【新增】商城栏目页面增加广告组件使用示例。

This commit is contained in:
JianWeie
2022-05-08 16:13:05 +08:00
parent 99299dc436
commit b523a3141a
5 changed files with 0 additions and 186 deletions

View File

@@ -9,7 +9,6 @@
</template>
<script>
import { navLinkType } from '@/common/setting/constVarsHelper.js';
export default {
props: {
codes: {
@@ -35,62 +34,6 @@
this.advert = res.data;
});
},
// 广告点击查看详情
showSliderInfo(type, val) {
if (!val) {
return;
}
if (type == 1) {
if (val.indexOf('http') != -1) {
// #ifdef H5
window.location.href = val
// #endif
// #ifdef H5 || APP-PLUS || APP-PLUS-NVUE || MP
this.$u.route('/pages/webview/webview', { src: val });
// #endif
} else {
// #ifdef H5 || APP-PLUS || APP-PLUS-NVUE || MP
if (val == '/pages/index/default/default' || val == '/pages/category/index/index' || val == '/pages/index/cart/cart' || val == '/pages/index/member/member') {
this.$u.route({ type: 'switchTab', url: val });
return;
} else if (val.indexOf('/pages/coupon/coupon') > -1) {
var id = val.replace('/pages/coupon/coupon?id=', "");
this.receiveCoupon(id)
} else {
this.$common.navigateTo(val);
return;
}
// #endif
}
} else if (type == 2) {
// 商品详情
this.$u.route('/pages/goods/goodDetails/goodDetails', { id: val });
} else if (type == 3) {
// 文章详情
this.$u.route('/pages/article/details/details', { idType: 1, id: val });
} else if (type == 4) {
// 文章列表
this.$u.route('/pages/article/list/list')
} else if (type == navLinkType.intelligentForms) {
this.$u.route('/pages/form/details/details', { id: val });
} else {
this.$u.route(val);
}
},
// 用户领取优惠券
receiveCoupon(couponId) {
let _this = this;
let coreshopdata = {
id: couponId
}
this.$u.api.getCoupon(coreshopdata).then(res => {
if (res.status) {
_this.$refs.uToast.show({ message: res.msg, type: 'success', back: false })
} else {
_this.$u.toast(res.msg)
}
})
},
},
}
</script>

View File

@@ -99,20 +99,6 @@
created() {
},
methods: {
// 用户领取优惠券
receiveCoupon(couponId) {
let _this = this;
let coreshopdata = {
id: couponId
}
this.$u.api.getCoupon(coreshopdata).then(res => {
if (res.status) {
_this.$refs.uToast.show({ message: res.msg, type: 'success', back: false })
} else {
_this.$u.toast(res.msg)
}
})
},
}
}
</script>

View File

@@ -69,7 +69,6 @@
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度,
beans: [],
advert: {},
isChild: false,
searchKey: ''
}
@@ -81,7 +80,6 @@
},
onShow() {
this.categories();
this.getBanner();
},
methods: {
categories() {
@@ -127,47 +125,6 @@
url: '/pages/category/list/list?id=' + catId
});
},
getBanner() {
this.$u.api.advert(
{
codes: 'tpl1_class_banner1'
}).then(res => {
this.advert = res.data;
}
);
},
// 广告点击查看详情
showSliderInfo(type, val) {
if (type == 1) {
if (val.indexOf('http') != -1) {
// #ifdef H5
window.location.href = val
// #endif
} else {
// #ifdef H5 || APP-PLUS || APP-PLUS-NVUE || MP
if (val == '/pages/index/default/default' || val == '/pages/category/index/index' || val == '/pages/index/cart/cart' || val == '/pages/index/member/member') {
this.$u.route({ type: 'switchTab', url: val });
return;
} else if (val.indexOf('/pages/coupon/coupon') > -1) {
var id = val.replace('/pages/coupon/coupon?id=', "");
this.receiveCoupon(id)
} else {
this.$u.route(val);
return;
}
// #endif
}
} else if (type == 2) {
// 商品详情
this.goGoodsDetail(val);
} else if (type == 3) {
// 文章详情
this.$u.route('/pages/article/details/details?id=' + val + '&idType=1');
} else if (type == 4) {
// 文章列表
this.$u.route('/pages/article/list/list?cid=' + val);
}
},
goSearch() {
if (this.searchKey != '') {
this.$u.route('/pages/category/list/list?key=' + this.searchKey);

View File

@@ -114,20 +114,6 @@
}
})
},
// 用户领取优惠券
receiveCoupon(couponId) {
let _this = this;
let coreshopdata = {
id: couponId
}
this.$u.api.getCoupon(coreshopdata).then(res => {
if (res.status) {
_this.$refs.uToast.show({ message: res.msg, type: 'success' })
} else {
this.$u.toast(res.msg)
}
})
}
}
};
</script>

View File

@@ -229,64 +229,6 @@
this.shareUrl = res.data
});
},
taped: function (e) {
this.showSliderInfo(this.swiperItems[e].linkType, this.swiperItems[e].linkValue);
},
// 广告点击查看详情
showSliderInfo(type, val) {
if (!val) {
return;
}
if (type == 1) {
if (val.indexOf('http') != -1) {
// #ifdef H5
window.location.href = val
// #endif
} else {
// #ifdef H5 || APP-PLUS || APP-PLUS-NVUE || MP
if (val == '/pages/index/default/default' || val == '/pages/category/index/index' || val == '/pages/index/cart/cart' || val == '/pages/index/member/member') {
this.$u.route({
type: 'switchTab',
url: val
});
return;
} else if (val.indexOf('/pages/coupon/coupon') > -1) {
var id = val.replace('/pages/coupon/coupon?id=', "");
this.receiveCoupon(id)
} else {
this.$u.route(val);
return;
}
// #endif
}
} else if (type == 2) {
// 商品详情
this.goGoodsDetail(val)
} else if (type == 3) {
// 文章详情
this.$u.route('/pages/article/details/details?id=' + val + '&idType=1')
} else if (type == 4) {
// 文章列表
this.$u.route('/pages/article/list/list?cid=' + val)
} else if (type == 5) {
//智能表单
this.$u.route('/pages/form/details/details?id=' + val)
}
},
// 用户领取优惠券
receiveCoupon(couponId) {
let data = {
promotion_id: couponId
}
this.$u.api.getCoupon(data).then(res => {
if (res.status) {
this.$refs.uToast.show({ message: res.msg, type: 'success', back: false })
} else {
this.$u.toast(res.msg)
}
})
},
},
onPullDownRefresh() {
this.swiperItems = [];