最新修改
parent
710aabb57f
commit
da89a9d42c
|
@ -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, // 用来记录当前swiper对应的索引index
|
||||||
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() {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue