|
@@ -2,10 +2,20 @@
|
|
|
<view>
|
|
|
<ujp-navbar title="51商城"></ujp-navbar>
|
|
|
<!-- 广告-->
|
|
|
+ <!-- <view class="banner">
|
|
|
+
|
|
|
+
|
|
|
+ </view> -->
|
|
|
+
|
|
|
<view class="banner">
|
|
|
|
|
|
- <img src="../../assets/img/storeBanner1.png" alt="">
|
|
|
+ <u-swiper bg-color="#fff" v-if="bannerList.length"
|
|
|
+ :img-mode="'scaleToFill'" :list="bannerList" @click="clickBanner"
|
|
|
+ :name="'picUrl'">
|
|
|
+ </u-swiper>
|
|
|
+ <img src="../../assets/img/storeBanner1.png" alt="" v-else >
|
|
|
|
|
|
+
|
|
|
</view>
|
|
|
<!-- 标签 -->
|
|
|
<!-- <view class="banner2">
|
|
@@ -58,18 +68,20 @@
|
|
|
|
|
|
<script>
|
|
|
import * as API from '@/apis/mall.js'
|
|
|
-
|
|
|
+ import * as newsApi from '@/apis/news.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
mallList:[],
|
|
|
-
|
|
|
+ bannerList: [],
|
|
|
pageIndex: 1,
|
|
|
recordsTotal: 0,
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
|
this.getList()
|
|
|
+ this.getBannerInfo("store");
|
|
|
+
|
|
|
|
|
|
},
|
|
|
onReachBottom() {
|
|
@@ -78,6 +90,63 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ clickBanner(index, bl, modout) {
|
|
|
+ var uurl = "";
|
|
|
+ var mod = this.bannerList[index]
|
|
|
+ if (modout) {
|
|
|
+ mod = modout;
|
|
|
+ }
|
|
|
+ mod.clickUrl = mod.linkUrl
|
|
|
+
|
|
|
+ if (mod.linkPicUrl && !bl) {
|
|
|
+
|
|
|
+ this.showOss = true;
|
|
|
+ this.showOssImg = mod.linkPicUrl;
|
|
|
+ this.showOssIndex = index;
|
|
|
+
|
|
|
+ } else if (mod.clickUrl == null) {
|
|
|
+
|
|
|
+ } else if (mod.clickUrl.indexOf('http') == 0) {
|
|
|
+
|
|
|
+ window.location = mod.clickUrl + uurl;
|
|
|
+ } else if (mod.clickUrl.slice(-5) == 'login' && this.userId) {
|
|
|
+
|
|
|
+ } else if (mod.clickUrl.indexOf('#/') == 0) {
|
|
|
+ if (mod.clickUrl.indexOf("?") == -1) {
|
|
|
+ mod.clickUrl += '?';
|
|
|
+ }
|
|
|
+ var url = mod.clickUrl.split("#")[1]
|
|
|
+ //window.location = mod.clickUrl;
|
|
|
+ uni.navigateTo({
|
|
|
+ url: url + uurl
|
|
|
+ })
|
|
|
+ } else if (mod.clickUrl == '#' || mod.clickUrl == '') {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: mod.clickUrl + uurl
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getBannerInfo(code, list) {
|
|
|
+
|
|
|
+ newsApi.getBannerInfo(code).then((res) => {
|
|
|
+ if (list) {
|
|
|
+ this[list] = res.data;
|
|
|
+ } else {
|
|
|
+ this.bannerList = res.data;
|
|
|
+ }
|
|
|
+
|
|
|
+ //uni.hideLoading()
|
|
|
+ //document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 120px;"
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+
|
|
|
+ title: error,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
myLoadmore(){
|
|
|
this.pageIndex += 1;
|
|
|
this.getList()
|