123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import http from '@/common/request/index'
- import share from '@/common/share';
- import ws from "@/store/ws.js";
- const state = {
- appInfo: {},
- wechat: {autologin:true}, // 微信配置
- share: {}, // 分享配置
- payment: {}, // 支付配置
- recharge: uni.getStorageSync("recharge") || {}, //充值配置
- shareInfo: {} ,// 默认分享数据
- homeTemplate: [], // 首页模板数据
- }
- const getters = {
- appInfo: state => state.appInfo,
- initWechat: state => state.wechat,
- initShare: state => state.share,
- shareInfo: state => state.shareInfo,
- homeTemplate: state => state.homeTemplate,
- }
- const actions = {
- // 初始化数据
- async appInit({
- commit,
- dispatch
- }, options) {
- var params = 'system.config';
- const result = await http('conf.getGroupConf', {
- group: params
- }).then(res => {
- // uni.hideTabBar()
- if (res.code === 0) {
- // uni.setNavigationBarTitle({
- // title: res.data.site_name
- // });
- commit('appInfo', res.data);
- uni.setStorageSync('appInfo', res.data);
- if (!options?.query?.token) {
- dispatch('autoLogin');
- }
- // ws.init();
- // #ifdef MP-WEIXIN
- if(res.data.examine_mode == 1){
- uni.reLaunch({
- url:'/pages/wx/wx'
- });
- return false;
- }
- // #endif
- // if(res.data.bottom_menu_status == 1){
- // dispatch('getbottom_menu',res.data)
- // }else{
- // uni.setTabBarItem({
- // index: 0,
- // text: '找好活',
- // })
- // uni.setTabBarItem({
- // index: 1,
- // text: '找师傅',
- // })
- // uni.setTabBarItem({
- // index: 2,
- // text: '消息',
- // })
- // uni.setTabBarItem({
- // index: 3,
- // text: '我的',
- // })
- // // uni.showTabBar({animation:true})
- // }
- return res.data;
- }
- return false;
- });
- },
- // 获取模板数据
- async getTemplate({
- commit
- }, options) {
- const result = await http('common.template');
- if (result.code === 0) {
- commit('TEMPLATE', result.data);
- uni.setStorageSync('homeTemplate', result.data);
- return result.data;
- } else {
- return false;
- }
- },
-
- }
- const mutations = {
- appInfo(state, data) {
- state.appInfo = data;
- },
- shareInfo(state, shareInfo) {
- state.shareInfo = shareInfo;
- },
- TEMPLATE(state, data) {
- state.template = data;
- state.homeTemplate = data
- }
- }
- export default {
- state,
- mutations,
- actions,
- getters
- }
|