mirror of
https://gitee.com/niucloud-team/niucloud.git
synced 2025-12-11 09:32:48 +00:00
同步uni-app
This commit is contained in:
parent
57d110237b
commit
16a8825962
@ -7,9 +7,9 @@ import useConfigStore from '@/stores/config'
|
|||||||
import useSystemStore from '@/stores/system'
|
import useSystemStore from '@/stores/system'
|
||||||
import { useLogin } from '@/hooks/useLogin'
|
import { useLogin } from '@/hooks/useLogin'
|
||||||
import { useShare } from '@/hooks/useShare'
|
import { useShare } from '@/hooks/useShare'
|
||||||
|
import { useLocation } from '@/hooks/useLocation'
|
||||||
|
const locationVal = useLocation(true);
|
||||||
onLaunch((data: any) => {
|
onLaunch((data: any) => {
|
||||||
|
|
||||||
// 添加初始化拦截器
|
// 添加初始化拦截器
|
||||||
launchInterceptor()
|
launchInterceptor()
|
||||||
const systemStore = useSystemStore()
|
const systemStore = useSystemStore()
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="diy-group" id="componentList">
|
<view class="diy-group" id="componentList">
|
||||||
<top-tabbar v-if="data.global && Object.keys(data.global).length && data.global.topStatusBar && data.global.topStatusBar.isShow"
|
<top-tabbar
|
||||||
|
v-if="data.global && Object.keys(data.global).length && data.global.topStatusBar && data.global.topStatusBar.isShow"
|
||||||
:scrollBool="diyGroup.componentsScrollBool.TopTabbar" ref="topTabbarRef" :data="data.global" />
|
:scrollBool="diyGroup.componentsScrollBool.TopTabbar" ref="topTabbarRef" :data="data.global" />
|
||||||
<pop-ads v-if="data.global && Object.keys(data.global).length && data.global.popWindow && data.global.popWindow.show" ref="popAbsRef" :data="data.global" />
|
<pop-ads
|
||||||
|
v-if="data.global && Object.keys(data.global).length && data.global.popWindow && data.global.popWindow.show"
|
||||||
|
ref="popAbsRef" :data="data.global" />
|
||||||
<template v-for="(component, index) in data.value" :key="component.id">
|
<template v-for="(component, index) in data.value" :key="component.id">
|
||||||
<view
|
<view v-show="component.componentIsShow" @click="diyStore.changeCurrentIndex(index, component)"
|
||||||
v-show="component.componentIsShow"
|
:class="diyGroup.getComponentClass(index,component)" :style="component.pageStyle">
|
||||||
@click="diyStore.changeCurrentIndex(index, component)"
|
<view class="relative"
|
||||||
:class="diyGroup.getComponentClass(index,component)" :style="component.pageStyle"
|
:style="{ marginTop : component.margin.top < 0 ? (component.margin.top * 2) + 'rpx' : '0', marginBottom : component.margin.bottom < 0 ? (component.margin.bottom * 2) + 'rpx' : '0' }">
|
||||||
>
|
|
||||||
<view class="relative" :style="{ marginTop : component.margin.top < 0 ? (component.margin.top * 2) + 'rpx' : '0', marginBottom : component.margin.bottom < 0 ? (component.margin.bottom * 2) + 'rpx' : '0' }">
|
|
||||||
|
|
||||||
<!-- 装修模式下,设置负上边距后超出的内容,禁止选中设置 -->
|
<!-- 装修模式下,设置负上边距后超出的内容,禁止选中设置 -->
|
||||||
<view v-if="diyGroup.isShowPlaceHolder(index,component)" class="absolute w-full z-1"
|
<view v-if="diyGroup.isShowPlaceHolder(index,component)" class="absolute w-full z-1"
|
||||||
@ -56,7 +57,8 @@
|
|||||||
<diy-float-btn :component="component" :global="data.global" :index="index" />
|
<diy-float-btn :component="component" :global="data.global" :index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'CarouselSearch'">
|
<template v-if="component.componentName == 'CarouselSearch'">
|
||||||
<diy-carousel-search :scrollBool="diyGroup.componentsScrollBool.CarouselSearch" :component="component" :global="data.global" :index="index" />
|
<diy-carousel-search :scrollBool="diyGroup.componentsScrollBool.CarouselSearch"
|
||||||
|
:component="component" :global="data.global" :index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'PictureShow'">
|
<template v-if="component.componentName == 'PictureShow'">
|
||||||
<diy-picture-show :component="component" :global="data.global" :index="index" />
|
<diy-picture-show :component="component" :global="data.global" :index="index" />
|
||||||
@ -65,61 +67,80 @@
|
|||||||
<diy-form-submit :component="component" :global="data.global" :index="index" />
|
<diy-form-submit :component="component" :global="data.global" :index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormInput'">
|
<template v-if="component.componentName == 'FormInput'">
|
||||||
<diy-form-input ref="diyFormInputRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-input ref="diyFormInputRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormTextarea'">
|
<template v-if="component.componentName == 'FormTextarea'">
|
||||||
<diy-form-textarea ref="diyFormTextareaRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-textarea ref="diyFormTextareaRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormIdentity'">
|
<template v-if="component.componentName == 'FormIdentity'">
|
||||||
<diy-form-identity ref="diyFormIdentityRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-identity ref="diyFormIdentityRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormEmail'">
|
<template v-if="component.componentName == 'FormEmail'">
|
||||||
<diy-form-email ref="diyFormEmailRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-email ref="diyFormEmailRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormMobile'">
|
<template v-if="component.componentName == 'FormMobile'">
|
||||||
<diy-form-mobile ref="diyFormMobileRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-mobile ref="diyFormMobileRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormWechatName'">
|
<template v-if="component.componentName == 'FormWechatName'">
|
||||||
<diy-form-wechat-name ref="diyFormWechatNameRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-wechat-name ref="diyFormWechatNameRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormNumber'">
|
<template v-if="component.componentName == 'FormNumber'">
|
||||||
<diy-form-number ref="diyFormNumberRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-number ref="diyFormNumberRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormRadio'">
|
<template v-if="component.componentName == 'FormRadio'">
|
||||||
<diy-form-radio ref="diyFormRadioRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-radio ref="diyFormRadioRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormCheckbox'">
|
<template v-if="component.componentName == 'FormCheckbox'">
|
||||||
<diy-form-checkbox ref="diyFormCheckboxRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-checkbox ref="diyFormCheckboxRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormTable'">
|
<template v-if="component.componentName == 'FormTable'">
|
||||||
<diy-form-table ref="diyFormTableRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-table ref="diyFormTableRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormDate'">
|
<template v-if="component.componentName == 'FormDate'">
|
||||||
<diy-form-date ref="diyFormDateRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-date ref="diyFormDateRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormDateScope'">
|
<template v-if="component.componentName == 'FormDateScope'">
|
||||||
<diy-form-date-scope ref="diyFormDateScopeRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-date-scope ref="diyFormDateScopeRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormTime'">
|
<template v-if="component.componentName == 'FormTime'">
|
||||||
<diy-form-time ref="diyFormTimeRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-time ref="diyFormTimeRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormTimeScope'">
|
<template v-if="component.componentName == 'FormTimeScope'">
|
||||||
<diy-form-time-scope ref="diyFormTimeScopeRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-time-scope ref="diyFormTimeScopeRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormLocation'">
|
<template v-if="component.componentName == 'FormLocation'">
|
||||||
<diy-form-location ref="diyFormLocationRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-location ref="diyFormLocationRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormAddress'">
|
<template v-if="component.componentName == 'FormAddress'">
|
||||||
<diy-form-address ref="diyFormAddressRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-address ref="diyFormAddressRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormImage'">
|
<template v-if="component.componentName == 'FormImage'">
|
||||||
<diy-form-image ref="diyFormImageRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-image ref="diyFormImageRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormVideo'">
|
<template v-if="component.componentName == 'FormVideo'">
|
||||||
<diy-form-video ref="diyFormVideoRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-video ref="diyFormVideoRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'FormFile'">
|
<template v-if="component.componentName == 'FormFile'">
|
||||||
<diy-form-file ref="diyFormFileRef" :component="component" :global="data.global" :index="index" />
|
<diy-form-file ref="diyFormFileRef" :component="component" :global="data.global"
|
||||||
|
:index="index" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
@ -127,13 +148,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="diyStore.mode == '' && data.global && diyGroup.showCopyright.value && data.global.copyright && data.global.copyright.isShow">
|
<template v-if="data.global && diyGroup.showCopyright.value && data.global.copyright && data.global.copyright.isShow">
|
||||||
<copy-right />
|
<copy-right :textColor="data.global.copyright.textColor" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="diyStore.mode == '' && data.global && data.global.bottomTabBar && data.global.bottomTabBar.isShow">
|
<template v-if="diyStore.mode == '' && data.global && data.global.bottomTabBar && data.global.bottomTabBar.isShow">
|
||||||
<view class="pt-[20rpx]"></view>
|
<view class="pt-[20rpx]"></view>
|
||||||
<tabbar :addon="data.global.bottomTabBar.designNav.key" />
|
<tabbar :addon="data.global.bottomTabBar.designNav?.key" />
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -146,7 +167,7 @@ import useDiyStore from '@/app/stores/diy';
|
|||||||
import { ref, getCurrentInstance } from 'vue';
|
import { ref, getCurrentInstance } from 'vue';
|
||||||
|
|
||||||
const props = defineProps(['data']);
|
const props = defineProps(['data']);
|
||||||
const instance: any = getCurrentInstance();
|
const instance : any = getCurrentInstance();
|
||||||
const getFormRef = () => {
|
const getFormRef = () => {
|
||||||
return {
|
return {
|
||||||
componentRefs: instance.refs
|
componentRefs: instance.refs
|
||||||
@ -155,6 +176,7 @@ const getFormRef = () => {
|
|||||||
|
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
|
|
||||||
const diyGroup = useDiyGroup({
|
const diyGroup = useDiyGroup({
|
||||||
...props,
|
...props,
|
||||||
getFormRef
|
getFormRef
|
||||||
|
|||||||
@ -102,7 +102,6 @@ export function useDiyGroup(params: any = {}) {
|
|||||||
}
|
}
|
||||||
// 新增:页面加载完成后,显示版权
|
// 新增:页面加载完成后,显示版权
|
||||||
showCopyright.value = true;
|
showCopyright.value = true;
|
||||||
console.log('组件加载完成', showCopyright.value);
|
|
||||||
|
|
||||||
}, 500)
|
}, 500)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -27,3 +27,87 @@ export function getShareInfo(params: Record<string, any>) {
|
|||||||
export function getMemberFormRecord() {
|
export function getMemberFormRecord() {
|
||||||
return request.get('diy/form/member_record')
|
return request.get('diy/form/member_record')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目列表供组件调用
|
||||||
|
*/
|
||||||
|
export function getGoodsComponents(params: Record<string, any>) {
|
||||||
|
return request.get(`home_service/goods/components`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 次卡套餐
|
||||||
|
* @param orderId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getFirstCard(orderId: number) {
|
||||||
|
return request.get(`home_service/member/firstCard`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品分类列表
|
||||||
|
*/
|
||||||
|
export function getGoodsCategoryList(params: Record<string, any>) {
|
||||||
|
return request.get(`home_service/goods/category/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取次卡列表供组件调用
|
||||||
|
*/
|
||||||
|
export function getCardComponents(params: Record<string, any>) {
|
||||||
|
return request.get(`home_service/card/components`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取优惠券、次卡
|
||||||
|
* @param orderId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getCouponCard(orderId: number) {
|
||||||
|
return request.get(`home_service/member/memberDiscountCount`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 技师信息
|
||||||
|
* @param params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getTechnicianInfo(params: Record<string, any>) {
|
||||||
|
return request.get(`home_service/technician/info`,params,{ showErrorMessage: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取门店信息
|
||||||
|
* @returns 门店信息数据
|
||||||
|
*/
|
||||||
|
export function getStoreInfo() {
|
||||||
|
return request.get('home_service/store/info',{},{ showErrorMessage: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 技师入驻申请资料
|
||||||
|
* @param params 技师入驻申请参数
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getTechnicianApply() {
|
||||||
|
return request.get(`home_service/technician/apply`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店入驻申请资料
|
||||||
|
* @param params 门店入驻申请参数
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getStoreApply() {
|
||||||
|
return request.get(`home_service/member/store/application`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,20 @@ export function pay(data : AnyObject) {
|
|||||||
return request.post(`pay`, data, { showErrorMessage: true })
|
return request.post(`pay`, data, { showErrorMessage: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试支付
|
||||||
|
*/
|
||||||
|
export function testPay(data : AnyObject) {
|
||||||
|
return request.get(`home_service/pay/pay`, data, { showErrorMessage: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取支付信息
|
* 获取支付信息
|
||||||
*/
|
*/
|
||||||
export function getPayInfo(tradeType : string, tradeId : number, params: Record<string, any>) {
|
export function getPayInfo(tradeType : string, tradeId : number, params: Record<string, any>) {
|
||||||
return request.get(`pay/info/${tradeType}/${tradeId}`, params, { showErrorMessage: true })
|
return request.get(`pay/info/${tradeType}/${tradeId}`, params, { showErrorMessage: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,12 +17,19 @@
|
|||||||
import { t } from '@/locale'
|
import { t } from '@/locale'
|
||||||
import { img } from '@/utils/common';
|
import { img } from '@/utils/common';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
const sendMessageTitle = ref('')
|
const sendMessageTitle = ref('')
|
||||||
const sendMessagePath = ref('')
|
const sendMessagePath = ref('')
|
||||||
const sendMessageImg = ref('')
|
const sendMessageImg = ref('')
|
||||||
|
|
||||||
sendMessageImg.value = img('static/resource/images/member/contact_service.png')
|
sendMessageImg.value = img('static/resource/images/member/contact_service.png')
|
||||||
|
|
||||||
|
onLoad((data: any) => {
|
||||||
|
data.send_title && (sendMessageTitle.value = data.send_title)
|
||||||
|
data.send_path && (sendMessagePath.value = decodeURIComponent(data.send_path))
|
||||||
|
data.send_img && (sendMessageImg.value = decodeURIComponent(data.send_img))
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -47,6 +47,7 @@ const useDiyStore = defineStore('diy', {
|
|||||||
copyright:{
|
copyright:{
|
||||||
control: true, // 是否允许展示编辑
|
control: true, // 是否允许展示编辑
|
||||||
isShow: false, // 是否显示
|
isShow: false, // 是否显示
|
||||||
|
textColor: '#ccc',
|
||||||
},
|
},
|
||||||
bgUrl: ''
|
bgUrl: ''
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,18 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="flex flex-col justify-center items-center p-[30rpx] ">
|
<view>
|
||||||
|
<template v-if="diyStore.mode == 'decorate'">
|
||||||
|
<view class="flex flex-col justify-center items-center p-[30rpx] text-[22rpx]" :style="{ color:textColor}">
|
||||||
|
示例版权信息
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<tempalte v-else>
|
||||||
|
<view class="flex flex-col justify-center items-center p-[30rpx]" :style="{ color:textColor}">
|
||||||
<img :src="img(systemStore.copyright.logo)" mode="heightFix" class="max-h-[60rpx]" v-if="systemStore.copyright?.logo" />
|
<img :src="img(systemStore.copyright.logo)" mode="heightFix" class="max-h-[60rpx]" v-if="systemStore.copyright?.logo" />
|
||||||
<view class="text-[#666] text-[22rpx] mt-[20rpx]" v-if="systemStore.copyright?.copyright_desc" @click="systemStore.copyright?.copyright_link && redirect({ url: systemStore.copyright.copyright_link})">
|
<view class="text-[22rpx] mt-[20rpx]" v-if="systemStore.copyright?.copyright_desc" @click="systemStore.copyright?.copyright_link && redirect({ url: systemStore.copyright.copyright_link})">
|
||||||
{{ systemStore.copyright.copyright_desc }}
|
{{ systemStore.copyright.copyright_desc }}
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#666] text-[22rpx] mt-[20rpx]" v-if="systemStore.copyright?.icp">
|
<view class="text-[22rpx] mt-[20rpx]" v-if="systemStore.copyright?.icp">
|
||||||
备案号:{{ systemStore.copyright.icp }}
|
备案号:{{ systemStore.copyright.icp }}
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#666] text-[22rpx] mt-[20rpx] flex items-center" v-if="systemStore.copyright?.gov_record" @click="systemStore.copyright?.gov_url && redirect({ url: systemStore.copyright.gov_url})">
|
<view class="text-[22rpx] mt-[20rpx] flex items-center" v-if="systemStore.copyright?.gov_record" @click="systemStore.copyright?.gov_url && redirect({ url: systemStore.copyright.gov_url})">
|
||||||
<img :src="img('static/resource/images/copy_right.png')" mode="heightFix" class="w-[28rpx] h-[28rpx] mr-[10rpx]" />
|
<img :src="img('static/resource/images/copy_right.png')" mode="heightFix" class="w-[28rpx] h-[28rpx] mr-[10rpx]" />
|
||||||
{{ systemStore.copyright.gov_record }}
|
{{ systemStore.copyright.gov_record }}
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<!-- <view class="h-[100rpx]"></view> -->
|
</tempalte>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -21,6 +28,16 @@ import { ref, nextTick } from 'vue'
|
|||||||
import { redirect,img } from '@/utils/common'
|
import { redirect,img } from '@/utils/common'
|
||||||
import useSystemStore from '@/stores/system';
|
import useSystemStore from '@/stores/system';
|
||||||
const systemStore = useSystemStore()
|
const systemStore = useSystemStore()
|
||||||
|
import useDiyStore from '@/app/stores/diy';
|
||||||
|
|
||||||
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
|
const prop = defineProps({
|
||||||
|
textColor: {
|
||||||
|
type: String,
|
||||||
|
default: '#ccc'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,9 @@
|
|||||||
:send-message-title="props.sendMessageTitle"
|
:send-message-title="props.sendMessageTitle"
|
||||||
:send-message-path="props.sendMessagePath"
|
:send-message-path="props.sendMessagePath"
|
||||||
:send-message-img="props.sendMessageImg"
|
:send-message-img="props.sendMessageImg"
|
||||||
:show-message-card="true">
|
:show-message-card="true"
|
||||||
|
@contact="handleContact"
|
||||||
|
>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<u-popup :show="popupShow" @close="popupShow = false" mode="center" :round="5" :safeAreaInsetBottom="false">
|
<u-popup :show="popupShow" @close="popupShow = false" mode="center" :round="5" :safeAreaInsetBottom="false">
|
||||||
@ -33,6 +35,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import useSystemStore from '@/stores/system'
|
import useSystemStore from '@/stores/system'
|
||||||
|
import { redirect } from '@/utils/common';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
sendMessageTitle: {
|
sendMessageTitle: {
|
||||||
@ -70,6 +73,12 @@ const callPhone = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleContact = (e) => {
|
||||||
|
if (e.detail && e.detail.path) {
|
||||||
|
redirect({ mode: 'redirectTo', url: e.detail.path, param: e.detail.query || {} })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({})
|
defineExpose({})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="btn-wrap">
|
<view class="btn-wrap">
|
||||||
<button class="primary-btn-bg btn" hover-class="none" :loading="loading" @click="confirmPay">{{ t('pay.confirmPay') }}</button>
|
<button class="primary-btn-bg bg-[var(--primary-color)] btn" hover-class="none" :loading="loading" @click="confirmPay">{{ t('pay.confirmPay') }}</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { t } from '@/locale'
|
import { t } from '@/locale'
|
||||||
import { getPayInfo, pay } from '@/app/api/pay'
|
import { getPayInfo, pay,testPay } from '@/app/api/pay'
|
||||||
import { img, redirect, isWeixinBrowser, moneyFormat } from '@/utils/common'
|
import { img, redirect, isWeixinBrowser, moneyFormat } from '@/utils/common'
|
||||||
import wechat from '@/utils/wechat'
|
import wechat from '@/utils/wechat'
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,7 @@ const props = defineProps({
|
|||||||
const emits = defineEmits(['close'])
|
const emits = defineEmits(['close'])
|
||||||
|
|
||||||
const sharePopupShow = ref(false);
|
const sharePopupShow = ref(false);
|
||||||
|
const posterType = ref(props.posterType)
|
||||||
|
|
||||||
// 复制
|
// 复制
|
||||||
const copyUrl = () => {
|
const copyUrl = () => {
|
||||||
@ -134,7 +135,8 @@ const copyUrl = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const openShare = () => {
|
const openShare = (data: any) => {
|
||||||
|
posterType.value = data?.type || posterType.value || ''
|
||||||
sharePopupShow.value = true
|
sharePopupShow.value = true
|
||||||
loadPoster();
|
loadPoster();
|
||||||
}
|
}
|
||||||
@ -154,7 +156,7 @@ const loadPoster = () => {
|
|||||||
isPosterImg.value = false;
|
isPosterImg.value = false;
|
||||||
let obj = {
|
let obj = {
|
||||||
id: props.posterId,
|
id: props.posterId,
|
||||||
type: props.posterType,
|
type: posterType.value,
|
||||||
param: props.posterParam
|
param: props.posterParam
|
||||||
}
|
}
|
||||||
let startTime = Date.parse(new Date());
|
let startTime = Date.parse(new Date());
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, getCurrentInstance, nextTick } from 'vue';
|
import { ref, computed, onMounted, getCurrentInstance, nextTick } from 'vue';
|
||||||
import { redirect, img } from '@/utils/common';
|
import { redirect, img ,currRoute} from '@/utils/common';
|
||||||
import useSystemStore from '@/stores/system';
|
import useSystemStore from '@/stores/system';
|
||||||
import useDiyStore from '@/app/stores/diy';
|
import useDiyStore from '@/app/stores/diy';
|
||||||
import { useLocation } from '@/hooks/useLocation'
|
import { useLocation } from '@/hooks/useLocation'
|
||||||
@ -192,7 +192,9 @@ if (componentsScrollVal) {
|
|||||||
let pages = getCurrentPages();
|
let pages = getCurrentPages();
|
||||||
const isBackShow = computed(() => {
|
const isBackShow = computed(() => {
|
||||||
let bool = false;
|
let bool = false;
|
||||||
if (props.isBack) {
|
if (props.isBack && pages.length > 1) {
|
||||||
|
bool = true;
|
||||||
|
} else if (currRoute() == 'app/pages/auth/index') {
|
||||||
bool = true;
|
bool = true;
|
||||||
}
|
}
|
||||||
return bool;
|
return bool;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import { getWechatAuthCode } from '@/app/api/system'
|
|||||||
import useMemberStore from '@/stores/member'
|
import useMemberStore from '@/stores/member'
|
||||||
import useConfigStore from '@/stores/config'
|
import useConfigStore from '@/stores/config'
|
||||||
import useSystemStore from '@/stores/system'
|
import useSystemStore from '@/stores/system'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
export function useLogin() {
|
export function useLogin() {
|
||||||
/**
|
/**
|
||||||
@ -84,20 +85,44 @@ export function useLogin() {
|
|||||||
/**
|
/**
|
||||||
* 执行登录后跳转
|
* 执行登录后跳转
|
||||||
*/
|
*/
|
||||||
const handleLoginBack = () => {
|
const ler = ref(0)
|
||||||
|
const handleLoginBack = (e) => {
|
||||||
|
ler.value = e
|
||||||
uni.removeStorageSync('autoLoginLock')
|
uni.removeStorageSync('autoLoginLock')
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: 'loginBack',
|
key: 'loginBack',
|
||||||
success: (res: any) => {
|
success: (res: any) => {
|
||||||
|
if(ler.value == 1){
|
||||||
|
redirect({
|
||||||
|
url:'/addon/home_service/technician/pages/member/index',
|
||||||
|
mode: 'redirectTo'
|
||||||
|
})
|
||||||
|
}else if(ler.value == 2){
|
||||||
|
redirect({
|
||||||
|
url:'/addon/home_service/store/pages/member/index',
|
||||||
|
mode: 'redirectTo'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
res ? redirect(
|
res ? redirect(
|
||||||
{
|
{
|
||||||
...res.data,
|
...res.data,
|
||||||
mode: 'redirectTo'
|
mode: 'redirectTo'
|
||||||
}
|
}
|
||||||
) : redirect({ url: '/app/pages/index/index', mode: 'switchTab' })
|
) : redirect({ url: '/app/pages/index/index', mode: 'switchTab' })
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
redirect({ url: '/app/pages/index/index', mode: 'switchTab' })
|
console.log(ler.value)
|
||||||
|
if(ler.value==1){
|
||||||
|
redirect({ url:'/addon/home_service/technician/pages/member/index', mode: 'switchTab' })
|
||||||
|
|
||||||
|
}else if(ler.value==2){
|
||||||
|
redirect({ url:'/addon/home_service/store/pages/member/index', mode: 'switchTab' })
|
||||||
|
}else{
|
||||||
|
redirect({ url:'/app/pages/index/index', mode: 'switchTab' })
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,5 +155,8 @@
|
|||||||
"shop_fenxiao.orderNo": "订单号",
|
"shop_fenxiao.orderNo": "订单号",
|
||||||
"shop_giftcard.actualPayment": "实付款",
|
"shop_giftcard.actualPayment": "实付款",
|
||||||
"shop_giftcard.orderClose": "关闭订单",
|
"shop_giftcard.orderClose": "关闭订单",
|
||||||
"shop_giftcard.orderNo": "订单号"
|
"shop_giftcard.orderNo": "订单号",
|
||||||
|
"notHave": "无",
|
||||||
|
"onceCard": "次卡",
|
||||||
|
"cardUnit": "张"
|
||||||
}
|
}
|
||||||
@ -1,36 +1,36 @@
|
|||||||
{
|
{
|
||||||
"name": "",
|
"name" : "",
|
||||||
"appid": "__UNI__9B03DBD",
|
"appid" : "__UNI__9B03DBD",
|
||||||
"description": "",
|
"description" : "",
|
||||||
"versionName": "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode": "100",
|
"versionCode" : "100",
|
||||||
"transformPx": false,
|
"transformPx" : false,
|
||||||
"app-plus": {
|
"app-plus" : {
|
||||||
"compatible": {
|
"compatible" : {
|
||||||
"ignoreVersion": true
|
"ignoreVersion" : true
|
||||||
},
|
},
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler": "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion": 3,
|
"compilerVersion" : 3,
|
||||||
"splashscreen": {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender": true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting": true,
|
"waiting" : true,
|
||||||
"autoclose": true,
|
"autoclose" : true,
|
||||||
"delay": 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
"modules": {
|
"modules" : {
|
||||||
"Camera": {},
|
"Camera" : {},
|
||||||
"Barcode": {},
|
"Barcode" : {},
|
||||||
"Contacts": {},
|
"Contacts" : {},
|
||||||
"Geolocation": {},
|
"Geolocation" : {},
|
||||||
"Payment": {},
|
"Payment" : {},
|
||||||
"VideoPlayer": {},
|
"VideoPlayer" : {},
|
||||||
"Maps": {},
|
"Maps" : {},
|
||||||
"Share": {}
|
"Share" : {}
|
||||||
},
|
},
|
||||||
"distribute": {
|
"distribute" : {
|
||||||
"android": {
|
"android" : {
|
||||||
"permissions": [
|
"permissions" : [
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
@ -48,71 +48,67 @@
|
|||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ios": {
|
"ios" : {
|
||||||
"dSYMs": false
|
"dSYMs" : false
|
||||||
},
|
},
|
||||||
"sdkConfigs": {
|
"sdkConfigs" : {
|
||||||
"maps": {
|
"maps" : {
|
||||||
"tencent": {
|
"tencent" : {
|
||||||
"key": "6ZDBZ-CLSLX-66747-7MVM4-HLK47-XMBXU"
|
"key" : "6ZDBZ-CLSLX-66747-7MVM4-HLK47-XMBXU"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"quickapp": {},
|
"quickapp" : {},
|
||||||
"mp-weixin": {
|
"mp-weixin" : {
|
||||||
"appid": "",
|
"appid" : "",
|
||||||
"setting": {
|
"setting" : {
|
||||||
"urlCheck": false
|
"urlCheck" : false
|
||||||
},
|
},
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"permission": {
|
"permission" : {
|
||||||
"scope.userLocation": {
|
"scope.userLocation" : {
|
||||||
"desc": "为了更好地为您提供服务"
|
"desc" : "为了更好地为您提供服务"
|
||||||
},
|
},
|
||||||
"scope.writePhotosAlbum": {
|
"scope.writePhotosAlbum" : {
|
||||||
"desc": "为了更好地为您提供服务"
|
"desc" : "为了更好地为您提供服务"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiredPrivateInfos": [
|
"requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress" ],
|
||||||
"chooseLocation",
|
"__usePrivacyCheck__" : true
|
||||||
"getLocation",
|
|
||||||
"chooseAddress"
|
|
||||||
],
|
|
||||||
"__usePrivacyCheck__": true
|
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay" : {
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"mp-baidu": {
|
"mp-baidu" : {
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"mp-toutiao": {
|
"mp-toutiao" : {
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"uniStatistics": {
|
"uniStatistics" : {
|
||||||
"enable": false
|
"enable" : false
|
||||||
},
|
},
|
||||||
"vueVersion": "3",
|
"vueVersion" : "3",
|
||||||
"h5": {
|
"h5" : {
|
||||||
"router": {
|
"router" : {
|
||||||
"mode": "history",
|
"mode" : "history",
|
||||||
"base": "/wap/"
|
"base" : "/wap/"
|
||||||
},
|
},
|
||||||
"sdkConfigs": {
|
"sdkConfigs" : {
|
||||||
"maps": {
|
"maps" : {
|
||||||
"qqmap": {
|
"qqmap" : {
|
||||||
"key": ""
|
"key" : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"async": {
|
"async" : {
|
||||||
"loading": "",
|
"loading" : "",
|
||||||
"error": "",
|
"error" : "",
|
||||||
"delay": 0,
|
"delay" : 0,
|
||||||
"timeout": 3000
|
"timeout" : 3000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fallbackLocale": "zh-Hans"
|
"fallbackLocale" : "zh-Hans"
|
||||||
}
|
}
|
||||||
@ -1,8 +1,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 3952239 */
|
font-family: "iconfont";
|
||||||
src: url('https://at.alicdn.com/t/c/font_3952239_yxckpayhvp.woff2?t=1755857288182') format('woff2'),
|
/* Project id 3952239 */
|
||||||
url('https://at.alicdn.com/t/c/font_3952239_yxckpayhvp.woff?t=1755857288182') format('woff'),
|
src: url('//at.alicdn.com/t/c/font_3952239_waynfpfdr5.woff2?t=1762225321119') format('woff2'),
|
||||||
url('https://at.alicdn.com/t/c/font_3952239_yxckpayhvp.ttf?t=1755857288182') format('truetype');
|
url('//at.alicdn.com/t/c/font_3952239_waynfpfdr5.woff?t=1762225321119') format('woff'),
|
||||||
|
url('//at.alicdn.com/t/c/font_3952239_waynfpfdr5.ttf?t=1762225321119') format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
@ -13,6 +14,54 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icondingdanzhongxinPC-3:before {
|
||||||
|
content: "\e7af";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconshangchuantupian:before {
|
||||||
|
content: "\e6e9";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconnew_icon_bianjiqi_chexiao_keyong:before {
|
||||||
|
content: "\e64a";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconnew_icon_bianjiqi_zhongzuo_keyong:before {
|
||||||
|
content: "\e64b";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconbiaotizhengwenqiehuan:before {
|
||||||
|
content: "\e6e2";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconjuyouduiqi:before {
|
||||||
|
content: "\e6e6";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconbianjiqifengexian:before {
|
||||||
|
content: "\e6eb";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconbianjiqijuzhongduiqi:before {
|
||||||
|
content: "\e6ec";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconzitijiacu:before {
|
||||||
|
content: "\ec83";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconzitixiahuaxian:before {
|
||||||
|
content: "\ec85";
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconzitixieti:before {
|
||||||
|
content: "\ec86";
|
||||||
|
}
|
||||||
|
|
||||||
|
.icont:before {
|
||||||
|
content: "\eb24";
|
||||||
|
}
|
||||||
|
|
||||||
.iconjiahaoV6xx1:before {
|
.iconjiahaoV6xx1:before {
|
||||||
content: "\e7cc";
|
content: "\e7cc";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,14 @@ import { getTabbarPages } from './pages'
|
|||||||
import useDiyStore from '@/app/stores/diy'
|
import useDiyStore from '@/app/stores/diy'
|
||||||
import useMemberStore from '@/stores/member'
|
import useMemberStore from '@/stores/member'
|
||||||
import useSystemStore from '@/stores/system'
|
import useSystemStore from '@/stores/system'
|
||||||
|
import wechat from '@/utils/wechat'
|
||||||
import useConfigStore from '@/stores/config'
|
import useConfigStore from '@/stores/config'
|
||||||
import { getNeedLoginPages } from '@/utils/pages'
|
import { getNeedLoginPages } from '@/utils/pages'
|
||||||
|
import { useLocation } from '@/hooks/useLocation'
|
||||||
/**
|
/**
|
||||||
* 跳转页面
|
* 跳转页面
|
||||||
*/
|
*/
|
||||||
export const redirect = (redirect: any) => {
|
export const redirect = (redirect : any) => {
|
||||||
// 装修模式禁止跳转
|
// 装修模式禁止跳转
|
||||||
if (useDiyStore().mode == 'decorate') return
|
if (useDiyStore().mode == 'decorate') return
|
||||||
|
|
||||||
@ -90,7 +91,6 @@ export const redirect = (redirect: any) => {
|
|||||||
if (newLogin) {
|
if (newLogin) {
|
||||||
uni.setStorage({ key: 'loginBack', data: { url: originalUrl } });
|
uni.setStorage({ key: 'loginBack', data: { url: originalUrl } });
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 'switchTab':
|
case 'switchTab':
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
@ -155,7 +155,7 @@ export const redirect = (redirect: any) => {
|
|||||||
* 自定义跳转链接
|
* 自定义跳转链接
|
||||||
* @param {Object} link
|
* @param {Object} link
|
||||||
*/
|
*/
|
||||||
export const diyRedirect = (link: any) => {
|
export const diyRedirect = (link : any) => {
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
// 装修模式禁止跳转
|
// 装修模式禁止跳转
|
||||||
if (diyStore.mode == 'decorate') return;
|
if (diyStore.mode == 'decorate') return;
|
||||||
@ -211,7 +211,7 @@ export const currRoute = () => {
|
|||||||
|
|
||||||
// 获取分享路由
|
// 获取分享路由
|
||||||
export const currShareRoute = () => {
|
export const currShareRoute = () => {
|
||||||
const pages: any = getCurrentPages()
|
const pages : any = getCurrentPages()
|
||||||
if (pages.length == 0) {
|
if (pages.length == 0) {
|
||||||
return {
|
return {
|
||||||
path: '/',
|
path: '/',
|
||||||
@ -221,15 +221,15 @@ export const currShareRoute = () => {
|
|||||||
let currentRoute = pages[pages.length - 1].route //获取当前页面路由
|
let currentRoute = pages[pages.length - 1].route //获取当前页面路由
|
||||||
|
|
||||||
// #ifndef MP
|
// #ifndef MP
|
||||||
let currentParam: any = pages[pages.length - 1].$page.options; //获取路由参数
|
let currentParam : any = pages[pages.length - 1].$page.options; //获取路由参数
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
let currentParam: any = pages[pages.length - 1].options || {}; //获取路由参数
|
let currentParam : any = pages[pages.length - 1].options || {}; //获取路由参数
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 拼接参数
|
// 拼接参数
|
||||||
let params: any = {};
|
let params : any = {};
|
||||||
for (let key in currentParam) {
|
for (let key in currentParam) {
|
||||||
params[key] = currentParam[key]
|
params[key] = currentParam[key]
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ export const currShareRoute = () => {
|
|||||||
* 获取token
|
* 获取token
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getToken(): null | string {
|
export function getToken() : null | string {
|
||||||
return useMemberStore().token
|
return useMemberStore().token
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ export function getToken(): null | string {
|
|||||||
* @param token
|
* @param token
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function setToken(token: string): void {
|
export function setToken(token : string) : void {
|
||||||
uni.setStorageSync(import.meta.env.VITE_REQUEST_STORAGE_TOKEN_KEY, token)
|
uni.setStorageSync(import.meta.env.VITE_REQUEST_STORAGE_TOKEN_KEY, token)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ export function setToken(token: string): void {
|
|||||||
* 移除token
|
* 移除token
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function removeToken(): void {
|
export function removeToken() : void {
|
||||||
uni.removeStorageSync(import.meta.env.VITE_REQUEST_STORAGE_TOKEN_KEY)
|
uni.removeStorageSync(import.meta.env.VITE_REQUEST_STORAGE_TOKEN_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ export function urlDeconstruction(url: string) {
|
|||||||
const query: any = {}
|
const query: any = {}
|
||||||
const [path, param] = url.split('?')
|
const [path, param] = url.split('?')
|
||||||
|
|
||||||
param && param.split('&').forEach((str: string) => {
|
param && param.split('&').forEach((str : string) => {
|
||||||
let [name, value] = str.split('=')
|
let [name, value] = str.split('=')
|
||||||
query[name] = value
|
query[name] = value
|
||||||
})
|
})
|
||||||
@ -286,7 +286,7 @@ export function urlDeconstruction(url: string) {
|
|||||||
* @param str
|
* @param str
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function isUrl(str: string): boolean {
|
export function isUrl(str : string) : boolean {
|
||||||
return str && (str.indexOf('http://') != -1 || str.indexOf('https://') != -1) || false
|
return str && (str.indexOf('http://') != -1 || str.indexOf('https://') != -1) || false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ export function isUrl(str: string): boolean {
|
|||||||
* @param path
|
* @param path
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function img(path: string): string {
|
export function img(path : string) : string {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
let imgDomain = import.meta.env.VITE_IMG_DOMAIN || location.origin
|
let imgDomain = import.meta.env.VITE_IMG_DOMAIN || location.origin
|
||||||
// #endif
|
// #endif
|
||||||
@ -314,7 +314,7 @@ export function img(path: string): string {
|
|||||||
* @param path
|
* @param path
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getUrl(path: string): string {
|
export function getUrl(path : string) : string {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
let urlDomain = import.meta.env.VITE_IMG_DOMAIN || location.origin
|
let urlDomain = import.meta.env.VITE_IMG_DOMAIN || location.origin
|
||||||
// #endif
|
// #endif
|
||||||
@ -332,14 +332,14 @@ export function getUrl(path: string): string {
|
|||||||
/**
|
/**
|
||||||
* 手机号隐藏
|
* 手机号隐藏
|
||||||
*/
|
*/
|
||||||
export function mobileHide(mobile: string) {
|
export function mobileHide(mobile : string) {
|
||||||
return mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
return mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否是微信浏览器
|
* 判断是否是微信浏览器
|
||||||
*/
|
*/
|
||||||
export function isWeixinBrowser(): boolean {
|
export function isWeixinBrowser() : boolean {
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
return false
|
return false
|
||||||
// #endif
|
// #endif
|
||||||
@ -350,7 +350,7 @@ export function isWeixinBrowser(): boolean {
|
|||||||
/**
|
/**
|
||||||
* 获取应用场景值
|
* 获取应用场景值
|
||||||
*/
|
*/
|
||||||
export function getAppChannel(): string {
|
export function getAppChannel() : string {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
return 'app'
|
return 'app'
|
||||||
// #endif
|
// #endif
|
||||||
@ -365,21 +365,21 @@ export function getAppChannel(): string {
|
|||||||
/**
|
/**
|
||||||
* 金额格式化
|
* 金额格式化
|
||||||
*/
|
*/
|
||||||
export function moneyFormat(money: string): string {
|
export function moneyFormat(money : string) : string {
|
||||||
return isNaN(parseFloat(money)) ? money : parseFloat(money).toFixed(2)
|
return isNaN(parseFloat(money)) ? money : parseFloat(money).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号隐藏
|
* 手机号隐藏
|
||||||
*/
|
*/
|
||||||
export function mobileConceal(mobile: string): string {
|
export function mobileConceal(mobile : string) : string {
|
||||||
return mobile.substring(0, 3) + "****" + mobile.substr(mobile.length - 4);
|
return mobile.substring(0, 3) + "****" + mobile.substr(mobile.length - 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取站点id
|
* 获取站点id
|
||||||
*/
|
*/
|
||||||
export function getSiteId(siteId: number | string) {
|
export function getSiteId(siteId : number | string) {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
const match = location.href.match(/\/wap\/(\d*)\//);
|
const match = location.href.match(/\/wap\/(\d*)\//);
|
||||||
match && (siteId = match[1])
|
match && (siteId = match[1])
|
||||||
@ -400,19 +400,19 @@ export function getSiteId(siteId: number | string) {
|
|||||||
* @param timeStamp
|
* @param timeStamp
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
export function timeStampTurnTime(timeStamp: any, type = "") {
|
export function timeStampTurnTime(timeStamp : any, type = "") {
|
||||||
if (timeStamp != undefined && timeStamp != "" && timeStamp > 0) {
|
if (timeStamp != undefined && timeStamp != "" && timeStamp > 0) {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setTime(timeStamp * 1000);
|
date.setTime(timeStamp * 1000);
|
||||||
const y = date.getFullYear();
|
const y = date.getFullYear();
|
||||||
let m: any = date.getMonth() + 1;
|
let m : any = date.getMonth() + 1;
|
||||||
m = m < 10 ? ('0' + m) : m;
|
m = m < 10 ? ('0' + m) : m;
|
||||||
let d: any = date.getDate();
|
let d : any = date.getDate();
|
||||||
d = d < 10 ? ('0' + d) : d;
|
d = d < 10 ? ('0' + d) : d;
|
||||||
let h: any = date.getHours();
|
let h : any = date.getHours();
|
||||||
h = h < 10 ? ('0' + h) : h;
|
h = h < 10 ? ('0' + h) : h;
|
||||||
let minute: any = date.getMinutes();
|
let minute : any = date.getMinutes();
|
||||||
let second: any = date.getSeconds();
|
let second : any = date.getSeconds();
|
||||||
minute = minute < 10 ? ('0' + minute) : minute;
|
minute = minute < 10 ? ('0' + minute) : minute;
|
||||||
second = second < 10 ? ('0' + second) : second;
|
second = second < 10 ? ('0' + second) : second;
|
||||||
if (type) {
|
if (type) {
|
||||||
@ -433,7 +433,7 @@ export function timeStampTurnTime(timeStamp: any, type = "") {
|
|||||||
* 日期格式转时间戳
|
* 日期格式转时间戳
|
||||||
* @param dateStr
|
* @param dateStr
|
||||||
*/
|
*/
|
||||||
export function timeTurnTimeStamp(dateStr: string) {
|
export function timeTurnTimeStamp(dateStr : string) {
|
||||||
// 输入验证
|
// 输入验证
|
||||||
if (!dateStr || typeof dateStr !== 'string' || dateStr.trim() === '') {
|
if (!dateStr || typeof dateStr !== 'string' || dateStr.trim() === '') {
|
||||||
return null;
|
return null;
|
||||||
@ -446,22 +446,22 @@ export function timeTurnTimeStamp(dateStr: string) {
|
|||||||
// 'YYYY年M月D日' -> 'YYYY-MM-DD'
|
// 'YYYY年M月D日' -> 'YYYY-MM-DD'
|
||||||
{
|
{
|
||||||
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日/,
|
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日/,
|
||||||
transform: (str: string) => str.replace(/(\d{4})年(\d{1,2})月(\d{1,2})日/, '$1-$2-$3')
|
transform: (str : string) => str.replace(/(\d{4})年(\d{1,2})月(\d{1,2})日/, '$1-$2-$3')
|
||||||
},
|
},
|
||||||
// 'YYYY年M月D日 HH时mm分' -> 'YYYY-MM-DD HH:mm'
|
// 'YYYY年M月D日 HH时mm分' -> 'YYYY-MM-DD HH:mm'
|
||||||
{
|
{
|
||||||
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/,
|
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/,
|
||||||
transform: (str: string) => str.replace(/(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/, '$1-$2-$3 $4:$5')
|
transform: (str : string) => str.replace(/(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/, '$1-$2-$3 $4:$5')
|
||||||
},
|
},
|
||||||
// 'YYYY/MM/DD' -> 'YYYY-MM-DD'
|
// 'YYYY/MM/DD' -> 'YYYY-MM-DD'
|
||||||
{
|
{
|
||||||
pattern: /^\d{4}\/\d{1,2}\/\d{1,2}(\s+\d{1,2}:\d{1,2}(:\d{1,2})?)?$/,
|
pattern: /^\d{4}\/\d{1,2}\/\d{1,2}(\s+\d{1,2}:\d{1,2}(:\d{1,2})?)?$/,
|
||||||
transform: (str: string) => str.replace(/\//g, '-')
|
transform: (str : string) => str.replace(/\//g, '-')
|
||||||
},
|
},
|
||||||
// 标准格式,无需转换
|
// 标准格式,无需转换
|
||||||
{
|
{
|
||||||
pattern: /^\d{4}-\d{1,2}-\d{1,2}(\s+\d{1,2}:\d{1,2}(:\d{1,2})?)?$/,
|
pattern: /^\d{4}-\d{1,2}-\d{1,2}(\s+\d{1,2}:\d{1,2}(:\d{1,2})?)?$/,
|
||||||
transform: (str: string) => str
|
transform: (str : string) => str
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ export function timeTurnTimeStamp(dateStr: string) {
|
|||||||
* 日期格式转时间戳 (兼容 iOS)
|
* 日期格式转时间戳 (兼容 iOS)
|
||||||
* @param dateStr
|
* @param dateStr
|
||||||
*/
|
*/
|
||||||
export function timeTurnTimeStampTwo(dateStr: string) {
|
export function timeTurnTimeStampTwo(dateStr : string) {
|
||||||
if (!dateStr || typeof dateStr !== 'string' || dateStr.trim() === '') {
|
if (!dateStr || typeof dateStr !== 'string' || dateStr.trim() === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -507,13 +507,13 @@ export function timeTurnTimeStampTwo(dateStr: string) {
|
|||||||
// 'YYYY年M月D日'
|
// 'YYYY年M月D日'
|
||||||
{
|
{
|
||||||
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日/,
|
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日/,
|
||||||
transform: (str: string) =>
|
transform: (str : string) =>
|
||||||
str.replace(/(\d{4})年(\d{1,2})月(\d{1,2})日/, '$1/$2/$3'),
|
str.replace(/(\d{4})年(\d{1,2})月(\d{1,2})日/, '$1/$2/$3'),
|
||||||
},
|
},
|
||||||
// 'YYYY年M月D日 HH时mm分'
|
// 'YYYY年M月D日 HH时mm分'
|
||||||
{
|
{
|
||||||
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/,
|
pattern: /(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/,
|
||||||
transform: (str: string) =>
|
transform: (str : string) =>
|
||||||
str.replace(
|
str.replace(
|
||||||
/(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/,
|
/(\d{4})年(\d{1,2})月(\d{1,2})日\s+(\d{1,2})时(\d{1,2})分/,
|
||||||
'$1/$2/$3 $4:$5'
|
'$1/$2/$3 $4:$5'
|
||||||
@ -522,22 +522,22 @@ export function timeTurnTimeStampTwo(dateStr: string) {
|
|||||||
// 'YYYY-MM-DD HH:mm:ss' -> 'YYYY/MM/DD HH:mm:ss' (iOS兼容)
|
// 'YYYY-MM-DD HH:mm:ss' -> 'YYYY/MM/DD HH:mm:ss' (iOS兼容)
|
||||||
{
|
{
|
||||||
pattern: /^\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{1,2}(:\d{1,2})?$/,
|
pattern: /^\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{1,2}(:\d{1,2})?$/,
|
||||||
transform: (str: string) => str.replace(/-/g, '/'),
|
transform: (str : string) => str.replace(/-/g, '/'),
|
||||||
},
|
},
|
||||||
// 'YYYY-MM-DD' -> 'YYYY/MM/DD' (iOS兼容)
|
// 'YYYY-MM-DD' -> 'YYYY/MM/DD' (iOS兼容)
|
||||||
{
|
{
|
||||||
pattern: /^\d{4}-\d{1,2}-\d{1,2}$/,
|
pattern: /^\d{4}-\d{1,2}-\d{1,2}$/,
|
||||||
transform: (str: string) => str.replace(/-/g, '/'),
|
transform: (str : string) => str.replace(/-/g, '/'),
|
||||||
},
|
},
|
||||||
// 'YYYY/MM/DD' / 'YYYY/MM/DD HH:mm:ss'
|
// 'YYYY/MM/DD' / 'YYYY/MM/DD HH:mm:ss'
|
||||||
{
|
{
|
||||||
pattern: /^\d{4}\/\d{1,2}\/\d{1,2}(\s+\d{1,2}:\d{1,2}(:\d{1,2})?)?$/,
|
pattern: /^\d{4}\/\d{1,2}\/\d{1,2}(\s+\d{1,2}:\d{1,2}(:\d{1,2})?)?$/,
|
||||||
transform: (str: string) => str,
|
transform: (str : string) => str,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// 尝试匹配并转换
|
// 尝试匹配并转换
|
||||||
let normalizedDateStr: string | null = null;
|
let normalizedDateStr : string | null = null;
|
||||||
for (const rule of formatRules) {
|
for (const rule of formatRules) {
|
||||||
if (rule.pattern.test(trimmedDateStr)) {
|
if (rule.pattern.test(trimmedDateStr)) {
|
||||||
normalizedDateStr = rule.transform(trimmedDateStr);
|
normalizedDateStr = rule.transform(trimmedDateStr);
|
||||||
@ -565,7 +565,7 @@ export function timeTurnTimeStampTwo(dateStr: string) {
|
|||||||
* @param {Object} value
|
* @param {Object} value
|
||||||
* @param {Object} callback
|
* @param {Object} callback
|
||||||
*/
|
*/
|
||||||
export function copy(value: any, callback: any) {
|
export function copy(value : any, callback : any) {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
const oInput = document.createElement('input'); //创建一个隐藏input(重要!)
|
const oInput = document.createElement('input'); //创建一个隐藏input(重要!)
|
||||||
oInput.value = value; //赋值
|
oInput.value = value; //赋值
|
||||||
@ -612,8 +612,8 @@ export function copy(value: any, callback: any) {
|
|||||||
* 处理onLoad传递的参数
|
* 处理onLoad传递的参数
|
||||||
* @param option
|
* @param option
|
||||||
*/
|
*/
|
||||||
export function handleOnloadParams(option: any) {
|
export function handleOnloadParams(option : any) {
|
||||||
let params: any = {};
|
let params : any = {};
|
||||||
|
|
||||||
// 处理小程序扫码进入的场景值参数
|
// 处理小程序扫码进入的场景值参数
|
||||||
if (option.scene) {
|
if (option.scene) {
|
||||||
@ -639,7 +639,7 @@ export function handleOnloadParams(option: any) {
|
|||||||
* @param {object} obj 需要深度克隆的对象
|
* @param {object} obj 需要深度克隆的对象
|
||||||
* @returns {*} 克隆后的对象或者原值(不是对象)
|
* @returns {*} 克隆后的对象或者原值(不是对象)
|
||||||
*/
|
*/
|
||||||
export function deepClone(obj: any) {
|
export function deepClone(obj : any) {
|
||||||
// 对常见的“非”值,直接返回原来值
|
// 对常见的“非”值,直接返回原来值
|
||||||
if ([null, undefined, NaN, false].includes(obj)) return obj
|
if ([null, undefined, NaN, false].includes(obj)) return obj
|
||||||
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
||||||
@ -661,8 +661,8 @@ export function deepClone(obj: any) {
|
|||||||
* @param delay
|
* @param delay
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function debounce(fn: (args?: any) => any, delay: number = 300) {
|
export function debounce(fn : (args ?: any) => any, delay : number = 300) {
|
||||||
let timer: null | number = null
|
let timer : null | number = null
|
||||||
return function (...args) {
|
return function (...args) {
|
||||||
if (timer != null) {
|
if (timer != null) {
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
@ -674,7 +674,7 @@ export function debounce(fn: (args?: any) => any, delay: number = 300) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isArray = (value: any) => {
|
const isArray = (value : any) => {
|
||||||
if (typeof Array.isArray === 'function') {
|
if (typeof Array.isArray === 'function') {
|
||||||
return Array.isArray(value)
|
return Array.isArray(value)
|
||||||
}
|
}
|
||||||
@ -682,14 +682,14 @@ const isArray = (value: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// px转rpx
|
// px转rpx
|
||||||
export function pxToRpx(px: any) {
|
export function pxToRpx(px : any) {
|
||||||
const systemStore = useSystemStore()
|
const systemStore = useSystemStore()
|
||||||
const screenWidth = systemStore.systemInfo.screenWidth;
|
const screenWidth = systemStore.systemInfo.screenWidth;
|
||||||
return (750 * Number.parseInt(px)) / screenWidth;
|
return (750 * Number.parseInt(px)) / screenWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
export function goback(data: any) {
|
export function goback(data : any) {
|
||||||
let { url, mode, param, title } = data
|
let { url, mode, param, title } = data
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: title,
|
title: title,
|
||||||
@ -729,10 +729,10 @@ export function getWinxinOpenId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取有效期
|
// 获取有效期
|
||||||
export function getValidTime(minutes: any = 1) {
|
export function getValidTime(minutes : any = 1) {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setSeconds(60 * minutes);
|
date.setSeconds(60 * minutes);
|
||||||
let validTime: any = parseInt(date.getTime() / 1000); // 定位信息 5分钟内有效,过期后将重新获取定位信息
|
let validTime : any = parseInt(date.getTime() / 1000); // 定位信息 5分钟内有效,过期后将重新获取定位信息
|
||||||
return validTime;
|
return validTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,10 +742,10 @@ export function getValidTime(minutes: any = 1) {
|
|||||||
* 设置插件应用的主色调
|
* 设置插件应用的主色调
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
export function setThemeColor (path: string) {
|
export function setThemeColor(path : string) {
|
||||||
let pathArr = path.split('/')
|
let pathArr = path.split('/')
|
||||||
let index = !pathArr[0] ? 1 : 0;
|
let index = !pathArr[0] ? 1 : 0;
|
||||||
let route = pathArr[index] == 'addon' ? pathArr[(index+1)] : 'app';
|
let route = pathArr[index] == 'addon' ? pathArr[(index + 1)] : 'app';
|
||||||
|
|
||||||
// 设置底部导航
|
// 设置底部导航
|
||||||
const configStore = useConfigStore()
|
const configStore = useConfigStore()
|
||||||
@ -760,38 +760,38 @@ export function setThemeColor (path: string) {
|
|||||||
if (route != 'app') {
|
if (route != 'app') {
|
||||||
try {
|
try {
|
||||||
currTheme = theme_color_list[route];
|
currTheme = theme_color_list[route];
|
||||||
if(currTheme && currTheme.theme){
|
if (currTheme && currTheme.theme) {
|
||||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||||
}else if( !currTheme && current_theme_color){
|
} else if (!currTheme && current_theme_color) {
|
||||||
configStore.themeColor = ''
|
configStore.themeColor = ''
|
||||||
}else{
|
} else {
|
||||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
||||||
if(!current_theme_color && theme_color_list && Object.keys(theme_color_list).length > 0){
|
if (!current_theme_color && theme_color_list && Object.keys(theme_color_list).length > 0) {
|
||||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||||
}else{
|
} else {
|
||||||
configStore.themeColor = '';
|
configStore.themeColor = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if (!current_theme_color && theme_color_list && Object.keys(theme_color_list).length > 0) {
|
} else if (!current_theme_color && theme_color_list && Object.keys(theme_color_list).length > 0) {
|
||||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0]
|
currTheme = theme_color_list.app || Object.values(theme_color_list)[0]
|
||||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||||
uni.setStorageSync("current_theme_color", JSON.stringify(themeColorToHex(currTheme.theme)))
|
uni.setStorageSync("current_theme_color", JSON.stringify(themeColorToHex(currTheme.theme)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function themeColorToHex (param: any) {
|
export function themeColorToHex(param : any) {
|
||||||
const hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
|
const hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
|
||||||
const rgbaRegex = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*\d*\.?\d+)?\)$/
|
const rgbaRegex = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*\d*\.?\d+)?\)$/
|
||||||
for(let key in param){
|
for (let key in param) {
|
||||||
if (rgbaRegex.test(param[key])) {
|
if (rgbaRegex.test(param[key])) {
|
||||||
const values = param[key].replace('rgba(', '').replace(')', '').split(',');
|
const values = param[key].replace('rgba(', '').replace(')', '').split(',');
|
||||||
// 提取 r, g, b, a 值,并将它们转换为合适的类型
|
// 提取 r, g, b, a 值,并将它们转换为合适的类型
|
||||||
@ -799,14 +799,14 @@ export function themeColorToHex (param: any) {
|
|||||||
const g = parseInt(values[1].trim(), 10); // Green 分量
|
const g = parseInt(values[1].trim(), 10); // Green 分量
|
||||||
const b = parseInt(values[2].trim(), 10); // Blue 分量
|
const b = parseInt(values[2].trim(), 10); // Blue 分量
|
||||||
const a = parseFloat(values[3].trim()); // Alpha 分量
|
const a = parseFloat(values[3].trim()); // Alpha 分量
|
||||||
param[key] = rgbaToHex(r,g,b,a)
|
param[key] = rgbaToHex(r, g, b, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return param
|
return param
|
||||||
}
|
}
|
||||||
|
|
||||||
// rgba转十六进制颜色
|
// rgba转十六进制颜色
|
||||||
export function rgbaToHex (r, g, b, a) {
|
export function rgbaToHex(r, g, b, a) {
|
||||||
// 计算混合后的RGB值,假设背景是白色 (255, 255, 255)
|
// 计算混合后的RGB值,假设背景是白色 (255, 255, 255)
|
||||||
let rBlend = Math.round((1 - a) * 255 + a * r)
|
let rBlend = Math.round((1 - a) * 255 + a * r)
|
||||||
let gBlend = Math.round((1 - a) * 255 + a * g)
|
let gBlend = Math.round((1 - a) * 255 + a * g)
|
||||||
@ -823,7 +823,7 @@ export function rgbaToHex (r, g, b, a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取 topFixedStatus 缓存名称
|
// 获取 topFixedStatus 缓存名称
|
||||||
export function getTopFixedStatusName(data: any = {}) {
|
export function getTopFixedStatusName(data : any = {}) {
|
||||||
let name = 'topFixedStatus'
|
let name = 'topFixedStatus'
|
||||||
if (data.id) name += '_' + data.id
|
if (data.id) name += '_' + data.id
|
||||||
if (data.site_id) name += '_' + data.site_id
|
if (data.site_id) name += '_' + data.site_id
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { redirect, getToken, getSiteId,currRoute, setThemeColor } from '@/utils/
|
|||||||
import { memberLog } from '@/app/api/auth'
|
import { memberLog } from '@/app/api/auth'
|
||||||
import { useShare } from '@/hooks/useShare'
|
import { useShare } from '@/hooks/useShare'
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面跳转拦截器
|
* 页面跳转拦截器
|
||||||
*/
|
*/
|
||||||
@ -24,7 +25,10 @@ export const redirectInterceptor = (route: { path: string, query: object }) => {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
route.path.indexOf('addon') != -1 && language.loadAllLocaleMessages('addon', uni.getLocale())
|
try {
|
||||||
|
language.loadAllLocaleMessages('addon', uni.getLocale())
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 校验是否需要登录
|
// 校验是否需要登录
|
||||||
|
|||||||
6974
uni-app/yarn.lock
Normal file
6974
uni-app/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user