Commit d00c5517 authored by linwenqing's avatar linwenqing

refactor:证书查询

parent dc626dba
...@@ -27,6 +27,9 @@ let userApiFun = function(vm) { ...@@ -27,6 +27,9 @@ let userApiFun = function(vm) {
params params
) )
let getCertFromOut = async (params = {}) =>
await vm.$u.get(apiUrl + '/rest/certificate/national', params)
const userApi = { const userApi = {
updateUserInfo, updateUserInfo,
getUserInfo, getUserInfo,
...@@ -35,6 +38,7 @@ let userApiFun = function(vm) { ...@@ -35,6 +38,7 @@ let userApiFun = function(vm) {
getCountryCertList, getCountryCertList,
getlearnCertList, getlearnCertList,
getlearnCertDetail, getlearnCertDetail,
getCertFromOut,
} }
return userApi return userApi
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"style": { "style": {
"navigationBarTitleText": "证书", "navigationBarTitleText": "证书",
"navigationStyle": "custom", "navigationStyle": "custom",
"disableScroll": true "disableScroll": false
} }
}, },
{ {
...@@ -239,6 +239,21 @@ ...@@ -239,6 +239,21 @@
} }
] ]
}, },
{
"root": "pages/cert",
"pages": [
{
"path": "detailLearn",
"name": "certDetailLearn",
"style": {
"navigationBarTitleText": "证书详情-学时证",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": false
}
}
]
},
{ {
"root": "pages/mine", "root": "pages/mine",
"pages": [ "pages": [
......
This diff is collapsed.
<template>
<view class="begin-answer">
<u-navbar
back-icon-color="#ffffff"
background="transparent"
title="证书详情"
titleColor="#ffffff"
:border-bottom="false"
title-bold
></u-navbar>
<view class="content">
<view class="cert-body">
<view class="top"></view>
<view class="top-baody">
<view class="table-list">
<view class="head-photo">
<u-image :src="headPhoto" width="144" height="144" shape="circle"></u-image>
</view>
<view v-if="type == 'learn'" class="item" style="margin-top: 30rpx;">
<view class="table">
<u-table border-color="#9EA5BB">
<u-tr class="u-tr">
<u-td class="u-td bg-td">姓名</u-td>
<u-td class="u-td">{{name}}</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td bg-td">身份证号</u-td></u-td>
<u-td class="u-td">{{idCard}}</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td bg-td">工作单位</u-td>
<u-td class="u-td">{{company}}</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td bg-td">资格类型</u-td>
<u-td class="u-td">{{subjectName}}</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td bg-td">培训机构</u-td>
<u-td class="u-td">{{institutionName}}</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td bg-td">培训日期</u-td>
<u-td class="u-td">{{learnDate}}</u-td>
</u-tr>
</u-table>
</view>
<view class="table" style="margin-top: 30rpx;">
<u-table class="table" border-color="#9EA5BB">
<u-tr class="u-tr">
<u-td class="u-td bg-td">培训方式</u-td>
<u-td class="u-td bg-td">最高分</u-td></u-td>
<u-td class="u-td bg-td">实修学时</u-td>
<u-td class="u-td bg-td">测试成绩</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">在线培训</u-td>
<u-td class="u-td">{{maxpoint}}</u-td>
<u-td class="u-td">{{learnTime}}</u-td>
<u-td class="u-td">{{resultForTest}}</u-td>
</u-tr>
</u-table>
</view>
</view>
<view class="cert-foot">
<text class="cert-top" style="line-height: 60rpx;">{{institutionName}}</text>
<text class="cert-bottom">{{startDate}}</text>
</view>
</view>
</view>
<view class="foot">
<text>证书机构:中华人民共和国应急管理部</text>
<text style="padding-top: 28rpx;">更新时间:{{ nowDate }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
learnData: {},
type: null,
certName: '',
topImage: process.uniEnv.qn_base_url + 'xueshitoubu@2x.png',
}
},
onShow: function() {
this.formatDataByType()
},
computed: {
nowDate(){
var Today=new Date();
let m = (Today.getMonth()+1)
let d = Today.getDate()
return (Today.getFullYear() + '.' + (m.length > 1 ? m : '0' + m) + '.' + (d.length > 1 ? d : '0' + d))
},
headPhoto(){
return this.learnData.photo || process.uniEnv.qn_base_url + 'xueshitoubu@2x.png'
},
startDate() {
return this.learnData.startDate || ' '
},
learnDate() {
return this.learnData.startDate + '~' + this.learnData.endDate
},
name() {
return this.learnData.name || ' '
},
idCard() {
return this.learnData.idCard || ' '
},
company() {
return this.learnData.company || ' '
},
subjectName() {
return this.learnData.subjectName || ' '
},
institutionName() {
return this.learnData.institutionName || ' '
},
maxpoint() {
return this.learnData.maxPoint || 0
},
learnTime() {
return this.learnData.time || 0
},
resultForTest() {
return (this.learnData.maxPoint > 80 && '合格') || '不合格'
},
},
methods: {
formatDataByType() {
console.log('shoudao param', getApp().globalData.certItemData.data)
if (!getApp().globalData.certItemData) {
return
}
this.certName = getApp().globalData.certItemData.certificateName
this.type = 'learn'
this.learnData = getApp().globalData.certItemData.data
},
},
}
</script>
<style scoped lang="scss">
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.begin-answer {
display: flex;
flex-direction: column;
background-color: #2953ff;
background-size: 100% 920rpx;
background-repeat: no-repeat;
height: 120vh;
position: absolute;
top: 0;
width: 100%;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 30rpx 24rpx 0rpx 24rpx;
}
.cert-body {
width: 702rpx;
background-color: #ffffff;
text-align: center;
border-radius: 12rpx;
position: relative;
height: 1254rpx;
.top {
width: 100%;
height: 240rpx;
position: absolute;
left: 0;
top: 0;
background-image: url('https://qn-static.banshouhui.com/study/xueshitoubu@2x.png');
background-repeat: no-repeat;
background-size: 100%;
background-position: center;
}
.top-baody {
height: 1090rpx;
width: 100%;
position: absolute;
background-repeat: no-repeat;
background-size: 95%;
background-position: center;
background-image: url('https://qn-static.banshouhui.com/study/biantiao@2x.png');
.head-photo{
height: 145rpx;
padding-left: 260rpx;
}
.table-list {
padding: 160rpx 40rpx 0 40rpx;
.name {
font-size: 24rpx;
text-align: left;
padding: 30rpx 0;
}
.table {
/* background-color: #2953ff; */
/* min-height: 200rpx; */
}
::v-deep .u-td{
height: 70rpx;
}
.bg-td{
background-color: #E8EBF3;
font-weight: bold;
}
}
.cert-foot {
height: 100rpx;
width: 100%;
text-align: right;
padding-left: 24rpx;
display: flex;
flex-direction: column;
font-size: 24rpx;
color: #5a6073;
margin-top: 30rpx;
}
.u-tr ::v-deep .u-td {
font-size: 22rpx !important;
}
}
.foot {
height: 100rpx;
width: 100%;
text-align: left;
padding-left: 24rpx;
display: flex;
flex-direction: column;
font-size: 28rpx;
color: #5a6073;
position: absolute;
font-weight: 500;
bottom: 40rpx;
left: 0;
}
}
</style>
This diff is collapsed.
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
return this.userInfo.nickName != undefined return this.userInfo.nickName != undefined
}, },
loginTips() { loginTips() {
return this.student.consumeAmount || 0 return (this.student && this.student.consumeAmount) || 0
}, },
avatar() { avatar() {
return (this.userInfo && this.userInfo.avatarUrl) || this.pic return (this.userInfo && this.userInfo.avatarUrl) || this.pic
......
...@@ -77,25 +77,27 @@ export default { ...@@ -77,25 +77,27 @@ export default {
}, },
computed: { computed: {
headPhoto() { headPhoto() {
return this.student.avatarPath || this.userInfo.avatarUrl return (
(this.student && this.student.avatarPath) || this.userInfo.avatarUrl
)
}, },
headCertPhoto() { headCertPhoto() {
return ( return (
this.student.certificatePhotoPath || (this.student && this.student.certificatePhotoPath) ||
process.uniEnv.qn_base_url + 'xitongtouxiang.png' process.uniEnv.qn_base_url + 'xitongtouxiang.png'
) )
}, },
isupLoadCertPhoto() { isupLoadCertPhoto() {
return this.student.identityNumber || false return (this.student && this.student.identityNumber) || false
}, },
getMobile() { getMobile() {
return this.student.phoneNumber || '' return (this.student && this.student.phoneNumber) || ''
}, },
getCompany() { getCompany() {
return this.student.workUnit || '' return (this.student && this.student.workUnit) || ''
}, },
getCertifyStatus() { getCertifyStatus() {
return !this.student.isCertify ? '去认证' : '已认证' return this.student && !this.student.isCertify ? '去认证' : '已认证'
}, },
}, },
onLoad() { onLoad() {
...@@ -108,7 +110,10 @@ export default { ...@@ -108,7 +110,10 @@ export default {
} }
}) })
this.$u.api.getUserInfo().then((res) => { this.$u.api.getUserInfo().then((res) => {
res.isCertify = res.identityNumber ? true : false if (res && res.identityNumber) {
res.isCertify = true
}
this.student = res this.student = res
}) })
}, },
......
<template> <template>
<view class="u-td" :style="[tdStyle]"> <view class="u-td" :style="[tdStyle]">
<slot></slot> <slot></slot>
</view> </view>
</template> </template>
<script> <script>
/** /**
* td td单元格 * td td单元格
* @description 表格组件一般用于展示大量结构化数据的场景(搭配u-table使用) * @description 表格组件一般用于展示大量结构化数据的场景(搭配u-table使用)
* @tutorial https://www.uviewui.com/components/table.html#td-props * @tutorial https://www.uviewui.com/components/table.html#td-props
* @property {String Number} width 单元格宽度百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比,单元格宽度默认为均分tr的长度(默认auto) * @property {String Number} width 单元格宽度百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比,单元格宽度默认为均分tr的长度(默认auto)
* @example <u-td>二年级</u-td> * @example <u-td>二年级</u-td>
*/ */
export default { export default {
name: "u-td", name: 'u-td',
props: { props: {
// 宽度,百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比 // 宽度,百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比
width: { width: {
type: [Number, String], type: [Number, String],
default: 'auto' default: 'auto',
} },
}, },
data() { data() {
return { return {
tdStyle: { tdStyle: {},
}
} },
} created() {
}, this.parent = false
created() { },
this.parent = false; mounted() {
}, this.parent = this.$u.$parent.call(this, 'u-table')
mounted() { if (this.parent) {
this.parent = this.$u.$parent.call(this, 'u-table'); // 将父组件的相关参数,合并到本组件
if (this.parent) { let style = {}
// 将父组件的相关参数,合并到本组件 if (this.width != 'auto') style.flex = `0 0 ${this.width}`
let style = {}; style.textAlign = this.parent.align
if (this.width != "auto") style.flex = `0 0 ${this.width}`; style.fontSize = this.parent.fontSize + 'rpx'
style.textAlign = this.parent.align; style.padding = this.parent.padding
style.fontSize = this.parent.fontSize + 'rpx'; style.borderBottom = `solid 1px ${this.parent.borderColor}`
style.padding = this.parent.padding; style.borderRight = `solid 1px ${this.parent.borderColor}`
style.borderBottom = `solid 1px ${this.parent.borderColor}`; style.color = this.parent.color
style.borderRight = `solid 1px ${this.parent.borderColor}`; this.tdStyle = style
style.color = this.parent.color; }
this.tdStyle = style; },
} }
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../../libs/css/style.components.scss"; @import '../../libs/css/style.components.scss';
.u-td { .u-td {
@include vue-flex; @include vue-flex;
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
justify-content: center; justify-content: center;
font-size: 28rpx; font-size: 28rpx;
color: $u-content-color; color: $u-content-color;
align-self: stretch; align-self: stretch;
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: 100%;
} }
</style> </style>
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