Commit cec01ecd authored by Facius's avatar Facius

feat: 接口

parent fb334a21
......@@ -10,12 +10,17 @@ let learnApiFun = function(vm) {
await vm.$u.post('/rest/question/save/answer', params)
let subjectList = async (params = {}) =>
await vm.$u.get('/rest/question/query/subjectList', params)
let getQuestionWarehouse = async (subjectId, params = {}) =>
await vm.$u.get(
'/rest/question/query/getQuestionWarehouse/' + subjectId,
params
)
const learnApi = {
getQuestion,
getQuestionTotal,
answer,
subjectList,
getQuestionWarehouse,
}
return learnApi
}
......
<template>
<!-- 体验资格结束弹窗 -->
<u-popup
border-radius="24"
v-model="visible"
mode="center"
safe-area-inset-bottom
width="690rpx"
:mask-close-able="flase"
close-icon-color="#FFFFFF"
height="86%"
>
<view class="pop-view">
<image mode="widthFix" class="image-view" :src="backgroundImage"></image>
......@@ -96,7 +96,7 @@ export default {
<style lang="scss" scoped>
.pop-view {
margin-top: 80rpx;
// margin-top: 80rpx;
padding: 48rpx 24rpx;
position: relative;
text-align: center;
......@@ -124,7 +124,7 @@ export default {
z-index: -1;
}
.pop-content {
margin-bottom: 60rpx;
margin-bottom: 150rpx;
font-size: 36rpx;
font-weight: bold;
color: #191c27;
......
......@@ -2,7 +2,7 @@
<view class="u-flex top">
<view class="u-flex avatar">
<view class="avatar-list" v-for="(item, index) in avatars" :key="index">
<image :src="item" mode="scaleToFill" />
<image :src="item" mode="aspectFill" />
</view>
</view>
<view class="notice">
......@@ -117,6 +117,9 @@ export default {
'习题"练习'
)
},
defaultUrl() {
return process.uniEnv.qn_base_url + 'heads/'
},
},
created() {
this.initData()
......@@ -124,18 +127,22 @@ export default {
},
methods: {
initData() {
// this.avatars = [
// process.uniEnv.qn_base_url + 'touxiang' + this.$u.random(0, 49) + '.png',
// process.uniEnv.qn_base_url + 'touxiang' + this.$u.random(0, 49) + '.png',
// process.uniEnv.qn_base_url + 'touxiang' + this.$u.random(0, 49) + '.png',
// process.uniEnv.qn_base_url + 'touxiang' + this.$u.random(0, 49) + '.png',
// ]
var a0 = this.$u.random(0, 49)
var a1 = this.$u.random(0, 49)
var a2 = this.$u.random(0, 49)
var a3 = this.$u.random(0, 49)
this.avatars = [
process.uniEnv.qn_base_url + 'xunzhang.png',
process.uniEnv.qn_base_url + 'xunzhang.png',
process.uniEnv.qn_base_url + 'xunzhang.png',
process.uniEnv.qn_base_url + 'xunzhang.png',
this.defaultUrl + a0 > 9 ? 'a' : 'a0' + a0 + '.png',
this.defaultUrl + a1 > 9 ? 'a' : 'a0' + a1 + '.png',
this.defaultUrl + a2 > 9 ? 'a' : 'a0' + a2 + '.png',
this.defaultUrl + a3 > 9 ? 'a' : 'a0' + a3 + '.png',
]
// this.avatars = [
// this.defaultUrl + 'xunzhang.png',
// this.defaultUrl + 'xunzhang.png',
// this.defaultUrl + 'xunzhang.png',
// this.defaultUrl + 'xunzhang.png',
// ]
this.list = [this.noticeText]
setInterval(() => {
this.produceTime += this.duration
......@@ -154,9 +161,12 @@ export default {
},
produceData() {
var array = this.avatars.slice(1)
console.log(array.length)
// this.avatars = [...array, process.uniEnv.qn_base_url + 'touxiang' + this.$u.random(0, 49) + '.png']
this.avatars = [...array, process.uniEnv.qn_base_url + 'xunzhang.png']
var a0 = this.$u.random(0, 49)
this.avatars = [
...array,
this.defaultUrl + a0 > 9 ? 'a' : 'a0' + a0 + '.png',
]
// this.avatars = [...array, this.defaultUrl + 'xunzhang.png']
console.log(this.avatars.length)
this.list = [this.noticeText]
......
......@@ -31,6 +31,7 @@
:custom-style="customStyleSave"
shape="circle"
type="primary"
:loading="loading"
@click="handleClickSure"
>
{{ buttonText }}
......@@ -62,7 +63,9 @@ export default {
},
},
data() {
return {}
return {
loading: false,
}
},
computed: {
customStyleCancel() {
......@@ -85,6 +88,11 @@ export default {
}
},
},
watch: {
visible() {
this.loading = false
},
},
methods: {
changeVisibleValue(val) {
this.$emit('update:visible', val)
......@@ -94,6 +102,7 @@ export default {
this.$emit('cancel')
},
handleClickSure() {
this.loading = true
this.$emit('submit')
},
},
......
<template>
<view class="question-bank-cell">
<view class="label-normal">
<view>{{ info.name }}</view>
<view>{{ info.label }}</view>
<view class="label-text">
共
<text class="label-blue">{{ info.quantity }}</text
<text class="label-blue">{{ info.number }}</text
>道精编试题,通过率
<text class="label-blue">{{ info.pass }}</text>
<text class="label-blue">{{ $u.random(95, 99) }}%</text>
</view>
</view>
<u-button
......
......@@ -19,7 +19,11 @@
</view>
<view class="add-exam-content">
<view class="label-content">
<view v-for="(label, index) in list" :key="index" class="label-item">
<view
v-for="(label, index) in category.list"
:key="index"
class="label-item"
>
<QuestionBankCell
:info="label"
type="add"
......@@ -27,12 +31,8 @@
></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 class="tag-loading-view" v-if="category.list.length <= 0"
>暂无数据</view
>
</view>
......@@ -50,8 +50,6 @@ export default {
},
data() {
return {
list: [], // 题库列表
loading: true,
selected: {},
}
},
......@@ -75,37 +73,16 @@ export default {
},
onLoad(e) {
this.getPageInfo()
this.loadList() // 获取题库列表
},
methods: {
// 点击了添加按钮
handleClick(index) {
this.selected[key3] = this.list[index]
this.selected[key3] = this.category.list[index]
this.setPageInfo(this.selected)
this.$u.route({
url: 'pages/learn/examSetting',
})
},
// 获取题库列表
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()
......
......@@ -9,7 +9,7 @@
></u-navbar>
<view>
<view class="title-view">
<text>{{ category.name }}</text>
<text>{{ category.label }}</text>
</view>
</view>
<view class="exam-type">
......@@ -75,7 +75,7 @@
>
<view v-for="(value, key) in selected" :key="key" class="pop-content">
<view :class="['pop-content-text', { last: key == thirdKey }]">{{
value.name
value.label
}}</view>
<u-icon v-if="key != thirdKey" name="arrow-downward"></u-icon>
</view>
......@@ -141,7 +141,7 @@ export default {
}
},
buttonDisabled() {
return !(this.selectedProvince.label && this.selectedType)
return !(this.selectedProvince.label && this.selectedTypeId)
},
selectedType() {
for (var item of this.types) {
......@@ -154,6 +154,14 @@ export default {
thirdKey() {
return key3
},
selectedTypeId() {
for (var item of this.types) {
if (item.selected == true) {
return item.id
}
}
return null
},
},
onLoad(e) {
this.getPageInfo()
......@@ -190,8 +198,21 @@ export default {
handleClickSure() {
this.showPop = true
},
handleClickSubmit() {
async handleClickSubmit() {
if (this.buttonDisabled) return
let param = {
provinceId: this.selectedProvince.value,
type: this.selectedTypeId,
}
let res = await this.$u.api.getQuestionWarehouse(this.category.id, param)
this.setPageInfo(res)
this.showPop = false
uni.switchTab({
url: '/pages/index/index',
})
console.log(res)
return
var selected = {
key: 0,
name: 'abc',
......
......@@ -78,6 +78,7 @@ export default {
tapLoading: true,
scrollId: '',
minHeight: 0,
result: [],
}
},
computed: {
......@@ -113,6 +114,9 @@ export default {
} else {
// 选中二级标签
this.selected[key1] = this.labels[key1][0][index]
this.selected[key2].list = this.result.filter((item) => {
return item.parentId == label.id
})
this.setPageInfo(this.selected)
this.$u.route({
url: 'pages/learn/addExam',
......@@ -126,6 +130,7 @@ export default {
let param = {}
let res = await this.$u.api.subjectList(param)
this.tapLoading = false
this.result = res
var filterItems = res.filter((item) => {
return item.parentId == 0
})
......
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