Browse Source

优化

master
陈裕财 2 years ago
parent
commit
a7c4a7d68f
  1. 8
      src/components/mdp-ui/mdp-dialog/Index.vue
  2. 154
      src/views/login/components/login.vue

8
src/components/mdp-ui/mdp-dialog/Index.vue

@ -1,10 +1,10 @@
<template> <template>
<el-dialog :title="myTitle" append-to-body modal-append-to-body :visible.sync="visible" :fullscreen="fullscreen" :width="width?width:'70%'" :close-on-click-modal="closeOnClickModal">
<slot :visible="visible" :title="myTitle" :data="this.data?this.data:{}" :dialog="that">
<el-dialog :title="myTitle||title" append-to-body modal-append-to-body :visible.sync="visible" :fullscreen="fullscreen" :width="width?width:'70%'" :close-on-click-modal="closeOnClickModal">
<slot :visible="visible" :title="myTitle||title" :data="this.data?this.data:{}" :dialog="that">
</slot> </slot>
<template slot="footer" > <template slot="footer" >
<slot name="footer" :visible="visible" :title="myTitle" :data="this.data?this.data:{}" :dialog="that" >
<slot name="footer" :visible="visible" :title="myTitle||title" :data="this.data?this.data:{}" :dialog="that" >
</slot> </slot>
</template> </template>
@ -54,6 +54,8 @@
this.data=data this.data=data
if(data && data.title){ if(data && data.title){
this.myTitle=data.title this.myTitle=data.title
}else{
this.myTitle=this.title
} }
}, },
close(){ close(){

154
src/views/login/components/login.vue

@ -31,7 +31,7 @@
<div class="oper"> <div class="oper">
<a @click="isRestPwd = true">忘记密码</a> <a @click="isRestPwd = true">忘记密码</a>
<a @click="loginByShowAccount">演示账户登录</a>
<a @click="$refs['starDialog'].open({action:loginByShowAccount})">演示账户登录</a>
<a v-if="loginForm.authType == 'password_display_userid' " @click="loginForm.authType = 'sms'">手机号登录</a> <a v-if="loginForm.authType == 'password_display_userid' " @click="loginForm.authType = 'sms'">手机号登录</a>
<a v-if="loginForm.authType == 'sms' " @click="loginForm.authType = 'password_display_userid' ">密码登录</a> <a v-if="loginForm.authType == 'sms' " @click="loginForm.authType = 'password_display_userid' ">密码登录</a>
</div> </div>
@ -40,7 +40,7 @@
<el-divider content-position="center">第三方登录方式</el-divider> <el-divider content-position="center">第三方登录方式</el-divider>
<div class="other"> <div class="other">
<el-popover trigger="manual" v-model="wxLoginCodeVisible" placement="top-start"> <div id="login_container"></div> <el-popover trigger="manual" v-model="wxLoginCodeVisible" placement="top-start"> <div id="login_container"></div>
<img slot="reference" src="@/assets/image/module/weixin.png" @click="weixinLogin">
<img slot="reference" src="@/assets/image/module/weixin.png" @click="$refs['starDialog'].open({action:weixinLogin})">
<el-button type="text" @click="wxLoginCodeVisible=false" icon="el-icon-close">关闭</el-button><el-button type="text" @click="weixinLogin" icon="el-icon-refresh"></el-button> <el-button type="text" @click="wxLoginCodeVisible=false" icon="el-icon-close">关闭</el-button><el-button type="text" @click="weixinLogin" icon="el-icon-refresh"></el-button>
</el-popover> </el-popover>
</div> </div>
@ -76,7 +76,16 @@
</el-button> </el-button>
</div> </div>
</div> </div>
<mdp-dialog ref="starDialog" width="600px" title="hi~同学,来支持一下【唛盟开源项目】吧,为项目点个Star!">
<el-row>
<el-link href="https://gitee.com/qingqinkj218/collections/375320" target="_blank" type="primary" icon="el-icon-star-off">唛盟项目</el-link>
</el-row>
<template #footer="{visible,data,dialog}">
<el-row slot="footer">
<el-button @click="dialog.close()">取消</el-button><el-button type="primary" @click="doLoginByAction(data.action)">已点赞继续登陆</el-button>
</el-row>
</template>
</mdp-dialog>
</div> </div>
</template> </template>
@ -258,46 +267,45 @@ export default {
smsCode:this.loginForm.smsCode, smsCode:this.loginForm.smsCode,
branchId:this.userBranchId, branchId:this.userBranchId,
} }
var loginParams={ }
if(params.authType=='password_display_userid'){
loginParams.userloginid=params.displayUserid
loginParams.password=params.password
loginParams.grantType="password"
loginParams.authType='password_display_userid'
//loginParams.deptid=params.deptid
loginParams.branchId=params.branchId
}else if(params.authType=='sms'){
loginParams.userloginid=params.phoneno
loginParams.password=params.smsCode
loginParams.grantType="password"
loginParams.authType="sms"
//loginParams.deptid=params.deptid
loginParams.branchId=params.branchId
}
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
this.loading = false
if(res.data.tips.isOk==true){
this.loading = true;
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.loading = false
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
}else{
this.$notify.error(res2.data.tips.msg);
}
}).catch(err=>{
console.log(err);
this.loading = false
});
}else{
this.$notify.error(res.data.tips.msg);
var loginParams={ }
if(params.authType=='password_display_userid'){
loginParams.userloginid=params.displayUserid
loginParams.password=params.password
loginParams.grantType="password"
loginParams.authType='password_display_userid'
//loginParams.deptid=params.deptid
loginParams.branchId=params.branchId
}else if(params.authType=='sms'){
loginParams.userloginid=params.phoneno
loginParams.password=params.smsCode
loginParams.grantType="password"
loginParams.authType="sms"
//loginParams.deptid=params.deptid
loginParams.branchId=params.branchId
} }
}).catch((e) => {
this.loading = false
})
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
this.loading = false
if(res.data.tips.isOk==true){
this.loading = true;
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.loading = false
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
}else{
this.$notify.error(res2.data.tips.msg);
}
}).catch(err=>{
console.log(err);
this.loading = false
});
}else{
this.$notify.error(res.data.tips.msg);
}
}).catch((e) => {
this.loading = false
})
} else { } else {
return false return false
} }
@ -363,7 +371,10 @@ export default {
}) })
}, },
doLoginByAction(action){
this.$refs['starDialog'].close();
action();
},
afterQRScan() { afterQRScan() {
// const hash = window.location.hash.slice(1) // const hash = window.location.hash.slice(1)
// const hashObj = getQueryObject(hash) // const hashObj = getQueryObject(hash)
@ -383,36 +394,37 @@ export default {
// } // }
}, },
loginByShowAccount(){ loginByShowAccount(){
this.loading = true
var loginParams={ }
loginParams.userloginid="demo-branch-01"
loginParams.password=md5("888888")
loginParams.grantType="password"
loginParams.authType='password_display_userid'
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
this.loading = false
if(res.data.tips.isOk==true){
this.loading = true;
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.loading = false
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
}else{
this.$notify.error(res2.data.tips.msg);
}
this.loading = true
var loginParams={ }
loginParams.userloginid="demo-branch-01"
loginParams.password=md5("888888")
loginParams.grantType="password"
loginParams.authType='password_display_userid'
this.$store.dispatch("LoginByUserloginid",loginParams).then(res => {
}).catch(err=>{
console.log(err);
this.loading = false
});
}else{
this.$notify.error(res.data.tips.msg);
}
}).catch((e) => {
this.loading = false
})
this.loading = false
if(res.data.tips.isOk==true){
this.loading = true;
this.$store.dispatch('GetUserInfo').then((res2)=>{
this.loading = false
if(res2.data.tips.isOk==true){
this.userDeptid=res2.data.userInfo.deptid
this.rolesChecked();
}else{
this.$notify.error(res2.data.tips.msg);
}
}).catch(err=>{
console.log(err);
this.loading = false
});
}else{
this.$notify.error(res.data.tips.msg);
}
}).catch((e) => {
this.loading = false
})
} }
}, },
created() { created() {

Loading…
Cancel
Save