Browse Source

惠民通调试完毕(点赞除外)

qinhouyu 1 năm trước cách đây
mục cha
commit
f5286b4563

+ 4 - 4
pages/fuwu/fuwu.vue

@@ -16,19 +16,19 @@
 		</view>
 	    <view class="rnwdList">
 	        <view class="list" @tap.stop="goDetails(item)" v-for="(item, index1) in qbwd" :key="index1">
-				<span v-if="item.isTop == 1" style="color: red;">[置顶]</span>
+				<span v-if="item.top == 1" style="color: red;">[置顶]</span>
 	            <span class="listTitle">{{ item.titleName }}</span>
 	
-	            <view class="onePic" v-if="item.isTop != 1  ? item.urls.length == 1 : false ">
+	            <view class="onePic" v-if="item.top != 1  ? item.urls.length == 1 : false ">
 	                <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
 					</image>
 	            </view>
-	            <view class="twoPic" v-if="item.isTop != 1 ? item.urls.length == 2 : false">
+	            <view class="twoPic" v-if="item.top != 1 ? item.urls.length == 2 : false">
 	                <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
 					</image>
 	            </view>
 	
-	            <view class="threePic" v-if="item.isTop != 1 ? item.urls.length == 3 : false">
+	            <view class="threePic" v-if="item.top != 1 ? item.urls.length == 3 : false">
 	                <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
 					</image>
 	            </view>

+ 4 - 7
pages/index/index.vue

@@ -2,7 +2,7 @@
 	<view>
 		<!-- index.wxml -->
 		<view class="topBj">
-			<image :src="loadImgSrc('/jcb-top.png')"></image>
+			<image :src="'https://tse1-mm.cn.bing.net/th/id/OIP-C.JsghMT_u8V52I4PSHow2hAHaEG?w=332&h=186&c=7&r=0&o=5&pid=1.7'"></image>
 		</view>
 		<view class="container">
 			<!-- 主导航 -->
@@ -86,7 +86,7 @@
 				:circular="circular" class="banner">
 				<block v-for="(item, index) in banners" :key="index">
 					<swiper-item>
-						<image :src="loadImgSrc(item.src)" mode="aspectFill"></image>
+						<image :src="item.src" mode="aspectFill"></image>
 					</swiper-item>
 				</block>
 			</swiper>
@@ -235,10 +235,7 @@
 			return {
 				// 图片轮播
 				banners: [{
-						src: '/img1.png'
-					},
-					{
-						src: '/img2.png'
+						src: 'https://tse1-mm.cn.bing.net/th/id/OIP-C.JsghMT_u8V52I4PSHow2hAHaEG?w=332&h=186&c=7&r=0&o=5&pid=1.7'
 					}
 				],
 				announcementList: [{
@@ -547,4 +544,4 @@
 </script>
 <style>
 	@import './index.css';
-</style>
+</style>

+ 11 - 11
pages/informationDetail/informationDetail.vue

@@ -18,7 +18,7 @@
             <view class="wenzhangCont article">
                 <span v-html="detailInfo.textDetails">
                 </span>
-			
+
                 <view >
                     <!-- 图片轮播 -->
                     <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration" :circular="circular">
@@ -28,8 +28,8 @@
                     </swiper>
                 </view>
             </view>
-			
-			
+
+
         </view>
 	</view>
 </template>
@@ -45,7 +45,7 @@ export default {
 				{
 					deptName:'国家乡村振兴局',
 					updateTime:'2023-2-27 16:04',
-					desc:'用好政策效果评估成果,进一步优化巩固拓展脱贫攻坚成果同乡村振兴有效衔接政策供给,为推动工作提质增效提供有力支撑保障。',					
+					desc:'用好政策效果评估成果,进一步优化巩固拓展脱贫攻坚成果同乡村振兴有效衔接政策供给,为推动工作提质增效提供有力支撑保障。',
 				}
 			],
 			isCollection:false,
@@ -61,7 +61,7 @@ export default {
 			this.anwserList.push({
 				deptName:'国家烟草局',
 				updateTime:new Date().getFullYear() + "-" + new Date().getMonth() + "-" + new Date().getDay() + " " + (new Date().getHours() < 10 ? "0" + new Date().getHours() : new Date().getHours()) + ':' + (new Date().getMinutes() < 10 ? "0" + new Date().getMinutes() : new Date().getMinutes()),
-				desc:this.anwserVal,		
+				desc:this.anwserVal,
 			})
 			this.anwserVal = null
 		},
@@ -83,11 +83,11 @@ export default {
 					allSrc.forEach(e => {
 						newHtml = newHtml.replace(e,this.loadImgSrc(e))
 					})
-				} 
+				}
 			}catch(e){
 				//TODO handle the exception
 			}
-			
+
 			return newHtml
 		}
 	}
@@ -105,8 +105,8 @@ export default {
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady(e) {  
-	}, 
+    onReady(e) {
+	},
     /**
      * 生命周期函数--监听页面显示
      */
@@ -142,7 +142,7 @@ export default {
 	}
 }
 .not-collect{
-	
+
 }
 .effectBix{
 	width: 56px;
@@ -189,7 +189,7 @@ export default {
   --slice-3: inset(10% -6px 85% 0);
   --slice-4: inset(40% -6px 43% 0);
   --slice-5: inset(80% -6px 5% 0);
-  
+
   content: 'AVAILABLE NOW';
   display: block;
   position: absolute;

+ 102 - 35
pages/toGovernmentList/toGovernmentList.vue

@@ -1,49 +1,59 @@
 <template>
     <!-- pages/me.wxml -->
 	<view class="container">
-		<uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="search"  @input="search"
-		style="width: 100%;"
-			@cancel="cancel">
-		</uni-search-bar>
+		<view style="width: 100%;display: flex;">
+			<uni-search-bar  :focus="true" v-model="searchValue"  @input="search"
+				style="width: 70%;"
+				@cancel="cancel">
+			</uni-search-bar>
+			  <uni-data-select
+				  style="width: 30%;margin: auto;"
+				  v-model="value"
+				  placeholder="请选择排序"
+				  :localdata="range"
+				  @change="getList(value)"
+			></uni-data-select>
+		</view>
 	    <view class="rnwdList">
-	        <view class="list" @tap="goDetails(item)" v-for="(item, index1) in qbwd" :key="index1">
+	        <view class="list" @tap.stop="goDetails(item)" v-for="(item, index1) in qbwd" :key="index1">
+				<span v-if="item.top == 1" style="color: red;">[置顶]</span>
 	            <span class="listTitle">{{ item.titleName }}</span>
-	
-	            <view class="onePic" v-if="item.urls.length == 1">
+
+	            <view class="onePic" v-if="item.top != 1  ? item.urls.length == 1 : false ">
 	                <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
 					</image>
 	            </view>
-	            <view class="twoPic" v-if="item.urls.length == 2">
+	            <view class="twoPic" v-if="item.top != 1 ? item.urls.length == 2 : false">
 	                <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
 					</image>
 	            </view>
-	
-	            <view class="threePic" v-if="item.urls.length == 3">
+
+	            <view class="threePic" v-if="item.top != 1 ? item.urls.length == 3 : false">
 	                <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
 					</image>
 	            </view>
-	
-	           <!-- <view class="jlSj">
+
+	           <view class="jlSj">
 	                <span class="jf">
-	                    {{ item.jf }}
-	                    <em class="iconfont icon-jifen"></em>
+	                   <!-- {{ item.jf }}
+	                    <em class="iconfont icon-jifen"></em> -->
 	                </span>
 	                <view class="ck">
-	                    <span>
+	                    <!-- <span>
 	                        <em class="iconfont icon-pinglun"></em>
 	                        {{ item.pl }}
-	                    </span>
+	                    </span> -->
 	                    <span>
 	                        <em class="iconfont icon-chakan"></em>
-	                        {{ item.ck }}
+	                        {{ item.watchNum }}
 	                    </span>
-	                    <span>
-	                        <em class="iconfont icon-shoucang"></em>
-	                        {{ item.dz }}
+	                    <span :class=" favoriteList.includes(item.id) ? 'favorite' : 'not-favorite' ">
+	                        <em class="iconfont icon-shoucang" @click.stop="addFavorite(item)"></em>
+	                        {{ currentFavoriteCount(item) }}
 	                    </span>
 	                </view>
-	            </view> -->
-	
+	            </view>
+
 			</view>
 	    </view>
 		<!-- 新增资讯按钮 -->
@@ -52,7 +62,7 @@
 </template>
 
 <script>
-import { listWxs ,listWx} from '@/api/information/information.js'
+import { listWxs ,listWx,likeServer} from '@/api/information/information.js'
 // pages/me.js
 export default {
     data() {
@@ -62,16 +72,24 @@ export default {
 			  pageNum: 1,
 			  pageSize: 7,
 			  titleName: '',
-			  isGovernment:'',
 			  type: 10,
-			  flag:''
+			  flag:'',
+			  isTop:null
 			},
+			topList:[],
 			total:0,
-			searchValue:''
+			searchValue:'',
+			favoriteList:[],
+			value: 1,
+			range: [
+				{ value: 'watch', text: "热度" },
+				{ value: 'like', text: "点赞" },
+				{ value: '', text: "最新" },
+			],
 		};
     },
 	created(){
-		
+
 	},
 	onReachBottom(){
 		let pageNum = this.listParams.pageNum
@@ -88,12 +106,48 @@ export default {
 		}
 	},
 	methods:{
+		currentFavoriteCount(e){
+			if(this.favoriteList.includes(e.id)){
+				return e.likeNum + 1
+			} else {
+				return e.likeNum
+			}
+		},
+		addFavorite(e){
+			if(this.favoriteList.includes(e.id)) return
+			likeServer({
+				id:e.id,
+				type:12
+			}).then(e => {
+			})
+			this.favoriteList.push(e.id)
+			return
+			if(this.favoriteList.includes(e.id)){
+				// 取消点赞
+				likeServer({
+					id:e.id,
+					type:10
+				})
+				let deleteIdx = this.favoriteList.findIndex((v => v == e.id))
+				this.favoriteList.splice(deleteIdx,1)
+			} else {
+				likeServer({
+					id:e.id,
+					type:10
+				})
+				this.favoriteList.push(e.id)
+			}
+		},
+		cancel(){
+			this.listParams.titleName = ''
+		},
 		search(){
 			this.listParams.titleName = this.searchValue
-			this.qbwd = []
 			this.getList()
 		},
-		getList(){
+		getList(val = null){
+			this.listParams.flag = val || ''
+			this.qbwd = this.topList
 			listWxs(this.listParams).then(res => {
 				this.qbwd = [...this.qbwd,...res.rows]
 				this.total = res.total
@@ -117,17 +171,21 @@ export default {
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-		console.log(options)
 		if(options.type!=null){
 			this.listParams.type = options.type
 		}
 		if(options.type==null){
 			this.listParams.isGovernment = 1
 		}
-		this.getList()
-		// 查置顶
-		listWx({}).then(e => {
-		})
+      // 查置顶
+      listWx({
+        type:10,
+        isTop:1
+      }).then(e => {
+        this.topList = e.data
+        this.qbwd = this.topList
+        this.getList()
+      })
 	},
     /**
      * 生命周期函数--监听页面初次渲染完成
@@ -155,9 +213,18 @@ export default {
     onShareAppMessage() {},
 };
 </script>
-<style>
+<style lang="scss">
 @import './index.css';
 .container{
 	height: 100%;
+	content: '\e633';
+}
+.favorite{
+	.icon-shoucang:before{
+		color: red;
+	}
+}
+.not-favorite{
+
 }
 </style>