Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
feat(认证): 被驳回的认证可继续填写
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jul 11, 2018
1 parent dbd6001 commit 8e585be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ export function postCertification(payload) {
return api.post(url, payload, { validateStatus: s => s === 201 });
}

export function patchCertification(payload) {
const url = "/user/certification";
return api.patch(url, payload, { validateStatus: s => s === 201 });
}

/**
* 获取用户认证信息
* @author mutoe <[email protected]>
Expand Down
27 changes: 22 additions & 5 deletions src/page/profile/Certificate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
import ContentText from "@/page/post/components/ContentText.vue";
import ImagePoster from "@/components/ImagePoster.vue";
import { postCertification } from "@/api/user.js";
import * as api from "@/api/user.js";
const formInfo = {
user: {
Expand Down Expand Up @@ -203,6 +203,7 @@ export default {
loading: false,
step: 1,
formInfo,
status: 0, // 认证状态
fields: {
name: "",
number: "",
Expand All @@ -225,8 +226,15 @@ export default {
* 认证类型. 必须是 (user|org)
* @returns {string}
*/
type() {
type: {
get() {
return this.$route.query.type || "user";
},
set(val) {
const { path, query } = this.$route;
query.type = val;
this.$router.push({ path, query });
}
},
/**
* 待提交表单
Expand Down Expand Up @@ -294,15 +302,24 @@ export default {
},
mounted() {
this.$store.dispatch("FETCH_USER_VERIFY").then(data => {
this.formData = data.data;
this.formData = data.data || {};
this.type = data.certification_name;
this.status = data.status;
});
},
methods: {
onSubmit() {
postCertification(this.formData).then(({ data: { message } }) => {
this.$Message.success(message || "提交成功,请等待审核");
if (this.status === 0) {
api.postCertification(this.formData).then(() => {
this.$Message.success("提交成功,请等待审核");
this.goBack();
});
} else {
api.patchCertification(this.formData).then(() => {
this.$Message.success("提交成功,请等待审核");
this.goBack();
});
}
},
uploaded1(poster) {
this.$set(this.fields.files, 0, poster.id);
Expand Down

0 comments on commit 8e585be

Please sign in to comment.