guhongwei 2 年之前
父節點
當前提交
332cbb42cf
共有 7 個文件被更改,包括 108 次插入146 次删除
  1. 1 1
      config.js
  2. 31 35
      pages/home/index.vue
  3. 19 31
      pages/index/index.vue
  4. 5 18
      pages/login/index.vue
  5. 17 17
      pages/market/index.vue
  6. 11 19
      pages/store/index.vue
  7. 24 25
      pages/week/index.vue

+ 1 - 1
config.js

@@ -13,8 +13,8 @@ export default {
 	// serverUrl: 'http://192.168.223.1:12111',
 	wx_projectkey: wx_projectkey,
 	wx_miniProgram: wx_min.miniProgram,
-	system: system,
 	wx_dev: 'dev',
+	system: system,
 	share: {},
 	china: [
 		//全国地址

+ 31 - 35
pages/home/index.vue

@@ -1,18 +1,14 @@
 <template>
 	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
-		<scroll-view scroll-y="true" class="scroll-view" scroll-with-animation :scroll-top="scrollTop" @scroll="scroll"
-			@scrolltolower="toPage">
+		<scroll-view scroll-y="true" class="scroll-view" scroll-with-animation :scroll-top="scrollTop" @scroll="scroll" @scrolltolower="toPage">
 			<view class="list-scroll-view">
 				<view class="main">
 					<view class="zero one">
-						<input type="text" placeholder="搜索商品" @tap="toCommon('pagesHome/market/search')"
-							placeholder-class="placss">
+						<input type="text" placeholder="搜索商品" @tap="toCommon('pagesHome/market/search')" placeholder-class="placss">
 					</view>
 					<view class="zero two">
-						<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
-							indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
-							<swiper-item class="list" v-for="(item,index) in bannerList" :key="index"
-								@tap="toBanner(item)">
+						<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff" indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
+							<swiper-item class="list" v-for="(item,index) in bannerList" :key="index" @tap="toBanner(item)">
 								<image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''" mode="">
 								</image>
 							</swiper-item>
@@ -27,8 +23,7 @@
 						</view>
 					</view>
 					<view class="zero four" v-if="recomList&&recomList.length>0">
-						<view class="recomList" v-for="(item,index) in recomList" :key="index"
-							v-if="item.list&&item.list.length>0">
+						<view class="recomList" v-for="(item,index) in recomList" :key="index" v-if="item.list&&item.list.length>0">
 							<view class="list" v-for="(tag,indexs) in item.list" :key="indexs" @tap="toBuy(tag)">
 								<view class="list_1">
 									<view class="txt">
@@ -51,8 +46,7 @@
 					<view class="zero act">
 						<view class="list" v-for="(item,index) in platformactList" :key="index" @tap="toAct(item)">
 							<view class="img">
-								<image class="image" :src="item.cover&&item.cover.length>0?item.cover[0].url:''"
-									mode="">
+								<image class="image" :src="item.cover&&item.cover.length>0?item.cover[0].url:''" mode="">
 								</image>
 							</view>
 							<view class="title" v-if="item.act_time.is_use=='0'">
@@ -87,7 +81,7 @@
 				</view>
 			</view>
 		</scroll-view>
-		<view class="backTop" v-if="old.scrollTop>500">
+		<view class="backTop" v-if="old_scrollTop>500">
 			<text @tap="goTop" class="iconfont icon-fanhuidingbu"></text>
 		</view>
 	</mobile-frame>
@@ -116,15 +110,18 @@
 				page: 0,
 				// 返回顶部
 				scrollTop: 0,
-				old: {
-					scrollTop: 0
-				},
+				old_scrollTop: 0
 			};
 		},
 		onLoad: function() {
 			const that = this;
 			that.search();
-			
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
 			async search() {
@@ -205,7 +202,6 @@
 			// 推荐好物更多
 			toMore(e) {
 				const that = this;
-
 				uni.navigateTo({
 					url: `/pagesRest/recom/index?act_tags=${e.value}`
 				})
@@ -256,28 +252,28 @@
 			},
 			// 计算高度
 			scroll: function(e) {
-				this.old.scrollTop = e.detail.scrollTop
+				const that = this;
+				that.old_scrollTop = e.detail.scrollTop
 			},
 			// 返回顶部
 			goTop: function(e) {
-				this.scrollTop = this.old.scrollTop
-				this.$nextTick(function() {
-					this.scrollTop = 0
+				const that = this;
+				that.scrollTop = that.old_scrollTop;
+				that.$nextTick(function() {
+					that.scrollTop = 0
 				});
+			},
+			clearPage() {
+				const that = this;
+				that.$set(that, `bannerList`, [])
+				that.$set(that, `btnList`, [])
+				that.$set(that, `recomList`, [])
+				that.$set(that, `platformactList`, [])
+				that.$set(that, `marketList`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
 			}
-		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `bannerList`, [])
-			that.$set(that, `btnList`, [])
-			that.$set(that, `recomList`, [])
-			that.$set(that, `platformactList`, [])
-			that.$set(that, `marketList`, [])
-			that.$set(that, `skip`, 0)
-			that.$set(that, `limit`, 6)
-			that.$set(that, `page`, 0)
-			await that.search();
-			uni.stopPullDownRefresh();
 		}
 	}
 </script>

+ 19 - 31
pages/index/index.vue

@@ -10,17 +10,14 @@
 
 <script>
 	export default {
-		components: {},
 		data() {
 			return {
 				logoUrl: '',
 			};
 		},
-		onLoad: function() {},
-		onShow: async function() {
+		onLoad: async function() {
 			const that = this;
 			await that.searchConfig();
-			await that.search();
 		},
 		methods: {
 			// 查询基本设置
@@ -29,37 +26,28 @@
 				let res = await that.$api(`/config`, 'GET', {});
 				if (res.errcode == '0') {
 					let config = res.data;
-					that.$set(that, `logoUrl`, config.config.logo[0].url)
+					that.$set(that, `logoUrl`, config.config.logo[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;
-				// 查询当前所在平台
-				uni.getSystemInfo({
-					success: async function(res) {
-						uni.setStorage({
-							key: 'system',
-							data: res,
-							success: function() {
-								uni.redirectTo({
-									url: `/pages/home/index`
-								})
+						success: function(res) {
+							// 赋值默认值
+							that.$config.share = {
+								title: config.title,
+								path: '/pages/index/index',
+								imageUrl: config.config.share[0].url
 							}
-						});
-					}
-				});
-			},
+							let url = `/pages/store/index`;
+							uni.redirectTo({
+								url
+							})
+						},
+						fail: function(err) {
+							console.log(err);
+						}
+					})
+				}
+			}
 		}
 	}
 </script>

+ 5 - 18
pages/login/index.vue

@@ -172,24 +172,11 @@
 			// 查询平台信息
 			searchSystem() {
 				const that = this;
-				uni.getStorage({
-					key: 'system',
-					success: function(res) {
-						that.$set(that, `system`, res.data);
-						that.searchOpenid();
-					},
-					fail: function(err) {
-						let system = that.$config.system;
-						uni.setStorage({
-							key: 'system',
-							data: system,
-							success: function() {
-								that.$set(that, `system`, system);
-								that.searchOpenid();
-							}
-						});
-					}
-				})
+				let system = that.$config.system;
+				if (system) {
+					that.$set(that, `system`, system);
+					that.searchOpenid();
+				}
 			},
 			// 查询openid
 			searchOpenid() {

+ 17 - 17
pages/market/index.vue

@@ -104,12 +104,6 @@
 			that.watchLogin();
 		},
 		methods: {
-			// 公共跳转
-			toCommon(route, e) {
-				uni.navigateTo({
-					url: `${route}?id=${e && e.goods_id}`
-				})
-			},
 			// 监听登录
 			watchLogin() {
 				const that = this;
@@ -135,17 +129,17 @@
 					that.$set(that, `list`, res.data)
 				}
 			},
-			// 转换金额
-			showMoney(money) {
-				const that = this;
-				let moneys = `${money}`.split(".");
-				if (moneys.length == 1) {
-					money = money + ".00";
-				} else if (moneys.length == 2) {
-					money = money + "0";
-				}
-				return money;
-			},
+			// // 转换金额
+			// showMoney(money) {
+			// 	const that = this;
+			// 	let moneys = `${money}`.split(".");
+			// 	if (moneys.length == 1) {
+			// 		money = money + ".00";
+			// 	} else if (moneys.length == 2) {
+			// 		money = money + "0";
+			// 	}
+			// 	return money;
+			// },
 			// 编辑
 			edit(num) {
 				const that = this;
@@ -378,6 +372,12 @@
 			hasCheck() {
 				return this.list.some(e => e.goods.some(eg => eg.check))
 			},
+			// 公共跳转
+			toCommon(route, e) {
+				uni.navigateTo({
+					url: `${route}?id=${e && e.goods_id}`
+				})
+			},
 			toPath(e) {
 				if (e && e.route && e.type == '0') {
 					uni.redirectTo({

+ 11 - 19
pages/store/index.vue

@@ -7,8 +7,7 @@
 						<view class="list" v-for="(item,index) in list" :key="index" @tap="toShop(item)">
 							<view class="list_1">
 								<view class="l">
-									<image class="image" :src="item.logo&&item.logo.length>0?item.logo[0].url:''"
-										mode=""></image>
+									<image class="image" :src="item.logo&&item.logo.length>0?item.logo[0].url:''" mode=""></image>
 								</view>
 								<view class="c">
 									<view class="name">
@@ -20,14 +19,12 @@
 									</view>
 								</view>
 								<view class="r" @tap.stop="toFolllow(item)">
-									<text class="iconfont icon-yduishoucangshixin-copy"
-										v-if="item.is_follow==true"></text>
+									<text class="iconfont icon-yduishoucangshixin-copy" v-if="item.is_follow==true"></text>
 									<text class="iconfont icon-yduishoucangkongxin-copy" v-else></text>
 								</view>
 							</view>
 							<view class="list_2">
-								<view class="market" v-for="(tag,indexs) in item.market" :key="indexs"
-									@tap.stop="toBuy(tag)">
+								<view class="market" v-for="(tag,indexs) in item.market" :key="indexs" @tap.stop="toBuy(tag)">
 									<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode="">
 									</image>
 									<view class="money">
@@ -64,7 +61,12 @@
 			await that.watchLogin();
 			// 查询列表
 			await that.search();
-			
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
 		},
 		methods: {
 			// 监听用户是否登录
@@ -114,9 +116,7 @@
 					that.$set(that, `skip`, skip)
 					that.search();
 					uni.hideLoading();
-				} else uni.showToast({
-					title: '没有更多数据了'
-				});
+				} else {}
 			},
 			// 商铺
 			toShop(e) {
@@ -177,15 +177,7 @@
 				}
 			}
 		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `list`, [])
-			that.$set(that, `skip`, 0)
-			that.$set(that, `limit`, 6)
-			that.$set(that, `page`, 0)
-			await that.search();
-			uni.stopPullDownRefresh();
-		}
+
 	}
 </script>
 

+ 24 - 25
pages/week/index.vue

@@ -2,15 +2,13 @@
 	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
 		<view class="main">
 			<view class="one">
-				<input type="text" placeholder="搜索商品" @tap="toCommon('pagesHome/market/search')"
-					placeholder-class="placss">
+				<input type="text" placeholder="搜索商品" @tap="toCommon('pagesHome/market/search')" placeholder-class="placss">
 			</view>
 			<view class="two">
 				<view class="two_1">
 					<scroll-view scroll-y="true" class="scroll-view">
 						<view class="list-scroll-view">
-							<view class="list" :class="[active==index?'listActive':'']" v-for="(item,index) in typeList"
-								:key="index" @tap="toChange(index,item)">
+							<view class="list" :class="[active==index?'listActive':'']" v-for="(item,index) in typeList" :key="index" @tap="toChange(index,item)">
 								<text>{{item.label}}</text>
 							</view>
 						</view>
@@ -21,13 +19,10 @@
 						<view class="list-scroll-view">
 							<view class="two_2_1">
 								<scroll-view scroll-x="true" class="typeScrollview">
-									<view class="list" v-for="(item,index) in list" :key="index"
-										@tap="twoChange(item,index)">
-										<image class="image"
-											:src="item.file&&item.file.length>0?item.file[0].url:logoUrl" mode="">
+									<view class="list" v-for="(item,index) in list" :key="index" @tap="twoChange(item,index)">
+										<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:logoUrl" mode="">
 										</image>
-										<view class="label textOver"><text
-												:style="{color:twoActive==index?'#ff0000':'#000000'}">{{item.label}}</text>
+										<view class="label textOver"><text :style="{color:twoActive==index?'#ff0000':'#000000'}">{{item.label}}</text>
 										</view>
 									</view>
 								</scroll-view>
@@ -35,8 +30,7 @@
 							<view class=" two_2_2">
 								<view class="list" v-for="(tag,index) in marketList" :key="index" @tap="toBuy(tag)">
 									<view class="img">
-										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
-											mode=""></image>
+										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode=""></image>
 									</view>
 									<view class="info">
 										<view class="name textOver">
@@ -94,6 +88,12 @@
 			that.searchConfig();
 			that.search();
 		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPages();
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
 		methods: {
 			// 查询基本设置
 			searchConfig() {
@@ -122,7 +122,6 @@
 				if (res.errcode == '0') {
 					that.$set(that, `typeList`, res.data);
 					if (res.total > 0) {
-
 						that.searchRight(res.data[0]);
 						// 查询产品
 						that.$set(that, `tags`, res.data[0].code)
@@ -216,6 +215,17 @@
 				that.$set(that, `limit`, 6)
 				that.$set(that, `page`, 0)
 			},
+			// 清空总信息
+			clearPages() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `marketList`, [])
+				that.$set(that, `typeList`, [])
+				that.$set(that, `active`, '0')
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			},
 			// 搜索商品
 			toCommon(e) {
 				const that = this;
@@ -245,18 +255,7 @@
 				}
 			}
 		},
-		onPullDownRefresh: async function() {
-			const that = this;
-			that.$set(that, `list`, [])
-			that.$set(that, `marketList`, [])
-			that.$set(that, `typeList`, [])
-			that.$set(that, `active`, '0')
-			that.$set(that, `skip`, 0)
-			that.$set(that, `limit`, 6)
-			that.$set(that, `page`, 0)
-			await that.search();
-			uni.stopPullDownRefresh();
-		}
+
 	}
 </script>