最新修改
parent
710aabb57f
commit
da89a9d42c
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view class="banner-box">
|
||||
<swiper :current="bcurrent" @change="changeBanner" :style="{height: newHeight}" :autoplay="ifAutoplay" :circular="true" :interval="3000" :duration="500">
|
||||
<swiper :current="bcurrent" @change="changeBanner" @animationfinish="animationfinishChange" :style="{height: newHeight}" :autoplay="ifAutoplay" :circular="true" :interval="3000" :duration="500">
|
||||
<swiper-item v-for="(item,index) in bannerList" :key="index">
|
||||
<view @tap="chooseImg(index,item.url,item.type)" class="img-box">
|
||||
<!-- 图片 -->
|
||||
|
@ -14,9 +14,8 @@
|
|||
</swiper>
|
||||
<!-- 指示点 -->
|
||||
<view v-if="isDot" class="dot-box" :style="{bottom:newBottom}">
|
||||
<view :class="bcurrent==indexd ? 'dotActive' : 'dotMo'"
|
||||
v-for="(itemd,indexd) in bannerList.length" :key="indexd"
|
||||
@tap="chooseDot(indexd)"></view>
|
||||
<view v-for="(itemd,indexd) in bannerList.length" :key="indexd" :class="currentDot==indexd ? 'dotActive' : 'dotMo'"
|
||||
@tap="chooseDot(indexd)" ></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -33,11 +32,7 @@
|
|||
bannerList:{//默认轮播图片
|
||||
type:Array,
|
||||
default:function(){
|
||||
return [
|
||||
{imgSrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',url:'',isVideo:false,poster:'',type:'image'},
|
||||
{imgSrc:'https://www.runoob.com/try/demo_source/movie.mp4',url:'',isVideo:false,poster:'',type:'video'},
|
||||
{imgSrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',url:'',isVideo:false,poster:'',type:'image'},
|
||||
]
|
||||
return []
|
||||
}
|
||||
},
|
||||
newHeight:{//swiper的高
|
||||
|
@ -75,11 +70,15 @@
|
|||
videoAutoPlay: this.videoAutoPlays,
|
||||
ifAutoplay: this.ifAutoplays,
|
||||
bcurrent: 0, // 默认当前选中项
|
||||
currentDot: 0, // 用来记录当前swiper对应的索引index
|
||||
isShowVideo:false, // 是否显示视频
|
||||
isVideo:uni.getStorageSync('is_video') // 是否是视频
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
animationfinishChange(e) {
|
||||
this.bcurrent = e.detail.current;
|
||||
},
|
||||
// 图片点击事件
|
||||
chooseImg(index,url,type){
|
||||
// console.log('当前banner图',index);
|
||||
|
@ -121,19 +120,18 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 切换后获取当前索引
|
||||
changeBanner(e){
|
||||
this.bcurrent = e.detail.current;//当前的指示点下标
|
||||
let videoIndex = e.detail.current - 1;
|
||||
if(videoIndex <= 0) {
|
||||
videoIndex = 0;
|
||||
}
|
||||
this.currentDot = e.detail.current;//当前的指示点下标
|
||||
let videoIndex = e.detail.current;
|
||||
console.log(videoIndex)
|
||||
//切换时要把视频暂停
|
||||
uni.createVideoContext("video" + (videoIndex),this).pause()
|
||||
uni.createVideoContext("video" + (videoIndex),this).pause();
|
||||
},
|
||||
handleVideoPlay() {
|
||||
this.ifAutoplay = false
|
||||
this.ifAutoplay = false;
|
||||
this.videoAutoPlay = true;
|
||||
},
|
||||
handleVideoPause() {
|
||||
|
|
|
@ -80,9 +80,7 @@
|
|||
data() {
|
||||
return {
|
||||
newtop:uni.getSystemInfoSync().statusBarHeight + 40,
|
||||
bannerList:[
|
||||
|
||||
],//轮播图
|
||||
bannerList:[],//轮播图
|
||||
current:0,
|
||||
dataList:[],//分类列表
|
||||
classId:'',//分类id
|
||||
|
@ -94,8 +92,6 @@
|
|||
}
|
||||
},
|
||||
onShow() {
|
||||
// 开启banner图自动轮播
|
||||
this.$store.commit('setAutoplay',true);
|
||||
// 判断视频是否隐藏
|
||||
this.isVideoEv();
|
||||
},
|
||||
|
@ -121,6 +117,8 @@
|
|||
this.getCourseCate();
|
||||
// 调用获取首页banner图
|
||||
this.getBanner();
|
||||
// 开启banner图自动轮播
|
||||
this.$store.commit('setAutoplay',true);
|
||||
console.log(op)
|
||||
if(op) {
|
||||
uni.setStorageSync('invite_code',op.invite_code);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</status-container>
|
||||
<!-- 分享图 -->
|
||||
<image :src="shareImg" mode="widthFix" lazy-load class="qrIamge"></image>
|
||||
<view style="height: 100rpx;"></view>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-btn">
|
||||
<view @tap="downloadImgEv">下载图片</view>
|
||||
|
@ -24,9 +25,11 @@
|
|||
data() {
|
||||
return {
|
||||
shareImg:'',
|
||||
hostapi:'',// 域名
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.hostapi = getApp().globalData.hostapi;
|
||||
this.qrCode();
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
|
@ -50,7 +53,7 @@
|
|||
this.$requst.get('/api/user/personal-poster').then(res=>{
|
||||
if(res.code==0){
|
||||
uni.hideLoading();
|
||||
this.shareImg = res.data.poster;
|
||||
this.shareImg = this.hostapi + res.data.poster;
|
||||
}
|
||||
}).catch(err=>{
|
||||
uni.hideLoading();
|
||||
|
@ -110,38 +113,61 @@
|
|||
})
|
||||
|
||||
},
|
||||
// saveImageToPhotosAlbum(){
|
||||
// let base64=this.shareImg.replace(/^data:image\/\w+;base64,/, "");//去掉data:image/png;base64,
|
||||
// let filePath=wx.env.USER_DATA_PATH + '/hym_pay_qrcode.png';
|
||||
// uni.getFileSystemManager().writeFile({
|
||||
// filePath:filePath , //创建一个临时文件名
|
||||
// data: base64, //写入的文本或二进制数据
|
||||
// encoding: 'base64', //写入当前文件的字符编码
|
||||
// success: res => {
|
||||
// uni.saveImageToPhotosAlbum({
|
||||
// filePath: filePath,
|
||||
// success: function(res2) {
|
||||
// uni.showToast({
|
||||
// title:'保存成功',
|
||||
// icon:'success',
|
||||
// duration:2000
|
||||
// })
|
||||
// },
|
||||
// fail: function(err) {
|
||||
// uni.showToast({
|
||||
// title:'保存失败',
|
||||
// icon:'error',
|
||||
// duration:2000
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// fail: err => {
|
||||
// //console.log(err)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
saveImageToPhotosAlbum(){
|
||||
let base64=this.shareImg.replace(/^data:image\/\w+;base64,/, "");//去掉data:image/png;base64,
|
||||
let filePath=wx.env.USER_DATA_PATH + '/hym_pay_qrcode.png';
|
||||
uni.getFileSystemManager().writeFile({
|
||||
filePath:filePath , //创建一个临时文件名
|
||||
data: base64, //写入的文本或二进制数据
|
||||
encoding: 'base64', //写入当前文件的字符编码
|
||||
success: res => {
|
||||
uni.downloadFile({
|
||||
url: this.shareImg,
|
||||
success: (res) => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: filePath,
|
||||
success: function(res2) {
|
||||
filePath: res.tempFilePath,
|
||||
success: ()=> {
|
||||
uni.showToast({
|
||||
title:'保存成功',
|
||||
icon:'success',
|
||||
duration:2000
|
||||
})
|
||||
},
|
||||
fail: function(err) {
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title:'保存失败',
|
||||
icon:'error',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
//console.log(err)
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,11 +41,10 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import evanSwitch from '@/components/evan-switch/evan-switch.vue';
|
||||
|
||||
import addressOne from '@/components/address-one/address-one.vue';
|
||||
export default {
|
||||
components:{
|
||||
evanSwitch,
|
||||
addressOne
|
||||
},
|
||||
data() {
|
||||
|
|
Loading…
Reference in New Issue