修改分享

master
xcw 2023-02-22 10:39:55 +08:00
parent 1c6e8206ad
commit bd8167724c
10 changed files with 153 additions and 53 deletions

View File

@ -120,10 +120,15 @@
}) })
} }
}, },
// //
changeBanner(e){ changeBanner(e){
this.bcurrent = e.detail.current;// this.bcurrent = e.detail.current;//
let videoIndex = e.detail.current; let videoIndex = e.detail.current - 1;
if(videoIndex <= 0) {
videoIndex = 0;
}
console.log(videoIndex)
// //
uni.createVideoContext("video" + (videoIndex),this).pause() uni.createVideoContext("video" + (videoIndex),this).pause()
}, },

View File

@ -44,6 +44,8 @@ const checkError = (e) => {
switch (Number(e.data.code)) { switch (Number(e.data.code)) {
case 500: case 500:
case 4000:// 参数错误 case 4000:// 参数错误
case 4001:// 参数错误
case 4002:// 参数错误
case 4003:// 参数错误 case 4003:// 参数错误
case 4004:// 记录不存在 case 4004:// 记录不存在
case 5000:// xxx错误 case 5000:// xxx错误

View File

@ -109,6 +109,9 @@
if(index==8){ if(index==8){
list[8] = ['/pagesA/my-extend/my-extend','/pagesB/second-level/second-level?level=1','/pagesB/second-level/second-level?level=2' ][this.userInfo.position] list[8] = ['/pagesA/my-extend/my-extend','/pagesB/second-level/second-level?level=1','/pagesB/second-level/second-level?level=2' ][this.userInfo.position]
} }
if(index==9){
list[9] = ['/pagesA/my-share/my-share','/pagesB/second-level/second-level?level=1','/pagesB/second-level/second-level?level=2' ][this.userInfo.position]
}
uni.navigateTo({ uni.navigateTo({
url:list[index] url:list[index]
}) })

View File

@ -98,6 +98,7 @@
this.$store.commit('setAutoplay',true); this.$store.commit('setAutoplay',true);
// //
this.isVideoEv(); this.isVideoEv();
console.log(op,'aaaaa')
}, },
onHide() { onHide() {
// banner // banner
@ -112,6 +113,7 @@
  return shareObj;   return shareObj;
}, },
onLoad(op) { onLoad(op) {
// unescape("http%3A//www.baidu.com%3Fname%3Dzhang@xiao@jie%26order%3D1") // unescape("http%3A//www.baidu.com%3Fname%3Dzhang@xiao@jie%26order%3D1")
// decodeURIComponent("http%3A%2F%2Fwww.baidu.com%3Fname%3Dzhang%40xiao%40jie%26order%3D1") // decodeURIComponent("http%3A%2F%2Fwww.baidu.com%3Fname%3Dzhang%40xiao%40jie%26order%3D1")
if(op.q!=undefined){ if(op.q!=undefined){

View File

@ -12,14 +12,6 @@
<view class="bacf pad-zy20 boxshow2 posi-sticky" :style="{top:newtop+'px'}"> <view class="bacf pad-zy20 boxshow2 posi-sticky" :style="{top:newtop+'px'}">
<view class="disjcac pad-sx30 bbot">
<view v-if="personCode" class="">
<image :src="personCode" mode="aspectFill" style="width: 124px;height: 124px;" lazy-load></image>
</view>
<view class="" v-else>
<yz-qr @update:qrPath="getPath" ref="qrPath" :text="textstr" :size="124" :colorDark="'#000000'" :colorLight="'#FFFFFF'"></yz-qr>
</view>
</view>
<view class="disjbac pad-sx20 pad-zy10"> <view class="disjbac pad-sx20 pad-zy10">
<view class="fon22 col26">推广获取积分</view> <view class="fon22 col26">推广获取积分</view>
<view class="fon26 bold col-e42417">{{scoreInfo || 0}}</view> <view class="fon26 bold col-e42417">{{scoreInfo || 0}}</view>

View File

@ -1,8 +1,10 @@
<template> <template>
<view> <view>
<status-container titlet="我的分享" returnc="#FFFFFF"></status-container> <status-container titlet="我的分享" returnc="#FFFFFF">
</status-container>
<!-- 分享图 --> <!-- 分享图 -->
<image :src="shareImg" mode="widthFix" lazy-load></image> <image :src="shareImg" mode="widthFix" lazy-load class="qrIamge"></image>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="bottom-btn"> <view class="bottom-btn">
<view @tap="downloadImgEv"></view> <view @tap="downloadImgEv"></view>
@ -25,45 +27,115 @@
} }
}, },
onLoad() { onLoad() {
uni.showToast({ this.qrCode();
title:'正在生成推广码',
icon:'loading',
duration:10000
})
// 广
createPoster({introducer:wx.getStorageSync('introducer')}).then(res=>{
this.shareImg = res.data.path;
uni.hideLoading();
}).catch(err=>{
uni.hideLoading();
uni.showToast({
title:'生成失败',
icon:'none',
position:'bottom'
})
setTimeout(()=>{
uni.navigateBack({delta:1})
},1000)
})
}, },
methods: { methods: {
// //
qrCode() {
uni.showLoading({
title:'正在生成推广码',
icon:'loading',
duration:5000
})
// 广
this.$requst.get('/api/user/personal-poster').then(res=>{
if(res.code==0){
this.shareImg = res.data.poster;
uni.hideLoading();
}
}).catch(err=>{
uni.hideLoading();
uni.showToast({
title:'生成失败',
icon:'none',
position:'bottom'
})
setTimeout(()=>{
uni.navigateBack({delta:1})
},1000)
})
},
//
downloadImgEv(){ downloadImgEv(){
uni.downloadFile({ uni.getSetting({//
url: this.shareImg, success:(res)=> {
success: (res) => { if(res.authSetting['scope.writePhotosAlbum']){//访
this.saveImageToPhotosAlbum();
}else{
uni.authorize({//
scope: 'scope.writePhotosAlbum',
success:()=> {
this.saveImageToPhotosAlbum();
},
fail:()=>{
uni.showModal({
content:'检测到您没打开保存图片的权限,是否去设置打开?',
confirmText: "确认",
cancelText:'取消',
success: (res) => {
if(res.confirm){
uni.openSetting({
success: (res) => {
console.log(res);
// this.getLocation();
}
})
}else{
console.log('取消');
return false;
}
}
})
setTimeout(()=>{
uni.openSetting({//,访
success:(res2)=> {
// console.log(res2.authSetting)
}
});
},3000);
}
})
}
}
})
},
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({ uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath, filePath: filePath,
success: ()=> { success: function(res2) {
console.log('save success'); uni.showToast({
title:'保存成功',
icon:'success',
duration:2000
})
}, },
fail: () => { fail: function(err) {
uni.showToast({title:'保存失败',icon:'error'}) uni.showToast({
title:'保存失败',
icon:'error',
duration:2000
})
} }
}); })
},
fail: err => {
//console.log(err)
} }
}) })
} }
} }
} }
</script> </script>
@ -77,7 +149,7 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
padding: 20rpx; padding:20rpx 20rpx;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
box-shadow: 0rpx -3rpx 20rpx rgba(0,0,0,.05); box-shadow: 0rpx -3rpx 20rpx rgba(0,0,0,.05);
@ -89,4 +161,10 @@
border-radius: 80rpx; border-radius: 80rpx;
font-size: 36rpx; font-size: 36rpx;
} }
.qrIamge {
width: 90%;
display: block;
margin: -120rpx auto 0;
}
</style> </style>

View File

@ -4,15 +4,15 @@
<view slot="content" style="margin-top: -20rpx;"> <view slot="content" style="margin-top: -20rpx;">
<view class="pad-zy30 bacf pad-x30" v-if="total"> <view class="pad-zy30 bacf pad-x30" v-if="total">
<view class="pad-sx30 disac fon24 bbot" v-for="(item,index) in dataList" :key="index"> <view class="pad-sx30 disac fon24 bbot" v-for="(item,index) in dataList" :key="index">
<image class="flexs" :src="item.cover" mode="aspectFill" style="width: 228rpx;height: 160rpx;"></image> <image class="flexs" :src="hostapi + item.course_video_cover" mode="aspectFill" style="width: 228rpx;height: 160rpx;"></image>
<view class="disjbac fc width100 mar-z20" style="height: 160rpx;"> <view class="disjbac fc width100 mar-z20" style="height: 160rpx;">
<view class="fon26 col26 width100"> <view class="fon26 col26 width100">
<view class="clips2">{{item.name}}</view> <view class="clips2">{{item.course_video_title}}</view>
<view class="fon20 mar-s10" style="color: #7f7f7f;">{{item.created_at}}</view> <view class="fon20 mar-s10" style="color: #7f7f7f;">{{item.course_video_summary}}</view>
</view> </view>
<view class="disjbac width100"> <view class="disjbac width100">
<view class="fon24">{{item.price}}</view> <view class="fon24"></view>
<view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.spu_id}`)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击学习</view> <view @tap="getVideoInfo(item.course_video_id)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击查看</view>
</view> </view>
</view> </view>
</view> </view>
@ -40,10 +40,12 @@
size:20, size:20,
total:0, total:0,
noMore:false, noMore:false,
loading:false loading:false,
hostapi:'',//
} }
}, },
onLoad() { onLoad() {
this.hostapi = getApp().globalData.hostapi;
// //
this.getCouresList(); this.getCouresList();
}, },
@ -61,7 +63,7 @@
page:this.page, page:this.page,
size:this.size size:this.size
} }
this.$requst.get('/api/course/course-browse-records',params).then(res=>{ this.$requst.post('/api/course/course-browse-records',params).then(res=>{
this.total = res.data.total; this.total = res.data.total;
if(this.page==1){this.dataList=[];} if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list]; this.dataList = [...this.dataList,...res.data.list];
@ -72,6 +74,22 @@
}) })
}, },
getVideoInfo(id) {
this.$requst.post('/api/course/get-course-video-info',{course_video_id:id}).then(res=>{
console.log(res.code,'课程视频')
if(res.code == 0) {
uni.navigateTo({
url:`/pagesB/course-video/course-video?id=${id}`
})
}else {
uni.showToast({
title: res.msg,//
icon: 'error',//
})
}
})
}
} }
} }
</script> </script>

View File

@ -6,7 +6,6 @@
<view class="fon32 tcenter pad-s50">{{couresDetail.name}}</view> <view class="fon32 tcenter pad-s50">{{couresDetail.name}}</view>
<view class="pad30 posir disjcac"> <view class="pad30 posir disjcac">
<image :src="couresDetail.cover" style="height: 388rpx;" mode="aspectFill" class="width100" lazy-load></image> <image :src="couresDetail.cover" style="height: 388rpx;" mode="aspectFill" class="width100" lazy-load></image>
<image v-if="couresDetail.video.includes('.mp4')" @tap="playVideo" class="posia" src="/static/tabbar/icon-play.png" mode="" style="width: 70rpx;height: 70rpx;" lazy-load></image>
</view> </view>
<view class="mar-zy30 bbot pad-x10"> <view class="mar-zy30 bbot pad-x10">
<span class="fon28 bold posir pad-x10"> <span class="fon28 bold posir pad-x10">
@ -169,6 +168,7 @@
url:`/pagesB/course-detail/course-detail?id=${id}&category_id=${this.classId}` url:`/pagesB/course-detail/course-detail?id=${id}&category_id=${this.classId}`
}) })
}, },
// //
playVideo(){ playVideo(){
if(this.couresDetail.type=="video_number"){ if(this.couresDetail.type=="video_number"){

View File

@ -65,7 +65,7 @@
size:this.size, size:this.size,
course_id:this.course_id, course_id:this.course_id,
} }
this.$requst.get('/api/course/get-course-video',params).then(res=>{ this.$requst.post('/api/course/get-course-video',params).then(res=>{
this.total = res.data.list; this.total = res.data.list;
if(this.page==1){this.dataList=[];} if(this.page==1){this.dataList=[];}
this.dataList = [...this.dataList,...res.data.list]; this.dataList = [...this.dataList,...res.data.list];
@ -78,7 +78,7 @@
getVideoInfo(id) { getVideoInfo(id) {
this.$requst.get('/api/course/get-course-video-info',{course_video_id:id}).then(res=>{ this.$requst.post('/api/course/get-course-video-info',{course_video_id:id}).then(res=>{
console.log(res.code,'课程视频') console.log(res.code,'课程视频')
if(res.code == 0) { if(res.code == 0) {
uni.navigateTo({ uni.navigateTo({

View File

@ -65,7 +65,7 @@
let course_video_id = this.videoList[this.currentIndex].course_video_id; let course_video_id = this.videoList[this.currentIndex].course_video_id;
let params = { let params = {
course_video_id:course_video_id, course_video_id:course_video_id,
duration:this.currentTime, duration:parseInt(this.currentTime),
} }
this.$requst.get('/api/course/create-browse-records',params).then(res=>{ this.$requst.get('/api/course/create-browse-records',params).then(res=>{
if(res.code == 0) { if(res.code == 0) {