Commit 42977b7a authored by Facius's avatar Facius

feat: 已选题库列表加状态

parent 876e70cc
<template>
<view class="question-bank-cell">
<view class="label-normal">
<view class="title-view">{{ info.label || info.title }}</view>
<view class="type-view" v-if="!isAdd">{{
<view class="title-view">{{ questionData.label || questionData.title }}</view>
<view class="type-view" v-if="!isAdd"><text>{{
provinceName + '-' + examTypeText
}}</view>
}}</text><text :style="statusData.statusStyle">{{'(' + statusData.status + statusData.subtitle + ')'}}</text></view>
<view class="label-text">
共
<text class="label-blue">{{ info.number || 0 }}</text
<text class="label-blue">{{ questionData.number || 0 }}</text
>道精编试题,通过率
<text class="label-blue">{{ info.version || info.key }}</text>
<text class="label-blue">{{ questionData.version || questionData.key }}</text>
</view>
</view>
<u-button
......@@ -43,22 +43,25 @@ export default {
return {}
},
computed: {
questionData() {
return this.isAdd ? this.info : this.info && this.info.echoMap && this.info.echoMap.questionWarehouseId
},
examTypeText() {
var str = this.info.echoMap && this.info.echoMap.type
var str = this.questionData.echoMap && this.questionData.echoMap.type
return str || ''
},
provinceName() {
var str =
this.info.echoMap &&
this.info.echoMap.provinceId &&
this.info.echoMap.provinceId.fullName
this.questionData.echoMap &&
this.questionData.echoMap.provinceId &&
this.questionData.echoMap.provinceId.fullName
return str || ''
},
isAdd() {
return this.type == 'add'
},
isNone() {
return this.type == 'none' || this.questionWarehouseId == this.info.id
return this.type == 'none' || this.questionWarehouseId == this.questionData.id
},
buttonText() {
var text = ''
......@@ -85,10 +88,78 @@ export default {
borderRadius: '12rpx',
}
},
statusData() {
var data = {status: '', statusStyle: '', subtitle: ''}
if (
!this.info.echoMap ||
!this.info.echoMap.questionWarehouseId ||
!this.info.echoMap.cardId
) {
data.status = '未激活' // 未绑卡
data.statusStyle = 'color: #9EA5BB'
return data
}
switch (this.info.echoMap.cardId.cardStatus) {
case 0:
break
case 5:
data.status = '已激活' // 绑卡未激活
data.statusStyle = 'color: #2953FF'
data.subtitle = '-未使用'
break
case 10:
data.status = '已激活'
data.statusStyle = 'color: #2953FF'
let leaveDay = 0
if (
this.info.echoMap.cardId &&
this.info.echoMap.cardId.activationTime
) {
let diff = this.datedifference(
this.info.echoMap.cardId.activationTime.split(' ')[0],
this.getTodayDate()
)
leaveDay = this.info.echoMap.cardId.effectiveDay - diff
leaveDay = leaveDay > 0 ? leaveDay : 0
}
data.subtitle = '-' + leaveDay + '天后到期'
break
case 15:
data.status = '已失效'
data.statusStyle = 'color: #9EA5BB'
break
default:
break
}
return data
}
},
methods: {
handleClick() {
this.$emit('action', this.info, this.type)
this.$emit('action', this.questionData, this.type)
},
getTodayDate() {
let day = new Date()
day.setTime(day.getTime())
let m = day.getMonth() + 1
let d = day.getDate()
return (
day.getFullYear() +
'-' +
(String(m).length < 2 ? '0' + m : m) +
'-' +
(String(d).length < 2 ? '0' + d : d)
)
},
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
},
},
}
......
......@@ -32,10 +32,7 @@
class="card-tip-view"
@click="$u.throttle(handleSelectTip, 500)"
>
题库未激活,请通过<text class="blue-text">“绑卡”</text>或<text
class="blue-text"
>“购买”</text
>激活
题库未激活,<text class="blue-text">激活</text>后可刷题模考
</view>
<view v-else class="detail-view">
<view
......@@ -155,7 +152,7 @@ export default {
return this.orgId
},
title() {
return this.selected.title || '请选择题库'
return this.selected.title || '点击选择题库'
},
imageUrl() {
return '/static/logo.png'
......
......@@ -18,7 +18,7 @@
<view class="title-view">{{ info.questionWarehouse.title }}</view>
<view class="message-view">8年题库沉淀,省时省力考高分</view>
<view class="tip-view"
>• 有效期90天,自购买或者绑卡后答题激活为起始日期</view
>• 有效期90天,从首次刷题之日算起</view
>
<view class="price-view">
<view class="left-view">
......@@ -79,7 +79,7 @@
type="primary"
shape="circle"
>
绑定学习卡
学习卡用户 绑卡激活
</u-button>
</view>
<MaskTip
......@@ -143,7 +143,7 @@ export default {
buttonStyle() {
return {
height: '104rpx',
backgroundColor: '#2953FF',
backgroundColor: '#FA5A4D',
color: '#FFFFFF',
fontSize: '32rpx',
fontWeight: 'bold',
......
......@@ -12,7 +12,7 @@
<view class="label-content">
<view v-for="(label, index) in list" :key="index" class="label-item">
<QuestionBankCell
:info="label && label.echoMap && label.echoMap.questionWarehouseId"
:info="label"
:type="type"
@action="handleAction"
></QuestionBankCell>
......
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