chore(代码合并): 代码从Custom/common分支合并
This commit is contained in:
@@ -5,6 +5,7 @@ Vue.use(Vuex)
|
||||
import Http from '../common/js/http.js'
|
||||
import { themeConfig } from '../common/js/config-external.js'
|
||||
import configExternal from '../common/js/config-external.js'
|
||||
import util from '../common/js/util.js'
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
@@ -14,6 +15,7 @@ const store = new Vuex.Store({
|
||||
tabBarList: '',
|
||||
siteState: 1,
|
||||
themeStyle: '',
|
||||
themeColor: '',
|
||||
addonIsExist: {
|
||||
bundling: 0,
|
||||
coupon: 0,
|
||||
@@ -59,7 +61,7 @@ const store = new Vuex.Store({
|
||||
cartNumber: 0,
|
||||
cartMoney: 0,
|
||||
cartChange: 0,
|
||||
wechatConfigStatus:0,
|
||||
wechatConfigStatus: 0,
|
||||
bottomNavHidden: false, // 底部导航是否隐藏,true:隐藏,false:显示
|
||||
aiUnreadCount: 10, // AI未读消息数量
|
||||
globalAIKefuConfig: null, // AI客服配置
|
||||
@@ -80,8 +82,8 @@ const store = new Vuex.Store({
|
||||
wap_valid_time: 0,
|
||||
},
|
||||
copyright: null,
|
||||
initStatus:false,
|
||||
offlineWhiteList:['pages_order/payment','pages_order/list','pages_order/detail'],//线下支付白名单
|
||||
initStatus: false,
|
||||
offlineWhiteList: ['pages_order/payment', 'pages_order/list', 'pages_order/detail'],//线下支付白名单
|
||||
canReceiveRegistergiftInfo: {
|
||||
status: false,
|
||||
path: ''
|
||||
@@ -227,15 +229,19 @@ const store = new Vuex.Store({
|
||||
setCartMoney(state, value) {
|
||||
state.cartMoney = value;
|
||||
},
|
||||
setInitStatus(state,value){
|
||||
setInitStatus(state, value) {
|
||||
state.initStatus = value
|
||||
},
|
||||
setWechatConfigStatus(state,value){
|
||||
setWechatConfigStatus(state, value) {
|
||||
state.wechatConfigStatus = value
|
||||
},
|
||||
},
|
||||
// 设置AI未读消息数量
|
||||
setAiUnreadCount(state, value) {
|
||||
state.aiUnreadCount = value;
|
||||
},
|
||||
// 设置主题颜色
|
||||
setThemeColor(state, value) {
|
||||
state.themeColor = value;
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
@@ -252,7 +258,8 @@ const store = new Vuex.Store({
|
||||
success: res => {
|
||||
var data = res.data;
|
||||
if (data) {
|
||||
this.commit('setThemeStyle', configExternal.loadThemeSync(data.style_theme.name));
|
||||
this.commit('setThemeStyle', configExternal.loadThemeSync(data.style_theme?.name));
|
||||
this.dispatch('themeColorSet');
|
||||
|
||||
// 底部导航
|
||||
this.commit('setTabBarList', data.diy_bottom_nav);
|
||||
@@ -260,16 +267,16 @@ const store = new Vuex.Store({
|
||||
this.commit('setAddonIsExist', data.addon_is_exist);
|
||||
|
||||
this.commit('setDefaultImg', data.default_img);
|
||||
|
||||
|
||||
this.commit('setSiteInfo', data.site_info);
|
||||
|
||||
this.commit('setServicerConfig', data.servicer);
|
||||
|
||||
|
||||
// 企业微信配置
|
||||
if (data?.wxwork_config) {
|
||||
this.commit('setWxworkConfig', data.wxwork_config);
|
||||
}
|
||||
|
||||
|
||||
this.commit('setCopyright', data.copyright);
|
||||
|
||||
this.commit('setMapConfig', data.map_config);
|
||||
@@ -277,11 +284,11 @@ const store = new Vuex.Store({
|
||||
this.commit('setglobalAIKefuConfig', data.ai_agent_config);
|
||||
|
||||
this.commit('setGlobalStoreConfig', data.store_config);
|
||||
|
||||
|
||||
//联系我们
|
||||
|
||||
|
||||
this.commit('setShopInfo', data.shop_info);
|
||||
this.commit('setWechatConfigStatus',data?.wechat_config_status);
|
||||
this.commit('setWechatConfigStatus', data?.wechat_config_status);
|
||||
// 默认总店
|
||||
if (data.store_info) {
|
||||
this.commit('setDefaultStoreInfo', data.store_info);
|
||||
@@ -290,7 +297,7 @@ const store = new Vuex.Store({
|
||||
this.commit('setDefaultStoreInfo', null);
|
||||
this.commit('setGlobalStoreInfo', null);
|
||||
}
|
||||
this.commit('setInitStatus',true)
|
||||
this.commit('setInitStatus', true)
|
||||
resolve(data);
|
||||
}
|
||||
}
|
||||
@@ -401,6 +408,34 @@ const store = new Vuex.Store({
|
||||
|
||||
this.commit('setCartIds', ids);
|
||||
|
||||
},
|
||||
// 生成主题颜色CSS变量
|
||||
themeColorSet() {
|
||||
console.log('样式颜色设置...');
|
||||
let theme = this.state.themeStyle;
|
||||
if (!theme?.main_color || !theme?.aux_color) return;
|
||||
try {
|
||||
let themeColor = `--base-color:${theme.main_color};--base-help-color:${theme.aux_color};`;
|
||||
if (this.state.tabBarHeight != '56px') themeColor += `--tab-bar-height:${this.state.tabBarHeight};`
|
||||
Object.keys(theme).forEach(key => {
|
||||
let data = theme[key];
|
||||
if (typeof (data) == "object") {
|
||||
Object.keys(data).forEach(k => {
|
||||
themeColor += '--' + k.replace(/_/g, "-") + ':' + data[k] + ';';
|
||||
});
|
||||
} else if (typeof (key) == "string" && key) {
|
||||
themeColor += '--' + key.replace(/_/g, "-") + ':' + data + ';';
|
||||
}
|
||||
});
|
||||
for (let i = 9; i >= 5; i--) {
|
||||
let color = util.colourBlend(theme.main_color, '#ffffff', (i / 10));
|
||||
themeColor += `--base-color-light-${i}:${color};`;
|
||||
}
|
||||
this.commit('setThemeColor', themeColor);
|
||||
} catch (e) {
|
||||
console.error('设置主题颜色失败', e);
|
||||
}
|
||||
console.log('themeColor => ', this.state.themeColor);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user