Commit 5c645564 by zhanghui1

test

parent a0a5d7a5
...@@ -32,12 +32,14 @@ ...@@ -32,12 +32,14 @@
<button @click="goLogin" :disabled="showLoading" :isLoading="showLoading">{{ showLoading ? '' : '登录' }}</button> <button @click="goLogin" :disabled="showLoading" :isLoading="showLoading">{{ showLoading ? '' : '登录' }}</button>
<div class="clearfix"> <div class="clearfix">
<a class="left" @click="switchLogin">{{ useMail ? '使用手机号登录' : '使用邮箱登录' }}</a> <a class="left" @click="switchLogin">{{ useMail ? '使用手机号登录' : '使用邮箱登录' }}</a>
<router-link class="right" to="/sign-up-mobile">注册</router-link> <router-link class="right" v-show="!useMail" to="/sign-up-mobile">注册</router-link>
<router-link class="right" v-show="useMail" to="/sign-up-email">注册</router-link>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
window.config = { appName: "Blockin Account", baseUrl: "https://ucdev1212.blockin.com", locale: "zh-cn", user: null };
import { mapState } from 'vuex' import { mapState } from 'vuex'
import countryInfo from './country_info.json' import countryInfo from './country_info.json'
import captcha from './captcha.vue' import captcha from './captcha.vue'
...@@ -108,7 +110,7 @@ export default { ...@@ -108,7 +110,7 @@ export default {
email = this.form.email; email = this.form.email;
const { data: accountResponse } = await this.$axios const { data: accountResponse } = await this.$axios
.post(this.UC_BASEURL+'/auth/api' + api['post-login-start'], { .post(this.UC_BASEURL + '/auth/api' + api['post-login-start'], {
captcha: this.showEmailCaptcha ? this.form.captcha : '', // todo: 登录验证码 captcha: this.showEmailCaptcha ? this.form.captcha : '', // todo: 登录验证码
email, email,
type: 'email' type: 'email'
...@@ -154,7 +156,7 @@ export default { ...@@ -154,7 +156,7 @@ export default {
email = this.form.country + '|' + this.form.email; email = this.form.country + '|' + this.form.email;
const { data: accountResponse } = await this.$axios const { data: accountResponse } = await this.$axios
.post(apiDomain + '/auth/api' + api['post-login-start'], { .post(this.UC_BASEURL + '/auth/api' + api['post-login-start'], {
captcha: this.showMobileCaptcha ? this.form.captcha : '', // todo: 登录验证码 captcha: this.showMobileCaptcha ? this.form.captcha : '', // todo: 登录验证码
email, email,
type: 'mobile' type: 'mobile'
...@@ -174,7 +176,7 @@ export default { ...@@ -174,7 +176,7 @@ export default {
} }
const { data: passwordResponse } = await this.$axios const { data: passwordResponse } = await this.$axios
.post(apiDomain + '/auth/api' + api['post-login-password'], { .post(this.UC_BASEURL + '/auth/api' + api['post-login-password'], {
password: this.form.password password: this.form.password
}); });
...@@ -214,6 +216,7 @@ export default { ...@@ -214,6 +216,7 @@ export default {
switchLogin() { switchLogin() {
this.useMail = !this.useMail; this.useMail = !this.useMail;
this.form.email = ''; this.form.email = '';
this.form.password = '';
if (this.useMail) { if (this.useMail) {
localStorage.setItem('login-type', 'email'); localStorage.setItem('login-type', 'email');
this.showEmailCaptcha = false; this.showEmailCaptcha = false;
......
<template> <template>
<div>邮箱注册页</div> <div class="page reg">
<div class="page-header">
<div class="l" @click="goBack"><span class="icon-back"><i class="iconfont icon-fanhui"></i></span></div>
<div class="c">注册</div>
<div class="r" @click="goLogin"><span class="txt abs-right">登录</span></div>
</div>
<div class="page-content">
<div v-if="step===1">
<h2 class="f-tac c-blue2 fs36 pt80 pb60">使用邮箱地址注册</h2>
<div class="form-content">
<el-form :model="regForm" ref="regForm" label-width="0px">
<el-form-item prop="email" label="" :rules="[{ required: true, message: '请输入邮箱地址', trigger: 'blur' },{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }]">
<el-input v-model="regForm.email" placeholder="输入邮箱"><i slot="prefix" class="iconfont icon-email"></i></el-input>
</el-form-item>
<captcha v-show="showEmailCaptcha" :captcha="regForm.captcha" ref="captchaEmail" @dispatchCaptcha="getCaptchaValue"></captcha>
<el-form-item>
<div class="btn-group full mt100">
<el-button type="primary" round @click="submitForm('regForm')">提交</el-button>
</div>
<!-- <div class="f-tac">
<router-link to="" class="c-blue1">使用手机号注册>></router-link>
</div> -->
</el-form-item>
</el-form>
</div>
</div>
<div v-if="step===2">123123</div>
</div>
</div>
</template> </template>
<script> <script>
export default{ import captcha from '@/components/ucenter/captcha'
data(){ export default {
return {} name: 'rega',
} data() {
} return {
</script> regForm: {
\ No newline at end of file email: ''
},
step: 1
}
},
components:{
captcha,
},
mounted() {
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$router.replace('/jump')
} else {
console.log('error submit!!');
return false;
}
});
},
goBack() {
this.$router.go(-1)
},
goLogin() {
this.$router.replace("/login")
}
},
}
</script>
<style>
</style>
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import {api} from '@/components/ucenter/helpers.js'; import axios from 'axios';
import { api } from '@/components/ucenter/helpers.js';
Vue.use(Vuex); Vue.use(Vuex);
import dictionaries from '@/utils/dictionaries.js'; //字典 import dictionaries from '@/utils/dictionaries.js'; //字典
...@@ -62,7 +63,7 @@ const mutations = { ...@@ -62,7 +63,7 @@ const mutations = {
}, },
FETCH_USER_SUCCESS(state, { user }) { FETCH_USER_SUCCESS(state, { user }) {
window.config.user = user; // window.config.user = user;
state.user = user; state.user = user;
}, },
...@@ -81,20 +82,20 @@ const getters = { ...@@ -81,20 +82,20 @@ const getters = {
user: state => { user: state => {
return state.user return state.user
}, },
check: state => { // check: state => {
let hasLogged = state.user && Boolean(state.user.uid); // let hasLogged = state.user && Boolean(state.user.uid);
if (!hasLogged) { // if (!hasLogged) {
hasLogged = Boolean(JSON.parse(window.config.register)); // hasLogged = Boolean(JSON.parse(window.config.register));
} // }
return hasLogged; // return hasLogged;
} // }
} }
const actions = { const actions = {
async fetchUser({commit}) { async fetchUser({ commit }) {
try { try {
const { data } = await axios const { data } = await axios
.get(config.apiDomain + api['get-userinfo']); .get(state.UC_BASEURL + '/auth/api' + api['get-userinfo']);
if (data.err_no) { if (data.err_no) {
throw new Error('get userinfo fail'); throw new Error('get userinfo fail');
...@@ -109,19 +110,14 @@ const actions = { ...@@ -109,19 +110,14 @@ const actions = {
} }
}, },
updateUser({ updateUser({ commit }, payload) {
commit
}, payload) {
commit('UPDATE_USER', payload) commit('UPDATE_USER', payload)
}, },
async logout({ async logout({ commit }) {
commit
}) {
try { try {
await axios.get('/logout') await axios.get('/logout')
} catch (e) {} } catch (e) {}
commit('LOGOUT') commit('LOGOUT')
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment