daylist.vue
4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<template>
<div>
<nav-bar class="daylistnavbar">
<div slot="left" class="picker" @click="goBack">
<img src="../../assets/img/back.png" alt="">
</div>
<div slot="center" class="center">
每日一练
</div>
<div slot="right" class="picker display-flex-around" >
<div>{{postname}}</div>
<!-- <img src="../../assets/img/xia.png" alt="" :class="isShow?'rotate':''">@click="pos" -->
</div>
</nav-bar>
<fil-ter :show="isShow" @infoType="infoType"></fil-ter>
<div class="Specialexercise">
<div class="noresult" v-if="Specialexercises.length==0">暂无每日一练</div>
<div v-else>
<div v-for="(item,index) in Specialexercises" :key="index" class="Specialexercises_item">
<div @click="todetail(item.id,item.is_complete)">
<div class="display-flex-between">
<img src="../../assets/img/wenben 1.png" alt="" class="Specialexercises_img">
<div class="Specialexercises_title">{{item.title}}</div>
<div :class="Number(item.is_complete)==0?'daystatus':'daystatus1'">{{Number(item.is_complete)==0?'未完成':'已完成'}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import '@/assets/style/list4.css'
import filTer from '@/components/filter'
export default {
components: {
filTer
},
data () {
return {
Specialexercises: [],
pagenum: 10,
postname: '',
pId: '',
page: 1,
isShow: false // 工种弹窗的显示
}
},
mounted () {
if (localStorage.getItem('postname', this.postname)) {
this.postname = localStorage.getItem('postname', this.postname)
this.pId = localStorage.getItem('pId', this.pId)
}
this.getlistkao()
},
methods: {
todetail (id, com) {
if (Number(com) === 1) {
this.$toast('该试题已完成')
} else {
localStorage.removeItem('alltest')
localStorage.removeItem('testindex')
localStorage.removeItem('answerId')
localStorage.removeItem('timelo')
this.$router.push({
path: '/examDetail', query: { specialId: id, id: this.pId, type: 1 }
})
}
},
async getlistkao () {
const params = {
pos_id: this.pId,
page: this.page,
page_num: this.pagenum
}
const res = await this.api.daylist(params)
if (res.code === 1) {
const result = res.data.list.data
this.Specialexercises = result
console.log(this.Specialexercises)
}
},
// 选择工种
pos () {
this.isShow = !this.isShow
},
infoType (infoType, itemId) {
console.log(infoType, itemId)
this.isShow = false
this.postname = infoType
this.pId = itemId
localStorage.setItem('postname', this.postname)
localStorage.setItem('pId', this.pId)
this.page = 1
this.getlistkao()
},
choose (e) {
this.current = e
this.page = 1
this.getlistkao()
},
goBack () {
this.$router.go(-1)
}
}
}
</script>
<style scoped lang="scss">
.daylistnavbar{
position: fixed;
top: 0;
left: 0;
z-index: 9;
background: #fff;
}
.daylistnavbar .picker{
width:1.6rem;
}
.daylistnavbar .center{
flex: 1;
text-align: center;
}
.daylistnavbar .picker{
justify-content: flex-end;
}
.center{
font-size: 0.34rem;
font-weight: 700;
text-align: center;
}
.exercisetabs{
width: 100%;
height:0.88rem;
margin-top: 0.8rem;
padding: 0;
}
.grade{
color: rgba(37.19,124.31,255,1);
font-size: 0.28rem;
font-weight: 600;
}
.Specialexercise{
margin-top: 0.88rem;
padding:0.32rem;
box-sizing: border-box;
}
.daystatus{
color: rgba(37,124,255,1);
font-size: 0.32rem;
font-weight: 600;
}
.daystatus1{
color: #FA700C;
font-size: 0.32rem;
font-weight: 600;
}
</style>