Commit 96ab3b90 authored by Facius's avatar Facius

improvement: 专项列表

parent 086b3467
......@@ -152,6 +152,16 @@
"disableScroll": true
}
},
{
"path": "selectSpecial",
"name": "learnSelectSpecial",
"style": {
"navigationBarTitleText": "专项练习",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},
{
"path": "beginAnswer",
"name": "learnBeginAnswer",
......
......@@ -69,7 +69,7 @@
v-for="(item, index) in subItems"
:key="index"
class="sub-content-item"
@click="handleClick(item.pathName)"
@click="handleClick(item.pathName, item.params)"
>
<view class="sub-image">
<image :src="item.icon" :style="item.imageStyle"></image>
......@@ -143,9 +143,7 @@ export default {
},
examText() {
return this.selected.cardId
? '/' + this.selected.totalExam
: '题库进阶练习'
return this.info.cardId ? '/' + this.selected.totalExam : '题库进阶练习'
},
info() {
return {
......@@ -164,11 +162,12 @@ export default {
subItems() {
return [
{
pathName: 'pages/xxx/xxx',
pathName: 'pages/learn/selectSpecial',
title: '专项练习',
value: '',
icon: process.uniEnv.qn_base_url + 'zhuanxiang.png',
imageStyle: 'width:72rpx;height:64rpx',
params: this.data,
},
{
pathName: '/pages/learn/answer?source=5',
......@@ -268,17 +267,17 @@ export default {
},
handleSelect() {
var str = this.selected.id ? 'selectedList' : 'selectCategory'
var str = this.info.id ? 'selectedList' : 'selectCategory'
this.$u.route({
url: 'pages/learn/' + str,
})
},
// 每日一练
handleAnswer() {
if (this.selected.cardId) {
if (this.info.cardId) {
// 练习
// ...
} else if (this.selected.id) {
} else if (this.info.id) {
if (this.info.experience) {
this.selected.state = false
this.$u.vuex('experience', false)
......@@ -315,7 +314,7 @@ export default {
})
},
handleClickItem(key) {
if (this.selected.id) {
if (this.info.id) {
// 跳转到学练记录
this.$u.route({
url: 'pages/learn/record?part=',
......@@ -342,7 +341,7 @@ export default {
})
},
handleClickExam(index) {
if (this.selected.cardId) {
if (this.info.cardId) {
// 已绑卡
if (index == 0) {
// 做题
......@@ -358,7 +357,7 @@ export default {
url: 'pages/learn/beginAnswer',
})
}
} else if (this.selected.id) {
} else if (this.info.id) {
// 已选题库
// 绑卡
......@@ -371,14 +370,24 @@ export default {
})
}
},
handleClick(path) {
if (!this.selected.id) {
handleClick(path, params) {
debugger
if (this.info.cardId) {
if (params) {
this.setPageInfo(params)
}
// 已经绑卡
this.$u.route({
url: 'pages/learn/selectCategory',
url: path,
})
} else if (this.info.id) {
// 已选题库未绑卡
// 绑卡
this.type = 'bound'
this.show = true
} else {
this.$u.route({
url: path,
url: 'pages/learn/selectCategory',
})
}
},
......@@ -387,6 +396,13 @@ export default {
console.log(res)
this.provinceList = res
},
setPageInfo(info) {
var pages = getCurrentPages()
if (pages.length >= 1) {
var page = pages[pages.length - 1]
page.info = info
}
},
},
}
</script>
......
......@@ -10,7 +10,22 @@
></u-navbar>
<view class="selected-list-content">
<view class="label-content">
<view v-for="(value, key) in lables" :key="key" class="label-item">
<view
v-for="(item, index) in lables"
:key="index"
class="special-item"
hover-class="hover-class"
@click="handleClick(item.source)"
>
<view class="left-view">
<image :src="item.image" class="item-image"></image>
<view class="item-title">{{ item.title }}</view>
<view
>共<text class="item-count">{{ info[item.key] }}</text
>道</view
>
</view>
<u-icon name="arrow-right" class="item-icon"></u-icon>
</view>
</view>
<!-- 无数据 -->
......@@ -20,42 +35,65 @@
</template>
<script>
import QuestionBankCell from '@/components/question-bank-cell'
export default {
components: {
QuestionBankCell,
},
data() {
return {
info: {}, // 已选题库列表
loading: true,
}
},
computed: {
lables() {
return {
oneAnswerCount: '单选题',
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
anyAnswerCount: '多选题',
trueOrFalseCount: '判断题',
trueAnswerCount: '判断题(结果为正确)',
}
lables() {
return [
{
key: 'oneAnswerCount',
title: '单选题',
source: 6,
image: process.uniEnv.qn_base_url + 'danxuan.png',
},
{
key: 'anyAnswerCount',
title: '多选题',
source: 7,
image: process.uniEnv.qn_base_url + 'duoxuan.png',
},
{
key: 'trueOrFalseCount',
title: '判断题',
source: 8,
image: process.uniEnv.qn_base_url + 'panduan.png',
},
{
key: 'trueAnswerCount',
title: '判断题(结果为正确)',
source: 9,
image: process.uniEnv.qn_base_url + 'zhengquepanduanti.png',
},
]
},
},
onLoad(e) {
this.loadList() // 获取已选题库列表
this.getPageInfo()
},
methods: {
getPageInfo() {
var pages = getCurrentPages()
if (pages.length >= 2) {
var page = pages[pages.length - 2]
this.selected = page.info
this.info = page.info
}
},
// 点击了添加按钮
handleClick(index) {},
handleClick(source) {
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
this.$u.route({
url: 'pages/learn/answer',
params: {
source: source,
},
})
},
},
}
</script>
......@@ -76,7 +114,7 @@ export default {
background-image: linear-gradient(to top, #f8fafd 0%, #e9f3ff 50%);
background-size: 100% 520rpx;
background-repeat: no-repeat;
padding: 0 24rpx 0rpx 24rpx;
padding: 0 24rpx;
.selected-list-content {
height: 100%;
......@@ -84,28 +122,43 @@ export default {
.label-content {
margin-bottom: 44rpx;
.label-item {
margin-bottom: 24rpx;
.special-item {
margin-top: 24rpx;
background-color: #ffffff;
border-radius: 12rpx;
padding: 0 24rpx 0 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
height: 142rpx;
.left-view {
display: flex;
align-items: center;
color: #5a6073;
font-size: 32rpx;
.item-image {
width: 48rpx;
height: 48rpx;
}
.item-title {
font-size: 36rpx;
font-weight: bold;
color: #191c27;
padding: 0 16rpx 0 24rpx;
}
.item-count {
color: #2953ff;
padding: 0 4rpx;
}
}
.item-icon {
color: #9ea5bb;
font-size: 34rpx;
}
}
.hover-class {
background-color: #dddddd;
}
}
}
.tag-loading-view {
display: flex;
align-items: center;
justify-content: center;
margin-top: 400rpx;
color: #999999;
text-align: center;
position: absolute;
width: 100%;
padding-right: 11rpx;
}
.bottom-view {
margin-bottom: 44rpx;
.button-icon {
margin-right: 10rpx;
font-size: 46rpx;
font-weight: bold;
}
}
}
......
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