Blame view

pages/home/home.vue 13.7 KB
290144e9   易尊强   第一次
1
2
  <template>
  	<view class="page">
508a9ba2   “wangming”   1
3
4
5
  		<view
  			style="position: absolute; top: 0;text-align: center;width: 100%;padding-top: 5px;color: #000;z-index: 99;font-weight: bold;">
  			德阳高新区企业服务中心</view>
290144e9   易尊强   第一次
6
7
8
9
10
  		<view style="position: absolute; top: 0; width: 100%;z-index: 0;">
  			<image src="../../static/bg.png" style="width: 100%; height: 450rpx;"></image>
  		</view>
  		<view class="main">
  			<view class="logo">
9b1c150c   “wangming”   1
11
  				<image src="../../static/logo_new.png" mode="widthFix"></image>
290144e9   易尊强   第一次
12
13
14
15
16
17
18
19
  			</view>
  			<view class="main-top">
  				<view style="width: 68%;">
  					<!-- 搜索 -->
  					<view class="search-head">
  						<view class="search">
  							<image src="../../static/fdj.png"></image>
  							<text></text>
508a9ba2   “wangming”   1
20
  							<input type="text" v-model="selectName" placeholder="搜索关键词1" @input="getMoHuList()" />
290144e9   易尊强   第一次
21
22
23
24
25
  						</view>
  						<view class="btn">
  							<text>搜索</text>
  						</view>
  					</view>
9b1c150c   “wangming”   1
26
27
  					<mo-hu-search :show="selectShow" :list="comList" @select="select" label-name="name" value-name="id"
  						categoryId-name="categoryId"></mo-hu-search>
290144e9   易尊强   第一次
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
  				</view>
  				<view style="width: 30%;">
  					<view class="main-top-right">
  						<view>
  							<image src="../../static/cloudy.png"></image>
  						</view>
  						<view>
  							<view class="main-top-right-text">{{lowerTemp}}~{{higherTemp}}°C</view>
  							<view>{{currentTime}}</view>
  						</view>
  					</view>
  				</view>
  			</view>
  
  			<!-- 菜单导航 -->
  			<view class="menu-nav">
  				<scroll-view scroll-x @scroll="ScrollMenu" class="nav-list">
  					<view class="nav">
  						<view class="list" @click="construct">
  							<image src="../../static/nav/nav_ico1.png"></image>
  							<text>党的建设</text>
  						</view>
  						<view class="list" @click="datain">
  							<image src="../../static/nav/nav_ico2.png"></image>
  							<text>数据填报</text>
  						</view>
  						<view class="list" @click="Feedback">
  							<image src="../../static/nav/nav_ico3.png"></image>
508a9ba2   “wangming”   1
56
  							<text>意见反馈</text>
290144e9   易尊强   第一次
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
  						</view>
  						<view class="list" @click="official">
  							<image src="../../static/nav/nav_ico4.png"></image>
  							<text>公文办理</text>
  						</view>
  						<view class="list" @click="notice">
  							<image src="../../static/nav/nav_ico5.png"></image>
  							<text>公示公告</text>
  						</view>
  					</view>
  					<view class="nav">
  						<view class="list" @click="neighbor">
  							<image src="../../static/nav/nav_ico6.png"></image>
  							<text>邻居计划</text>
  						</view>
  						<view class="list" @click="map">
  							<image src="../../static/nav/nav_ico7.png"></image>
  							<text>企业地图</text>
  						</view>
  						<view class="list" @click="talent">
  							<image src="../../static/nav/nav_ico8.png"></image>
  							<text>人才服务</text>
  						</view>
  						<view class="list" @click="policy">
  							<image src="../../static/nav/nav_ico9.png"></image>
  							<text>政策法规</text>
  						</view>
  						<view class="list" @click="news">
  							<image src="../../static/nav/nav_ico10.png"></image>
  							<text>新闻信息</text>
  						</view>
  					</view>
  				</scroll-view>
  			</view>
  
  			<view class="banner-tu">
9b1c150c   “wangming”   1
93
94
95
96
97
98
99
100
101
102
103
104
  				<!-- <image src="../../static/img/img1.png" mode="widthFix"></image> -->
  				<!-- <uni-swiper-dot :info="info" :current="current" field="content" :mode="mode">
  					<swiper class="swiper-box" @change="change">
  							<swiper-item v-for="(item ,index) in info" :key="index">
  								<view class="swiper-item">
  									<image :src="item.content" mode="widthFix"></image>
  								</view>
  							</swiper-item>
  						</swiper>
  				</uni-swiper-dot> -->
  				<liu-slide-img style="height: 100%;" :list="info" :autoplay="autoplay" :interval="interval"
  					@click="click">></liu-slide-img>
290144e9   易尊强   第一次
105
106
107
108
109
110
111
112
113
114
115
  			</view>
  			<view class="new-content">
  				<view class="new-title">
  					<view>
  						<image src="../../static/nav/nav_ico5.png"></image>
  					</view>
  					<view class="new-title-right">
  						<view class="new-title-big">公示公告</view>
  						<view class="news-title-more" @click="notice()">更多...</view>
  					</view>
  				</view>
46dd6078   易尊强   人才搜索
116
  				<view class="news-text" v-for="(it,index) in noticeHighThree" :key="index" @click="onNotice(it.id)">·
290144e9   易尊强   第一次
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
  					{{it.title}}
  				</view>
  				<!-- <view class="news-text">·做好“第八届中国( 成都智慧产业国际博览会”组织工作的通知</view>
  				<view class="news-text">·德阳高新区 2022年政府信息公开工作年度报告</view> -->
  			</view>
  			<view class="new-content">
  				<view class="new-title">
  					<view>
  						<image src="../../static/nav/nav_ico10.png"></image>
  					</view>
  					<view class="new-title-right blue">
  						<view class="new-title-big">园区快讯</view>
  						<view class="news-title-more" @click="news">更多...</view>
  					</view>
  				</view>
9b1c150c   “wangming”   1
132
  				<!-- <view class="news-img">
290144e9   易尊强   第一次
133
  					<image src="../../static/img/img01.png"></image>
9b1c150c   “wangming”   1
134
135
136
  				</view> -->
  				<view class="news-text" v-for="(it,index) in newsHighThree" :key="index" @click="onArticle(it.id)">·
  					{{it.title}}
290144e9   易尊强   第一次
137
  				</view>
290144e9   易尊强   第一次
138
139
140
141
142
143
144
145
146
147
148
149
150
  				<!-- <view class="news-text news-text-left">·高新区组织召开全体干部职工大会</view>
  				<view class="news-text news-text-left">·市人大工业经济发展代表专业小组在高新区开展</view> -->
  			</view>
  			<view class="new-content">
  				<view class="new-title">
  					<view>
  						<image src="../../static/nav/nav_ico9.png"></image>
  					</view>
  					<view class="new-title-right black">
  						<view class="new-title-big">政策法规</view>
  						<view class="news-title-more" @click="policy">更多...</view>
  					</view>
  				</view>
46dd6078   易尊强   人才搜索
151
  				<view class="news-text" v-for="(it,index) in policyHighThree" :key="index" @click="onPolicyDE(it.id)">·
290144e9   易尊强   第一次
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  					{{it.title}}
  				</view>
  				<!-- <view class="news-text">·国家发展改革委办公厅关于规范招标投标领域信用评价应用应用应用应用</view>
  				<view class="news-text">·四川省人民政府办公厅印发《关于进一步激发市场活力推动发市场活力推动</view> -->
  			</view>
  		</view>
  		<!-- tabbar -->
  		<TabBar :tabBarShow="0"></TabBar>
  	</view>
  </template>
  
  <script>
  	import request from '@/utils/request.js'
  	import TabBar from '../../components/TabBar/TabBar.vue';
  	import utils from '../../service/utils';
46dd6078   易尊强   人才搜索
167
  	import moHuSearch from '../../components/qj-fuzzy-search/index.vue'
290144e9   易尊强   第一次
168
169
  	export default {
  		components: {
46dd6078   易尊强   人才搜索
170
171
  			TabBar,
  			moHuSearch
290144e9   易尊强   第一次
172
173
174
175
176
177
178
179
180
181
182
183
184
185
  		},
  		data() {
  			return {
  				slideNum: 0,
  				newsList: [],
  				noticeList: [],
  				policyList: [],
  				newsHighThree: [],
  				noticeHighThree: [],
  				policyHighThree: [],
  				city: '',
  				cityCode: '',
  				cityName: '',
  				// 最低温度
9b1c150c   “wangming”   1
186
  				lowerTemp: '',
290144e9   易尊强   第一次
187
  				// 最高温度
9b1c150c   “wangming”   1
188
  				higherTemp: '',
290144e9   易尊强   第一次
189
  				// 时间
9b1c150c   “wangming”   1
190
  				currentTime: '',
46dd6078   易尊强   人才搜索
191
192
  				selectShow: false,
  				comList: [],
9b1c150c   “wangming”   1
193
  				selectName: '',
46dd6078   易尊强   人才搜索
194
  				selectId: '',
9b1c150c   “wangming”   1
195
196
197
198
199
200
201
  				categoryId: '',
  				baseUrl: "https://www.dygxq-es.cn",
  				info: [],
  				// current:0,
  				mode: 'round',
  				autoplay: true,
  				interval: 3000
290144e9   易尊强   第一次
202
203
204
205
206
207
208
209
  			}
  		},
  		onShow() {
  			// this.getLocation()
  			this.getNewsList()
  			this.getNoticeList()
  			this.getPolicyList()
  			this.getTianQi()
9b1c150c   “wangming”   1
210
  			this.getLunboList()
290144e9   易尊强   第一次
211
212
213
214
215
  		},
  		onReady() {
  			uni.hideTabBar();
  		},
  		methods: {
9b1c150c   “wangming”   1
216
217
218
  			// change(e) {
  			// 	this.current = e.detail.current;
  			// },
290144e9   易尊强   第一次
219
220
221
222
  			// 获取新闻列表
  			getNewsList() {
  				let that = this
  				that.API.getNewsList({
e6b161ae   易尊强   2/23
223
  					categoryId: '530363088214426885'
290144e9   易尊强   第一次
224
225
226
  				}).then(res => {
  					console.log("新闻", res)
  					that.newsList = res.data.list
9b1c150c   “wangming”   1
227
228
229
230
  					// that.newsHighThree = that.newsList.sort(function(a, b) {
  					// 	return a.ViewCount - b.ViewCount
  					// }).slice(-3)
  					that.newsHighThree = that.newsList.slice(0, 3);
290144e9   易尊强   第一次
231
232
233
234
235
236
237
238
239
240
  					that.newsList = JSON.parse(JSON.stringify(that.newsList.map(it => {
  						return {
  							...it,
  							// createTime:utils.formatTime(it.createTime)
  							createTime: utils.formatTime(it.createTime)
  						}
  					})))
  					console.log(that.newsHighThree)
  				})
  			},
9b1c150c   “wangming”   1
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
  			getLunboList() {
  				request({
  					url: '/api/system/DataInterface/570845601671939333/Actions/Response',
  					method: 'get',
  					data: {}
  				}).then(res => {
  					console.log('轮播图', res.data)
  					if (res.code == 200) {
  						let list = res.data.map(it => {
  							return {
  								...it,
  								F_ImageUrl: JSON.parse(it.F_ImageUrl)
  							}
  						})
  
  						let arr = list.map(it => {
  							return {
  								src: this.baseUrl + it.F_ImageUrl[0].url
  							}
  						})
  						arr.forEach(it => {
  							this.info.push(it)
  						})
  						console.log('轮播图', arr)
  						console.log('轮播图', this.info)
  					}
  				})
  			},
46dd6078   易尊强   人才搜索
269
  			// 首页模糊查询
9b1c150c   “wangming”   1
270
  			getMoHuList() {
46dd6078   易尊强   人才搜索
271
  				this.selectShow = true
9b1c150c   “wangming”   1
272
  				if (this.selectName === '') {
6c679290   易尊强   3/6a上午
273
  					this.selectShow = false
9b1c150c   “wangming”   1
274
  				} else {
6c679290   易尊强   3/6a上午
275
  					request({
9b1c150c   “wangming”   1
276
277
278
279
  						url: '/api/SubDev/zyoaarticle',
  						method: 'get',
  						data: {
  							keyword: this.selectName
6c679290   易尊强   3/6a上午
280
  						}
9b1c150c   “wangming”   1
281
282
283
  					}).then(res => {
  						console.log('模糊查询', res.data)
  						if (res.code === 200) {
6c679290   易尊强   3/6a上午
284
  							let arr = res.data.list
9b1c150c   “wangming”   1
285
  							this.comList = arr.map(it => {
6c679290   易尊强   3/6a上午
286
287
  								return {
  									...it,
9b1c150c   “wangming”   1
288
  									name: it.title
6c679290   易尊强   3/6a上午
289
290
  								}
  							})
9b1c150c   “wangming”   1
291
292
  							this.comList = JSON.parse(JSON.stringify(this.comList))
  							console.log('mohu', this.comList)
6c679290   易尊强   3/6a上午
293
294
295
  						}
  					})
  				}
9b1c150c   “wangming”   1
296
  
46dd6078   易尊强   人才搜索
297
298
  			},
  			select(item) {
9b1c150c   “wangming”   1
299
  
46dd6078   易尊强   人才搜索
300
301
302
  				this.selectName = item.name;
  				this.selectId = item.id
  				this.categoryId = item.categoryId
9b1c150c   “wangming”   1
303
304
  				console.log("栏目ID", this.categoryId)
  				if (this.categoryId == '360233879019193605' || this.categoryId == '360233879019193605') {
46dd6078   易尊强   人才搜索
305
  					this.onArticle(this.selectId)
9b1c150c   “wangming”   1
306
  				} else {
46dd6078   易尊强   人才搜索
307
308
309
310
311
  					this.onNotice(this.selectId)
  				}
  				// if()
  				this.selectShow = false;
  			},
290144e9   易尊强   第一次
312
313
314
315
316
317
  			// 获取公示公告列表
  			getNoticeList() {
  				let that = this
  				that.API.getNoticeList({
  					categoryId: '360234116366468357'
  				}).then(res => {
bd028579   易尊强   2/28
318
  					console.log("公示公告", res)
290144e9   易尊强   第一次
319
  					that.noticeList = res.data.list
9b1c150c   “wangming”   1
320
321
322
323
324
  					// that.noticeHighThree = that.noticeList.sort(function(a, b) {
  					// 	return a.ViewCount - b.ViewCount
  					// }).slice(-3)
  					// 直接获取前三条公告
  					that.noticeHighThree = that.noticeList.slice(0, 3);
290144e9   易尊强   第一次
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
  					that.noticeList = JSON.parse(JSON.stringify(that.noticeList.map(it => {
  						return {
  							...it,
  							createTime: utils.formatTime(it.createTime)
  						}
  					})))
  					console.log(that.noticeHighThree)
  				})
  			},
  			// 获取政策法规列表
  			getPolicyList() {
  				let that = this
  				that.API.getPolicyList().then(res => {
  					console.log("政策", res)
  					that.policyList = res.data.list
9b1c150c   “wangming”   1
340
341
342
343
  					// that.policyHighThree = that.policyList.sort(function(a, b) {
  					// 	return a.ViewCount - b.ViewCount
  					// }).slice(-3)
  					that.policyHighThree = that.policyList.slice(0, 3);
290144e9   易尊强   第一次
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
393
394
  					that.policyList = JSON.parse(JSON.stringify(that.policyList.map(it => {
  						return {
  							...it,
  							createTime: utils.formatTime(it.createTime)
  						}
  					})))
  					console.log(that.policyHighThree)
  				})
  			},
  			policy() {
  				uni.navigateTo({
  					url: '/pages/policy/policy'
  				})
  			},
  			news() {
  				uni.navigateTo({
  					url: '/pages/news/news'
  				})
  			},
  			construct() {
  				uni.navigateTo({
  					url: '/pages/construct/construct'
  				})
  			},
  			notice() {
  				uni.navigateTo({
  					url: '/pages/notice/notice'
  				})
  			},
  			datain() {
  				uni.navigateTo({
  					url: '/pages/datain/datain'
  				})
  			},
  			Feedback() {
  				uni.navigateTo({
  					url: '/pages/Feedback/Feedback'
  				})
  			},
  			map() {
  				uni.navigateTo({
  					url: '/pages/map/map'
  				})
  			},
  			official() {
  				uni.navigateTo({
  					url: '/pages/official/official'
  				})
  			},
  			neighbor() {
  				uni.navigateTo({
1af1c1b1   易尊强   2/29 17:39
395
  					url: '/pages/equip/equip'
290144e9   易尊强   第一次
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
  				})
  			},
  			talent() {
  				uni.navigateTo({
  					url: '/pages/talent/talent'
  				})
  			},
  			onArticle(item) {
  				uni.navigateTo({
  					url: `/pages/newsDetail/newsDetail?data=${JSON.stringify(item)}`
  				})
  			},
  			onPolicyDE(item) {
  				uni.navigateTo({
  					url: `/pages/policyDetail/policyDetail?data=${JSON.stringify(item)}`
  				})
  			},
  			onNotice(item) {
  				uni.navigateTo({
  					url: `/pages/newsDetail/newsDetail?data=${JSON.stringify(item)}`
  				})
  			},
  
  			// 获取天气预报
  			getTianQi() {
  				uni.getLocation({
  					type: 'wgs84',
  					success: (res) => {
  						const latitude = res.latitude;
  						const longitude = res.longitude;
  						console.log('经度' + longitude, '纬度' + latitude)
  						// const latitude = 22.8092997; const longitude = 113.547439;
  						// 将经纬度转换为城市名称
  						uni.request({
  							url: 'https://restapi.amap.com/v3/geocode/regeo',
  							data: {
  								key: '1ed58e357871f9bd1fbf19c480b7afea', //自己的高德密钥key
  								location: `${longitude},${latitude}`
  							},
  							success: (res) => {
  								const city = res.data.regeocode.addressComponent.city;
  								this.cityName = city
  								// 获取天气预报
  								uni.request({
  									url: 'https://restapi.amap.com/v3/weather/weatherInfo',
  									data: {
  										city: city,
9b1c150c   “wangming”   1
443
444
  										key: '1ed58e357871f9bd1fbf19c480b7afea', //自己的高德密钥key
  										extensions: 'all'
290144e9   易尊强   第一次
445
446
447
448
  									},
  									success: (res) => {
  										const weatherData = res.data.forecasts[0];
  										console.log(res)
9b1c150c   “wangming”   1
449
  										console.log("总的", weatherData)
290144e9   易尊强   第一次
450
451
452
453
  										console.log('当前城市:', city);
  										console.log('天气信息:', weatherData[0]);
  										var regEx = /-/g;
  										var str = weatherData.reporttime.split(' ')[0]
9b1c150c   “wangming”   1
454
455
  										this.currentTime = str.replace(regEx, '/')
  										console.log('currentTime', this.currentTime)
290144e9   易尊强   第一次
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
  										this.lowerTemp = weatherData.casts[0].nighttemp
  										this.higherTemp = weatherData.casts[0].daytemp
  									},
  									fail: (error) => {
  										console.error('获取天气信息失败:', error);
  									}
  								});
  							},
  							fail: (error) => {
  								console.error('获取城市名称失败:', error);
  							}
  						});
  					},
  					fail: (error) => {
  						console.error('获取地理位置失败:', error);
  					}
  				});
  			}
  		}
  	};
  </script>
  
  <style scoped lang="scss">
  	@import 'home.scss';
  </style>