|
|
@@ -93,7 +93,7 @@
|
|
|
<none-hd :show="no_shop_show_model" :title="MODEL_TITLE" :btnText="MODEL_BTN_TEXT" @bthClick="toFreeApply_HOME" :authShow="EXPER_AUTH_SHOW" @comfirm="experienceFun"></none-hd>
|
|
|
</view>
|
|
|
<view v-else>
|
|
|
- <loginModel :show="show_login_model" @comfirm="loginFun"></loginModel>
|
|
|
+ <loginModel :show="show_login_model" @comfirm="loginFun" @mobileLogin="mobileLogin"></loginModel>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -113,6 +113,7 @@ import { getDictionaries } from '@/api/mini'
|
|
|
import productMins from "@/mixins/product";
|
|
|
import { allProduct } from '@/api/product'
|
|
|
import { replaceClientId } from '@/api/admin'
|
|
|
+import { phoneLogin } from "@/api/auth";
|
|
|
export default {
|
|
|
name: "admin-workbench",
|
|
|
components: {
|
|
|
@@ -195,7 +196,93 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['setUserShopAll']),
|
|
|
+ mobileLogin(){
|
|
|
+ let that = this
|
|
|
+ uni.preLogin({
|
|
|
+ provider: 'univerify',
|
|
|
+ success:()=>{
|
|
|
+ uni.login({
|
|
|
+ provider: 'univerify',
|
|
|
+ univerifyStyle: { // 自定义登录框样式
|
|
|
+ },
|
|
|
+ success:(res)=>{ // 登录成功
|
|
|
+ let openid = res.authResult.openid
|
|
|
+ let access_token = res.authResult.access_token
|
|
|
+ phoneLogin({openid,access_token}).then(subRes=>{
|
|
|
+
|
|
|
+ let currentShopId = subRes.data.admin.currentShopId || 0
|
|
|
+ if(Number(currentShopId) <= 0){
|
|
|
+ //没店
|
|
|
+ let openShop = subRes.data.admin.openShop || 1
|
|
|
+ if(openShop == 1){
|
|
|
+ //没店没申请
|
|
|
+ }
|
|
|
+ if(openShop == 2){
|
|
|
+ //没店已申请
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //有店
|
|
|
+
|
|
|
+ //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
+ if(subRes.code == 1){
|
|
|
+ if (that.$util.isEmpty(subRes)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.setStorageSync('token', subRes.data.token)
|
|
|
+ uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
|
+ getDictionaries({ token: subRes.data.token }).then(res => {
|
|
|
+ if (that.$util.isEmpty(res)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
+ that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
+ })
|
|
|
+ that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
+
|
|
|
+ that.show_login_model = false
|
|
|
+
|
|
|
+ uni.showTabBar()
|
|
|
+
|
|
|
+ getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
+
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ that.skCustomId = subRes.data.skCustomId
|
|
|
+ that.listenPDAkd()
|
|
|
+ // #endif
|
|
|
+
|
|
|
+ that.setUserShopAll()
|
|
|
+ that.init()
|
|
|
+ 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
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail(res){ // 登录失败
|
|
|
+ uni.closeAuthView()//关闭一键登录弹出窗口
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ uni.closeAuthView()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail(res){
|
|
|
+ // 预登录失败
|
|
|
+ //如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,
|
|
|
+ //都有可能造成预登录校验失败。
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
loginFun(mobile,password){
|
|
|
let that = this
|
|
|
uni.showLoading({mask:true})
|