Commit 8bd125b4 authored by Facius's avatar Facius

improvement: 首页UI变更

parent b3fa6588
...@@ -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',
......
...@@ -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;
......
...@@ -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>
...@@ -128,39 +131,40 @@ export default { ...@@ -128,39 +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:
this.selected.state && !this.detail.questionWarehouse.cardId,
pass: this.$u.random(95, 99) + '%', 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,
totalExam: this.data.totalCount, totalExam: this.data.totalCount || 0,
} }
}, },
subItems() { subItems() {
...@@ -261,23 +265,6 @@ export default { ...@@ -261,23 +265,6 @@ export default {
}) })
this.detail = res || { questionWarehouse: {} } this.detail = res || { questionWarehouse: {} }
this.queryQuestionWarehouseById(res.questionWarehouse.questionWarehouseId) this.queryQuestionWarehouseById(res.questionWarehouse.questionWarehouseId)
// this.detail = res || {
// questionWarehouse: {
// cardId: 0,
// createTime: '',
// createdBy: 0,
// echoMap: {},
// id: 0,
// institutionId: 0,
// questionWarehouseId: 0,
// studentId: 0,
// updateTime: '',
// updatedBy: 0,
// },
// todayCount: 100,
// totalCount: 100,
// totalDayCount: 100,
// }
}, },
handleSelect() { handleSelect() {
...@@ -289,12 +276,18 @@ export default { ...@@ -289,12 +276,18 @@ export default {
// 每日一练 // 每日一练
handleAnswer() { handleAnswer() {
if (this.selected.cardId) { if (this.selected.cardId) {
// 练习
// ...
} else if (this.selected.id) { } else if (this.selected.id) {
this.type = 'bound' if (this.info.experience) {
this.show = true this.selected.state = false
// 体验
} else {
// 绑卡提示
this.type = 'bound'
this.show = true
}
} else { } else {
// this.type = 'select'
// this.show = true
this.$u.route({ this.$u.route({
url: 'pages/learn/selectCategory', url: 'pages/learn/selectCategory',
}) })
...@@ -345,14 +338,10 @@ export default { ...@@ -345,14 +338,10 @@ export default {
} }
} else if (this.selected.id) { } else if (this.selected.id) {
// 已选题库 // 已选题库
if (index == 0 && this.info.experience) {
// 体验 // 绑卡
// ... this.type = 'bound'
} else { this.show = true
// 绑卡
this.type = 'bound'
this.show = true
}
} else { } else {
// 未选题库 // 未选题库
this.$u.route({ this.$u.route({
...@@ -520,6 +509,9 @@ export default { ...@@ -520,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;
}
} }
} }
} }
......
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