mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-12 10:52:48 +00:00
1.5.0
This commit is contained in:
parent
165b21e927
commit
17c37727e8
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
||||
import { launchInterceptor } from '@/utils/interceptor'
|
||||
import { getToken, isWeixinBrowser, currRoute, deepClone } from '@/utils/common'
|
||||
import { getToken, isWeixinBrowser, currRoute, deepClone, setThemeColor } from '@/utils/common'
|
||||
import useMemberStore from '@/stores/member'
|
||||
import useConfigStore from '@/stores/config'
|
||||
import useSystemStore from '@/stores/system'
|
||||
@ -82,8 +82,11 @@
|
||||
loginConfig = deepClone(configStore.login)
|
||||
}
|
||||
|
||||
// 判断在登录注册页面账号锁定后不进行请求三方登录注册
|
||||
let url: any = currRoute()
|
||||
// 设置主色调
|
||||
setThemeColor(url)
|
||||
|
||||
// 判断在登录注册页面账号锁定后不进行请求三方登录注册
|
||||
if ((['app/pages/auth/index', 'app/pages/auth/login', 'app/pages/auth/register', 'app/pages/auth/resetpwd'].indexOf(url) != -1) &&
|
||||
(loginConfig.is_username || loginConfig.is_mobile || loginConfig.is_bind_mobile)) {
|
||||
return false
|
||||
@ -165,6 +168,7 @@
|
||||
// #ifdef H5
|
||||
if (isWeixinBrowser()) {
|
||||
if (uni.getStorageSync('autoLoginLock') && !uni.getStorageSync('wechat_login_back')) return;
|
||||
// 开启自动注册的情况下才能执行
|
||||
if (loginConfig.is_auth_register || uni.getStorageSync('wechat_login_back')) {
|
||||
uni.removeStorageSync('wechat_login_back') // 删除微信公众号手动授权登录回调标识
|
||||
if (data.query.code) {
|
||||
@ -187,6 +191,7 @@
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
|
||||
})
|
||||
|
||||
onHide(() => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "",
|
||||
"appid": "__UNI__ED923AB",
|
||||
"appid" : "__UNI__149BA20",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
@ -55,11 +55,7 @@
|
||||
"desc" : "为了更好地为您提供服务"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos": [
|
||||
"chooseLocation",
|
||||
"getLocation",
|
||||
"chooseAddress"
|
||||
],
|
||||
"requiredPrivateInfos" : [ "chooseLocation", "getLocation", "chooseAddress" ],
|
||||
"__usePrivacyCheck__" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{
|
||||
"pages": [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
"pages": [
|
||||
// pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "app/pages/index/index",
|
||||
"style": {
|
||||
@ -8,12 +9,10 @@
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.index.index%",
|
||||
"usingComponents": {
|
||||
"diy-group": "../../../../addon/components/diy/group/index",
|
||||
"fixed-group": "../../../../addon/components/fixed/group/index"
|
||||
"diy-group": "../../../../addon/components/diy/group/index"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"diy-group": "view",
|
||||
"fixed-group": "view"
|
||||
"diy-group": "view"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -76,15 +75,45 @@
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.index.diy%",
|
||||
"usingComponents": {
|
||||
"diy-group": "../../../../addon/components/diy/group/index",
|
||||
"fixed-group": "../../../../addon/components/fixed/group/index"
|
||||
"diy-group": "../../../../addon/components/diy/group/index"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"diy-group": "view",
|
||||
"fixed-group": "view"
|
||||
"diy-group": "view"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/index/diy_form",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.index.diy_form%",
|
||||
"usingComponents": {
|
||||
"diy-group": "../../../../addon/components/diy/group/index"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"diy-group": "view"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/index/diy_form_result",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.index.diy_form_result%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/index/diy_form_detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.index.diy_form_detail%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/index/close",
|
||||
"style": {
|
||||
@ -97,146 +126,6 @@
|
||||
"navigationBarTitleText": "%pages.index.nosite%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/apply_cash_out",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.apply_cash_out%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/commission",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.commission%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/balance",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.balance%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/level",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.level%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/detailed_account",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.detailed_account%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/cash_out",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.cash_out%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/cash_out_detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.cash_out_detail%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/index",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.index%",
|
||||
"usingComponents": {
|
||||
"diy-group": "../../../../addon/components/diy/group/index",
|
||||
"fixed-group": "../../../../addon/components/fixed/group/index"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"diy-group": "view",
|
||||
"fixed-group": "view"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/personal",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.personal%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/point",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.point%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/point_detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.point_detail%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/account",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.account%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/account_edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.account_edit%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/address",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.address%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/address_edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.address_edit%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/sign_in",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.sign_in%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "app/pages/member/contact",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.contact%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "app/pages/pay/browser",
|
||||
"style": {
|
||||
@ -320,13 +209,152 @@
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "addon",
|
||||
"pages": [
|
||||
// {{ PAGE_BEGAIN }}
|
||||
// {{ PAGE_END }}}
|
||||
// {{ PAGE_END }}
|
||||
{
|
||||
"path": "end"
|
||||
"root": "app/components",
|
||||
"pages": []
|
||||
},
|
||||
{
|
||||
"root": "app/pages/member",
|
||||
"pages": [
|
||||
{
|
||||
"path": "apply_cash_out",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.apply_cash_out%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "commission",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.commission%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "balance",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.balance%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "level",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.level%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "detailed_account",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.detailed_account%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "cash_out",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.cash_out%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "cash_out_detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.cash_out_detail%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "index",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.index%",
|
||||
"usingComponents": {
|
||||
"diy-group": "../../../../addon/components/diy/group/index"
|
||||
},
|
||||
"componentPlaceholder": {
|
||||
"diy-group": "view"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "personal",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.personal%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "point",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.point%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "point_detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.point_detail%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "account",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.account%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "account_edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.account_edit%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "address",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.address%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "address_edit",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.address_edit%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "sign_in",
|
||||
"style": {
|
||||
// #ifndef H5
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"navigationBarTitleText": "%pages.member.sign_in%"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "contact",
|
||||
"style": {
|
||||
"navigationBarTitleText": "%pages.member.contact%"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -344,7 +372,7 @@
|
||||
"pagePath": "app/pages/index/index"
|
||||
},
|
||||
{
|
||||
"pagePath": "app/pages/member/index"
|
||||
"pagePath": "app/pages/index/nosite"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -352,12 +380,10 @@
|
||||
"easycom": {
|
||||
"custom": {
|
||||
"diy-group": "@/addon/components/diy/group/index.vue",
|
||||
"fixed-group": "@/addon/components/fixed/group/index.vue",
|
||||
"^u-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"diy-(\W.*)": "@/app/components/diy/$1/index.vue",
|
||||
"fixed-(\W.*)": "@/app/components/fixed/$1/index.vue"
|
||||
"diy-(\W.*)": "@/app/components/diy/$1/index.vue"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,18 +382,52 @@ export function timeStampTurnTime(timeStamp: any, type = "") {
|
||||
* 日期格式转时间戳
|
||||
* @param {Object} date
|
||||
*/
|
||||
export function timeTurnTimeStamp(date: string) {
|
||||
var f = date.split(' ', 2);
|
||||
var d = (f[0] ? f[0] : '').split('-', 3);
|
||||
var t = (f[1] ? f[1] : '').split(':', 3);
|
||||
return (new Date(
|
||||
parseInt(d[0], 10) || null,
|
||||
(parseInt(d[1], 10) || 1) - 1,
|
||||
parseInt(d[2], 10) || null,
|
||||
parseInt(t[0], 10) || null,
|
||||
parseInt(t[1], 10) || null,
|
||||
parseInt(t[2], 10) || null
|
||||
)).getTime() / 1000;
|
||||
export function timeTurnTimeStamp(dateStr: string) {
|
||||
let timestamp;
|
||||
let date;
|
||||
|
||||
// 尝试解析 'YYYY年M月D日'
|
||||
try {
|
||||
let dateStr1 = dateStr.replace('年', '-').replace('月', '-').replace('日', '');
|
||||
date = new Date(dateStr1);
|
||||
timestamp = date.getTime();
|
||||
} catch (e) {
|
||||
// 尝试解析 'YYYY-MM-DD'
|
||||
try {
|
||||
date = new Date(dateStr);
|
||||
timestamp = date.getTime();
|
||||
} catch (e) {
|
||||
// 尝试解析 'YYYY/MM/DD'
|
||||
try {
|
||||
date = new Date(dateStr.replace(/\//g, "-"));
|
||||
timestamp = date.getTime();
|
||||
} catch (e) {
|
||||
// 尝试解析 'YYYY年M月D日 HH时mm分'
|
||||
try {
|
||||
let dateStr1 = dateStr.replace('年', '-').replace('月', '-').replace('日', ' ').replace('时', ':').replace('分', '');
|
||||
date = new Date(dateStr1);
|
||||
timestamp = date.getTime();
|
||||
} catch (e) {
|
||||
// 尝试解析 'YYYY-MM-DD HH:mm'
|
||||
try {
|
||||
date = new Date(dateStr);
|
||||
timestamp = date.getTime();
|
||||
} catch (e) {
|
||||
// 尝试解析 'YYYY/MM/DD HH:mm'
|
||||
try {
|
||||
date = new Date(dateStr.replace(/\//g, "-"));
|
||||
timestamp = date.getTime();
|
||||
} catch (e) {
|
||||
// 如果所有格式都失败,返回null
|
||||
console.error("无法解析日期字符串:", dateStr);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (timestamp / 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,3 +578,81 @@ export function goback(data: any) {
|
||||
}
|
||||
}, 600);
|
||||
}
|
||||
|
||||
|
||||
// 获取微信OpenId、微信公众号OpenId
|
||||
export function getWinxinOpenId() {
|
||||
const memberStore = useMemberStore();
|
||||
const memberInfo = memberStore.info;
|
||||
|
||||
let obj = {
|
||||
weapp: '',
|
||||
wechat: ''
|
||||
}
|
||||
|
||||
if (memberInfo) {
|
||||
obj.weapp = memberInfo.weapp_openid;
|
||||
obj.wechat = memberInfo.wx_openid;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// 获取有效期
|
||||
export function getValidTime(minutes: any = 1) {
|
||||
var date = new Date();
|
||||
date.setSeconds(60 * minutes);
|
||||
let validTime: any = parseInt(date.getTime() / 1000); // 定位信息 5分钟内有效,过期后将重新获取定位信息
|
||||
return validTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测当前访问的是系统(app)还是插件
|
||||
* 设置插件的底部导航
|
||||
* 设置插件应用的主色调
|
||||
* @param path
|
||||
*/
|
||||
export function setThemeColor (path: string) {
|
||||
let pathArr = path.split('/')
|
||||
let index = !pathArr[0] ? 1 : 0;
|
||||
let route = pathArr[index] == 'addon' ? pathArr[(index+1)] : 'app';
|
||||
|
||||
// 设置底部导航
|
||||
const configStore = useConfigStore()
|
||||
if (configStore.addon != route) {
|
||||
configStore.addon = route;
|
||||
}
|
||||
|
||||
// 设置插件应用的主色调,排除系统
|
||||
const theme_color_list = uni.getStorageSync('theme_color_list');
|
||||
const current_theme_color = uni.getStorageSync('current_theme_color');
|
||||
let theme = '';
|
||||
if (route != 'app') {
|
||||
try {
|
||||
theme = theme_color_list[route];
|
||||
if(theme && theme.value){
|
||||
configStore.themeColor = theme.value
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(theme.value));
|
||||
}else if( !theme && current_theme_color){
|
||||
configStore.themeColor = ''
|
||||
}else{
|
||||
theme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||
configStore.themeColor = theme.value
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(theme.value));
|
||||
}
|
||||
} catch (e) {
|
||||
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
||||
if(!current_theme_color && theme_color_list){
|
||||
theme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||
configStore.themeColor = theme.value
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(theme.value));
|
||||
}else{
|
||||
configStore.themeColor = '';
|
||||
}
|
||||
}
|
||||
|
||||
}else if(!current_theme_color && theme_color_list){
|
||||
theme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||
configStore.themeColor = theme.value
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(theme.value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { language } from '@/locale'
|
||||
import { checkNeedLogin } from '@/utils/auth'
|
||||
import { getToken, currRoute } from '@/utils/common'
|
||||
import { getToken, currRoute, setThemeColor } from '@/utils/common'
|
||||
import { memberLog } from '@/app/api/auth'
|
||||
import useConfigStore from "@/stores/config";
|
||||
import { useShare } from '@/hooks/useShare'
|
||||
|
||||
/**
|
||||
@ -12,7 +11,7 @@ export const redirectInterceptor = (route: { path: string, query: object }) => {
|
||||
route.path = `/${ route.path }`
|
||||
|
||||
// 检测当前访问的是系统(app)还是插件
|
||||
setAddonName(route.path)
|
||||
setThemeColor(route.path)
|
||||
|
||||
// #ifdef MP
|
||||
route.path.indexOf('addon') != -1 && language.loadAllLocaleMessages('addon', uni.getLocale())
|
||||
@ -39,7 +38,7 @@ export const launchInterceptor = () => {
|
||||
launch.path = `/${ launch.path }`
|
||||
|
||||
// 检测当前访问的是系统(app)还是插件
|
||||
setAddonName(launch.path);
|
||||
setThemeColor(launch.path);
|
||||
|
||||
// 加载语言包
|
||||
language.loadAllLocaleMessages('app', uni.getLocale())
|
||||
@ -62,35 +61,6 @@ export const launchInterceptor = () => {
|
||||
if (getToken()) memberLog({ route: launch.path, params: JSON.stringify(launch.query || {}), pre_route: '' })
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测当前访问的是系统(app)还是插件
|
||||
* 设置插件的底部导航
|
||||
* 设置插件应用的主色调
|
||||
* @param path
|
||||
*/
|
||||
const setAddonName = async(path: string) => {
|
||||
let pathArr = path.split('/')
|
||||
let route = pathArr[1] == 'addon' ? pathArr[2] : 'app';
|
||||
|
||||
// 设置底部导航
|
||||
const configStore = useConfigStore()
|
||||
if (configStore.addon != route) {
|
||||
configStore.addon = route;
|
||||
}
|
||||
|
||||
// 设置插件应用的主色调,排除系统
|
||||
if (route != 'app') {
|
||||
try {
|
||||
const theme = await import(`../addon/${ route }/utils/theme.json`)
|
||||
configStore.themeColor = theme.default
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(theme.default));
|
||||
} catch (e) {
|
||||
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 加载分享
|
||||
const loadShare = () => {
|
||||
@ -106,6 +76,7 @@ const loadShare = () => {
|
||||
'addon/shop_giftcard/pages/detail',
|
||||
'addon/shop_giftcard/pages/give',
|
||||
'app/pages/index/diy',
|
||||
'app/pages/index/diy_form',
|
||||
'app/pages/friendspay/share',
|
||||
'app/pages/friendspay/money'
|
||||
]
|
||||
|
||||
@ -152,7 +152,7 @@ class Request {
|
||||
break;
|
||||
case 403:
|
||||
if (currRoute().indexOf('app/pages/index/nosite') != -1) return;
|
||||
redirect({ url: '/app/pages/index/nosite', mode: 'reLaunch' })
|
||||
redirect({ url: '/app/pages/index/nosite', mode: 'switchTab' })
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user