Переглянути джерело

前端H5和小程序——》信息发布

xiaoshushu 3 роки тому
батько
коміт
20df95ab9f

+ 1 - 0
smart-admin/src/main/java/com/huijy/web/controller/api/ApiAbstractController.java

@@ -155,6 +155,7 @@ public abstract class ApiAbstractController {
 		rspData.setMsg("查询成功");
 		rspData.setRows(list);
 		rspData.setTotal(new PageInfo(list).getTotal());
+		rspData.setPages(new PageInfo(list).getPages());
 		return rspData;
 	}
 

+ 13 - 0
smart-common/src/main/java/com/huijy/common/core/page/TableDataInfo.java

@@ -25,6 +25,11 @@ public class TableDataInfo implements Serializable
     private String msg;
 
     /**
+     * 总页数
+     */
+    private long pages;
+
+    /**
      * 表格数据对象
      */
     public TableDataInfo()
@@ -82,4 +87,12 @@ public class TableDataInfo implements Serializable
     {
         this.msg = msg;
     }
+
+    public long getPages() {
+        return pages;
+    }
+
+    public void setPages(long pages) {
+        this.pages = pages;
+    }
 }

+ 1 - 1
smart-ui-app/App.vue

@@ -25,7 +25,7 @@ button::after { border: none }
 /**挂载iconfont图表*/
 @font-face {
 	font-family: 'iconfont';
-	src: url('https://at.alicdn.com/t/font_2816842_prqpn28m9t.ttf?t=1631771735015') format('truetype');
+	src: url('https://at.alicdn.com/t/font_2816842_pf6sfv219m.ttf?t=1631771735015') format('truetype');
 	/* src: url('~@/static/font/iconfont.ttf') format('truetype'); */
 }
 .icon {

+ 4 - 15
smart-ui-app/common/http.js

@@ -1,25 +1,14 @@
 //const ip = 'http://192.168.0.101:8080';
-const ip = 'https://qfnj.gaswkj.com/prod-api';
-//const ip = 'http://127.0.0.1:8080';
+//const ip = 'https://qfnj.gaswkj.com/prod-api';
+const ip = 'http://192.168.2.101:8080';
 /**
  * 全部接口
  */
 const urls = {
 	ip: ip,
 	home: ip + '/app/home/index', //首页数据
-	bindPhone: ip + '/app/user/bindPhone', //绑定手机
-	login: ip + '/app/user/login', //用户登陆
-	goods_list: ip + '/app/goods/goodsList', //商品服务列表
-	goods_detail: ip + '/app/goods/detail/', //商品详情
-	cart_list: ip + '/app/cart/list', //购物车列表
-	cart_add: ip + '/app/cart/add', //添加购物车
-	cart_del: ip + '/app/cart/del/', //删除购物车
-	notice: ip + '/app/other/notice', //消息公告
-	notice_detail: ip + '/app/other/notice/', //公告详情
-	pay: ip + '/app/wxPay/pay', //微信支付
-	order_list: ip + '/app/order/list', //我的订单
-	order_cancel: ip + '/app/order/cancel', //取消订单
-	order_detail: ip + '/app/order/detail', //订单详情
+	getPageContent: ip + '/api/index/getPageContent', //分页获取主要内容信息
+	getContentInfo: ip + '/api/index/getContentInfo/', //获取主要内容详细信息
 	dictType: ip + '/app/other/type/', //根据字典类型查询字典数据信息
 
 }

+ 1 - 1
smart-ui-app/manifest.json

@@ -50,7 +50,7 @@
     "quickapp" : {},
     /* 小程序特有相关 */
     "mp-weixin" : {
-        "appid" : "wx1fbf524e470b0549",
+        "appid" : "wx01e139c8c2cd0fa4",
         "setting" : {
             "urlCheck" : false
         },

+ 38 - 6
smart-ui-app/pages/government/detail.vue

@@ -1,16 +1,13 @@
 <template>
 	<view class="contents">
-		<view class="title"><text>西藏新增12家4A级景区,get到你的眼球吗?</text></view>
+		<view class="title"><text>{{item.title}}</text></view>
 		<view class="ly">
-			<text>公众号名称</text>
+			<text>{{item.author}}</text>
 			<text class="day">4天前</text>
 		</view>
 		<view>
-			<image src="../../static/b1.jpg" mode="widthFix" class="pic"></image>
-			<image src="../../static/b2.jpg" mode="widthFix" class="pic"></image>
-			<image src="../../static/b3.jpg" mode="widthFix" class="pic"></image>
 			<view class="fwb">
-				这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容
+				<u-parse :html="item.content"></u-parse>
 			</view>
 			<view class="mt10">
 				<view class="">来源:作者名称</view>
@@ -26,8 +23,43 @@
 export default {
 	data() {
 		return {
+			ip: this.$http.urls.ip,
 			item: {}
 		};
+	},
+	onLoad(e) {
+		this.$http.request({
+			url: this.$http.urls.getContentInfo+ e.id,
+			success: res => {
+				console.log("asd:"+JSON.stringify(res));
+				this.item = res.data.data.info;
+				//this.item.contents = res.data.data.contents.replace(/\<img/gi, '<img style=width:100%;height:auto');
+			}
+		});
+	},
+	methods: {
+		//购物车
+		car() {
+			uni.switchTab({
+				url: 'shopcar'
+			});
+		},
+		//添加购物车
+		add() {
+			this.$http.request({
+				url: this.$http.urls.cart_add,
+				method: 'POST',
+				data: { goodsId: this.item.id, userId: this.$getUser().id },
+				success: res => {
+					uni.showToast({ title: '已加入购物车', icon: 'none' });
+				}
+			});
+		},
+		//直接购买服务
+		buy() {
+			let list = [{ goodsId: this.item.id, goods: { title: this.item.title, price: this.item.price, pic: this.item.pic } }];
+			uni.navigateTo({ url: 'pay?list=' + JSON.stringify(list) });
+		}
 	}
 };
 </script>

+ 46 - 5
smart-ui-app/pages/government/index.vue

@@ -3,12 +3,12 @@
 		<view class="list">
 			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
 				<view class="r65">
-					<view class="title">这是标题</view>
-					<view class="desc">这是内容介绍,可以是文字</view>
+					<view class="title">{{item.title}}</view>
 				</view>
-				<view class="r35 day">2021· 8· 27</view>
+				<view class="r35 day">{{item.createTime.substring(0,11)}}</view>
 				<view class="clear"></view>
 			</view>
+			<view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 		</view>
 	</view>
 </template>
@@ -17,13 +17,54 @@
 export default {
 	data() {
 		return {
-			list: ['1', '2', '3', '4', '5']
+			list: [],
+			param: { pageNum: 1, pageSize: 10, type: 1 },
+			loadMore: true
 		};
 	},
+	onLoad() {
+		this.getData();
+	},
 	methods: {
+		//获取数据
+		getData() {
+			this.$http.request({
+				url: this.$http.urls.getPageContent,
+				data: this.param,
+				loading: 'false',
+				success: res => {
+					console.log(JSON.stringify(res));
+					this.loadMore = res.data.pages > this.param.pageNum ? true : false;
+					res.data.rows.forEach(item => {
+						this.list.push(item);
+					});
+				}
+			});
+		},
 		//详情
 		detail(item) {
-			uni.navigateTo({ url: '/pages/government/detail'});
+			uni.navigateTo({ url: '/pages/government/detail?id='+item.contentId});
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNum = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			uni.stopPullDownRefresh();
+			this.refresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNum++;
+			this.getData();
 		}
 	}
 };

+ 1 - 1
smart-ui-app/pages/index/index.vue

@@ -17,7 +17,7 @@
 				</view>
 			</view>
 			<view class="ms">城市后花园·温泉养生地·胜境谢通门</view>
-			<image src="../../static/组-74@2x.jpg" mode="aspectFill"></image>
+			<image src="../../static/bg.jpg" mode="aspectFill"></image>
 		</view>
 		<view class="main">
 			<view class="flex menu">

+ 45 - 3
smart-ui-app/pages/travel/index.vue

@@ -2,9 +2,9 @@
 	<view>
 		<view class="list">
 			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
-				<image src="../../static/img2.jpg" mode="aspectFill" class="pic"></image>
+				<image :src="ip + item.showPictures" mode="aspectFill" class="pic"></image>
 				<view class="con">
-					<view class="title">景区名称</view>
+					<view class="title omit">{{ item.title }}</view>
 					<view class="ms">
 						<text class="ll">1233</text>
 						<text class="wz">浏览</text>
@@ -16,6 +16,7 @@
 				</view>
 				<view class="clear"></view>
 			</view>
+			<view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 		</view>
 	</view>
 </template>
@@ -24,13 +25,54 @@
 export default {
 	data() {
 		return {
-			list: ['1', '2', '3', '4', '5']
+			ip: this.$http.urls.ip,
+			list: [],
+			param: { pageNum: 1, pageSize: 10, type: 2 },
+			loadMore: true
 		};
 	},
+	onLoad() {
+		this.getData();
+	},
 	methods: {
+		//获取数据
+		getData() {
+			this.$http.request({
+				url: this.$http.urls.getPageContent,
+				data: this.param,
+				loading: 'false',
+				success: res => {
+					this.loadMore = res.data.pages > this.param.pageNum ? true : false;
+					res.data.rows.forEach(item => {
+						this.list.push(item);
+					});
+				}
+			});
+		},
 		//详情
 		detail(item) {
 			uni.navigateTo({ url: '/pages/travel/detail' });
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNum = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			uni.stopPullDownRefresh();
+			this.refresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNum++;
+			this.getData();
 		}
 	}
 };

+ 0 - 0
smart-ui-app/static/组-74@2x.jpg → smart-ui-app/static/bg.jpg