最新修改

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> <template>
<view class="banner-box"> <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"> <swiper-item v-for="(item,index) in bannerList" :key="index">
<view @tap="chooseImg(index,item.url,item.type)" class="img-box"> <view @tap="chooseImg(index,item.url,item.type)" class="img-box">
<!-- 图片 --> <!-- 图片 -->
@ -14,8 +14,7 @@
</swiper> </swiper>
<!-- 指示点 --> <!-- 指示点 -->
<view v-if="isDot" class="dot-box" :style="{bottom:newBottom}"> <view v-if="isDot" class="dot-box" :style="{bottom:newBottom}">
<view :class="bcurrent==indexd ? 'dotActive' : 'dotMo'" <view v-for="(itemd,indexd) in bannerList.length" :key="indexd" :class="currentDot==indexd ? 'dotActive' : 'dotMo'"
v-for="(itemd,indexd) in bannerList.length" :key="indexd"
@tap="chooseDot(indexd)" ></view> @tap="chooseDot(indexd)" ></view>
</view> </view>
</view> </view>
@ -33,11 +32,7 @@
bannerList:{// bannerList:{//
type:Array, type:Array,
default:function(){ default:function(){
return [ 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'},
]
} }
}, },
newHeight:{//swiper newHeight:{//swiper
@ -75,11 +70,15 @@
videoAutoPlay: this.videoAutoPlays, videoAutoPlay: this.videoAutoPlays,
ifAutoplay: this.ifAutoplays, ifAutoplay: this.ifAutoplays,
bcurrent: 0, // bcurrent: 0, //
currentDot: 0, // swiperindex
isShowVideo:false, // isShowVideo:false, //
isVideo:uni.getStorageSync('is_video') // isVideo:uni.getStorageSync('is_video') //
}; };
}, },
methods:{ methods:{
animationfinishChange(e) {
this.bcurrent = e.detail.current;
},
// //
chooseImg(index,url,type){ chooseImg(index,url,type){
// console.log('banner',index); // console.log('banner',index);
@ -121,19 +120,18 @@
} }
}, },
// //
changeBanner(e){ changeBanner(e){
this.bcurrent = e.detail.current;// this.currentDot = e.detail.current;//
let videoIndex = e.detail.current - 1; let videoIndex = e.detail.current;
if(videoIndex <= 0) {
videoIndex = 0;
}
console.log(videoIndex) console.log(videoIndex)
// //
uni.createVideoContext("video" + (videoIndex),this).pause() uni.createVideoContext("video" + (videoIndex),this).pause();
}, },
handleVideoPlay() { handleVideoPlay() {
this.ifAutoplay = false this.ifAutoplay = false;
this.videoAutoPlay = true; this.videoAutoPlay = true;
}, },
handleVideoPause() { handleVideoPause() {

View File

@ -80,9 +80,7 @@
data() { data() {
return { return {
newtop:uni.getSystemInfoSync().statusBarHeight + 40, newtop:uni.getSystemInfoSync().statusBarHeight + 40,
bannerList:[ bannerList:[],//
],//
current:0, current:0,
dataList:[],// dataList:[],//
classId:'',//id classId:'',//id
@ -94,8 +92,6 @@
} }
}, },
onShow() { onShow() {
// banner
this.$store.commit('setAutoplay',true);
// //
this.isVideoEv(); this.isVideoEv();
}, },
@ -121,6 +117,8 @@
this.getCourseCate(); this.getCourseCate();
// banner // banner
this.getBanner(); this.getBanner();
// banner
this.$store.commit('setAutoplay',true);
console.log(op) console.log(op)
if(op) { if(op) {
uni.setStorageSync('invite_code',op.invite_code); uni.setStorageSync('invite_code',op.invite_code);

View File

@ -5,6 +5,7 @@
</status-container> </status-container>
<!-- 分享图 --> <!-- 分享图 -->
<image :src="shareImg" mode="widthFix" lazy-load class="qrIamge"></image> <image :src="shareImg" mode="widthFix" lazy-load class="qrIamge"></image>
<view style="height: 100rpx;"></view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="bottom-btn"> <view class="bottom-btn">
<view @tap="downloadImgEv"></view> <view @tap="downloadImgEv"></view>
@ -24,9 +25,11 @@
data() { data() {
return { return {
shareImg:'', shareImg:'',
hostapi:'',//
} }
}, },
onLoad() { onLoad() {
this.hostapi = getApp().globalData.hostapi;
this.qrCode(); this.qrCode();
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
@ -50,7 +53,7 @@
this.$requst.get('/api/user/personal-poster').then(res=>{ this.$requst.get('/api/user/personal-poster').then(res=>{
if(res.code==0){ if(res.code==0){
uni.hideLoading(); uni.hideLoading();
this.shareImg = res.data.poster; this.shareImg = this.hostapi + res.data.poster;
} }
}).catch(err=>{ }).catch(err=>{
uni.hideLoading(); 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(){ saveImageToPhotosAlbum(){
let base64=this.shareImg.replace(/^data:image\/\w+;base64,/, "");//data:image/png;base64, uni.downloadFile({
let filePath=wx.env.USER_DATA_PATH + '/hym_pay_qrcode.png'; url: this.shareImg,
uni.getFileSystemManager().writeFile({ success: (res) => {
filePath:filePath , //
data: base64, //
encoding: 'base64', //
success: res => {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: filePath, filePath: res.tempFilePath,
success: function(res2) { success: ()=> {
uni.showToast({ uni.showToast({
title:'保存成功', title:'保存成功',
icon:'success', icon:'success',
duration:2000 duration:2000
}) })
}, },
fail: function(err) { fail: () => {
uni.showToast({ uni.showToast({
title:'保存失败', title:'保存失败',
icon:'error', icon:'error',
duration:2000 duration:2000
}) })
} }
}) });
},
fail: err => {
//console.log(err)
} }
}) })
} }
} }
} }
</script> </script>

View File

@ -41,11 +41,10 @@
</template> </template>
<script> <script>
import evanSwitch from '@/components/evan-switch/evan-switch.vue';
import addressOne from '@/components/address-one/address-one.vue'; import addressOne from '@/components/address-one/address-one.vue';
export default { export default {
components:{ components:{
evanSwitch,
addressOne addressOne
}, },
data() { data() {