|
@@ -5,7 +5,11 @@
|
|
|
<image src="/static/logo2.png"></image>
|
|
|
</view>
|
|
|
</u-navbar>
|
|
|
- <u-swiper height="320" border-radius="0" :list="list" @change="e => current = e.current" :autoplay="false"></u-swiper>
|
|
|
+ <swiper :style="{'height':swiperHeight+'rpx'}" @change="e => current = e.current" :interval="interval" :duration="duration" :autoplay="autoplay">
|
|
|
+ <swiper-item v-for="swiper in list">
|
|
|
+ <image style="width:100%" @load="imageLoad" :src="$method.splitImgHost(swiper.adverUrl, true)" mode="widthFix"></image>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
<view class="content">
|
|
|
<view class="notice" v-if="infoNums">
|
|
|
<image src="/static/icon/msg_icon1.png" class="icon"></image>
|
|
@@ -126,9 +130,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
infoNums:0,
|
|
|
- list:[
|
|
|
- 'https://file.xyyxt.net/oss/images/file/20220111.jpg',
|
|
|
- ],
|
|
|
+ list:[],
|
|
|
tabCurrent:0,
|
|
|
date:['日','一','二','三','四','五','六'],
|
|
|
date_num: [],
|
|
@@ -137,6 +139,7 @@ export default {
|
|
|
autoplay: true,
|
|
|
interval: 2000,
|
|
|
duration: 500,
|
|
|
+ swiperHeight:0,
|
|
|
menu: [{
|
|
|
name: '推荐课程',
|
|
|
}, {
|
|
@@ -174,6 +177,7 @@ export default {
|
|
|
this.init()
|
|
|
this.courseList();
|
|
|
this.bankList();
|
|
|
+ this.getAdvertising()
|
|
|
},
|
|
|
onShow() {
|
|
|
if (uni.getStorageSync('updateHome')|| !this.isOld){
|
|
@@ -204,6 +208,36 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * banner图片加载完成
|
|
|
+ */
|
|
|
+ imageLoad(e) {
|
|
|
+ let winW = 750;
|
|
|
+ let imgW = e.detail.width;
|
|
|
+ let imgH = e.detail.height;
|
|
|
+ this.swiperHeight = 750 * imgH / imgW;
|
|
|
+ },
|
|
|
+ async getAdvertising() {
|
|
|
+ await this.advertisingHomeLocation();
|
|
|
+ await this.advertisingList();
|
|
|
+ },
|
|
|
+
|
|
|
+ advertisingHomeLocation() {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.$api.advertisingHomeLocation().then(res => {
|
|
|
+ this.interval = res.data.data.intervalTime * 1000
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ advertisingList() {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.$api.advertisingList().then(res => {
|
|
|
+ this.list = res.data.rows;
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
jumpPage(){
|
|
|
this.$navTo.togo('/pages2/msg/index')
|
|
|
},
|