|
|
@@ -73,17 +73,17 @@
|
|
|
<a
|
|
|
href="https://github.com/login/oauth/authorize?client_id=65396ecb78f8cb000768&redirect_uri=https%3A%2F%2Fwww.proginn.com%2Fuser%2Flogingithub&scope=user%3Aemail"
|
|
|
>
|
|
|
- <img src="~@/assets/img/user/github_logo.png" alt="github">
|
|
|
+ <img src="~@/assets/img/user/github_logo.png" alt="github" />
|
|
|
</a>
|
|
|
<a
|
|
|
href="https://api.weibo.com/oauth2/authorize?client_id=2749593033&redirect_uri=https%3A%2F%2Fwww.proginn.com%2Fuser%2Floginweibo&response_type=code&forcelogin=true"
|
|
|
>
|
|
|
- <img src="~@/assets/img/user/sina_logo.png" alt="sina">
|
|
|
+ <img src="~@/assets/img/user/sina_logo.png" alt="sina" />
|
|
|
</a>
|
|
|
<a
|
|
|
href="https://open.weixin.qq.com/connect/qrconnect?appid=wx0f62bbdc948d0f23&redirect_uri=https%3A%2F%2Fwww.proginn.com%2Fuser%2Floginweixin&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect"
|
|
|
>
|
|
|
- <img src="~@/assets/img/user/wechat_logo.png" alt="wechat">
|
|
|
+ <img src="~@/assets/img/user/wechat_logo.png" alt="wechat" />
|
|
|
</a>
|
|
|
</div>
|
|
|
<agreement :visible.sync="agreeShow"></agreement>
|
|
|
@@ -91,182 +91,186 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import InputVer from '@/components/input/ver'
|
|
|
-import InputVerImg from '@/components/input/ver_img'
|
|
|
-import InputArea from '@/components/input/area'
|
|
|
-import Agreement from '@/components/agreement'
|
|
|
+import InputVer from "@/components/input/ver";
|
|
|
+import InputVerImg from "@/components/input/ver_img";
|
|
|
+import InputArea from "@/components/input/area";
|
|
|
+import Agreement from "@/components/agreement";
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
InputVer,
|
|
|
InputVerImg,
|
|
|
InputArea,
|
|
|
- Agreement,
|
|
|
+ Agreement
|
|
|
},
|
|
|
data() {
|
|
|
let validateEmail = (rule, value, callback) => {
|
|
|
if (!value.trim()) {
|
|
|
- callback(new Error('请输入邮箱'))
|
|
|
+ callback(new Error("请输入邮箱"));
|
|
|
} else {
|
|
|
if (value.match(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/)) {
|
|
|
- callback()
|
|
|
+ callback();
|
|
|
} else {
|
|
|
- callback(new Error('邮箱格式不正确!'))
|
|
|
+ callback(new Error("邮箱格式不正确!"));
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
return {
|
|
|
pwdShow: false,
|
|
|
agreeShow: false,
|
|
|
usePhone: true,
|
|
|
ruleFormPhone: {
|
|
|
- mobile: '',
|
|
|
- ver: '',
|
|
|
- nickname: '',
|
|
|
- pwd: '',
|
|
|
+ mobile: "",
|
|
|
+ ver: "",
|
|
|
+ nickname: "",
|
|
|
+ pwd: ""
|
|
|
},
|
|
|
rulesPhone: {
|
|
|
mobile: [
|
|
|
- { required: true, message: '请输入手机号', trigger: 'blur' },
|
|
|
- { min: 7, max: 16, message: '请输入正确的手机号', trigger: 'blur' }
|
|
|
- ],
|
|
|
- ver: [
|
|
|
- { required: true, message: '请输入验证码', trigger: 'blur' },
|
|
|
- ],
|
|
|
- nickname: [
|
|
|
- { required: true, message: '请输入昵称', trigger: 'blur' },
|
|
|
+ { required: true, message: "请输入手机号", trigger: "blur" },
|
|
|
+ { min: 7, max: 16, message: "请输入正确的手机号", trigger: "blur" }
|
|
|
],
|
|
|
+ ver: [{ required: true, message: "请输入验证码", trigger: "blur" }],
|
|
|
+ nickname: [{ required: true, message: "请输入昵称", trigger: "blur" }],
|
|
|
pwd: [
|
|
|
- { required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
- { min: 6, message: '密码至少为6位字符', trigger: 'blur' },
|
|
|
- ],
|
|
|
+ { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
+ { min: 6, message: "密码至少为6位字符", trigger: "blur" }
|
|
|
+ ]
|
|
|
},
|
|
|
ruleFormEmail: {
|
|
|
- email: '',
|
|
|
- ver: '',
|
|
|
- nickname: '',
|
|
|
- pwd: '',
|
|
|
+ email: "",
|
|
|
+ ver: "",
|
|
|
+ nickname: "",
|
|
|
+ pwd: ""
|
|
|
},
|
|
|
rulesEmail: {
|
|
|
email: [
|
|
|
- { validator: validateEmail, message: '请输入正确的邮箱', trigger: 'blur' },
|
|
|
- ],
|
|
|
- ver: [
|
|
|
- { required: true, message: '请输入验证码', trigger: 'blur' },
|
|
|
- ],
|
|
|
- nickname: [
|
|
|
- { required: true, message: '请输入昵称', trigger: 'blur' },
|
|
|
+ {
|
|
|
+ validator: validateEmail,
|
|
|
+ message: "请输入正确的邮箱",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
],
|
|
|
+ ver: [{ required: true, message: "请输入验证码", trigger: "blur" }],
|
|
|
+ nickname: [{ required: true, message: "请输入昵称", trigger: "blur" }],
|
|
|
pwd: [
|
|
|
- { required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
- { min: 6, message: '密码至少为6位字符', trigger: 'blur' },
|
|
|
- ],
|
|
|
+ { required: true, message: "请输入密码", trigger: "blur" },
|
|
|
+ { min: 6, message: "密码至少为6位字符", trigger: "blur" }
|
|
|
+ ]
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.$store.getters.isLogin) {
|
|
|
- this.$message('你已有注册的账号')
|
|
|
+ this.$message("你已有注册的账号");
|
|
|
setTimeout(() => {
|
|
|
- location.href = '/'
|
|
|
- }, 1000)
|
|
|
+ location.href = "/";
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
chengeVerMobile(val) {
|
|
|
- this.ruleFormPhone.ver = val
|
|
|
+ this.ruleFormPhone.ver = val;
|
|
|
},
|
|
|
chengeVerEmail(val) {
|
|
|
- this.ruleFormEmail.ver = val
|
|
|
+ this.ruleFormEmail.ver = val;
|
|
|
},
|
|
|
chengeMobile(val) {
|
|
|
- this.ruleFormPhone.mobile = val
|
|
|
+ this.ruleFormPhone.mobile = val;
|
|
|
},
|
|
|
/**
|
|
|
* 点击注册
|
|
|
*/
|
|
|
doRegist() {
|
|
|
- let mobile = this.ruleFormPhone.mobile
|
|
|
+ let mobile = this.ruleFormPhone.mobile;
|
|
|
let register = async body => {
|
|
|
- let res = await this.$axios.$post('/api/passport/register', body)
|
|
|
+ let res = await this.$axios.$post("/api/passport/register", body);
|
|
|
if (res && res.data) {
|
|
|
- this.$message(res.data.info)
|
|
|
+ this.$message(res.data.info);
|
|
|
setTimeout(() => {
|
|
|
- location.href = "/user/success"
|
|
|
- }, 1000)
|
|
|
+ location.href = "/user/success";
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
if (this.usePhone) {
|
|
|
- this.$refs.ruleFormPhone.validate((valid) => {
|
|
|
+ this.$refs.ruleFormPhone.validate(valid => {
|
|
|
if (valid) {
|
|
|
let body = {
|
|
|
auth_code: this.ruleFormPhone.ver,
|
|
|
login_name: mobile,
|
|
|
mobile,
|
|
|
nickname: this.ruleFormPhone.nickname,
|
|
|
- password: this.ruleFormPhone.pwd,
|
|
|
- }
|
|
|
- register(body)
|
|
|
+ password: this.ruleFormPhone.pwd
|
|
|
+ };
|
|
|
+ register(body);
|
|
|
} else {
|
|
|
- console.log('error submit!!')
|
|
|
- return false
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.$refs.ruleFormEmail.validate((valid) => {
|
|
|
+ this.$refs.ruleFormEmail.validate(valid => {
|
|
|
if (valid) {
|
|
|
let body = {
|
|
|
captcha: this.ruleFormEmail.ver,
|
|
|
email: this.ruleFormEmail.email,
|
|
|
nickname: this.ruleFormEmail.nickname,
|
|
|
- password: this.ruleFormEmail.pwd,
|
|
|
- }
|
|
|
- register(body)
|
|
|
+ password: this.ruleFormEmail.pwd
|
|
|
+ };
|
|
|
+ register(body);
|
|
|
} else {
|
|
|
- console.log('error submit!!')
|
|
|
- return false
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 获取手机验证码
|
|
|
* @params {function} run 闭包函数,用来启动验证码内部脚本
|
|
|
*/
|
|
|
- async getVerMobile(run) {
|
|
|
+ async getVerMobile(token, run) {
|
|
|
// let checkRes = await this.$axios.$post('')
|
|
|
- let mobileSplit = this.ruleFormPhone.mobile.split('-')
|
|
|
- let area = mobileSplit[0] || ''
|
|
|
- let mobile = mobileSplit[1] || ''
|
|
|
- if (area.match(/\+86/) && !mobile.match(/^(0|86|17951)?(13[0-9]|15[012356789]|166|17[35678]|18[0-9]|14[57])[0-9]{8}$/)) {
|
|
|
+ let mobileSplit = this.ruleFormPhone.mobile.split("-");
|
|
|
+ let area = mobileSplit[0] || "";
|
|
|
+ let mobile = mobileSplit[1] || "";
|
|
|
+ if (
|
|
|
+ area.match(/\+86/) &&
|
|
|
+ !mobile.match(
|
|
|
+ /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[35678]|18[0-9]|14[57])[0-9]{8}$/
|
|
|
+ )
|
|
|
+ ) {
|
|
|
this.$message({
|
|
|
- message: '请输入正确手机号',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- return
|
|
|
+ message: "请输入正确手机号",
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
//console.log(area + mobile)
|
|
|
- let res = await this.$axios.$post('/api/user/sendMobileAuthCode', {
|
|
|
- mobile: area + '-' + mobile,
|
|
|
- })
|
|
|
+ let res = await this.$axios.$post("/api/user/sendMobileAuthCode", {
|
|
|
+ mobile: area + "-" + mobile,
|
|
|
+ token,
|
|
|
+ type: 1 // 注册1,忘记密码2,提现3
|
|
|
+ });
|
|
|
if (res) {
|
|
|
- run()
|
|
|
- this.$message(res.info)
|
|
|
+ run();
|
|
|
+ // this.$message(res.info);
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 点击切换注册模式
|
|
|
*/
|
|
|
doSwitch() {
|
|
|
- this.usePhone = !this.usePhone
|
|
|
- let clearValidate
|
|
|
- if (!this.usePhone) clearValidate = this.$refs.ruleFormPhone.clearValidate
|
|
|
- else clearValidate = this.$refs.ruleFormEmail.clearValidate
|
|
|
+ this.usePhone = !this.usePhone;
|
|
|
+ let clearValidate;
|
|
|
+ if (!this.usePhone)
|
|
|
+ clearValidate = this.$refs.ruleFormPhone.clearValidate;
|
|
|
+ else clearValidate = this.$refs.ruleFormEmail.clearValidate;
|
|
|
// setTimeout(clearValidate, 200)
|
|
|
- this.$nextTick(clearValidate)
|
|
|
+ this.$nextTick(clearValidate);
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|