Commit b82e28e9 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' into test

parents 67b7f24a 00f4796d
...@@ -96,6 +96,13 @@ let learnApiFun = function(vm) { ...@@ -96,6 +96,13 @@ let learnApiFun = function(vm) {
'/rest/question/query/everyTaskList/' + questionWarehouseId, '/rest/question/query/everyTaskList/' + questionWarehouseId,
params params
) )
// 练习分析
let studyRecord = async (questionWarehouseId, params = {}) =>
await vm.$u.get(
'/rest/question/query/studyRecord/' + questionWarehouseId,
params
)
const learnApi = { const learnApi = {
getQuestion, getQuestion,
getQuestionTotal, getQuestionTotal,
...@@ -119,6 +126,7 @@ let learnApiFun = function(vm) { ...@@ -119,6 +126,7 @@ let learnApiFun = function(vm) {
searchQuestion, searchQuestion,
checkGetQuestion, checkGetQuestion,
everyTaskList, everyTaskList,
studyRecord,
} }
return learnApi return learnApi
} }
......
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
.sheet { .sheet {
flex-flow: column; flex-flow: column;
.lists { .lists {
padding: 10rpx 0; padding: 32rpx 0;
width: 100%; width: 100%;
.icons { .icons {
font-size: 28rpx; font-size: 28rpx;
...@@ -186,7 +186,7 @@ export default { ...@@ -186,7 +186,7 @@ export default {
} }
.btn { .btn {
text-align: center; text-align: center;
margin-top: 50rpx; margin-top: 200rpx;
.confirm { .confirm {
width: 400rpx; width: 400rpx;
height: 100rpx; height: 100rpx;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
v-model="visible" v-model="visible"
mode="center" mode="center"
safe-area-inset-bottom safe-area-inset-bottom
width="690rpx" width="650rpx"
:mask-close-able="flase" :mask-close-able="flase"
close-icon-color="#FFFFFF" close-icon-color="#FFFFFF"
height="86%" height="86%"
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
:loading="loading" :loading="loading"
@click="handleClickSure" @click="handleClickSure"
> >
{{ buttonText }} 确定
</u-button> </u-button>
</view> </view>
</view> </view>
...@@ -61,11 +61,6 @@ export default { ...@@ -61,11 +61,6 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
buttonText: {
// 确定按钮
type: String,
default: '确定',
},
}, },
data() { data() {
return { return {
......
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
return this.type == 'add' return this.type == 'add'
}, },
isNone() { isNone() {
return this.type == 'none' return this.type == 'none' || this.questionWarehouseId == this.info.id
}, },
buttonText() { buttonText() {
var text = '' var text = ''
......
<template>
<view @click.stop="itemChange(item.id)" class="list-item">
<view :class="['u-flex', 'head', { selected: item.id === arrIndex }]">
<view class="titles">
<text>{{ item.type }}</text
>{{ item.title }}
</view>
<view class="u-flex arrow" v-show="item.id !== arrIndex">
<text>展开</text>
<u-icon name="arrow-down" color="#9EA5BB"></u-icon>
</view>
</view>
<view class="u-flex subject" v-show="item.id === arrIndex">
<view class="content">
<answer-sheet
ref="answerSheet"
:answerList="item.answerList"
:rightKey="item.rightKey"
:multiple="item.type === 3"
:submitStatus="item.submitStatus"
:btnStatus="false"
@change="answerChange"
></answer-sheet>
</view>
<view class="explain">
<answer-explanation
:answer="item.answer"
:explain="item.explain"
></answer-explanation>
</view>
</view>
<view class="u-flex opera" v-show="item.id === arrIndex">
<view class="opera-list" @click="collection(item)">
<u-image
:src="collectImg"
width="36"
height="36"
:fade="false"
:lazy-load="false"
/>
<text>{{ collectionFlag ? '已收藏' : '收藏' }}</text>
</view>
<view class="opera-list" @click.stop="arrowUp(item.id)">
<text>收起</text>
<u-icon name="arrow-up" color="#9EA5BB"></u-icon>
</view>
</view>
</view>
</template>
<script>
import answerSheet from '@/components/answer-sheet/index.vue'
import answerExplanation from '@/components/answer-explanation/index.vue'
export default {
components: {
answerSheet,
answerExplanation,
},
props: ['item', 'arrIndex'],
computed: {
collectImg() {
const name = this.item?.collectionFlag ? 'collected.png' : 'collect.png'
return process.uniEnv.qn_base_url + name
},
collectionFlag() {
return this.item?.collectionFlag || false
},
},
methods: {
itemChange(id) {
this.$emit('arrowDown', id)
},
arrowUp(id) {
this.$emit('arrowUp', id)
},
collection(item) {
this.$emit('collection', item)
},
},
}
</script>
<style lang="scss" scoped>
.list-item {
background: #fff;
padding: 30rpx 20rpx;
margin: 10rpx 0;
border-radius: 30rpx 30rpx 0 0;
.head {
width: 100%;
height: 60rpx;
overflow: hidden;
.titles {
color: #191c27;
font-size: 32rpx;
line-height: 50rpx;
font-weight: bold;
flex: 1;
height: 60rpx;
overflow: hidden;
text {
background: #9ea5bb;
color: #fff;
padding: 8rpx 20rpx;
margin-right: 10rpx;
font-size: 20rpx;
border-radius: 50rpx 0 50rpx 50rpx;
}
}
.arrow {
padding-left: 20rpx;
margin-top: -10rpx;
text {
color: #2953ff;
font-size: 28rpx;
padding-right: 10rpx;
}
}
}
.selected {
height: auto;
overflow: auto;
.titles {
height: auto;
overflow: auto;
}
}
.subject {
flex-flow: column;
.type {
width: 100%;
text-align: left;
padding: 20rpx 0;
}
.content {
width: 100%;
}
.explain,
.btn {
width: 100%;
padding-top: 50rpx;
}
}
.opera {
padding-top: 30rpx;
justify-content: space-between;
color: #5a6073;
font-size: 28rpx;
.opera-list {
display: flex;
&:nth-of-type(1) {
text {
padding-left: 10rpx;
}
}
&:nth-of-type(2) {
text {
padding-right: 10rpx;
color: #2953ff;
}
}
}
}
}
</style>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<swiper-item v-for="(item, i) in swiperList" :key="i"> <swiper-item v-for="(item, i) in swiperList" :key="i">
<view class="u-flex subject"> <view class="u-flex subject">
<view class="title" v-if="item.title"><text class="title-type">{{ 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" v-if="item.answerList">
<answer-sheet <answer-sheet
ref="answerSheet" ref="answerSheet"
:answerList="item.answerList" :answerList="item.answerList"
......
<template>
<view class="t-table" :style="{ 'border-width': border + 'px', 'border-color': borderColor }">
<slot />
</view>
</template>
<script>
export default {
props: {
border: {
type: String,
default: '1'
},
borderColor: {
type: String,
default: '#d0dee5'
},
isCheck: {
type: Boolean,
default: false
}
},
provide() {
return {
table: this
};
},
data() {
return {};
},
created() {
this.childrens = [];
this.index = 0;
},
methods: {
fire(e, index, len) {
let childrens = this.childrens;
console.log(childrens);
// 全选
if (index === 0) {
childrens.map((vm, index) => {
vm.checkboxData.checked = e;
return vm;
});
} else {
let isAll = childrens.find((n, ids) => ids !== 0 && !n.checkboxData.checked);
childrens[0].checkboxData.checked = isAll ? false : true;
}
let fireArr = [];
for (let i = 0; i < childrens.length; i++) {
if (childrens[i].checkboxData.checked && i !== 0) {
fireArr.push(childrens[i].checkboxData.value - 1);
}
}
this.$emit('change', {
detail: fireArr
});
}
}
};
</script>
<style scoped>
.t-table {
width: 100%;
border: 1px #d0dee5 solid;
border-left: none;
border-top: none;
box-sizing: border-box;
}
.t-table>>>t-tr {
display: flex;
}
.t-table>>>t-tr:nth-child(2n) {
background: #f5f5f5;
}
/* #ifdef H5 */
.t-table>>>.t-tr:nth-child(2n) {
background: #f5f5f5;
}
/* #endif */
</style>
<template>
<view
class="t-td"
:style="{
'border-width': thBorder + 'px',
'border-color': borderColor,
'font-size': fontSize + 'px',
color: color,
'justify-content': tdAlignCpd,
}"
>
<slot></slot>
</view>
</template>
<script>
export default {
props: {
align: String,
},
data() {
return {
thBorder: '1',
borderColor: '#d0dee5',
fontSize: '14',
color: '#555c60',
tdAlign: 'center',
}
},
inject: ['table', 'tr'],
created() {
this.thBorder = this.table.border
this.borderColor = this.table.borderColor
this.fontSize = this.tr.fontSize
this.color = this.tr.color
if (this.align) {
this.tdAlign = this.align
} else {
this.tdAlign = this.tr.align
}
},
computed: {
tdAlignCpd() {
let nameAlign = ''
switch (this.tdAlign) {
case 'left':
nameAlign = 'flex-start'
break
case 'center':
nameAlign = 'center'
break
case 'right':
nameAlign = 'flex-end'
break
default:
nameAlign = 'center'
break
}
return nameAlign
},
},
}
</script>
<style>
.t-td {
flex: 1;
display: flex;
align-items: center;
width: 100%;
padding: 14upx;
border-top: 1px #d0dee5 solid;
border-left: 1px #d0dee5 solid;
text-align: center;
color: #555c60;
font-size: 28upx;
}
</style>
<template>
<view class="t-th" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor,'font-size':fontSize+'px' ,'color':color,'justify-content':thAlignCpd}">
<slot></slot>
</view>
</template>
<script>
export default {
props: {
align: String,
},
data() {
return {
thBorder: '1',
borderColor: '#d0dee5',
fontSize: '15',
color: '#3b4246',
thAlign: 'center'
};
},
inject: ['table', 'tr'],
created() {
this.thBorder = this.table.border;
this.borderColor = this.table.borderColor;
this.fontSize = this.tr.fontSize;
this.color = this.tr.color;
if (this.align) {
this.thAlign = this.align;
} else {
this.thAlign = this.tr.align
}
},
computed: {
thAlignCpd() {
let nameAlign = '';
switch (this.thAlign) {
case 'left':
nameAlign = 'flex-start'
break;
case 'center':
nameAlign = 'center'
break;
case 'right':
nameAlign = 'flex-end'
break;
default:
nameAlign = 'center'
break;
}
return nameAlign
}
}
};
</script>
<style>
.t-th {
flex: 1;
display: flex;
align-items: center;
font-size: 30upx;
font-weight: bold;
text-align: center;
color: #3b4246;
border-left: 1px #d0dee5 solid;
border-top: 1px #d0dee5 solid;
padding: 15upx;
}
</style>
<template>
<view class="t-tr">
<view v-if="isCheck" class="t-check-box" :style="{ 'border-width': thBorder + 'px' ,'border-color':borderColor}">
<checkbox-group @change="checkboxChange">
<checkbox :value="checkboxData.value + ''" :checked="checkboxData.checked" />
</checkbox-group>
</view>
<slot></slot>
</view>
</template>
<script>
export default {
props: {
fontSize: String,
color: String,
align: String
},
inject: ['table'],
provide() {
return {
tr: this
};
},
data() {
return {
isCheck: false,
checkboxData: {
value: 0,
checked: false
},
checked: false,
thBorder: '1',
borderColor: '#d0dee5'
};
},
created() {
this.thBorder = this.table.border;
this.borderColor = this.table.borderColor;
this.table.childrens.push(this);
this.checkboxData.value = this.table.index++;
this.isCheck = this.table.isCheck;
},
methods: {
checkboxChange(e) {
this.checkboxData.checked = !this.checkboxData.checked;
this.table.childrens[this.checkboxData.value] = this;
this.table.fire(e.detail.value[0] ? true : false, this.checkboxData.value, this.table.index);
}
}
};
</script>
<style>
.t-tr {
width: 100%;
display: flex;
}
.t-tr t-th,
.t-tr t-td {
display: flex;
flex: 1;
}
.t-tr .t-check-box {
flex-shrink: 0;
display: flex;
justify-content: center;
align-items: center;
width: 80upx;
color: #3b4246;
border-left: 1px #d0dee5 solid;
border-top: 1px #d0dee5 solid;
}
.t-tr .t-check-box checkbox {
transform: scale(0.8);
}
</style>
<template>
<!-- #ifndef APP-NVUE -->
<view class="uni-list uni-border-top-bottom">
<view v-if="border" class="uni-list--border-top"></view>
<slot />
<view v-if="border" class="uni-list--border-bottom"></view>
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<list class="uni-list" :class="{ 'uni-list--border': border }" :enableBackToTop="enableBackToTop" loadmoreoffset="15"><slot /></list>
<!-- #endif -->
</template>
<script>
/**
* List 列表
* @description 列表组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
* @property {String} border = [true|false] 标题
*/
export default {
name: 'uniList',
'mp-weixin': {
options: {
multipleSlots: false
}
},
props: {
enableBackToTop: {
type: [Boolean, String],
default: false
},
scrollY: {
type: [Boolean, String],
default: false
},
border: {
type: Boolean,
default: true
}
},
// provide() {
// return {
// list: this
// };
// },
created() {
this.firstChildAppend = false;
},
methods: {
loadMore(e) {
this.$emit('scrolltolower');
}
}
};
</script>
<style lang="scss">
.uni-list {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
position: relative;
flex-direction: column;
}
.uni-list--border {
position: relative;
/* #ifdef APP-NVUE */
border-top-color: $uni-border-color;
border-top-style: solid;
border-top-width: 0.5px;
border-bottom-color: $uni-border-color;
border-bottom-style: solid;
border-bottom-width: 0.5px;
/* #endif */
z-index: -1;
}
/* #ifndef APP-NVUE */
.uni-list--border-top {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 1px;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
background-color: $uni-border-color;
z-index: 1;
}
.uni-list--border-bottom {
position: absolute;
bottom: 0;
right: 0;
left: 0;
height: 1px;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
background-color: $uni-border-color;
}
/* #endif */
</style>
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
"name": "learnScore", "name": "learnScore",
"style": { "style": {
"navigationBarTitleText": "考试成绩", "navigationBarTitleText": "考试成绩",
"navigationStyle": "custom", // "navigationStyle": "custom",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"disableScroll": true "disableScroll": true
} }
......
...@@ -17,17 +17,13 @@ ...@@ -17,17 +17,13 @@
<view class="item" v-for="(data, k) in dataList"> <view class="item" v-for="(data, k) in dataList">
<view class="name">{{ certName[k] }}</view> <view class="name">{{ certName[k] }}</view>
<view class="table"> <view class="table">
<u-table border-color="#9EA5BB"> <t-table @change="change" border-color="#9EA5BB">
<u-tr v-for="(item, i) in data" :key="i" class="u-tr"> <t-tr v-for="item in data" :key="item.id">
<u-td <t-td v-for="(val, name, index) in item" :key="index">{{
v-for="(val, name, index) in item" val
:key="index" }}</t-td>
class="u-td bg-td" </t-tr>
> </t-table>
{{ val }}
</u-td>
</u-tr>
</u-table>
</view> </view>
</view> </view>
</view> </view>
...@@ -41,7 +37,18 @@ ...@@ -41,7 +37,18 @@
</template> </template>
<script> <script>
import tTable from '@/components/t-table/t-table.vue'
import tTh from '@/components/t-table/t-th.vue'
import tTr from '@/components/t-table/t-tr.vue'
import tTd from '@/components/t-table/t-td.vue'
export default { export default {
components: {
tTable,
tTh,
tTr,
tTd,
},
data() { data() {
return { return {
dataList: [], dataList: [],
...@@ -104,6 +111,15 @@ export default { ...@@ -104,6 +111,15 @@ export default {
}, },
}, },
methods: { methods: {
change(e) {
console.log(e.detail)
},
edit(item) {
uni.showToast({
title: item.name,
icon: 'none',
})
},
formatDataByType() { formatDataByType() {
console.log('shoudao param', getApp().globalData.certItemData) console.log('shoudao param', getApp().globalData.certItemData)
if (!getApp().globalData.certItemData) { if (!getApp().globalData.certItemData) {
...@@ -171,7 +187,7 @@ export default { ...@@ -171,7 +187,7 @@ export default {
background-color: #ffffff; background-color: #ffffff;
text-align: center; text-align: center;
border-radius: 12rpx; border-radius: 12rpx;
padding: 30rpx; padding: 24rpx;
position: relative; position: relative;
.top { .top {
height: 116rpx; height: 116rpx;
...@@ -192,15 +208,19 @@ export default { ...@@ -192,15 +208,19 @@ export default {
.table { .table {
/* background-color: #2953ff; */ /* background-color: #2953ff; */
min-height: 200rpx; min-height: 200rpx;
::v-deep .u-td { ::v-deep t-td .t-td {
font-weight: bold; font-size: 22rpx !important;
color: #5a6073; font-weight: bold !important;
padding: 24rpx 2rpx !important;
} }
::v-deep .bg-td:nth-of-type(2n + 1) { ::v-deep t-td:nth-of-type(2n + 1) .t-td {
background-color: #e8ebf3 !important; background-color: #e8ebf3 !important;
font-weight: bold !important;
color: #191c27; color: #191c27;
} }
::v-deep t-td:nth-of-type(2n) .t-td {
background-color: #ffffff !important;
color: #5a6073;
}
} }
} }
.foot { .foot {
...@@ -223,12 +243,5 @@ export default { ...@@ -223,12 +243,5 @@ export default {
font-size: 24rpx; font-size: 24rpx;
color: #5a6073; 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>
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
return this.learnData.startDate || ' ' return this.learnData.startDate || ' '
}, },
learnDate() { learnDate() {
return this.learnData.startDate + '~' + this.learnData.endDate return String(this.learnData.startDate).length > 1 && (this.learnData.startDate + '~' + this.learnData.endDate) || ' '
}, },
name() { name() {
return this.learnData.name || ' ' return this.learnData.name || ' '
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
return this.learnData.idCard || ' ' return this.learnData.idCard || ' '
}, },
company() { company() {
return this.workPlace return this.workPlace || ' '
}, },
subjectName() { subjectName() {
return this.learnData.subjectName || ' ' return this.learnData.subjectName || ' '
...@@ -130,13 +130,13 @@ export default { ...@@ -130,13 +130,13 @@ export default {
return this.learnData.institutionName || '模考大师' return this.learnData.institutionName || '模考大师'
}, },
maxpoint() { maxpoint() {
return this.learnData.maxPoint > 0 && this.learnData.maxPoint || '' return String(this.learnData.startDate).length > 0 ? this.learnData.maxPoint : ''
}, },
learnTime() { learnTime() {
return this.learnData.maxPoint > 0 && this.learnData.time || '' return String(this.learnData.startDate).length > 0 ? this.learnData.time : ''
}, },
resultForTest() { resultForTest() {
return this.learnData.maxPoint > 0 && ((this.learnData.maxPoint > 80 && '合格') || '不合格') || '' return String(this.learnData.startDate).length > 0 ? ((this.learnData.maxPoint >= 80 && '合格') || '不合格') : ''
}, },
}, },
methods: { methods: {
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
background-image: url('https://qn-static.banshouhui.com/study/biantiao@2x.png'); background-image: url('https://qn-static.banshouhui.com/study/biantiao@2x.png');
.head-photo{ .head-photo{
height: 145rpx; height: 145rpx;
padding-left: 260rpx; padding-left: 245rpx;
} }
.table-list { .table-list {
padding: 160rpx 40rpx 0 40rpx; padding: 160rpx 40rpx 0 40rpx;
......
...@@ -277,7 +277,7 @@ export default { ...@@ -277,7 +277,7 @@ export default {
continue continue
} }
let item = {} let item = {}
item.certificateName = res[key].echoMap.questionWarehouseId.title.replace('作业', '证') item.certificateName = res[key].echoMap.questionWarehouseId.title
item.id = res[key].echoMap.questionWarehouseId.id item.id = res[key].echoMap.questionWarehouseId.id
item.bgImage = this.learnCertImage item.bgImage = this.learnCertImage
item.type = 'learn' item.type = 'learn'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<u-navbar <u-navbar
back-icon-color="#333333" back-icon-color="#333333"
background="transparent" background="transparent"
title="题库平台" title="模考大师"
titleColor="#191C27" titleColor="#191C27"
:border-bottom="false" :border-bottom="false"
title-bold title-bold
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<text v-else>{{ title }}</text> <text v-else>{{ title }}</text>
<u-icon class="icon-view" name="arrow-up-fill"></u-icon> <u-icon class="icon-view" name="arrow-up-fill"></u-icon>
</view> </view>
<view>{{ orgIdText }}</view>
<view v-if="noExam" class="tip-view"> <view v-if="noExam" class="tip-view">
<text>您还未选择题库,请先选择题库</text> <text>您还未选择题库,请先选择题库</text>
</view> </view>
...@@ -128,6 +129,9 @@ export default { ...@@ -128,6 +129,9 @@ export default {
} }
}, },
computed: { computed: {
orgIdText() {
return getApp().globalData.orgId
},
title() { title() {
return this.selected.title || '请选择题库' return this.selected.title || '请选择题库'
}, },
...@@ -351,6 +355,12 @@ export default { ...@@ -351,6 +355,12 @@ export default {
}, },
// 每日一练 // 每日一练
handleAnswer() { handleAnswer() {
if (!this.vuex_token) {
this.$u.route({
url: 'pages/login/index',
})
return
}
if (this.info.cardId) { if (this.info.cardId) {
// 练习 // 练习
this.$u.route({ this.$u.route({
...@@ -378,9 +388,6 @@ export default { ...@@ -378,9 +388,6 @@ export default {
}, },
}) })
} else { } else {
// 绑卡提示
// this.type = 'bound'
// this.show = true
this.$u.route({ this.$u.route({
url: 'pages/learn/detail', url: 'pages/learn/detail',
params: { params: {
...@@ -391,12 +398,15 @@ export default { ...@@ -391,12 +398,15 @@ export default {
} }
} else { } else {
this.show = true this.show = true
// this.$u.route({
// url: 'pages/learn/selectCategory',
// })
} }
}, },
handleClickLeftTop() { handleClickLeftTop() {
if (!this.vuex_token) {
this.$u.route({
url: 'pages/login/index',
})
return
}
this.$u.route({ this.$u.route({
url: 'pages/learn/selectCategory', url: 'pages/learn/selectCategory',
}) })
...@@ -413,6 +423,12 @@ export default { ...@@ -413,6 +423,12 @@ export default {
}) })
}, },
handleClickItem(key) { handleClickItem(key) {
if (!this.vuex_token) {
this.$u.route({
url: 'pages/login/index',
})
return
}
if (this.info.id) { if (this.info.id) {
// 跳转到学练记录 // 跳转到学练记录
this.$u.route({ this.$u.route({
...@@ -429,8 +445,6 @@ export default { ...@@ -429,8 +445,6 @@ export default {
} }
}, },
handleClickExperience() { handleClickExperience() {
// this.selected.state = false
// this.$u.vuex('experience', false)
// 体验 // 体验
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
this.$u.route({ this.$u.route({
...@@ -444,6 +458,12 @@ export default { ...@@ -444,6 +458,12 @@ export default {
}) })
}, },
handleClickExam(index) { handleClickExam(index) {
if (!this.vuex_token) {
this.$u.route({
url: 'pages/login/index',
})
return
}
if (this.info.cardId) { if (this.info.cardId) {
// 已绑卡 // 已绑卡
if (index == 0) { if (index == 0) {
...@@ -462,10 +482,6 @@ export default { ...@@ -462,10 +482,6 @@ export default {
} }
} else if (this.info.id) { } else if (this.info.id) {
// 已选题库 // 已选题库
// 绑卡
// this.type = 'bound'
// this.show = true
this.$u.route({ this.$u.route({
url: 'pages/learn/detail', url: 'pages/learn/detail',
params: { params: {
...@@ -476,12 +492,15 @@ export default { ...@@ -476,12 +492,15 @@ export default {
} else { } else {
// 未选题库 // 未选题库
this.show = true this.show = true
// this.$u.route({
// url: 'pages/learn/selectCategory',
// })
} }
}, },
handleClick(path, params) { handleClick(path, params) {
if (!this.vuex_token) {
this.$u.route({
url: 'pages/login/index',
})
return
}
if (this.info.cardId) { if (this.info.cardId) {
if (params) { if (params) {
this.setPageInfo(params) this.setPageInfo(params)
...@@ -492,9 +511,6 @@ export default { ...@@ -492,9 +511,6 @@ export default {
}) })
} else if (this.info.id) { } else if (this.info.id) {
// 已选题库未绑卡 // 已选题库未绑卡
// 绑卡
// this.type = 'bound'
// this.show = true
this.$u.route({ this.$u.route({
url: 'pages/learn/detail', url: 'pages/learn/detail',
params: { params: {
...@@ -503,9 +519,7 @@ export default { ...@@ -503,9 +519,7 @@ export default {
}, },
}) })
} else { } else {
this.$u.route({ this.show = true
url: 'pages/learn/selectCategory',
})
} }
}, },
// getProvinceList() { // getProvinceList() {
...@@ -526,17 +540,15 @@ export default { ...@@ -526,17 +540,15 @@ export default {
} }
}, },
chagefinishCount() { chagefinishCount() {
this.finishCount = this.questionList[this.questionWarehouseId] this.finishCount = this.answerCount[this.questionWarehouseId] || 0
? this.questionList[this.questionWarehouseId].reduce(
(accumulator, currentValue) => {
if (currentValue.submitStatus) accumulator++
return accumulator
},
0
)
: 0
}, },
handleSelectTip() { handleSelectTip() {
if (!this.vuex_token) {
this.$u.route({
url: 'pages/login/index',
})
return
}
this.$u.route({ this.$u.route({
url: 'pages/learn/detail', url: 'pages/learn/detail',
params: { params: {
...@@ -653,7 +665,7 @@ export default { ...@@ -653,7 +665,7 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin: 60rpx 0 160rpx 0; margin: 30rpx 0 160rpx 0;
.sub-content-item { .sub-content-item {
color: #5a6073; color: #5a6073;
font-size: 26rpx; font-size: 26rpx;
...@@ -679,7 +691,7 @@ export default { ...@@ -679,7 +691,7 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.list-view { .list-view {
width: 340rpx; width: 330rpx;
height: 136rpx; height: 136rpx;
border-radius: 16rpx; border-radius: 16rpx;
display: flex; display: flex;
......
...@@ -134,8 +134,9 @@ export default { ...@@ -134,8 +134,9 @@ export default {
}, },
avatar() { avatar() {
return ( return (
(this.student && this.student.avatarPath) || (this.vuex_token &&
(this.userInfo && this.userInfo.avatarUrl) || ((this.student && this.student.avatarPath) ||
this.userInfo.avatarUrl)) ||
this.pic this.pic
) )
}, },
...@@ -256,4 +257,7 @@ page { ...@@ -256,4 +257,7 @@ page {
background-color: white; */ background-color: white; */
} }
} }
::v-deep u-cell-item .u-cell {
padding: 35rpx 32rpx !important;
}
</style> </style>
...@@ -226,11 +226,12 @@ export default { ...@@ -226,11 +226,12 @@ export default {
if (this.source === 3 && this.beginTime) { if (this.source === 3 && this.beginTime) {
const timestamp = Utils.diffTime(this.beginTime, new Date()) const timestamp = Utils.diffTime(this.beginTime, new Date())
this.timestamp = this.currentTime - timestamp this.timestamp = this.currentTime - timestamp
this.$u.vuex('beginTime', '')
} }
}, },
onHide() { onHide() {
// 记录进入后台时间 // 记录进入后台时间
this.$u.vuex('beginTime', new Date()) if (this.source === 3) this.$u.vuex('beginTime', new Date())
}, },
onLoad(e) { onLoad(e) {
if (e?.experience) this.experience = JSON.parse(e.experience) // 体验资格 if (e?.experience) this.experience = JSON.parse(e.experience) // 体验资格
...@@ -274,6 +275,7 @@ export default { ...@@ -274,6 +275,7 @@ export default {
: false : false
if (check) { if (check) {
this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, 0) this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, 0)
this.$u.vuex(`answerCount.${this.questionWarehouseId}`, 0)
this.$u.vuex(`questionList.${this.questionWarehouseId}`, []) this.$u.vuex(`questionList.${this.questionWarehouseId}`, [])
} }
} else if (this.source === 4) { } else if (this.source === 4) {
...@@ -293,15 +295,11 @@ export default { ...@@ -293,15 +295,11 @@ export default {
source: this.source, source: this.source,
} }
uni.showLoading({
title: '加载中',
})
this.$u.api.getQuestionTotal(params).then((res) => { this.$u.api.getQuestionTotal(params).then((res) => {
uni.hideLoading()
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0 let total = parseInt(res) || 0
//if (total > 0) { if (total > 0) {
// 考试 // 考试
if (this.type === 2) { if (this.type === 2) {
this.pageSize = this.totalPoint this.pageSize = this.totalPoint
...@@ -317,7 +315,7 @@ export default { ...@@ -317,7 +315,7 @@ export default {
let index = let index =
this.source === 1 ? this.lastIndex[this.questionWarehouseId] || 0 : 0 this.source === 1 ? this.lastIndex[this.questionWarehouseId] || 0 : 0
this.refresh(i ? i : index) this.refresh(i ? i : index)
//} }
}) })
}, },
// 切换 // 切换
...@@ -348,7 +346,7 @@ export default { ...@@ -348,7 +346,7 @@ export default {
if (currentValue.submitStatus) accumulator++ if (currentValue.submitStatus) accumulator++
return accumulator return accumulator
}, 0) }, 0)
if (count > 1) { if (count > 0) {
this.handPapers() this.handPapers()
return return
} }
...@@ -477,6 +475,7 @@ export default { ...@@ -477,6 +475,7 @@ export default {
`questionList.${this.questionWarehouseId}`, `questionList.${this.questionWarehouseId}`,
this.questionList[this.questionWarehouseId] this.questionList[this.questionWarehouseId]
) )
this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, this.currentIndex) this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, this.currentIndex)
// 统计是否达满所有试题 // 统计是否达满所有试题
...@@ -488,6 +487,10 @@ export default { ...@@ -488,6 +487,10 @@ export default {
0 0
) )
let count = this.answerCount[this.questionWarehouseId] || 0
count+=1
this.$u.vuex(`answerCount.${this.questionWarehouseId}`, count)
if (this.count === this.total) { if (this.count === this.total) {
this.$nextTick(() => { this.$nextTick(() => {
return this.$u.toast('您已经答完全部试题') return this.$u.toast('您已经答完全部试题')
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
> >
<view class="select-area"> <view class="select-area">
<view @click="handleClickArea" class="area-text-view"> <view @click="handleClickArea" class="area-text-view">
<text>{{ currentProvince.label }}</text> <text>{{ currentProvince.label || '请选择' }}</text>
<u-icon name="arrow-down"></u-icon> <u-icon name="arrow-down"></u-icon>
</view> </view>
<view class="loading-view" v-if="loading"> <view class="loading-view" v-if="loading">
...@@ -52,26 +52,6 @@ ...@@ -52,26 +52,6 @@
</view> </view>
</view> </view>
</picker> </picker>
<!-- <view class="select-area">
<view @click="handleClickArea" class="area-text-view">
<text>{{ currentProvince.label }}</text>
<u-icon name="arrow-down"></u-icon>
</view>
<view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
<u-picker
mode="selector"
:range="range"
v-model="show"
:params="params"
safe-area-inset-bottom
cancel-color="#9EA5BB"
confirm-color="#2953FF"
:default-region="defaultRegion"
@confirm="handleConform"
></u-picker>
</view> -->
</view> </view>
<view class="bottom-view"> <view class="bottom-view">
<u-button <u-button
...@@ -80,6 +60,7 @@ ...@@ -80,6 +60,7 @@
shape="circle" shape="circle"
:disabled="buttonDisabled" :disabled="buttonDisabled"
:type="buttonDisabled ? '' : 'primary'" :type="buttonDisabled ? '' : 'primary'"
throttle-time="250"
> >
确定 确定
</u-button> </u-button>
...@@ -131,7 +112,7 @@ export default { ...@@ -131,7 +112,7 @@ export default {
{ id: '1', name: '初训(初次考试)', selected: false }, { id: '1', name: '初训(初次考试)', selected: false },
{ id: '2', name: '复训(年审或换证)', selected: false }, { id: '2', name: '复训(年审或换证)', selected: false },
], ],
currentProvince: { label: '北京市' }, currentProvince: { label: '' },
loading: true, loading: true,
showPop: false, showPop: false,
range: [], range: [],
...@@ -233,11 +214,11 @@ export default { ...@@ -233,11 +214,11 @@ export default {
console.log(res) console.log(res)
this.range = res || [] this.range = res || []
}, },
async handleClickSubmit() { handleClickSubmit() {
if (this.buttonDisabled) return // if (this.buttonDisabled) return
if (this.range.length <= 0 || this.range.length == null) { if (this.range.length <= 0 || this.range.length == null) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '该类型和区域没有的题库', title: '该类型和区域没有该题库',
type: 'warning', type: 'warning',
duration: 1500, duration: 1500,
callback: () => { callback: () => {
...@@ -246,6 +227,7 @@ export default { ...@@ -246,6 +227,7 @@ export default {
}) })
return return
} }
if (this.index == 0) { if (this.index == 0) {
this.changeIndex() this.changeIndex()
} }
...@@ -254,18 +236,18 @@ export default { ...@@ -254,18 +236,18 @@ export default {
type: this.selectedTypeId, type: this.selectedTypeId,
} }
// 获取科目对应的题库 // 获取科目对应的题库
let res = await this.$u.api.getQuestionWarehouse(this.category.id, param) this.$u.api
.getQuestionWarehouse(this.category.id, param)
.then((res) => {
if (res && res.length > 0) { if (res && res.length > 0) {
let data = res[0] let data = res[0]
// 学员增加自己的题库 // 学员增加自己的题库
let result = await this.$u.api this.$u.api
.addQuestionWarehouse({ .addQuestionWarehouse({
questionWarehouseId: data.id, questionWarehouseId: data.id,
}) })
.catch((err) => { .then((result) => {
console.log(err)
})
if (result) { if (result) {
data.isAdd = true data.isAdd = true
this.setPageInfo(data) this.setPageInfo(data)
...@@ -284,9 +266,14 @@ export default { ...@@ -284,9 +266,14 @@ export default {
} else { } else {
this.showPop = false this.showPop = false
} }
})
.catch((err) => {
this.showPop = false
console.log(err)
})
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '该类型和区域没有的题库', title: '该类型和区域没有该题库',
type: 'warning', type: 'warning',
duration: 1500, duration: 1500,
callback: () => { callback: () => {
...@@ -294,6 +281,10 @@ export default { ...@@ -294,6 +281,10 @@ export default {
}, },
}) })
} }
})
.catch((err) => {
console.log(err)
})
}, },
changeIndex() { changeIndex() {
for (var i = 0; i < this.range.length; i++) { for (var i = 0; i < this.range.length; i++) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
></u-navbar> ></u-navbar>
<view class="body-view"> <view class="body-view">
<view class="image-view" <view class="image-view"
><image class="image" :src="successImage"></image ><image class="image" :src="kapianImage" mode="widthFix"></image
></view> ></view>
<view class="content-view"> <view class="content-view">
<view class="field-title">学习卡卡号</view> <view class="field-title">学习卡卡号</view>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<view class="field-view"> <view class="field-view">
<u-input <u-input
class="input-view" class="input-view"
password type="password"
input-align="center" input-align="center"
v-model="password" v-model="password"
placeholder="请输入密码" placeholder="请输入密码"
...@@ -97,6 +97,9 @@ export default { ...@@ -97,6 +97,9 @@ export default {
borderRadius: '12rpx', borderRadius: '12rpx',
} }
}, },
kapianImage() {
return process.uniEnv.qn_base_url + 'kapian.png'
},
placeplaceholderStyle() { placeplaceholderStyle() {
return 'color:#9EA5BB;font-size:28rpx' return 'color:#9EA5BB;font-size:28rpx'
}, },
...@@ -108,6 +111,18 @@ export default { ...@@ -108,6 +111,18 @@ export default {
}, },
methods: { methods: {
handleClick() { handleClick() {
if (!this.code || !this.password) {
this.$refs.uToast.show({
title: '请输入正确的卡号、密码',
type: 'warning',
duration: 1500,
callback: () => {
this.showPop = false
},
})
return
}
this.loading = true this.loading = true
this.$u.api this.$u.api
.bindCard({ .bindCard({
...@@ -142,7 +157,25 @@ export default { ...@@ -142,7 +157,25 @@ export default {
}, },
} }
</script> </script>
<style lang="scss">
.bound-questions {
.u-flex {
display: flex;
justify-content: center;
align-items: center;
// background-color: green;
}
.u-input__right-icon__item {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
// background-color: red;
width: 60rpx;
flex-shrink: 0;
}
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0; width: 0;
...@@ -166,8 +199,8 @@ export default { ...@@ -166,8 +199,8 @@ export default {
text-align: center; text-align: center;
.image { .image {
width: 700rpx; width: 700rpx;
height: 360rpx; // height: 360rpx;
background-color: red; // background-color: red;
border-radius: 24rpx; border-radius: 24rpx;
box-shadow: 0px 10px 16px rgba(29, 53, 155, 0.2); box-shadow: 0px 10px 16px rgba(29, 53, 155, 0.2);
} }
......
...@@ -169,23 +169,23 @@ export default { ...@@ -169,23 +169,23 @@ export default {
onLoad(e) { onLoad(e) {
if (e && e.key) { if (e && e.key) {
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { // setTimeout(() => {
this.scrollId = 'part-' + e.key this.scrollId = 'part-' + e.key
}, 500) // }, 500)
}) })
} }
this.queryExamRecord()
this.chartInit() this.chartInit()
this.queryExamRecord()
}, },
methods: { methods: {
chartInit() { chartInit() {
this.chartData.series = [ this.chartData.series = [
{ {
name: '时间轴1', name: '答题数',
pointShape: "circle", pointShape: 'circle',
legendShape: "circle", legendShape: 'circle',
data: [ data: [
[10000, 55], [10000, 55], // 【日期, 数值】
[30000, 25], [30000, 25],
[50000, 55], [50000, 55],
[70000, 25], [70000, 25],
...@@ -193,9 +193,9 @@ export default { ...@@ -193,9 +193,9 @@ export default {
], ],
}, },
{ {
name: '时间轴2', name: '正确率',
pointShape: "circle", pointShape: 'circle',
legendShape: "circle", legendShape: 'circle',
data: [ data: [
[0, 25], [0, 25],
[20000, 55], [20000, 55],
...@@ -205,6 +205,7 @@ export default { ...@@ -205,6 +205,7 @@ export default {
], ],
}, },
] ]
this.studyRecord()
}, },
// 每日一练统计 // 每日一练统计
everyTaskList(year, month) { everyTaskList(year, month) {
...@@ -230,6 +231,37 @@ export default { ...@@ -230,6 +231,37 @@ export default {
console.log(err) console.log(err)
}) })
}, },
// 练习分析
studyRecord(start, end) {
var params = {}
if (!start || !end) {
// 近七天
end = new Date().getTime()
start = new Date().setDate(new Date().getDay() - 6)
}
console.log(
'---------start---------',
start,
'---------start---------',
end
)
params = {
startDate: this.$u.timeFormat(start, 'yyyy-mm-dd'),
endDate: this.$u.timeFormat(end, 'yyyy-mm-dd'),
}
this.$u.api
.studyRecord(this.questionWarehouseId, params)
.then((res) => {
console.log('----------studyRecord------------', res)
// this.days = []
// for (var item of res) {
// this.days.push(item.time.replace(/\-0/g, '\-'))
// }
})
.catch((err) => {
console.log(err)
})
},
// 模考记录 // 模考记录
queryExamRecord() { queryExamRecord() {
this.recordParams.current += 1 this.recordParams.current += 1
...@@ -295,8 +327,8 @@ export default { ...@@ -295,8 +327,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.record-view { .record-view {
display: flex; // display: flex;
flex-direction: column; // flex-direction: column;
height: 100vh; height: 100vh;
position: relative; position: relative;
background-color: #f7f9fc; background-color: #f7f9fc;
...@@ -340,7 +372,7 @@ export default { ...@@ -340,7 +372,7 @@ export default {
} }
border-radius: 24rpx 24rpx 0 0; border-radius: 24rpx 24rpx 0 0;
background-color: #ffffff; background-color: #ffffff;
height: 100%; height: calc(100vh - 178px);
overflow: auto; overflow: auto;
.scroll-view { .scroll-view {
height: 100%; height: 100%;
...@@ -406,6 +438,7 @@ export default { ...@@ -406,6 +438,7 @@ export default {
.charts-content { .charts-content {
width: 100%; width: 100%;
height: 570rpx; height: 570rpx;
padding: 0 24rpx 10rpx 0rpx;
.charts-box { .charts-box {
width: 100%; width: 100%;
height: 570rpx; height: 570rpx;
...@@ -413,10 +446,10 @@ export default { ...@@ -413,10 +446,10 @@ export default {
} }
} }
.list-view { .list-view {
padding-bottom: 20rpx; padding-bottom: 44rpx;
.list-content { .list-content {
padding: 0 30rpx 20rpx 30rpx; padding: 0 30rpx 20rpx 30rpx;
min-height: 44rpx;
.show-more { .show-more {
display: flex; display: flex;
justify-content: center; justify-content: center;
......
<template> <template>
<view class="score-view"> <view class="score-view">
<u-navbar <!-- <u-navbar
back-icon-color="#191C27" back-icon-color="#191C27"
background="transparent" background="transparent"
title="考试成绩" title="考试成绩"
...@@ -8,13 +8,20 @@ ...@@ -8,13 +8,20 @@
:border-bottom="false" :border-bottom="false"
title-bold title-bold
:custom-back="customBack" :custom-back="customBack"
></u-navbar> ></u-navbar> -->
<scroll-view
scroll-y="true"
class="scroll-view"
scroll-anchoring
enable-back-to-top
>
<view <view
class="top-view" class="top-view"
v-if="!isFull" v-if="!isFull"
@click="$u.throttle(handleClickRecord, 500)" @click="$u.throttle(handleClickRecord, 500)"
> >
考试错题已自动加入<text class="blue-text">"错题记录"</text> 方便练习</view 考试错题已自动加入<text class="blue-text">"错题记录"</text>
方便练习</view
> >
<view :class="['content', { 'is-full': isFull }]"> <view :class="['content', { 'is-full': isFull }]">
<view class="content-view"> <view class="content-view">
...@@ -32,7 +39,9 @@ ...@@ -32,7 +39,9 @@
<view class="progress-content"> <view class="progress-content">
<view class="progress-score">{{ info.score }}</view> <view class="progress-score">{{ info.score }}</view>
<view class="progress-info">{{ resultText }}</view> <view class="progress-info">{{ resultText }}</view>
<view class="percent-text">超越了{{ falsePercent }}%的学员</view> <view class="percent-text"
>超越了{{ falsePercent }}%的学员</view
>
</view> </view>
</CircleProgress> </CircleProgress>
</view> </view>
...@@ -65,6 +74,7 @@ ...@@ -65,6 +74,7 @@
</u-button> </u-button>
</view> </view>
</view> </view>
</scroll-view>
<u-mask :show="show" @click="show = false"> <u-mask :show="show" @click="show = false">
<view class="tip-view"> <view class="tip-view">
<image class="tip-image" :src="jiantouImage"></image> <image class="tip-image" :src="jiantouImage"></image>
...@@ -162,14 +172,15 @@ export default { ...@@ -162,14 +172,15 @@ export default {
return this.$u.random(random[0], random[1]) return this.$u.random(random[0], random[1])
}, },
}, },
onLoad(e) { onLoad() {
if (!e) { let options = wx.getLaunchOptionsSync()
if (!options.query?.id) {
this.$u.route({ this.$u.route({
url: 'pages/index/index', url: 'pages/index/index',
type: 'tab', type: 'tab',
}) })
} }
this.init(e?.id) this.init(options.query?.id)
}, },
methods: { methods: {
init(id) { init(id) {
...@@ -199,7 +210,7 @@ export default { ...@@ -199,7 +210,7 @@ export default {
url: 'pages/learn/answer', url: 'pages/learn/answer',
params: { params: {
source: 5, source: 5,
} },
}) })
}, },
handleClick() { handleClick() {
...@@ -211,26 +222,28 @@ export default { ...@@ -211,26 +222,28 @@ export default {
customBack() { customBack() {
this.$u.route({ this.$u.route({
type: 'tab', type: 'tab',
url: 'pages/index/index' url: 'pages/index/index',
}) })
} },
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::-webkit-scrollbar { .score-view {
// display: flex;
// flex-direction: column;
height: 100vh;
background-color: #f7f9fc;
::-webkit-scrollbar {
width: 0; width: 0;
height: 0; height: 0;
color: transparent; color: transparent;
display: none; display: none;
} }
.score-view { .scroll-view {
display: flex;
flex-direction: column;
height: 100vh; height: 100vh;
background-color: #f7f9fc; }
.top-view { .top-view {
background-color: rgba(250, 90, 73, 0.1); background-color: rgba(250, 90, 73, 0.1);
color: #5a6073; color: #5a6073;
...@@ -243,8 +256,6 @@ export default { ...@@ -243,8 +256,6 @@ export default {
} }
} }
.content { .content {
height: 100%;
overflow: auto;
padding: 64rpx 48rpx 44rpx 48rpx; padding: 64rpx 48rpx 44rpx 48rpx;
&.is-full { &.is-full {
padding-top: 0rpx; padding-top: 0rpx;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<view class="selected-list-content"> <view class="selected-list-content">
<view class="label-content"> <view class="label-content">
<view <view
v-for="(item, index) in lables" v-for="(item, index) in showLabels"
:key="index" :key="index"
class="special-item" class="special-item"
hover-class="hover-class" hover-class="hover-class"
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<image :src="item.image" class="item-image"></image> <image :src="item.image" class="item-image"></image>
<view class="item-title">{{ item.title }}</view> <view class="item-title">{{ item.title }}</view>
<view <view
>共<text class="item-count">{{ info[item.key] }}</text >共<text class="item-count">{{ item.number }}</text
>道</view >道</view
> >
</view> </view>
...@@ -43,35 +43,39 @@ export default { ...@@ -43,35 +43,39 @@ export default {
}, },
computed: { computed: {
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
lables() { lables() {
return [ return [
{ {
key: 'oneAnswerCount', number: this.info['oneAnswerCount'],
title: '单选题', title: '单选题',
source: 6, source: 6,
image: process.uniEnv.qn_base_url + 'danxuan.png', image: process.uniEnv.qn_base_url + 'danxuan.png',
}, },
{ {
key: 'anyAnswerCount', number: this.info['anyAnswerCount'],
title: '多选题', title: '多选题',
source: 7, source: 7,
image: process.uniEnv.qn_base_url + 'duoxuan.png', image: process.uniEnv.qn_base_url + 'duoxuan.png',
}, },
{ {
key: 'trueOrFalseCount', number: this.info['trueOrFalseCount'],
title: '判断题', title: '判断题',
source: 8, source: 8,
image: process.uniEnv.qn_base_url + 'panduan.png', image: process.uniEnv.qn_base_url + 'panduan.png',
}, },
{ {
key: 'trueAnswerCount', number: this.info['trueAnswerCount'],
title: '判断题(结果为正确)', title: '判断题(结果为正确)',
source: 9, source: 9,
image: process.uniEnv.qn_base_url + 'zhengquepanduanti.png', image: process.uniEnv.qn_base_url + 'zhengquepanduanti.png',
}, },
] ]
}, },
showLabels() {
return this.lables.filter((item) => {
return item.number > 0
})
},
}, },
onLoad(e) { onLoad(e) {
this.getPageInfo() this.getPageInfo()
...@@ -87,6 +91,7 @@ export default { ...@@ -87,6 +91,7 @@ export default {
}, },
// 点击了添加按钮 // 点击了添加按钮
handleClick(source) { handleClick(source) {
this.$nextTick(() => {
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
this.$u.route({ this.$u.route({
url: 'pages/learn/answer', url: 'pages/learn/answer',
...@@ -94,6 +99,7 @@ export default { ...@@ -94,6 +99,7 @@ export default {
source: source, source: source,
}, },
}) })
})
}, },
}, },
} }
......
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
case 5: case 5:
status = '已绑定' status = '已绑定'
data[i].statusStyle = { color: '#2953FF' } data[i].statusStyle = { color: '#2953FF' }
data[i].subtitle = '请前往首页答题联系吧' data[i].subtitle = '请前往首页答题练习吧'
break break
case 10: case 10:
status = '已激活' status = '已激活'
...@@ -95,7 +95,10 @@ export default { ...@@ -95,7 +95,10 @@ export default {
res[i].echoMap.cardId && res[i].echoMap.cardId &&
res[i].echoMap.cardId.activationTime res[i].echoMap.cardId.activationTime
) { ) {
let diff = this.datedifference(sDate1, sDate2) let diff = this.datedifference(
res[i].echoMap.cardId.activationTime.split(' ')[0],
this.getTodayDate()
)
leaveDay = res[i].echoMap.cardId.effectiveDay - diff leaveDay = res[i].echoMap.cardId.effectiveDay - diff
leaveDay = leaveDay > 0 ? leaveDay : 0 leaveDay = leaveDay > 0 ? leaveDay : 0
} }
...@@ -118,6 +121,19 @@ export default { ...@@ -118,6 +121,19 @@ export default {
} }
}) })
}, },
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) { datedifference(sDate1, sDate2) {
//2021-01-01,2020-02-01,31 //2021-01-01,2020-02-01,31
var dateSpan, tempDate, iDays var dateSpan, tempDate, iDays
......
...@@ -147,7 +147,7 @@ export default { ...@@ -147,7 +147,7 @@ export default {
}, },
getFront() { getFront() {
//身份证正面图片识别 //身份证正面图片识别
upload.getPhoto(1, this.token).then((res) => { upload.getPhoto(2, this.token).then((res) => {
this.student.identityFrontPath = res.key this.student.identityFrontPath = res.key
this.$u.api this.$u.api
.getCertifyInfoByType('front', { .getCertifyInfoByType('front', {
...@@ -165,7 +165,7 @@ export default { ...@@ -165,7 +165,7 @@ export default {
}, },
getBack() { getBack() {
//身份证反面图片识别 //身份证反面图片识别
upload.getPhoto(1, this.token).then((res) => { upload.getPhoto(2, this.token).then((res) => {
this.student.identityBackPath = res.key this.student.identityBackPath = res.key
this.$u.api this.$u.api
.getCertifyInfoByType('back', { .getCertifyInfoByType('back', {
......
...@@ -42,14 +42,24 @@ export default { ...@@ -42,14 +42,24 @@ export default {
}) })
}, },
logout() { logout() {
this.$u.vuex('vuex_token', '') let that = this
this.$u.vuex('openId', '') uni.showModal({
this.$u.vuex('userInfo', {}) title: '提示',
content: '确认退出当前账号',
success: function(res) {
if (res.confirm) {
that.$u.vuex('vuex_token', '')
that.$u.vuex('openId', '')
that.$u.vuex('userInfo', {})
setTimeout(() => { setTimeout(() => {
this.$u.route({ that.$u.route({
type: 'back', type: 'back',
}) })
}, 1000) }, 800)
} else if (res.cancel) {
}
},
})
}, },
}, },
} }
......
...@@ -27,62 +27,12 @@ ...@@ -27,62 +27,12 @@
>道</view >道</view
> >
<view class="result"> <view class="result">
<uni-list :border="false"> <my-section
<view v-for="(item, index) in section"
v-for="item in lists" :key="index"
:key="item.id" :begin="item.begin"
@click.stop="itemChange(item.id)" :end="item.end"
class="list-item" ></my-section>
>
<view
:class="['u-flex', 'head', { selected: item.id === arrIndex }]"
>
<view class="titles">
<text>{{ item.type }}</text
>{{ item.title }}
</view>
<view class="u-flex arrow" v-show="item.id !== arrIndex">
<text>展开</text>
<u-icon name="arrow-down" color="#9EA5BB"></u-icon>
</view>
</view>
<view class="u-flex subject" v-show="item.id === arrIndex">
<view class="content">
<answer-sheet
ref="answerSheet"
:answerList="item.answerList"
:rightKey="item.rightKey"
:multiple="item.type === 3"
:submitStatus="item.submitStatus"
:btnStatus="false"
@change="answerChange"
></answer-sheet>
</view>
<view class="explain">
<answer-explanation
:answer="item.answer"
:explain="item.explain"
></answer-explanation>
</view>
</view>
<view class="u-flex opera" v-show="item.id === arrIndex">
<view class="opera-list" @click="collection(item)">
<u-image
:src="collectImg"
width="36"
height="36"
:fade="false"
:lazy-load="false"
/>
<text>{{ collectionFlag ? '已收藏' : '收藏' }}</text>
</view>
<view class="opera-list" @click.stop="arrowUp(index)">
<text>收起</text>
<u-icon name="arrow-up" color="#9EA5BB"></u-icon>
</view>
</view>
</view>
</uni-list>
<u-loadmore :status="loadStatus" :margin-bottom="40" /> <u-loadmore :status="loadStatus" :margin-bottom="40" />
</view> </view>
</view> </view>
...@@ -99,14 +49,11 @@ ...@@ -99,14 +49,11 @@
</template> </template>
<script> <script>
import answerSheet from '@/components/answer-sheet/index.vue' import { list } from './list.js'
import answerExplanation from '@/components/answer-explanation/index.vue' import mySection from './my-section.vue'
import uniList from '@/components/uni-list/uni-list.vue'
export default { export default {
components: { components: {
answerSheet, mySection,
answerExplanation,
uniList,
}, },
data() { data() {
return { return {
...@@ -117,26 +64,21 @@ export default { ...@@ -117,26 +64,21 @@ export default {
pageSize: 10, pageSize: 10,
loadStatus: 'loadmore', loadStatus: 'loadmore',
isLoadMore: false, //是否加载中 isLoadMore: false, //是否加载中
total: 0 total: 0,
section: [],
} }
}, },
onLoad(e) { onLoad(e) {
this.keyword = e ? decodeURIComponent(e.keyword) : '' this.keyword = e ? decodeURIComponent(e.keyword) : ''
this.lists = list
},
onReady() {
this.init() this.init()
}, },
computed: { computed: {
defaultImg() { defaultImg() {
return process.uniEnv.qn_base_url + 'no-search.png' return process.uniEnv.qn_base_url + 'no-search.png'
}, }
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() {
const info = this.lists.find((v) => v.index === this.arrIndex)
return info ? info.collectionFlag : false
},
}, },
onReachBottom() { onReachBottom() {
//上拉触底函数 //上拉触底函数
...@@ -156,16 +98,17 @@ export default { ...@@ -156,16 +98,17 @@ export default {
size: this.pageSize, size: this.pageSize,
} }
uni.showLoading({
title: '加载中',
})
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.$u.api.searchQuestion(data).then((res) => { this.$u.api.searchQuestion(data).then((res) => {
uni.hideLoading()
this.total = res.total this.total = res.total
const lists = const records = res?.records || []
res?.records.length > 0 if (records.length === 0) {
? res?.records.map(v => { this.loadStatus = 'nomore'
return
}
for (let i = 0; i < records.length; i++) {
const v = records[i]
const rightKey = v.answer.split(',') const rightKey = v.answer.split(',')
const content = JSON.parse(v.content) const content = JSON.parse(v.content)
const answerList = content.choiceList.map((item) => { const answerList = content.choiceList.map((item) => {
...@@ -177,7 +120,7 @@ export default { ...@@ -177,7 +120,7 @@ export default {
} }
}) })
return { this.lists.push({
id: v.id, id: v.id,
answer: v.answer, answer: v.answer,
title: content.title, title: content.title,
...@@ -187,24 +130,24 @@ export default { ...@@ -187,24 +130,24 @@ export default {
rightKey: rightKey, rightKey: rightKey,
collectionFlag: v.collectionFlag, collectionFlag: v.collectionFlag,
submitStatus: true, submitStatus: true,
})
} }
this.section.push({
begin: this.lists.length - records.length,
end: this.lists.length,
}) })
: []
this.lists = this.lists.concat(lists) if (records.length < this.pageSize) {
if (res.records.length < this.pageSize) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页 //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true this.isLoadMore = true
this.loadStatus = 'nomore' this.loadStatus = 'nomore'
} else { } else {
this.loadStatus = 'loadmore'
this.isLoadMore = false this.isLoadMore = false
} }
this.status = 'nomore'
}) })
}, },
itemChange(e) {
this.arrIndex = e
},
search(val) { search(val) {
if (val) { if (val) {
this.keyword = val this.keyword = val
...@@ -214,23 +157,12 @@ export default { ...@@ -214,23 +157,12 @@ export default {
history.splice(9, 1) history.splice(9, 1)
} }
this.$u.vuex('searchHistory', history) this.$u.vuex('searchHistory', history)
this.currentPage = 1
this.lists = [] this.lists = []
this.section = []
this.init() this.init()
} }
},
collection(item) {
const action = item.collectionFlag ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({ questionId: item.id }).then((res) => {
if (res) {
const msg = item.collectionFlag ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg)
item.collectionFlag = !item.collectionFlag
} }
})
},
arrowUp() {
this.arrIndex = ''
},
}, },
} }
</script> </script>
...@@ -264,87 +196,6 @@ export default { ...@@ -264,87 +196,6 @@ export default {
.result { .result {
margin-top: 30rpx; margin-top: 30rpx;
width: 100%; width: 100%;
.list-item {
background: #fff;
padding: 30rpx 20rpx;
margin: 10rpx 0;
border-radius: 30rpx 30rpx 0 0;
.head {
width: 100%;
height: 60rpx;
overflow: hidden;
.titles {
color: #191c27;
font-size: 32rpx;
line-height: 50rpx;
font-weight: bold;
flex: 1;
height: 60rpx;
overflow: hidden;
text {
background: #9ea5bb;
color: #fff;
padding: 8rpx 20rpx;
margin-right: 10rpx;
font-size: 20rpx;
border-radius: 50rpx 0 50rpx 50rpx;
}
}
.arrow {
padding-left: 20rpx;
margin-top: -10rpx;
text {
color: #2953ff;
font-size: 28rpx;
padding-right: 10rpx;
}
}
}
.selected {
height: auto;
overflow: auto;
.titles {
height: auto;
overflow: auto;
}
}
.subject {
flex-flow: column;
.type {
width: 100%;
text-align: left;
padding: 20rpx 0;
}
.content {
width: 100%;
}
.explain,
.btn {
width: 100%;
padding-top: 50rpx;
}
}
.opera {
padding-top: 30rpx;
justify-content: space-between;
color: #5a6073;
font-size: 28rpx;
.opera-list {
display: flex;
&:nth-of-type(1) {
text {
padding-left: 10rpx;
}
}
&:nth-of-type(2) {
text {
padding-right: 10rpx;
color: #2953ff;
}
}
}
}
}
} }
.default { .default {
flex-flow: column; flex-flow: column;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
bg-color="#fff" bg-color="#fff"
v-model="keyword" v-model="keyword"
@custom="search" @custom="search"
@search="search"
></u-search> ></u-search>
</view> </view>
......
export const list = []
\ No newline at end of file
<template>
<view>
<search-item
v-for="(item, index) in list"
:key="index"
:item="item"
:arrIndex.sync="arrIndex"
@arrowDown="arrowDown"
@arrowUp="arrowUp"
@collection="collection($event, index)"
></search-item>
</view>
</template>
<script>
import { list } from './list.js'
import searchItem from '@/components/search-item/index.vue'
export default {
components: {
searchItem,
},
props: ['begin', 'end'],
data() {
return {
list: [],
arrIndex: '',
}
},
created() {
this.list = list.slice(this.begin, this.end)
},
methods: {
arrowDown(e) {
this.arrIndex = e
},
arrowUp() {
this.arrIndex = ''
},
collection(item, index) {
const action = item.collectionFlag ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({ questionId: item.id }).then((res) => {
if (res) {
const msg = item.collectionFlag ? '取消收藏成功' : '收藏成功'
this.$u.toast(msg)
this.$set(this.list[index], 'collectionFlag', !item.collectionFlag)
}
})
},
},
}
</script>
...@@ -15,11 +15,11 @@ let saveStateKeys = [ ...@@ -15,11 +15,11 @@ let saveStateKeys = [
'vuex_token', 'vuex_token',
'openId', 'openId',
'searchHistory', 'searchHistory',
'questionList',
'lastIndex', 'lastIndex',
'tipStatus', 'tipStatus',
'questionWarehouseId', 'questionWarehouseId',
'relationId', // 绑卡用 'relationId', // 绑卡用
'answerCount'
] ]
// 保存变量到本地存储中 // 保存变量到本地存储中
...@@ -45,7 +45,7 @@ const store = new Vuex.Store({ ...@@ -45,7 +45,7 @@ const store = new Vuex.Store({
openId: lifeData.openId ? lifeData.openId : '', openId: lifeData.openId ? lifeData.openId : '',
relationId: lifeData.relationId ? lifeData.relationId : '', // 绑卡用 relationId: lifeData.relationId ? lifeData.relationId : '', // 绑卡用
searchHistory: lifeData.searchHistory ? lifeData.searchHistory : [], // 搜索历史记录 searchHistory: lifeData.searchHistory ? lifeData.searchHistory : [], // 搜索历史记录
questionList: lifeData.questionList ? lifeData.questionList : {}, // 练习列表 answerCount: lifeData.answerCount ? lifeData.answerCount : {},// 已回答题数
lastIndex: lifeData.lastIndex ? lifeData.lastIndex : {}, // 上次做到第几题 lastIndex: lifeData.lastIndex ? lifeData.lastIndex : {}, // 上次做到第几题
tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示 tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示
questionWarehouseId: lifeData.questionWarehouseId questionWarehouseId: lifeData.questionWarehouseId
...@@ -53,6 +53,7 @@ const store = new Vuex.Store({ ...@@ -53,6 +53,7 @@ const store = new Vuex.Store({
: '1414854649273384960', // 科目ID : '1414854649273384960', // 科目ID
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0', vuex_version: '1.0.0',
questionList: {}, // 练习列表
beginTime: null // 考试开始时间 beginTime: null // 考试开始时间
}, },
mutations: { mutations: {
......
...@@ -269,11 +269,11 @@ export default { ...@@ -269,11 +269,11 @@ export default {
blur() { blur() {
// 最开始使用的是监听图标@touchstart事件,自从hx2.8.4后,此方法在微信小程序出错 // 最开始使用的是监听图标@touchstart事件,自从hx2.8.4后,此方法在微信小程序出错
// 这里改为监听点击事件,手点击清除图标时,同时也发生了@blur事件,导致图标消失而无法点击,这里做一个延时 // 这里改为监听点击事件,手点击清除图标时,同时也发生了@blur事件,导致图标消失而无法点击,这里做一个延时
setTimeout(() => { // setTimeout(() => {
this.focused = false; // this.focused = false;
}, 100) // }, 100)
this.show = false; // this.show = false;
this.$emit('blur', this.keyword); // this.$emit('blur', this.keyword);
}, },
// 点击搜索框,只有disabled=true时才发出事件,因为禁止了输入,意味着是想跳转真正的搜索页 // 点击搜索框,只有disabled=true时才发出事件,因为禁止了输入,意味着是想跳转真正的搜索页
clickHandler() { clickHandler() {
......
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