gcz 1 рік тому
батько
коміт
d0cd211a34

+ 7 - 2
center/addrlist.vue

@@ -4,7 +4,7 @@
 			title="收货地址"
 			:placeholder="true"
 			@leftClick="leftClick"
-			:autoBack="true"
+			:autoBack="false"
 			 :safeAreaInsetTop="true"
 		>
 		</u-navbar>
@@ -64,7 +64,12 @@
 		},
 		methods: {
 			leftClick(e){
-				console.log('leftClick',e);
+				let pages = getCurrentPages();
+				if(pages.length==1){
+					uni.$u.route('/pages/index/index')
+				}else{
+					uni.navigateBack()
+				};
 			},
 			newAddr(){
 				uni.$u.route('/center/addrForm', {type: 'add',backUrl:this.backUrl});

+ 58 - 11
center/center.vue

@@ -4,7 +4,7 @@
 		<view class="page-bg">
 			<img class="img" :src="staticUrl+'/img/center-index-bg.png'" alt="">
 		</view>
-		<view class="base-info page-wrap u-flex u-row-between">
+		<view class="base-info page-wrap u-flex u-row-between"  v-if="vuex_member_info.name">
 			<view class="left u-flex">
 				<u-avatar :src="avatar||staticUrl+'/img/avatar.png'" size="110rpx"></u-avatar>
 				<view class="info">
@@ -17,23 +17,32 @@
 			</view>
 			<u-icon @click="$u.route('/center/memberinfo',{type:'redirectTo'})" name="setting-fill" color="#333333" size="38rpx"></u-icon>
 		</view>
+		<view class="base-info page-wrap u-flex u-row-between" @click="goLogin" v-else>
+			<view class="left u-flex">
+				<u-avatar :src="staticUrl+'/img/avatar.png'" size="110rpx"></u-avatar>
+				<view class="info">
+					<view class="name ellipsis-1">立即登录</view>
+				</view>
+			</view>
+			<u-icon name="setting-fill" color="#333333" size="38rpx"></u-icon>
+		</view>
 		<view class="property page-wrap u-flex u-row-between">
-			<view class="property-item"  @click="$u.route('/center/paycode')">
+			<view class="property-item"  @click="checkauth('/center/paycode')">
 				<view class="up">
 					<u-icon :name="staticUrl+'/img/paycode.png'" color="#333333" size="42rpx"></u-icon>
 				</view>
 				<view class="down">会员码</view>
 			</view>
-			<view class="property-item" @click="$u.route('/center/mybalance')">
-				<view class="up">{{memberInfo.balance}}</view>
+			<view class="property-item" @click="checkauth('/center/mybalance')">
+				<view class="up">{{memberInfo.balance||0}}</view>
 				<view class="down">余额</view>
 			</view>
-			<view class="property-item" @click="$u.route('/credits/creditslist')">
-				<view class="up">{{memberInfo.credit}}</view>
+			<view class="property-item" @click="checkauth('/credits/creditslist')">
+				<view class="up">{{memberInfo.credit||0}}</view>
 				<view class="down">积分</view>
 			</view>
 			<view class="property-item">
-				<view class="up">{{memberInfo.couponNum}}</view>
+				<view class="up">{{memberInfo.couponNum||0}}</view>
 				<view class="down">优惠券</view>
 			</view>
 		</view>
@@ -112,14 +121,17 @@
 				},
 				tools:[
 					// {name:'充值中心',url:'/center/recharge',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
-					{name:'地址管理',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png'},
+					{name:'地址管理',url:'center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png',checkauth:true},
 					{name:'客服电话',phone:'',ico:this.$commonConfig.staticUrl+'/img/tool-phone.png'},
 				]
 			}
 		},
 		onShow() {	
-			this.getMemberInfo();
-			this.statisticsOrder();
+			if(this.vuex_member_info.name){
+				this.getMemberInfo();
+				this.statisticsOrder();
+			}
+			
 		},
 		onLoad() {
 			this.getSystemInfo();
@@ -157,7 +169,12 @@
 				  });
 				  return
 				}
-				uni.$u.route(item.url);
+				if(item.checkauth){
+					this.checkauth(item.url)
+				}else{
+					uni.$u.route(item.url);
+				}
+				
 			},
 			orderClick(item,index){
 				console.log('item',item);
@@ -176,6 +193,36 @@
 					}).catch(err=>{
 					console.log('memberInfo',err.data);
 				})
+			},
+			goLogin(){
+				uni.setStorage({
+					key: 'backUrl',
+					data:'center/center' ,
+					success: function () {
+						uni.$u.route('/pages/login/login')
+					}
+				});
+			},
+			checkauth(pageUrl){
+				if(this.vuex_member_info.name){
+					uni.$u.route(pageUrl)
+				}else{
+					uni.showModal({
+					  title: '还未登录',
+					  content: '是否前往登录!',
+					  success: res => {
+					    if (res.confirm) {
+							uni.setStorage({
+								key: 'backUrl',
+								data:pageUrl ,
+								success: function () {
+									uni.$u.route('/pages/login/login')
+								}
+							});
+					    }
+					  }
+					})
+				}
 			}
 		}
 	}

+ 7 - 7
common/config.js

@@ -12,15 +12,15 @@
 // }
 
 //64
-// let baseUrl='https://xusfoodapi.hw.hongweisoft.com/appapi/app';
-// let upFileUrl='http://fileupload.hw.hongweisoft.com/upload/single/minio';
-// // let staticUrl='http://res.hw.hongweisoft.com/xushuo/';
-// let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
+let baseUrl='https://xusfoodapi.hw.hongweisoft.com/appapi/app';
+let upFileUrl='http://fileupload.hw.hongweisoft.com/upload/single/minio';
+// let staticUrl='http://res.hw.hongweisoft.com/xushuo/';
+let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
 
 //正式
-let baseUrl='https://xusapi.gzxsjt.cn/appapi/app';
-let upFileUrl='https://xusapi.gzxsjt.cn/thirdapi/upload/single/minio';
-let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
+// let baseUrl='https://xusapi.gzxsjt.cn/appapi/app';
+// let upFileUrl='https://xusapi.gzxsjt.cn/thirdapi/upload/single/minio';
+// let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
 
 const commonConfig = {
 	wxAppid: '', // 测试wxAppid

+ 38 - 40
common/request.js

@@ -39,43 +39,10 @@ module.exports = (vm) => {
 			let options =uni.$u.queryParams( pages[pages.length - 1].options);
 			let fullBackUrl = backUrl+options;
 			
-			const backArr = ['productdetails'];
-			const hasBackArr = backArr.some(backPage => backUrl.includes(backPage));
-			if(hasBackArr){
-				console.log('包含');
-				uni.setStorage({
-					key: 'backUrl',
-					data: fullBackUrl,
-					success: function () {
-						// console.log('setStorage success');
-					}
-				});
-			}else{
-				console.log('不包含');
-				uni.removeStorage({
-					key: 'backUrl',
-					success: function (res) {
-						// console.log('success');
-					}
-				});
-			}
-			setTimeout(() => {
-				uni.$u.route('/pages/login/login');
-			}, 1000)
-			// const loginUrl = 'login'
-			// if (backUrl.indexOf(loginUrl) > 0) {
-			// 	uni.removeStorage({
-			// 		key: 'backUrl',
-			// 		success: function (res) {
-			// 			// console.log('success');
-			// 		}
-			// 	});
-			// } else {
-			// 	// uni.showToast({
-			// 	// 	title: res.msg + "即将跳转到登录页",
-			// 	// 	icon: "none",
-			// 	// 	duration: 2000
-			// 	// });
+			// const backArr = ['productdetails'];//需要登录返回的页面
+			// const hasBackArr = backArr.some(backPage => backUrl.includes(backPage));
+			// if(hasBackArr){
+			// 	console.log('包含');
 			// 	uni.setStorage({
 			// 		key: 'backUrl',
 			// 		data: fullBackUrl,
@@ -83,10 +50,41 @@ module.exports = (vm) => {
 			// 			// console.log('setStorage success');
 			// 		}
 			// 	});
-			// 	setTimeout(() => {
-			// 		uni.$u.route('/pages/login/login');
-			// 	}, 1000)
+			// }else{
+			// 	console.log('不包含');
+			// 	uni.removeStorage({
+			// 		key: 'backUrl',
+			// 		success: function (res) {
+			// 			// console.log('success');
+			// 		}
+			// 	});
 			// }
+			uni.setStorage({
+				key: 'backUrl',
+				data: fullBackUrl,
+				success: function () {
+					// console.log('setStorage success');
+				}
+			});
+			tryHideFullScreenLoading()
+			uni.showModal({
+			  title: '温馨提示',
+			  content: '是否前往登录!',
+			  success: res => {
+			    if (res.confirm) {
+			      uni.$u.route('/pages/login/login');
+			    }else{
+					uni.removeStorage({
+						key: 'backUrl',
+						success: function (res) {
+							// console.log('success');
+						}
+					});
+					uni.navigateBack()
+				}
+			  }
+			})
+
 		}
 	}
 	

+ 4 - 1
components/cartfixed.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="">
-		<view class="cart u-flex u-row-center" @click="$u.route('/shopping/cart',{type:'reLaunch'})">
+		<view v-if="vuex_member_info.name" class="cart u-flex u-row-center" @click="$u.route('/shopping/cart',{type:'reLaunch'})">
 			<u-icon size="52rpx" class="icon" :name="staticUrl+'/img/cartico.png'"></u-icon>
 			<u-badge type="error" max="99" :value="cartTotal" :absolute="true" :offset="[0,5]"></u-badge>
 		</view>
@@ -26,6 +26,9 @@
 		},
 		methods: {
 			getCartList(isAdd){
+				if(!this.vuex_member_info.name){
+					return
+				}
 				this.$u.api.cartList().then(res=>{
 					if(isAdd){
 						if(res.data.total==this.cartTotal){

+ 27 - 4
pages/index/index.vue

@@ -17,7 +17,7 @@
 		<view class="swiper-block" :style="{height: ( 375 - navHeight )+'px' }"></view>
 		<view class="page-wrap">
 			
-			<view class="member-info u-flex u-row-between" :style="[memberInfoBg]">
+			<view class="member-info u-flex u-row-between" :style="[memberInfoBg]" v-if="vuex_member_info.name">
 				<view class="left u-flex">
 					<u-avatar :src="avatar||staticUrl+'/img/avatar-white.png'" size="88rpx"></u-avatar>
 					<view class="text">
@@ -30,6 +30,17 @@
 					<text class="num">{{memberInfo.credit}}</text>
 				</view>
 			</view>
+			<view class="member-info u-flex u-row-between unlogin" :style="[memberInfoBg]" v-else>
+				<view class="left u-flex">
+					<u-avatar :src="staticUrl+'/img/avatar-white.png'" size="88rpx"></u-avatar>
+					<view class="text">
+						<view class="name">欢迎登录</view>
+					</view>
+				</view>
+				<view class="right" @click="goLogin">
+					登录 / 注册
+				</view>
+			</view>
 			
 			<view class="index-nav u-flex u-row-between u-flex-wrap">
 				<view class="nav-item" v-for="(item,index) in iconNavList" @click="indexNavClick(item)" :key="index">
@@ -154,7 +165,7 @@
 		onShow() {
 			// this.$refs.cartfixed.getCartList();
 			this.getHotGoods();
-			this.getMemberInfo()
+			// this.getMemberInfo()
 		},
 		onLoad(query) {
 			const scene = decodeURIComponent(query.scene);
@@ -173,6 +184,7 @@
 			// console.log('navigationBarHeight',this.navigationBarHeight);
 			// console.log('windowHeight',this.windowHeight);
 			// console.log('navHeight',this.navHeight);
+			console.log('vuex_member_info=======',this.vuex_member_info);
 
 		},
 		methods: {
@@ -261,8 +273,10 @@
 				uni.$u.route('/activity/activitydetails', {
 					id: item.id
 				});
-			}
-
+			},
+			goLogin(){
+				uni.$u.route('/pages/login/login')
+			},
 		}
 	}
 </script>
@@ -320,6 +334,15 @@ page{
 			font-weight: 600;
 		}
 	}
+	&.unlogin{
+		.right{
+			border-radius: 40rpx;
+			border: 2rpx solid #FFFFFF;
+			padding: 14rpx 33rpx;
+			font-weight: 600;
+			font-size: 30rpx;
+		}
+	}
 }
 .index-nav{
 	padding: 0 32rpx;

+ 1 - 1
shopping/productdetails.vue

@@ -8,7 +8,7 @@
 			 :safeAreaInsetTop="true"
 		>
 		</u-navbar>
-		<u-loading-page :loading="loadingPage"></u-loading-page>
+		<u-loading-page :loading="loadingPage" bgColor="#f1f1f1"></u-loading-page>
 		 <u-swiper
 			v-if="details.slideImgList.length>0"
 			:list="details.slideImgList"

+ 22 - 1
xushuo/xushuo.vue

@@ -31,7 +31,7 @@
 				</view>
 				<view class="nav-item">
 					<u--image
-					 @click="$u.route('/xushuo/cooperation')"
+					 @click="goCooper"
 					 class="image" :src="staticUrl+'/img/xushuo-index-04.png'" width="101rpx" height="101rpx"></u--image>
 					合作加盟
 				</view>
@@ -164,6 +164,27 @@
 			vrClick(){
 				uni.showToast({title:'暂未开发',icon:'none'});
 				// uni.$u.route('/xushuo/vrlist')
+			},
+			goCooper(){
+				if(this.vuex_member_info.name){
+					uni.$u.route('/xushuo/cooperation')
+				}else{
+					uni.showModal({
+					  title: '还未登录',
+					  content: '是否前往登录!',
+					  success: res => {
+					    if (res.confirm) {
+							uni.setStorage({
+								key: 'backUrl',
+								data:'xushuo/cooperation' ,
+								success: function () {
+									uni.$u.route('/pages/login/login')
+								}
+							});
+					    }
+					  }
+					})
+				}
 			}
 		}
 	}