Blame view

pages/policy/policy.vue 7.48 KB
290144e9   易尊强   第一次
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
  <template>
  	<view class="page">
  		<view class="coupon-tab">
  			<view class="tab" :class="{'action':TabShow==='人才'}" @click="onCouponTab('人才')">
  				<text>人才</text>
  			</view>
  			<view class="tab" :class="{'action':TabShow==='企业'}" @click="onCouponTab('企业')">
  				<text>企业</text>
  			</view>
  			<view class="tab" :class="{'action':TabShow==='金融'}" @click="onCouponTab('金融')">
  				<text>金融</text>
  			</view>
  			<view class="tab" :class="{'action':TabShow==='法律法规'}" @click="onCouponTab('法律法规')">
  				<text>法律法规</text>
  			</view>
  			<view class="tab" :class="{'action':TabShow==='其他'}" @click="onCouponTab('其他')">
  				<text>其他</text>
  			</view>
  		</view>
  		<view class="coupon-tab-one">
  			<view class="tab" :class="{'action':TabSecond==='国家级'}" @click="onCouponSecondTab('国家级')">
  				<text>国家级</text>
  			</view>
  			<view class="tab" :class="{'action':TabSecond==='省级'}" @click="onCouponSecondTab('省级')">
  				<text>省级</text>
  			</view>
  			<view class="tab" :class="{'action':TabSecond==='市级'}" @click="onCouponSecondTab('市级')">
  				<text>市级</text>
  			</view>
  			<view class="tab" :class="{'action':TabSecond==='本地'}" @click="onCouponSecondTab('本地')">
  				<text>本地</text>
  			</view>
  		</view>
  		<!-- 搜索 -->
  		<view class="search-head">
  			<view class="search">
  				<image src="../../static/fdj1.png"></image>
  				<text></text>
  				<input type="text" v-model="keyword" placeholder="搜索关键词" />
  			</view>
  			<view class="btn" @click="search">
  				<text>搜索</text>
  			</view>
  		</view>
  		<!-- 文章数据 -->
  		<view>
  			<!-- @down="downCallback"
  			@up="upCallback"
  			:down="downOption"
  			:up="upOption"
  			:top="0" -->
  			<!-- <mescroll-body ref="mescrollRef"
                    > -->
  			<view ref="mescrollRef">
  				<view class="article-data">
  					<!-- 党的建设发布 -->
  					<view class="postCon" v-show="isAdmin" @click="toPost()">
  						政策法规发布
  					</view>
  					<!-- <view class="noData" v-show="haveData">
  						暂无此类数据
  					</view> -->
  					<view class="article-list">
bd028579   易尊强   2/28
64
  						<view class="list" v-for="(item,index) in fenLeiList" @click="onArticle(item.id)" :key="index">
290144e9   易尊强   第一次
65
66
67
68
69
70
71
72
73
74
  							<view class="item">
  								<view class="title">
  									<text class="two-omit">{{ item.title }}</text>
  								</view>
  								<view class="find-collect">
  									<view class="find">
  										<text>{{item.createTime}}</text>
  									</view>
  								</view>
  							</view>
e6b161ae   易尊强   2/23
75
76
77
  							<!-- <view class="thumb" v-if="item.isImg">
  								<image :src="baseUrl + item.imgUrl[0].url"></image>
  							</view> -->
1af1c1b1   易尊强   2/29 17:39
78
  							<!-- <view class="thumb">
e6b161ae   易尊强   2/23
79
  								<image src="../../static/img/img3.jpg"></image>
1af1c1b1   易尊强   2/29 17:39
80
  							</view> -->
290144e9   易尊强   第一次
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
  						</view>
  					</view>
  				</view>
  			</view>
  			<!-- </mescroll-body> -->
  		</view>
  	</view>
  </template>
  
  <script>
  	import service from '../../service/service.js'
  	import utils from '../../service/utils.js';
  	import util from '../../service/utils.js'
  	export default {
  		data() {
  			return {
  				TabShow: '人才',
  				TabSecond: '国家级',
  				AllList: [],
  				fenLeiList: [],
  				searchList: [],
  				keyword: '',
  				isAdmin: false,
  				categoryId: '360234017372505349',
  				baseUrl: "http://deyanggaoxin.fengshiyun.com",
e6b161ae   易尊强   2/23
106
107
  				haveData:false,
  				isImg:false
290144e9   易尊强   第一次
108
109
110
111
112
113
114
115
  			};
  		},
  		onLoad() {
  			let that = this
  			that.getUser()
  			that.getPolicyList()
  		},
  		methods: {
6c679290   易尊强   3/6a上午
116
  			// 获取用户信息判断是否有政策法规发布的ID,权限判断authority = 396297481161278725
290144e9   易尊强   第一次
117
118
119
120
121
122
123
124
125
  			getUser() {
  				if (uni.getStorageSync('user')) {
  					let userCode = uni.getStorageSync('user')
  					// console.log("用户的code", this.userCode)
  					this.userId = userCode.userInfo.userId
  					this.userName = userCode.userInfo.userAccount
  					this.userIcon = userCode.userInfo.headIcon
  					this.organizeName = userCode.userInfo.organizeName
  					// this.isAdmin = userCode.userInfo.isCompany
6c679290   易尊强   3/6a上午
126
127
128
  					let authorityID = userCode.permissionList
  					this.isAdmin = authorityID.some(it => it.modelId === '396297481161278725')
  					console.log('是否有政策法规发布权限',this.isAdmin)
290144e9   易尊强   第一次
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  				} else {
  					uni.showToast({
  						title: '请登录',
  						icon: 'none'
  					})
  				}
  			},
  			// 获取政策法规列表
  			getPolicyList() {
  				let that = this
  				that.API.getPolicyList({
  					// categoryId: this.categorrId,
  					// categoryId:'360234017372505349',
  					// keyword: this.keyword,
  					pageSize:500
  				}).then(res => {
  					console.log(res)
  					that.AllList = res.data.list
e6b161ae   易尊强   2/23
147
  					console.log('总的',that.AllList)
290144e9   易尊强   第一次
148
149
150
  					that.AllList = that.AllList.map(it => {
  						return {
  							...it,
e6b161ae   易尊强   2/23
151
152
  							createTime: utils.formatTime(it.createTime),
  							// isImg: it.imgUrl.length > 0
290144e9   易尊强   第一次
153
154
155
156
157
158
159
160
  						}
  					})
  					this.fenLeiList = that.AllList.filter(it=>{
  						return it.isType == '人才'
  					})
  					if(this.fenLeiList === []){
  						this.haveData = true
  					}
e6b161ae   易尊强   2/23
161
  					console.log("this.AllList", this.AllList)
290144e9   易尊强   第一次
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
  					console.log("分类", this.fenLeiList)
  				})
  			},
  			onCouponTab(type) {
  				let that = this
  				this.TabShow = type;
  				
  				// if(type == '其他'){
  				// 	that.fenLeiList = that.AllList.filter(it => {
  				// 		return it.isType === that.TabShow || it.isType === null
  				// 	})
  				// 	if(this.fenLeiList === null){
  				// 		this.haveData = true
  				// 	}
  				// }else{
  				// 	that.fenLeiList = that.AllList.filter(it => {
  				// 		return it.isType === that.TabShow
  				// 	})
  				// 	if(this.fenLeiList === null){
  				// 		this.haveData = true
  				// 	}
  				// }
  				
  				that.API.getPolicyList({
  					isType:this.TabShow,
  					isType2:this.TabSecond,
  					pageSize:500
  				}).then(res => {
  					console.log(res)
  					that.AllList = res.data.list
  					console.log(that.AllList)
  					that.AllList = that.AllList.map(it => {
  						return {
  							...it,
e6b161ae   易尊强   2/23
196
197
  							createTime: utils.formatTime(it.createTime),
  							// isImg: it.imgUrl.length > 0
290144e9   易尊强   第一次
198
199
200
201
202
203
204
205
  						}
  					})
  					this.fenLeiList = that.AllList
  					if(this.fenLeiList === []){
  						this.haveData = true
  					}
  					console.log("分类", this.fenLeiList)
  				})
e6b161ae   易尊强   2/23
206
  				console.log('this.fenLeiList',this.fenLeiList)
290144e9   易尊强   第一次
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
  				console.log(type)
  			},
  			// 显示下方为国家级还是省级等
  			onCouponSecondTab(type) {
  				let that = this
  				this.TabSecond = type
  				console.log(type)
  				that.API.getPolicyList({
  					isType:this.TabShow,
  					isType2:this.TabSecond,
  					pageSize:500
  				}).then(res => {
  					console.log(res)
  					that.AllList = res.data.list
  					console.log(that.AllList)
  					that.AllList = that.AllList.map(it => {
  						return {
  							...it,
e6b161ae   易尊强   2/23
225
226
  							createTime: utils.formatTime(it.createTime),
  							// isImg: it.imgUrl.length > 0
290144e9   易尊强   第一次
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
  						}
  					})
  					this.fenLeiList = that.AllList
  					if(this.fenLeiList === []){
  						this.haveData = true
  					}
  					console.log("分类", this.fenLeiList)
  				})
  			},
  			onArticle(item) {
  				uni.navigateTo({
  					url: `/pages/policyDetail/policyDetail?data=${JSON.stringify(item)}`
  				})
  			},
  			search() {
  				let that = this
  				that.API.getPolicyList({
e6b161ae   易尊强   2/23
244
  					// categoryId: this.categoryId,
290144e9   易尊强   第一次
245
246
247
248
249
250
  					keyword: this.keyword
  				}).then(res => {
  					// console.log(res)
  					that.fenLeiList = res.data.list.map(it => {
  						return {
  							...it,
e6b161ae   易尊强   2/23
251
252
  							createTime: utils.formatTime(it.createTime),
  							// isImg: it.imgUrl.length > 0
290144e9   易尊强   第一次
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
  						}
  					})
  					if(this.fenLeiList === null){
  						this.haveData = true
  					}
  					// console.log(that.AllList)
  				})
  			},
  			// 跳转到发布页面
  			toPost() {
  				uni.navigateTo({
  					url: '/pages/postPolicy/postPolicy'
  				})
  			}
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'policy.scss';
  </style>