Commit 8b9a0d18 authored by Damon's avatar Damon

Merge branch 'dev-v1.0.0' of git.banshouhui.com:wuzhenzhe/study into dev-v1.0.0

parents 59203b55 32ec109f
const UNI_APP = {
apiUrl: 'http://192.168.0.204:8760',
apiUrl: 'http://192.168.1.22:8760',
qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'http://deudn.c.pp.cc/',
qn_asset_url: 'https://img2.banshouhui.com/',
uCenterUrl: 'http://192.168.0.5:8093/', //'http://rest-u.yunya.com/'
argoDebugMode: 1,
version: 'v1.0.0',
......
......@@ -89,6 +89,13 @@ let learnApiFun = function(vm) {
// 检查是否具有体验资格
let checkGetQuestion = async (questionWarehouseId) =>
await vm.$u.get('/rest/question/checkGetQuestion/' + questionWarehouseId)
// 每日一练统计
let everyTaskList = async (questionWarehouseId, params = {}) =>
await vm.$u.get(
'/rest/question/query/everyTaskList/' + questionWarehouseId,
params
)
const learnApi = {
getQuestion,
getQuestionTotal,
......@@ -111,6 +118,7 @@ let learnApiFun = function(vm) {
bindCard,
searchQuestion,
checkGetQuestion,
everyTaskList,
}
return learnApi
}
......
......@@ -14,21 +14,29 @@ let userApiFun = function(vm) {
//验证身份证反面
let checkIdCardBack = async (params = {}) =>
await vm.$u.post(uCenterUrl + 'v1/settled/card-back', params)
//获取国家证列表
let getCountryCertList = async (params = {}) =>
await vm.$u.post(apiUrl + '/rest/certificate/query', params)
//获取学时证列表
let getlearnCertList = async (params = {}) =>
await vm.$u.get(apiUrl + '/rest/question/getSchoolCertificate', params)
let getlearnCertDetail = async (questionWarehouseId, params = {}) =>
//获取学时证详情
let getlearnCertDetail = async (questionWarehouseId) =>
await vm.$u.get(
apiUrl + '/rest/question/getSchoolCertificate/' + questionWarehouseId,
params
apiUrl + '/rest/question/getSchoolCertificate/' + questionWarehouseId
)
//证书查询结果
let getCertFromOut = async (params = {}) =>
await vm.$u.get(apiUrl + '/rest/certificate/national', params)
//身份证识别
let getCertifyInfoByType = async (type, params = {}) =>
await vm.$u.get(apiUrl + '/student/get/idCard/' + type, params)
//获取学员题库列表
let getUserQuestionWareHouse = async (params = {}) =>
await vm.$u.get(
apiUrl + '/rest/question/query/allStudentQuestionWarehouse',
params
)
const userApi = {
updateUserInfo,
......@@ -39,6 +47,8 @@ let userApiFun = function(vm) {
getlearnCertList,
getlearnCertDetail,
getCertFromOut,
getCertifyInfoByType,
getUserQuestionWareHouse,
}
return userApi
}
......
This diff is collapsed.
......@@ -8,10 +8,10 @@
<view
v-if="key == 'result'"
:class="['result-text', { passed: passed }]"
>{{ resultText }}</view
>{{ data[key] }}</view
>
<view v-else class="content-text">{{ info[key] }}</view>
<view class="unit-text">{{ units[key] }}</view>
<view v-else class="content-text">{{ data[key] }}</view>
<view v-if="units[key]" class="unit-text">{{ units[key] }}</view>
</view>
</view>
</view>
......@@ -32,26 +32,48 @@ export default {
return {}
},
computed: {
data() {
return {
take: this.take,
point: this.info.point,
result: this.resultText,
}
},
take() {
if (this.info.startDatetime && this.info.endDatetime) {
let timesStart = new Date(
this.info.startDatetime.replace(/\-/g, '/')
).getTime()
let timesEnd = new Date(
this.info.endDatetime.replace(/\-/g, '/')
).getTime()
return Math.ceil((timesEnd - timesStart) / 1000 / 60)
}
return 0
},
timeText() {
return this.$u.timeFormat(this.info.date, 'yyyy.mm.dd')
return this.info.endDatetime
? this.info.endDatetime.split(' ')[0].replace(/\-/g, '.')
: this.$u.timeFormat(new Date().getTime(), 'yyyy.mm.dd')
},
labels() {
return {
time: '模考用时',
score: '模考成绩',
take: '模考用时',
point: '模考成绩',
result: '是否及格',
}
},
units() {
return {
time: '分钟',
score: '分',
take: '分钟',
point: '分',
result: '',
}
},
passed() {
// 及格、不及格
return this.info.score >= 60
return this.info.point >= 60
},
resultText() {
return this.passed ? '及格' : '不及格'
......@@ -83,6 +105,7 @@ export default {
padding-top: 16rpx;
display: flex;
align-items: flex-end;
justify-content: center;
.result-text {
font-size: 44rpx;
color: #fa5a49;
......@@ -103,7 +126,7 @@ export default {
.unit-text {
padding-left: 14rpx;
font-weight: 400;
margin-bottom: 11rpx;
margin-bottom: 12rpx;
}
}
}
......
......@@ -18,7 +18,7 @@
"style": {
"navigationBarTitleText": "证书",
"navigationStyle": "custom",
"disableScroll": false
"disableScroll": true
}
},
{
......
......@@ -14,15 +14,11 @@
<u-image :src="topImage" height="116rpx" width="100%"></u-image>
</view>
<view class="table-list">
<view v-if="type == 'country'" class="item">
<view class="name">{{ certName }}</view>
<view class="item" v-for="(data, k) in dataList">
<view class="name">{{ certName[k] }}</view>
<view class="table">
<u-table border-color="#9EA5BB">
<u-tr
v-for="(item, i) in data.certificateTextContent"
:key="i"
class="u-tr"
>
<u-tr v-for="(item, i) in data" :key="i" class="u-tr">
<u-td
v-for="(val, name, index) in item"
:key="index"
......@@ -48,16 +44,13 @@
export default {
data() {
return {
data: {
certificateTextContent: [],
},
dataList: [],
learnData: {},
type: null,
certName: '',
certName: [],
topImage: process.uniEnv.qn_base_url + 'tezhongzuoyepingtai@2x.png',
}
},
onShow: function() {
onLoad: function() {
this.formatDataByType()
},
computed: {
......@@ -111,39 +104,33 @@ export default {
return
}
let certData = getApp().globalData.certItemData
this.certName = certData.certificateName
if (certData.type == 'country') {
console.log('ok')
this.type = 'country'
this.certName = certData.certificateName
let countryData = []
let count = certData.data.count || 2
let list
console.log('data is', certData.data)
if (!certData.data.certificateTextContent) {
let countryData = []
let certName = []
let count, list
for (let k in certData) {
countryData[k] = []
count = certData[k].data.count || 2
certName[k] = certData[k].certificateName.replace('作业', '证')
//格式化表格数据为json
if (!certData[k].data.certificateTextContent) {
list = JSON.parse(
JSON.parse(JSON.stringify(certData.data.certificateContent))
JSON.parse(JSON.stringify(certData[k].data.certificateContent))
)
console.log('list is', list)
} else {
list = certData.data.certificateTextContent
list = certData[k].data.certificateTextContent
}
//组合表格数据
for (let key in list) {
countryData[key] = []
countryData[k][key] = []
for (let i = 1; i <= count; i++) {
countryData[key].push(list[key]['filedName_' + i])
countryData[key].push(list[key]['filedValue_' + i])
countryData[k][key].push(list[key]['filedName_' + i])
countryData[k][key].push(list[key]['filedValue_' + i])
}
}
console.log('data countryData', countryData)
certData.data.certificateTextContent = countryData
this.data = certData.data
console.log('data log', this.data)
} else if (certData.type == 'learn') {
this.type = 'learn'
this.learnData = certData.data
}
this.certName = certName
this.dataList = countryData
console.log('data redo log', this.dataList)
},
},
}
......@@ -156,13 +143,15 @@ export default {
color: transparent;
display: none;
}
page {
background-color: #2953ff;
}
.begin-answer {
display: flex;
flex-direction: column;
background-color: #2953ff;
background-size: 100% 920rpx;
background-repeat: no-repeat;
height: 120vh;
height: 100vh;
position: absolute;
top: 0;
width: 100%;
......@@ -173,7 +162,7 @@ export default {
flex-direction: column;
align-items: center;
justify-content: center;
padding: 30rpx 24rpx 0rpx 24rpx;
padding: 30rpx 24rpx 50rpx 24rpx;
}
.cert-body {
......
......@@ -85,16 +85,24 @@ export default {
type: null,
certName: '',
topImage: process.uniEnv.qn_base_url + 'xueshitoubu@2x.png',
workPlace: ''
}
},
onLoad(){
this.$u.api.getUserInfo().then((res) => {
this.workPlace =
res && res.workUnit || null
})
},
onShow: function() {
this.formatDataByType()
},
computed: {
nowDate(){
var Today=new Date();
let m = (Today.getMonth()+1)
let d = Today.getDate()
let m = String(Today.getMonth()+1)
let d = String(Today.getDate())
console.log('d length', d.length)
return (Today.getFullYear() + '.' + (m.length > 1 ? m : '0' + m) + '.' + (d.length > 1 ? d : '0' + d))
},
headPhoto(){
......@@ -113,7 +121,7 @@ export default {
return this.learnData.idCard || ' '
},
company() {
return this.learnData.company || ' '
return this.workPlace
},
subjectName() {
return this.learnData.subjectName || ' '
......@@ -122,13 +130,13 @@ export default {
return this.learnData.institutionName || '模考大师'
},
maxpoint() {
return this.learnData.maxPoint || 0
return this.learnData.maxPoint > 0 && this.learnData.maxPoint || ''
},
learnTime() {
return this.learnData.time || 0
return this.learnData.maxPoint > 0 && this.learnData.time || ''
},
resultForTest() {
return (this.learnData.maxPoint > 80 && '合格') || '不合格'
return this.learnData.maxPoint > 0 && ((this.learnData.maxPoint > 80 && '合格') || '不合格') || ''
},
},
methods: {
......
This diff is collapsed.
......@@ -413,8 +413,10 @@ export default {
if (this.info.id) {
// 跳转到学练记录
this.$u.route({
url: 'pages/learn/record?part=',
key,
url: 'pages/learn/record?key=',
params: {
key: key,
},
})
} else {
this.$refs.uToast.show({
......
......@@ -16,78 +16,103 @@
<image class="xunzhang-image" :src="xunzhangImage"></image>
</view>
<view class="body-view">
<view class="date-view">
<view class="content-title" id="part-days">每日一练</view>
<view class="date-content"></view>
</view>
<view class="charts-view">
<view class="content-title" id="part-total">练习分析</view>
<view class="range-view">
<view class="range-title">日期范围</view>
<view
v-for="(item, index) in items"
:key="index"
:class="['range-item', { selected: item.selected }]"
@click="handleClickRange(index)"
>{{ item.title }}</view
>
<scroll-view
scroll-y="true"
class="scroll-view"
@scrolltolower="reachBottom"
scroll-anchoring
enable-back-to-top
:scroll-into-view="scrollId"
>
<view class="date-view">
<view class="content-title" id="part-days">每日一练</view>
<view class="date-content">
<Calendar
:initialDays="days"
@change="handleChangeMonth"
></Calendar>
</view>
</view>
<view v-if="showSelect" class="days-select-view">
<picker
mode="date"
:value="rangeDay0"
:end="rangeDay1"
@change="handleConform($event, 0)"
>
<view class="date-picker-content" hover-class="hover-class">
<view class="input-view">{{ rangeDay0 }}</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<view class="line-view">-</view>
<picker
mode="date"
:value="rangeDay1"
:start="rangeDay0"
:end="getDate()"
@change="handleConform($event, 1)"
>
<view class="date-picker-content" hover-class="hover-class">
<view class="input-view">{{ rangeDay1 }}</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<view class="charts-view">
<view class="content-title" id="part-total">练习分析</view>
<view class="range-view">
<view class="range-title">日期范围</view>
<view
v-for="(item, index) in items"
:key="index"
:class="['range-item', { selected: item.selected }]"
@click="handleClickRange(index)"
>{{ item.title }}</view
>
</view>
<view v-if="showSelect" class="days-select-view">
<picker
mode="date"
:value="rangeDay0"
:end="rangeDay1"
@change="handleConform($event, 0)"
>
<view class="date-picker-content" hover-class="hover-class">
<view class="input-view">{{ rangeDay0 }}</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<view class="line-view">-</view>
<picker
mode="date"
:value="rangeDay1"
:start="rangeDay0"
:end="getDate()"
@change="handleConform($event, 1)"
>
<view class="date-picker-content" hover-class="hover-class">
<view class="input-view">{{ rangeDay1 }}</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
</view>
<view class="charts-content"> </view>
</view>
<view class="charts-content"> </view>
</view>
<view class="list-view">
<view class="content-title" id="part-today">模考成绩</view>
<view class="list-content">
<RecordCell
v-for="(item, index) in showedList"
:key="index"
:info="item"
></RecordCell>
<view class="show-more" @click="showAll = true" v-if="!showAll">
<u-icon name="arrow-down"></u-icon>
<text>查看更多</text>
<view class="list-view">
<view class="content-title" id="part-today">模考成绩</view>
<view class="list-content">
<RecordCell
v-for="(item, index) in lists"
:key="index"
:info="item"
></RecordCell>
<!-- <view class="show-more" @click="showAll = true" v-if="!showAll">
<u-icon name="arrow-down"></u-icon>
<text>查看更多</text>
</view> -->
</view>
<u-loadmore
v-show="
(recordParams.current == 1 && loaded) || recordParams.current > 1
"
:status="currentLoadStatus"
></u-loadmore>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import RecordCell from '@/components/record-cell'
import Calendar from '@/components/calendar'
export default {
components: { RecordCell },
components: { RecordCell, Calendar },
data() {
return {
lists: [],
days: [],
showSelect: false,
showAll: false,
scrollId: null,
loaded: false,
items: [
{
title: '近7天',
......@@ -102,9 +127,13 @@ export default {
selected: false,
},
],
currentLoadStatus: 'loading',
rangeDay0: this.getDate(), // 自定义开始日期
rangeDay1: this.getDate(), // 自定义结束日期
recordParams: {
current: 0,
size: 15,
},
}
},
......@@ -119,23 +148,74 @@ export default {
day: true,
}
},
showedList() {
return this.showAll ? this.lists : this.lists.slice(0, 2)
},
},
onLoad(e) {
if (e && e.key) {
this.$nextTick(() => {
this.scrollId = 'part-' + e.key
setTimeout(() => {
this.scrollId = 'part-' + e.key
}, 500)
})
}
this.lists = [
{ time: 36, score: 80, date: new Date().getTime },
{ time: 100, score: 40, date: new Date().getTime },
{ time: 40, score: 60, date: new Date().getTime },
]
this.queryExamRecord()
},
methods: {
// 每日一练统计
everyTaskList(year, month) {
var params = {
startDate: this.$u.timeFormat(
new Date(year, month - 1, 1).getTime(),
'yyyy-mm-dd'
),
endDate: this.$u.timeFormat(
new Date(year, month, 0).getTime(),
'yyyy-mm-dd'
),
}
this.$u.api
.everyTaskList(this.questionWarehouseId, params)
.then((res) => {
this.days = []
for (var item of res) {
this.days.push(item.time.replace(/\-0/g, '\-'))
}
})
.catch((err) => {
console.log(err)
})
},
// 模考记录
queryExamRecord() {
this.recordParams.current += 1
;(this.recordParams.model = {
questionWarehouseId: this.questionWarehouseId,
}),
this.$u.api
.queryExamRecord(this.recordParams)
.then((res) => {
this.loaded = true
if (this.recordParams.current == 1) {
this.lists = []
}
if ((res.records || []).length > 0) {
this.lists.push(...res.records)
}
this.currentLoadStatus =
res.total > this.lists.length &&
(res.records || []).length == this.recordParams.size
? 'loadmore'
: 'nomore'
})
.catch((err) => {
this.loaded = true
console.log(err)
})
},
handleChangeMonth(e) {
this.everyTaskList(e.year, e.month)
},
handleClick() {},
handleClickRange(index) {
for (var item of this.items) {
......@@ -158,17 +238,16 @@ export default {
getDate() {
return this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd')
},
reachBottom() {
if (this.currentLoadStatus != 'loadmore') return
this.currentLoadStatus == 'loading'
this.queryExamRecord()
},
},
}
</script>
<style lang="scss" scoped>
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.record-view {
display: flex;
flex-direction: column;
......@@ -207,26 +286,34 @@ export default {
}
}
.body-view {
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
border-radius: 24rpx 24rpx 0 0;
background-color: #ffffff;
height: 100%;
overflow: auto;
padding: 24rpx 30rpx 44rpx 30rpx;
.scroll-view {
height: 100%;
}
.date-view {
.date-content {
min-height: 648rpx;
min-height: 650rpx;
}
}
.content-title {
font-size: 32rpx;
color: #191c27;
font-weight: bold;
padding: 24rpx 30rpx 0rpx 30rpx;
}
.charts-view {
.range-view {
display: flex;
margin-top: 40rpx;
margin-bottom: 40rpx;
margin: 40rpx 30rpx 40rpx 30rpx;
.range-title {
font-size: 28rpx;
color: #9ea5bb;
......@@ -248,7 +335,7 @@ export default {
}
}
.days-select-view {
margin-left: 154rpx;
margin-left: 168rpx;
display: flex;
align-items: center;
color: #9ea5bb;
......@@ -275,7 +362,10 @@ export default {
}
}
.list-view {
padding-bottom: 20rpx;
.list-content {
padding: 0 30rpx 20rpx 30rpx;
.show-more {
display: flex;
justify-content: center;
......
......@@ -50,176 +50,7 @@ export default {
},
onLoad() {
this.$u.api.getUserQuestionWareHouse().then((res) => {
res = [
{
id: '1415266126815821824',
createTime: '2021-07-14 19:05:14',
createdBy: '1415215255998431232',
updateTime: '2021-07-14 19:05:14',
updatedBy: '1415215255998431232',
echoMap: {
studentId: {
id: '1414459877807357952',
createTime: '2021-07-12 13:41:29',
createdBy: '3',
updateTime: '2021-07-20 20:41:13',
updatedBy: '1414459877807357952',
echoMap: {},
cardCount: null,
consumeAmount: null,
loginTime: null,
unionid: '',
nickname: '',
name: '',
phoneNumber: '11111111111',
avatarPath: '',
identityNumber: '',
identityFrontPath: '',
identityBackPath: '',
certificatePhotoPath: '',
certificateValidityDate: null,
workUnit: '',
address: '',
},
questionWarehouseId: {
id: '1414854649273384960',
createTime: '2021-07-13 15:50:10',
createdBy: '1413688964405002240',
updateTime: '2021-07-22 19:21:00',
updatedBy: '1413688964405002240',
echoMap: {},
institutionId: '1',
subjectId: '1418169087225233408',
title: '测试题库',
subtitle: '大狼狗',
description: 'sad',
effectiveTime: '0',
provinceId: '470715',
cityId: '475286',
type: '1',
price: '100.00',
realPrice: '60.00',
state: true,
remark: '',
version: '0',
},
cardId: {
id: '1416278788987158528',
createTime: '2021-07-17 14:09:11',
createdBy: '1410776147574128640',
updateTime: '2021-07-17 14:09:11',
updatedBy: '1410776147574128640',
echoMap: {},
unitPrice: null,
buyTime: null,
subjectNames: null,
instrtutionId: '1',
studentId: null,
questionWarehouseId: '1',
cardType: '02',
cardNumber: '621001200010719',
cardSecret: '9923sibv',
cardStatus: 5,
isEnable: 1,
effectiveDay: 30,
bindingTime: null,
activationTime: null,
sourceType: {
code: 'INSTRTUTION_SEND',
desc: '机构发卡',
},
sourceOrderId: '1416278788521590784',
},
},
questionWarehouseId: '1414854649273384960',
studentId: '1414459877807357952',
cardId: '1416278788987158528',
},
{
id: '1415602594134360064',
createTime: '2021-07-15 17:41:51',
createdBy: '1415215255998431232',
updateTime: '2021-07-15 17:41:51',
updatedBy: null,
echoMap: {
studentId: {
id: '1414459877807357952',
createTime: '2021-07-12 13:41:29',
createdBy: '3',
updateTime: '2021-07-20 20:41:13',
updatedBy: '1414459877807357952',
echoMap: {},
cardCount: null,
consumeAmount: null,
loginTime: null,
unionid: '',
nickname: '',
name: '',
phoneNumber: '11111111111',
avatarPath: '',
identityNumber: '',
identityFrontPath: '',
identityBackPath: '',
certificatePhotoPath: '',
certificateValidityDate: null,
workUnit: '',
address: '',
},
questionWarehouseId: {
id: '1',
createTime: '2021-07-12 16:33:20',
createdBy: null,
updateTime: '2021-07-21 14:40:44',
updatedBy: '1413688964405002240',
echoMap: {},
institutionId: '1',
subjectId: '1413687160678121472',
title: '测试1',
subtitle: '侧首',
description: '哈哈哈哈',
effectiveTime: '1',
provinceId: '470715',
cityId: '475286',
type: '1',
price: '100.00',
realPrice: '50.00',
state: true,
remark: '123231',
version: null,
},
cardId: {
id: '1416278788987158528',
createTime: '2021-07-17 14:09:11',
createdBy: '1410776147574128640',
updateTime: '2021-07-17 14:09:11',
updatedBy: '1410776147574128640',
echoMap: {},
unitPrice: null,
buyTime: null,
subjectNames: null,
instrtutionId: '1',
studentId: null,
questionWarehouseId: '1',
cardType: '02',
cardNumber: '621001200010719',
cardSecret: '9923sibv',
cardStatus: 15,
isEnable: 1,
effectiveDay: 30,
bindingTime: null,
activationTime: null,
sourceType: {
code: 'INSTRTUTION_SEND',
desc: '机构发卡',
},
sourceOrderId: '1416278788521590784',
},
},
questionWarehouseId: '1',
studentId: '1414459877807357952',
cardId: '1416278788987158528',
},
]
console.log('tiku list', res)
let length = res.length
if (res.length <= 0) {
this.lists = []
......@@ -237,7 +68,6 @@ export default {
//绑卡或支付时间
data[i].title = res[i].echoMap.questionWarehouseId.title
data[i].subtitle = res[i].echoMap.questionWarehouseId.subtitle
data[i].time =
res[i].echoMap.cardId.bindingTime ||
res[i].echoMap.cardId.buyTime ||
......@@ -247,18 +77,28 @@ export default {
case 0:
status = '未绑定'
data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '请前往绑定'
break
case 5:
status = '已绑定'
data[i].statusStyle = { color: '#2953FF' }
data[i].subtitle = '请前往首页答题联系吧'
break
case 10:
status = '已激活'
data[i].statusStyle = { color: '#2953FF' }
let leaveDay = 0
if (res[i].echoMap.cardId && res[i].echoMap.cardId.activationTime) {
let diff = this.datedifference(sDate1, sDate2)
leaveDay = res[i].echoMap.cardId.effectiveDay - diff
leaveDay = leaveDay > 0 ? leaveDay : 0
}
data[i].subtitle = '题库将于' + leaveDay + '天后到期'
break
case 15:
status = '已失效'
data[i].statusStyle = { color: '#9EA5BB' }
data[i].subtitle = '题库已失效'
break
default:
break
......@@ -266,9 +106,21 @@ export default {
data[i].status = status
}
this.lists = data
console.log(data)
console.log('tiku data', data)
})
},
methods: {
datedifference(sDate1, sDate2) {
//2021-01-01,2020-02-01,31
var dateSpan, tempDate, iDays
sDate1 = Date.parse(sDate1)
sDate2 = Date.parse(sDate2)
dateSpan = sDate2 - sDate1
dateSpan = Math.abs(dateSpan)
iDays = Math.floor(dateSpan / (24 * 3600 * 1000))
return iDays
},
},
}
</script>
......
......@@ -150,15 +150,16 @@ export default {
upload.getPhoto(1, this.token).then((res) => {
this.student.identityFrontPath = res.key
this.$u.api
.checkIdCardFront({ id_card_front: res.key })
.then(() => {})
.getCertifyInfoByType('front', {
url: process.uniEnv.qn_asset_url + res.key,
})
.then((res) => {
console.log('识别结果', res)
this.student.name = res.name
this.student.identityNumber = res.number
})
.catch((data) => {
if (data.errMsg == 'request:ok') {
this.student.name = data.data.id_card_name
this.student.identityNumber = data.data.id_card_number
} else {
this.$u.toast('识别身份证信息错误')
}
this.$u.toast('识别身份证信息错误')
})
})
},
......@@ -167,14 +168,15 @@ export default {
upload.getPhoto(1, this.token).then((res) => {
this.student.identityBackPath = res.key
this.$u.api
.checkIdCardBack({ id_card_back: res.key })
.then(() => {})
.getCertifyInfoByType('back', {
url: process.uniEnv.qn_asset_url + res.key,
})
.then((res) => {
console.log('识别结果', res)
this.student.certificateValidityDate = res.expire
})
.catch((data) => {
if (data.errMsg == 'request:ok') {
this.student.certificateValidityDate = data.data.id_card_expire
} else {
this.$u.toast('识别身份证信息错误')
}
this.$u.toast('识别身份证信息错误')
})
})
},
......
......@@ -47,10 +47,6 @@ export default {
},
methods: {
submit() {
if (this.student.workUnit == '') {
this.$u.toast('请输入工作单位名称')
return
}
this.$u.api
.updateUserInfo({
workUnit: this.student.workUnit,
......
......@@ -32,7 +32,7 @@
>
<view slot="right-icon">
<u-image
v-if="isupLoadCertPhoto"
v-if="headCertPhoto"
width="92rpx"
height="120rpx"
:src="headCertPhoto"
......@@ -82,7 +82,9 @@ import login from '@/common/login'
export default {
data() {
return {
student: {},
student: {
isCertify: false,
},
token: null,
code: '',
}
......@@ -94,13 +96,11 @@ export default {
)
},
headCertPhoto() {
return (
(this.student && this.student.certificatePhotoPath) ||
process.uniEnv.qn_base_url + 'xitongtouxiang.png'
console.log(
'touxiang bianle',
this.student ? this.student.certificatePhotoPath : 'kong'
)
},
isupLoadCertPhoto() {
return (this.student && this.student.identityNumber) || false
return (this.student && this.student.certificatePhotoPath) || false
},
getMobile() {
return (
......@@ -115,20 +115,24 @@ export default {
return (this.student && this.student.workUnit) || '去填写'
},
getCertifyStatus() {
return this.student && this.student.isCertify ? '已认证' : '去认证'
console.log('is cert', this.student.isCertify)
return this.student.isCertify ? '已认证' : '去认证'
},
},
onLoad() {
this.$u.api
.getQiNiuToken({ bucketName: 'banshou-userprofile' })
.then((res) => {
this.token = data.data.token //token为七牛云的token一般由后台接口提供
getApp().globalData.qiNiuToken = data.data.token
console.log('chushihua token', res)
this.token = res //token为七牛云的token一般由后台接口提供
getApp().globalData.qiNiuToken = res
})
this.$u.api.getUserInfo().then((res) => {
if (res && res.identityNumber) {
this.student.isCertify = true
}
console.log('huoqu userinfo', res)
res.isCertify =
res && res.identityNumber && res.identityNumber.length > 5
? true
: false
this.student = res
})
},
......
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 to comment