Authored by htoooth

add login

... ... @@ -130,6 +130,11 @@ export default {
},
methods: {
async onSubmit() {
if (!this.$yoho.isLogin()) {
this.$yoho.goLogin();
return;
}
if (this.validate()) {
this.toast = this.$createToast({
type: 'loading',
... ... @@ -144,7 +149,7 @@ export default {
this.toast && this.toast.hide();
if (result && result.code === 200) {
this.$store.commit('license/form/FETCH_UFO_STATUS_SUCCESS', 0);
this.$store.commit('license/form/FETCH_UFO_STATUS_SUCCESS', {status: 0});
} else {
this.$createToast({
type: 'error',
... ...
... ... @@ -36,9 +36,9 @@ export default {
},
mounted() {
if (this.needLogin) {
setTimeout(() => {
this.$yoho.ready(() => {
this.$yoho.goLogin({});
}, 1000);
});
}
}
};
... ...
... ... @@ -24,7 +24,7 @@
<div class="image fail"></div>
<div class="pane-body">
<h1>审核不通过</h1>
<p class="desc">您提交的姓名和身份证不匹配。</p>
<p class="desc">{{message}}</p>
</div>
<div class="footer" @click="onRepeatClick">重新提交</div>
... ... @@ -58,7 +58,7 @@ export default {
return {};
},
computed: {
...mapState(['status'])
...mapState(['status', 'message'])
},
methods: {
...mapActions(['getStoreStatus']),
... ... @@ -66,7 +66,7 @@ export default {
this.$yoho.finishPage({});
},
onRepeatClick() {
this.$store.commit('license/form/FETCH_UFO_STATUS_SUCCESS', -1);
this.$store.commit('license/form/FETCH_UFO_STATUS_SUCCESS', {status: -1});
},
async onCashClick() {
const result = await this.getStoreStatus();
... ...
... ... @@ -30,17 +30,10 @@ export default {
},
async saveLicense({ commit }, data) {
let result = {};
try {
result = await this.$api.post(
'/api/ufo/license/save',
_handleData(data)
);
} catch (e) {
commit(Types.FETCH_UFO_NEED_LOGIN, true);
return result;
}
const result = await this.$api.post(
'/api/ufo/license/save',
_handleData(data)
);
return result;
},
... ... @@ -58,7 +51,7 @@ export default {
}
if (result.code === 200) {
commit(Types.FETCH_UFO_STATUS_SUCCESS, result.data);
commit(Types.FETCH_UFO_STATUS_SUCCESS, { status: result.data, message: result.message });
} else {
commit(Types.FETCH_UFO_STATUS_SUCCESS, -1);
}
... ...
... ... @@ -8,6 +8,7 @@ export default function() {
fetching: false,
token: false,
status: -1,
message: '',
needLogin: false
},
actions,
... ...
... ... @@ -5,8 +5,9 @@ export default {
state.token = token;
},
[Types.FETCH_UFO_STATUS_SUCCESS](state, data) {
state.status = data;
[Types.FETCH_UFO_STATUS_SUCCESS](state, {status, message}) {
state.status = status;
state.message = message;
},
[Types.FETCH_UFO_NEED_LOGIN](state, data) {
... ...