Jelajahi Sumber

更新首页

李书文 1 tahun lalu
induk
melakukan
87b6f7e863
1 mengubah file dengan 22 tambahan dan 5 penghapusan
  1. 22 5
      pages/index/index.vue

+ 22 - 5
pages/index/index.vue

@@ -6,7 +6,8 @@
 				<view class="vse">
 					<u-search placeholder="搜索资讯" v-model="keyword" @search="search" :actionStyle="{ color: 'white' }" :animation="true" actionText="取消"></u-search>
 				</view>
-				<view class="icon" @click="scanCode()">&#xe60d;</view>
+				<view class="icon" @click="message()">&#xe60d;</view>
+				<view class="bage" v-if="count > 0"></view>
 			</view>
 			<!--轮播图-->
 			<u-swiper circular :radius="5" :indicator="true" keyName="image" :list="bannerList" :height="110" class="uni-swiper" @click="click"></u-swiper>
@@ -60,7 +61,8 @@ export default {
 			newsList: [],
 			noticeList: ['边民互市贸易APP上线了', '关于边民互市贸易开通注意事项'],
 			roleMenu: [],
-			menuList: []
+			menuList: [],
+			count: 0
 		};
 	},
 	onLoad() {
@@ -79,6 +81,7 @@ export default {
 				loading: 'false',
 				success: res => {
 					if (res.data.data.count > 0) {
+						this.count = res.data.data.count;
 						uni.setTabBarBadge({ index: 1, text: res.data.data.count });
 					}
 				}
@@ -117,10 +120,15 @@ export default {
 				}
 			});
 		},
+		//点击轮播图
+		click(index) {
+			uni.navigateTo({ url: '/pages/news/detail?id=8' });
+		},
+		message() {
+			uni.switchTab({ url: '/pages/message/message' });
+		},
 		search() {
-			uni.navigateTo({
-				url: '/pages/news/list?keyword=' + this.keyword
-			});
+			uni.navigateTo({ url: '/pages/news/list?keyword=' + this.keyword });
 		},
 		navTo(url) {
 			uni.navigateTo({
@@ -163,6 +171,15 @@ page {
 			font-size: 25px;
 			top: 5px;
 		}
+		.bage {
+			width: 8px;
+			height: 8px;
+			border-radius: 50%;
+			background-color: #f44336;
+			top: 0px;
+			right: 0px;
+			position: absolute;
+		}
 	}
 	.uni-swiper {
 		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);