Commit 3c3a6827 authored by youjie's avatar youjie

no message

parent 8289c18d
...@@ -36,11 +36,6 @@ ...@@ -36,11 +36,6 @@
margin-bottom: 0; margin-bottom: 0;
} }
.sty-box { .sty-box {
// width: 750px;
// height: 1344px;
// position: fixed;
// top: -2000px;
// left: -1500px;
width: 500rpx; width: 500rpx;
height: 500rpx; height: 500rpx;
} }
...@@ -58,12 +53,12 @@ ...@@ -58,12 +53,12 @@
<text class="fz24">{{ list[current].TCNUMS }}</text> <text class="fz24">{{ list[current].TCNUMS }}</text>
</view> </view>
<view class="orcodeImg row items-center justify-center PX40"> <view class="orcodeImg row items-center justify-center PX40">
<swiper indicator-dots circular style="height:500rpx;width:500rpx" <swiper :indicator-dots="false" circular style="height:500rpx;width:500rpx"
:current="current" @change="changeHandler"> :current="current" @change="changeHandler">
<swiper-item v-for="(item, index) in list" :key="index"> <swiper-item v-for="(item, index) in list" :key="index">
<canvas canvas-id="TeamLeaderCanvas" class="sty-box" @error="canvasIdErrorCallback"> <canvas :canvas-id="`firstCanvas_${index}`" class="sty-box"
<image mode="aspectFit" :src="item.Url" /> @error="(e)=>canvasIdErrorCallback(e,index)"></canvas>
</canvas> <!-- <image mode="aspectFit" :src="item.Url" /> -->
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- <img :src="list[0].Url"/> --> <!-- <img :src="list[0].Url"/> -->
...@@ -74,6 +69,7 @@ ...@@ -74,6 +69,7 @@
<view class="flex1 PY20 text-center" @click="preservation">保存</view> <view class="flex1 PY20 text-center" @click="preservation">保存</view>
</view> </view>
</view> </view>
</u-popup> </u-popup>
</view> </view>
</template> </template>
...@@ -90,6 +86,7 @@ export default { ...@@ -90,6 +86,7 @@ export default {
interval: 2000, interval: 2000,
duration: 500, duration: 500,
BaseInfo: [], BaseInfo: [],
TCIDsList: []
} }
}, },
watch: { watch: {
...@@ -117,9 +114,9 @@ export default { ...@@ -117,9 +114,9 @@ export default {
}, (res) => { }, (res) => {
if (res.resultCode == 1) { if (res.resultCode == 1) {
this.BaseInfo = res.data.BaseInfo this.BaseInfo = res.data.BaseInfo
let TCIDs = this.TCIDs.split(',') this.TCIDsList = this.TCIDs.split(',')
TCIDs.forEach(x => { this.TCIDsList.forEach((x,index) => {
this.init(x) this.init(x,index)
}); });
} }
}) })
...@@ -135,7 +132,12 @@ export default { ...@@ -135,7 +132,12 @@ export default {
TCID:x, TCID:x,
TCNUMS:this.BaseInfo[findIndex].TCNUMS TCNUMS:this.BaseInfo[findIndex].TCNUMS
}) })
uni.hideLoading() if(this.list.length==this.TCIDsList.length) {
this.list.forEach((x,i)=>{
this.drawCtx(i)
})
}
// uni.hideLoading()
} }
}) })
}, },
...@@ -143,82 +145,117 @@ export default { ...@@ -143,82 +145,117 @@ export default {
this.currencyVisible = false this.currencyVisible = false
this.$emit('close') this.$emit('close')
}, },
drawCtx(i) {
// uni.showLoading({
// title: "正在生成",
// });
let ctx = uni.createCanvasContext(`firstCanvas_${i}`, this);
let that = this;
ctx.drawImage(that.list[i].Url, 0, 0, 250, 250); //绘制图
that.drawQrCode(ctx)
},
drawQrCode(ctx) {
let that = this;
setTimeout(() => {
ctx.draw(false, () => {
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: 750,
height: 1344,
destWidth: 750.0,
destHeight: 1344.0,
canvasId: "firstCanvas",
success: (res) => {
uni.hideLoading();
// that.tempPic = res.tempFilePath;
},
fail(e) {
uni.hideLoading();
console.log(e);
},
},
that
);
});
}, 200)
},
preservation(){ preservation(){
uni.showLoading({ uni.showLoading({
title: "正在生成", title: "正在生成",
}); });
let that = this; let that = this;
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: "TeamLeaderCanvas", canvasId: `firstCanvas_${that.current}`,
success: (res) => { success: (res) => {
uni.hideLoading(); uni.hideLoading();
uni.showLoading({ uni.showLoading({
title: "正在保存", title: "正在保存",
}); });
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath, filePath: res.tempFilePath,
success: function() { success: function() {
uni.showToast({ uni.showToast({
title: "保存成功", title: "保存成功",
}); });
}, },
fail: function(err) { fail: function(err) {
if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") { if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
uni.authorize({ uni.authorize({
scope: 'scope.writePhotosAlbum', scope: 'scope.writePhotosAlbum',
success: (res) => { success: (res) => {
console.log('11111');
}, },
fail: (res) => { fail: (res) => {
uni.showModal({ uni.showModal({
content: '检测到您没打开保存到相册权限,是否去设置打开?', content: '检测到您没打开保存到相册权限,是否去设置打开?',
confirmText: "确认", confirmText: "确认",
cancelText: '取消', cancelText: '取消',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
uni.openSetting({ uni.openSetting({
success: (res) => { success: (res) => {
console.log(res); console.log(res);
if (res.authSetting['scope.writePhotosAlbum']) { if (res.authSetting['scope.writePhotosAlbum']) {
that.preservation() that.preservation()
}
} }
}) }
} else { })
console.log('取消'); } else {
} console.log('取消');
} }
}) }
} })
}) }
} else { })
uni.showToast({ } else {
title: '保存失败,请稍后重试', uni.showToast({
icon: 'none', title: '保存失败,请稍后重试',
duration: 2000 icon: 'none',
}) duration: 2000
} })
}, }
complete: function() { },
uni.hideLoading(); complete: function() {
}, uni.hideLoading();
}); },
}, });
fail: function(e) { },
console.log(e); fail: function(e) {
uni.showToast({ console.log(e);
title: '生成失败,请稍后重试', uni.showToast({
icon: 'none', title: '生成失败,请稍后重试',
duration: 2000 icon: 'none',
}) duration: 2000
}, })
}, },
this },
); this
);
}, },
canvasIdErrorCallback: function(e) { canvasIdErrorCallback: function(e,index) {
console.error(e.detail.errMsg); console.error(e.detail.errMsg,'---index',index);
} }
} }
} }
......
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