|
|
@@ -35,15 +35,29 @@
|
|
|
<div style="font-size: 50px;font-weight: bold;color: #1B3769;">智云版</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-<!-- <div style="width: 90%;display: flex;justify-content: end">-->
|
|
|
-<!-- {{ this.$config.loginSubTitle }}-->
|
|
|
-<!-- </div>-->
|
|
|
- <div class="tab-class">
|
|
|
- <div :class="active == 0? 'btn-active-class':'btn-class' " id="user" @click="changeMode">密码登录</div>
|
|
|
- <div :class="active == 1? 'btn-active-class':'btn-class' " id="scan" @click="changeMode">扫码登录</div>
|
|
|
- </div>
|
|
|
+ <!-- <div style="width: 90%;display: flex;justify-content: end">-->
|
|
|
+ <!-- {{ this.$config.loginSubTitle }}-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <div class="tab-class">
|
|
|
+ <div :class="active == 0? 'btn-active-class':'btn-class' " id="user" @click="changeMode">密码登录</div>
|
|
|
+ <div :class="active == 1? 'btn-active-class':'btn-class' " id="scan" @click="changeMode">扫码登录</div>
|
|
|
+ </div>
|
|
|
<div v-show="active == 0" class="content">
|
|
|
- <login-form @on-success-valid="handleSubmit" :loading="loading"></login-form>
|
|
|
+ <!--登录界面-->
|
|
|
+ <login-form v-if="step == 0" @on-success-valid="handleSubmit" :loading="loading"></login-form>
|
|
|
+ <!--选择公司-->
|
|
|
+ <div v-if="step == 1" style="overflow-y: auto;overflow-x:hidden;height: 300px;margin-bottom: 40px">
|
|
|
+ <DkButton v-for="(item,index) in joinedCpList" icon="iconfont iconfont icon-branch" :key="index"
|
|
|
+ ref="save" type="text"
|
|
|
+ style="margin-right: 10px;" @click="chooseCp(item)">
|
|
|
+ <div style="display: flex;margin-left: 20px">
|
|
|
+ <div>{{ item.cpName }}</div>
|
|
|
+ </div>
|
|
|
+ </DkButton>
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- <Icon type="ios-arrow-round-forward" />-->
|
|
|
+ <!-- </div>-->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div v-show="active == 1" id="scan-login" style="text-align: center; padding: 21px">
|
|
|
<img :src="qrcodeUrl" style="width: 250px;height: 250px" v-if="qrcodeUrl"/>
|
|
|
@@ -64,8 +78,10 @@ import {mapActions} from 'vuex'
|
|
|
import dk_logo from '@/assets/images/dongke_logo.png'
|
|
|
import dk_mini from '@/assets/images/iboss_mini.png'
|
|
|
import {localRead, localSave} from "@/libs/base/util";
|
|
|
-import { getQrCode, checkLoginOpenId } from '@/api/system/user/login'
|
|
|
+import {getQrCode, checkLoginOpenId} from '@/api/system/user/login'
|
|
|
import uuidv4 from 'uuid/v4'
|
|
|
+import config from "@/config";
|
|
|
+import {request} from "@/api/base";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -86,13 +102,19 @@ export default {
|
|
|
checkLoginOpenId: checkLoginOpenId,
|
|
|
loginUuid: null,
|
|
|
qrcodeUrl: null,
|
|
|
- interval: null
|
|
|
+ interval: null,
|
|
|
+ step: 0,// 用于跳转到选择公司页面
|
|
|
+ joinedCpList: [], // 公司数据源
|
|
|
+ joinedCps:[],// 加入公司
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions([
|
|
|
'handleLogin',
|
|
|
'afterLogin',
|
|
|
+ 'updateCompany',
|
|
|
+ 'updateToken',
|
|
|
+ 'changeCp',
|
|
|
'getInfoAfterLogin',
|
|
|
'handleAfterLoginInfo'
|
|
|
]),
|
|
|
@@ -109,7 +131,7 @@ export default {
|
|
|
this.active = 1;
|
|
|
let _this = this
|
|
|
this.interval = setInterval(() => {
|
|
|
- _this.checkLoginOpenId(_this.loginUuid).then(r=>{
|
|
|
+ _this.checkLoginOpenId(_this.loginUuid).then(r => {
|
|
|
let res = r.data
|
|
|
if (res.code === _this.$config.SUCCESS_CODE) {
|
|
|
clearInterval(_this.interval)
|
|
|
@@ -117,7 +139,7 @@ export default {
|
|
|
this.$router.push({
|
|
|
name: this.$config.homeName
|
|
|
})
|
|
|
- } else if (res.code === 1015){
|
|
|
+ } else if (res.code === 1015) {
|
|
|
_this.$Message.warning(res.message)
|
|
|
}
|
|
|
})
|
|
|
@@ -135,29 +157,68 @@ export default {
|
|
|
this.$i18n.locale = this.lang
|
|
|
},
|
|
|
/**
|
|
|
+ * @desc : 选择公司
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2024/3/19 14:18
|
|
|
+ */
|
|
|
+ async chooseCp(e) {
|
|
|
+ if(e){
|
|
|
+ await this.updateCompany(e);
|
|
|
+ // 点击切换公司
|
|
|
+ this.changeCp(this.joinedCps).then(res=>{
|
|
|
+ // 更新token
|
|
|
+ this.updateToken(res.data);
|
|
|
+ setTimeout(()=>{
|
|
|
+ // 登录后获取信息
|
|
|
+ this.getInfoAfterLogin().then(r => {
|
|
|
+ if (r.code == this.$config.SUCCESS_CODE) {
|
|
|
+ this.handleAfterLoginInfo(r.data);
|
|
|
+ this.$router.push({
|
|
|
+ name: this.$config.homeName
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },50)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
* @desc : 密码账号登录提交
|
|
|
* @date : 2022/5/13 16:52
|
|
|
* @author : 洪旭东
|
|
|
*/
|
|
|
- handleSubmit({ftyCode, userCode, userPwd, appCode}) {
|
|
|
+ handleSubmit({userCode, userPwd, appCode}) {
|
|
|
this.loading = true
|
|
|
- this.handleLogin({ftyCode, userCode, userPwd, appCode}).then(res => {
|
|
|
+ this.handleLogin({userCode, userPwd, appCode}).then(res => {
|
|
|
this.$Message.destroy()
|
|
|
if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
if (res.data) {
|
|
|
clearInterval(this.interval)
|
|
|
- // 登录后获取信息
|
|
|
- this.getInfoAfterLogin(res.data).then(r=>{
|
|
|
- if(r.code == this.$config.SUCCESS_CODE){
|
|
|
- this.handleAfterLoginInfo(r.data);
|
|
|
- this.$router.push({
|
|
|
- name: this.$config.homeName
|
|
|
- })
|
|
|
+ // 如果当前公司为空,加入公司有值,那么打开选择公司的页面
|
|
|
+ if (!res.data.company) {
|
|
|
+ let joinedCpList = []
|
|
|
+ if (res.data.joinedCpList && res.data.joinedCpList.length > 0) {
|
|
|
+ joinedCpList = res.data.joinedCpList;
|
|
|
+ this.joinedCps = res.data.joinedCps;
|
|
|
}
|
|
|
- });
|
|
|
+ // 加入体验公司
|
|
|
+ joinedCpList.push(this.$config.expCp);
|
|
|
+ this.joinedCpList = joinedCpList;
|
|
|
+ this.step = 1;
|
|
|
+ } else {
|
|
|
+ // 登录后获取信息
|
|
|
+ this.getInfoAfterLogin(res.data).then(r => {
|
|
|
+ if (r.code == this.$config.SUCCESS_CODE) {
|
|
|
+ this.handleAfterLoginInfo(r.data);
|
|
|
+ this.$router.push({
|
|
|
+ name: this.$config.homeName
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 登录后更新相关信息
|
|
|
this.afterLogin(res.data)
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
let message = res.message
|
|
|
this.$Message.warning({content: message})
|
|
|
@@ -179,7 +240,7 @@ export default {
|
|
|
|
|
|
//生成uuid并获取二维码
|
|
|
this.loginUuid = uuidv4()
|
|
|
- this.getQrCode(this.loginUuid).then(r=>{
|
|
|
+ this.getQrCode(this.loginUuid).then(r => {
|
|
|
let res = r.data
|
|
|
if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
this.qrcodeUrl = res.data
|
|
|
@@ -255,7 +316,7 @@ export default {
|
|
|
bottom: 50px;
|
|
|
}
|
|
|
|
|
|
-/deep/.ivu-btn-primary{
|
|
|
+/deep/ .ivu-btn-primary {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
@@ -269,5 +330,21 @@ export default {
|
|
|
height: calc(100vh - 150px)
|
|
|
}
|
|
|
|
|
|
+/deep/ .ivu-btn-text {
|
|
|
+ width: 100%;
|
|
|
+ height: 60px;
|
|
|
+ font-size: 20px !important;
|
|
|
+ background: #ffffff;
|
|
|
+ display: flex;
|
|
|
+ justify-content: left;
|
|
|
+ align-items: center;
|
|
|
+ margin: 20px 20px;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/deep/ .ivu-btn .ivu-btn-text > span {
|
|
|
+ width: calc(100% - 50px);
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
</style>
|