mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-11 10:22:48 +00:00
up uni-app
This commit is contained in:
parent
7d27920bcf
commit
7f8d86eed4
@ -71,18 +71,23 @@ const solve = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleWeappAddonComponents = (mode) => {
|
const handleWeappAddonComponents = (mode) => {
|
||||||
const src = `./dist/${mode}/mp-weixin/addon/components/diy/group/index.json`
|
const files = [
|
||||||
|
`./dist/${mode}/mp-weixin/addon/components/diy/group/index.json`,
|
||||||
|
`./dist/${mode}/mp-weixin/app/pages/index/tabbar.json`
|
||||||
|
]
|
||||||
|
|
||||||
try {
|
files.forEach(src => {
|
||||||
const data = JSON.parse(fs.readFileSync(src, 'utf8'));
|
try {
|
||||||
data.componentPlaceholder = {};
|
const data = JSON.parse(fs.readFileSync(src, 'utf8'));
|
||||||
|
data.componentPlaceholder = {};
|
||||||
|
|
||||||
Object.keys(data.usingComponents).map(key => {
|
Object.keys(data.usingComponents).map(key => {
|
||||||
data.componentPlaceholder[key] = "view";
|
data.componentPlaceholder[key] = "view";
|
||||||
})
|
})
|
||||||
fs.writeFileSync(src, JSON.stringify(data))
|
fs.writeFileSync(src, JSON.stringify(data))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleWeappLanguage = (mode) => {
|
const handleWeappLanguage = (mode) => {
|
||||||
@ -115,6 +120,20 @@ const listenWeappRunDev = () => {
|
|||||||
handleWeappLanguage('dev')
|
handleWeappLanguage('dev')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 监听 stderr 输出,用于捕获错误信息
|
||||||
|
devProcess.stderr.on('data', (data) => {
|
||||||
|
console.error(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听子进程退出事件
|
||||||
|
devProcess.on('close', (code) => {
|
||||||
|
if (code !== 0) { // 如果退出码不是0,则认为发生了错误
|
||||||
|
console.error(`Child process exited with code ${code}`);
|
||||||
|
} else {
|
||||||
|
console.log('Child process exited successfully.');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -28,18 +28,26 @@
|
|||||||
<button class="bg-[#FFB4B1] !text-[#fff] h-[80rpx] leading-[80rpx] rounded-[100rpx] text-[26rpx] font-500" hover-class="none" v-else-if="friendsInfo.status == -1">{{ t('close') }}</button>
|
<button class="bg-[#FFB4B1] !text-[#fff] h-[80rpx] leading-[80rpx] rounded-[100rpx] text-[26rpx] font-500" hover-class="none" v-else-if="friendsInfo.status == -1">{{ t('close') }}</button>
|
||||||
<button class="botton-color !text-[#fff] h-[80rpx] leading-[80rpx] rounded-[100rpx] text-[26rpx] font-500" hover-class="none" v-else :loading="operateLoading" @click="save">{{ friendsInfo.config.pay_button_name ? friendsInfo.config.pay_button_name : t('payGenerously') }}</button>
|
<button class="botton-color !text-[#fff] h-[80rpx] leading-[80rpx] rounded-[100rpx] text-[26rpx] font-500" hover-class="none" v-else :loading="operateLoading" @click="save">{{ friendsInfo.config.pay_button_name ? friendsInfo.config.pay_button_name : t('payGenerously') }}</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-[20rpx] flex items-baseline justify-center text-[var(--text-color-light9)]" @click="redirect({url: '/app/pages/index/index'})">
|
<view class="px-[10px] flex justify-between items-center text-[var(--text-color-light9)] mt-[20rpx] ">
|
||||||
<text class="text-[24rpx] mr-[6rpx]">返回首页</text>
|
<view class="flex items-baseline justify-between text-[var(--text-color-light9)]" @click="redirect({url: '/app/pages/index/index'})">
|
||||||
</view>
|
<text class="text-[24rpx] mr-[6rpx]">返回首页</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-shrink-0" @click="handleMessage" v-if="friendsInfo.config.pay_explain_switch">
|
||||||
|
<text class="mr-[8rpx] text-[24rpx]">{{ friendsInfo.config.pay_explain_title }}</text>
|
||||||
|
<text class="nc-iconfont nc-icon-jichuxinxiV6xx text-[26rpx] "></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="card-template sidebar-margin mb-[var(--top-m)]" v-if="friendsInfo.config.pay_info_switch">
|
<view class="card-template sidebar-margin mb-[var(--top-m)]" v-if="friendsInfo.config.pay_info_switch">
|
||||||
<template v-if="JSON.stringify(friendsInfo.trade_info) !== '[]' && friendsInfo.trade_info.item_list.length">
|
<template v-if="JSON.stringify(friendsInfo.trade_info) !== '[]' && friendsInfo.trade_info.item_list.length">
|
||||||
<view class="flex justify-between items-center mb-[30rpx]">
|
<view class="flex justify-between items-center mb-[30rpx]">
|
||||||
<view class="text-[30rpx] text-[#333] font-500">{{ t('helpPayInfo') }}</view>
|
<view class="text-[30rpx] text-[#333] font-500">{{ t('helpPayInfo') }}</view>
|
||||||
<view class="flex-shrink-0" @click="handleMessage" v-if="friendsInfo.config.pay_explain_switch">
|
<!-- <view class="flex-shrink-0" @click="handleMessage" v-if="friendsInfo.config.pay_explain_switch">
|
||||||
<text class="mr-[8rpx] text-[24rpx]">{{ friendsInfo.config.pay_explain_title }}</text>
|
<text class="mr-[8rpx] text-[24rpx]">{{ friendsInfo.config.pay_explain_title }}</text>
|
||||||
<text class="nc-iconfont nc-icon-jichuxinxiV6xx text-[26rpx]"></text>
|
<text class="nc-iconfont nc-icon-jichuxinxiV6xx text-[26rpx]"></text>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="border-0 border-solid border-b-[1rpx] border-[#f6f6f6] mb-[20rpx]">
|
<view class="border-0 border-solid border-b-[1rpx] border-[#f6f6f6] mb-[20rpx]">
|
||||||
<view v-for="(item, index) in friendsInfo.trade_info.item_list" class="flex justify-between" :class="{' mb-[34rpx]': (index + 1) != friendsInfo.trade_info.length }">
|
<view v-for="(item, index) in friendsInfo.trade_info.item_list" class="flex justify-between" :class="{' mb-[34rpx]': (index + 1) != friendsInfo.trade_info.length }">
|
||||||
|
|||||||
222
uni-app/src/app/pages/index/tabbar.vue
Normal file
222
uni-app/src/app/pages/index/tabbar.vue
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
<template>
|
||||||
|
<view class="w-screen h-screen flex flex-col">
|
||||||
|
<top-tabbar v-if="navbar" :data="navbar.data" :is-back="false"/>
|
||||||
|
|
||||||
|
<view class="hidden">{{ tag }}</view>
|
||||||
|
|
||||||
|
<template v-if="tabbar && Object.keys(tabbar).length">
|
||||||
|
<u-tabbar :value="page" zIndex="9999" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
|
||||||
|
:inactive-color="tabbar.value.textColor" :active-color="tabbar.value.textHoverColor">
|
||||||
|
<block v-for="item in tabbar.value.list">
|
||||||
|
<u-tabbar-item class="py-[5rpx]" :style="{'background-color': tabbar.value.backgroundColor}" :text="item.text"
|
||||||
|
:icon="img(page == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link"
|
||||||
|
v-if="tabbar.value.type == 1" @click="itemBtn(item.link.url)"></u-tabbar-item>
|
||||||
|
<u-tabbar-item class="py-[5rpx]" :style="{'background-color': tabbar.value.backgroundColor}"
|
||||||
|
:icon="img(page == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link"
|
||||||
|
v-if="tabbar.value.type == 2" @click="itemBtn(item.link.url)"></u-tabbar-item>
|
||||||
|
<u-tabbar-item class="py-[5rpx]" :style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :name="item.link.url"
|
||||||
|
v-if="tabbar.value.type == 3" @click="itemBtn(item.link.url)"></u-tabbar-item>
|
||||||
|
</block>
|
||||||
|
</u-tabbar>
|
||||||
|
<view class="tab-bar-placeholder"></view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, watch, computed } from 'vue'
|
||||||
|
import { img, redirect, urlDeconstruction } from '@/utils/common'
|
||||||
|
import { getCustomNavigationPages } from '@/utils/pages'
|
||||||
|
import useConfigStore from '@/stores/config'
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import useSystemStore from '@/stores/system'
|
||||||
|
import tabbarJson from '@/tabbar.json'
|
||||||
|
import pagesJson from '@/pages.json'
|
||||||
|
import zh from '@/locale/zh-Hans.json'
|
||||||
|
import en from '@/locale/en.json'
|
||||||
|
import {onPageScroll} from "@dcloudio/uni-app";
|
||||||
|
import TopTabbar from "@/components/top-tabbar/top-tabbar.vue";
|
||||||
|
import { language } from '@/locale'
|
||||||
|
|
||||||
|
uni.hideTabBar()
|
||||||
|
|
||||||
|
const customNavigationPages = getCustomNavigationPages()
|
||||||
|
const tag = ref(0)
|
||||||
|
const scrollTop = ref({})
|
||||||
|
const scrollRecord = ref({})
|
||||||
|
const systemStore = useSystemStore()
|
||||||
|
const page = computed(() => {
|
||||||
|
return systemStore.currTabbar.path
|
||||||
|
})
|
||||||
|
const tabbar:any = reactive({})
|
||||||
|
const addon = computed(() => {
|
||||||
|
if (systemStore.currTabbar.path) {
|
||||||
|
let pathArr = systemStore.currTabbar.path.split('/')
|
||||||
|
let index = !pathArr[0] ? 1 : 0;
|
||||||
|
let app = pathArr[index] == 'addon' ? pathArr[(index+1)] : 'app';
|
||||||
|
return app
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
})
|
||||||
|
const pagesRefs = ref({})
|
||||||
|
const navbar = ref(null)
|
||||||
|
const loadRecord = ref([])
|
||||||
|
|
||||||
|
const setTabbar = ()=> {
|
||||||
|
let list = cloneDeep(useConfigStore().tabbarList);
|
||||||
|
if (list.length == 1) {
|
||||||
|
Object.assign(tabbar, list[0]);
|
||||||
|
} else {
|
||||||
|
let isExist = false;
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].key == addon.value) {
|
||||||
|
Object.assign(tabbar, list[i]);
|
||||||
|
isExist = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isExist) {
|
||||||
|
|
||||||
|
// 检测是否单应用
|
||||||
|
let count = 0;
|
||||||
|
let singleTabbar = {}
|
||||||
|
try {
|
||||||
|
if (list) {
|
||||||
|
list.forEach((item: any) => {
|
||||||
|
if (item.info.type == 'app') {
|
||||||
|
count++;
|
||||||
|
singleTabbar = item;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 1) {
|
||||||
|
Object.assign(tabbar, singleTabbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pagesLoad = () => {
|
||||||
|
if (systemStore.currTabbar.path) {
|
||||||
|
if (!loadRecord.value.includes(systemStore.currTabbar.path)) loadRecord.value.push(systemStore.currTabbar.path)
|
||||||
|
|
||||||
|
if (pagesRefs.value[systemStore.currTabbar.path] && pagesRefs.value[systemStore.currTabbar.path].$) {
|
||||||
|
// #ifdef MP
|
||||||
|
systemStore.currTabbar.path.indexOf('addon') != -1 && language.loadAllLocaleMessages('addon', uni.getLocale())
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 执行页面onshow onload事件
|
||||||
|
pagesRefs.value[systemStore.currTabbar.path].$.root.onLoad.forEach(el => {
|
||||||
|
el(systemStore.currTabbar.query || {})
|
||||||
|
})
|
||||||
|
pagesRefs.value[systemStore.currTabbar.path].$.root.onShow.forEach(el => {
|
||||||
|
el()
|
||||||
|
})
|
||||||
|
// 设置页面滚动条高度
|
||||||
|
scrollTop.value[systemStore.currTabbar.path] = scrollRecord.value[systemStore.currTabbar.path] || 0
|
||||||
|
// 处理页面navbar
|
||||||
|
// 页面没有自定义navbar
|
||||||
|
if (!customNavigationPages[systemStore.currTabbar.path]) {
|
||||||
|
let key = systemStore.currTabbar.path.replace('/app/', '').replace('/addon/', '').replaceAll('/', '.')
|
||||||
|
|
||||||
|
switch (uni.getLocale()) {
|
||||||
|
case 'zh-Hans':
|
||||||
|
zh[key] && (key = zh[key])
|
||||||
|
break;
|
||||||
|
case 'en':
|
||||||
|
en[key] && (key = en[key])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
navbar.value = {
|
||||||
|
data: {
|
||||||
|
title: key,
|
||||||
|
topStatusBar: {
|
||||||
|
"bgColor": "#ffffff",
|
||||||
|
"rollBgColor": "#ffffff",
|
||||||
|
"style": "style-1",
|
||||||
|
"textColor": "#333333",
|
||||||
|
"rollTextColor": "#333333",
|
||||||
|
"textAlign": "center",
|
||||||
|
"imgUrl": "",
|
||||||
|
"link": {
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
navbar.value = null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
tag.value++
|
||||||
|
pagesLoad()
|
||||||
|
}, 300)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => useConfigStore().tabbarList,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (newValue) {
|
||||||
|
setTabbar()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, { deep: true, immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(() => addon, (newValue, oldValue) => {
|
||||||
|
if (newValue) {
|
||||||
|
setTabbar()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true, immediate: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
const setPagesRefs = (el, key) => {
|
||||||
|
if (!pagesRefs.value[key]) {
|
||||||
|
pagesRefs.value[key] = el
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemBtn = (url: string)=>{
|
||||||
|
const route = urlDeconstruction(url)
|
||||||
|
if (tabbarJson.includes(route.path)) {
|
||||||
|
useSystemStore().$patch((state) => {
|
||||||
|
state.currTabbar = route
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
redirect({ url, mode: 'navigateTo' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => systemStore.currTabbar, (newValue, oldValue) => {
|
||||||
|
pagesLoad()
|
||||||
|
}, { deep: true, immediate: true })
|
||||||
|
|
||||||
|
const scrollListen = (e: any, key: string) => {
|
||||||
|
scrollRecord.value[key] = e.detail.scrollTop
|
||||||
|
|
||||||
|
try {
|
||||||
|
pagesRefs.value[systemStore.currTabbar.path].$.root.onPageScroll.forEach(el => {
|
||||||
|
el(e.detail)
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.u-tabbar) {
|
||||||
|
flex: unset!important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -54,7 +54,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<area-select ref="areaRef" @complete="areaSelectComplete" :area-id="formData.district_id" />
|
<area-select ref="areaRef" @complete="areaSelectComplete" :area-id="formData.district_id || formData.city_id" />
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<!-- 小程序隐私协议 -->
|
<!-- 小程序隐私协议 -->
|
||||||
<wx-privacy-popup ref="wxPrivacyPopupRef"></wx-privacy-popup>
|
<wx-privacy-popup ref="wxPrivacyPopupRef"></wx-privacy-popup>
|
||||||
@ -181,14 +181,14 @@ const selectArea = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const areaSelectComplete = (event: any) => {
|
const areaSelectComplete = (event: any) => {
|
||||||
if (isSelectAddress.value && (formData.value.province_id == event.province.id || formData.value.city_id != event.city.id || formData.value.district_id != event.district.id)) {
|
if (isSelectAddress.value && (formData.value.province_id == event.province?.id || formData.value.city_id != event.city?.id || formData.value.district_id != event.district?.id)) {
|
||||||
formData.value.lat = '';
|
formData.value.lat = '';
|
||||||
formData.value.lng = '';
|
formData.value.lng = '';
|
||||||
}
|
}
|
||||||
formData.value.province_id = event.province.id || 0
|
formData.value.province_id = event.province?.id || 0
|
||||||
formData.value.city_id = event.city.id || 0
|
formData.value.city_id = event.city?.id || 0
|
||||||
formData.value.district_id = event.district.id || 0
|
formData.value.district_id = event.district?.id || 0
|
||||||
formData.value.area = `${ event.province.name || '' }${ event.city.name || '' }${ event.district.name || '' }`
|
formData.value.area = `${ event.province?.name || '' }${ event.city?.name || '' }${ event.district?.name || '' }`
|
||||||
isSelectAddress.value = false;
|
isSelectAddress.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -110,10 +110,16 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="empty-page" v-if="!loading && (!list || !list.length)">
|
<view class="" v-if="!loading && (!list || !list.length)">
|
||||||
<image class="img" :src="img('static/resource/images/empty.png')" mode="aspectFill" />
|
<!-- #ifdef MP -->
|
||||||
<text class="desc">暂无会员等级</text>
|
<top-tabbar :data="topTabbarDataEmpty" />
|
||||||
</view>
|
<!-- #endif -->
|
||||||
|
<view class="empty-page" >
|
||||||
|
<image class="img" :src="img('static/resource/images/empty.png')" mode="aspectFill" />
|
||||||
|
<text class="desc">暂无会员等级</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -136,6 +142,16 @@ const levelIndex = ref(0); //当前等级的索引
|
|||||||
/********* 自定义头部 - start ***********/
|
/********* 自定义头部 - start ***********/
|
||||||
const topTabarObj = topTabar()
|
const topTabarObj = topTabar()
|
||||||
let topTabbarData = topTabarObj.setTopTabbarParam({ title: '会员等级' })
|
let topTabbarData = topTabarObj.setTopTabbarParam({ title: '会员等级' })
|
||||||
|
let topTabbarDataEmpty =ref({
|
||||||
|
title: '会员等级',
|
||||||
|
topStatusBar: {
|
||||||
|
style: 'style-1',
|
||||||
|
bgColor: '#fff',
|
||||||
|
rollBgColor: '#333',
|
||||||
|
textColor: '#333',
|
||||||
|
rollTextColor: '#333'
|
||||||
|
}
|
||||||
|
})
|
||||||
/********* 自定义头部 - end ***********/
|
/********* 自定义头部 - end ***********/
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
|||||||
@ -118,6 +118,11 @@ watch(() => selected.city, (nval) => {
|
|||||||
selected.district = null
|
selected.district = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!data.length) {
|
||||||
|
emits('complete', selected)
|
||||||
|
show.value = false
|
||||||
|
}
|
||||||
|
|
||||||
}).catch()
|
}).catch()
|
||||||
} else {
|
} else {
|
||||||
areaList.district = []
|
areaList.district = []
|
||||||
|
|||||||
@ -148,6 +148,10 @@ const getPhoneNumber = (e: any) => {
|
|||||||
let msg = '用户未授权隐私权限';
|
let msg = '用户未授权隐私权限';
|
||||||
uni.showToast({ title: msg, icon: 'none' })
|
uni.showToast({ title: msg, icon: 'none' })
|
||||||
}
|
}
|
||||||
|
if (e.detail.errno == 112) {
|
||||||
|
let msg = `隐私协议中未声明,获取手机号失败`;
|
||||||
|
uni.showToast({ title: msg, icon: 'none' })
|
||||||
|
}
|
||||||
if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
|
if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
|
||||||
let msg = '用户拒绝获取手机号码';
|
let msg = '用户拒绝获取手机号码';
|
||||||
uni.showToast({ title: msg, icon: 'none' })
|
uni.showToast({ title: msg, icon: 'none' })
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<template v-if="tabbar && Object.keys(tabbar).length">
|
<template v-if="tabbarShow && tabbar && Object.keys(tabbar).length">
|
||||||
<u-tabbar :value="value" zIndex="9999" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" :inactive-color="tabbar.value.textColor" :active-color="tabbar.value.textHoverColor" :border="props.border" class="custom-tabbar">
|
<u-tabbar :value="value" zIndex="9999" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" :inactive-color="tabbar.value.textColor" :active-color="tabbar.value.textHoverColor" :border="props.border" class="custom-tabbar">
|
||||||
<template v-for="item in tabbar.value.list">
|
<template v-for="item in tabbar.value.list">
|
||||||
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :icon="img(value == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link.url" v-if="tabbar.value.type == 1" @click="itemBtn(item.link.url)"></u-tabbar-item>
|
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :icon="img(value == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link.url" v-if="tabbar.value.type == 1" @click="itemBtn(item.link.url)"></u-tabbar-item>
|
||||||
@ -15,6 +15,7 @@
|
|||||||
import { reactive, computed, watch, nextTick, getCurrentInstance } from 'vue'
|
import { reactive, computed, watch, nextTick, getCurrentInstance } from 'vue'
|
||||||
import { redirect, currRoute, currShareRoute, img } from '@/utils/common'
|
import { redirect, currRoute, currShareRoute, img } from '@/utils/common'
|
||||||
import useConfigStore from '@/stores/config'
|
import useConfigStore from '@/stores/config'
|
||||||
|
import useSystemStore from '@/stores/system'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -47,6 +48,10 @@ if (!addon && configStore.addon) {
|
|||||||
|
|
||||||
const tabbar: any = reactive({})
|
const tabbar: any = reactive({})
|
||||||
|
|
||||||
|
const tabbarShow = computed(() => {
|
||||||
|
return currRoute() != '/app/pages/index/tabbar'
|
||||||
|
})
|
||||||
|
|
||||||
const setTabbar = () => {
|
const setTabbar = () => {
|
||||||
let list = cloneDeep(useConfigStore().tabbarList);
|
let list = cloneDeep(useConfigStore().tabbarList);
|
||||||
if (list.length == 1) {
|
if (list.length == 1) {
|
||||||
|
|||||||
@ -244,7 +244,9 @@ const navbarPlaceholderHeight = () => {
|
|||||||
const query = uni.createSelectorQuery().in(instance);
|
const query = uni.createSelectorQuery().in(instance);
|
||||||
query.select('.ns-navbar-wrap .u-navbar .content-wrap').boundingClientRect(data => {
|
query.select('.ns-navbar-wrap .u-navbar .content-wrap').boundingClientRect(data => {
|
||||||
placeholderHeight.value = data ? data.height : 0;
|
placeholderHeight.value = data ? data.height : 0;
|
||||||
diyStore.topTabarHeight = placeholderHeight.value;
|
diyStore.$patch((state) => {
|
||||||
|
state.topTabarHeight = placeholderHeight.value
|
||||||
|
})
|
||||||
}).exec();
|
}).exec();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view @touchmove.prevent.stop>
|
<view @touchmove.prevent.stop>
|
||||||
<u-popup :show="showPop" type="bottom" @close="disPopUp">
|
<u-popup :show="showPop" type="bottom" @close="disPopUp">
|
||||||
<view>
|
<view class="privacy-popup-wrap">
|
||||||
<view class="p-[30rpx]">
|
<view class="p-[30rpx]">
|
||||||
<view class="privacy-title">用户隐私保护提示</view>
|
<view class="privacy-title">用户隐私保护提示</view>
|
||||||
<view class="privacy-desc">感谢您使用本小程序,在使用前您应当阅读并同意<text class="privacy-link" @tap="openPrivacyContract">{{ privacyContractName }}</text>, 当点击同意并继续时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力;如您不同意,将无法继续使用小程序相关功能。</view>
|
<view class="privacy-desc">感谢您使用本小程序,在使用前您应当阅读并同意<text class="privacy-link" @tap="openPrivacyContract">{{ privacyContractName }}</text>, 当点击同意并继续时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力;如您不同意,将无法继续使用小程序相关功能。</view>
|
||||||
@ -235,4 +235,10 @@ defineExpose({
|
|||||||
.bg-agree {
|
.bg-agree {
|
||||||
margin-right: 0rpx;
|
margin-right: 0rpx;
|
||||||
}
|
}
|
||||||
|
.privacy-popup-wrap {
|
||||||
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
|
/*兼容 IOS<11.2*/
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { sendSms } from '@/app/api/system'
|
|||||||
|
|
||||||
export function useSendSms(smsRef: any) {
|
export function useSendSms(smsRef: any) {
|
||||||
const tips = ref(t('getSmsCode'))
|
const tips = ref(t('getSmsCode'))
|
||||||
const seconds = 90
|
const seconds = 60
|
||||||
const changeText = 'X' + t('smsCodeChangeText')
|
const changeText = 'X' + t('smsCodeChangeText')
|
||||||
|
|
||||||
const canGetCode = computed(() => {
|
const canGetCode = computed(() => {
|
||||||
|
|||||||
@ -8,21 +8,13 @@ const t = (message: string) => {
|
|||||||
route = getCurrentInstance()?.appContext.config.globalProperties.$route.path || ('/' + useSystemStore().currRoute)
|
route = getCurrentInstance()?.appContext.config.globalProperties.$route.path || ('/' + useSystemStore().currRoute)
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
let _route = getCurrentInstance()?.root.ctx.$scope.__route__;
|
route = '/' + (getCurrentInstance()?.root.ctx.$scope.__route__ || useSystemStore().currRoute)
|
||||||
if(_route == 'app/pages/index/tabbar'){
|
if (route == '/app/pages/index/tabbar' && useSystemStore().currTabbar && useSystemStore().currTabbar.path) {
|
||||||
route = useSystemStore().currRoute
|
route = useSystemStore().currTabbar.path
|
||||||
}else{
|
|
||||||
route = '/' + getCurrentInstance()?.root.ctx.$scope.__route__
|
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
// console.log('vgetCurrentInstance()?.root.ctx.$scope.__route__',getCurrentInstance()?.root.ctx.$scope.__route__,useSystemStore().currRoute)
|
|
||||||
// console.log('route',route)
|
|
||||||
const file = language.getFileKey(route)
|
const file = language.getFileKey(route)
|
||||||
// console.log('file',file)
|
|
||||||
const key = `${ file.fileKey }.${ message }`
|
const key = `${ file.fileKey }.${ message }`
|
||||||
// console.log('key',key)
|
|
||||||
// console.log('i18n.global.t(key)',i18n.global.t(key))
|
|
||||||
// console.log('i18n.global.t(message)',i18n.global.t(message))
|
|
||||||
if (i18n.global.t(message) != message) return i18n.global.t(message)
|
if (i18n.global.t(message) != message) return i18n.global.t(message)
|
||||||
return i18n.global.t(key) != key ? i18n.global.t(key) : ''
|
return i18n.global.t(key) != key ? i18n.global.t(key) : ''
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,6 @@ class Language {
|
|||||||
this.setI18nLanguage(locale, file)
|
this.setI18nLanguage(locale, file)
|
||||||
return nextTick()
|
return nextTick()
|
||||||
}
|
}
|
||||||
this.loadLocale.push(`${fileKey}.${locale}`)
|
|
||||||
|
|
||||||
// 引入语言包文件
|
// 引入语言包文件
|
||||||
const messages = await import(route == 'app' ? `../${route}/locale/${locale}/${file}.json` : `../addon/${route}/locale/${locale}/${file}.json`)
|
const messages = await import(route == 'app' ? `../${route}/locale/${locale}/${file}.json` : `../addon/${route}/locale/${locale}/${file}.json`)
|
||||||
@ -56,6 +55,8 @@ class Language {
|
|||||||
this.i18n.global.mergeLocaleMessage(locale, data)
|
this.i18n.global.mergeLocaleMessage(locale, data)
|
||||||
this.setI18nLanguage(locale, file)
|
this.setI18nLanguage(locale, file)
|
||||||
|
|
||||||
|
this.loadLocale.push(`${fileKey}.${locale}`)
|
||||||
|
|
||||||
return nextTick()
|
return nextTick()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// console.log(e)
|
// console.log(e)
|
||||||
|
|||||||
@ -42,4 +42,4 @@
|
|||||||
"pages.friendspay.share": "找朋友帮忙付",
|
"pages.friendspay.share": "找朋友帮忙付",
|
||||||
"pages.friendspay.money": "",
|
"pages.friendspay.money": "",
|
||||||
"pages.webview.index": ""
|
"pages.webview.index": ""
|
||||||
}
|
}
|
||||||
@ -16,6 +16,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "app/pages/index/tabbar",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "app/pages/auth/index",
|
"path": "app/pages/auth/index",
|
||||||
"style": {
|
"style": {
|
||||||
@ -373,6 +379,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "app/pages/index/nosite"
|
"pagePath": "app/pages/index/nosite"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "app/pages/index/tabbar"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -16,6 +16,10 @@ interface System {
|
|||||||
shareCallback: any, // 分享回调
|
shareCallback: any, // 分享回调
|
||||||
defaultPositionAddress: any,
|
defaultPositionAddress: any,
|
||||||
diyAddressInfo: any // 定位信息
|
diyAddressInfo: any // 定位信息
|
||||||
|
currTabbar: {
|
||||||
|
path: string,
|
||||||
|
query: object
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const useSystemStore = defineStore('system', {
|
const useSystemStore = defineStore('system', {
|
||||||
@ -38,7 +42,11 @@ const useSystemStore = defineStore('system', {
|
|||||||
},
|
},
|
||||||
shareCallback: null,
|
shareCallback: null,
|
||||||
defaultPositionAddress: '定位中',
|
defaultPositionAddress: '定位中',
|
||||||
diyAddressInfo: null
|
diyAddressInfo: null,
|
||||||
|
currTabbar: {
|
||||||
|
path: '',
|
||||||
|
query: {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
2
uni-app/src/tabbar.json
Normal file
2
uni-app/src/tabbar.json
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[
|
||||||
|
]
|
||||||
@ -646,7 +646,7 @@ export function setThemeColor (path: string) {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
||||||
if(!current_theme_color && theme_color_list && 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)));
|
||||||
@ -655,7 +655,7 @@ export function setThemeColor (path: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if (!current_theme_color && theme_color_list && 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)))
|
||||||
|
|||||||
@ -3,6 +3,8 @@ import { checkNeedLogin } from '@/utils/auth'
|
|||||||
import { getToken, currRoute, setThemeColor } from '@/utils/common'
|
import { getToken, currRoute, setThemeColor } from '@/utils/common'
|
||||||
import { memberLog } from '@/app/api/auth'
|
import { memberLog } from '@/app/api/auth'
|
||||||
import { useShare } from '@/hooks/useShare'
|
import { useShare } from '@/hooks/useShare'
|
||||||
|
import tabbarJson from '@/tabbar.json'
|
||||||
|
import useSystemStore from '@/stores/system'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面跳转拦截器
|
* 页面跳转拦截器
|
||||||
@ -28,6 +30,10 @@ export const redirectInterceptor = (route: { path: string, query: object }) => {
|
|||||||
params: JSON.stringify(route.query),
|
params: JSON.stringify(route.query),
|
||||||
pre_route: getCurrentPages()[0]?.route
|
pre_route: getCurrentPages()[0]?.route
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #ifdef MP
|
||||||
|
toTabbar(route)
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +65,10 @@ export const launchInterceptor = () => {
|
|||||||
|
|
||||||
// 添加会员访问日志
|
// 添加会员访问日志
|
||||||
if (getToken()) memberLog({ route: launch.path, params: JSON.stringify(launch.query || {}), pre_route: '' })
|
if (getToken()) memberLog({ route: launch.path, params: JSON.stringify(launch.query || {}), pre_route: '' })
|
||||||
|
|
||||||
|
// #ifdef MP
|
||||||
|
toTabbar(launch)
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,3 +94,17 @@ const loadShare = () => {
|
|||||||
if (!shareWhiteList.includes(currRoute() || '')) setShare()
|
if (!shareWhiteList.includes(currRoute() || '')) setShare()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转到tabbar
|
||||||
|
*/
|
||||||
|
const toTabbar = (route: { path: string, query: object }) => {
|
||||||
|
if (tabbarJson.includes(route.path)) {
|
||||||
|
useSystemStore().$patch((state) => {
|
||||||
|
state.currTabbar = route
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/app/pages/index/tabbar'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user