shish před 4 roky
rodič
revize
50bea8b7b0

+ 2 - 2
ghsApp/src/admin/home/me.vue

@@ -207,9 +207,9 @@ export default {
     },
     // #endif
     async selectShopFn (val) {
-      uni.showLoading({mask:true})
+        uni.showLoading({mask:true})
         await toggleShop({ shopId: val.id })
-        //有多处相似地方,请全项目搜索about_store_clear
+        uni.hideLoading()
         // #ifdef MP-WEIXIN
         this.$store.commit("setLoginInfo", {})
         this.$store.commit("setMyShopInfo", {})

+ 0 - 1
ghsApp/src/admin/home/workbench.vue

@@ -145,7 +145,6 @@ export default {
 		}
 	},
 	computed: {
-		...mapGetters({ userInfo: "getUser" }),
 		...mapGetters({ loginInfo: "getLoginInfo" }),
 		...mapGetters({ myShopInfo: "getMyShopInfo" }),
 	},

+ 2 - 5
hdApp/src/admin/common/callback.vue

@@ -10,17 +10,14 @@
 <script>
 import appResult from "@/components/app-result";
 import { mapGetters, mapState } from 'vuex'
-import { getUser, wxLoginFn } from '@/utils/auth'
+import { getShopInfo, wxLoginFn } from '@/utils/auth'
 export default {
 	name: "BillingResult", // 开单结果
 	components: {
 		appResult
 	},
-  computed: {
-		...mapGetters({ userInfo: "getUser"})
-	},
   onShow() {
-    getUser(true)
+    getShopInfo(true)
   },
   methods: {
     back() {

+ 2 - 9
hdApp/src/admin/goodsManage/freight.vue

@@ -19,7 +19,7 @@
 
 <script>
 import { mapGetters, mapState } from 'vuex'
-import { getUser } from '@/utils/auth'
+import { getShopInfo } from '@/utils/auth'
 import { freightSet } from '@/api/goods'
 export default {
 	name: 'setting-freight',
@@ -31,13 +31,6 @@ export default {
 			}
 		}
 	},
-	computed: {
-		...mapGetters({ userInfo: 'getUser' })
-	},
-	onLoad() {},
-	mounted() {
-		// this.init()
-	},
 	watch: {
 		userInfo() {
 			if (!this.$util.isEmpty(this.userInfo)) {
@@ -48,7 +41,7 @@ export default {
 	},
 	methods: {
 		init() {
-			getUser().then(res => {
+			getShopInfo().then(res => {
 				this.form.first = this.userInfo.extend.freeDistance
 				this.form.add = this.userInfo.extend.freight
 			})

+ 4 - 4
hdApp/src/admin/home/login.vue

@@ -50,7 +50,7 @@
 </template>
 <script>
 import { mapActions } from "vuex";
-import { getUser} from "@/utils/auth";
+import { getShopInfo} from "@/utils/auth";
 import {appLogin} from '@/api/common'
 import { getDictionaries } from '@/api/mini'
 import { replaceClientId } from '@/api/admin'
@@ -154,7 +154,7 @@ export default {
 							that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 						})
 						that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-						getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+						getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
 						that.setUserShopAll()
 						// #ifdef APP-PLUS
 						//保存安卓的clientId
@@ -224,7 +224,7 @@ export default {
 										that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 									})
 									that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-									getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+									getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
 									that.setUserShopAll()
 									// #ifdef APP-PLUS
 									//保存安卓的clientId
@@ -301,7 +301,7 @@ export default {
 						that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 					})
 					that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-					getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+					getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
 					that.setUserShopAll()
 					// #ifdef APP-PLUS
 					//保存安卓的clientId

+ 13 - 3
hdApp/src/admin/home/me.vue

@@ -115,7 +115,7 @@ import { mainMy, applyCash } from "@/api/home";
 import { toggleShop } from "@/api/common";
 import DorpdownSelect from "@/components/module/dorpdownSelect";
 import { selectShop } from "@/mixins";
-import { getUser } from "@/utils/auth";
+import { getShopInfo } from "@/utils/auth";
 import { list } from "@/mixins";
 import { mapGetters } from "vuex";
 import NotLogin from "@/components/not-login";
@@ -201,11 +201,21 @@ export default {
       uni.stopPullDownRefresh()
     },
     async changeShop() {
-        uni.showLoading()
+        uni.showLoading({mask:true})
         await toggleShop({ shopId: this.shopId })
+        uni.hideLoading()
+        // #ifdef MP-WEIXIN
         this.$store.commit("setLoginInfo", {})
+        this.$store.commit("setMyShopInfo", {})
         this.$util.pageTo({url: "/admin/home/me",type: 3})
-        uni.hideLoading()
+        // #endif
+        // #ifdef APP-PLUS
+        this.$store.commit("setLoginInfo", {})
+        this.$store.commit("setDictionariesInfo", {})
+        this.$store.commit("setMyShopInfo", {})
+        plus.runtime.restart()
+        // #endif
+        getShopInfo(true)
     },
     checkToApplyCash () {
       let self = this;

+ 8 - 9
hdApp/src/admin/home/workbench.vue

@@ -72,7 +72,7 @@
 <script>
 import { mapGetters, mapState } from "vuex";
 import { getWeixinId } from "@/api/invite/index";
-import { getUser } from "@/utils/auth";
+import { getShopInfo } from "@/utils/auth";
 import { consoleIndex } from "@/api/workbench";
 import NotLogin from "@/components/not-login";
 import autoUpdateMixins from "@/mixins/autoUpdate";
@@ -124,7 +124,6 @@ export default {
       };
   },
   computed: {
-    ...mapGetters({ userInfo: "getUser" }),
     ...mapGetters({ loginInfo: "getLoginInfo" })
   },
   onLoad () {
@@ -134,6 +133,13 @@ export default {
     uni.stopPullDownRefresh();
   },
   onShow () {
+      getShopInfo().then(res => {
+        if(res.name){
+          uni.setNavigationBarTitle({ title: res.name })
+        }else{
+          uni.setNavigationBarTitle({ title: '店铺' })
+        }
+      })
   },
   methods: {
     goGd(){
@@ -163,13 +169,6 @@ export default {
         getWeixinId().then(res => {
           this.getappIdList = res.data
         });
-        getUser().then(res => {
-          if(res.name){
-            uni.setNavigationBarTitle({ title: res.name })
-          }else{
-            uni.setNavigationBarTitle({ title: '店铺' })
-          }
-        })
         // #ifdef MP-WEIXIN
         this.isMini = 1
         // #endif

+ 1 - 1
hdApp/src/api/common/index.js

@@ -13,7 +13,7 @@ export const getMerchantInfo = param => https.get("/merchant/get-info", param);
 export const getShopUserApi = param => https.get("/user/my-profile", param);
 
 // 商户信息
-export const getUserApi = param => https.get("/merchant/detail", param);
+export const getShopInfoApi = param => https.get("/merchant/detail", param);
 
 // 员工信息
 export const getStaffApi = param => https.get("/admin/login-detail", param);

+ 4 - 4
hdApp/src/mixins/globalMixins.js

@@ -1,6 +1,6 @@
 import { mapGetters,mapActions } from 'vuex'
 import { pageTo } from '@/utils/util.js'
-import { getUser, wxLoginFn } from '@/utils/auth'
+import { getShopInfo, wxLoginFn } from '@/utils/auth'
 import { getDictionaries } from '@/api/mini'
 import { hasTokenAutoLogin } from '@/api/common'
 import constant from '@/constant'
@@ -48,7 +48,7 @@ export default {
 						let currentMiniOpenId = res.data.currentMiniOpenId || ''
 						uni.setStorageSync('currentMiniOpenId', currentMiniOpenId)
 						if (!this.$util.isEmpty(token)) {
-							getUser(true)
+							getShopInfo(true)
 							this.setUserShopAll()
 						}
 						if (this.init) {
@@ -69,7 +69,7 @@ export default {
 						that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 					})
 					that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-					getUser(true).then(res => { 
+					getShopInfo(true).then(res => { 
 						uni.setNavigationBarTitle({ title: res.name })
 					})
 					that.setUserShopAll()
@@ -92,7 +92,7 @@ export default {
 							that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 						})
 						that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-						getUser(true).then(res => { 
+						getShopInfo(true).then(res => { 
 							uni.setNavigationBarTitle({ title: res.name })
 						})
 						that.setUserShopAll()

+ 2 - 2
hdApp/src/pagesClient/official/apply.vue

@@ -104,7 +104,7 @@ import htzImageUpload from '../components/htz-image-upload/htz-image-upload.vue'
 import { mapResolve } from "@/api/map";
 import util from '@/utils/util';
 import { APIHOST } from '@/config'
-import { getUser} from "@/utils/auth";
+import { getShopInfo} from "@/utils/auth";
 import { getDictionaries } from '@/api/mini'
 export default {
   name: "apply-data",
@@ -330,7 +330,7 @@ export default {
             that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
           })
           that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-          getUser(true).then(res => { 
+          getShopInfo(true).then(res => { 
             uni.setNavigationBarTitle({ title: res.name }) 
           })
           that.setUserShopAll()

+ 2 - 2
hdApp/src/store/modules/merchant.js

@@ -1,4 +1,4 @@
-import { getUserApi } from "@/api/common/index";
+import { getShopInfoApi } from "@/api/common/index";
 export default {
 	state: {
 		merchantInfo: null //商家信息
@@ -11,7 +11,7 @@ export default {
 	actions: {
 		async initMerchantInfo({ commit }) {
 			try {
-				const { data } = await getUserApi();
+				const { data } = await getShopInfoApi();
 				commit("UPDATE_MERCHANT_INFO", data);
 				return data;
 			} catch (error) {

+ 4 - 12
hdApp/src/utils/auth.js

@@ -1,5 +1,5 @@
 import store from '@/store'
-import { getStaffApi, getUserApi, getShopUserApi } from '@/api/common'
+import { getStaffApi, getShopInfoApi, getShopUserApi } from '@/api/common'
 import { postWxCode,getDictionaries } from '@/api/mini'
 import util from './util'
 //获取商城端用户信息 update为true时会重新触发请求,重置vuex的数据
@@ -22,12 +22,12 @@ export async function getShopUser(update) {
  * 获取后台商户用户信息
  * @parmas update为true时会重新触发请求,重置vuex的数据
  */
-export async function getUser(update) {
+export async function getShopInfo(update) {
 	let userInfo = store.getters.getUser
 	if (!util.isEmpty(userInfo) && !update) {
 		return userInfo
 	}
-	await getUserApi().then((res) => {
+	await getShopInfoApi().then((res) => {
 		userInfo = res.data
 		store.dispatch('setUser', userInfo)
 	}).catch(() => {
@@ -141,12 +141,4 @@ export async function wxLoginFn(update) {
 			}
 		})
 	})
-}
-
-// export default {
-// 	getSelfInfo,
-// 	getUser,
-// 	resetAllUser,
-// 	getRoleReal
-// }
-
+}