Commit f207c805 authored by Damon's avatar Damon

chore: merge

parents c757c1f2 2640a093
......@@ -10,27 +10,44 @@ let learnApiFun = function(vm) {
let answer = async (params = {}) =>
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
)
// 查询省份列表
let getProvinceList = async (params = {}) =>
await vm.$u.get('/rest/question/getProvinceList', params)
// 学生查询题库首页
let queryMyQuestionWarehouseDetail = async (questionWarehouseId) =>
await vm.$u.get(
'/rest/question/query/queryMyQuestionWarehouseDetail/' +
questionWarehouseId
)
// 学员增加自己的题库
let addQuestionWarehouse = async (params = {}) =>
await vm.$u.post('/rest/question/query/addQuestionWarehouse', params)
let joinCollection = async (params = {}) =>
await vm.$u.get('/rest/question/join/collection/'+params.questionId, params)
await vm.$u.get(
'/rest/question/join/collection/' + params.questionId,
params
)
let removeCollection = async (params = {}) =>
await vm.$u.get('/rest/question/remove/collection/'+params.questionId, params)
await vm.$u.get(
'/rest/question/remove/collection/' + params.questionId,
params
)
let removeError = async (params = {}) =>
await vm.$u.get('/rest/question/remove/error/'+params.questionId, params)
await vm.$u.get('/rest/question/remove/error/' + params.questionId, params)
let getExamPaper = async (params = {}) =>
await vm.$u.get('/rest/question/getExamPaper/'+params.questionWarehouseId, params)
......@@ -45,6 +62,8 @@ let learnApiFun = function(vm) {
subjectList,
getQuestionWarehouse,
getProvinceList,
queryMyQuestionWarehouseDetail,
addQuestionWarehouse,
joinCollection,
removeCollection,
removeError,
......
......@@ -16,7 +16,7 @@
</view>
</view>
<view class="pop-content">
<view>您已获得1次答题体验机会</view>
<view>您已获得免费体验10道题机会</view>
<view class="label-view">每日一练,轻松完成课程练习</view>
</view>
<u-button
......
......@@ -166,7 +166,7 @@ export default {
var a0 = this.$u.random(0, 49)
this.avatars = [
...array,
this.defaultUrl + a0 > 9 ? 'a' : 'a0' + a0 + '.jpeg',
this.defaultUrl + (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg',
]
// this.avatars = [...array, this.defaultUrl + 'xunzhang.jpeg']
console.log(this.avatars.length)
......
......@@ -83,14 +83,9 @@ export default {
return {
today: '今日做题',
total: '累计做题',
days: '累计天数',
days: '打卡天数',
}
},
avatars() {
return this.info.avatar.length > 4
? this.info.avatar.slice(0, 4)
: this.info.avatar
},
meiriyilianImage() {
return process.uniEnv.qn_base_url + 'meiriyilianquyu.png'
},
......
......@@ -34,7 +34,9 @@
:src="item.image"
></image
><text v-if="item.title" class="detail-title">{{ item.title }}</text
><text class="detail-text">{{ selected[item.key] }}</text></view
><text class="detail-text">{{
item.key == 'location' ? provinceName : selected[item.key]
}}</text></view
>
</view>
<SubjectStatistics
......@@ -78,7 +80,7 @@
</view>
</view>
<view class="experience-pop-view">
<ExperiencePop :visible.sync="visible" />
<ExperiencePop :visible.sync="visible" @click="handleClickExperience" />
</view>
<ToastPop :visible.sync="show" :type="type" @click="handleClickToast" />
<view>
......@@ -96,24 +98,17 @@ export default {
components: { SubjectStatistics, ExperiencePop, ToastPop },
data() {
return {
visible: false,
visible: false, // 免费体验弹窗
show: false,
type: 'select',
selected: {
key: 0,
name: '熔化焊接与热切割作业',
location: '黑龙江省题',
count: '899',
all: '10000',
pass: '96%',
cardId: '', // 绑卡
free: true, // true:可以体验;false: 没有体验机会了
},
provinceList: [],
detail: {},
selected: {},
}
},
computed: {
title() {
return this.selected.name || '请选择题库'
return this.selected.title || '请选择题库'
},
imageUrl() {
return '/static/logo.png'
......@@ -144,10 +139,10 @@ export default {
]
},
labelColor() {
return this.selected.free ? '#FA5A49' : '#9EA5BB'
return this.selected.state ? '#FA5A49' : '#9EA5BB'
},
examText() {
return this.selected.free
return this.selected.state
? '免费体验1次'
: this.selected.card
? this.selected.count + '/' + this.selected.all
......@@ -155,12 +150,17 @@ export default {
},
info() {
return {
days: 9,
today: 0,
total: 0,
dynamic: ['2分钟前 李**完成了“高空作业习题”练习'],
avatar: [this.imageUrl, this.imageUrl, this.imageUrl, this.imageUrl],
selected: this.selected,
id: this.selected.id,
cardId:
this.detail.questionWarehouse && this.detail.questionWarehouse.cardId,
provinceName: this.provinceName,
experience: this.selected.state,
pass: this.selected.pass,
number: this.selected.number,
days: this.detail.totalDayCount || 0,
today: this.detail.todayCount || 0,
total: this.detail.totalCount || 0,
// selected: this.selected,
}
},
subItems() {
......@@ -195,6 +195,14 @@ export default {
},
]
},
provinceName() {
for (var item of this.provinceList) {
if (item.provinceId == this.selected.provinceId) {
return item.fullName + '题'
}
}
return ''
},
detailItems() {
return [
{
......@@ -218,7 +226,10 @@ export default {
]
},
},
onLoad() {},
onLoad() {
this.getProvinceList()
this.queryMyQuestionWarehouseDetail(0)
},
onShow() {
let pages = getCurrentPages()
let page = pages[pages.length - 1]
......@@ -226,19 +237,22 @@ export default {
if (info) {
this.selected = info
page.info = null
this.visible = info.cardId
this.visible = info.state
this.queryMyQuestionWarehouseDetail(this.selected.id)
}
},
methods: {
async queryMyQuestionWarehouseDetail(id) {
let res = await this.$u.api.queryMyQuestionWarehouseDetail(id)
console.log(res)
this.provinceList = res
},
handleSelect() {
// if (this.vuex_token) {
var str = this.selected ? 'selectedList' : 'addExam'
var str = this.selected.id ? 'selectedList' : 'selectCategory'
this.$u.route({
url: 'pages/learn/' + str,
})
// } else {
// this.$u.route({ url: 'pages/login/index' })
// }
},
// 每日一练
handleAnswer() {
......@@ -273,11 +287,26 @@ export default {
})
}
},
handleClickExperience() {
this.selected.state = false
// 体验
// ...
},
handleClickExam(index) {
if (index == 0) {
// 点击了全部试题
if (!this.info.cardId && this.info.experience) {
this.selected.state = false
// 体验
// ...
} else {
// 正常做题
// ...
}
} else {
// 点击了模拟考试
this.$u.route({
url: 'pages/learn/beginAnswer',
})
......@@ -292,6 +321,11 @@ export default {
// this.$u.route({ url: 'pages/login/index' })
// }
},
async getProvinceList() {
let res = await this.$u.api.getProvinceList()
console.log(res)
this.provinceList = res
},
},
}
</script>
......
......@@ -215,11 +215,18 @@ export default {
handleClickSure() {
this.showPop = true
},
// 获取省份列表
async getProvinceList() {
let res = await this.$u.api.getProvinceList()
console.log(res)
this.range = res
},
// 学员增加自己的题库
async addQuestionWarehouse(params) {
let res = await this.$u.api.addQuestionWarehouse({ params })
console.log(res)
this.range = res
},
async handleClickSubmit() {
if (this.buttonDisabled) return
if (this.index == 0) {
......@@ -229,13 +236,22 @@ export default {
provinceId: this.range[this.index].id,
type: this.selectedTypeId,
}
// 获取科目对应的题库
let res = await this.$u.api.getQuestionWarehouse(this.category.id, param)
this.setPageInfo(res[0])
this.showPop = false
uni.switchTab({
url: '/pages/index/index',
let data = res[0]
this.setPageInfo(data)
// 学员增加自己的题库
let result = await this.$u.api.addQuestionWarehouse({
questionWarehouseId: data.id,
})
if (result) {
// 成功
this.showPop = false
uni.switchTab({
url: '/pages/index/index',
})
} else {
}
},
changeIndex() {
for (var i = 0; i < this.range.length; i++) {
......@@ -277,6 +293,7 @@ export default {
if (pages.length >= 1) {
var page = pages[0]
console.log('--------setPageInfo--------', info)
info.pass = this.$u.random(95, 99)
page.info = info
}
},
......
......@@ -131,6 +131,7 @@ export default {
let res = await this.$u.api.subjectList(param)
this.tapLoading = false
this.result = res
console.log('-----------res-------------', 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