最新修改

master
xcw 2023-03-16 17:10:21 +08:00
parent 710aabb57f
commit da89a9d42c
4 changed files with 60 additions and 39 deletions

View File

@ -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,8 +14,7 @@
</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"
<view v-for="(itemd,indexd) in bannerList.length" :key="indexd" :class="currentDot==indexd ? 'dotActive' : 'dotMo'"
@tap="chooseDot(indexd)" ></view>
</view>
</view>
@ -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, // swiperindex
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() {

View File

@ -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);

View File

@ -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,39 +113,62 @@
})
},
// 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)
});
}
})
}
}
}
</script>

View File

@ -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() {