shish 4 лет назад
Родитель
Сommit
68e90b12e8

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
ghsApp/dist/build/app-plus/app-config-service.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
ghsApp/dist/build/app-plus/app-service.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
ghsApp/dist/build/app-plus/app-view.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
ghsApp/dist/build/app-plus/manifest.json


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

@@ -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})

+ 3 - 34
ghsApp/src/components/login-model.vue

@@ -17,7 +17,7 @@
         </view>
 
         <view style="margin-top:35upx;">
-          <button class="admin-button-com small blue buttonText" @click="fastLogin">本机号码一键登录</button>
+          <button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
         </view>
 
       </view>
@@ -25,7 +25,6 @@
   </view>
 </template>
 <script>
-import { phoneLogin } from "@/api/auth";
 export default {
   props: {
     show: {
@@ -45,38 +44,8 @@ export default {
     loginClick() {
       this.$emit('comfirm', this.mobile,this.password)
     },
-    fastLogin(){
-
-				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(res=>{
-                  console.log(res)
-                })
-							},
-							fail(res){  // 登录失败
-								uni.closeAuthView()//关闭一键登录弹出窗口
-							},
-							complete: () => {
-								uni.closeAuthView()
-							}
-						})
-					},
-					fail(res){  
-						// 预登录失败
-						//如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,
-						//都有可能造成预登录校验失败。
-					}
-				})
-
-
+    mobileLogin(){
+      this.$emit('mobileLogin')
     }
   },
 };

Некоторые файлы не были показаны из-за большого количества измененных файлов