Commit 3f743565 authored by Facius's avatar Facius

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

parents d79bb612 1de0a98e
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',
......
......@@ -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
}
......
......@@ -44,7 +44,7 @@ const install = (Vue, vm) => {
if (data.code === 0) {
return data.data
} else if (data.code === 401) {
vm.$u.toast(data.msg)
vm.$u.toast('登录过期,请重新登录!')
// 如果不是在登录页,则跳转到登录页
if (route !== 'pages/login/index') {
setTimeout(() => {
......@@ -59,7 +59,7 @@ const install = (Vue, vm) => {
}
} else if (res.statusCode === 401) {
// 登录过期
vm.$u.toast(data.msg)
vm.$u.toast('登录过期,请重新登录!')
if (route !== 'pages/login/index') {
setTimeout(() => {
vm.$u.route('/pages/login/index')
......
......@@ -142,6 +142,10 @@ export default {
let info = {}
info.source = e.detail.source
this.$nextTick(() => {
this.swiperCurrent = current
})
// 正向滑动,到下一个的时候
// 是正向衔接
let isLoopPositive = current == START && lastIndex == END
......@@ -178,9 +182,10 @@ export default {
if (currentItem == null) return
info.current = currentItem.index
this.$emit("change", info)
// 记录滑过来的位置,此值对于下一次滑动的计算很重要
this.swiperIndex = current
this.$emit("change", info)
if (this.model === 2) {
this.changeModel()
}
......
......@@ -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: {
......
......@@ -7,6 +7,7 @@
titleColor="#000000"
:border-bottom="false"
title-bold
:is-back="false"
></u-navbar>
<view class="study">
<u-tabs-swiper
......@@ -28,94 +29,80 @@
@transition="transition"
@animationfinish="animationfinish"
>
<swiper-item @touchmove.stop.prevent="stopTouchMove">
<view class="tips-top">
<view class="all-text">
正式考试后
<text class="num">
30
</text>
个工作日后,可查询相关证书/成绩
</text>
</view>
</view>
<scroll-view scroll-y style="width: 702rpx;padding: 0 24rpx;">
<view class=" form">
<view class="item">
<text class="title">选择查询证书类型</text>
<u-input
v-model="checkType"
:type="type"
:border="border"
@click="show = true"
value="特种作业操作证查询"
placeholder="请选择"
/>
</view>
<view class="item">
<text class="title">身份证号</text>
<u-input
class="input"
v-model="certId"
placeholder="请输入身份证号"
:clearable="false"
/>
<swiper-item>
<view style="width: 100%;height: 100%;overflow: auto;">
<view class="tips-top">
<view class="all-text">
正式考试后
<text class="num">
30
</text>
个工作日后,可查询相关证书/成绩
</text>
</view>
<view class="item">
<text class="title">姓名</text>
<u-input
class="input"
v-model="certName"
placeholder="请输入姓名"
:clearable="false"
/>
</view>
<view class="tips-bottom">请确认与所在考试省份一致</view>
</view>
<button class="sub-button" @tap="submit">查询</button>
</scroll-view>
</swiper-item>
<swiper-item @touchmove.stop.prevent="stopTouchMove">
<scroll-view
scroll-y
style="width: 702rpx;padding: 0 24rpx;"
@scrolltolower="onreachBottom"
scroll-y="true"
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
@refresherpulling="onPulling"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@refresherabort="onAbort"
>
<view v-if="hasData" class="list-view">
<view class="item" v-for="(item, key) in countryCertList" :key="key" @tap="goDetail(item)">
<u-image :src="item.bgImage" width="100%" height="100%" class="bg-image"></u-image>
<view class="name">
{{ item.certificateName }}
<view style="padding: 0 12px;height: 100%;overflow: auto;">
<view class=" form">
<view class="item">
<text class="title">选择查询证书类型</text>
<u-input
v-model="checkType"
:type="type"
:border="border"
placeholder="请选择"
/>
</view>
</view>
<view class="item" v-for="(item, key) in learnCertList" :key="key" @tap="goDetail(item)">
<u-image :src="item.bgImage" width="100%" height="100%" class="bg-image"></u-image>
<view class="learn-name">
{{ item.certificateName }}
<view class="item">
<text class="title">身份证号</text>
<u-input
class="input"
v-model="certId"
placeholder="请输入身份证号"
:clearable="false"
/>
</view>
<view class="item">
<text class="title">姓名</text>
<u-input
class="input"
v-model="certName"
placeholder="请输入姓名"
:clearable="false"
/>
</view>
<view class="tips-bottom">请确认与所在考试省份一致</view>
</view>
<button class="sub-button" @tap="submit">查询</button>
</view>
<view v-else class="list-view empty-value">
<u-image
width="374rpx"
height="322rpx"
:src="nothing"
style="margin-top: 100rpx;"
></u-image>
<text style="margin-top: 20rpx;font-size: 28rpx;color: #9EA5BB;"
>当前暂无证书内容</text
>
</view>
</swiper-item>
<swiper-item>
<view v-if="hasData" class="list-view" style="width: 100%;height: 100%;overflow: auto;padding: 0 12px;padding-bottom: 100rpx;">
<view class="item" v-for="(item, key) in countryCertList" :key="key" @tap="goDetail([item])">
<u-image :src="item.bgImage" width="100%" height="100%" class="bg-image"></u-image>
<view class="name">
{{ item.certificateName }}
</view>
</view>
</scroll-view>
<view class="item" v-for="(item, key) in learnCertList" :key="key" @tap="goDetail([item])">
<u-image :src="item.bgImage" width="100%" height="100%" class="bg-image"></u-image>
<view class="learn-name">
{{ item.certificateName }}
</view>
</view>
</view>
<view v-else class="list-view empty-value">
<u-image
width="374rpx"
height="322rpx"
:src="nothing"
style="margin-top: 100rpx;"
></u-image>
<text style="margin-top: 20rpx;font-size: 28rpx;color: #9EA5BB;"
>当前暂无证书内容</text
>
</view>
</swiper-item>
</swiper>
</view>
......@@ -184,6 +171,15 @@ export default {
}
},
onLoad() {
if (!this.vuex_token) {
this.$u.toast('请先登录')
let that = this
setTimeout(function(){
that.$u.route({
url: 'pages/login/index',
})
}, 1000)
}
this.checkType = '特种作业操作证查询'
},
onShow: function(param) {
......@@ -197,10 +193,6 @@ export default {
},
methods: {
submit(){
if(!this.checkType){
this.$u.toast('请选择查询类型')
return
}
console.log('cert', this.certId)
if(!this.certId){
this.$u.toast('请填写证件号码!')
......@@ -221,16 +213,19 @@ export default {
this.$u.toast('证书暂未公布')
return
}
let item = {}
item.certificateName = res[0].certificateName.replace('作业', '证')
item.bgImage = this.countryCertImage
item.type = 'country'
item.key = 0
item.data = res[0]
this.goDetail(item)
let data = []
for(let index in res){
let item = {}
item.certificateName = res[index].certificateName.replace('作业', '证')
item.bgImage = this.countryCertImage
item.type = 'country'
item.key = index
item.data = res[index]
data.push(item)
}
this.goDetail(data)
}).catch((err) => {
console.log(err)
this.$u.toast('证书暂未公布')
return
})
},
......@@ -263,128 +258,6 @@ export default {
//获取学时数据
getLearnCert(){
this.$u.api.getlearnCertList().then((res)=>{
// res = [
// {
// "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,
// "code": "XY20210723000001",
// "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
// }
// },
// "number": null,
// "questionWarehouseId": "1",
// "institutionId": "-1",
// "studentId": "1414459877807357952",
// "cardId": "1416278788987158528"
// },
// {
// "id": "1418473748293484544",
// "createTime": "2021-07-23 15:31:10",
// "createdBy": "1414459877807357952",
// "updateTime": "2021-07-24 14:45:15",
// "updatedBy": "1414459877807357952",
// "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,
// "code": "XY20210723000001",
// "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-23 14:41:30",
// "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"
// }
// },
// "number": null,
// "questionWarehouseId": "1414854649273384960",
// "institutionId": "-1",
// "studentId": "1414459877807357952",
// "cardId": "0"
// }
// ]
console.log('学时证', res);
if(!res || res.length == 0){
//空显示缺醒
......@@ -410,22 +283,10 @@ export default {
},
goDetail(param){
console.log('goto param', param)
if(param.type == 'learn'){
if(param[0].type == 'learn'){
param = param[0]
console.log('点击学时证,请求详情,组装参数再传过去')
this.$u.api.getlearnCertDetail(param.id).then((res)=>{
// let res = {
// photo: "https://thirdwx.qlogo.cn/mmopen/vi_32/c20Wk8HTurnNnKJMmnAnib9CUtqicwKKIMCvzViaBn0icNnpmeOQbSiaRklWCcfUOlW7oqj2o7u65d6F3ZwmZtLVZaw/132",//头像,
// name: "阿三哥",//名字,
// idCard: "111141222",//身份证,
// company: "维修班",//工作单位,
// subjectName: "测试1",//资格类型,
// institutionName: '阿斯顿学院',//培训机构名称,
// startDate: "2011-01-01",//培训开始时间,
// endDate: "2021-07-24",//培训结束时间,
// maxPoint: 20,//最高分,
// time: 0,//学时,
// questionWarehouse: null,
// }
param.data = res
getApp().globalData.certItemData = param
this.$u.route({
......@@ -499,6 +360,7 @@ export default {
let current = e.detail.current
this.$refs.uTabs.setFinishCurrent(current)
this.swiperCurrent = current
this.tabsChange(current)
this.current = current
},
},
......@@ -527,9 +389,8 @@ page {
width: 100%;
}
.study {
height: 100vh;
height: 100%;
background: none;
/* padding: 0rpx 24rpx; */
}
.form {
display: flex;
......@@ -611,12 +472,15 @@ page {
width: 100%;
height: 100%;
text-align: center;
line-height: 444rpx;
position: absolute;
top: 0;
font-size: 60rpx;
font-weight: bold;
color: white;
display: flex;
flex-direction: column;
vertical-align: middle;
padding: 160rpx 50rpx 0 50rpx;
}
.learn-name {
width: 100%;
......
......@@ -6,7 +6,7 @@
titleColor="#191C27"
:border-bottom="false"
:custom-back="customBack"
title="答题"
:title="title"
title-bold
></u-navbar>
<view class="u-flex contents" v-if="total > 0">
......@@ -152,6 +152,7 @@ export default {
},
data() {
return {
title: '答题',
show: false,
// 1 练习 or 每日一练 2 考试 3 收藏记录 4 错题记录
type: 1,
......@@ -179,7 +180,7 @@ export default {
current: 0,
// 仅仅记录swiper的位置
currentIndex: 0,
swiperDuration: '1000',
swiperDuration: '800',
// 分页数据
currentPage: 1,
pageSize: 100,
......@@ -262,13 +263,17 @@ export default {
this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, 0)
this.$u.vuex(`questionList.${this.questionWarehouseId}`, [])
}
} else if (this.source === 4) {
this.title = '收藏的题'
} else if (this.source === 5) {
this.title = '错题记录'
}
this.init()
},
methods: {
// 初始化数据
init() {
init(i) {
const params = {
questionWarehouseId: this.questionWarehouseId,
recordId: this.recordId,
......@@ -297,7 +302,7 @@ export default {
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
this.refresh(i ? i : index)
}
})
},
......@@ -465,7 +470,9 @@ export default {
}
return
}
this.current = this.currentIndex + 1
this.$nextTick(() => {
this.current = this.currentIndex + 1
})
}
},
// 保存答案
......@@ -575,7 +582,7 @@ export default {
remove() {
const info = this.list.find(v => v.index === this.currentIndex)
this.$u.api.removeError({questionId: info.id}).then(res => {
if(res) this.current = this.currentIndex + 1
if(res) this.init(this.currentIndex)
})
},
// 以下方法用于初始化数据
......
......@@ -92,9 +92,11 @@ export default {
id: res.id,
kemu: res.echoMap?.questionWarehouseId?.title,
tishu: `${res.totalPoint}题`,
totalPoint: res.totalPoint,
biaozhun: `${res.passPoint}分`,
passPoint: res.passPoint,
duration: `${res.duration}分钟`,
durationNumber: res.duration,
guize: '根据国家规定比例随机抽取'
}
})
......@@ -117,7 +119,7 @@ export default {
source: 3,
passPoint: this.info.passPoint,
totalPoint: this.info.totalPoint,
duration: this.info.duration
duration: this.info.durationNumber
}
})
}
......
......@@ -209,7 +209,6 @@ export default {
}, 2500)
},
customBack() {
console.log("111", 111)
this.$u.route({
type: 'tab',
url: 'pages/index/index'
......
......@@ -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('识别身份证信息错误')
})
})
},
......
......@@ -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
})
},
......
......@@ -16,7 +16,6 @@
bg-color="#fff"
v-model="keyword"
@custom="search"
@search="search"
></u-search>
</view>
......@@ -32,7 +31,7 @@
>
</view>
<view class="u-flex clear" @click="removeHistory">
<view class="u-flex clear" @click="removeHistory" v-if="history.length > 0">
<image :src="deleteImg"></image>
<view>清空搜索历史记录</view>
</view>
......@@ -113,6 +112,9 @@ export default {
.history {
margin-top: 20rpx;
flex-wrap: wrap;
max-height: 190rpx;
overflow: hidden;
align-items: flex-start;
.history-list {
padding: 20rpx 25rpx;
background: #fff;
......
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