feat: 首次提交

This commit is contained in:
peerless_hero
2023-08-17 21:28:49 +08:00
parent 36f80fb971
commit ec1e5e16cd
571 changed files with 95322 additions and 0 deletions

86
store/index.js Normal file
View File

@ -0,0 +1,86 @@
// 本文件由FirstUI授权予新疆天衡创新研究院有限公司手机号186 1 4 0725 49身份证尾号5A07X5专用请尊重知识产权勿私下传播违者追究法律责任。
// #ifdef MP
import http from '../common/fui-request'
// #endif
// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
// #endif
// #ifdef VUE3
import {
createStore
} from 'vuex'
const store = createStore({
// #endif
state: {
//当前版本
version: "2.0.0",
//主题 light、dark
theme: uni.getStorageSync('fui_theme') || 'light',
status: 0
},
mutations: {
setTheme(state, theme) {
state.theme = theme || 'light'
},
setStatus(state, status) {
state.status = status
}
},
actions: {
getStatus: async function({
commit,
state
}) {
return await new Promise((resolve, reject) => {
// #ifndef MP
commit('setStatus', 1)
resolve(true)
// #endif
// #ifdef MP
if (state.status == 1) {
resolve(true)
} else {
//wxalibaidutoutiaoqq
let platform = 'wx';
// #ifdef MP-ALIPAY
platform = 'ali';
// #endif
// #ifdef MP-BAIDU
platform = 'baidu';
// #endif
// #ifdef MP-TOUTIAO
platform = 'toutiao';
// #endif
// #ifdef MP-QQ
platform = 'qq';
// #endif
http.get(`/api/main/site-status/${platform}`, {
brief: true,
showLoading: false,
errorMsg: ''
}).then(res => {
if (res.succeeded && res.data == 1) {
commit('setStatus', 1)
resolve(true)
} else {
resolve(false)
}
}).catch(e => {
reject(false)
})
}
// #endif
})
}
}
})
export default store