guhongwei 2 年之前
父節點
當前提交
42a5218ba8
共有 7 個文件被更改,包括 2244 次插入2238 次删除
  1. 9 11
      common/share.js
  2. 2109 2148
      config.js
  3. 89 59
      pages/home/index.vue
  4. 22 2
      pages/index/index.vue
  5. 0 1
      pages/login/index.vue
  6. 13 12
      pagesHome/group/share.vue
  7. 2 5
      pagesHome/order/detail.vue

+ 9 - 11
common/share.js

@@ -2,18 +2,15 @@ import config from '../config.js';
 export default {
 	data() {
 		return {
-			share: {
-				title: config.point_title,
-				path: `/pages/index/index`,
-				imageUrl: config.shareUrl,
-			}
+			share: {}
 		}
 	},
 	onShareAppMessage(res) { //发送给朋友
+		const that = this;
 		return {
-			title: this.share.title,
-			path: this.share.path,
-			imageUrl: this.share.imageUrl,
+			title: that.$config.share.title,
+			path: that.$config.share.path,
+			imageUrl: that.$config.share.imageUrl,
 			success(res) {
 				uni.showToast({
 					title: '分享成功'
@@ -28,10 +25,11 @@ export default {
 		}
 	},
 	onShareTimeline(res) { //分享到朋友圈
+		const that = this;
 		return {
-			title: this.share.title,
-			path: this.share.path,
-			imageUrl: this.share.imageUrl,
+			title: that.$config.share.title,
+			path: that.$config.share.path,
+			imageUrl: that.$config.share.imageUrl,
 			success(res) {
 				uni.showToast({
 					title: '分享成功'

File diff suppressed because it is too large
+ 2109 - 2148
config.js


+ 89 - 59
pages/home/index.vue

@@ -22,7 +22,7 @@
 							</view>
 						</view>
 					</view>
-					<view class="zero four">
+					<view class="zero four" v-if="recomList&&recomList.length>0">
 						<view class="recomList" v-for="(item,index) in recomList" :key="index">
 							<view class="list" v-for="(tag,indexs) in item.list" :key="indexs" @tap="toBuy(tag)">
 								<view class="title">
@@ -36,22 +36,29 @@
 						</view>
 					</view>
 					<view class="zero five">
-						<view class="list" v-for="(item,index) in marketList" :key="index" @tap="toBuy(item)">
-							<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
-							</image>
-							<view class="name">
-								{{item.name}}
-							</view>
-							<view class="other">
-								<view class="money">
-									<text>¥</text><text>{{item.sell_money||'暂无'}}</text>
+						<view class="five_pubu">
+							<view class="list" v-for="(item,index) in marketList" :key="index" @tap="toBuy(item)">
+								<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
+								</image>
+								<view class="name">
+									{{item.name}}
 								</view>
-								<view class="btn">
-									<!-- <button type="default" size="mini">购买</button> -->
+								<view class="other">
+									<view class="money">
+										<view class="money_1">
+											<text>¥</text><text>{{item.sell_money||0}}</text>
+										</view>
+										<view class="money_2">
+											<text>¥</text><text>{{item.flow_money||0}}</text>
+										</view>
+									</view>
 								</view>
 							</view>
 						</view>
 					</view>
+					<view class="is_bottom" v-if="is_bottom">
+						<text>数据到底了!!</text>
+					</view>
 				</view>
 			</view>
 		</scroll-view>
@@ -88,11 +95,11 @@
 				old: {
 					scrollTop: 0
 				},
+				// 数据是否触底
+				is_bottom: false,
 			};
 		},
-		onLoad: function() {
-			const that = this;
-		},
+		onLoad: function() {},
 		onShow: function() {
 			const that = this;
 			that.search();
@@ -105,7 +112,12 @@
 				res = await that.$api(`/banner`, 'GET', {
 					status: '0'
 				});
-				if (res.errcode == '0') that.$set(that, `bannerList`, res.data);
+				if (res.errcode == '0') {
+					let data = res.data.sort(function(a, b) {
+						return a.sort - b.sort
+					});
+					that.$set(that, `bannerList`, data);
+				}
 				// 首页模块管理
 				res = await that.$api(`/indexModule`, 'GET', {});
 				if (res.errcode == '0') {
@@ -188,10 +200,9 @@
 					that.$set(that, `skip`, skip)
 					that.search();
 					uni.hideLoading();
-				} else uni.showToast({
-					title: '没有更多数据了',
-					icon: 'none'
-				});
+				} else {
+					that.$set(that, `is_bottom`, true)
+				}
 			},
 			// 计算高度
 			scroll: function(e) {
@@ -338,58 +349,68 @@
 
 		.five {
 			display: flex;
-			flex-direction: row;
-			flex-wrap: wrap;
+			flex-direction: column;
 			background-color: var(--f2Color);
-			padding: 2vw 0 0 0;
+			padding: 2vw 0;
 
-			.list {
-				width: 40vw;
-				background-color: var(--fffColor);
-				padding: 2vw;
-				margin: 0 2vw 2vw 2vw;
-				border-radius: 10px;
+			.five_pubu {
+				column-count: 2;
+				column-gap: 2vw;
 
-				.image {
-					width: 100%;
-					height: 35vw;
-				}
+				.list {
+					background-color: var(--fffColor);
+					padding: 2vw;
+					margin: 0 0 2vw 0;
+					break-inside: avoid;
+					border-radius: 10px;
 
-				.name {
-					font-size: var(--font14Size);
-					margin: 0 0 1vw 0;
-				}
+					.image {
+						width: 100%;
+						height: 35vw;
+					}
 
-				.other {
-					display: flex;
-					flex-direction: row;
-					justify-content: space-between;
+					.name {
+						font-size: var(--font14Size);
+						margin: 0 0 1vw 0;
+					}
 
-					.money {
-						color: var(--fFB1Color);
+					.other {
+						display: flex;
+						flex-direction: row;
+						justify-content: space-between;
 
-						text:nth-child(1) {
-							font-size: var(--font12Size);
-						}
-					}
+						.money {
+							display: flex;
+
+							.money_1 {
+								color: var(--fFB1Color);
+								font-size: 12px;
 
-					.btn {
-						button {
-							color: var(--fffColor);
-							background-color: var(--fFB1Color);
-							padding: 5px 2vw;
-							font-size: var(--font14Size);
-							line-height: 1;
-							border-radius: 90px;
+								text:last-child {
+									font-size: 16px;
+									padding: 0 0 0 1vw;
+								}
+							}
+
+							.money_2 {
+								font-size: 12px;
+								margin: 0 0 0 2vw;
+
+								text {
+									text-decoration: line-through;
+								}
+
+								text:last-child {
+									font-size: 16px;
+									padding: 0 0 0 1vw;
+								}
+							}
 
 						}
+
 					}
 				}
 			}
-
-			.list:nth-child(2n) {
-				margin: 0 0 2vw 2vw;
-			}
 		}
 	}
 
@@ -417,4 +438,13 @@
 			border-radius: 90px;
 		}
 	}
+
+	.is_bottom {
+		text-align: center;
+
+		text {
+			padding: 1vw 0;
+			display: inline-block;
+		}
+	}
 </style>

+ 22 - 2
pages/index/index.vue

@@ -19,12 +19,32 @@
 		onLoad: function() {},
 		onShow: function() {
 			const that = this;
+			that.searchConfig();
 			that.search();
 		},
 		methods: {
-			search() {
+			// 查询基本设置
+			async searchConfig() {
+				const that = this;
+				let res = await that.$api(`/config`, 'GET', {});
+				if (res.errcode == '0' && res.total > 0) {
+					let config = res.data[0];
+					that.$set(that, `logoUrl`, config.config.share[0].url)
+					uni.setStorage({
+						key: 'config',
+						data: config,
+						success: function() {}
+					});
+					// 赋值默认值
+					that.$config.share = {
+						title: config.title,
+						path: '/pages/index/index',
+						imageUrl: config.config.share[0].url
+					}
+				}
+			},
+			async search() {
 				const that = this;
-				that.$set(that, `logoUrl`, that.$config.logoUrl);
 				// 查询当前所在平台
 				uni.getSystemInfo({
 					success: async function(res) {

+ 0 - 1
pages/login/index.vue

@@ -95,7 +95,6 @@
 	export default {
 		data() {
 			return {
-				point_title: this.$config.point_title,
 				// 平台信息
 				platform: {},
 				//openid

+ 13 - 12
pagesHome/group/share.vue

@@ -14,8 +14,7 @@
 			<view class="two">
 				<view class="two_1">
 					<view class="img">
-						<image class="image" :src="info.goods.file&&info.goods.file.length>0?info.goods.file[0].url:''"
-							mode=""></image>
+						<image class="image" :src="info.goods.file&&info.goods.file.length>0?info.goods.file[0].url:''" mode=""></image>
 					</view>
 				</view>
 				<view class="two_2">
@@ -36,8 +35,7 @@
 						<view class="thr_1">
 							<view class="list" v-for="(item,index) in info.persons" :key="index">
 								<view class="img">
-									<image class="image" :src="item.icon&&item.icon.length>0?item.icon[0].url:''"
-										mode=""></image>
+									<image class="image" :src="item.icon&&item.icon.length>0?item.icon[0].url:''" mode=""></image>
 								</view>
 								<view class="name">
 									{{item.name}}
@@ -76,8 +74,6 @@
 				id: '',
 				user: {},
 				info: {},
-				// 分享
-				share: {},
 				num: 1,
 			};
 		},
@@ -159,12 +155,17 @@
 							res.data.persons = res.data.persons.filter(i => i.status == '0')
 						}
 						that.$set(that, `info`, res.data);
-						let share = {
-							title: res.data.goods.name,
-							path: `/pagesHome/group/share?id=${that.id}`,
-							imageUrl: '',
-						}
-						that.$set(that, `share`, share);
+						uni.getStorage({
+							key: 'config',
+							success: function(config) {
+								// 赋值默认值
+								that.$config.share = {
+									title: res.data.goods.name,
+									path: '/pagesHome/group/share?id=${that.id}',
+									imageUrl: config.config.share[0].url
+								}
+							}
+						});
 					} else {
 						uni.showToast({
 							title: res.errmsg,

+ 2 - 5
pagesHome/order/detail.vue

@@ -216,8 +216,6 @@
 				isActive: -1,
 				// 计数器
 				num: 1,
-				// 分享
-				share: {},
 			};
 		},
 		onLoad: async function(e) {
@@ -479,13 +477,12 @@
 			configShare() {
 				const that = this;
 				let user_id = that.user && that.user._id ? that.user._id : '';
-				let id = that.info && that.info._id ? that.info._id : ''
-				let obj = {
+				let id = that.info && that.info._id ? that.info._id : '';
+				that.$config.share = {
 					title: that.info.name,
 					path: `/pagesHome/order/detail?id=${id}&user_id=${user_id}`,
 					imageUrl: that.info.file[0].url
 				}
-				that.$set(that, `share`, obj)
 			}
 		}
 	}