Преглед на файлове

产品详情跳转使用encodeURIComponent传参数

gcz преди 2 години
родител
ревизия
1a5052a793
променени са 3 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 1 1
      center/addrForm.vue
  2. 3 1
      shopping/productdetails.vue
  3. 1 1
      uni.scss

+ 1 - 1
center/addrForm.vue

@@ -116,7 +116,7 @@
 				this.getAddrById(this.id)
 			}
 			this.fromPage = page.from;
-			this.backUrl = page.backUrl;
+			this.backUrl = decodeURIComponent(page.backUrl);
 		},
 		onReady() {
 			//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。

+ 3 - 1
shopping/productdetails.vue

@@ -195,15 +195,17 @@
 			},
 			buyNow(id){
 				// this.addCart(id,'buyNow')//跳购物车
+				let that = this;
 				if(!this.hasAddr){
 					uni.showModal({
 						title: '温馨提示',
 						content: '请先设置地址!',
 						success: res => {
 							if (res.confirm) {
+								let url = encodeURIComponent(`/shopping/productdetails?id=${that.id}`) ;
 								uni.$u.route('/center/addrlist', {
 									from: 'productdetails',
-									backUrl:'/shopping/productdetails?id='+this.id
+									backUrl:url
 								});
 							}
 						}

+ 1 - 1
uni.scss

@@ -285,7 +285,7 @@ page{
 				margin-bottom: 17rpx;
 			}
 			.time{
-				text-align: right;
+				text-align: left;
 				color: #999;
 				font-size: 24rpx;
 			}