Commit bc051b9a authored by Damon's avatar Damon

chore: merge

parents e81d45d1 8bd125b4
...@@ -49,11 +49,22 @@ let learnApiFun = function(vm) { ...@@ -49,11 +49,22 @@ let learnApiFun = function(vm) {
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 queryQuestionWarehouseById = async (questionWarehouseId) =>
await vm.$u.get(
'/rest/question/query/queryQuestionWarehouseById/' + questionWarehouseId
)
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
)
let applyExam = async (params = {}) => let applyExam = async (params = {}) =>
await vm.$u.get(`/rest/question/applyExam/${params.questionWarehouseId}/${params.paperId}`, params) await vm.$u.get(
`/rest/question/applyExam/${params.questionWarehouseId}/${params.paperId}`,
params
)
let submitExamRecord = async (params = {}) => let submitExamRecord = async (params = {}) =>
await vm.$u.post('/rest/question/submit/examRecord', params) await vm.$u.post('/rest/question/submit/examRecord', params)
...@@ -76,6 +87,7 @@ let learnApiFun = function(vm) { ...@@ -76,6 +87,7 @@ let learnApiFun = function(vm) {
joinCollection, joinCollection,
removeCollection, removeCollection,
removeError, removeError,
queryQuestionWarehouseById,
getExamPaper, getExamPaper,
applyExam, applyExam,
submitExamRecord, submitExamRecord,
......
...@@ -129,9 +129,11 @@ export default { ...@@ -129,9 +129,11 @@ export default {
initData() { initData() {
var a0 = this.$u.random(0, 49) var a0 = this.$u.random(0, 49)
var a1 = this.$u.random(0, 49) var a1 = this.$u.random(0, 49)
if (a1 == a0) a0 = this.$u.random(0, 49)
var a2 = this.$u.random(0, 49) var a2 = this.$u.random(0, 49)
if ([a0, a1].indexOf(a2) != -1) a2 = this.$u.random(0, 49)
var a3 = this.$u.random(0, 49) var a3 = this.$u.random(0, 49)
console.log(a0, a1, a2, a3, this.defaultUrl) if ([a0, a1, a2].indexOf(a3) != -1) a3 = this.$u.random(0, 49)
this.avatars = [ this.avatars = [
this.defaultUrl + (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg', this.defaultUrl + (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg',
this.defaultUrl + (a1 > 9 ? 'a' : 'a0') + String(a1) + '.jpeg', this.defaultUrl + (a1 > 9 ? 'a' : 'a0') + String(a1) + '.jpeg',
...@@ -164,10 +166,15 @@ export default { ...@@ -164,10 +166,15 @@ export default {
produceData() { produceData() {
var array = this.avatars.slice(1) var array = this.avatars.slice(1)
var a0 = this.$u.random(0, 49) var a0 = this.$u.random(0, 49)
this.avatars = [ var str = (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg'
...array, for (var item of this.avatars) {
this.defaultUrl + (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg', if (item.indexOf(str) != -1) {
] a0 = this.$u.random(0, 49)
str = (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg'
break
}
}
this.avatars = [...array, this.defaultUrl + str]
// this.avatars = [...array, this.defaultUrl + 'xunzhang.jpeg'] // this.avatars = [...array, this.defaultUrl + 'xunzhang.jpeg']
console.log(this.avatars.length) console.log(this.avatars.length)
......
...@@ -37,12 +37,12 @@ ...@@ -37,12 +37,12 @@
</view> </view>
<view class="bottom"> <view class="bottom">
<view <view
class="bottom-button" :class="['bottom-button', { experience: info.experience }]"
type="primary" type="primary"
shape="circle" shape="circle"
@click="$u.throttle(answer, 500)" @click="$u.throttle(answer, 500)"
><image class="button-image" :src="lianxianniuImage"></image ><image class="button-image" :src="lianxianniuImage"></image
>每日一练</view >{{ buttonText }}</view
> >
</view> </view>
</view> </view>
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
dynamic: [], dynamic: [],
avatar: [], avatar: [],
selected: {}, selected: {},
experience: false,
} }
}, },
}, },
...@@ -92,6 +93,9 @@ export default { ...@@ -92,6 +93,9 @@ export default {
lianxianniuImage() { lianxianniuImage() {
return process.uniEnv.qn_base_url + 'lianxianniu.png' return process.uniEnv.qn_base_url + 'lianxianniu.png'
}, },
buttonText() {
return this.info.experience ? '免费体验答题' : '每日一练'
},
}, },
created() {}, created() {},
methods: { methods: {
...@@ -196,6 +200,9 @@ export default { ...@@ -196,6 +200,9 @@ export default {
color: #2953ff; color: #2953ff;
height: 104rpx; height: 104rpx;
width: 400rpx; width: 400rpx;
&.experience {
color: #fa5a49;
}
.button-image { .button-image {
width: 400rpx; width: 400rpx;
height: 104rpx; height: 104rpx;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
></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">{{ ><text class="detail-text">{{
item.key == 'location' ? provinceName : selected[item.key] item.key == 'location' ? provinceName : info[item.key]
}}</text></view }}</text></view
> >
</view> </view>
...@@ -54,9 +54,12 @@ ...@@ -54,9 +54,12 @@
<image class="exam-image" :src="item.image"></image> <image class="exam-image" :src="item.image"></image>
<view class="right-view"> <view class="right-view">
<view>{{ item.name }}</view> <view>{{ item.name }}</view>
<view class="label-view" :style="{ color: item.labelColor }">{{ <view class="label-view"
item.label ><text class="left-label" v-if="item.leftLabel">{{
}}</view> item.leftLabel
}}</text
><text>{{ item.label }}</text></view
>
</view> </view>
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
...@@ -102,8 +105,9 @@ export default { ...@@ -102,8 +105,9 @@ export default {
show: false, show: false,
type: 'select', type: 'select',
provinceList: [], provinceList: [],
detail: {}, detail: { questionWarehouse: {} },
selected: {}, selected: {},
data: {},
} }
}, },
computed: { computed: {
...@@ -114,7 +118,7 @@ export default { ...@@ -114,7 +118,7 @@ export default {
return '/static/logo.png' return '/static/logo.png'
}, },
noExam() { noExam() {
return this.$u.test.isEmpty(this.selected.name) return this.$u.test.isEmpty(this.selected.title)
}, },
mokaodashiImage() { mokaodashiImage() {
return process.uniEnv.qn_base_url + 'mokaodashi.png' return process.uniEnv.qn_base_url + 'mokaodashi.png'
...@@ -127,40 +131,40 @@ export default { ...@@ -127,40 +131,40 @@ export default {
{ {
name: '全部试题', name: '全部试题',
label: this.examText, label: this.examText,
labelColor: this.labelColor, leftLabel: this.selected.count, // 已做题目数
image: process.uniEnv.qn_base_url + 'quanbushiti.png', image: process.uniEnv.qn_base_url + 'quanbushiti.png',
}, },
{ {
name: '模拟考试', name: '模拟考试',
label: '真题模拟强化', label: this.simulateText,
labelColor: '#9EA5BB',
image: process.uniEnv.qn_base_url + 'monishiti.png', image: process.uniEnv.qn_base_url + 'monishiti.png',
}, },
] ]
}, },
labelColor() {
return this.selected.state ? '#FA5A49' : '#9EA5BB'
},
examText() { examText() {
return this.selected.state return this.selected.cardId
? '免费体验1次' ? '/' + this.selected.totalExam
: this.selected.card
? this.selected.count + '/' + this.selected.all
: '题库进阶练习' : '题库进阶练习'
}, },
simulateText() {
return this.selected.cardId
? '上次成绩' + this.selected.totalExam + '分'
: '真题模拟强化'
},
info() { info() {
return { return {
id: this.selected.id, id: this.selected.id,
cardId: cardId:
this.detail.questionWarehouse && this.detail.questionWarehouse.cardId, this.detail.questionWarehouse && this.detail.questionWarehouse.cardId,
provinceName: this.provinceName, provinceName: this.provinceName,
experience: this.selected.state, experience:
pass: this.selected.pass, this.selected.state && !this.detail.questionWarehouse.cardId,
number: this.selected.number, pass: this.$u.random(95, 99) + '%',
days: this.detail.totalDayCount || 0, days: this.detail.totalDayCount || 0,
today: this.detail.todayCount || 0, today: this.detail.todayCount || 0,
total: this.detail.totalCount || 0, total: this.detail.totalCount || 0,
// selected: this.selected, totalExam: this.data.totalCount || 0,
} }
}, },
subItems() { subItems() {
...@@ -197,7 +201,7 @@ export default { ...@@ -197,7 +201,7 @@ export default {
}, },
provinceName() { provinceName() {
for (var item of this.provinceList) { for (var item of this.provinceList) {
if (item.provinceId == this.selected.provinceId) { if (item.id == this.selected.provinceId) {
return item.fullName + '题' return item.fullName + '题'
} }
} }
...@@ -219,7 +223,7 @@ export default { ...@@ -219,7 +223,7 @@ export default {
}, },
{ {
title: '题目数:', title: '题目数:',
key: 'count', key: 'totalExam',
image: process.uniEnv.qn_base_url + 'timushu.png', image: process.uniEnv.qn_base_url + 'timushu.png',
imageStyle: 'width:28rpx;height:30rpx', imageStyle: 'width:28rpx;height:30rpx',
}, },
...@@ -228,7 +232,7 @@ export default { ...@@ -228,7 +232,7 @@ export default {
}, },
onLoad() { onLoad() {
this.getProvinceList() this.getProvinceList()
this.queryMyQuestionWarehouseDetail(0) this.queryMyQuestionWarehouseDetail('1414854649273384960')
}, },
onShow() { onShow() {
let pages = getCurrentPages() let pages = getCurrentPages()
...@@ -242,10 +246,25 @@ export default { ...@@ -242,10 +246,25 @@ export default {
} }
}, },
methods: { methods: {
// 题库详情
async queryQuestionWarehouseById(id) {
let res = await this.$u.api
.queryQuestionWarehouseById(id)
.catch((err) => {
console.log(err)
})
this.data = res || { questionWarehouse: {} }
this.selected = this.data.questionWarehouse
},
// 学生查询题库首页
async queryMyQuestionWarehouseDetail(id) { async queryMyQuestionWarehouseDetail(id) {
let res = await this.$u.api.queryMyQuestionWarehouseDetail(id) let res = await this.$u.api
console.log(res) .queryMyQuestionWarehouseDetail(id)
this.provinceList = res .catch((err) => {
console.log(err)
})
this.detail = res || { questionWarehouse: {} }
this.queryQuestionWarehouseById(res.questionWarehouse.questionWarehouseId)
}, },
handleSelect() { handleSelect() {
...@@ -257,12 +276,21 @@ export default { ...@@ -257,12 +276,21 @@ export default {
// 每日一练 // 每日一练
handleAnswer() { handleAnswer() {
if (this.selected.cardId) { if (this.selected.cardId) {
} else if (this.selected.name) { // 练习
// ...
} else if (this.selected.id) {
if (this.info.experience) {
this.selected.state = false
// 体验
} else {
// 绑卡提示
this.type = 'bound' this.type = 'bound'
this.show = true this.show = true
}
} else { } else {
this.type = 'select' this.$u.route({
this.show = true url: 'pages/learn/selectCategory',
})
} }
}, },
handleClickLeftTop() { handleClickLeftTop() {
...@@ -278,8 +306,12 @@ export default { ...@@ -278,8 +306,12 @@ export default {
}) })
}, },
handleClickItem(key) { handleClickItem(key) {
if (this.selected.name) { if (this.selected.id) {
// 跳转到学练记录 // 跳转到学练记录
this.$u.route({
url: 'pages/learn/record?part=',
key,
})
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '暂未选题库', title: '暂未选题库',
...@@ -293,33 +325,40 @@ export default { ...@@ -293,33 +325,40 @@ export default {
// ... // ...
}, },
handleClickExam(index) { handleClickExam(index) {
if (this.selected.cardId) {
// 已绑卡
if (index == 0) { if (index == 0) {
// 点击了全部试题 // 做题
if (!this.info.cardId && this.info.experience) {
this.selected.state = false
// 体验
// ... // ...
} else { } else {
// 正常做题 // 模拟考试
// ... this.$u.route({
url: 'pages/learn/beginAnswer',
})
} }
} else { } else if (this.selected.id) {
// 点击了模拟考试 // 已选题库
// 绑卡
this.type = 'bound'
this.show = true
} else {
// 未选题库
this.$u.route({ this.$u.route({
url: 'pages/learn/beginAnswer', url: 'pages/learn/selectCategory',
}) })
} }
}, },
handleClick(path) { handleClick(path) {
// if (this.vuex_token) { if (!this.selected.id) {
this.$u.route({
url: 'pages/learn/selectCategory',
})
} else {
this.$u.route({ this.$u.route({
url: path, url: path,
}) })
// } else { }
// this.$u.route({ url: 'pages/login/index' })
// }
}, },
async getProvinceList() { async getProvinceList() {
let res = await this.$u.api.getProvinceList() let res = await this.$u.api.getProvinceList()
...@@ -470,6 +509,9 @@ export default { ...@@ -470,6 +509,9 @@ export default {
font-weight: 400; font-weight: 400;
font-size: 26rpx; font-size: 26rpx;
margin-top: 4rpx; margin-top: 4rpx;
.left-label {
color: #5a6073;
}
} }
} }
} }
......
...@@ -97,6 +97,9 @@ ...@@ -97,6 +97,9 @@
<u-icon v-if="key != thirdKey" name="arrow-downward"></u-icon> <u-icon v-if="key != thirdKey" name="arrow-downward"></u-icon>
</view> </view>
</PopView> </PopView>
<view>
<u-toast ref="uToast" />
</view>
</view> </view>
</template> </template>
...@@ -241,16 +244,29 @@ export default { ...@@ -241,16 +244,29 @@ export default {
let data = res[0] let data = res[0]
this.setPageInfo(data) this.setPageInfo(data)
// 学员增加自己的题库 // 学员增加自己的题库
let result = await this.$u.api.addQuestionWarehouse({ let result = await this.$u.api
.addQuestionWarehouse({
questionWarehouseId: data.id, questionWarehouseId: data.id,
}) })
.catch((err) => {
console.log(err)
})
if (result) { if (result) {
// 成功 // 成功
this.$refs.uToast.show({
title: '添加题库成功',
type: 'success',
duration: 1500,
callback: () => {
this.showPop = false this.showPop = false
uni.switchTab({ uni.switchTab({
url: '/pages/index/index', url: '/pages/index/index',
}) })
},
})
} else { } else {
this.showPop = false
} }
}, },
changeIndex() { changeIndex() {
...@@ -293,7 +309,6 @@ export default { ...@@ -293,7 +309,6 @@ 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
} }
}, },
......
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