Commit f207c805 authored by Damon's avatar Damon

chore: merge

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