This repository has been archived by the owner on Nov 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
225 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ import lstore from "@/plugins/lstore/lstore.js"; | |
|
||
const userState = vuex.state.USERS; | ||
const resArray = { data: [] }; | ||
const noop = () => {}; | ||
|
||
/** | ||
* 关注 || 取关 操作 | ||
|
@@ -191,17 +190,15 @@ export function signinByAccount(payload) { | |
* 刷新用户信息 | ||
* @author jsonleex <[email protected]> | ||
* @export | ||
* @param {Function} [callback = noop] | ||
* @returns {Promise<UserObject>} | ||
*/ | ||
export function refreshCurrentUserInfo(callback = noop) { | ||
export function refreshCurrentUserInfo() { | ||
return api.get(`/user`).then( | ||
({ data }) => { | ||
// 保存本地 | ||
lstore.setData("H5_CUR_USER", data); | ||
// 保存 vuex | ||
vuex.commit("SAVE_CURRENTUSER", data); | ||
callback(); | ||
return data; | ||
}, | ||
err => { | ||
|
@@ -238,3 +235,33 @@ export function rewardUser(userId, data) { | |
const url = `/user/${userId}/new-rewards`; | ||
return api.post(url, data, { validateStatus: s => s === 201 }); | ||
} | ||
|
||
/** | ||
* 申请认证 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @param {Object} payload | ||
* @param {string} payload.type 'user' or 'org' | ||
* @param {string} payload.name 真实姓名 or 负责人名字 | ||
* @param {string} payload.phone 用户联系方式 or 负责人联系方式 | ||
* @param {string} payload.number 身份证号码 or 营业执照注册号 | ||
* @param {string} payload.desc 认证描述 | ||
* @param {string} [payload.org_name] 企业或机构名称 | ||
* @param {string} [payload.org_address] 企业或机构地址 | ||
* @param {number[]} [payload.files] | ||
* @returns | ||
*/ | ||
export function postCertification(payload) { | ||
const url = "/user/certification"; | ||
return api.post(url, payload, { validateStatus: s => s === 201 }); | ||
} | ||
|
||
/** | ||
* 获取用户认证信息 | ||
* @author mutoe <[email protected]> | ||
* @export | ||
* @returns | ||
*/ | ||
export function getUserVerifyInfo() { | ||
return api.get("/user/certification", { validateStatus: s => s === 200 }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
<template> | ||
<div class="p-profile-certification"> | ||
<header class="m-box m-pos-f m-main m-bb1 m-head-top"> | ||
<div | ||
class="m-box m-aln-center m-flex-none" | ||
@click="goBack"> | ||
<v-icon type="base-back" /> | ||
</div> | ||
<div class="m-box m-aln-center m-flex-auto m-justify-center m-head-top-title"> | ||
<span>{{ type === 'user' ? '个人' : '企业' }}认证</span> | ||
</div> | ||
<div class="m-box m-aln-center m-flex-none btn-submit"/> | ||
</header> | ||
<main class="m-box-model main"> | ||
<div | ||
v-if="verified.status === 0" | ||
class="info-bar"> | ||
认证信息审核中,我们会在7个工作日内给您答复 | ||
</div> | ||
<div class="info-main"> | ||
<div class="row"> | ||
<span class="label">{{ formInfo[type].name }}</span> | ||
<span class="value">{{ verified.data.name }}</span> | ||
</div> | ||
<div class="row"> | ||
<span class="label">{{ formInfo[type].number }}</span> | ||
<span class="value">{{ verified.data.number }}</span> | ||
</div> | ||
<div class="row"> | ||
<span class="label">{{ formInfo[type].phone }}</span> | ||
<span class="value">{{ verified.data.phone }}</span> | ||
</div> | ||
<div class="row"> | ||
<span class="label">{{ formInfo[type].desc }}</span> | ||
<span class="value">{{ verified.data.desc }}</span> | ||
</div> | ||
<div class="row"> | ||
<span class="label">认证资料</span> | ||
<span class="value"> | ||
<img | ||
v-for="imageId in verified.data.files" | ||
:key="imageId" | ||
:src="getImageSrc(imageId)"> | ||
</span> | ||
</div> | ||
</div> | ||
</main> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
/** | ||
* 认证状态页面 | ||
*/ | ||
import _ from "lodash"; | ||
import { mapState } from "vuex"; | ||
const formInfo = { | ||
user: { | ||
name: "真实姓名", | ||
number: "身份证号码", | ||
phone: "手机号码", | ||
desc: "认证描述" | ||
}, | ||
org: { | ||
name: "负责人", | ||
number: "身份证号码", | ||
phone: "手机号码", | ||
desc: "认证描述", | ||
orgName: "机构名称", | ||
orgAddress: "机构地址" | ||
} | ||
}; | ||
export default { | ||
name: "Certification", | ||
data() { | ||
return { | ||
formInfo | ||
}; | ||
}, | ||
computed: { | ||
...mapState({ | ||
verified: state => state.USER_VERIFY | ||
}), | ||
type() { | ||
const { certification_name = "user" } = this.verified; | ||
return certification_name; | ||
} | ||
}, | ||
watch: { | ||
verified(to) { | ||
console.log(to); | ||
// 如果被驳回或没有数据则返回个人页面 | ||
if (to.id && ![0, 1].includes(to.status)) { | ||
this.$router.replace("/profile"); | ||
} | ||
} | ||
}, | ||
created() { | ||
// 如果 store 中没有数据则重新获取认证数据,用于首屏加载 | ||
if (_.isEmpty(this.verified) || !this.verified.id) { | ||
this.$store.dispatch("FETCH_USER_VERIFY"); | ||
} | ||
}, | ||
methods: { | ||
/** | ||
* @param {number} id | ||
* @returns {string} | ||
*/ | ||
getImageSrc(id) { | ||
return `${this.$http.defaults.baseURL}/files/${id}?w=250&h=185`; | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.p-profile-certification { | ||
main { | ||
padding-top: 0.9rem; | ||
.info-bar { | ||
background-color: #4bb893; | ||
color: #fff; | ||
font-size: 24px; | ||
padding: 18px; | ||
text-align: center; | ||
} | ||
.row { | ||
font-size: 30px; | ||
line-height: 36px; | ||
margin-top: 78px; | ||
margin-left: 30px; | ||
.label { | ||
display: inline-block; | ||
width: 5em; | ||
margin-right: 1em; | ||
color: #999; | ||
vertical-align: top; | ||
} | ||
img { | ||
width: ~"calc(50% - 4em)"; | ||
margin-left: 4px; | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters