|
|
|
|
@ -540,6 +540,7 @@
|
|
|
|
|
</scroll-view>
|
|
|
|
|
</div>
|
|
|
|
|
</u-popup>
|
|
|
|
|
<canvas type="2d" style="position: absolute; left: -2000px; width: 425px; height: 350px; background: #fff" id="canvasId" ref="canvasId"></canvas>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -552,7 +553,27 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
this.attention = false;
|
|
|
|
|
return this.G.shareFun("/root/detail/job?id=" + this.jobDetail.id, "", this.jobDetail.jobName + " " + this.jobDetail.priceStr + " " + "好厂好工作 火热招聘中");
|
|
|
|
|
// return this.G.shareFun("/root/detail/job?id=" + this.jobDetail.id,
|
|
|
|
|
// "", this.jobDetail.jobName + " " + this.jobDetail.priceStr + " " + "好厂好工作 火热招聘中");
|
|
|
|
|
let that = this;
|
|
|
|
|
let path;
|
|
|
|
|
if (this.isMember) {
|
|
|
|
|
path = `/root/detail/job?id=${that.jobDetail.id}&from=home&userId=${that.userInfo.user.id}`;
|
|
|
|
|
} else {
|
|
|
|
|
path = `/root/detail/job?id=${that.jobDetail.id}&from=home`;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
promise: new Promise((resolve, reject) => {
|
|
|
|
|
that.getWXCanvas("", "setShare").then((res) => {
|
|
|
|
|
wx.hideLoading();
|
|
|
|
|
resolve({
|
|
|
|
|
title: " ",
|
|
|
|
|
imageUrl: res.tempFilePath,
|
|
|
|
|
path,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
var obj = dateTimePicker.dateTimePicker(this.startYear, this.endYear, this.currentTime);
|
|
|
|
|
@ -1274,6 +1295,143 @@ export default {
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 微信端绘制
|
|
|
|
|
getWXCanvas(sharelImg, type) {
|
|
|
|
|
const that = this;
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
var mycenter = 0; //文字左右居中显示
|
|
|
|
|
var myheight = 0; //文字高度
|
|
|
|
|
const query = uni.createSelectorQuery().in(this);
|
|
|
|
|
query
|
|
|
|
|
.select("#canvasId")
|
|
|
|
|
.fields({
|
|
|
|
|
node: true,
|
|
|
|
|
size: true,
|
|
|
|
|
})
|
|
|
|
|
.exec((res) => {
|
|
|
|
|
console.log("uni 获取节点信息:", res);
|
|
|
|
|
const canvas = res[0].node;
|
|
|
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
|
that.setShareCover(ctx, canvas, mycenter).then((canvas) => {
|
|
|
|
|
uni.canvasToTempFilePath({
|
|
|
|
|
canvas: canvas,
|
|
|
|
|
success(res) {
|
|
|
|
|
resolve(res);
|
|
|
|
|
},
|
|
|
|
|
fail(res) {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.errMsg,
|
|
|
|
|
icon: "error",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生成分享小程序的封面
|
|
|
|
|
*/
|
|
|
|
|
setShareCover(ctx, canvas, mycenter) {
|
|
|
|
|
let that = this;
|
|
|
|
|
canvas.width = 750;
|
|
|
|
|
canvas.height = 600;
|
|
|
|
|
mycenter = canvas.width / 2;
|
|
|
|
|
let labelLeft = 0;
|
|
|
|
|
let baseLeft, logoSize, titleFontSize, mainFontSize, line1, line2, line3, line4, line5, line6, line7, line8;
|
|
|
|
|
baseLeft = 24; // 左侧基准线
|
|
|
|
|
logoSize = 132; // logo尺寸
|
|
|
|
|
mainFontSize = 36; // 内容字体大小
|
|
|
|
|
titleFontSize = 56; // 标题字体大小
|
|
|
|
|
line1 = 68; // 第一行距顶部距离
|
|
|
|
|
line2 = 90;
|
|
|
|
|
line3 = 200;
|
|
|
|
|
line4 = 280;
|
|
|
|
|
line5 = 350;
|
|
|
|
|
line6 = 380;
|
|
|
|
|
line7 = 460;
|
|
|
|
|
|
|
|
|
|
// 绘制基础白色背景
|
|
|
|
|
console.log("that.jobDetail", that.jobDetail);
|
|
|
|
|
that.G.roundRect1(ctx, 0, 0, 750, 600, 0, "#fff");
|
|
|
|
|
return new Promise(function (imgres) {
|
|
|
|
|
// 岗位标题
|
|
|
|
|
that.G.fillTextLineBreak(ctx, that.jobDetail.jobName, baseLeft, line2, 800, 20, "#000", titleFontSize, "500", "left");
|
|
|
|
|
// 月工资
|
|
|
|
|
that.G.fillTextLineBreak(ctx, that.jobDetail.monthPay, 750 - ctx.measureText(that.jobDetail.monthPay).width + 20, line3 + 6, 400, 20, "#ff4400", titleFontSize, "400");
|
|
|
|
|
// 时薪
|
|
|
|
|
that.G.fillTextLineBreak(ctx, that.G.getSalaryClassifyValue(that.jobDetail.salaryClassify, that.jobDetail.salaryClassifyValue), baseLeft, line3, 400, 40, "#ff4400", titleFontSize + 6, "600", "left");
|
|
|
|
|
|
|
|
|
|
if (that.jobDetail.jobRequestLabelNames.length > 0) {
|
|
|
|
|
that.jobDetail.jobRequestLabelNames.forEach((item1, index) => {
|
|
|
|
|
if (index <= 3) {
|
|
|
|
|
that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 80, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符
|
|
|
|
|
// that.G.roundRect1(ctx, baseLeft + labelLeft, line4 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
|
|
|
|
|
labelLeft += ctx.measureText(item1).width + 32;
|
|
|
|
|
if (index == 3) {
|
|
|
|
|
labelLeft = 0;
|
|
|
|
|
}
|
|
|
|
|
} else if (index > 3 && index <= 6) {
|
|
|
|
|
// that.G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
|
|
|
|
|
that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 80, line5 + 4, 400, 40, "#666", mainFontSize); // 标签字符
|
|
|
|
|
labelLeft += ctx.measureText(item1).width + 32;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (that.jobDetail.jobSpecialLabelNames.length > 0) {
|
|
|
|
|
that.jobDetail.jobSpecialLabelNames.forEach((item1, index) => {
|
|
|
|
|
if (index <= 3) {
|
|
|
|
|
that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 80, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符
|
|
|
|
|
// that.G.roundRect1(ctx, baseLeft + labelLeft, line4 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
|
|
|
|
|
labelLeft += ctx.measureText(item1).width + 32;
|
|
|
|
|
if (index == 3) {
|
|
|
|
|
labelLeft = 0;
|
|
|
|
|
}
|
|
|
|
|
} else if (index > 3 && index <= 6) {
|
|
|
|
|
// that.G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
|
|
|
|
|
that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 80, line5 + 4, 400, 40, "#666", mainFontSize); // 标签字符
|
|
|
|
|
labelLeft += ctx.measureText(item1).width + 32;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 根据标签数量调整宣传标语位置
|
|
|
|
|
that.G.roundRect1(ctx, mycenter - 712 / 2, line6, 712, 60, 4, "#fff6e8"); // 宣传标语背景
|
|
|
|
|
// 绘制立即咨询
|
|
|
|
|
// 根据标签数量调整立即咨询背景位置
|
|
|
|
|
that.G.roundRect1(ctx, mycenter - 712 / 2, line7, 712, 100, 4, "#3b80fa"); // 立即咨询背景
|
|
|
|
|
// 根据标签数量调整立即咨询位置
|
|
|
|
|
that.G.fillTextLineBreak(ctx, "立即咨询", mycenter - 24 - ctx.measureText("立即咨询").width / 2 + 100, line7 + 65, 300, 120, "#fff", titleFontSize, "500"); // 立即咨询
|
|
|
|
|
// 绘制职位logo
|
|
|
|
|
uni.downloadFile({
|
|
|
|
|
url: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/pugongying/goxj2-qpwbo.png",
|
|
|
|
|
success(res) {
|
|
|
|
|
console.log("duihao", res);
|
|
|
|
|
const img1 = canvas.createImage();
|
|
|
|
|
img1.src = res.tempFilePath;
|
|
|
|
|
console.log("img info img", img1);
|
|
|
|
|
img1.onload = (info) => {
|
|
|
|
|
console.log("img info", info);
|
|
|
|
|
let safeMarkPosition = 44;
|
|
|
|
|
// 宣传标语
|
|
|
|
|
["安全保障", "工资保障", "补贴保障"].forEach((item1, index) => {
|
|
|
|
|
// 根据标签数量调整安全标识位置
|
|
|
|
|
that.G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition + 70, line6 + 40, 100, 32, "#fca025");
|
|
|
|
|
that.G.roundRect(ctx, img1, baseLeft + safeMarkPosition - 36, line6 + 12, 32, 32, 12);
|
|
|
|
|
safeMarkPosition += 130 + ctx.measureText(item1).width;
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
imgres(canvas);
|
|
|
|
|
}, 200);
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
fail(err) {
|
|
|
|
|
console.log("downloadFile err", err);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
console.log("all err", err);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|