|
@@ -112,6 +112,7 @@ import {appLogin} from '@/api/common'
|
|
|
import { getDictionaries } from '@/api/mini'
|
|
import { getDictionaries } from '@/api/mini'
|
|
|
import productMins from "@/mixins/product";
|
|
import productMins from "@/mixins/product";
|
|
|
import { allProduct } from '@/api/product'
|
|
import { allProduct } from '@/api/product'
|
|
|
|
|
+import { replaceClientId } from '@/api/admin'
|
|
|
export default {
|
|
export default {
|
|
|
name: "admin-workbench",
|
|
name: "admin-workbench",
|
|
|
components: {
|
|
components: {
|
|
@@ -196,39 +197,50 @@ export default {
|
|
|
...mapActions(['setUserShopAll']),
|
|
...mapActions(['setUserShopAll']),
|
|
|
|
|
|
|
|
loginFun(mobile,password){
|
|
loginFun(mobile,password){
|
|
|
|
|
+ let that = this
|
|
|
uni.showLoading({mask:true})
|
|
uni.showLoading({mask:true})
|
|
|
//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
appLogin({mobile,password}).then(subRes=>{
|
|
appLogin({mobile,password}).then(subRes=>{
|
|
|
|
|
|
|
|
if(subRes.code == 1){
|
|
if(subRes.code == 1){
|
|
|
|
|
|
|
|
- if (this.$util.isEmpty(subRes)) {
|
|
|
|
|
|
|
+ if (that.$util.isEmpty(subRes)) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
uni.setStorageSync('token', subRes.data.token)
|
|
uni.setStorageSync('token', subRes.data.token)
|
|
|
uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
|
getDictionaries({ token: subRes.data.token }).then(res => {
|
|
getDictionaries({ token: subRes.data.token }).then(res => {
|
|
|
- if (this.$util.isEmpty(res)) {
|
|
|
|
|
|
|
+ if (that.$util.isEmpty(res)) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- this.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
|
|
- this.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
|
|
|
|
+ that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
|
|
+ that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
})
|
|
})
|
|
|
- this.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
|
|
|
|
+ that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
|
|
|
|
|
- this.show_login_model = false
|
|
|
|
|
|
|
+ that.show_login_model = false
|
|
|
|
|
|
|
|
uni.showTabBar()
|
|
uni.showTabBar()
|
|
|
|
|
|
|
|
getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
|
|
|
//#ifdef APP-PLUS
|
|
//#ifdef APP-PLUS
|
|
|
- this.skCustomId = subRes.data.skCustomId
|
|
|
|
|
- this.listenPDAkd()
|
|
|
|
|
|
|
+ that.skCustomId = subRes.data.skCustomId
|
|
|
|
|
+ that.listenPDAkd()
|
|
|
// #endif
|
|
// #endif
|
|
|
- this.setUserShopAll()
|
|
|
|
|
- this.init()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ that.setUserShopAll()
|
|
|
|
|
+ that.init()
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ //保存安卓的clientId
|
|
|
|
|
+ let hasClientId = !that.$util.isEmpty(subRes.data.admin.clientId) ? subRes.data.admin.clientId : ''
|
|
|
|
|
+ const clientInfo = plus.push.getClientInfo()
|
|
|
|
|
+ let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
|
|
+ if(hasClientId == '' || hasClientId != currentClientId){
|
|
|
|
|
+ replaceClientId({id:currentClientId}).then(res=>{ })
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|