|
@@ -1,28 +1,48 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="login">
|
|
<div class="login">
|
|
|
<div>{{linkURL}}</div>
|
|
<div>{{linkURL}}</div>
|
|
|
- <div class="page-part">
|
|
|
|
|
- <mt-field auto-complete="off" placeholder="手机号/邮箱" v-model="login.username" @blur.native.capture="codeCount"></mt-field>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="page-part">
|
|
|
|
|
- <mt-field placeholder="密码" v-model="login.password" type="password"></mt-field>
|
|
|
|
|
- <template>
|
|
|
|
|
- <p class="passwd"><a @click="forgetPwd" class="rgba">忘记密码?</a></p>
|
|
|
|
|
|
|
+ <div v-if="activeTab === 0">
|
|
|
|
|
+ <div class="page-part">
|
|
|
|
|
+ <mt-field auto-complete="off" placeholder="手机号/邮箱" v-model="login.username" @blur.native.capture="codeCount"></mt-field>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="page-part">
|
|
|
|
|
+ <mt-field placeholder="密码" v-model="login.password" type="password"></mt-field>
|
|
|
|
|
+ <template>
|
|
|
|
|
+ <p class="passwd"><a @click="forgetPwd" class="rgba">忘记密码?</a></p>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template v-if="showCheckCode">
|
|
|
|
|
+ <div class="page-part">
|
|
|
|
|
+ <mt-field placeholder="验证码" v-model="login.captcha">
|
|
|
|
|
+ <img :src="imgSrc" height="45px" width="100px" @click="getCode">
|
|
|
|
|
+ </mt-field>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
- </div>
|
|
|
|
|
- <template v-if="showCheckCode">
|
|
|
|
|
<div class="page-part">
|
|
<div class="page-part">
|
|
|
- <mt-field placeholder="验证码" v-model="login.captcha">
|
|
|
|
|
- <img :src="imgSrc" height="45px" width="100px" @click="getCode">
|
|
|
|
|
- </mt-field>
|
|
|
|
|
|
|
+ <mt-button size="large" type="primary" @click="checkLogin(true)">登录</mt-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="login-btn">
|
|
|
|
|
+ <p>还没有优软云账号?</p>
|
|
|
|
|
+ <mt-button size="large" plain type="primary" @click="jump">立即注册</mt-button>
|
|
|
</div>
|
|
</div>
|
|
|
- </template>
|
|
|
|
|
- <div class="page-part">
|
|
|
|
|
- <mt-button size="large" type="primary" @click="checkLogin(true)">登录</mt-button>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="login-btn">
|
|
|
|
|
- <p>还没有优软云账号?</p>
|
|
|
|
|
- <mt-button size="large" plain type="primary" @click="jump">立即注册</mt-button>
|
|
|
|
|
|
|
+ <div v-if="activeTab === 1">
|
|
|
|
|
+ <div class="user-info">
|
|
|
|
|
+ <div class="img"><img :src="bhImg || '/images/all/icon_mall_index.png'" alt=""></div>
|
|
|
|
|
+ <div class="user-name">{{bhName}}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="page-part">
|
|
|
|
|
+ <mt-field auto-complete="off" placeholder="请输入账号" v-model="bhLogin.username"></mt-field>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="page-part">
|
|
|
|
|
+ <mt-field placeholder="请输入密码" v-model="bhLogin.password" type="password"></mt-field>
|
|
|
|
|
+ <template>
|
|
|
|
|
+ <p class="go-register"><a :href="`/register/enterpriseRegistration${this.$store.state.option.fullPath}&tk=${bhToken}`" class="go">创建新账号</a></p>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="page-part">
|
|
|
|
|
+ <mt-button size="large" type="primary" @click="bhBind">绑定账号</mt-button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<mt-popup v-model="popupVisible" position="right" class="mint-popup" :modal="false">
|
|
<mt-popup v-model="popupVisible" position="right" class="mint-popup" :modal="false">
|
|
|
<ul style="height:100vh;overflow-y:auto">
|
|
<ul style="height:100vh;overflow-y:auto">
|
|
@@ -34,6 +54,21 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+ function getCodeD (appId) {
|
|
|
|
|
+ let paramse = {
|
|
|
|
|
+ appId: appId
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ if (window.cordova) {
|
|
|
|
|
+ window.MrJsBridge.call((returnValue) => {
|
|
|
|
|
+ resolve(returnValue)
|
|
|
|
|
+ }, (error) => {
|
|
|
|
|
+ console.log(error)
|
|
|
|
|
+ reject(error)
|
|
|
|
|
+ }, 'getCode', paramse)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
export default {
|
|
export default {
|
|
|
name: 'loginMobile',
|
|
name: 'loginMobile',
|
|
|
data () {
|
|
data () {
|
|
@@ -48,9 +83,18 @@
|
|
|
spaceUU: '',
|
|
spaceUU: '',
|
|
|
captcha: ''
|
|
captcha: ''
|
|
|
},
|
|
},
|
|
|
|
|
+ bhLogin: {
|
|
|
|
|
+ username: '',
|
|
|
|
|
+ password: ''
|
|
|
|
|
+ },
|
|
|
appId: '',
|
|
appId: '',
|
|
|
returnUrl: '',
|
|
returnUrl: '',
|
|
|
baseUrl: '',
|
|
baseUrl: '',
|
|
|
|
|
+ bhCode: '',
|
|
|
|
|
+ bhToken: '',
|
|
|
|
|
+ bhImg: '',
|
|
|
|
|
+ bhName: '',
|
|
|
|
|
+ activeTab: 1,
|
|
|
linkURL: ''
|
|
linkURL: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -59,23 +103,16 @@
|
|
|
this.getUrl()
|
|
this.getUrl()
|
|
|
this.linkURL = window.location.href
|
|
this.linkURL = window.location.href
|
|
|
// 碧合应用授权认证
|
|
// 碧合应用授权认证
|
|
|
- window.jssdk.getCode = function getCode () {
|
|
|
|
|
- let paramse = {
|
|
|
|
|
- appId: 'a9f624cbbdb947049f5638880b0ecbb2'
|
|
|
|
|
- }
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- if (window.cordova) {
|
|
|
|
|
- window.MrJsBridge.call((returnValue) => {
|
|
|
|
|
- resolve(returnValue)
|
|
|
|
|
- }, (error) => {
|
|
|
|
|
- reject(error)
|
|
|
|
|
- }, 'getCode', paramse)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ window.document.addEventListener('deviceready', function () {
|
|
|
|
|
+ window.addEventListener('js_bridge_called', function () {
|
|
|
})
|
|
})
|
|
|
- }
|
|
|
|
|
- window.jssdk.getCode().then((data) => {
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ let appId = 'a9f624cbbdb947049f5638880b0ecbb2'
|
|
|
|
|
+ getCodeD(appId).then((data) => {
|
|
|
// 成功回调 code
|
|
// 成功回调 code
|
|
|
- console.log(data)
|
|
|
|
|
|
|
+ // alert(data)
|
|
|
|
|
+ this.bhCode = data
|
|
|
|
|
+ this.bhToLogin()
|
|
|
}).catch((error) => {
|
|
}).catch((error) => {
|
|
|
console.log(error)
|
|
console.log(error)
|
|
|
})
|
|
})
|
|
@@ -90,7 +127,11 @@
|
|
|
selectEnterprise (flag, type) {
|
|
selectEnterprise (flag, type) {
|
|
|
this.login.spaceUU = type
|
|
this.login.spaceUU = type
|
|
|
this.popupVisible = flag
|
|
this.popupVisible = flag
|
|
|
- this.toLogin(flag)
|
|
|
|
|
|
|
+ if (this.$route.query.type) {
|
|
|
|
|
+ this.bhToLogin()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.toLogin(flag)
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
// 忘记密码
|
|
// 忘记密码
|
|
|
forgetPwd () {
|
|
forgetPwd () {
|
|
@@ -258,6 +299,127 @@
|
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
|
crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
|
|
crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+ // 碧合绑定账号
|
|
|
|
|
+ bhBind () {
|
|
|
|
|
+ this.$indicator.open('绑定中请稍后...')
|
|
|
|
|
+ if (!this.bhLogin.username) {
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ this.downToast('请填写账号')
|
|
|
|
|
+ } else if (!this.bhLogin.password) {
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ this.downToast('请填写密码')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let param = new FormData()
|
|
|
|
|
+ param.append('t', this.bhToken)
|
|
|
|
|
+ param.append('username', this.bhLogin.username)
|
|
|
|
|
+ param.append('password', this.bhLogin.password)
|
|
|
|
|
+ let config = {
|
|
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'}
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$http.post('/bh/addAccount', param, config)
|
|
|
|
|
+ .then(response => {
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ if (response.data.success) {
|
|
|
|
|
+ this.bhToLogin()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return Promise.reject(response.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ this.$toast({
|
|
|
|
|
+ message: err.errMsg,
|
|
|
|
|
+ iconClass: 'el-icon-error'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 判断是否绑定、选择账套
|
|
|
|
|
+ bhToLogin () {
|
|
|
|
|
+ this.$indicator.open('加载中...')
|
|
|
|
|
+ if (this.$route.query.type) {
|
|
|
|
|
+ let param = new FormData()
|
|
|
|
|
+ param.append('code', this.bhCode || '')
|
|
|
|
|
+ param.append('appId', this.$route.query.appId ? this.$route.query.appId : '')
|
|
|
|
|
+ param.append('returnUrl', this.$route.query.returnURL ? this.$route.query.returnURL : '')
|
|
|
|
|
+ param.append('baseUrl', this.$route.query.baseUrl ? this.$route.query.baseUrl : '')
|
|
|
|
|
+ param.append('spaceUU', this.login.spaceUU ? this.login.spaceUU : '')
|
|
|
|
|
+ let config = {
|
|
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'}
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$http.post('/sso/login/bhLogin', param, config)
|
|
|
|
|
+ .then(response => {
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ if (response.data.success) {
|
|
|
|
|
+ if (!response.data.content.hasRegister && response.data.content.token) {
|
|
|
|
|
+ this.activeTab = 1
|
|
|
|
|
+ this.bhToken = response.data.content.token
|
|
|
|
|
+ this.$http.get(`/bh/userInfo/${this.bhToken}`, {params: {token: this.bhToken}})
|
|
|
|
|
+ .then(response => {
|
|
|
|
|
+ if (response.data.success) {
|
|
|
|
|
+ this.bhImg = response.data.content.userImg
|
|
|
|
|
+ this.bhName = response.data.content.nickName
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return Promise.reject(response.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.$toast({
|
|
|
|
|
+ message: err.errMsg,
|
|
|
|
|
+ iconClass: 'el-icon-error'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if (response.data.content.spaces) {
|
|
|
|
|
+// 弹框让用户选择企业
|
|
|
|
|
+ this.$store.commit('login/chooseRegisterEnterprise/GET_ENTERPRISE_SUCCESS', response.data.content.spaces)
|
|
|
|
|
+ this.popupVisible = true
|
|
|
|
|
+ this.$indicator.open('跳转中...')
|
|
|
|
|
+ } else if (response.data.content.loginUrls) {
|
|
|
|
|
+// 遍历登录url循环让各应用登录(需要跨域)
|
|
|
|
|
+ let param = response.data.content.data
|
|
|
|
|
+ let a = ''
|
|
|
|
|
+ for (let n in param) {
|
|
|
|
|
+ a += (n + '=' + encodeURIComponent(param[n]) + '&')
|
|
|
|
|
+ }
|
|
|
|
|
+ let params = a.substr(0, a.length - 1)
|
|
|
|
|
+ this.$indicator.open('加载中...')
|
|
|
|
|
+ if (response.data.content.currentUrl) {
|
|
|
|
|
+ this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
|
|
|
|
|
+ name: 'successCallback',
|
|
|
|
|
+ timeout: 3000
|
|
|
|
|
+ }, (err, data) => {
|
|
|
|
|
+ if (err) {
|
|
|
|
|
+ this.$toast({
|
|
|
|
|
+ message: '登录超时,请重试',
|
|
|
|
|
+ iconClass: 'el-icon-error'
|
|
|
|
|
+ })
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ throw err
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.loginOther(response, params)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.loginOther(response, params, 3000)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$toast({
|
|
|
|
|
+ message: response.data,
|
|
|
|
|
+ iconClass: 'el-icon-error'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.$indicator.close()
|
|
|
|
|
+ let _this = this
|
|
|
|
|
+ setTimeout(function () {
|
|
|
|
|
+ _this.getCode()
|
|
|
|
|
+ }, 100)
|
|
|
|
|
+ this.$toast({
|
|
|
|
|
+ message: err.errMsg,
|
|
|
|
|
+ iconClass: 'el-icon-error'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|