登录逻辑修改
This commit is contained in:
parent
9cf474a68f
commit
6b86a9aedc
10
src/utils/support.js
Normal file
10
src/utils/support.js
Normal file
@ -0,0 +1,10 @@
|
||||
import Cookies from "js-cookie";
|
||||
const SupportKey='supportKey';
|
||||
export const SupportUrl='https://e.coding.net/?utm_source=macrozheng&utm_medium=banner&utm_campaign=march2019';
|
||||
export function getSupport() {
|
||||
return Cookies.get(SupportKey)
|
||||
}
|
||||
|
||||
export function setSupport(isSupport) {
|
||||
return Cookies.set(SupportKey, isSupport,{ expires: 3 })
|
||||
}
|
@ -44,11 +44,22 @@
|
||||
</el-form>
|
||||
</el-card>
|
||||
<img :src="login_center_bg" class="login-center-layout">
|
||||
<el-dialog
|
||||
title="特别赞助"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%">
|
||||
<span>mall项目已由CODING特别赞助,点击去支持,页面加载完后点击<span class="color-main font-medium">免费试用</span>按钮即可完成支持,谢谢!</span>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogCancel">残忍拒绝</el-button>
|
||||
<el-button type="primary" @click="dialogConfirm">去支持</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {isvalidUsername} from '@/utils/validate';
|
||||
import {setSupport,getSupport,SupportUrl} from '@/utils/support';
|
||||
import login_center_bg from '@/assets/images/login_center_bg.png'
|
||||
|
||||
export default {
|
||||
@ -71,7 +82,7 @@
|
||||
return {
|
||||
loginForm: {
|
||||
username: 'admin',
|
||||
password: '123456'
|
||||
password: '123456',
|
||||
},
|
||||
loginRules: {
|
||||
username: [{required: true, trigger: 'blur', validator: validateUsername}],
|
||||
@ -79,7 +90,8 @@
|
||||
},
|
||||
loading: false,
|
||||
pwdType: 'password',
|
||||
login_center_bg
|
||||
login_center_bg,
|
||||
dialogVisible:false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -93,6 +105,11 @@
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
let isSupport = getSupport();
|
||||
if(isSupport===undefined||isSupport==null){
|
||||
this.dialogVisible =true;
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||
this.loading = false;
|
||||
@ -105,6 +122,15 @@
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
dialogConfirm(){
|
||||
this.dialogVisible =false;
|
||||
setSupport(true);
|
||||
window.location.href=SupportUrl;
|
||||
},
|
||||
dialogCancel(){
|
||||
this.dialogVisible = false;
|
||||
setSupport(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user