Commit 847b9893 authored by wangxuelai's avatar wangxuelai

''

parent 4e662fab
...@@ -195,9 +195,7 @@ Component({ ...@@ -195,9 +195,7 @@ Component({
this.ctx.fillText(fillText, left, fillTop) this.ctx.fillText(fillText, left, fillTop)
this.drawTextLine(left, fillTop, textDecoration, color, fontSize, fillText) this.drawTextLine(left, fillTop, textDecoration, color, fontSize, fillText)
} }
this.ctx.restore() this.ctx.restore()
if (bolder) { if (bolder) {
this.drawText({ this.drawText({
...params, ...params,
......
import { import {
wxOpenLocation, wxOpenLocation,
wxPreviewImage wxPreviewImage,
wxGetImageInfo
} from '../../../utilities/wxApi.js'; } from '../../../utilities/wxApi.js';
import { import {
delEvaluate, delEvaluate,
...@@ -10,11 +11,13 @@ import { ...@@ -10,11 +11,13 @@ import {
fingureUpList fingureUpList
} from '../../../service/customer/circleindex.js'; } from '../../../service/customer/circleindex.js';
import { import {
formIdCreate formIdCreate,
generateCustomerQrcode
} from '../../../service/common.js'; } from '../../../service/common.js';
import { import {
LocalStorage, LocalStorage,
imagify imagify,
voiceTimeFormat
} from '../../../utilities/index.js'; } from '../../../utilities/index.js';
var app = getApp(); var app = getApp();
Component({ Component({
...@@ -75,6 +78,7 @@ Component({ ...@@ -75,6 +78,7 @@ Component({
tid: 0, tid: 0,
name: '' name: ''
}, },
imageIndex: 0
}, },
created () { created () {
}, },
...@@ -527,6 +531,254 @@ Component({ ...@@ -527,6 +531,254 @@ Component({
current: src, current: src,
type: 'clockitem' type: 'clockitem'
}) })
} },
} // 生成长图海报相关代码
generatelongimg() { // 生成日签
let baseHeight = 320;
const that = this;
let qrcode = '';
let clock = this.data.clock;
let className = clock.subject.classes.title;
let images = clock.video_parse.filter((ele) => ele.type == 'image');
let content_100 = clock.content_100;
let content = clock.content;
let avatar = clock.school_student.avatar;
let nickname = clock.school_student.nickname;
let review = clock.review && clock.review[1] || {1: null, 2: null};
let audio = clock.audio_parse.splice(0,1);
if (audio.length == 0) {
images = images.splice(0,3);
} else {
images = images.splice(0,2);
}
let startDrawTop = 395;
const ctx = wx.createCanvasContext('myCanvas');
ctx.font = 'italic bold 28px cursive';
let contentHeight = 0;
let contentPaintJson = {};
if (content != '') {
contentHeight = Math.ceil(Math.ceil(ctx.measureText(content).width / 663) * 1.2 * 28) + 40;
contentPaintJson = {
type: 'text',
content: content,
fontSize: 28,
color: '#000000',
textAlign: 'left',
top: startDrawTop,
left: 41,
breakWord: true,
width: 663,
lineHeight: 36,
MaxLineNumber: Math.ceil(ctx.measureText(content).width / 663)
};
}
this.getImagesInfo(images, function(res) { // 将所有的图片转化成宽666 高度撑开的尺寸计算图片所占的高度
let imagesHeight = images.reduce(function (total, currentValue, currentIndex, arr) {
return total + currentValue.height;
}, 0);
imagesHeight = imagesHeight + (images.length) * 20;
let imageBoxHeight = 40 * images.length;
let audioBoxHeight = 0;
let imagesPaintArr = [];
let reciewPaintArr = [];
let audioPaintArr = [];
let imageStartDrawTop = contentHeight + startDrawTop;
let canvasHeight = 0;
images.forEach((ele, index) => {
imageBoxHeight = imageBoxHeight + ele.height;
imageStartDrawTop = imageStartDrawTop + (index == 0 ? 0 : (images[index - 1].height + 40));
imagesPaintArr.push({
type: 'image',
url: imagify(ele.src, 'image/resize,w_666/format,jpg'),
top: imageStartDrawTop,
left: 42,
width: ele.width,
height: ele.height,
})
});
if (audio.length > 0) {
audioBoxHeight = audio.length * (156 + 20);
let audioStartDrawTop = contentHeight + startDrawTop + imageBoxHeight;
audio.forEach((ele, index) => {
console.log(voiceTimeFormat(ele.duration), 'ele.duration');
audioStartDrawTop = audioStartDrawTop + (index == 0 ? 0 : 156);
audioPaintArr = audioPaintArr.concat([{
type: 'image',
url: 'https://cdn.img.shangjiadao.cn/source/images/dakav4/2c/common/radiobox.png',
top: audioStartDrawTop - 20,
left: 23,
width: 705,
height: 156,
},{
type: 'text',
content: '00:00',
fontSize: 24,
color: '#000000',
textAlign: 'left',
top: audioStartDrawTop + 64 - 20,
left: 150,
width: 89,
},{
type: 'text',
content: voiceTimeFormat(ele.duration),
fontSize: 24,
color: '#000000',
textAlign: 'left',
top: audioStartDrawTop + 64- 20,
left: 620,
width: 89,
}])
})
}
if (review && review[1]) {
let reviewStartDrawTop = contentHeight + startDrawTop + imageBoxHeight + audioBoxHeight;
let bgUrl = 'https://cdn.img.shangjiadao.cn/source/images/dakav4/2c/common/reviewbox.png';
if (review.img && JSON.parse(review.img).length > 0 && !review.audio) { // 有图片无录音
let bgUrl = 'https://cdn.img.shangjiadao.cn/source/images/dakav4/2c/common/reviewboximg.png';
}
if (review.img && JSON.parse(review.img).length > 0 && review.audio) { // 有图片有录音
let bgUrl = 'https://cdn.img.shangjiadao.cn/source/images/dakav4/2c/common/reviewboxboth.png';
}
if (!review.img || JSON.parse(review.img).length == 0 && review.audio) { // 无图片有录音
let bgUrl = 'https://cdn.img.shangjiadao.cn/source/images/dakav4/2c/common/reviewboxaudio.png';
}
reciewPaintArr.push({
type: 'image',
url: bgUrl,
top: reviewStartDrawTop - 20,
left: 42,
width: 666,
height: 366
},{
type: 'text',
content: review.content,
fontSize: 26,
color: '#D0D0D0',
textAlign: 'left',
top: reviewStartDrawTop + 150 - 20,
left: 93,
width: 562,
breakWord: true,
lineHeight: 32,
MaxLineNumber: 5
})
canvasHeight = canvasHeight + 366;
}
canvasHeight = canvasHeight + contentHeight + imagesHeight + startDrawTop + audioBoxHeight + 260;
generateCustomerQrcode({
scene: `tid=${that.data.tid}&cid=${that.data.cid}`,
page: `src/pages/clockdetail/index`
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
qrcode = imagify(data.url);
} else {
qrcode = '';
}
let painting = {
width: 750,
height: canvasHeight,
views: [
{
type: 'rect',
top: 0,
left: 0,
width: 750,
height: 5000,
background: '#fff'
},
{
type: 'image',
url: imagify(avatar),
top: 286,
left: 41,
width: 73,
height: 73
},
{
type: 'text',
content: that.data.modeType == 3 ? `已解锁${that.data.clock.clock_days}个课时` : `已坚持${that.data.clock.clock_days}天`,
fontSize: 22,
color: '#7F7F7F',
textAlign: 'left',
top: 340,
left: 152
},
{ // 昵称
type: 'text',
content: nickname,
fontSize: 26,
color: '#000000',
textAlign: 'left',
top: 286,
left: 152
},
{
type: 'image',
url: 'https://cdn.img.shangjiadao.cn/source/images/dakav4/2c/common/detailposterheader.png',
top: 0,
left: 0,
width: 750,
height: 278
},
{
type: 'image',
url: qrcode,
top: canvasHeight - 180,
left: 100,
width: 156,
height: 156
}, { // 昵称
type: 'text',
content: '长按识别',
fontSize: 28,
color: '#000000',
textAlign: 'left',
top: canvasHeight - 124,
bolder: true,
left: 296
},
]
}
painting.views = painting.views.concat(imagesPaintArr).concat(audioPaintArr).concat(reciewPaintArr);
painting.views.push(contentPaintJson);
wx.hideLoading()
that.triggerEvent('drawpaint', painting)
}).catch(() =>{
wx.hideLoading()
})
});
},
getImagesInfo (images, callback) {
if (images.length == 0) {
callback&&callback(images);
}
this.getSingleImageinfo(images, callback);
},
getSingleImageinfo(images, callback) {
if (this.data.imageIndex == images.length) {
this.data.imageIndex = 0;
callback&&callback(images)
return
}
wx.showLoading({
title: '分享长图生成中...'
})
wxGetImageInfo({
src: imagify(images[this.data.imageIndex].src, 'image/resize,w_320/format,jpg/quality,q_50')
}).then((res) => {
images[this.data.imageIndex].width = 666;
images[this.data.imageIndex].height = Math.floor((666* res.height)/(res.width) );
this.data.imageIndex = this.data.imageIndex + 1;
this.getSingleImageinfo(images, callback)
}).catch(() => {
wx.hideLoading()
})
},
// 生成长图海报相关代码
},
}) })
\ No newline at end of file
...@@ -400,7 +400,7 @@ ...@@ -400,7 +400,7 @@
<button open-type="share" data-info="{{clock}}" class="share-button"></button> <button open-type="share" data-info="{{clock}}" class="share-button"></button>
</view> </view>
</view> </view>
<view class="operate-box-right" hover-class="none" hover-stop-propagation="false" bindtap="goTranaspond"> <view class="operate-box-right" hover-class="none" hover-stop-propagation="false" bindtap="generatelongimg">
<view class="btn share-btn" hover-class="none" hover-stop-propagation="false"> <view class="btn share-btn" hover-class="none" hover-stop-propagation="false">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform"> <form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button> <button form-type="submit" class="createidbutton">生成form</button>
...@@ -496,7 +496,7 @@ ...@@ -496,7 +496,7 @@
<image class="iconimg" src="{{imageRoot}}2c/common/assessicon.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix"></image> <image class="iconimg" src="{{imageRoot}}2c/common/assessicon.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix"></image>
<text class="btnname" selectable="false" space="false" decode="false" wx:if="{{clock.comments.total > 0}}">{{clock.comments.total}}</text> <text class="btnname" selectable="false" space="false" decode="false" wx:if="{{clock.comments.total > 0}}">{{clock.comments.total}}</text>
</view> </view>
<view class="btn assess-btn" hover-class="none" hover-stop-propagation="false" data-cid="{{clock.id}}" bindtap="goTranaspond"> <view class="btn assess-btn" hover-class="none" hover-stop-propagation="false" data-cid="{{clock.id}}" bindtap="generatelongimg">
<form report-submit="true" bindsubmit="formIdCreate" class="createidform"> <form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button> <button form-type="submit" class="createidbutton">生成form</button>
</form> </form>
......
...@@ -22,7 +22,7 @@ import { ...@@ -22,7 +22,7 @@ import {
import { import {
wxOpenLocation, wxOpenLocation,
wxNavigateToMiniProgram, wxNavigateToMiniProgram,
wxGetImageInfo wxPreviewImage
} from '../../../utilities/wxApi.js'; } from '../../../utilities/wxApi.js';
import { import {
formIdCreate, formIdCreate,
...@@ -168,7 +168,8 @@ Page({ ...@@ -168,7 +168,8 @@ Page({
name: '' name: ''
}, },
preScrollerToTop: 0, preScrollerToTop: 0,
nextScrollerToTop: 0 nextScrollerToTop: 0,
paintingType: ''
}, },
onLoad: function (options) { // Do some initialize when page load. onLoad: function (options) { // Do some initialize when page load.
// this.getWeeksDay(new Date()); // this.getWeeksDay(new Date());
...@@ -2308,19 +2309,28 @@ Page({ ...@@ -2308,19 +2309,28 @@ Page({
} = e; } = e;
wx.hideLoading(); wx.hideLoading();
if (detail.errMsg == 'canvasdrawer:ok') { if (detail.errMsg == 'canvasdrawer:ok') {
if (this.data.paintingType == 'longImg') {
wxPreviewImage({
current: e.detail.tempFilePath,
urls: [e.detail.tempFilePath]
})
} else {
this.setData({
canvasShow: false,
canvasImagePath: e.detail.tempFilePath,
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
}
this.setData({ this.setData({
canvasShow: false, painting: {},
canvasImagePath: e.detail.tempFilePath, paintingType: ''
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
this.setData({
painting: {}
}) })
} else { } else {
this.setData({ this.setData({
painting: {} painting: {},
paintingType: ''
}) })
wx.showToast({ wx.showToast({
title: '生成失败', title: '生成失败',
...@@ -2505,5 +2515,11 @@ Page({ ...@@ -2505,5 +2515,11 @@ Page({
this.setData({ this.setData({
"activeDay.isClock": false "activeDay.isClock": false
}) })
} },
drawpaint (e) {
this.setData({
painting: e.detail,
paintingType: 'longImg'
})
},
}) })
\ No newline at end of file
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
headerclick="{{true}}" bind:playvoice="playvoice" bind:pausevoice="pausevoice" headerclick="{{true}}" bind:playvoice="playvoice" bind:pausevoice="pausevoice"
bind:voiceslide="voiceslide" audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:voiceslide="voiceslide" audioStorage="{{audioStorage}}" bind:slidestart="slidestart"
bind:slideend="slideend" bind:videoplay="videoplay" bind:delEvaluate="selfDelEvaluate" bind:slideend="slideend" bind:videoplay="videoplay" bind:delEvaluate="selfDelEvaluate"
bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo" bind:delActiveDClock="delActiveDClock"> bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo" bind:delActiveDClock="delActiveDClock" bind:drawpaint="drawpaint">
</clock-item> </clock-item>
</view> </view>
<view class="sign-count-box" hover-class="none" hover-stop-propagation="false"> <view class="sign-count-box" hover-class="none" hover-stop-propagation="false">
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
bind:playvoice="playvoice" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide" bind:playvoice="playvoice" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide"
audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:slideend="slideend" audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:slideend="slideend"
bind:videoplay="videoplay" bind:delEvaluate="delEvaluate" bind:videoplay="videoplay" bind:delEvaluate="delEvaluate"
bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo"> bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo" bind:drawpaint="drawpaint">
</clock-item> </clock-item>
</view> </view>
<list-loading loading="{{clockGetting}}"></list-loading> <list-loading loading="{{clockGetting}}"></list-loading>
......
This diff is collapsed.
<wxs src="./../../../filter/index.wxs" module="filter" /> <wxs src="./../../../filter/index.wxs" module="filter" />
<view class="container"> <view class="container">
<view class="" bindtap="generatelongimg" hover-class="none" hover-stop-propagation="false">
生成长图
</view>
<view class="gohome" hover-class="none" hover-stop-propagation="false" bindtap="goindex"> <view class="gohome" hover-class="none" hover-stop-propagation="false" bindtap="goindex">
<image class="" src="{{imageRoot}}2c/common/home.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""> <image class="" src="{{imageRoot}}2c/common/home.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="">
</image> </image>
...@@ -10,13 +7,6 @@ ...@@ -10,13 +7,6 @@
班级 班级
</view> </view>
</view> </view>
<!-- <view class="ad-box" hover-class="none" hover-stop-propagation="false" wx:if="{{adInfo.status == 1 && adShow &&clock.school_id!=activtySchoolInfo.sid}}">
<image class="adimg" animation="{{attentionAnim}}" bindtap="toGetAd" src="{{imageRoot}}2c/circleindex/adimg.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
<image class="closeicon" bindtap="closeAd" src="{{imageRoot}}2c/common/closeicon.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
</view> -->
<!-- <view class="ad-box" hover-class="none" hover-stop-propagation="false" wx:if="{{clock.school_id==activtySchoolInfo.sid&&activtySchoolInfo.tid==tid&&!isReceived}}">
<image class="adimg" animation="{{attentionAnim}}" bindtap="showatvDailog" src="{{imageRoot}}2c/circleindex/adimg.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
</view> -->
<view class="clock-detail-container clearfix" wx:if="{{hasData}}"> <view class="clock-detail-container clearfix" wx:if="{{hasData}}">
<clock-item <clock-item
clock="{{clock}}" clock="{{clock}}"
...@@ -41,6 +31,7 @@ ...@@ -41,6 +31,7 @@
bind:playvideo="playvideo" bind:playvideo="playvideo"
bind:delEvaluate="delEvaluate" bind:delEvaluate="delEvaluate"
isactivityclock="{{clock.subject_id == activtySchoolInfo.tid}}" isactivityclock="{{clock.subject_id == activtySchoolInfo.tid}}"
bind:drawpaint="drawpaint"
> >
</clock-item> </clock-item>
<!-- <view class="submitbtn-box" hover-class="none" hover-stop-propagation="false"> <!-- <view class="submitbtn-box" hover-class="none" hover-stop-propagation="false">
...@@ -114,4 +105,5 @@ ...@@ -114,4 +105,5 @@
bind:closeposter="closeposter" bind:closeposter="closeposter"
> >
</poster-box> </poster-box>
<canvas id="myCanvas"></canvas>
</view> </view>
\ No newline at end of file
...@@ -19,7 +19,7 @@ import { ...@@ -19,7 +19,7 @@ import {
var app = getApp(); var app = getApp();
import { import {
wxOpenLocation, wxOpenLocation,
wxNavigateToMiniProgram wxPreviewImage
} from '../../../utilities/wxApi.js'; } from '../../../utilities/wxApi.js';
import { import {
sharePosteCanvas sharePosteCanvas
...@@ -52,6 +52,8 @@ import { ...@@ -52,6 +52,8 @@ import {
Page({ Page({
data: { data: {
painting: null,
paintingType: '',
id: 0, // 圈子ID id: 0, // 圈子ID
id2: 0, // 圈子ID复制 id2: 0, // 圈子ID复制
imageRoot: app.globalData.imageRoot, imageRoot: app.globalData.imageRoot,
...@@ -1272,5 +1274,46 @@ Page({ ...@@ -1272,5 +1274,46 @@ Page({
this.setData({ this.setData({
activityIsClock:e.detail activityIsClock:e.detail
}) })
} },
drawpaint (e) {
this.setData({
painting: e.detail,
paintingType: 'longImg'
})
},
eventGetImage(e) {
const {
detail
} = e;
wx.hideLoading();
if (detail.errMsg == 'canvasdrawer:ok') {
if (this.data.paintingType == 'longImg') {
wxPreviewImage({
current: e.detail.tempFilePath,
urls: [e.detail.tempFilePath]
})
} else {
this.setData({
canvasShow: false,
canvasImagePath: e.detail.tempFilePath,
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
}
this.setData({
painting: null,
paintingType: ''
})
} else {
this.setData({
painting: null,
paintingType: ''
})
wx.showToast({
title: '生成失败',
icon: 'none'
})
}
},
}) })
\ No newline at end of file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"comment-editor": "../../../components/commenteditor", "comment-editor": "../../../components/commenteditor",
"activity-bar":"../../../components/activitybar", "activity-bar":"../../../components/activitybar",
"scoregetfeedback": "../../../components/scoregetfeedback", "scoregetfeedback": "../../../components/scoregetfeedback",
"advertisement":"../../components/advertisement" "advertisement":"../../components/advertisement",
"canvasdrawer": "/components/canvasdrawer/canvasdrawer"
} }
} }
\ No newline at end of file
...@@ -302,6 +302,7 @@ ...@@ -302,6 +302,7 @@
bind:delEvaluate="delEvaluate" bind:delEvaluate="delEvaluate"
bind:showcommenteditor="showcommenteditor" bind:showcommenteditor="showcommenteditor"
isactivityclock="{{item.subject_id == activtySchoolInfo.tid}}" isactivityclock="{{item.subject_id == activtySchoolInfo.tid}}"
bind:drawpaint="drawpaint"
> >
</clock-item> </clock-item>
</view> </view>
...@@ -401,6 +402,7 @@ ...@@ -401,6 +402,7 @@
<view class="ad-img-box" hover-class="none" hover-stop-propagation="false" wx:if="{{sid==activtySchoolInfo.sid && bottombarLoaded}}" bindtap="goActivity"> <view class="ad-img-box" hover-class="none" hover-stop-propagation="false" wx:if="{{sid==activtySchoolInfo.sid && bottombarLoaded}}" bindtap="goActivity">
<image class="" src="{{imageRoot}}activityindex/{{activtySchoolInfo.name}}/bottombar.gif?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" ></image> <image class="" src="{{imageRoot}}activityindex/{{activtySchoolInfo.name}}/bottombar.gif?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" ></image>
</view> </view>
<canvasdrawer painting="{{painting}}" bind:getImage="eventGetImage" />
<scoregetfeedback <scoregetfeedback
sid="{{sid}}" sid="{{sid}}"
scoretype="{{scoreFeedBackStatus.scoretype}}" scoretype="{{scoreFeedBackStatus.scoretype}}"
......
...@@ -30,7 +30,8 @@ import { ...@@ -30,7 +30,8 @@ import {
import { import {
wxOpenLocation, wxOpenLocation,
wxNavigateToMiniProgram, wxNavigateToMiniProgram,
wxGetImageInfo wxGetImageInfo,
wxPreviewImage
} from '../../../utilities/wxApi.js'; } from '../../../utilities/wxApi.js';
import { import {
formIdCreate, formIdCreate,
...@@ -166,7 +167,8 @@ Page({ ...@@ -166,7 +167,8 @@ Page({
SEdialog:0, SEdialog:0,
allentrydialog:false, allentrydialog:false,
preScrollerToTop: 0, preScrollerToTop: 0,
nextScrollerToTop: 0 nextScrollerToTop: 0,
paintingType: ''
}, },
onLoad: function (options) { // Do some initialize when page load. onLoad: function (options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器 this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
...@@ -1454,19 +1456,28 @@ Page({ ...@@ -1454,19 +1456,28 @@ Page({
} = e; } = e;
wx.hideLoading(); wx.hideLoading();
if (detail.errMsg == 'canvasdrawer:ok') { if (detail.errMsg == 'canvasdrawer:ok') {
if (this.data.paintingType == 'longImg') {
wxPreviewImage({
current: e.detail.tempFilePath,
urls: [e.detail.tempFilePath]
})
} else {
this.setData({
canvasShow: false,
canvasImagePath: e.detail.tempFilePath,
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
}
this.setData({ this.setData({
canvasShow: false, painting: {},
canvasImagePath: e.detail.tempFilePath, paintingType: ''
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
this.setData({
painting: {}
}) })
} else { } else {
this.setData({ this.setData({
painting: {} painting: {},
paintingType: ''
}) })
wx.showToast({ wx.showToast({
title: '生成失败', title: '生成失败',
...@@ -2378,5 +2389,11 @@ Page({ ...@@ -2378,5 +2389,11 @@ Page({
this.setData({ this.setData({
allentrydialog:false allentrydialog:false
}) })
} },
drawpaint (e) {
this.setData({
painting: e.detail,
paintingType: 'longImg'
})
},
}) })
\ No newline at end of file
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
bind:pausevoice="pausevoice" bind:voiceslide="voiceslide" audioStorage="{{audioStorage}}" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide" audioStorage="{{audioStorage}}"
bind:slidestart="slidestart" bind:slideend="slideend" bind:videoplay="videoplay" bind:slidestart="slidestart" bind:slideend="slideend" bind:videoplay="videoplay"
bind:delEvaluate="selfDelEvaluate" bind:showcommenteditor="showcommenteditor" bind:delEvaluate="selfDelEvaluate" bind:showcommenteditor="showcommenteditor"
bind:playvideo="playvideo" modeType="{{3}}"> bind:playvideo="playvideo" modeType="{{3}}" bind:drawpaint="drawpaint">
</clock-item> </clock-item>
</view> </view>
</view> </view>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
bind:playvoice="playvoice" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide" bind:playvoice="playvoice" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide"
audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:slideend="slideend" audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:slideend="slideend"
bind:videoplay="videoplay" bind:delEvaluate="delEvaluate" modeType="{{3}}" bind:videoplay="videoplay" bind:delEvaluate="delEvaluate" modeType="{{3}}"
bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo"> bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo" bind:drawpaint="drawpaint">
</clock-item> </clock-item>
</view> </view>
<list-loading loading="{{clockGetting}}"></list-loading> <list-loading loading="{{clockGetting}}"></list-loading>
......
...@@ -3,8 +3,8 @@ import { ...@@ -3,8 +3,8 @@ import {
studentTasks studentTasks
} from '../../../service/customer/circleindex.js'; } from '../../../service/customer/circleindex.js';
import { import {
constants wxPreviewImage
} from '../../../constants/index.js'; } from '../../../utilities/wxApi.js';
import { import {
LocalStorage, LocalStorage,
audioorigin audioorigin
...@@ -853,5 +853,36 @@ Page({ ...@@ -853,5 +853,36 @@ Page({
taskExpanded: taskExpanded, taskExpanded: taskExpanded,
taskList: taskExpanded ? totalTaskList : totalTaskList.slice(0,3) taskList: taskExpanded ? totalTaskList : totalTaskList.slice(0,3)
}) })
} },
drawpaint (e) {
this.setData({
painting: e.detail,
paintingType: 'longImg'
})
},
eventGetImage(e) {
const {
detail
} = e;
wx.hideLoading();
if (detail.errMsg == 'canvasdrawer:ok') {
wxPreviewImage({
current: e.detail.tempFilePath,
urls: [e.detail.tempFilePath]
})
this.setData({
painting: null,
paintingType: ''
})
} else {
this.setData({
painting: null,
paintingType: ''
})
wx.showToast({
title: '生成失败',
icon: 'none'
})
}
},
}) })
\ No newline at end of file
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"comment-editor": "../../../components/commenteditor", "comment-editor": "../../../components/commenteditor",
"empty-content": "../../../components/emptycontent", "empty-content": "../../../components/emptycontent",
"list-loading": "../../../components/listloading", "list-loading": "../../../components/listloading",
"scoregetfeedback": "../../../components/scoregetfeedback" "scoregetfeedback": "../../../components/scoregetfeedback",
"canvasdrawer": "/components/canvasdrawer/canvasdrawer"
}, },
"navigationBarTitleText": "积分任务", "navigationBarTitleText": "积分任务",
"enablePullDownRefresh": true "enablePullDownRefresh": true
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
bind:playvoice="playvoice" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide" bind:playvoice="playvoice" bind:pausevoice="pausevoice" bind:voiceslide="voiceslide"
audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:slideend="slideend" audioStorage="{{audioStorage}}" bind:slidestart="slidestart" bind:slideend="slideend"
bind:videoplay="videoplay" bind:delEvaluate="delEvaluate" bind:videoplay="videoplay" bind:delEvaluate="delEvaluate"
bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo"> bind:showcommenteditor="showcommenteditor" bind:playvideo="playvideo" bind:drawpaint="drawpaint">
</clock-item> </clock-item>
</view> </view>
<list-loading loading="{{clockGetting}}"></list-loading> <list-loading loading="{{clockGetting}}"></list-loading>
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
<comment-editor wx:if="{{commenteditor}}" prams="{{commentclock}}" bind:hidecommenteditor="hidecommenteditor" <comment-editor wx:if="{{commenteditor}}" prams="{{commentclock}}" bind:hidecommenteditor="hidecommenteditor"
type="2c"></comment-editor> type="2c"></comment-editor>
</view> </view>
<canvasdrawer painting="{{painting}}" bind:getImage="eventGetImage" />
<scoregetfeedback <scoregetfeedback
sid="{{sid}}" sid="{{sid}}"
scoretype="{{scoreFeedBackStatus.scoretype}}" scoretype="{{scoreFeedBackStatus.scoretype}}"
......
...@@ -21,7 +21,8 @@ import { ...@@ -21,7 +21,8 @@ import {
import { import {
wxOpenLocation, wxOpenLocation,
wxNavigateToMiniProgram, wxNavigateToMiniProgram,
wxGetImageInfo wxGetImageInfo,
wxPreviewImage
} from '../../../utilities/wxApi.js'; } from '../../../utilities/wxApi.js';
import { import {
formIdCreate, formIdCreate,
...@@ -170,6 +171,7 @@ Page({ ...@@ -170,6 +171,7 @@ Page({
retract: false, retract: false,
preScrollerToTop: 0, preScrollerToTop: 0,
nextScrollerToTop: 0, nextScrollerToTop: 0,
paintingType: ''
}, },
onLoad: function (options) { // Do some initialize when page load. onLoad: function (options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器 this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
...@@ -1526,19 +1528,28 @@ Page({ ...@@ -1526,19 +1528,28 @@ Page({
} = e; } = e;
wx.hideLoading(); wx.hideLoading();
if (detail.errMsg == 'canvasdrawer:ok') { if (detail.errMsg == 'canvasdrawer:ok') {
if (this.data.paintingType == 'longImg') {
wxPreviewImage({
current: e.detail.tempFilePath,
urls: [e.detail.tempFilePath]
})
} else {
this.setData({
canvasShow: false,
canvasImagePath: e.detail.tempFilePath,
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
}
this.setData({ this.setData({
canvasShow: false, painting: null,
canvasImagePath: e.detail.tempFilePath, paintingType: ''
posterBoxShow: true,
qrcodeGenerating: false,
pagefrom: ''
})
this.setData({
painting: null
}) })
} else { } else {
this.setData({ this.setData({
painting: null painting: null,
paintingType: ''
}) })
wx.showToast({ wx.showToast({
title: '生成失败', title: '生成失败',
...@@ -2070,7 +2081,6 @@ Page({ ...@@ -2070,7 +2081,6 @@ Page({
}) })
return; return;
} }
console.log(res)
const imgInfo = this.caculateImagePosition({ const imgInfo = this.caculateImagePosition({
width: res.width, width: res.width,
height: res.height height: res.height
...@@ -2163,5 +2173,11 @@ Page({ ...@@ -2163,5 +2173,11 @@ Page({
posterImgLeft, posterImgLeft,
posterImgTop posterImgTop
} }
} },
drawpaint (e) {
this.setData({
painting: e.detail,
paintingType: 'longImg'
})
},
}) })
\ No newline at end of file
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
bind:showcommenteditor="showcommenteditor" bind:showcommenteditor="showcommenteditor"
bind:playvideo="playvideo" bind:playvideo="playvideo"
isactivityclock="{{tid == activtySchoolInfo.tid}}" isactivityclock="{{tid == activtySchoolInfo.tid}}"
bind:drawpaint="drawpaint"
> >
</clock-item> </clock-item>
</view> </view>
...@@ -188,6 +189,7 @@ ...@@ -188,6 +189,7 @@
bind:showcommenteditor="showcommenteditor" bind:showcommenteditor="showcommenteditor"
bind:playvideo="playvideo" bind:playvideo="playvideo"
isactivityclock="{{tid == activtySchoolInfo.tid}}" isactivityclock="{{tid == activtySchoolInfo.tid}}"
bind:drawpaint="drawpaint"
> >
</clock-item> </clock-item>
</view> </view>
......
...@@ -313,6 +313,16 @@ function getDateInfo(date) { ...@@ -313,6 +313,16 @@ function getDateInfo(date) {
minutes minutes
} }
} }
function voiceTimeFormat (time) {
console.log(time, 'timetimetime')
if (!time) return '00:00';
var zheng = Math.floor(time / 60);
var yu = time % 60
var minute = zheng < 10 ? '0' + zheng : zheng;
var second = yu < 10 ? '0' + yu : yu;
var _time = minute + ':' + second;
return _time;
}
export { export {
encode, encode,
decode, decode,
...@@ -332,5 +342,6 @@ export { ...@@ -332,5 +342,6 @@ export {
mediaTimeFormat, mediaTimeFormat,
getDailyMateria, getDailyMateria,
dateDetail, dateDetail,
getDateInfo getDateInfo,
voiceTimeFormat
} }
\ No newline at end of file
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