eslint; 收入合同
This commit is contained in:
+113
-113
@@ -180,16 +180,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
import { mapActions } from "vuex";
|
||||
import { timeFix } from "@/utils/util";
|
||||
import { ACCESS_TOKEN } from "@/store/mutation-types";
|
||||
import { postAction, getAction } from "@/api/manage";
|
||||
import { getRSAPublicKey } from "@/api/login.js";
|
||||
import { JSEncrypt } from "jsencrypt";
|
||||
import Vue from 'vue'
|
||||
import { mapActions } from 'vuex'
|
||||
import { timeFix } from '@/utils/util'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { postAction, getAction } from '@/api/manage'
|
||||
import { getRSAPublicKey } from '@/api/login.js'
|
||||
import { JSEncrypt } from 'jsencrypt'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
name: 'Login',
|
||||
data() {
|
||||
return {
|
||||
loginBtn: false,
|
||||
@@ -203,213 +203,213 @@ export default {
|
||||
smsSendBtn: false
|
||||
},
|
||||
validatorRules: {
|
||||
username: { rules: [{ required: true, message: "请输入用户名!" }, { validator: this.handleUsernameOrEmail }] },
|
||||
password: { rules: [{ required: true, message: "请输入密码!", validator: "click" }] },
|
||||
username: { rules: [{ required: true, message: '请输入用户名!' }, { validator: this.handleUsernameOrEmail }] },
|
||||
password: { rules: [{ required: true, message: '请输入密码!', validator: 'click' }] },
|
||||
mobile: { rules: [{ validator: this.validateMobile }] },
|
||||
captcha: { rule: [{ required: true, message: "请输入验证码!" }] },
|
||||
inputCode: { rules: [{ required: true, message: "请输入验证码!" }] }
|
||||
captcha: { rule: [{ required: true, message: '请输入验证码!' }] },
|
||||
inputCode: { rules: [{ required: true, message: '请输入验证码!' }] }
|
||||
},
|
||||
velorifiedCode: "",
|
||||
inputCodeContent: "",
|
||||
velorifiedCode: '',
|
||||
inputCodeContent: '',
|
||||
inputCodeNull: true,
|
||||
currentUsername: "",
|
||||
currdatetime: "",
|
||||
randCodeImage: "",
|
||||
currentUsername: '',
|
||||
currdatetime: '',
|
||||
randCodeImage: '',
|
||||
requestCodeSuccess: false,
|
||||
rsaPublicKey: ""
|
||||
};
|
||||
rsaPublicKey: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.currdatetime = new Date().getTime();
|
||||
Vue.ls.remove(ACCESS_TOKEN);
|
||||
this.getRouterData();
|
||||
this.handleChangeCheckCode();
|
||||
this.currdatetime = new Date().getTime()
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
this.getRouterData()
|
||||
this.handleChangeCheckCode()
|
||||
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["Login", "Logout", "PhoneLogin"]),
|
||||
...mapActions(['Login', 'Logout', 'PhoneLogin']),
|
||||
handleUsernameOrEmail(rule, value, callback) {
|
||||
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
|
||||
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/
|
||||
if (regex.test(value)) {
|
||||
this.loginType = 0;
|
||||
this.loginType = 0
|
||||
} else {
|
||||
this.loginType = 1;
|
||||
this.loginType = 1
|
||||
}
|
||||
callback();
|
||||
callback()
|
||||
},
|
||||
handleSubmit() {
|
||||
let that = this;
|
||||
let loginParams = {};
|
||||
that.loginBtn = true;
|
||||
that.form.validateFields(["username", "password", "inputCode", "rememberMe"], { force: true }, (err, values) => {
|
||||
let that = this
|
||||
let loginParams = {}
|
||||
that.loginBtn = true
|
||||
that.form.validateFields(['username', 'password', 'inputCode', 'rememberMe'], { force: true }, (err, values) => {
|
||||
if (!err) {
|
||||
|
||||
loginParams.remember_me = values.rememberMe;
|
||||
loginParams.captcha = that.inputCodeContent;
|
||||
loginParams.checkKey = that.currdatetime;
|
||||
loginParams.rsaPublicKey = that.rsaPublicKey;
|
||||
loginParams.remember_me = values.rememberMe
|
||||
loginParams.captcha = that.inputCodeContent
|
||||
loginParams.checkKey = that.currdatetime
|
||||
loginParams.rsaPublicKey = that.rsaPublicKey
|
||||
// 新建JSEncrypt对象
|
||||
let encrypt = new JSEncrypt();
|
||||
encrypt.setPublicKey(loginParams.rsaPublicKey);
|
||||
let encrypt = new JSEncrypt()
|
||||
encrypt.setPublicKey(loginParams.rsaPublicKey)
|
||||
// 公钥加密
|
||||
loginParams.username = encrypt.encrypt(values.username);
|
||||
loginParams.password = encrypt.encrypt(values.password);
|
||||
loginParams.username = encrypt.encrypt(values.username)
|
||||
loginParams.password = encrypt.encrypt(values.password)
|
||||
//登录
|
||||
that.Login(loginParams).then((res) => {
|
||||
console.log(res);
|
||||
this.loginSuccess();
|
||||
console.log(res)
|
||||
this.loginSuccess()
|
||||
}).catch((err) => {
|
||||
if (err.code === 500) {
|
||||
// 刷新验证码
|
||||
this.handleChangeCheckCode();
|
||||
this.handleChangeCheckCode()
|
||||
}
|
||||
that.requestFailed(err);
|
||||
});
|
||||
that.requestFailed(err)
|
||||
})
|
||||
} else {
|
||||
that.loginBtn = false;
|
||||
that.loginBtn = false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getCaptcha(e) {
|
||||
e.preventDefault();
|
||||
let that = this;
|
||||
this.form.validateFields(["mobile"], { force: true }, (err, values) => {
|
||||
e.preventDefault()
|
||||
let that = this
|
||||
this.form.validateFields(['mobile'], { force: true }, (err, values) => {
|
||||
if (!values.mobile) {
|
||||
that.cmsFailed("请输入手机号");
|
||||
that.cmsFailed('请输入手机号')
|
||||
} else if (!err) {
|
||||
this.state.smsSendBtn = true;
|
||||
this.state.smsSendBtn = true
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60;
|
||||
that.state.smsSendBtn = false;
|
||||
window.clearInterval(interval);
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000);
|
||||
}, 1000)
|
||||
|
||||
const hide = this.$message.loading("验证码发送中..", 0);
|
||||
let smsParams = {};
|
||||
smsParams.mobile = values.mobile;
|
||||
smsParams.smsmode = "0";
|
||||
postAction("/sys/sms", smsParams)
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
let smsParams = {}
|
||||
smsParams.mobile = values.mobile
|
||||
smsParams.smsmode = '0'
|
||||
postAction('/sys/sms', smsParams)
|
||||
.then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 0);
|
||||
this.cmsFailed(res.message);
|
||||
setTimeout(hide, 0)
|
||||
this.cmsFailed(res.message)
|
||||
}
|
||||
setTimeout(hide, 500);
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
.catch(err => {
|
||||
setTimeout(hide, 1);
|
||||
clearInterval(interval);
|
||||
that.state.time = 60;
|
||||
that.state.smsSendBtn = false;
|
||||
this.requestFailed(err);
|
||||
});
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
this.requestFailed(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
handleChangeCheckCode() {
|
||||
this.currdatetime = new Date().getTime();
|
||||
this.currdatetime = new Date().getTime()
|
||||
getAction(`/sys/randomImage/${this.currdatetime}`).then(res => {
|
||||
if (res.success) {
|
||||
this.randCodeImage = res.result;
|
||||
this.requestCodeSuccess = true;
|
||||
this.randCodeImage = res.result
|
||||
this.requestCodeSuccess = true
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
this.requestCodeSuccess = false;
|
||||
this.$message.error(res.message)
|
||||
this.requestCodeSuccess = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.requestCodeSuccess = false;
|
||||
});
|
||||
this.getPublicKey();
|
||||
this.requestCodeSuccess = false
|
||||
})
|
||||
this.getPublicKey()
|
||||
},
|
||||
//获取RSA公钥
|
||||
getPublicKey() {
|
||||
// 获取公钥
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result;
|
||||
});
|
||||
this.rsaPublicKey = res.result
|
||||
})
|
||||
},
|
||||
loginSuccess() {
|
||||
this.$router.push({ path: "/dashboard/analysis" }).catch((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
this.$router.push({ path: '/dashboard/analysis' }).catch((res) => {
|
||||
console.log(res)
|
||||
})
|
||||
this.$notification.success({
|
||||
message: "欢迎",
|
||||
message: '欢迎',
|
||||
description: `${timeFix()},欢迎回来`
|
||||
});
|
||||
})
|
||||
},
|
||||
cmsFailed(err) {
|
||||
this.$notification["error"]({
|
||||
message: "登录失败",
|
||||
this.$notification['error']({
|
||||
message: '登录失败',
|
||||
description: err,
|
||||
duration: 4
|
||||
});
|
||||
})
|
||||
},
|
||||
requestFailed(err) {
|
||||
this.$notification["error"]({
|
||||
message: "登录失败",
|
||||
description: ((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试",
|
||||
this.$notification['error']({
|
||||
message: '登录失败',
|
||||
description: ((err.response || {}).data || {}).message || err.message || '请求出现错误,请稍后再试',
|
||||
duration: 4
|
||||
});
|
||||
this.loginBtn = false;
|
||||
})
|
||||
this.loginBtn = false
|
||||
},
|
||||
validateMobile(rule, value, callback) {
|
||||
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
|
||||
callback();
|
||||
callback()
|
||||
} else {
|
||||
callback("您的手机号码格式不正确!");
|
||||
callback('您的手机号码格式不正确!')
|
||||
}
|
||||
},
|
||||
validateInputCode(rule, value, callback) {
|
||||
if (!value || this.verifiedCode == this.inputCodeContent) {
|
||||
callback();
|
||||
callback()
|
||||
} else {
|
||||
callback("您输入的验证码不正确!");
|
||||
callback('您输入的验证码不正确!')
|
||||
}
|
||||
},
|
||||
generateCode(value) {
|
||||
this.verifiedCode = value.toLowerCase();
|
||||
this.verifiedCode = value.toLowerCase()
|
||||
},
|
||||
inputCodeChange(e) {
|
||||
this.inputCodeContent = e.target.value;
|
||||
this.inputCodeContent = e.target.value
|
||||
},
|
||||
getRouterData() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$route.params.username) {
|
||||
this.form.setFieldsValue({
|
||||
"username": this.$route.params.username
|
||||
});
|
||||
'username': this.$route.params.username
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 判断当前设备
|
||||
function isMobile() {
|
||||
var userAgentInfo = navigator.userAgent;
|
||||
var userAgentInfo = navigator.userAgent
|
||||
|
||||
var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
||||
var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
|
||||
|
||||
var mobile_flag = false;
|
||||
var mobile_flag = false
|
||||
|
||||
//根据userAgent判断是否是手机
|
||||
for (var v = 0; v < mobileAgents.length; v++) {
|
||||
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
|
||||
mobile_flag = true;
|
||||
break;
|
||||
mobile_flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
var screen_width = window.screen.width;
|
||||
var screen_height = window.screen.height;
|
||||
var screen_width = window.screen.width
|
||||
var screen_height = window.screen.height
|
||||
|
||||
//根据屏幕分辨率判断是否是手机
|
||||
if (screen_width < 500 && screen_height < 800) {
|
||||
mobile_flag = true;
|
||||
mobile_flag = true
|
||||
}
|
||||
return mobile_flag;
|
||||
return mobile_flag
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import Step4 from './Step4'
|
||||
|
||||
export default {
|
||||
name: "Alteration",
|
||||
name: 'Alteration',
|
||||
components: {
|
||||
Step1,
|
||||
Step2,
|
||||
@@ -40,13 +40,13 @@
|
||||
|
||||
// handler
|
||||
nextStep(data) {
|
||||
this.userList = data;
|
||||
this.userList = data
|
||||
if (this.currentTab < 4) {
|
||||
this.currentTab += 1
|
||||
}
|
||||
},
|
||||
prevStep(data) {
|
||||
this.userList = data;
|
||||
this.userList = data
|
||||
if (this.currentTab > 0) {
|
||||
this.currentTab -= 1
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@
|
||||
import { checkOnlyUser } from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: "Step1",
|
||||
name: 'Step1',
|
||||
data() {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
inputCodeContent: "",
|
||||
inputCodeContent: '',
|
||||
inputCodeNull: true,
|
||||
verifiedCode: "",
|
||||
verifiedCode: '',
|
||||
validatorRules: {
|
||||
username: {rules: [{required: false}, {validator: this.validateInputUsername}]},
|
||||
inputCode: {rules: [{required: true, message: '请输入验证码!'}]},
|
||||
@@ -63,11 +63,11 @@
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.handleChangeCheckCode();
|
||||
this.handleChangeCheckCode()
|
||||
},
|
||||
methods: {
|
||||
handleChangeCheckCode(){
|
||||
this.currdatetime = new Date().getTime();
|
||||
this.currdatetime = new Date().getTime()
|
||||
getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
|
||||
if(res.success){
|
||||
this.randCodeImage = res.result
|
||||
@@ -84,29 +84,29 @@
|
||||
let that = this
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
let isPhone = false;
|
||||
let isPhone = false
|
||||
var params = {}
|
||||
var reg = /^[1-9]\d*$|^0$/;
|
||||
var username = values.username;
|
||||
var reg = /^[1-9]\d*$|^0$/
|
||||
var username = values.username
|
||||
if (reg.test(username) == true) {
|
||||
params.phone = username;
|
||||
params.phone = username
|
||||
isPhone = true
|
||||
} else {
|
||||
params.username = username;
|
||||
params.username = username
|
||||
}
|
||||
that.validateInputCode().then(()=>{
|
||||
getAction("/sys/user/querySysUser", params).then((res) => {
|
||||
getAction('/sys/user/querySysUser', params).then((res) => {
|
||||
if (res.success) {
|
||||
var userList = {
|
||||
username: res.result.username,
|
||||
phone: res.result.phone,
|
||||
isPhone: isPhone
|
||||
};
|
||||
}
|
||||
setTimeout(function () {
|
||||
that.$emit('nextStep', userList)
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -114,21 +114,21 @@
|
||||
},
|
||||
validateInputCode() {
|
||||
return new Promise((resolve,reject)=>{
|
||||
postAction("/sys/checkCaptcha",{
|
||||
postAction('/sys/checkCaptcha',{
|
||||
captcha:this.inputCodeContent,
|
||||
checkKey:this.currdatetime
|
||||
}).then(res=>{
|
||||
if(res.success){
|
||||
resolve();
|
||||
resolve()
|
||||
}else{
|
||||
this.$message.error(res.message)
|
||||
reject();
|
||||
reject()
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
},
|
||||
inputCodeChange(e) {
|
||||
this.inputCodeContent = e.target.value;
|
||||
this.inputCodeContent = e.target.value
|
||||
console.log(this.inputCodeContent)
|
||||
if (!e.target.value || 0 == e.target.value) {
|
||||
this.inputCodeNull = true
|
||||
@@ -138,24 +138,24 @@
|
||||
}
|
||||
},
|
||||
generateCode(value) {
|
||||
this.verifiedCode = value.toLowerCase();
|
||||
console.log(this.verifiedCode);
|
||||
this.verifiedCode = value.toLowerCase()
|
||||
console.log(this.verifiedCode)
|
||||
},
|
||||
validateInputUsername(rule, value, callback) {
|
||||
console.log(value);
|
||||
var reg = /^[0-9]+.?[0-9]*/;
|
||||
console.log(value)
|
||||
var reg = /^[0-9]+.?[0-9]*/
|
||||
if (!value) {
|
||||
callback("请输入用户名和手机号!");
|
||||
callback('请输入用户名和手机号!')
|
||||
}
|
||||
|
||||
//判断用户输入账号还是手机号码
|
||||
if (reg.test(value)) {
|
||||
var params = {
|
||||
phone: value,
|
||||
};
|
||||
}
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback("用户名不存在!")
|
||||
callback('用户名不存在!')
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
@@ -163,10 +163,10 @@
|
||||
} else {
|
||||
var params = {
|
||||
username: value,
|
||||
};
|
||||
}
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback("用户名不存在!")
|
||||
callback('用户名不存在!')
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
|
||||
@@ -51,23 +51,23 @@
|
||||
import {postAction} from '@/api/manage'
|
||||
|
||||
export default {
|
||||
name: "Step2",
|
||||
name: 'Step2',
|
||||
props: ['userList'],
|
||||
data() {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
loading: false,
|
||||
// accountName: this.userList.username,
|
||||
dropList: "0",
|
||||
captcha: "",
|
||||
dropList: '0',
|
||||
captcha: '',
|
||||
show: true,
|
||||
state: {
|
||||
time: 60,
|
||||
smsSendBtn: false,
|
||||
},
|
||||
formLogin: {
|
||||
captcha: "",
|
||||
mobile: "",
|
||||
captcha: '',
|
||||
mobile: '',
|
||||
},
|
||||
validatorRules: {
|
||||
captcha: {rule: [{required: true, message: '请输入短信验证码!'}, {validator: this.validateCaptcha}]},
|
||||
@@ -82,28 +82,28 @@
|
||||
let that = this
|
||||
that.loading = true
|
||||
this.form.validateFields((err, values) => {
|
||||
console.log(values);
|
||||
console.log(values)
|
||||
if (!err) {
|
||||
if (that.dropList == "0") {
|
||||
if (that.dropList == '0') {
|
||||
if (values.captcha == undefined) {
|
||||
this.cmsFailed("请输入短信验证码!");
|
||||
this.cmsFailed('请输入短信验证码!')
|
||||
} else {
|
||||
var params = {}
|
||||
params.phone = values.phone;
|
||||
params.smscode = values.captcha;
|
||||
postAction("/sys/user/phoneVerification", params).then((res) => {
|
||||
params.phone = values.phone
|
||||
params.smscode = values.captcha
|
||||
postAction('/sys/user/phoneVerification', params).then((res) => {
|
||||
if (res.success) {
|
||||
console.log(res);
|
||||
console.log(res)
|
||||
var userList = {
|
||||
username: res.result.username,
|
||||
phone: values.phone,
|
||||
smscode: res.result.smscode
|
||||
};
|
||||
}
|
||||
setTimeout(function () {
|
||||
that.$emit('nextStep', userList)
|
||||
}, 0)
|
||||
} else {
|
||||
this.cmsFailed(res.message);
|
||||
this.cmsFailed(res.message)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -115,60 +115,60 @@
|
||||
})
|
||||
},
|
||||
getCaptcha(e) {
|
||||
e.preventDefault();
|
||||
let that = this;
|
||||
let phone=that.form.getFieldValue("phone")
|
||||
e.preventDefault()
|
||||
let that = this
|
||||
let phone=that.form.getFieldValue('phone')
|
||||
if(!phone){
|
||||
this.cmsFailed("手机号不能为空!");
|
||||
return;
|
||||
this.cmsFailed('手机号不能为空!')
|
||||
return
|
||||
}
|
||||
this.state.smsSendBtn = true;
|
||||
this.state.smsSendBtn = true
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60;
|
||||
that.state.smsSendBtn = false;
|
||||
window.clearInterval(interval);
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000);
|
||||
}, 1000)
|
||||
|
||||
const hide = this.$message.loading('验证码发送中..', 0);
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
let smsParams = {
|
||||
mobile: phone,
|
||||
smsmode: "2"
|
||||
};
|
||||
postAction("/sys/sms", smsParams).then(res => {
|
||||
smsmode: '2'
|
||||
}
|
||||
postAction('/sys/sms', smsParams).then(res => {
|
||||
if (!res.success) {
|
||||
setTimeout(hide, 1);
|
||||
this.cmsFailed(res.message);
|
||||
setTimeout(hide, 1)
|
||||
this.cmsFailed(res.message)
|
||||
}
|
||||
setTimeout(hide, 500);
|
||||
setTimeout(hide, 500)
|
||||
})
|
||||
},
|
||||
cmsFailed(err) {
|
||||
this.$notification['error']({
|
||||
message: "验证错误",
|
||||
message: '验证错误',
|
||||
description: err,
|
||||
duration: 4,
|
||||
});
|
||||
})
|
||||
},
|
||||
handleChangeSelect(value) {
|
||||
var that = this;
|
||||
console.log(value);
|
||||
var that = this
|
||||
console.log(value)
|
||||
if (value == 0) {
|
||||
that.dropList = "0";
|
||||
that.show = true;
|
||||
that.dropList = '0'
|
||||
that.show = true
|
||||
} else {
|
||||
that.dropList = "1";
|
||||
that.show = false;
|
||||
that.dropList = '1'
|
||||
that.show = false
|
||||
}
|
||||
},
|
||||
validatePhone(rule,value,callback){
|
||||
if(value){
|
||||
var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
|
||||
var myreg=/^[1][3,4,5,7,8][0-9]{9}$/
|
||||
if(!myreg.test(value)){
|
||||
callback("请输入正确的手机号")
|
||||
callback('请输入正确的手机号')
|
||||
}else{
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
}else{
|
||||
callback()
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<script>
|
||||
import { putAction,getAction } from '@/api/manage'
|
||||
export default {
|
||||
name: "Step3",
|
||||
name: 'Step3',
|
||||
// components: {
|
||||
// Result
|
||||
// },
|
||||
@@ -74,21 +74,21 @@
|
||||
this.form.validateFields((err, values) => {
|
||||
if ( !err ){
|
||||
var params={}
|
||||
params.username=this.userList.username;
|
||||
params.password=values.password;
|
||||
params.smscode=this.userList.smscode;
|
||||
params.phone= this.userList.phone;
|
||||
getAction("/sys/user/passwordChange", params).then((res) => {
|
||||
params.username=this.userList.username
|
||||
params.password=values.password
|
||||
params.smscode=this.userList.smscode
|
||||
params.phone= this.userList.phone
|
||||
getAction('/sys/user/passwordChange', params).then((res) => {
|
||||
if(res.success){
|
||||
var userList = {
|
||||
username: this.userList.username
|
||||
}
|
||||
console.log(userList);
|
||||
console.log(userList)
|
||||
setTimeout(function () {
|
||||
that.$emit('nextStep', userList)
|
||||
}, 1500)
|
||||
}else{
|
||||
this.passwordFailed(res.message);
|
||||
this.passwordFailed(res.message)
|
||||
that.loading = false
|
||||
}
|
||||
})
|
||||
@@ -111,10 +111,10 @@
|
||||
},
|
||||
passwordFailed(err){
|
||||
this.$notification[ 'error' ]({
|
||||
message: "更改密码失败",
|
||||
message: '更改密码失败',
|
||||
description:err,
|
||||
duration: 4,
|
||||
});
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script>
|
||||
import Result from '@/views/result/Result'
|
||||
export default {
|
||||
name: "Step4",
|
||||
name: 'Step4',
|
||||
props:['userList'],
|
||||
components: {
|
||||
Result
|
||||
@@ -27,21 +27,21 @@
|
||||
},
|
||||
methods: {
|
||||
countDown(){
|
||||
let that = this;
|
||||
that.time--;
|
||||
let that = this
|
||||
that.time--
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
let that = this;
|
||||
that.time = 5;
|
||||
setInterval(that.countDown, 1000);
|
||||
let that = this
|
||||
that.time = 5
|
||||
setInterval(that.countDown, 1000)
|
||||
},
|
||||
watch: {
|
||||
time: function (newVal,oldVal) {
|
||||
if (newVal == 0) {
|
||||
var params = {
|
||||
username: this.userList.username
|
||||
};
|
||||
}
|
||||
this.$router.push({name: 'login', params})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
3: '#52c41a',
|
||||
}
|
||||
export default {
|
||||
name: "Register",
|
||||
name: 'Register',
|
||||
components: {},
|
||||
mixins: [mixinDevice],
|
||||
data() {
|
||||
@@ -147,16 +147,16 @@
|
||||
methods: {
|
||||
checkUsername(rule, value, callback) {
|
||||
if(!value){
|
||||
callback(new Error("请输入用户名"))
|
||||
callback(new Error('请输入用户名'))
|
||||
}else{
|
||||
var params = {
|
||||
username: value,
|
||||
};
|
||||
}
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback()
|
||||
} else {
|
||||
callback("用户名已存在!")
|
||||
callback('用户名已存在!')
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -164,19 +164,19 @@
|
||||
handleEmailCheck(rule, value, callback) {
|
||||
var params = {
|
||||
email: value,
|
||||
};
|
||||
}
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback()
|
||||
} else {
|
||||
callback("邮箱已存在!")
|
||||
callback('邮箱已存在!')
|
||||
}
|
||||
})
|
||||
},
|
||||
handlePasswordLevel(rule, value, callback) {
|
||||
|
||||
let level = 0
|
||||
let reg = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/;
|
||||
let reg = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/
|
||||
if (!reg.test(value)) {
|
||||
callback(new Error('密码由8位数字、大小写字母和特殊符号组成!'))
|
||||
}
|
||||
@@ -220,24 +220,24 @@
|
||||
},
|
||||
handleCaptchaCheck(rule, value, callback){
|
||||
if(!value){
|
||||
callback(new Error("请输入验证码"))
|
||||
callback(new Error('请输入验证码'))
|
||||
}else{
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
},
|
||||
handlePhoneCheck(rule, value, callback) {
|
||||
var reg=/^1[3456789]\d{9}$/
|
||||
if(!reg.test(value)){
|
||||
callback(new Error("请输入正确手机号"))
|
||||
callback(new Error('请输入正确手机号'))
|
||||
}else{
|
||||
var params = {
|
||||
phone: value,
|
||||
};
|
||||
}
|
||||
checkOnlyUser(params).then((res) => {
|
||||
if (res.success) {
|
||||
callback()
|
||||
} else {
|
||||
callback("手机号已存在!")
|
||||
callback('手机号已存在!')
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -246,7 +246,7 @@
|
||||
handlePasswordInputClick() {
|
||||
if (!this.isMobile()) {
|
||||
this.state.passwordLevelChecked = true
|
||||
return;
|
||||
return
|
||||
}
|
||||
this.state.passwordLevelChecked = false
|
||||
},
|
||||
@@ -259,8 +259,8 @@
|
||||
password: values.password,
|
||||
phone: values.mobile,
|
||||
smscode: values.captcha
|
||||
};
|
||||
postAction("/sys/user/register", register).then((res) => {
|
||||
}
|
||||
postAction('/sys/user/register', register).then((res) => {
|
||||
if (!res.success) {
|
||||
this.registerFailed(res.message)
|
||||
} else {
|
||||
@@ -276,51 +276,51 @@
|
||||
let that = this
|
||||
this.form.validateFields(['mobile'], {force: true}, (err, values) => {
|
||||
if (!err) {
|
||||
this.state.smsSendBtn = true;
|
||||
this.state.smsSendBtn = true
|
||||
let interval = window.setInterval(() => {
|
||||
if (that.state.time-- <= 0) {
|
||||
that.state.time = 60;
|
||||
that.state.smsSendBtn = false;
|
||||
window.clearInterval(interval);
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
window.clearInterval(interval)
|
||||
}
|
||||
}, 1000);
|
||||
const hide = this.$message.loading('验证码发送中..', 0);
|
||||
}, 1000)
|
||||
const hide = this.$message.loading('验证码发送中..', 0)
|
||||
const params = {
|
||||
mobile: values.mobile,
|
||||
smsmode: "1"
|
||||
};
|
||||
postAction("/sys/sms", params).then((res) => {
|
||||
smsmode: '1'
|
||||
}
|
||||
postAction('/sys/sms', params).then((res) => {
|
||||
if (!res.success) {
|
||||
this.registerFailed(res.message);
|
||||
setTimeout(hide, 0);
|
||||
this.registerFailed(res.message)
|
||||
setTimeout(hide, 0)
|
||||
}
|
||||
setTimeout(hide, 500);
|
||||
setTimeout(hide, 500)
|
||||
}).catch(err => {
|
||||
setTimeout(hide, 1);
|
||||
clearInterval(interval);
|
||||
that.state.time = 60;
|
||||
that.state.smsSendBtn = false;
|
||||
this.requestFailed(err);
|
||||
});
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
this.requestFailed(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
registerFailed(message) {
|
||||
this.$notification['error']({
|
||||
message: "注册失败",
|
||||
message: '注册失败',
|
||||
description: message,
|
||||
duration: 2,
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
requestFailed(err) {
|
||||
this.$notification['error']({
|
||||
message: '错误',
|
||||
description: ((err.response || {}).data || {}).message || "请求出现错误,请稍后再试",
|
||||
description: ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试',
|
||||
duration: 4,
|
||||
});
|
||||
this.registerBtn = false;
|
||||
})
|
||||
this.registerBtn = false
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import Result from '@/views/result/Result'
|
||||
|
||||
export default {
|
||||
name: "RegisterResult",
|
||||
name: 'RegisterResult',
|
||||
components: {
|
||||
Result
|
||||
},
|
||||
@@ -28,7 +28,7 @@
|
||||
email () {
|
||||
let v = this.form ? this.form.username || this.form.mobile : ' XXX '
|
||||
let title = `你的账户:${v} 注册成功`
|
||||
this.username = v;
|
||||
this.username = v
|
||||
return title
|
||||
}
|
||||
},
|
||||
@@ -37,10 +37,10 @@
|
||||
},
|
||||
methods: {
|
||||
goHomeHandle () {
|
||||
let params={};
|
||||
params.username=this.form.username;
|
||||
params.password=this.form.password;
|
||||
console.log(params);
|
||||
let params={}
|
||||
params.username=this.form.username
|
||||
params.password=this.form.password
|
||||
console.log(params)
|
||||
this.$router.push({name:'login',params})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user