Commit 7d894fcd authored by lvtz's avatar lvtz

fix rich-text

parents 74e497ed 6a66ec5a
......@@ -1643,7 +1643,7 @@ Page({
},
goTaggedpicture(){
const imgString = JSON.stringify(this.data.commentDetail.filterImage.map((item)=>{return item.src}));
const imgInfoList = JSON.stringify(this.data.imgInfoList)
const imgInfoList = JSON.stringify(this.data.imgInfoList);
wx.navigateTo({
url: `/business/pages/commenteditor/taggedpicture?sid=${this.data.sid}&imgString=${imgString}&imgInfoList=${imgInfoList}`,
})
......@@ -1654,7 +1654,8 @@ Page({
this.data.imgInfoList = new Array(imgUrls.length);
const maxImgHeight = this.data.windowHeight - 180;
for(let i=0; i<imgUrls.length; i++){
const url = imagify(imgUrls[i], 'image/resize,w_400/format,jpg/quality,q_50');
// const url = imagify(imgUrls[i], 'image/resize,w_800/format,jpg/quality,q_50');
const url = imagify(imgUrls[i]);
wxGetImageInfo({src:url}).then((res)=>{
let imageWidth ='';
let imageHeight = '';
......
......@@ -12,7 +12,6 @@ import {
import {
bOssAccess, cOssAccess,
} from '../../../service/common.js';
var app = getApp();
Page({
......@@ -69,6 +68,7 @@ Page({
imgArr: thisImgs,
imgInfoList: thisImgInfoList
})
console.log(this.data.imgInfoList, 'imgInfoList');
this.data.initImgArr = JSON.parse(JSON.stringify(thisImgs));
this.data.initImgInfoList = JSON.parse(JSON.stringify(thisImgInfoList));
this.getImgInfo();
......@@ -151,7 +151,7 @@ Page({
},
doodleStart(e) {
this.lineWidth = 3;
this.lineWidth = 2;
this.lineColor = this.data.colors[this.data.ActColorIndex];
this.doodleStartX = e.touches[0].x
this.doodleStartY = e.touches[0].y
......@@ -185,7 +185,7 @@ Page({
{
x,
y,
lineWidth: 3,
lineWidth: 2,
color: this.lineColor,
}
)
......@@ -235,9 +235,11 @@ Page({
getImgInfo(){
const { imgArr, AcSubIndex, imgInfoList } = this.data;
const that = this;
let url = imagify(imgArr[AcSubIndex], 'image/resize,w_400/format,jpg/quality,q_50');
// let url = imagify(imgArr[AcSubIndex], 'image/resize,w_400/format,jpg/quality,q_50');
let url = imagify(imgArr[AcSubIndex]);
const maxImgHeight = this.data.windowHeight - 180;
// let url = imgArr[AcSubIndex];
console.log(this.data.imgInfoList, 'imgInfoList');
if(imgInfoList[AcSubIndex] && imgInfoList[AcSubIndex].actTemPath) {
return;
}
......@@ -314,11 +316,18 @@ Page({
wx.canvasToTempFilePath({
x: 0,
y: 0,
// width: imgInfoList[AcSubIndex].imageWidth,
// height: imgInfoList[AcSubIndex].imageHeight,
// destWidth: imgInfoList[AcSubIndex].imageWidth,
// destHeight: imgInfoList[AcSubIndex].imageHeight,
// canvasId: 'myCanvas',
width: imgInfoList[AcSubIndex].imageWidth,
height: imgInfoList[AcSubIndex].imageHeight,
destWidth: imgInfoList[AcSubIndex].imageWidth,
destHeight: imgInfoList[AcSubIndex].imageHeight,
canvasId: 'myCanvas',
fileType: 'jpg',
quality: 1,
success(res) {
const tempFilePath = res.tempFilePath;
that.setData({
......@@ -425,23 +434,25 @@ Page({
return
}
var ctx = wx.createCanvasContext('tempCanvas');
ctx.clearRect(0,0,750, imgInfoList[AcSubIndex].imageHeight);
ctx.drawImage(imgInfoList[AcSubIndex].actTemPath, 0, 0, imgInfoList[AcSubIndex].imageWidth*2, imgInfoList[AcSubIndex].imageHeight*2);
// ctx.clearRect(0,0,750, imgInfoList[AcSubIndex].imageHeight);
ctx.clearRect(0,0,imgInfoList[AcSubIndex].imageWidth * 4, imgInfoList[AcSubIndex].imageHeight * 4);
ctx.drawImage(imgInfoList[AcSubIndex].actTemPath, 0, 0, imgInfoList[AcSubIndex].imageWidth*4, imgInfoList[AcSubIndex].imageHeight*4);
// ctx.drawImage(imgInfoList[AcSubIndex].actTemPath, 0, 0, imgInfoList[AcSubIndex].imageWidth, imgInfoList[AcSubIndex].imageHeight);
ctx.draw(true);
// 线条
for (var i = 0; i < sourceArr.length; i++) {
this.phArr(sourceArr[i], ctx,2)
this.phArr(sourceArr[i], ctx,4)
}
// 文字
for (var i = 0; i < textArr.length; i++) {
this.textWrap({
x: textArr[i].data.left*2,
y: textArr[i].data.top*2,
width: 400,
height: 30*1.5,
x: textArr[i].data.left*4,
y: textArr[i].data.top*4,
width: 200 * 4,
height: 14*4,
line: 10,
color: '#FA5251',
size: 24*1.5,
size: 14*4,
align: 'left',
baseline: 'top',
text: textArr[i].value,
......@@ -563,11 +574,17 @@ Page({
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: imgInfoList[AcSubIndex].imageWidth*2,
height: imgInfoList[AcSubIndex].imageHeight*2,
destWidth: imgInfoList[AcSubIndex].imageWidth*2,
destHeight: imgInfoList[AcSubIndex].imageHeight*2,
width: imgInfoList[AcSubIndex].imageWidth*4,
height: imgInfoList[AcSubIndex].imageHeight*4,
destWidth: imgInfoList[AcSubIndex].imageWidth*4,
destHeight: imgInfoList[AcSubIndex].imageHeight*4,
// width: imgInfoList[AcSubIndex].imageWidth,
// height: imgInfoList[AcSubIndex].imageHeight,
// destWidth: imgInfoList[AcSubIndex].imageWidth,
// destHeight: imgInfoList[AcSubIndex].imageHeight,
canvasId: 'tempCanvas',
fileType: 'jpg',
quality: 1,
success(res) {
const tempFilePath = res.tempFilePath;
that.ctx.clearRect(0,0,750, imgInfoList[AcSubIndex].imageHeight);
......
......@@ -21,7 +21,7 @@
<view class="content-box">
<view class="img-wrapper" style="width: {{imgInfoList[AcSubIndex].imageWidth}}px; height:{{imgInfoList[AcSubIndex].imageHeight}}px">
<image class="myimg" src="{{myimg}}" wx:if="{{shortCanvas && myimg}}" style="height:{{imgInfoList[AcSubIndex].imageHeight}}px" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
<image class="cur-img" src="{{imgInfoList[AcSubIndex].isDraw ? imgArr[AcSubIndex] : filter.imagify(imgArr[AcSubIndex])}}" style="height:{{imgInfoList[AcSubIndex].imageHeight}}px" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
<image class="cur-img" src="{{imgInfoList[AcSubIndex].isDraw ? imgArr[AcSubIndex] : filter.imagify(imgArr[AcSubIndex], 'image/resize,w_750/format,jpg')}}" style="height:{{imgInfoList[AcSubIndex].imageHeight}}px" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" />
<canvas class="myCanvas {{shortCanvas? 'shortCanvas': ''}}" canvas-id="myCanvas" disable-scroll="true" bindtouchstart="doodleStart" bindtouchend="doodleEnd" bindtouchmove="doodleMove" style="width: {{imgInfoList[AcSubIndex].imageWidth}}px; height:{{imgInfoList[AcSubIndex].imageHeight}}px"></canvas>
<block wx:if="{{textArr.length>0}}">
<view class="text-box" animation="{{animationData}}" bindtouchstart="textMoveStart" bindtouchmove="textMove" bindtouchend="textMoveEnd" wx:for="{{textArr}}" data-index="{{index}}" wx:key="index" style="left: {{item.data.left}}px; top: {{item.data.top}}px"><view class="close" bindtap="deleteText"><image class="" src="{{imageRoot}}2b/comment/icon_cancal.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" /></view>{{item.value}}</view>
......@@ -47,4 +47,6 @@
</view>
</view>
<canvas canvas-id="tempCanvas" disable-scroll="true" style="width:200%; height:{{imgInfoList[AcSubIndex].imageHeight*2}}px; position:absolute;left:-999999px"></canvas>
\ No newline at end of file
<!-- <canvas canvas-id="tempCanvas" disable-scroll="true" style="width:200%; height:{{imgInfoList[AcSubIndex].imageHeight*2}}px; position:absolute;left:-999999px"></canvas> -->
<canvas canvas-id="tempCanvas" disable-scroll="true" style="width: {{imgInfoList[AcSubIndex].imageWidth * 4}}px; height:{{imgInfoList[AcSubIndex].imageHeight * 4}}px; position:absolute;left:-999999px"></canvas>
<!-- style="width: {{imgInfoList[AcSubIndex].imageWidth}}px; height:{{imgInfoList[AcSubIndex].imageHeight}}px" -->
\ No newline at end of file
......@@ -27,7 +27,7 @@
font-family:PingFang SC;
font-weight:500;
color:rgba(3,202,241,1);
padding-left: 24rpx;
padding: 12rpx 24rpx;
}
.header-box .title .text{
font-size:30rpx;
......@@ -112,20 +112,22 @@
top: 0;
}
.content-box .img-wrapper .text-box{
max-width: 400rpx;
/* max-width: 400rpx; */
max-width: 200px;
height: auto;
word-break: break-all;
padding: 0 6rpx;
display: inline-block;
box-shadow:0px 0px 10px 0px rgba(0, 0, 0, 0.2);
font-size:30rpx;
font-size: 14px;
/* font-size:30rpx; */
font-family:PingFang SC;
font-weight:500;
color: rgba(250,82,81,1);
position: absolute;
left: 100rpx;
top: 100rpx;
z-index: 100;
z-index: 104;
line-height: 30rpx;
/* overflow: auto; */
/* padding-top: 18rpx;
......@@ -273,7 +275,7 @@
position: fixed;
left: 0;
top: 0;
z-index: 100;
z-index: 109;
}
.input-wrapper .sure-btn{
width:100rpx;
......
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