Commit bc051b9a authored by Damon's avatar Damon

chore: merge

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