Commit c93219e7 authored by linwenqing's avatar linwenqing

Merge branch 'dev-v1.0.0' into test

parents 8bad8498 19fd5136
let commonApiFun = function(vm) { let commonApiFun = function(vm) {
const globalUrl = process.uniEnv || {} const globalUrl = process.uniEnv || {}
let uCenterApiUrl = globalUrl.uCenterUrl let apiUrl = globalUrl.apiUrl
let loginWechatAuth = async (params = {}) => let loginWechatAuth = async (params = {}) =>
await vm.$u.post('/wxapp/unify/authorization', params) await vm.$u.post('/wxapp/unify/authorization', params)
let payOrder = async (params = {}) => await vm.$u.post('/pay/order', params) let payOrder = async (params = {}) => await vm.$u.post('/pay/order', params)
let payQuery = async (params = {}) => await vm.$u.get('/pay/query', params) let payQuery = async (params = {}) => await vm.$u.get('/pay/query', params)
let getQiNiuToken = async (params = {}) => let getQiNiuToken = async (params = {}) =>
await vm.$u.post(uCenterApiUrl + 'v1/tokens', params) await vm.$u.get(apiUrl + '/rest/file/token/get', params)
const commonApi = { const commonApi = {
loginWechatAuth, loginWechatAuth,
payOrder, payOrder,
......
...@@ -21,8 +21,8 @@ let learnApiFun = function(vm) { ...@@ -21,8 +21,8 @@ let learnApiFun = function(vm) {
) )
// 查询省份列表 // 查询省份列表
let getProvinceList = async (params = {}) => let getProvinceList = async (subjectId) =>
await vm.$u.get('/rest/question/getProvinceList', params) await vm.$u.get('/rest/question/getProvinceList/' + subjectId)
// 学生查询题库首页 // 学生查询题库首页
let queryMyQuestionWarehouseDetail = async (questionWarehouseId) => let queryMyQuestionWarehouseDetail = async (questionWarehouseId) =>
......
...@@ -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
} }
......
...@@ -46,7 +46,7 @@ function getPhoto(type, token) { ...@@ -46,7 +46,7 @@ function getPhoto(type, token) {
} }
let sourceType = type == 1 ? ['album'] : ['album', 'camera'] let sourceType = type == 1 ? ['album'] : ['album', 'camera']
uni.chooseImage({ uni.chooseImage({
count: 6, //默认9 count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: sourceType, //从相册选择 sourceType: sourceType, //从相册选择
success: function(res) { success: function(res) {
...@@ -87,7 +87,7 @@ function upload(filePath, token) { ...@@ -87,7 +87,7 @@ function upload(filePath, token) {
}, },
complete: (res) => { complete: (res) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
resolve(JSON.parse(res.data).key) resolve(JSON.parse(res.data).key || JSON.parse(res.data).src)
} else { } else {
reject(res.errMsg) reject(res.errMsg)
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
v-model="visible" v-model="visible"
safe-area-inset-bottom safe-area-inset-bottom
mode="center" mode="center"
width="654rpx" width="622rpx"
:mask-close-able="false" :mask-close-able="false"
> >
<view class="pop-view"> <view class="pop-view">
......
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
this.defaultUrl + (a3 > 9 ? 'a' : 'a0') + String(a3) + '.jpeg', this.defaultUrl + (a3 > 9 ? 'a' : 'a0') + String(a3) + '.jpeg',
] ]
this.list = [this.noticeText] // this.list = [this.noticeText]
setInterval(() => { setInterval(() => {
this.produceTime += this.duration this.produceTime += this.duration
}, this.duration) }, this.duration)
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
} }
this.avatars = [...array, this.defaultUrl + str] this.avatars = [...array, this.defaultUrl + str]
this.list = [this.noticeText] // this.list = [this.noticeText]
}, },
}, },
} }
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
:current="swiperCurrent" :current="swiperCurrent"
@change="swiperChange" @change="swiperChange"
circular circular
> >
<swiper-item v-for="(item, index) in swiperList" :key="index"> <swiper-item v-for="(item, index) in swiperList" :key="index" class="swiper-items">
<view class="u-flex subject"> <view class="u-flex subject">
<view class="title" v-if="item.title"><text>{{ titleType[item.type - 1] }}</text>{{ item.title }}</view> <view class="title" v-if="item.title"><text class="title-type">{{ titleType[item.type - 1] }}</text>{{ item.title }}</view>
<view class="content"> <view class="content">
<answer-sheet <answer-sheet
ref="answerSheet" ref="answerSheet"
...@@ -69,8 +69,8 @@ export default { ...@@ -69,8 +69,8 @@ export default {
}, },
// 值为0禁止切换动画 // 值为0禁止切换动画
swiperDuration: { swiperDuration: {
type: String, type: Number,
default: "250" default: 1000
}, },
// 分页需要传此数据 // 分页需要传此数据
total: { total: {
...@@ -262,7 +262,7 @@ export default { ...@@ -262,7 +262,7 @@ export default {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
swiper-item { .swiper-items {
overflow: auto; overflow: auto;
} }
.subject { .subject {
...@@ -280,7 +280,7 @@ export default { ...@@ -280,7 +280,7 @@ export default {
font-weight: bold; font-weight: bold;
width: 100%; width: 100%;
text-align: left; text-align: left;
text { .title-type {
background: #9EA5BB; background: #9EA5BB;
color: #fff; color: #fff;
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
......
...@@ -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": [
......
...@@ -14,88 +14,22 @@ ...@@ -14,88 +14,22 @@
<u-image :src="topImage" height="116rpx" width="100%"></u-image> <u-image :src="topImage" height="116rpx" width="100%"></u-image>
</view> </view>
<view class="table-list"> <view class="table-list">
<view class="item"> <view v-if="type == 'country'" class="item">
<view class="name">低压电工证</view> <view class="name">{{ certName }}</view>
<view class="table"> <view class="table">
<u-table> <u-table border-color="#9EA5BB">
<u-tr class="u-tr"> <u-tr
<u-th class="u-th">姓名</u-th> v-for="(item, i) in data.certificateTextContent"
<u-th class="u-th">年龄</u-th> :key="i"
<u-th class="u-th">籍贯</u-th> class="u-tr"
<u-th class="u-th">性别</u-th> >
</u-tr> <u-td
<u-tr class="u-tr"> v-for="(val, name, index) in item"
<u-td class="u-td">吕布</u-td> :key="index"
<u-td class="u-td">22</u-td> class="u-td bg-td"
<u-td class="u-td">楚河</u-td> >
<u-td class="u-td">男</u-td> {{ val }}
</u-tr> </u-td>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
</u-table>
</view>
</view>
<view class="item">
<view class="name">低压电工证</view>
<view class="table">
<u-table>
<u-tr class="u-tr">
<u-th class="u-th">姓名</u-th>
<u-th class="u-th">年龄</u-th>
<u-th class="u-th">籍贯</u-th>
<u-th class="u-th">性别</u-th>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr>
<u-tr class="u-tr">
<u-td class="u-td">吕布</u-td>
<u-td class="u-td">22</u-td>
<u-td class="u-td">楚河</u-td>
<u-td class="u-td">男</u-td>
</u-tr> </u-tr>
</u-table> </u-table>
</view> </view>
...@@ -103,7 +37,7 @@ ...@@ -103,7 +37,7 @@
</view> </view>
<view class="foot"> <view class="foot">
<text>证书机构:中华人民共和国应急管理部</text> <text>证书机构:中华人民共和国应急管理部</text>
<text style="padding-top: 28rpx;">更新时间:2021.07.21</text> <text style="padding-top: 28rpx;">更新时间:{{ nowDate }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -114,13 +48,103 @@ ...@@ -114,13 +48,103 @@
export default { export default {
data() { data() {
return { return {
data: null, data: {
certificateTextContent: [],
},
learnData: {},
type: null,
certName: '',
topImage: process.uniEnv.qn_base_url + 'tezhongzuoyepingtai@2x.png', topImage: process.uniEnv.qn_base_url + 'tezhongzuoyepingtai@2x.png',
} }
}, },
onShow: function() { onShow: function() {
this.data = getApp().globalData.certItemData this.formatDataByType()
console.log('shoudao param', this.data) },
computed: {
nowDate() {
var Today = new Date()
let m = Today.getMonth() + 1
let d = Today.getDate()
return (
Today.getFullYear() +
'.' +
(String(m).length > 1 ? m : '0' + m) +
'.' +
(String(d).length > 1 ? d : '0' + d)
)
},
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)
if (!getApp().globalData.certItemData) {
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) {
list = JSON.parse(
JSON.parse(JSON.stringify(certData.data.certificateContent))
)
console.log('list is', list)
} else {
list = certData.data.certificateTextContent
}
for (let key in list) {
countryData[key] = []
for (let i = 1; i <= count; i++) {
countryData[key].push(list[key]['filedName_' + i])
countryData[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
}
},
}, },
} }
</script> </script>
...@@ -149,7 +173,7 @@ export default { ...@@ -149,7 +173,7 @@ export default {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 130rpx 24rpx 0rpx 24rpx; padding: 30rpx 24rpx 0rpx 24rpx;
} }
.cert-body { .cert-body {
...@@ -161,19 +185,29 @@ export default { ...@@ -161,19 +185,29 @@ export default {
position: relative; position: relative;
.top { .top {
height: 116rpx; height: 116rpx;
background-color: #000000;
} }
.table-list { .table-list {
margin-top: 20rpx; margin-top: 20rpx;
margin-bottom: 200rpx; margin-bottom: 200rpx;
.name { .name {
font-size: 24rpx; font-size: 28rpx;
text-align: left; text-align: left;
padding: 30rpx 0; padding: 30rpx 0;
color: #191c27;
font-weight: bold;
} }
.table { .table {
background-color: #2953ff; /* background-color: #2953ff; */
min-height: 200rpx; min-height: 200rpx;
::v-deep .u-td {
font-weight: bold;
color: #5a6073;
}
::v-deep .bg-td:nth-of-type(2n + 1) {
background-color: #e8ebf3 !important;
font-weight: bold !important;
color: #191c27;
}
} }
} }
.foot { .foot {
...@@ -189,5 +223,22 @@ export default { ...@@ -189,5 +223,22 @@ export default {
font-size: 28rpx; font-size: 28rpx;
color: #5a6073; color: #5a6073;
} }
.cert-foot {
height: 100rpx;
width: 100%;
text-align: right;
padding-left: 24rpx;
display: flex;
flex-direction: column;
font-size: 24rpx;
color: #5a6073;
}
.u-tr ::v-deep .u-td {
font-size: 22rpx !important;
height: 80rpx;
}
.u-tr ::v-deep .u-td .u-td {
padding: 5rpx 0 !important;
}
} }
</style> </style>
<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 val-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 val-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 val-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 val-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 val-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 val-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 val-td">在线培训</u-td>
<u-td class="u-td val-td">{{maxpoint}}</u-td>
<u-td class="u-td val-td">{{learnTime}}</u-td>
<u-td class="u-td val-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 + 'xitongtouxiang.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;
}
.u-tr ::v-deep .val-td {
font-weight: bold;
color: #5A6073 !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.
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
:src="item.image" :src="item.image"
></image ></image
><text v-if="item.title" class="detail-title">{{ item.title }}</text ><text v-if="item.title" class="detail-title">{{ item.title }}</text
><text class="detail-text">{{ ><text class="detail-text">{{ info[item.key] }}</text></view
item.key == 'location' ? provinceName : info[item.key]
}}</text></view
> >
</view> </view>
<SubjectStatistics <SubjectStatistics
...@@ -68,7 +66,7 @@ ...@@ -68,7 +66,7 @@
<view class="right-view"> <view class="right-view">
<view>{{ item.name }}</view> <view>{{ item.name }}</view>
<view class="label-view" <view class="label-view"
><text class="left-label" v-if="item.leftLabel">{{ ><text class="left-label" v-if="info.cardId">{{
item.leftLabel item.leftLabel
}}</text }}</text
><text>{{ item.label }}</text></view ><text>{{ item.label }}</text></view
...@@ -117,10 +115,10 @@ export default { ...@@ -117,10 +115,10 @@ export default {
visible: false, // 免费体验弹窗 visible: false, // 免费体验弹窗
show: false, show: false,
type: 'select', type: 'select',
provinceList: [], // provinceList: [],
detail: { questionWarehouse: {} }, detail: { questionWarehouse: {} },
selected: {}, selected: {},
data: {}, data: { questionWarehouse: {} },
// relationId: 0, // 绑卡用 // relationId: 0, // 绑卡用
loading: false, loading: false,
canExperience: false, // 体验资格 canExperience: false, // 体验资格
...@@ -166,7 +164,10 @@ export default { ...@@ -166,7 +164,10 @@ export default {
id: this.selected.id, id: this.selected.id,
cardId: cardId:
this.detail.questionWarehouse && this.detail.questionWarehouse.cardId, this.detail.questionWarehouse && this.detail.questionWarehouse.cardId,
provinceName: this.provinceName, provinceName:
this.data.questionWarehouse.echoMap &&
this.data.questionWarehouse.echoMap.provinceId &&
this.data.questionWarehouse.echoMap.provinceId.fullName,
experience: this.canExperience, experience: this.canExperience,
pass: this.$u.random(95, 99) + '%', pass: this.$u.random(95, 99) + '%',
days: this.detail.totalDayCount || 0, days: this.detail.totalDayCount || 0,
...@@ -208,19 +209,19 @@ export default { ...@@ -208,19 +209,19 @@ export default {
}, },
] ]
}, },
provinceName() { // provinceName() {
for (var item of this.provinceList) { // for (var item of this.provinceList) {
if (item.id == this.selected.provinceId) { // if (item.id == this.selected.provinceId) {
return item.fullName + '题' // return item.fullName + '题'
} // }
} // }
return '' // return ''
}, // },
detailItems() { detailItems() {
return [ return [
{ {
title: '', title: '',
key: 'location', key: 'provinceName',
image: process.uniEnv.qn_base_url + 'quyu.png', image: process.uniEnv.qn_base_url + 'quyu.png',
imageStyle: 'width:24rpx;height:28rpx', imageStyle: 'width:24rpx;height:28rpx',
}, },
...@@ -248,7 +249,7 @@ export default { ...@@ -248,7 +249,7 @@ export default {
onLoad() { onLoad() {
if (this.vuex_token) { if (this.vuex_token) {
this.loading = true this.loading = true
this.getProvinceList() // this.getProvinceList()
} }
}, },
onShow() { onShow() {
...@@ -269,7 +270,7 @@ export default { ...@@ -269,7 +270,7 @@ export default {
}, },
methods: { methods: {
initData() { initData() {
this.getProvinceList() // this.getProvinceList()
this.queryMyQuestionWarehouseDetail('0') this.queryMyQuestionWarehouseDetail('0')
}, },
// 检查是否具有体验资格 // 检查是否具有体验资格
...@@ -381,9 +382,10 @@ export default { ...@@ -381,9 +382,10 @@ export default {
}) })
} }
} else { } else {
this.$u.route({ this.show = true
url: 'pages/learn/selectCategory', // this.$u.route({
}) // url: 'pages/learn/selectCategory',
// })
} }
}, },
handleClickLeftTop() { handleClickLeftTop() {
...@@ -392,10 +394,10 @@ export default { ...@@ -392,10 +394,10 @@ export default {
}) })
}, },
handleClickToast(type) { handleClickToast(type) {
var str = type == 'select' ? 'addExam' : 'detail' // var str = type == 'select' ? 'selectCategory' : 'detail'
this.$u.route({ this.$u.route({
url: 'pages/learn/' + str, url: 'pages/learn/selectCategory',
params: { params: {
// relationId: this.relationId, // relationId: this.relationId,
id: this.info.id, id: this.info.id,
...@@ -463,9 +465,10 @@ export default { ...@@ -463,9 +465,10 @@ export default {
}) })
} else { } else {
// 未选题库 // 未选题库
this.$u.route({ this.show = true
url: 'pages/learn/selectCategory', // this.$u.route({
}) // url: 'pages/learn/selectCategory',
// })
} }
}, },
handleClick(path, params) { handleClick(path, params) {
...@@ -495,16 +498,16 @@ export default { ...@@ -495,16 +498,16 @@ export default {
}) })
} }
}, },
getProvinceList() { // getProvinceList() {
this.$u.api // this.$u.api
.getProvinceList() // .getProvinceList()
.then((res) => { // .then((res) => {
this.provinceList = res || [] // this.provinceList = res || []
}) // })
.catch((err) => { // .catch((err) => {
console.log(err) // console.log(err)
}) // })
}, // },
setPageInfo(info) { setPageInfo(info) {
var pages = getCurrentPages() var pages = getCurrentPages()
if (pages.length >= 1) { if (pages.length >= 1) {
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<u-image <u-image
slot="icon" slot="icon"
width="36rpx" width="36rpx"
height="40rpx" height="42rpx"
:src="questionIcon" :src="questionIcon"
></u-image> ></u-image>
</u-cell-item> </u-cell-item>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<u-image <u-image
slot="icon" slot="icon"
width="36rpx" width="36rpx"
height="40rpx" height="36rpx"
:src="serviceIcon" :src="serviceIcon"
></u-image> ></u-image>
</u-cell-item> </u-cell-item>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<u-image <u-image
slot="icon" slot="icon"
width="36rpx" width="36rpx"
height="40rpx" height="34rpx"
:src="settingIcon" :src="settingIcon"
></u-image> ></u-image>
</u-cell-item> </u-cell-item>
...@@ -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
......
...@@ -64,10 +64,15 @@ ...@@ -64,10 +64,15 @@
<view <view
class="c-list" class="c-list"
v-if="type === 1 || type === 3" v-if="type === 1 || type === 3"
@click="collection(collectionFlag)" @click="$u.throttle(collection, 500)"
> >
<u-icon v-show="!collectionFlag" name="star" color="#5A6073" size="40"></u-icon> <u-image
<u-icon v-show="collectionFlag" name="star-fill" color="#FF930D" size="40"></u-icon> :src="collectImg"
width="36"
height="36"
:fade="false"
:lazy-load="false"
/>
<text>{{ collectionFlag ? '已收藏' : '收藏' }}</text> <text>{{ collectionFlag ? '已收藏' : '收藏' }}</text>
</view> </view>
<view class="c-list" v-if="type === 2" @click="handPapers"> <view class="c-list" v-if="type === 2" @click="handPapers">
...@@ -192,9 +197,9 @@ export default { ...@@ -192,9 +197,9 @@ export default {
computed: { computed: {
defaultImg() { defaultImg() {
let name = '' let name = ''
if (this.type === 4) { if (this.source === 5) {
name = 'no-error.png' name = 'no-error.png'
} else if (this.type === 5) { } else if (this.source === 4) {
name = 'no-collect.png' name = 'no-collect.png'
} }
return process.uniEnv.qn_base_url + name return process.uniEnv.qn_base_url + name
...@@ -205,6 +210,11 @@ export default { ...@@ -205,6 +210,11 @@ export default {
removeImg() { removeImg() {
return process.uniEnv.qn_base_url + 'remove-error.png' return process.uniEnv.qn_base_url + 'remove-error.png'
}, },
collectImg() {
const info = this.list.find(v => v.index === this.currentIndex)
const name = info?.collectionFlag ? 'collected.png' : 'collect.png'
return process.uniEnv.qn_base_url + name
},
currentNumber() { currentNumber() {
let index = this.currentIndex let index = this.currentIndex
return index === -2 ? this.total : index + 1 return index === -2 ? this.total : index + 1
...@@ -215,7 +225,7 @@ export default { ...@@ -215,7 +225,7 @@ export default {
} }
}, },
onLoad(e) { onLoad(e) {
if (e?.experience) this.experience = Boolean(e.experience) // 体验资格 if (e?.experience) this.experience = JSON.parse(e.experience) // 体验资格
if (e?.daily) this.daily.status = true // 每日一练 if (e?.daily) this.daily.status = true // 每日一练
if (e?.dailyCount) this.daily.count = parseInt(e.dailyCount) // 打卡天数 if (e?.dailyCount) this.daily.count = parseInt(e.dailyCount) // 打卡天数
if (e?.source) this.source = parseInt(e.source) // 来源 if (e?.source) this.source = parseInt(e.source) // 来源
...@@ -273,20 +283,22 @@ export default { ...@@ -273,20 +283,22 @@ export default {
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0 let total = parseInt(res) || 0
// 考试 if (total > 0) {
if (this.type === 2) { // 考试
this.pageSize = this.totalPoint if (this.type === 2) {
total = this.totalPoint this.pageSize = this.totalPoint
total = this.totalPoint
}
this.total = total
// 练习模式-初始化答题卡列表
if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
} }
this.total = total
// 练习模式-初始化答题卡列表
if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.source === 1 ? (this.lastIndex[this.questionWarehouseId] || 0) : 0
this.refresh(index)
}) })
}, },
// 切换 // 切换
...@@ -488,7 +500,7 @@ export default { ...@@ -488,7 +500,7 @@ export default {
uni.hideLoading() uni.hideLoading()
if (res) { // 交卷 if (res) { // 交卷
this.$u.route({ this.$u.route({
type: 'redirect', type: 'reLaunch',
url: '/pages/learn/score', url: '/pages/learn/score',
params: { params: {
id: this.recordId id: this.recordId
...@@ -520,11 +532,17 @@ export default { ...@@ -520,11 +532,17 @@ export default {
}) })
}, },
// 收藏 // 收藏
collection(status) { collection() {
const info = this.list.find(v => v.index === this.currentIndex) const info = this.list.find(v => v.index === this.currentIndex)
const status = info ? info.collectionFlag : false
const action = status ? 'removeCollection' : 'joinCollection' const action = status ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: info.id}).then(res => { this.$u.api[action]({questionId: info.id}).then(res => {
if(res) { if(res) {
const msg = status ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg)
if (status && this.source === 4) {
this.current = this.currentIndex + 1
}
info.collectionFlag = !status info.collectionFlag = !status
if (this.source === 1) { //更新缓存数据 if (this.source === 1) { //更新缓存数据
this.questionList[this.questionWarehouseId][this.currentIndex] = info this.questionList[this.questionWarehouseId][this.currentIndex] = info
......
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
{ {
title: '判断题', title: '判断题',
icon: this.panduanmage, icon: this.panduanmage,
key: 'trueAnswerCount', key: 'trueOrFalseCount',
}, },
{ {
title: '多选题', title: '多选题',
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</view> </view>
<view class="exam-area"> <view class="exam-area">
<view class="area-title-view"> <view class="area-title-view">
<text class="rea-title-view">包括区域</text> <text class="rea-title-view">报考区域</text>
<text>请确认与所在考试省份一致</text> <text>请确认与所在考试省份一致</text>
</view> </view>
<picker <picker
...@@ -91,9 +91,14 @@ ...@@ -91,9 +91,14 @@
@submit="handleClickSubmit" @submit="handleClickSubmit"
> >
<view v-for="(value, key) in selected" :key="key" class="pop-content"> <view v-for="(value, key) in selected" :key="key" class="pop-content">
<view :class="['pop-content-text', { last: key == thirdKey }]">{{ <view :class="['pop-content-text', { last: key == thirdKey }]"
value.label >{{ value.label
}}</view> }}<text v-if="key != secondKey"
>({{
key == firstKey ? selectedTypeText : currentProvince.label
}})</text
></view
>
<u-icon v-if="key != thirdKey" name="arrow-downward"></u-icon> <u-icon v-if="key != thirdKey" name="arrow-downward"></u-icon>
</view> </view>
</PopView> </PopView>
...@@ -162,16 +167,20 @@ export default { ...@@ -162,16 +167,20 @@ export default {
buttonDisabled() { buttonDisabled() {
return !(this.currentProvince.label && this.selectedTypeId) return !(this.currentProvince.label && this.selectedTypeId)
}, },
selectedType() { typeTexts() {
for (var item of this.types) { return { '1': '初训', '2': '复训' }
if (item.selected == true) { },
return true selectedTypeText() {
} return this.typeTexts[this.selectedTypeId]
}
return false
}, },
thirdKey() { thirdKey() {
return key3 || key2 || key1 return key3
},
firstKey() {
return key1
},
secondKey() {
return key2
}, },
selectedTypeId() { selectedTypeId() {
for (var item of this.types) { for (var item of this.types) {
...@@ -185,7 +194,7 @@ export default { ...@@ -185,7 +194,7 @@ export default {
onLoad(e) { onLoad(e) {
this.getPageInfo() this.getPageInfo()
this.getLocation() this.getLocation()
this.getProvinceList() this.getProvinceList(this.category.id)
}, },
methods: { methods: {
handleClickArea() { handleClickArea() {
...@@ -219,8 +228,8 @@ export default { ...@@ -219,8 +228,8 @@ export default {
this.showPop = true this.showPop = true
}, },
// 获取省份列表 // 获取省份列表
async getProvinceList() { async getProvinceList(id) {
let res = await this.$u.api.getProvinceList() let res = await this.$u.api.getProvinceList(id)
console.log(res) console.log(res)
this.range = res this.range = res
}, },
...@@ -241,32 +250,43 @@ export default { ...@@ -241,32 +250,43 @@ export default {
} }
// 获取科目对应的题库 // 获取科目对应的题库
let res = await this.$u.api.getQuestionWarehouse(this.category.id, param) let res = await this.$u.api.getQuestionWarehouse(this.category.id, param)
let data = res[0] if (res && res.length > 0) {
this.setPageInfo(data) let data = res[0]
// 学员增加自己的题库 // 学员增加自己的题库
let result = await this.$u.api let result = await this.$u.api
.addQuestionWarehouse({ .addQuestionWarehouse({
questionWarehouseId: data.id, questionWarehouseId: data.id,
}) })
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
if (result) { if (result) {
// 成功 this.setPageInfo(data)
// 成功
this.$refs.uToast.show({
title: '添加题库成功',
type: 'success',
duration: 1500,
callback: () => {
this.showPop = false
uni.switchTab({
url: '/pages/index/index',
})
},
})
} else {
this.showPop = false
}
} else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '添加题库成功', title: '该类型和区域没有的题库',
type: 'success', type: 'warning',
duration: 1500, duration: 1500,
callback: () => { callback: () => {
this.showPop = false this.showPop = false
uni.switchTab({
url: '/pages/index/index',
})
}, },
}) })
} else {
this.showPop = false
} }
}, },
changeIndex() { changeIndex() {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
titleColor="#191C27" titleColor="#191C27"
:border-bottom="false" :border-bottom="false"
title-bold title-bold
:custom-back="customBack"
></u-navbar> ></u-navbar>
<view <view
class="top-view" class="top-view"
...@@ -194,7 +195,6 @@ export default { ...@@ -194,7 +195,6 @@ export default {
}) })
}, },
handleClickRecord() { handleClickRecord() {
console.log("11", 11)
this.$u.route({ this.$u.route({
url: 'pages/learn/answer', url: 'pages/learn/answer',
params: { params: {
...@@ -208,6 +208,13 @@ export default { ...@@ -208,6 +208,13 @@ export default {
this.show = false this.show = false
}, 2500) }, 2500)
}, },
customBack() {
console.log("111", 111)
this.$u.route({
type: 'tab',
url: 'pages/index/index'
})
}
}, },
} }
</script> </script>
......
...@@ -91,6 +91,11 @@ export default { ...@@ -91,6 +91,11 @@ export default {
.getMyQuestionWarehouseList(param) .getMyQuestionWarehouseList(param)
.then((res) => { .then((res) => {
this.loading = false this.loading = false
for (var item of res) {
if (item && item.echoMap && item.echoMap.questionWarehouseId) {
item.echoMap.questionWarehouseId.number = item.number
}
}
this.list = res this.list = res
}) })
.catch((err) => { .catch((err) => {
......
...@@ -6,92 +6,6 @@ ...@@ -6,92 +6,6 @@
// } // }
const TOTAL = 100 const TOTAL = 100
const lists = [
{
type: 1,
title: '采用QS1电桥测量tanδ的接线方式一般有差接线及和接线。',
answerList: [
{
sort: 'A',
text: '正确',
},
{
sort: 'B',
text: '错误',
},
],
answer: 'A',
explain:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。',
index: 0,
rightKey: ['A'],
},
{
type: 2,
title:
'空气间隙的操作冲击击穿电压数值大小不仅与间隙距离、电极形状、电极极性有关,而且与操作冲击电压波的波前时间的长短有关。',
answerList: [
{
sort: 'A',
text: '正确',
},
{
sort: 'B',
text: '错误',
},
],
answer: 'B',
explain:
'极性电介质在外电场作用下,由偶极子分子的转向形成的极化称为偶极子式极化。',
index: 1,
rightKey: ['B'],
},
{
type: 3,
title: '西林电桥采用正接线及反接线时,其测试原理相同',
answerList: [
{
sort: 'A',
text: '影响',
},
{
sort: 'B',
text: '影响很小',
},
{
sort: 'C',
text: '影响很大',
},
{
sort: 'D',
text: '无影响',
},
],
answer: 'B,C',
explain:
'双臂电桥是在单臂电桥的基础上增加特殊机构,以消除测试时连接线和接线柱接触电阻对测量结果的影响。',
index: 2,
rightKey: ['B', 'C'],
},
{
type: 2,
title: '测试标题测试标题测试标题测试标题',
answerList: [
{
sort: 'A',
text: '是',
},
{
sort: 'B',
text: '否',
},
],
answer: 'B',
explain: '测试内容测试内容测试内容测试内容测试内容测试内容',
index: 3,
rightKey: ['B'],
},
]
// 请求一页数据 // 请求一页数据
function request({ currentPage, size, onSuccess, onFailed }, vm) { function request({ currentPage, size, onSuccess, onFailed }, vm) {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
binderror="" binderror=""
bindload="" bindload=""
@click="getBack" @click="getBack"
style="margin-top: 30rpx"
/> />
</view> </view>
</view> </view>
......
...@@ -29,12 +29,21 @@ export default { ...@@ -29,12 +29,21 @@ export default {
return { return {
student: { student: {
workUnit: '', workUnit: '',
isNotSet: null,
}, },
} }
}, },
computed: {}, computed: {},
onLoad() { onLoad() {
this.student = getApp().globalData.student this.student = getApp().globalData.student
if (this.student.workUnit == '' || !this.student.workUnit) {
this.isNotSet = true
}
},
onUnload() {
if (this.isNotSet) {
this.student.workUnit = ''
}
}, },
methods: { methods: {
submit() { submit() {
...@@ -47,6 +56,7 @@ export default { ...@@ -47,6 +56,7 @@ export default {
workUnit: this.student.workUnit, workUnit: this.student.workUnit,
}) })
.then((res) => { .then((res) => {
this.isNotSet = false
this.$u.toast('保存成功') this.$u.toast('保存成功')
setTimeout(() => { setTimeout(() => {
this.$u.route({ this.$u.route({
......
...@@ -24,7 +24,12 @@ ...@@ -24,7 +24,12 @@
></u-image> ></u-image>
</view> </view>
</u-cell-item> </u-cell-item>
<u-cell-item title="证件照" @click="changeCertPhoto"> <u-cell-item
title="证件照"
@click="changeCertPhoto"
:arrow="false"
:hover-class="none"
>
<view slot="right-icon"> <view slot="right-icon">
<u-image <u-image
v-if="isupLoadCertPhoto" v-if="isupLoadCertPhoto"
...@@ -32,7 +37,7 @@ ...@@ -32,7 +37,7 @@
height="120rpx" height="120rpx"
:src="headCertPhoto" :src="headCertPhoto"
></u-image> ></u-image>
<text v-else style="color:blue;">未上传</text> <text v-else style="color:#2953FF">去上传</text>
</view> </view>
</u-cell-item> </u-cell-item>
<u-cell-item title="手机号" :arrow="false" :hover-class="none"> <u-cell-item title="手机号" :arrow="false" :hover-class="none">
...@@ -43,7 +48,8 @@ ...@@ -43,7 +48,8 @@
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhonenumber" @getphonenumber="getPhonenumber"
> >
{{ getMobile }} <text v-if="getMobile">{{ getMobile }}</text>
<text v-else class="empty-value">去绑定</text>
</button> </button>
</view> </view>
</u-cell-item> </u-cell-item>
...@@ -51,12 +57,18 @@ ...@@ -51,12 +57,18 @@
title="实名认证" title="实名认证"
title-style="{'font':'bold','font-size':'40rpx'}" title-style="{'font':'bold','font-size':'40rpx'}"
:value="getCertifyStatus" :value="getCertifyStatus"
:value-style="{
color: getCertifyStatus == '去认证' ? '#2953FF' : '#191C27',
}"
@click="goCertify" @click="goCertify"
> >
</u-cell-item> </u-cell-item>
<u-cell-item <u-cell-item
title="工作单位" title="工作单位"
:value="getCompany" :value="getCompany"
:value-style="{
color: getCompany == '去填写' ? '#2953FF' : '#191C27',
}"
@click="goCompany" @click="goCompany"
></u-cell-item> ></u-cell-item>
</u-cell-group> </u-cell-group>
...@@ -77,38 +89,46 @@ export default { ...@@ -77,38 +89,46 @@ 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 &&
this.student.phoneNumber.length > 5 &&
this.student.phoneNumber) ||
false
)
}, },
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() {
this.$u.api.getQiNiuToken({ type: 'image' }).catch((data) => { this.$u.api
if (data.errMsg == 'request:ok') { .getQiNiuToken({ bucketName: 'banshou-userprofile' })
.then((res) => {
this.token = data.data.token //token为七牛云的token一般由后台接口提供 this.token = data.data.token //token为七牛云的token一般由后台接口提供
getApp().globalData.qiNiuToken = data.data.token getApp().globalData.qiNiuToken = data.data.token
} else { })
this.$u.toast('获取token失败')
}
})
this.$u.api.getUserInfo().then((res) => { this.$u.api.getUserInfo().then((res) => {
res.isCertify = res.identityNumber ? true : false if (res && res.identityNumber) {
this.student.isCertify = true
}
this.student = res this.student = res
}) })
}, },
...@@ -263,8 +283,11 @@ page { ...@@ -263,8 +283,11 @@ page {
.mobile-button { .mobile-button {
width: 115px; width: 115px;
height: 55rpx;
background: none; background: none;
font-size: 28rpx; font-size: 28rpx;
text-align: right;
padding-right: 0;
} }
button::after { button::after {
border: none; border: none;
...@@ -285,7 +308,7 @@ button::after { ...@@ -285,7 +308,7 @@ button::after {
border-top-width: 0; border-top-width: 0;
} }
.content ::v-deep .u-cell__value { .empty-value {
color: #191c27; color: #2953ff;
} }
</style> </style>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
title="版本更新" title="版本更新"
value="当前版本v1.1.0" value="当前版本v1.1.0"
:border-bottom="false" :border-bottom="false"
@tap="upgrade"
></u-cell-item> ></u-cell-item>
</u-cell-group> </u-cell-group>
<view class="logout" @tap="logout">退出登录</view> <view class="logout" @tap="logout">退出登录</view>
...@@ -19,6 +20,27 @@ export default { ...@@ -19,6 +20,27 @@ export default {
computed: {}, computed: {},
onLoad() {}, onLoad() {},
methods: { methods: {
upgrade: function() {
wx.showToast({
title: '正在更新版本...',
icon: 'loading',
})
const um = wx.getUpdateManager()
um.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
um.onUpdateReady(function() {
um.applyUpdate()
wx.showToast({
title: '更新完成',
})
})
} else {
wx.showToast({
title: '已是最新版本',
})
}
})
},
logout() { logout() {
this.$u.vuex('vuex_token', '') this.$u.vuex('vuex_token', '')
this.$u.vuex('openId', '') this.$u.vuex('openId', '')
......
...@@ -67,8 +67,13 @@ ...@@ -67,8 +67,13 @@
</view> </view>
<view class="u-flex opera"> <view class="u-flex opera">
<view class="opera-list" @click="collection(item)"> <view class="opera-list" @click="collection(item)">
<u-icon v-show="!collectionFlag" name="star" color="#5A6073" size="40"></u-icon> <u-image
<u-icon v-show="collectionFlag" name="star-fill" color="#FF930D" size="40"></u-icon> :src="collectImg"
width="36"
height="36"
:fade="false"
:lazy-load="false"
/>
<text>{{ collectionFlag ? '已收藏' : '收藏' }}</text> <text>{{ collectionFlag ? '已收藏' : '收藏' }}</text>
</view> </view>
<view class="opera-list" @click="arrowUp(index)"> <view class="opera-list" @click="arrowUp(index)">
...@@ -128,6 +133,11 @@ export default { ...@@ -128,6 +133,11 @@ export default {
count() { count() {
return this.lists.length return this.lists.length
}, },
collectImg() {
const info = this.lists.find(v => v.index === this.arrIndex)
const name = info?.collectionFlag ? 'collected.png' : 'collect.png'
return process.uniEnv.qn_base_url + name
},
collectionFlag() { collectionFlag() {
const info = this.lists.find(v => v.index === this.arrIndex) const info = this.lists.find(v => v.index === this.arrIndex)
return info ? info.collectionFlag : false return info ? info.collectionFlag : false
...@@ -178,18 +188,23 @@ export default { ...@@ -178,18 +188,23 @@ export default {
search(val) { search(val) {
if (val){ if (val){
this.keyword = val this.keyword = val
let history = this.searchHistory let history = this.searchHistory.filter(v => v !== val)
history.unshift(val) history.unshift(val)
if (history.length > 9) { if (history.length > 9) {
history.splice(9, 1) history.splice(9, 1)
} }
this.$u.vuex('searchHistory', history) this.$u.vuex('searchHistory', history)
this.init()
} }
}, },
collection(item) { collection(item) {
const action = item.collectionFlag ? 'removeCollection' : 'joinCollection' const action = item.collectionFlag ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: item.id}).then(res => { this.$u.api[action]({questionId: item.id}).then(res => {
if(res) item.collectionFlag = !item.collectionFlag if(res) {
const msg = item.collectionFlag ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg)
item.collectionFlag = !item.collectionFlag
}
}) })
}, },
arrowUp(index) { arrowUp(index) {
......
...@@ -43,8 +43,7 @@ ...@@ -43,8 +43,7 @@
export default { export default {
data() { data() {
return { return {
keyword: '', keyword: ''
history: [],
} }
}, },
computed: { computed: {
...@@ -56,19 +55,20 @@ export default { ...@@ -56,19 +55,20 @@ export default {
deleteImg() { deleteImg() {
return process.uniEnv.qn_base_url + 'delete.png' return process.uniEnv.qn_base_url + 'delete.png'
}, },
}, history() {
created() { return this.searchHistory
this.history = this.searchHistory }
}, },
methods: { methods: {
search(val) { search(val) {
if (val){ if (val){
this.keyword = val this.keyword = val
this.history.unshift(val) let history = this.searchHistory.filter(v => v !== val)
if(this.history.length > 9){ history.unshift(val)
this.history.splice(9, 1) if(history.length > 9){
history.splice(9, 1)
} }
this.$u.vuex('searchHistory', this.history) this.$u.vuex('searchHistory', history)
this.toSearchDetail(val) this.toSearchDetail(val)
} }
}, },
...@@ -86,7 +86,6 @@ export default { ...@@ -86,7 +86,6 @@ export default {
content: '确认要清空搜索历史记录?', content: '确认要清空搜索历史记录?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.history = []
this.$u.vuex('searchHistory', []) this.$u.vuex('searchHistory', [])
} }
}, },
......
<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