部分修改
This commit is contained in:
+55
-62
@@ -63,9 +63,11 @@
|
||||
<div class="el-col el-col-10">
|
||||
<div @click="onClickSendCode" class="login-code">
|
||||
<!-- <span class="login-code-img" > -->
|
||||
<!-- <i class="el-icon-position">{{ sendText }}</i> -->
|
||||
<!-- <i class="el-icon-position">{{ sendText }}</i> -->
|
||||
<!-- </span> -->
|
||||
<el-button class="el-icon-position" style="width: 100%;">{{ sendText }}</el-button>
|
||||
<el-button class="el-icon-position" style="width: 100%">{{
|
||||
sendText
|
||||
}}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -110,8 +112,8 @@ import { PrevLoading } from "@/utils/loading.js";
|
||||
import { quotationsList } from "./mock";
|
||||
import { useLoginApi } from "@/api/login";
|
||||
import { Message } from "element-ui";
|
||||
import { rulesPhone } from '@/com/index.js'
|
||||
import { getSmsCaptcha, login } from './api'
|
||||
import { rulesPhone } from "@/com/index.js";
|
||||
import { getSmsCaptcha, login } from "./api";
|
||||
const LoginApi = useLoginApi();
|
||||
|
||||
export default {
|
||||
@@ -132,7 +134,7 @@ export default {
|
||||
txt: "",
|
||||
fun: null,
|
||||
},
|
||||
sendText: '发送'
|
||||
sendText: "发送",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -147,16 +149,15 @@ export default {
|
||||
},
|
||||
created() {
|
||||
const paragraph = "I think Ruth's dog is cuter than your dog! Ruth";
|
||||
console.log(paragraph.replace("Ruth", 'my'));
|
||||
console.log(paragraph.replace("Ruth", "my"));
|
||||
|
||||
this.initTime();
|
||||
},
|
||||
mounted() {
|
||||
this.initRandomQuotations();
|
||||
// console.log(localStorage.getItem('user'))
|
||||
console.log('this.$store.state.loginConfig')
|
||||
console.log(this.$store.state.loginConfig.loginConfig)
|
||||
|
||||
console.log("this.$store.state.loginConfig");
|
||||
console.log(this.$store.state.loginConfig.loginConfig);
|
||||
},
|
||||
methods: {
|
||||
// 随机语录
|
||||
@@ -174,71 +175,65 @@ export default {
|
||||
},
|
||||
// 登录按钮点击
|
||||
submitForm() {
|
||||
this.$router.push('/evaluate')
|
||||
console.log(this.$router)
|
||||
|
||||
if( rulesPhone(this.loginForm.phone) ){ // 判断是否存在手机号验证码
|
||||
if(this.loginForm.code){
|
||||
console.log(this.$router);
|
||||
if (rulesPhone(this.loginForm.phone)) {
|
||||
// 判断是否存在手机号验证码
|
||||
if (this.loginForm.code) {
|
||||
this.submit.loading = true;
|
||||
|
||||
// 登录发请求获取用户信息
|
||||
let obj = {...this.$store.state.loginConfig.loginConfig, ...this.loginForm}
|
||||
let formData = new FormData()
|
||||
for( let key in obj){
|
||||
formData.append(key, obj[key])
|
||||
}
|
||||
this.$store.dispatch('loginIn', formData).then(res =>{
|
||||
this.$message.success('登录成功!')
|
||||
Session.set('token',res.token_type +' ' + res.access_token)
|
||||
// this.$router.push('/evaluate')
|
||||
let obj = { ...this.$store.state.loginConfig.loginConfig, ...this.loginForm };
|
||||
let formData = new FormData();
|
||||
for (let key in obj) {
|
||||
formData.append(key, obj[key]);
|
||||
}
|
||||
this.$store
|
||||
.dispatch("loginIn", formData)
|
||||
.then((res) => {
|
||||
this.$message.success("登录成功!");
|
||||
Session.set("token", res.token_type + " " + res.access_token);
|
||||
// 设置用户信息 学校信息 班级信息
|
||||
let user = this.$store.state.user
|
||||
if(user.campusInfo ){
|
||||
if(user.campusInfo.length >= 1){ // 说明只有一个校区
|
||||
if(user.campusInfo[0].classInfo){
|
||||
this.$store.commit('setSchool', user.campusInfo[0] ); // 设置默认校区
|
||||
let user = this.$store.state.user;
|
||||
if (user.campusInfo) {
|
||||
if (user.campusInfo.length >= 1) {
|
||||
// 说明只有一个校区
|
||||
if (user.campusInfo[0].classInfo) {
|
||||
this.$store.commit("setSchool", user.campusInfo[0]); // 设置默认校区
|
||||
}
|
||||
}
|
||||
}else { // 未查到校区信息
|
||||
|
||||
} else {
|
||||
// 未查到校区信息
|
||||
}
|
||||
|
||||
this.oldSet()
|
||||
|
||||
|
||||
}).finally(err =>{
|
||||
this.submit.loading = false;
|
||||
this.sendText = '发送'
|
||||
this.oldSet();
|
||||
})
|
||||
}else{
|
||||
this.$message.error('请输入验证码!')
|
||||
.finally((err) => {
|
||||
this.submit.loading = false;
|
||||
this.sendText = "发送";
|
||||
});
|
||||
} else {
|
||||
this.$message.error("请输入验证码!");
|
||||
}
|
||||
}else {
|
||||
this.$message.error('请输入正确的手机号!')
|
||||
} else {
|
||||
this.$message.error("请输入正确的手机号!");
|
||||
}
|
||||
|
||||
},
|
||||
// 点击发送验证码
|
||||
// 点击发送验证码
|
||||
onClickSendCode() {
|
||||
if( rulesPhone(this.loginForm.phone)){
|
||||
if(this.sendText == '发送' || this.sendText == '重新发送'){
|
||||
getSmsCaptcha(this.loginForm.phone).then(res =>{
|
||||
this.sendText = '发送成功'
|
||||
}).catch(err =>{
|
||||
this.sendText = '重新发送'
|
||||
})
|
||||
if (rulesPhone(this.loginForm.phone)) {
|
||||
if (this.sendText == "发送" || this.sendText == "重新发送") {
|
||||
getSmsCaptcha(this.loginForm.phone)
|
||||
.then((res) => {
|
||||
this.sendText = "发送成功";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.sendText = "重新发送";
|
||||
});
|
||||
}
|
||||
}else{
|
||||
this.$message.error('请输入正确的手机号!')
|
||||
} else {
|
||||
this.$message.error("请输入正确的手机号!");
|
||||
}
|
||||
},
|
||||
// 验证表单
|
||||
rulesForm() {
|
||||
// if(loginForm.phone){
|
||||
|
||||
// }
|
||||
// this.loginForm.phone
|
||||
},
|
||||
|
||||
oldSet() {
|
||||
let defaultRoles = [];
|
||||
let defaultAuthBtnList = [];
|
||||
@@ -278,13 +273,12 @@ export default {
|
||||
`${this.currentTime},${this.$t("message.login.signInText")}`
|
||||
);
|
||||
}, 300);
|
||||
}
|
||||
},
|
||||
},
|
||||
destroyed() {
|
||||
clearInterval(this.time.fun);
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
setTimeout(() => {
|
||||
let defaultRoles = [];
|
||||
@@ -329,7 +323,6 @@ export default {
|
||||
}, 300);
|
||||
}, 300);
|
||||
*/
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user