Skip to content

Commit 6b86a9a

Browse files
committed
登录逻辑修改
1 parent 9cf474a commit 6b86a9a

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/utils/support.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Cookies from "js-cookie";
2+
const SupportKey='supportKey';
3+
export const SupportUrl='https://e.coding.net/?utm_source=macrozheng&utm_medium=banner&utm_campaign=march2019';
4+
export function getSupport() {
5+
return Cookies.get(SupportKey)
6+
}
7+
8+
export function setSupport(isSupport) {
9+
return Cookies.set(SupportKey, isSupport,{ expires: 3 })
10+
}

src/views/login/index.vue

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,22 @@
4444
</el-form>
4545
</el-card>
4646
<img :src="login_center_bg" class="login-center-layout">
47+
<el-dialog
48+
title="特别赞助"
49+
:visible.sync="dialogVisible"
50+
width="30%">
51+
<span>mall项目已由CODING特别赞助,点击去支持,页面加载完后点击<span class="color-main font-medium">免费试用</span>按钮即可完成支持,谢谢!</span>
52+
<span slot="footer" class="dialog-footer">
53+
<el-button @click="dialogCancel">残忍拒绝</el-button>
54+
<el-button type="primary" @click="dialogConfirm">去支持</el-button>
55+
</span>
56+
</el-dialog>
4757
</div>
4858
</template>
4959

5060
<script>
5161
import {isvalidUsername} from '@/utils/validate';
62+
import {setSupport,getSupport,SupportUrl} from '@/utils/support';
5263
import login_center_bg from '@/assets/images/login_center_bg.png'
5364
5465
export default {
@@ -71,15 +82,16 @@
7182
return {
7283
loginForm: {
7384
username: 'admin',
74-
password: '123456'
85+
password: '123456',
7586
},
7687
loginRules: {
7788
username: [{required: true, trigger: 'blur', validator: validateUsername}],
7889
password: [{required: true, trigger: 'blur', validator: validatePass}]
7990
},
8091
loading: false,
8192
pwdType: 'password',
82-
login_center_bg
93+
login_center_bg,
94+
dialogVisible:false
8395
}
8496
},
8597
methods: {
@@ -93,6 +105,11 @@
93105
handleLogin() {
94106
this.$refs.loginForm.validate(valid => {
95107
if (valid) {
108+
let isSupport = getSupport();
109+
if(isSupport===undefined||isSupport==null){
110+
this.dialogVisible =true;
111+
return;
112+
}
96113
this.loading = true;
97114
this.$store.dispatch('Login', this.loginForm).then(() => {
98115
this.loading = false;
@@ -105,6 +122,15 @@
105122
return false
106123
}
107124
})
125+
},
126+
dialogConfirm(){
127+
this.dialogVisible =false;
128+
setSupport(true);
129+
window.location.href=SupportUrl;
130+
},
131+
dialogCancel(){
132+
this.dialogVisible = false;
133+
setSupport(false);
108134
}
109135
}
110136
}

0 commit comments

Comments
 (0)