广告位跳转

This commit is contained in:
ghusermoon 2020-08-19 16:59:06 +08:00
parent 5dff8c8d96
commit dc636e30b7
3 changed files with 45 additions and 63 deletions

View File

@ -221,6 +221,7 @@
</style>
<script>
import common from '@/static/js/common.js';
import { mapState } from 'vuex'
import videoItem from "@/components/index/video-item/index"
import zhiboItem from "@/components/index/zhibo-item/index"
@ -532,40 +533,20 @@
},
clickFImage(index) {
const item = this.indexImageSwiper[index];
console.log(item);
this.activityLink({
// console.log(item);
this.jumpPage({
type: item.url_type,
id: item.info_id
id: item.info_id,
});
},
clickSImage(index) {
const item = this.zhiboImageSwiper[index];
console.log(item);
this.activityLink({
// console.log(item);
this.jumpPage({
type: item.url_type,
id: item.info_id
id: item.info_id,
});
},
activityLink({
type,
id
}) {
console.log(type,id);
if (type == 0) return false;
// type 1 , 2
const url = type == 1 ? 'pageB/sdetails/index' : 'pageC/merchant/index';
let params = {
id: id
};
// type: 1 // 1 2 3 4
if (type == 1) Object.assign(params, {
type: 1
});
this.$u.route({
url: url,
params: params
})
},
goSearch() {
this.$u.route("/pageB/search/index", {
type: 2,
@ -580,6 +561,10 @@
}
})
},
jumpPage(uri) {
// console.log(uri);
common.jumpPage({ type: uri.type, id: uri.id });
}
},
}
</script>

View File

@ -46,7 +46,7 @@
<!-- 拼团列表 -->
<group></group>
<view class="activity-view">
<image class="lingquan" :src="activityInfo.adv_code" @click="activityLink({ type: activityInfo.url_type, id: activityInfo.info_id })"></image>
<image class="lingquan" :src="activityInfo.adv_code" @click="jumpPage({ type: activityInfo.url_type, id: activityInfo.info_id })"></image>
</view>
<!-- 优惠券 -->
<youhq></youhq>
@ -61,6 +61,7 @@
</view>
</template>
<script>
import common from '@/static/js/common.js';
import shopitem from "@/components/shop/shop-item/index";
import recommend from "@/components/shop/recommend/index";
import pintuan from "@/components/shop/recommend/pintuan";
@ -190,31 +191,11 @@
clickImage(index) {
// console.log(this.list[index]);
let item = this.list[index];
this.activityLink({
type: item.url_type,
this.jumpPage({
type: item.url_type,
id: item.info_id,
});
});
},
activityLink({
type,
id
}) {
console.log(type,id);
if (type == 0) return false;
// type 1 , 2
const url = type == 1 ? 'pageB/sdetails/index' : 'pageC/merchant/index';
let params = {
id: id
};
// type: 1 // 1 2 3 4
if (type == 1) Object.assign(params, {
type: 1
});
this.$u.route({
url: url,
params: params
})
},
//
onreachBottom() {
this.$refs.recommendGoods.loadMore();
@ -240,18 +221,10 @@
}
})
},
activityLink({ type, id }) {
if(type == 0 || type == 2) return false;
// type 1 , 2
const url = type == 1 ? 'pageB/sdetails/index' : '';
let params = { id: id };
// type: 1 // 1 2 3 4
if(type == 1) Object.assign(params, { type: 1 });
this.$u.route({
url: url,
params: params
})
},
jumpPage(uri) {
// console.log(uri);
common.jumpPage({ type: uri.type, id: uri.id });
}
},
}
</script>

View File

@ -67,5 +67,29 @@ const common = {
else result = hours + ':' + minutes + ':' + seconds;
return result;
},
/**
* 广告位跳转
* @param { String } type 跳转类型
* @param { String | Number } id 跳转id 商品id/商家id...
* @return { undefined } undefined
*/
jumpPage({ type, id }) {
let url;
switch (type) {
case 1:
url = '/pageB/sdetails/index?id=' + id;
break;
case 2:
url = '/pageC/merchant/index?id=' + id;
break;
case 3:
url = '/pageE/tool/MineCoupon'
break;
default:
break;
}
// console.log(url);
uni.navigateTo({ url: url });
},
}
export default common
export default common;