Browse Source

草图生成格式换成png

laiguoran 5 years ago
parent
commit
2e0f6edfa7
3 changed files with 3 additions and 3 deletions
  1. 1 1
      app/controller/stage_controller.js
  2. 1 1
      app/public/js/stage.js
  3. 1 1
      app/public/js/stage_detail.js

+ 1 - 1
app/controller/stage_controller.js

@@ -592,7 +592,7 @@ module.exports = app => {
 
                 if (data.updateType === 'update') {
                     const create_time = Date.parse(new Date()) / 1000;
-                    const fileName = path.join('public/upload', this.ctx.tender.id.toString(), 'im', 'calcImg_' + create_time + '.jpg');
+                    const fileName = path.join('public/upload', this.ctx.tender.id.toString(), 'im', 'calcImg_' + create_time + '.png');
                     const base64Data = data.img.replace(/^data:image\/\w+;base64,/, "");
                     const dataBuffer = new Buffer(base64Data, 'base64');
                     await this.ctx.helper.saveBufferFile(dataBuffer, path.join(this.app.baseDir, 'app', fileName));

+ 1 - 1
app/public/js/stage.js

@@ -2360,7 +2360,7 @@ $(document).ready(() => {
                         updateData.unit = data.unit;
                         updateData.unit_price = data.unit_price;
                     }
-                    updateData.img = canvas.toDataURL('image/jpeg');
+                    updateData.img = canvas.toDataURL('image/png');
                     updateData.imgInfo = itemInfo;
                     postData(window.location.pathname + '/detail/merge-img', updateData, function (result) {
                         data.calc_img = result.calc_img;

+ 1 - 1
app/public/js/stage_detail.js

@@ -730,7 +730,7 @@ $(document).ready(() => {
                 updateData.unit = data.unit;
                 updateData.unit_price = data.unit_price;
             }
-            updateData.img = canvas.toDataURL('image/jpeg');
+            updateData.img = canvas.toDataURL('image/png');
             updateData.imgInfo = itemInfo;
             console.log(updateData);
             postData(window.location.pathname + '/merge-img', updateData, function (result) {