From d39644872fa6f9499fc2c1651bced631a9e96b19 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期一, 23 十二月 2024 09:48:53 +0800
Subject: [PATCH] 1.高德地图未开发完成版本(可能废弃)
---
store/index.js | 95 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/store/index.js b/store/index.js
index 766cdbf..146839b 100644
--- a/store/index.js
+++ b/store/index.js
@@ -19,6 +19,7 @@
leftWinActive: '/pages/component/view/view',
activeOpen: '',
menu: [],
+ appMenu: [],
univerifyErrorMsg: '',
currentInfo: {}, //个人用户信息
cache_address: {},
@@ -38,6 +39,7 @@
cache: {
coupon: {},
goods:[],
+ cache_coupon_select_cancel:0
},
defaultaddress: {},
addressDesc:'',
@@ -60,7 +62,9 @@
state.hasLogin = false
state.openid = null
state.currentInfo = {}
+ state.appMenu=[]
storage.removeItem('token')
+ storage.removeItem('appMenu');
message.showToast('退出登录成功')
},
@@ -71,7 +75,10 @@
state.defaultaddress = defaultaddress
},
setAddressDesc(state, addressDesc) {
+ console.log('setAddressDesc',addressDesc)
state.addressDesc = addressDesc
+ storage.setItem("defaultaddress",addressDesc || "")
+
},
setTestTrue(state) {
state.testvuex = true
@@ -135,6 +142,14 @@
}, dto) {
state.cache['coupon'] = dto || {}
},
+
+ cache_coupon_select_cancel: async function({
+ commit,
+ state
+ }, val) {
+ state.cache['cache_coupon_select_cancel'] = val || 0
+ },
+
cache_goods_select: async function({
commit,
state
@@ -184,6 +199,7 @@
}) {
//把权限获取到
// console.log('getCurrentInfo,getCurrentInfo')
+
const currentInfo = await http.request('get', '/api/current/user', {})
if (currentInfo && currentInfo.code == 0) {
// state.cMenu = cMenu
@@ -200,6 +216,81 @@
//这种情况就是要跳转到登录页面
}
},
+
+ getSwitchSubAccount: async function({commit,state},payload) {
+ //把权限获取到
+ // console.log('getCurrentInfo,getCurrentInfo')
+
+ const currentInfo = await http.request('get', '/api/supplierSub/getSwitchById', {
+ params: {
+ id:payload.id,
+ type:payload.type
+ }
+ })
+ if (currentInfo && currentInfo.code == 0) {
+
+ state.currentInfo = currentInfo.data || {}
+ state.type = currentInfo.data.type || ''
+ state.spacecode = currentInfo.data.spacecode || ''
+
+ commit("updateLogin", true)
+ } else {
+ commit("updateLogin", false)
+ //这种情况就是要跳转到登录页面
+ }
+
+ return currentInfo;
+ },
+
+
+ getAppMenu: async function({
+ commit,
+ state
+ }) {
+ //把权限获取到
+ const menu = await http.request('get', '/api/app/menu/permission/menu', {})
+ storage.setItem('appMenu', []);
+ if (menu && menu.code == 0) {
+ const appMenu = menu.data || []
+ storage.setItem('appMenu', appMenu);
+
+ // commit("updateLogin", true)
+ } else {
+ // commit("updateLogin", false)
+ //这种情况就是要跳转到登录页面
+ }
+ },
+
+ getAppMenuSupplier: async function({
+ commit,
+ state
+ }) {
+ //把权限获取到
+ const menu = await http.request('get', '/api/app/menu/supplier/permission/menu', {})
+ storage.setItem('appMenu', []);
+ if (menu && menu.code == 0) {
+ const appMenu = menu.data || []
+ storage.setItem('appMenu', appMenu);
+ } else {
+
+ }
+ },
+ getAppMenuPartner: async function({
+ commit,
+ state
+ }) {
+ //把权限获取到
+ const menu = await http.request('get', '/api/app/menu/partner/permission/menu', {})
+ storage.setItem('appMenu', []);
+ if (menu && menu.code == 0) {
+ const appMenu = menu.data || []
+ storage.setItem('appMenu', appMenu);
+ } else {
+
+ }
+ },
+
+
loginwx: async function({
dispatch,
commit,
@@ -290,6 +381,8 @@
storage.setItem('token', resp.data.access_token)
commit("updateLogin", true)
await dispatch('getCurrentInfo')
+ // 获取所有权限菜单
+ await dispatch('getAppMenuPartner')
uni.reLaunch({
url: '/pages/home/supplier-home'
})
@@ -355,6 +448,8 @@
storage.setItem('token', resp.data.access_token)
commit("updateLogin", true)
await dispatch('getCurrentInfo')
+ // 获取所有供应商权限菜单
+ await dispatch('getAppMenuSupplier')
console.log('login,reLaunch')
// #ifdef APP
--
Gitblit v1.9.3