mockexamination.vue
6.6 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<template>
<div>
<nav-bar class="navbar">
<div slot="left" class="back" @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>
<!-- <tabs :tabs="tabs" :active="current" @choose="choose" class="exercisetabs"></tabs> -->
<!-- <fil-ter :show="isShow" @infoType="infoType"></fil-ter> -->
<!-- <div class="line"></div> -->
<!-- <swiper-list
@slideChange="choose"
:active="current" slot="first"
> -->
<div class="Specialexercise">
<div class="noresult" v-if="Specialexercises.length==0">暂无模拟考试</div>
<div v-else>
<van-list
@load="scrollEnd">
<div v-for="(item,index) in Specialexercises" :key="index" class="Specialexercises_item">
<div @click="todetail(item.id,item.is_complete,item.count)">
<div class="display-flex-between">
<img src="../../assets/img/wenben 1.png" alt="" class="Specialexercises_img">
<div class="Specialexercises_title">{{item.name}}</div>
</div>
<div class="display-flex-between">
<div class="Specialexercises_number">{{item.answer_count}}人做过</div>
<div class="Specialexercises_time">{{item.create_time}}</div>
</div>
</div>
</div>
</van-list>
</div>
</div>
<!-- <div slot="second" 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.name}}({{item.posnames}})</div>
</div>
<div class="display-flex-between">
<div class="Specialexercises_number">{{item.answer_count}}人做过</div>
<div class="Specialexercises_time">{{item.create_time}}</div>
</div>
</div>
</div>
</div>
</div>
</swiper-list> -->
</div>
</template>
<script>
import '@/assets/style/list4.css'
// import filTer from '@/components/filter'
// import tabs from '@/components/tabs.vue'
// import swiperList from '@/components/swiper.vue'
export default {
// components: {
// swiperList
// },
data () {
return {
// tabs: ['未答试卷', '已做试卷'],
isShow: false, // 工种弹窗的显示
Specialexercises: [],
doSpecialexercises: [{}, {}, {}],
current: 0,
postname: '',
pId: '',
ifmore: false,
pagenum: 10,
page: 1
}
},
mounted () {
this.getuserinfo();
this.getlistkao()
console.log(1111111111111)
},
methods: {
async getuserinfo () {
const result = await this.api.userinfo()
if (result.code === 1) {
this.postname = result.data.info.pos_name
this.pId = result.data.info.pos_id
}
},
scrollEnd(e) {
console.log(e);
if (this.ifmore) {
++this.page;
this.getlistkao();
}
// else {
// this.$toast({ message: "没有更多了", duration: 1000 });
// }
},
todetail (id, com, count) {
localStorage.removeItem('alltest')
localStorage.removeItem('testindex')
localStorage.removeItem('answerId')
localStorage.removeItem('timelo')
console.log(1)
console.log(com, com === '1')
if (com === '1') {
this.$toast('该试题已完成')
} else {
if(count === 0) {
this.$toast('该模拟考试暂无题目')
} else {
this.$router.push({
path: '/examtype', query: { id: id, posid: this.pId }
})
}
}
},
async getlistkao () {
const params = {
// is_complete:this.current,
pos_id: this.pId,
type: 1,
page: this.page,
page_num: this.pagenum
}
const res = await this.api.monilist(params)
if (res.code === 1) {
const result = res.data.list
result.forEach(item => {
console.log(item)
item.posnames = []
item.pos.forEach(a => {
item.posnames.push(a.name)
})
item.posnames = item.posnames.join(',')
})
if (result.length === 0) {
this.ifmore = false;
this.Specialexercises = this.Specialexercises.concat(result);
} else {
this.ifmore = true;
this.Specialexercises =
this.page === 1 ? result : this.Specialexercises.concat(result);
}
}
},
// 选择工种
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">
.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{
padding:0.32rem;
margin-top: 1rem;
box-sizing: border-box;
}
</style>