80 lines
1.5 KiB
JavaScript
80 lines
1.5 KiB
JavaScript
import {
|
|
defineStore
|
|
} from "pinia";
|
|
import {
|
|
getCommonConfig
|
|
} from '@/api/init.js'
|
|
const $map = {
|
|
882: 'isWxIosPay',
|
|
833: 'checkIosLogin',
|
|
834: 'checkIosPay',
|
|
835: 'checkWxLogin',
|
|
836: 'checkPhoneLogin',
|
|
108: 'isOpenWxWebAutoLogin',
|
|
817: 'zhengbu',
|
|
818: 'danbu',
|
|
252: 'adUnitId',
|
|
821: 'playType',
|
|
251: 'isGuanggao',
|
|
254: 'isGuanggaody',
|
|
202: 'kefu',
|
|
249: 'moreSearch', //热搜词
|
|
206: 'kefuPhone',
|
|
204: 'kefuUrl',
|
|
203: 'kefuAppId',
|
|
248: 'isVips',
|
|
49: 'AppUrl',
|
|
823: 'OfferID',
|
|
824: 'payEnv',
|
|
825: 'moneyTips',
|
|
855: 'kmPaySel',
|
|
849: 'homeTypeSel',
|
|
856: 'syPaySel',
|
|
857: 'imId',
|
|
858: 'isAccountPay',
|
|
860: 'dyadUnitId',
|
|
881: '',
|
|
109: '',
|
|
922: 'withdrawNum',
|
|
500: 'payTips',
|
|
914: 'goldBili', // 金币比例
|
|
919: 'isExamine' //是否ios审核中
|
|
}
|
|
|
|
export const useCommonStore = defineStore("common", {
|
|
state() {
|
|
return {
|
|
payTips: '付款完成后不要忘记抽红包哦',
|
|
goldBili: 0,
|
|
sysInfo:{},
|
|
isIos:false,
|
|
isExamine:1
|
|
};
|
|
},
|
|
actions: {
|
|
async init() {
|
|
this.sysInfo=uni.getSystemInfoSync()
|
|
this.isIos=this.sysInfo.platform == 'ios'
|
|
const res = await getCommonConfig()
|
|
if (res) {
|
|
for (let i in $map) {
|
|
const key = $map[i]
|
|
if (key) {
|
|
this[key] = res[i]
|
|
uni.setStorageSync(key, res[i])
|
|
}
|
|
}
|
|
}
|
|
},
|
|
isIosExamine() {
|
|
if (!this.isIos) {
|
|
return true
|
|
}
|
|
if (this.isExamine == 1) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
},
|
|
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
|
}); |