collegeCellect.vue
11.8 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<template>
<view class="content">
<view class="title">
<view class="mine" :class="{active:active3}" @click="mineShow">我的发布</view>
<view class="history" :class="{active:active1}" @click="historyShow">浏览历史</view>
<view class="cellect" :class="{active:active2}" @click="cellectShow">我的收藏</view>
</view>
<view class="mineBox" v-if="isMineShow==true&&isHistoryShow==false">
<view class="minetop">
<view class="mineTitle">我的发布</view>
<view class="del" @click="edit" v-if="isedit==false">编辑</view>
<view class="del" @click="editok" v-if="isedit==true">完成</view>
<!-- <view class="del">完成</view> -->
</view>
<view class="item" v-for="(item,index) in articlelist" :key="index">
<image class="icon" src="../../static/shanchu_icon@2x.png" v-if="isedit" @click="delarcial(item,index)"></image>
<view class="cont" :style="{width:width}" @click="toarticl" :data-id="item.id">
<view class="rowOne">{{item.article_type_name}}</view>
<view class="rowTwo">{{item.title}}</view>
<view class="rowThree">{{item.des_content}}</view>
</view>
</view>
<view class="nodata" v-if="articlelist.length==0">暂无数据</view>
</view>
<view class="historyBox" v-if="isHistoryShow==true&&isMineShow==false">
<view class="liulan">
<view class="liulantitle">浏览历史</view>
<view class="del" @click="delhistory">清空</view>
<!-- <view class="del">完成</view> -->
</view>
<view class="mateitem" v-for="(item,index) in historylist" :key="index">
<view class="contentBox">
<image class="photo" src="../../static/logo_img@2x.png"></image>
<view class="cont">
<view class="title">红色的战旗</view>
<view class="fen">就读体验</view>
</view>
<view class="right">
<view class="text">已关注</view>
</view>
<view class="txt">班主任用“心”战“疫” 全力做好学生防疫工作</view>
</view>
</view>
<view class="nodata" v-if="historylist.length==0">暂无消息</view>
</view>
<view class="cellcetBox" v-if="isHistoryShow==false&&isMineShow==false">
<view class="liulan">
<view class="liulantitle">我的收藏</view>
<view class="del" @click="change2" v-if="isdel">完成</view>
<view class="del" @click="change" v-else>编辑</view>
</view>
<view class="mateitem" v-for="(item,index) in cellectlist" :key="index">
<image class="delBtn" src="../../static/shanchu_icon@2x.png" v-if="isdel"></image>
<view class="contentBox" :style="{width:width2}">
<image class="photo" src="../../static/logo_img@2x.png"></image>
<view class="cont">
<view class="title">{{item.nickname}}</view>
<view class="fen">{{item.title}}</view>
</view>
<view class="right">
<view class="text">已关注</view>
</view>
<view class="txt">{{item.des_content}}</view>
</view>
</view>
<view class="nodata" v-if="cellectlist.length==0">暂无数据</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data(){
return{
active3:true,
active1:false,
active2:false,
isHistoryShow:false,
isMineShow:true,
isdel:false,
isedit:false,
width:'686rpx',
width2:'660rpx',
page:1,
size:10,
articlelist:[],
historylist:[],
cellectlist:[]
}
},
methods:{
historyShow(){
this.active1=true,
this.active2=false,
this.isHistoryShow=true
this.isMineShow=false,
this.active3=false
},
cellectShow(){
this.isHistoryShow=false,
this.active2=true,
this.active1=false,
this.isMineShow=false,
this.active3=false
},
mineShow(){
this.active3=true,
this.active1=false,
this.active2=false,
this.isMineShow=true,
this.isHistoryShow=false
},
edit(){
this.isedit=true,
this.width="580rpx"
},
editok(){
this.isedit=false,
this.width="686rpx"
},
change(){
this.isdel=true
this.width="620rpx"
},
change2(){
this.isdel=false
this.width="660rpx"
},
getMyArticle(){
var that = this
var url = "article/getMyArticle"
var token = uni.getStorageSync('token')
var params = {
token:token,
page:that.page,
size:that.size
}
app.post(url,params,"get").then((res)=>{
console.log(res)
that.articlelist=res
}).catch((err)=>{
console.log(err)
})
},
gethistory(){
var that = this
var url = "article/getLookArticleList"
var token = uni.getStorageSync('token')
var params = {
token:token
}
app.post(url,params,"get").then((res)=>{
that.historylist=res
console.log(res)
}).catch((err)=>{
console.log(err)
})
},
delhistory(){
var that = this
var url = "article/delLookArticle"
var token = uni.getStorageSync('token')
var params = {
token:token
}
app.post(url,params,"post").then((res)=>{
that.historylist=res
console.log(res)
uni.showToast({
title:'浏览记录已清空'
})
}).catch((err)=>{
console.log(err)
})
},
getMyCellect(){
var that = this
var url = "article/getMyLikeArticle"
var token = uni.getStorageSync('token')
var params = {
token:token,
page:that.page,
size:that.size
}
app.post(url,params,"get").then((res)=>{
console.log(res)
that.cellectlist=res
}).catch((err)=>{
console.log(err)
})
},
toarticl(e){
var id = e.currentTarget.dataset.id
uni.navigateTo({
url:'../school/article?article_id='+id
})
},
delarcial(item,index){
var that = this
var url = "article/delArticle"
var params = {
token:uni.getStorageSync('token'),
article_id:item.id
}
app.post(url,params,"post").then((res)=>{
console.log(res)
that.articlelist.splice(index, 1)
uni.showToast({
title:'删除成功',
icon:'none'
})
}).catch((err)=>{
console.log(err)
})
}
},
onLoad(){
this.getMyArticle()
this.gethistory()
this.getMyCellect()
}
}
</script>
<style lang="less">
.content{
background:rgba(249,249,249,1);
height: 100vh;
// padding: 32rpx;
.nodata{
text-align: center;
font-size: 28rpx;
}
.title{
background-color: #fff;
display: flex;
.history,.cellect,.mine{
width: 33%;
text-align: center;
font-size:28rpx;
padding: 24rpx 0;
}
.active{
background: url("../../static/xuanzhong_icon@2x.png") no-repeat;
background-size: 60rpx 12rpx;
background-position: 95rpx 70rpx;
color: rgba(5,132,157,1);
}
}
.minetop{
display: flex;
font-size:32rpx;
width: 686rpx;
margin: 0 auto;
justify-content: space-between;
padding: 30rpx 0;
.mineTitle{
color:rgba(45,85,117,1);
}
.del{
font-size:24rpx;
}
}
.item{
width: 686rpx;
background-color: #fff;
margin: 0 auto;
border-radius:20rpx;
padding: 20rpx 30rpx;
box-sizing: border-box;
margin-bottom: 14rpx;
display: flex;
align-items: center;
.cont{
.rowOne{
font-size:24rpx;
color:rgba(140,145,152,1);
}
.rowTwo{
font-size:28rpx;
color:rgba(61,68,77,1);
margin-top: 16rpx;
}
.rowThree{
font-size:24rpx;
color:rgba(140,145,152,1);
margin-top: 4rpx;
height: 74rpx;
overflow: hidden;
}
}
.icon{
width: 28rpx;
height: 28rpx;
margin-right: 26rpx;
}
}
.liulan{
display: flex;
font-size:32rpx;
width: 686rpx;
margin: 0 auto;
justify-content: space-between;
padding: 30rpx 0;
.liulantitle{
color:rgba(45,85,117,1);
}
.del{
font-size:24rpx;
}
}
.mateitem{
display: flex;
align-items: center;
width:686rpx;
// height:172rpx;
background:rgba(255,255,255,1);
opacity:1;
border-radius:20rpx;
margin: 0 auto;
background-color: #fff;
padding: 24rpx 0;
// box-sizing: border-box;
margin-bottom: 24rpx;
.delBtn{
width: 28rpx;
height: 28rpx;
// position: absolute;
// top: 50%;
// transform: translateY(-50%);
// left: 28rpx;
margin-left: 26rpx;
}
.contentBox{
display: flex;
// align-items: center;
position: relative;
flex-wrap: wrap;
margin-left: 26rpx;
width: 660rpx;
.photo{
width: 68rpx;
height: 68rpx;
margin-right: 26rpx;
margin-top: 6rpx;
}
.cont{
.title{
color:rgba(61,68,77,1);
font-size: 24rpx;
}
.fen{
font-size: 24rpx;
color:rgba(140,145,152,1);
margin-top: 4rpx;
}
}
.right{
width:118rpx;
height:44rpx;
border:2rpx solid rgba(189,196,206,1);
opacity:1;
border-radius:40rpx;
position: absolute;
right: 26rpx;
top: 32rpx;
.text{
color:rgba(189,196,206,1);
text-align: center;
line-height: 44rpx;
font-size:24rpx;
}
}
.txt{
// width: 600rpx;
font-size:28rpx;
margin-top: 24rpx;
}
}
}
}
</style>