|
@@ -21,7 +21,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
|
- <view style="margin-top:55upx;">
|
|
|
|
|
|
|
+ <view style="margin-top:55upx;" v-if="showAccountLogin==false">
|
|
|
|
|
|
|
|
<view style="color:black;font-size:30upx;margin-top:30upx;">这是花店管理后台,需获取你的手机号登录后</view>
|
|
<view style="color:black;font-size:30upx;margin-top:30upx;">这是花店管理后台,需获取你的手机号登录后</view>
|
|
|
<view style="color:black;font-size:30upx;margin-top:15upx;">才能使用相应功能,请谅解</view>
|
|
<view style="color:black;font-size:30upx;margin-top:15upx;">才能使用相应功能,请谅解</view>
|
|
@@ -32,11 +32,11 @@
|
|
|
</view>
|
|
</view>
|
|
|
<!-- #endif -->
|
|
<!-- #endif -->
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
<!-- #ifdef APP-PLUS -->
|
|
|
- <view style="margin-top:55upx;">
|
|
|
|
|
- <button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
|
|
|
|
|
|
|
+ <view style="margin-top:55upx;" v-if="showAccountLogin==false">
|
|
|
|
|
+ <button class="admin-button-com small blue buttonText" @click="mobileLogin">本机号码一键登录</button>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- #endif -->
|
|
<!-- #endif -->
|
|
|
- <view style="color:#999999;font-size:25upx;margin-top:60upx;">
|
|
|
|
|
|
|
+ <view style="color:#999999;font-size:25upx;margin-top:60upx;" v-if="showAccountLogin">
|
|
|
<checkbox-group @change="agreeItem">
|
|
<checkbox-group @change="agreeItem">
|
|
|
<label style="display:flex;align-items:center;justify-content:center;">
|
|
<label style="display:flex;align-items:center;justify-content:center;">
|
|
|
<checkbox value="1" style="transform:scale(0.8)" :checked="agree == 1" />
|
|
<checkbox value="1" style="transform:scale(0.8)" :checked="agree == 1" />
|
|
@@ -49,10 +49,14 @@
|
|
|
</label>
|
|
</label>
|
|
|
</checkbox-group>
|
|
</checkbox-group>
|
|
|
</view>
|
|
</view>
|
|
|
- <view style="margin-top:45upx;color:#333333;font-size:38upx;width:100%;text-align:right;padding-right:70upx;">
|
|
|
|
|
|
|
+ <view style="margin-top:45upx;color:#333333;font-size:38upx;width:100%;text-align:right;padding-right:70upx;" v-if="showAccountLogin==false">
|
|
|
<text style="margin-right:40upx;" @click="useAccount()">使用账号密码登录</text>
|
|
<text style="margin-right:40upx;" @click="useAccount()">使用账号密码登录</text>
|
|
|
<text @click="register">注册账号</text>
|
|
<text @click="register">注册账号</text>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view style="margin-top:45upx;color:#333333;font-size:38upx;width:100%;text-align:right;padding-right:70upx;" v-else>
|
|
|
|
|
+ <text style="margin-right:40upx;" @click="useMoibleAccount()">使用手机号登录</text>
|
|
|
|
|
+ <text @click="register">注册账号</text>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -130,6 +134,11 @@ export default {
|
|
|
goBack(){
|
|
goBack(){
|
|
|
uni.navigateBack({})
|
|
uni.navigateBack({})
|
|
|
},
|
|
},
|
|
|
|
|
+ useMoibleAccount(){
|
|
|
|
|
+ this.showAccountLogin = false
|
|
|
|
|
+ this.agree = 0
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ },
|
|
|
useAccount(){
|
|
useAccount(){
|
|
|
this.showAccountLogin = true
|
|
this.showAccountLogin = true
|
|
|
this.agree = 0
|
|
this.agree = 0
|
|
@@ -149,6 +158,38 @@ export default {
|
|
|
this.agree = 1
|
|
this.agree = 1
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 检查并提示用户阅读协议
|
|
|
|
|
+ checkAgreement(callback){
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ if(this.agree == 0){
|
|
|
|
|
+ uni.showModal({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ content: '请阅读并同意服务协议和隐私政策',
|
|
|
|
|
+ confirmText: '同意',
|
|
|
|
|
+ cancelText: '不同意',
|
|
|
|
|
+ success(res) {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ // 用户选择同意
|
|
|
|
|
+ that.agree = 1
|
|
|
|
|
+ that.$forceUpdate()
|
|
|
|
|
+ if(callback && typeof callback === 'function'){
|
|
|
|
|
+ callback()
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (res.cancel) {
|
|
|
|
|
+ // 用户选择不同意,不执行任何操作
|
|
|
|
|
+ console.log('用户选择不同意')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return false
|
|
|
|
|
+ }else{
|
|
|
|
|
+ // 已勾选协议,直接执行回调
|
|
|
|
|
+ if(callback && typeof callback === 'function'){
|
|
|
|
|
+ callback()
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
dealLogin(res){
|
|
dealLogin(res){
|
|
|
let that = this
|
|
let that = this
|
|
|
console.log(res)
|
|
console.log(res)
|
|
@@ -173,73 +214,76 @@ export default {
|
|
|
let that = this
|
|
let that = this
|
|
|
let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
if (e.detail.errMsg === "getPhoneNumber:ok") {
|
|
if (e.detail.errMsg === "getPhoneNumber:ok") {
|
|
|
- wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
|
|
|
|
|
- uni.hideLoading()
|
|
|
|
|
- if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId == 1){
|
|
|
|
|
- that.$util.confirmModal({content:'网络异常,请刷新重试'},() => {
|
|
|
|
|
|
|
+ // 检查是否勾选协议
|
|
|
|
|
+ this.checkAgreement(function(){
|
|
|
|
|
+ wxMobileLogin({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ if(subRes.data && subRes.data.hasNoOpenId && subRes.data.hasNoOpenId == 1){
|
|
|
|
|
+ that.$util.confirmModal({content:'网络异常,请刷新重试'},() => {
|
|
|
|
|
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
|
|
- uni.clearStorage()
|
|
|
|
|
- that.$store.commit("setLoginInfo", {})
|
|
|
|
|
- that.$util.pageTo({url: "/admin/home/workbench",type: 3})
|
|
|
|
|
- // #endif
|
|
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ uni.clearStorage()
|
|
|
|
|
+ that.$store.commit("setLoginInfo", {})
|
|
|
|
|
+ that.$util.pageTo({url: "/admin/home/workbench",type: 3})
|
|
|
|
|
+ // #endif
|
|
|
|
|
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- uni.clearStorage()
|
|
|
|
|
- that.$store.commit("setLoginInfo", {})
|
|
|
|
|
- plus.runtime.restart()
|
|
|
|
|
- // #endif
|
|
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ uni.clearStorage()
|
|
|
|
|
+ that.$store.commit("setLoginInfo", {})
|
|
|
|
|
+ plus.runtime.restart()
|
|
|
|
|
+ // #endif
|
|
|
|
|
|
|
|
- })
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- let token = subRes.data.token || ''
|
|
|
|
|
- if (that.$util.isEmpty(token)) {
|
|
|
|
|
- that.$msg('请先注册')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
|
|
- if(subRes.code == 1){
|
|
|
|
|
- if (that.$util.isEmpty(subRes)) {
|
|
|
|
|
|
|
+ })
|
|
|
return false
|
|
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 })
|
|
|
|
|
- getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
- that.setUserShopAll()
|
|
|
|
|
-
|
|
|
|
|
- if(this.option.fromType && this.option.fromType == 2){
|
|
|
|
|
- //跳转失信人员页面
|
|
|
|
|
- that.$util.pageTo({url: "/admin/ll/list", type:2})
|
|
|
|
|
|
|
+ let token = subRes.data.token || ''
|
|
|
|
|
+ if (that.$util.isEmpty(token)) {
|
|
|
|
|
+ that.$msg('请先注册')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if(this.option.itemId && Number(this.option.itemId)>0 && this.option.ghsShopId && Number(this.option.ghsShopId)>0){
|
|
|
|
|
- ghsInfo({shopId:this.option.ghsShopId}).then(resInfo => {
|
|
|
|
|
- let ghsId = resInfo.data.id
|
|
|
|
|
- if(Number(ghsId)>0){
|
|
|
|
|
- that.$util.pageTo({url: "/admin/ghsProduct/detail?id="+that.option.itemId+'&ghsId='+ghsId, type:2})
|
|
|
|
|
|
|
+ //有几个地方涉及登陆,需要统一方法,请搜索关键词 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 })
|
|
|
})
|
|
})
|
|
|
- }else{
|
|
|
|
|
- //返回上一页带参数
|
|
|
|
|
- let pages = getCurrentPages();
|
|
|
|
|
- let prevPage = pages[ pages.length - 2 ];
|
|
|
|
|
- //修改上一页data里面的xjData
|
|
|
|
|
- prevPage.$vm.backAction = 'login'
|
|
|
|
|
|
|
+ that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
|
|
+ getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
+ that.setUserShopAll()
|
|
|
|
|
+
|
|
|
|
|
+ if(this.option.fromType && this.option.fromType == 2){
|
|
|
|
|
+ //跳转失信人员页面
|
|
|
|
|
+ that.$util.pageTo({url: "/admin/ll/list", type:2})
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- uni.navigateBack()
|
|
|
|
|
|
|
+ if(this.option.itemId && Number(this.option.itemId)>0 && this.option.ghsShopId && Number(this.option.ghsShopId)>0){
|
|
|
|
|
+ ghsInfo({shopId:this.option.ghsShopId}).then(resInfo => {
|
|
|
|
|
+ let ghsId = resInfo.data.id
|
|
|
|
|
+ if(Number(ghsId)>0){
|
|
|
|
|
+ that.$util.pageTo({url: "/admin/ghsProduct/detail?id="+that.option.itemId+'&ghsId='+ghsId, type:2})
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //返回上一页带参数
|
|
|
|
|
+ let pages = getCurrentPages();
|
|
|
|
|
+ let prevPage = pages[ pages.length - 2 ];
|
|
|
|
|
+ //修改上一页data里面的xjData
|
|
|
|
|
+ prevPage.$vm.backAction = 'login'
|
|
|
|
|
+
|
|
|
|
|
+ uni.navigateBack()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
this.$msg("登录失败");
|
|
this.$msg("登录失败");
|
|
|
}
|
|
}
|
|
@@ -247,117 +291,107 @@ export default {
|
|
|
mobileLogin(){
|
|
mobileLogin(){
|
|
|
let that = this
|
|
let that = this
|
|
|
|
|
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- if(this.agree == 0){
|
|
|
|
|
- this.$msg('请同意并勾选服务协议和隐私政策')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- // #endif
|
|
|
|
|
-
|
|
|
|
|
- uni.showLoading({mask:true})
|
|
|
|
|
- uni.preLogin({
|
|
|
|
|
- provider: 'univerify',
|
|
|
|
|
- success:()=>{
|
|
|
|
|
- uni.hideLoading()
|
|
|
|
|
- uni.login({
|
|
|
|
|
- provider: 'univerify',
|
|
|
|
|
- // 自定义登录框样式
|
|
|
|
|
- univerifyStyle: {
|
|
|
|
|
- "fullScreen": true,
|
|
|
|
|
- "privacyTerms": {
|
|
|
|
|
- "defaultCheckBoxState":false,
|
|
|
|
|
- "checkBoxSize":18
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- success:(res)=>{ // 登录成功
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- let openid = res.authResult.openid
|
|
|
|
|
- let access_token = res.authResult.access_token
|
|
|
|
|
- phoneLogin({openid,access_token}).then(subRes=>{
|
|
|
|
|
- let token = subRes.data.token || ''
|
|
|
|
|
- if (that.$util.isEmpty(token)) {
|
|
|
|
|
- that.$msg('请先注册')
|
|
|
|
|
- return false
|
|
|
|
|
|
|
+ // 先检查协议
|
|
|
|
|
+ this.checkAgreement(function(){
|
|
|
|
|
+ uni.showLoading({mask:true})
|
|
|
|
|
+ uni.preLogin({
|
|
|
|
|
+ provider: 'univerify',
|
|
|
|
|
+ success:()=>{
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ uni.login({
|
|
|
|
|
+ provider: 'univerify',
|
|
|
|
|
+ // 自定义登录框样式
|
|
|
|
|
+ univerifyStyle: {
|
|
|
|
|
+ "fullScreen": true,
|
|
|
|
|
+ "privacyTerms": {
|
|
|
|
|
+ "defaultCheckBoxState":false,
|
|
|
|
|
+ "checkBoxSize":18
|
|
|
}
|
|
}
|
|
|
- //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
|
|
- if(subRes.code == 1){
|
|
|
|
|
- if (that.$util.isEmpty(subRes)) {
|
|
|
|
|
- uni.showToast({title:'subRes is empty', duration: 3000, icon:'none'})
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ success:(res)=>{ // 登录成功
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ let openid = res.authResult.openid
|
|
|
|
|
+ let access_token = res.authResult.access_token
|
|
|
|
|
+ phoneLogin({openid,access_token}).then(subRes=>{
|
|
|
|
|
+ let token = subRes.data.token || ''
|
|
|
|
|
+ if (that.$util.isEmpty(token)) {
|
|
|
|
|
+ that.$msg('请先注册')
|
|
|
return false
|
|
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)) {
|
|
|
|
|
- uni.showToast({title:'getDictionaries get empty', duration: 3000, icon:'none'})
|
|
|
|
|
|
|
+ //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
|
|
+ if(subRes.code == 1){
|
|
|
|
|
+ if (that.$util.isEmpty(subRes)) {
|
|
|
|
|
+ uni.showToast({title:'subRes is empty', duration: 3000, icon:'none'})
|
|
|
return false
|
|
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 })
|
|
|
|
|
- getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
- that.setUserShopAll()
|
|
|
|
|
|
|
+ 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)) {
|
|
|
|
|
+ uni.showToast({title:'getDictionaries get empty', duration: 3000, icon:'none'})
|
|
|
|
|
+ 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 })
|
|
|
|
|
+ getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
+ that.setUserShopAll()
|
|
|
|
|
|
|
|
- //返回上一页带参数
|
|
|
|
|
- let pages = getCurrentPages();
|
|
|
|
|
- let prevPage = pages[ pages.length - 2 ];
|
|
|
|
|
- //修改上一页data里面的xjData
|
|
|
|
|
- prevPage.$vm.backAction = 'login'
|
|
|
|
|
- uni.navigateBack()
|
|
|
|
|
|
|
+ //返回上一页带参数
|
|
|
|
|
+ let pages = getCurrentPages();
|
|
|
|
|
+ let prevPage = pages[ pages.length - 2 ];
|
|
|
|
|
+ //修改上一页data里面的xjData
|
|
|
|
|
+ prevPage.$vm.backAction = 'login'
|
|
|
|
|
+ uni.navigateBack()
|
|
|
|
|
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- //保存安卓的clientId
|
|
|
|
|
- const clientInfo = plus.push.getClientInfo()
|
|
|
|
|
- let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
|
|
- if(currentClientId != ''){
|
|
|
|
|
- replaceClientId({id:currentClientId, auto:0})
|
|
|
|
|
- console.log("mobileLogin - clientId ---------- ", currentClientId)
|
|
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ //保存安卓的clientId
|
|
|
|
|
+ const clientInfo = plus.push.getClientInfo()
|
|
|
|
|
+ let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
|
|
+ if(currentClientId != ''){
|
|
|
|
|
+ replaceClientId({id:currentClientId, auto:0})
|
|
|
|
|
+ console.log("mobileLogin - clientId ---------- ", currentClientId)
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
}
|
|
}
|
|
|
- // #endif
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- fail(res){
|
|
|
|
|
- uni.showToast({title:'已取消', duration: 3000, icon:'none'})
|
|
|
|
|
- //关闭一键登录弹出窗口
|
|
|
|
|
- uni.closeAuthView()
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- },
|
|
|
|
|
- complete: (res) => {
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ fail(res){
|
|
|
|
|
+ uni.showToast({title:'已取消', duration: 3000, icon:'none'})
|
|
|
|
|
+ //关闭一键登录弹出窗口
|
|
|
|
|
+ uni.closeAuthView()
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: (res) => {
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ uni.closeAuthView()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ fail(res){
|
|
|
|
|
+ //如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
|
|
|
|
|
+ if (res.code == 30005) {
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
- uni.closeAuthView()
|
|
|
|
|
|
|
+ that.$util.confirmModal({content:'登录失败,请看视频操作后再试'},() => {
|
|
|
|
|
+ that.pageTo({url: '/admin/home/appLoginRemind'})
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if(res.code == 1000) {
|
|
|
|
|
+ uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
|
|
|
|
|
+ } else if(res.code == 40004) {
|
|
|
|
|
+ uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- fail(res){
|
|
|
|
|
- //如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,都有可能造成预登录校验失败
|
|
|
|
|
- if (res.code == 30005) {
|
|
|
|
|
- uni.hideLoading()
|
|
|
|
|
- that.$util.confirmModal({content:'登录失败,请看视频操作后再试'},() => {
|
|
|
|
|
- that.pageTo({url: '/admin/home/appLoginRemind'})
|
|
|
|
|
- })
|
|
|
|
|
- } else if(res.code == 1000) {
|
|
|
|
|
- uni.showToast({title: '即将开通', duration: 3000, icon:'none'})
|
|
|
|
|
- } else if(res.code == 40004) {
|
|
|
|
|
- uni.showToast({title: '即将开通...', duration: 3000, icon:'none'})
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.showToast({title: '登录失败...', duration: 3000, icon:'none'})
|
|
|
|
|
|
|
+ console.log(res)
|
|
|
}
|
|
}
|
|
|
- console.log(res)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
loginFun(){
|
|
loginFun(){
|
|
|
let that = this
|
|
let that = this
|
|
|
let mobile = this.mobile
|
|
let mobile = this.mobile
|
|
|
let password = this.password
|
|
let password = this.password
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- if(that.agree == 0){
|
|
|
|
|
- this.$msg('请同意并勾选服务协议和隐私政策')
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- // #endif
|
|
|
|
|
if (that.$util.isEmpty(mobile)) {
|
|
if (that.$util.isEmpty(mobile)) {
|
|
|
this.$msg('请输入手机号')
|
|
this.$msg('请输入手机号')
|
|
|
return false
|
|
return false
|
|
@@ -370,44 +404,48 @@ export default {
|
|
|
this.$msg('请输入密码')
|
|
this.$msg('请输入密码')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- uni.showLoading({mask:true})
|
|
|
|
|
- //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
|
|
- appLogin({mobile,password}).then(subRes=>{
|
|
|
|
|
- uni.hideLoading()
|
|
|
|
|
- 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)) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 检查协议
|
|
|
|
|
+ this.checkAgreement(function(){
|
|
|
|
|
+ uni.showLoading({mask:true})
|
|
|
|
|
+ //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
|
|
+ appLogin({mobile,password}).then(subRes=>{
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ if(subRes.code == 1){
|
|
|
|
|
+ if (that.$util.isEmpty(subRes)) {
|
|
|
return false
|
|
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 })
|
|
|
|
|
- getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
- that.setUserShopAll()
|
|
|
|
|
|
|
+ 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 })
|
|
|
|
|
+ getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
|
|
+ that.setUserShopAll()
|
|
|
|
|
|
|
|
- //返回上一页带参数
|
|
|
|
|
- let pages = getCurrentPages();
|
|
|
|
|
- let prevPage = pages[ pages.length - 2 ];
|
|
|
|
|
- //修改上一页data里面的xjData
|
|
|
|
|
- prevPage.$vm.backAction = 'login'
|
|
|
|
|
- uni.navigateBack()
|
|
|
|
|
|
|
+ //返回上一页带参数
|
|
|
|
|
+ let pages = getCurrentPages();
|
|
|
|
|
+ let prevPage = pages[ pages.length - 2 ];
|
|
|
|
|
+ //修改上一页data里面的xjData
|
|
|
|
|
+ prevPage.$vm.backAction = 'login'
|
|
|
|
|
+ uni.navigateBack()
|
|
|
|
|
|
|
|
- // #ifdef APP-PLUS
|
|
|
|
|
- //保存安卓的clientId
|
|
|
|
|
- const clientInfo = plus.push.getClientInfo()
|
|
|
|
|
- let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
|
|
- if(currentClientId != ''){
|
|
|
|
|
- replaceClientId({id:currentClientId, auto:0})
|
|
|
|
|
- console.log("loginFun - clientId ---------- ", currentClientId)
|
|
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ //保存安卓的clientId
|
|
|
|
|
+ const clientInfo = plus.push.getClientInfo()
|
|
|
|
|
+ let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
|
|
+ if(currentClientId != ''){
|
|
|
|
|
+ replaceClientId({id:currentClientId, auto:0})
|
|
|
|
|
+ console.log("loginFun - clientId ---------- ", currentClientId)
|
|
|
|
|
+ }
|
|
|
|
|
+ // #endif
|
|
|
}
|
|
}
|
|
|
- // #endif
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
}
|
|
}
|