| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- export const state = () => ({
- isPC: -1,
- isWeixin: false,
- userinfo: {},
- wxConfig: {},
- regPhone: /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[35678]|18[0-9]|14[57])[0-9]{8}$/,
- regEmail: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
- regSpecialChar: /[&¥%\/\*]+/,
- deviceType: {},
- domainConfig: {
- api: "",
- siteUrl: "",
- rooterUrl: "",
- jishuinUrl: ""
- }
- });
- export const getters = {
- isLogin(state) {
- return state.userinfo && !!state.userinfo.nickname;
- }
- };
- export const mutations = {
- updateDomainConfig(state, config) {
- console.log("update-----------store-----------");
- console.log(config);
- state.domainConfig = {
- api: config.api,
- siteUrl: config.siteUrl,
- jishuinUrl: config.jishuinUrl,
- rooterUrl: config.rooterUrl
- };
- },
- updateUserinfo(state, payload) {
- state.userinfo = payload.userinfo;
- },
- updateIsPC(state, payload) {
- state.isPC = payload.isPC;
- },
- updateIsWeixin(state, payload) {
- state.isWeixin = payload.isWeixin;
- },
- updateDeviceType(state, payload) {
- state.deviceType = payload;
- },
- updateWxConfig(state, payload) {
- state.wxConfig = {
- ...state.wxConfig,
- ...payload.wxConfig
- };
- }
- };
- export const actions = {
- async nuxtServerInit({ commit }, { app }) {
- commit("updateDeviceType", app.$deviceType || {});
- }
- };
|