Commit a226fa84 authored by 林文清's avatar 林文清

add:我的证书

parent 65f7dadc
const globalUrl = process.uniEnv || {}
const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl
let certApiFun = function(vm){
let getCertList = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/settled/get-cert-list', params);
const certApi = {
getCertList
}
return certApi
}
module.exports = {
certApiFun
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import {
import {learnApiFun} from "@/common/api/learn.js";
import { orderApiFun } from "@/common/api/order.js";
import {assessmentApiFun} from"@/common/api/assessment.js"
import {certApiFun} from"@/common/api/cert.js"
let apiFun = function(vm) {
let commonApi = commonApiFun(vm);
let settledApi = settledApiFun(vm)
......@@ -17,13 +18,15 @@ let apiFun = function(vm) {
let learnApi=learnApiFun(vm)
let assessmentApi = assessmentApiFun(vm)
let orderApi=orderApiFun(vm)
let certApi=certApiFun(vm)
let apiUrl = {
...commonApi,
...settledApi,
...cloudApi,
...learnApi,
...orderApi,
...assessmentApi
...assessmentApi,
...certApi
}
return apiUrl
}
......
......@@ -166,6 +166,20 @@
"navigationStyle": "custom", // 隐藏系统导航栏
"navigationBarBackgroundColor":"#F4F5F7"
}
},
{
"path": "cert/list",
"style": {
"navigationBarTitleText": "我的证件",
"navigationStyle":"custom"
}
},
{
"path": "cert/detail",
"style": {
"navigationBarTitleText": "",//证件详情
"navigationStyle":"custom"
}
}
]
},
......@@ -469,6 +483,11 @@
"name": "学习 - 首页", //模式名称
"path": "pages/index/learn", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},
{
"name": "我的 - 我的证件 - 列表", //模式名称
"path": "pages/mine/cert/list", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
}
]
}
......
<template>
<view class="cert-page">
<u-navbar
back-icon-color="#000000"
:background="background"
title-color="#000"
:border-bottom="false"
title="我的证件"
title-bold="true"
></u-navbar>
<view class="content-cody">
<view class="title">{{ info.type }}</view>
<view class="content" v-for="item in info.url"><image :src="item" mode=""></image></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
info: {
type: "",
url: null
}
}
},
onLoad() {
var that = this;
const eventChannel = this.getOpenerEventChannel()
eventChannel.on('acceptDataFromCert', function(data) {
try{
let urlArr = data.url.split(',');
that.info.type = data.type;
that.info.url = urlArr;
console.log(urlArr);
}catch(e){}
console.log(that.info);
})
},
}
</script>
<style>
.cert-page {
font-size: 28rpx;
margin: 30rpx;
}
.content-cody {
padding-left: 30rpx;
padding-right: 30rpx;
background-color: #F4F5F7;
border-radius: 12rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.content {
padding-top: 30rpx;
}
</style>
<template>
<view class="cert-page">
<u-navbar
back-icon-color="#000000"
:background="background"
title-color="#000"
:border-bottom="false"
title="我的证件"
title-bold="true"
></u-navbar>
<view class="content-cody">
<u-cell-group>
<u-cell-item v-for="item in list" :title="item.name" :value="item.isUploadName" :arrow="true"
:value-style="{'color': item.color}" @click="toDetail(item.keyName)">
<u-icon slot="icon" size="32" name="checkmark-circle" :color="item.iconColor"></u-icon>
</u-cell-item>
</u-cell-group>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: {
id_card: {
name: "身份证",
isUpload: false,
isUploadName: "",
keyName: "id_card",
color: "#999999"
},
electrician_certificate: {
name: "电工证",
isUpload: false,
isUploadName: "",
keyName: "electrician_certificate",
color: "#999999"
},
driver_license: {
name: "驾驶证",
isUpload: false,
isUploadName: "",
keyName: "driver_license",
color: "#999999"
},
driving_license: {
name: "行驶证",
isUpload: false,
isUploadName: "",
keyName: "driving_license",
color: "#999999"
},
vehicle: {
name: "车辆照",
isUpload: false,
isUploadName: "",
keyName: "vehicle",
color: "#999999"
},
high_sky_license: {
name: "高空证",
isUpload: false,
isUploadName: "",
keyName: "high_sky_license",
color: "#999999"
},
refrigeration_license: {
name: "制冷证",
isUpload: false,
isUploadName: "",
keyName: "refrigeration_license",
color: "#999999"
},
business_license: {
name: "营业执照",
isUpload: false,
isUploadName: "",
keyName: "business_license",
color: "#999999"
},
}
}
},
onLoad() {
let that = this;
this.$u.api
.getCertList()
.then((res) => {
if(res.code != 200){
return
}
for(let key in this.list){
let getData = res.data[key];
this.list[key].isUpload = getData.status;
this.list[key].isUploadName = getData.status == 1 ? '已上传' : '未上传';
this.list[key].color = getData.status == 1 ? "#999999" : "#2272FF";
this.list[key].iconColor = getData.status == 1 ? "#2272FF" : "#999999";
this.list[key].data = getData;
}
console.log(this.list);
console.log(res);
}).catch((err) => {
console.log(err);
});
},
methods: {
isUpload(typeBool) {
return typeBool ? '已上传' : '未上传'
},
toDetail(key) {
let data = this.list[key].data;
if(data.status != 1){
return;
}
wx.navigateTo({
url: '/pages/mine/cert/detail',
success: function(res) {
res.eventChannel.emit('acceptDataFromCert', data)
}
});
}
}
}
</script>
<style>
.cert-page {
font-size: 28rpx;
margin: 30rpx;
}
.content-cody {
/* padding-left: 30rpx;
padding-right: 30rpx; */
padding-left: 30rpx;
padding-right: 30rpx;
background-color: #ffffff;
border-radius: 12rpx;
}
.rightBlue {
color: #007AFF;
}
</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