Commit 5056bd09 authored by Facius's avatar Facius

feat: 已选题库页面

parent 448a0312
<template>
<view class="question-bank-cell">
<view class="label-normal">
<view>{{ info.name }}</view>
<view class="label-text">
共
<text class="label-blue">{{ info.quantity }}</text
>道精编试题,通过率
<text class="label-blue">{{ info.pass }}</text>
</view>
</view>
<u-button
v-if="!isNone"
:customStyle="buttonStyle"
@click="handleClick(index)"
type="primary"
>
<u-icon v-if="isAdd" class="button-icon" name="plus"></u-icon
>{{ buttonText }}
</u-button>
</view>
</template>
<script>
export default {
props: {
type: {
// add: '添加';change: '切换'; // none: 无按钮
type: String,
default: 'none',
},
info: {
type: Object,
default() {
return {}
},
},
},
data() {
return {}
},
computed: {
isAdd() {
return this.type == 'add'
},
isNone() {
return this.type == 'none'
},
buttonText() {
var text = ''
switch (this.type) {
case 'add':
text = '添加'
break
case 'change':
text = '切换'
break
case 'none':
default:
break
}
return text
},
buttonStyle() {
return {
width: '120rpx',
height: '64rpx',
backgroundColor: '#2953FF',
color: '#FFFFFF',
fontSize: '26rpx',
borderRadius: '12rpx',
}
},
},
methods: {
handleClick() {
this.$emit('action', this.info, this.type)
},
},
}
</script>
<style lang="scss" scoped>
.question-bank-cell {
padding: 40rpx 24rpx 40rpx 30rpx;
background-color: #ffffff;
border-radius: 12rpx;
display: flex;
justify-content: space-between;
align-items: center;
.label-normal {
width: 470rpx;
font-size: 36rpx;
color: #191c27;
font-weight: bold;
word-break: break-all;
.label-text {
margin-top: 24rpx;
font-size: 26rpx;
color: #5a6073;
.label-blue {
color: #2953ff;
padding-left: 6rpx;
padding-right: 6rpx;
}
}
}
.button-icon {
margin-right: 4rpx;
font-size: 28rpx;
font-weight: bold;
}
}
</style>
...@@ -84,6 +84,16 @@ ...@@ -84,6 +84,16 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"disableScroll": true "disableScroll": true
} }
},
{
"path": "selectedList",
"name": "learnSelectedList",
"style": {
"navigationBarTitleText": "已选题库",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
} }
] ]
}, },
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
:border-bottom="false" :border-bottom="false"
title-bold title-bold
></u-navbar> ></u-navbar>
<!-- 类别 -->
<view> <view>
<view class="category-view"> <view class="category-view">
<text>{{ category.name }}</text> <text>{{ category.name }}</text>
...@@ -20,23 +19,11 @@ ...@@ -20,23 +19,11 @@
<view class="add-exam-content"> <view class="add-exam-content">
<view class="label-content"> <view class="label-content">
<view v-for="(label, index) in list" :key="index" class="label-item"> <view v-for="(label, index) in list" :key="index" class="label-item">
<!-- 选中为蓝底,非选中状态为白底 --> <QuestionBankCell
<view class="label-normal"> :info="label"
<view>{{ label.name }}</view> type="add"
<view class="label-text"> @action="handleClick(index)"
共 ></QuestionBankCell>
<text class="label-blue">{{ label.quantity }}</text
>道精编试题,通过率
<text class="label-blue">{{ label.pass }}</text>
</view>
</view>
<u-button
:customStyle="buttonStyle"
@click="handleClick(index)"
type="primary"
>
<u-icon name="plus"></u-icon>添加
</u-button>
</view> </view>
</view> </view>
<!-- 标签加载中 --> <!-- 标签加载中 -->
...@@ -52,9 +39,14 @@ ...@@ -52,9 +39,14 @@
</template> </template>
<script> <script>
import QuestionBankCell from '@/components/question-bank-cell'
const key2 = '2' const key2 = '2'
const key3 = '3' const key3 = '3'
export default { export default {
components: {
QuestionBankCell,
},
data() { data() {
return { return {
list: [], // 题库列表 list: [], // 题库列表
...@@ -177,30 +169,7 @@ export default { ...@@ -177,30 +169,7 @@ export default {
.label-content { .label-content {
margin-bottom: 44rpx; margin-bottom: 44rpx;
.label-item { .label-item {
padding: 40rpx 24rpx 40rpx 30rpx;
background-color: #ffffff;
border-radius: 12rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
.label-normal {
width: 470rpx;
font-size: 36rpx;
color: #191c27;
font-weight: bold;
word-break: break-all;
.label-text {
margin-top: 24rpx;
font-size: 26rpx;
color: #5a6073;
.label-blue {
color: #2953ff;
padding-left: 6rpx;
padding-right: 6rpx;
}
}
}
} }
} }
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
:border-bottom="false" :border-bottom="false"
title-bold title-bold
></u-navbar> ></u-navbar>
<!-- 类别 -->
<view> <view>
<view class="title-view"> <view class="title-view">
<text>{{ category.name }}</text> <text>{{ category.name }}</text>
...@@ -107,11 +106,6 @@ export default { ...@@ -107,11 +106,6 @@ export default {
selectedProvince: { label: '北京市', value: 11 }, selectedProvince: { label: '北京市', value: 11 },
loading: true, loading: true,
showPop: false, showPop: false,
selectedCategorys: [
{ name: '特种作业人员', id: 0 },
{ name: '高处作业', id: 0 },
{ name: '高处作业', id: 0 },
],
} }
}, },
computed: { computed: {
...@@ -124,10 +118,6 @@ export default { ...@@ -124,10 +118,6 @@ export default {
} }
}, },
defaultRegion() { defaultRegion() {
console.log(
'---------this.selectedProvince.value-------',
this.selectedProvince.label
)
return [this.selectedProvince.label] return [this.selectedProvince.label]
}, },
buttonStyle() { buttonStyle() {
...@@ -167,14 +157,6 @@ export default { ...@@ -167,14 +157,6 @@ export default {
this.getLocation() this.getLocation()
}, },
methods: { methods: {
// 选中某个单选框时,由radio时触发
radioChange(e) {
// console.log(e);
},
// 选中任一radio时,由radio-group触发
radioGroupChange(e) {
// console.log(e);
},
handleClickArea() { handleClickArea() {
this.loading = false this.loading = false
this.show = true this.show = true
...@@ -195,8 +177,6 @@ export default { ...@@ -195,8 +177,6 @@ export default {
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: (res) => { success: (res) => {
console.log('当前位置的经度:' + res.longitude)
console.log('当前位置的纬度:' + res.latitude)
this.baiduLocation(res.longitude, res.latitude) this.baiduLocation(res.longitude, res.latitude)
}, },
fail: () => { fail: () => {
...@@ -205,7 +185,6 @@ export default { ...@@ -205,7 +185,6 @@ export default {
}) })
}, },
handleClickSure() { handleClickSure() {
console.log('---------handleClickSure----------')
this.showPop = true this.showPop = true
}, },
handleClickSubmit() { handleClickSubmit() {
......
<template>
<view class="selected-list">
<u-navbar
back-icon-color="#333333"
background="transparent"
title="已选题库"
titleColor="#191C27"
:border-bottom="false"
title-bold
></u-navbar>
<view class="selected-list-content">
<view class="label-content">
<view v-for="(label, index) in list" :key="index" class="label-item">
<QuestionBankCell
:info="label"
:type="type"
@action="handleAction"
></QuestionBankCell>
</view>
</view>
<!-- 标签加载中 -->
<view class="tag-loading-view" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
<!-- 无数据 -->
<view class="tag-loading-view" v-else-if="list.length <= 0"
>暂无数据</view
>
</view>
<view class="bottom-view">
<u-button
:customStyle="buttonStyle"
@click="handleClick"
type="primary"
shape="circle"
>
<u-icon class="button-icon" name="plus-circle"></u-icon>添加新题库
</u-button>
</view>
</view>
</template>
<script>
import QuestionBankCell from '@/components/question-bank-cell'
export default {
components: {
QuestionBankCell,
},
data() {
return {
list: [], // 已选题库列表
loading: true,
}
},
computed: {
buttonStyle() {
return {
height: '104rpx',
backgroundColor: '#2953FF',
color: '#FFFFFF',
fontSize: '32rpx',
fontWeight: 'bold',
}
},
type() {
return this.list.length > 1 ? 'change' : 'none'
},
},
onLoad(e) {
this.loadList() // 获取已选题库列表
},
methods: {
// 点击了添加按钮
handleClick() {
this.$u.route({
url: 'pages/learn/selectCategory',
})
},
handleAction(info) {
this.setPageInfo(info)
this.$u.route({
type: 'back',
})
},
// 获取题库列表
loadList() {
// async loadList() {
// this.loading = true;
// let res = await this.$u.api.fileLabel({categoryId: this.category.id});
// this.loading = false
// if (res && res.code == 200) {
// this.list = res.data || [];
for (var i = 0; i < 10; i++) {
// 测试模拟多条数据
this.list.push({
name: '登高架设作业',
quantity: '80000',
pass: '98%',
id: i,
})
}
// }
},
setPageInfo(info) {
var pages = getCurrentPages()
if (pages.length >= 2) {
var page = pages[pages.length - 2]
page.info = info
}
},
},
}
</script>
<style lang="scss" scoped>
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.selected-list {
height: 100vh;
display: flex;
flex-direction: column;
background-color: #f8fafd;
background-image: linear-gradient(to top, #f8fafd 0%, #e9f3ff 50%);
background-size: 100% 520rpx;
background-repeat: no-repeat;
padding: 0 24rpx 0rpx 24rpx;
.selected-list-content {
height: 100%;
overflow: auto;
.label-content {
margin-bottom: 44rpx;
.label-item {
margin-bottom: 24rpx;
}
}
}
.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;
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment