|
|
@@ -98,7 +98,6 @@ import { mapActions } from "vuex";
|
|
|
import { getShopInfo} from "@/utils/auth";
|
|
|
import {appLogin} from '@/api/common'
|
|
|
import { getDictionaries,postWxCode } from '@/api/mini'
|
|
|
-import { replaceClientId } from '@/api/admin'
|
|
|
import { phoneLogin,wxMobileLogin } from "@/api/auth";
|
|
|
import { ghsInfo } from "@/api/ghs/index";
|
|
|
export default {
|
|
|
@@ -192,20 +191,6 @@ export default {
|
|
|
this.agree = 0
|
|
|
}else{
|
|
|
this.agree = 1
|
|
|
-
|
|
|
- // #ifdef APP-PLUS
|
|
|
- //获取设备ID,并保存到storage
|
|
|
- console.log('GlobalMixins -- 获取设备ID');
|
|
|
- const systemInfo = uni.getSystemInfoSync();
|
|
|
- if (systemInfo.platform === 'ios') {
|
|
|
- this.getIosDeviceId()
|
|
|
- } else if (systemInfo.platform === 'android') {
|
|
|
- this.androidRegister();
|
|
|
- //this.androidGetIdCodes();
|
|
|
- this.androidGetOAID()
|
|
|
- }
|
|
|
- console.log('GlobalMixins -- 获取设备ID 结束');
|
|
|
- // #endif
|
|
|
}
|
|
|
},
|
|
|
// 检查并提示用户阅读协议
|
|
|
@@ -219,19 +204,6 @@ export default {
|
|
|
cancelText: '不同意',
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
- //获取设备ID,并保存到storage
|
|
|
- console.log('GlobalMixins -- 获取设备ID');
|
|
|
- const systemInfo = uni.getSystemInfoSync();
|
|
|
- if (systemInfo.platform === 'ios') {
|
|
|
- that.getIosDeviceId()
|
|
|
- } else if (systemInfo.platform === 'android') {
|
|
|
- that.androidRegister();
|
|
|
- //that.androidGetIdCodes();
|
|
|
- that.androidGetOAID()
|
|
|
- }
|
|
|
- console.log('GlobalMixins -- 获取设备ID 结束6666');
|
|
|
-
|
|
|
- // 用户选择同意
|
|
|
that.agree = 1
|
|
|
that.$forceUpdate()
|
|
|
if(callback && typeof callback === 'function'){
|
|
|
@@ -318,6 +290,9 @@ export default {
|
|
|
uni.removeStorageSync('manualLogout')
|
|
|
getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
that.setUserShopAll()
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ that.$util.afterAppLoginSuccess({ auto: 0 })
|
|
|
+ // #endif
|
|
|
|
|
|
if(this.option.fromType && this.option.fromType == 2){
|
|
|
//跳转失信人员页面
|
|
|
@@ -369,18 +344,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
success:(res)=>{ // 登录成功
|
|
|
- //获取设备ID,并保存到storage
|
|
|
- console.log('GlobalMixins -- 获取设备ID');
|
|
|
- const systemInfo = uni.getSystemInfoSync();
|
|
|
- if (systemInfo.platform === 'ios') {
|
|
|
- that.getIosDeviceId()
|
|
|
- } else if (systemInfo.platform === 'android') {
|
|
|
- that.androidRegister();
|
|
|
- //that.androidGetIdCodes();
|
|
|
- that.androidGetOAID()
|
|
|
- }
|
|
|
-
|
|
|
- console.log(res)
|
|
|
let openid = res.authResult.openid
|
|
|
let access_token = res.authResult.access_token
|
|
|
phoneLogin({openid,access_token}).then(subRes=>{
|
|
|
@@ -409,6 +372,9 @@ export default {
|
|
|
uni.removeStorageSync('manualLogout')
|
|
|
getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
that.setUserShopAll()
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ that.$util.afterAppLoginSuccess({ auto: 0 })
|
|
|
+ // #endif
|
|
|
|
|
|
//返回上一页带参数
|
|
|
let pages = getCurrentPages();
|
|
|
@@ -420,17 +386,6 @@ export default {
|
|
|
// H5 直接访问登录页,没有上一页,回首页
|
|
|
uni.reLaunch({ url: '/admin/home/workbench' })
|
|
|
}
|
|
|
-
|
|
|
- // #ifdef APP-PLUS
|
|
|
- //保存安卓的clientId
|
|
|
- const clientInfo = plus.push.getClientInfo()
|
|
|
- let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
- const deviceId = uni.getStorageSync('deviceId')
|
|
|
- if(currentClientId != ''){
|
|
|
- replaceClientId({id:currentClientId, deviceId:deviceId, auto:0})
|
|
|
- console.log("mobileLogin - clientId ---------- ", currentClientId)
|
|
|
- }
|
|
|
- // #endif
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -510,6 +465,9 @@ export default {
|
|
|
|
|
|
getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
that.setUserShopAll()
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ that.$util.afterAppLoginSuccess({ auto: 0 })
|
|
|
+ // #endif
|
|
|
|
|
|
//返回上一页带参数
|
|
|
let pages = getCurrentPages();
|
|
|
@@ -521,81 +479,12 @@ export default {
|
|
|
// H5 直接访问登录页,没有上一页,回首页
|
|
|
uni.reLaunch({ url: '/admin/home/workbench' })
|
|
|
}
|
|
|
-
|
|
|
- // #ifdef APP-PLUS
|
|
|
- //保存安卓的clientId
|
|
|
- const clientInfo = plus.push.getClientInfo()
|
|
|
- let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
- const deviceId = uni.getStorageSync('deviceId')
|
|
|
- console.log("loginFun - deviceId ---------- ", deviceId)
|
|
|
- if(currentClientId != ''){
|
|
|
- replaceClientId({id:currentClientId, deviceId:deviceId, auto:0})
|
|
|
- console.log("loginFun - clientId ---------- ", currentClientId)
|
|
|
- }
|
|
|
- // #endif
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
|
|
|
}
|
|
|
- },
|
|
|
- // #ifdef APP-PLUS
|
|
|
- getIosDeviceId() {
|
|
|
- const keychain = uni.requireNativePlugin('Univalsoft-DeviceId');
|
|
|
- keychain.getDeviceIDCallback((ret)=>{
|
|
|
- let deviceId = ret ? ret : '';
|
|
|
- if(deviceId != ''){
|
|
|
- uni.setStorageSync('deviceId', deviceId)
|
|
|
- }
|
|
|
- // uni.showToast({
|
|
|
- // title:'GlobalMixins -- 调用方法 uuid ' + ret,
|
|
|
- // icon: "none"
|
|
|
- // })
|
|
|
- })
|
|
|
- },
|
|
|
- androidRegister() {
|
|
|
- const idCode = uni.requireNativePlugin('Ba-IdCode');
|
|
|
- idCode.register(res => {
|
|
|
- console.log('Ba-IdCode register', res);
|
|
|
- });
|
|
|
- },
|
|
|
- androidGetIdCodes() {
|
|
|
- const idCode = uni.requireNativePlugin('Ba-IdCode');
|
|
|
- idCode.getIdCodes(res => {
|
|
|
- console.log(res);
|
|
|
- // if (res.data) {
|
|
|
- // this.msgList.unshift(JSON.stringify(res.data))
|
|
|
- // }
|
|
|
- if(res.data.AndroidID && res.data.AndroidID != ''){
|
|
|
- uni.setStorageSync('deviceId', res.data.AndroidID)
|
|
|
- return
|
|
|
- }
|
|
|
- if(res.data.GUID && res.data.GUID != ''){
|
|
|
- uni.setStorageSync('deviceId', res.data.GUID)
|
|
|
- return
|
|
|
- }
|
|
|
- if(res.data.IMEI && res.data.IMEI != ''){
|
|
|
- uni.setStorageSync('deviceId', res.data.IMEI)
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- androidGetOAID() {
|
|
|
- const idCode = uni.requireNativePlugin('Ba-IdCode');
|
|
|
- idCode.getOAID((res) => {
|
|
|
- let OAID = (res.data && res.data.OAID) ? res.data.OAID : '';
|
|
|
-
|
|
|
- //OAID为空 或 OAID 只包含有0、-字符,不包含其他字符,则调用 getIdCodes 方法获取设备ID
|
|
|
- if (OAID == '' || (!/^(0|-)$/.test(OAID)) ) {
|
|
|
- this.androidGetIdCodes()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if (OAID) {
|
|
|
- uni.setStorageSync('deviceId', OAID);
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
- // #endif
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|