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