淘宝客API调用优惠券问题 vue传输淘宝优惠券链接不完整
<template>
<view >
<view class="li" v-for="(item,index) in List" @click="Go(item.mainPic,item.actualPrice,item.originalPrice,item.monthSales,item.dtitle,item.couponPrice,item.couponStartTime,item.couponEndTime,item.couponLink)">
<image class="li-img" :src="item.mainPic"></image>
<view class="li-info">
<text class="li-info-title" >{{item.dtitle}}</text>
</view>
<view class="li-quan">
<text class="li-info-quan" >券</text>
<text class="li-info-yhje" >{{item.couponPrice}}元</text>
</view>
<view class="but-yyds">
<text class="quanhou">券后</text>
<text class="li-but">{{item.actualPrice}}</text>
</view>
<view>
<text class="text-dp">{{item.shopName}}</text>
</view>
<view>
<text class="text-xsl">已售:{{item.monthSales}}+</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
List:[],
pageId:1
}
},
onLoad() {//页面加载事件//
var that = this;
uni.request({
url:'https://openapi.dataoke.com/api/goods/get-goods-list',
method:"GET",
data: {
pageSize:20,
pageId:1,
},
header: {
},
success:(res) => {
console.log(res.data);
that.List = res.data.data.list;
},
});
},
methods: {
Go:function(a,b,c,d,e,f,g,h,i){
console.log(a)
console.log(b)
console.log(c)
console.log(d)
console.log(e)
console.log(f)
console.log(g)
console.log(h)
console.log(i)
uni.navigateTo({
url:"xq?aaa="+a+'&bbb='+b+'&ccc='+c+'&ddd='+d+'&eee='+e+'&fff='+f+'&ggg='+g+'&hhh='+h+'&iii='+i,
})
},
},
onReachBottom(){//页面加载事件
console.log("页面到底了")
var that = this;
that.pageId = that.pageId+1;
uni.request({
url:'https://openapi.dataoke.com/api/goods/get-goods-list',
method:"GET",
data: {
pageSize:20,
pageId:that.pageId
},
header: {
},
success:(res) => {
//console.log(res.data);
for(var i = 0;i < res.data.data.list.length;i++){
//console.log(res.data.data.list[i])
that.List.push(res.data.data.list[i])
}
}
});
}
}
</script>
以上是主页的内容item.couponLink和i是定义的优惠券链接变量, 当我在主页输出优惠券链接是完整的
当我传到详情页面后优惠券链接就不完整了,导致打不开优惠券地址,
是不是我传参的方法不正确? 有没有好伙伴帮帮忙
下面是详情窗口的代码
export default {
data() {
return {
img:'',
qh:'',
yj:'',
xl:'',
bt:'',
yhq:'',
ksrq:'',
jsrq:'',
yhqlj:'',
}
},
onLoad:function(a,b,c,d,e,f,g,h,i) {//页面加载时间//
this.img = a.aaa
this.qh = a.bbb
this.yj = a.ccc
this.xl = a.ddd
this.bt = a.eee
this.yhq = a.fff
this.ksrq = a.ggg
this.jsrq = a.hhh
this.yhqlj = a.iii
console.log(a.iii)
已解决
使用navigateTo传参URL太长会导致传输失败将变量encodeURIComponent加密后传输在解密即可