Forráskód Böngészése

更新首页图片

李书文 1 éve
szülő
commit
5cc14efafc
4 módosított fájl, 28 hozzáadás és 14 törlés
  1. 20 11
      pages/index/index.vue
  2. 8 3
      pages/news/list.vue
  3. BIN
      static/news.jpg
  4. BIN
      static/tp.jpg

+ 20 - 11
pages/index/index.vue

@@ -35,12 +35,12 @@
 				</view>
 				<view class="list animated fadeInDown">
 					<view class="news_item" v-for="(item, index) in newsList" :key="index" @click="go('/pages/news/detail?id=' + item.id)">
-						<image src="../../static/news.jpg" mode="aspectFill" class="img"></image>
+						<image src="../../static/tp.jpg" mode="aspectFill" class="img"></image>
 						<view class="con">
 							<view class="title ellip">{{ item.title }}</view>
 							<view class="source omit">
 								<text class="icon">&#xe639;</text>
-								<text>{{item.readCount}}</text>
+								<text>{{ item.readCount }}</text>
 							</view>
 							<view class="releaseTime">{{ item.releaseTime }}</view>
 						</view>
@@ -69,17 +69,21 @@ export default {
 		this.getMenu();
 	},
 	onShow() {
-		this.http.request({
-			url: '/sp-admin/app/TbMessage/getRead',
-			loading: 'false',
-			success: res => {
-				if (res.data.data.count > 0) {
-					uni.setTabBarBadge({ index: 1, text: res.data.data.count });
-				}
-			}
-		});
+		this.keyword = '';
+		this.getRead();
 	},
 	methods: {
+		getRead() {
+			this.http.request({
+				url: '/sp-admin/app/TbMessage/getRead',
+				loading: 'false',
+				success: res => {
+					if (res.data.data.count > 0) {
+						uni.setTabBarBadge({ index: 1, text: res.data.data.count });
+					}
+				}
+			});
+		},
 		getBannerList() {
 			this.http.request({
 				url: '/level-one-server/app/TbBanner/getList',
@@ -113,6 +117,11 @@ export default {
 				}
 			});
 		},
+		search() {
+			uni.navigateTo({
+				url: '/pages/news/list?keyword=' + this.keyword
+			});
+		},
 		navTo(url) {
 			uni.navigateTo({
 				url: url,

+ 8 - 3
pages/news/list.vue

@@ -1,11 +1,11 @@
 <template>
 	<view>
 		<view class="search">
-			<u-search placeholder="搜索资讯" v-model="param.title"  bgColor="white" @search="refresh()" :animation="true" actionText="取消" @clear="refresh()"></u-search>
+			<u-search placeholder="搜索资讯" v-model="param.title" bgColor="white" @search="refresh()" :animation="true" actionText="取消" @clear="refresh()"></u-search>
 		</view>
 		<view class="list">
 			<view class="news_item" v-for="(item, index) in list" :key="index" @click="detail(item)">
-				<image src="../../static/news.jpg" mode="aspectFill" class="img"></image>
+				<image src="../../static/tp.jpg" mode="aspectFill" class="img"></image>
 				<view class="con">
 					<view class="title ellip">{{ item.title }}</view>
 					<view class="source omit">{{ item.source }}</view>
@@ -28,7 +28,12 @@ export default {
 		};
 	},
 	onLoad(e) {
-		this.getData();
+		if (e.keyword) {
+			this.param.title = e.keyword;
+			this.refresh();
+		} else {
+			this.getData();
+		}
 	},
 	methods: {
 		getData() {

BIN
static/news.jpg


BIN
static/tp.jpg