Commit 2844ea02 authored by wangtao's avatar wangtao

'最新代码提交'

parent f5f159cf
......@@ -552,6 +552,11 @@ Page({
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
_params.content = JSON.stringify(_content);
const data = Object.assign(_params, {
class_id: this.data.id,
......
......@@ -76,7 +76,14 @@ Page({
maxImgCount: 1,
imageUploaded: true,
showtip: false,
isMarketting:false
isMarketting:false,
videostatus: {
preSrc: '',
currentSrc: '',
videoShow: false,
videoId: '',
src: ''
},
},
onLoad: function(options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
......@@ -297,7 +304,12 @@ Page({
})
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '')
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
_params.content = JSON.stringify(_content);
_params.amous_teacher = JSON.stringify(this.data.imageBox);
erpClassEdit(Object.assign(_params, {
......@@ -711,6 +723,46 @@ Page({
this.singleUploadFile(access);
})
},
// 视频播放相关代码
playvideo(e) {
const that = this;
const {
src,
from,
mode
} = e.detail;
this.setData({
'videostatus.videoId': src,
'videostatus.videoShow': true,
'videostatus.src': src,
'videostatus.mode': mode || 'mp4',
})
setTimeout(() => {
that.videoContext = wx.createVideoContext(src);
that.videoContext.play();
that.videoContext.requestFullScreen();
}, 500)
},
screenchange(e) {
const {
fullScreen
} = e.detail;
if (!fullScreen) { // 退出全屏时的操作
this.setData({
'videostatus.videoId': '',
'videostatus.videoShow': false,
'videostatus.src': '',
})
}
},
closeVideo() {
this.setData({
'videostatus.videoId': '',
'videostatus.videoShow': false,
'videostatus.src': '',
})
},
// 视频播放相关代码
delimg (e) {
const {dataset} = e.currentTarget;
const imageBox = this.data.imageBox;
......
......@@ -111,6 +111,7 @@
bind:slidestart="slidestart"
bind:slideend="slideend"
bind:delvoice="delvoice"
bind:playvideo="playvideo"
></sjd-media-editor>
</view>
<view class="devided-line"></view>
......@@ -144,4 +145,11 @@
>
</sound-recording>
</view>
<view class="videodialog" wx:if="{{videostatus.videoShow}}">
<view class="videodialogmask" bindtap="closeVideo"></view>
<video class="" src="{{filter.transformOssVideofy(videostatus.src,videostatus.mode)}}" id="{{videostatus.videoId}}"
initial-time="0" autoplay="false" loop="false" direction="0" bindplay="" bindpause="" bindended=""
bindtimeupdate="" bindwaiting="" binderror="" bindfullscreenchange="screenchange">
</video>
</view>
<expiredTip/>
\ No newline at end of file
......@@ -475,6 +475,11 @@ Page({
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
_params.content = JSON.stringify(_content);
const data = Object.assign(_params, {
class_id: this.data.id,
......
......@@ -169,12 +169,12 @@ Page({
} catch (error) {
}
const introduce = JSON.parse(data.introduce);
introduce.forEach((ele) => {
if (ele.type == 'video') {
ele.poster = ele.value;
}
})
// const introduce = JSON.parse(data.introduce);
// introduce.forEach((ele) => {
// if (ele.type == 'video') {
// ele.poster = ele.value;
// }
// })
this.setData({
params: {
school_id: data.school_id,
......@@ -207,6 +207,13 @@ Page({
})
})
},
// posterloaderr(e) {
// const { index } = e.detail;
// this.setData({
// [`params.introduce[${index}].poster`]: `${this.data.imageRoot}common/videodefaultbg.png`,
// })
// console.log(e, 'eee');
// },
titleInput(e) {
const {
value
......@@ -434,12 +441,16 @@ Page({
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
const { radioList, radioname } = this.data;
this.data.params.sign_up_content = {
radioname,
radioList,
}
console.log(this.data.params.sign_up_content,' this.data.params.sign_up_content')
try {
this.data.params.introduce = JSON.stringify(_content);
this.data.params.sign_up_content = JSON.stringify(this.data.params.sign_up_content);
......
......@@ -173,6 +173,7 @@
bind:playvideo="playvideo"
withmask="{{showWarn}}">
</sjd-media-editor>
<!-- bind:posterloaderr="posterloaderr" -->
</view>
</view>
</view>
......
......@@ -229,6 +229,11 @@ Page({
const sjdMediaEditor = this.selectComponent('#sjd-media-editor');
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_content.forEach((ele) => {
if (ele.type == 'video' && ele.poster) {
delete ele.poster;
}
})
_params.content = JSON.stringify(_content);
const paramsData = Object.assign(_params, {
class_id: this.data.id,
......
......@@ -330,6 +330,7 @@ Component({
content.push({
type: 'video',
value: filename,
poster: filename,
mode: 'm3u8'
})
this.setData({
......@@ -521,11 +522,10 @@ Component({
}
},
imgloaderr (e) {
const src = e.currentTarget.dataset.src;
// this.setData({
// content[]
// })
console.log(e);
const index = e.currentTarget.dataset.index;
this.setData({
[`content[${index}].poster`]: `${this.data.imageRoot}common/videodefaultbg.png`,
})
}
},
})
\ No newline at end of file
......@@ -189,6 +189,10 @@ function transformOssVideofyM3u8 (src) {
function videoPoster (src, params) {
if (!src) return '';
var _src = src;
var reg = getRegExp("(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$", "g");
if (reg.test(src)) {
return src;
}
if (src.indexOf('media.shangjiadao.cn') == -1) {
_src = 'https://media.shangjiadao.cn/' + src + '.jpg';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment