sharp-agezi 5 лет назад
Родитель
Сommit
1cd20d67e2

+ 1 - 1
customized/pages/boxMade/boxMade.js

@@ -140,7 +140,7 @@ Page({
     console.log('添加图片');
     wx.setStorageSync('box',this.data.box)
     wx.navigateTo({
-      url: '/customized/pages/boxMade/boxMadeImg/boxMadeImg?id=' + this.data.isActive,
+      url: '/customized/pages/boxMade/boxMadeImg/boxMadeImg?id=' + this.data.isActive+'&dataId='+this.data.dataId,
     })
   },
   addFontRouter() {

+ 22 - 20
customized/pages/boxMade/boxMadeImg/boxMadeImg.js

@@ -31,9 +31,10 @@ Page({
       scale: 1, // 图片宽高比例
       angle: 0, // 旋转度数
     },
-    box:{},
-    fontTouch:{},//文字对象
-    fontAnimationData:{},
+    dataId: [],
+    box: {},
+    fontTouch: {}, //文字对象
+    fontAnimationData: {},
   },
 
   /**
@@ -62,11 +63,12 @@ Page({
       } else {
         that.setData({
           'imgTouch.isActive': options.id,
+          dataId: options.dataId.split(','),
           dataPositionObj: cupNum.dataPositionObj,
           propSize: cupNum.propSize
         });
       }
-      
+
 
 
     }
@@ -80,7 +82,7 @@ Page({
     that.setData({
       host: host,
     })
-    
+
   },
 
   /**
@@ -89,7 +91,7 @@ Page({
   onShow: function () {
     let that = this;
     that.setData({
-      box:wx.getStorageSync('box'),
+      box: wx.getStorageSync('box'),
       obverseImgObject: util.changeImg
     })
     that.getImgList();
@@ -130,16 +132,16 @@ Page({
   onShareAppMessage: function () {
 
   },
-  touchstart(e){
+  touchstart(e) {
     this.fontTouchstart(e)
   },
-  touchmove(e){
+  touchmove(e) {
     this.fontTouchmove(e)
   },
   // touch 事件
   fontTouchstart(e) {
     //1.获取鼠标点击下去的
-    
+
     this.setData({
       "imgTouch.clientX": e.touches[0].clientX - this.data.imgTouch.x,
       "imgTouch.clientY": e.touches[0].clientY - this.data.imgTouch.y
@@ -187,8 +189,8 @@ Page({
     wx.request({
       url: host + '/queryImgListByPlaceIdAndGoodsId',
       data: {
-        customGoodsId: 6, // 商品id,白色箱子是6
-        customGoodsImgPlaceId: that.data.imgTouch.isActive * 1 - 4
+        customGoodsId: wx.getStorageSync('detail').id, // 商品id,白色箱子是6
+        customGoodsImgPlaceId: that.data.dataId[0] == that.data.imgTouch.isActive ? 1 : 2, // that.data.dataId[0] 是正面,1是背面
       },
       type: 'get',
       success(res) {
@@ -282,15 +284,15 @@ Page({
   },
   getDataTouch(that) {
     let madeTouchFont = wx.getStorageSync('madeCupFontData' + that.data.imgTouch.isActive)
-    console.log(madeTouchFont,"madeTouchFont")
+    console.log(madeTouchFont, "madeTouchFont")
     if (madeTouchFont) {
-      console.log(that.fontAnimation,"that.fontAnimation")
-        that.fontAnimation.rotate(madeTouchFont.angle).step();
-        that.setData({
-          fontAnimationData: that.fontAnimation.export(),
-          fontTouch: madeTouchFont ? madeTouchFont : {},
-          madeStatic: true,
-        })
-    } 
+      console.log(that.fontAnimation, "that.fontAnimation")
+      that.fontAnimation.rotate(madeTouchFont.angle).step();
+      that.setData({
+        fontAnimationData: that.fontAnimation.export(),
+        fontTouch: madeTouchFont ? madeTouchFont : {},
+        madeStatic: true,
+      })
+    }
   },
 })

+ 2 - 2
customized/pages/oneMade/oneMadeImg/oneMadeImg.js

@@ -187,8 +187,8 @@ Page({
     wx.request({
       url: host + '/queryImgListByPlaceIdAndGoodsId',
       data: {
-        customGoodsId: 6, // 商品id,白色箱子是6
-        customGoodsImgPlaceId: that.data.imgTouch.isActive * 1 - 4
+        customGoodsId: wx.getStorageSync('detail').id,
+        customGoodsImgPlaceId: 1,//表示正面
       },
       type: 'get',
       success(res) {

+ 37 - 28
utils/util.js

@@ -18,7 +18,8 @@ function formatNumber(n) {
 
 function changeCup(e) {
   // e== 1正面,2背面,3手柄,4杯底
-  let dataPositionObj = null, propSize = null;
+  let dataPositionObj = null,
+    propSize = null;
   switch (e) {
     case '1':
       // console.log('正面')
@@ -139,7 +140,7 @@ function changeCup(e) {
       };
       break;
     case '9': //黑色T恤
-      dataPositionObj = { 
+      dataPositionObj = {
         top: 254,
         left: 204,
         width: 368,
@@ -203,36 +204,44 @@ function changeCup(e) {
     dataPositionObj: dataPositionObj,
     propSize: propSize
   }
-  
 
+
+}
+let uploadLocation = {
+  '1': '正面',
+  '2': '反面',
+  '3': '左侧',
+  '4': '右侧',
+  '5': '顶部',
+  '6': '底部'
 }
 let url = 'https://dlz.info666.com';
-let changeImg={
-  '5': url+'/temp/box_silvery1.png',//银色箱子正面
-  '5_1': url +'/temp/box_silvery1_1.png', //银色箱子正面镂空
-  '5_2': url +'/temp/box_silvery1_2.png', //银色箱子正面
-  '6': url +'/temp/box_silvery2.png',//银色箱子反面
-  '6_1': url +'/temp/box_silvery2_1.png', //银色箱子镂空
-  '6_2': url +'/temp/box_silvery2_2.png', //银色箱子
-  '7': url +'/temp/box_white1.png',//白色箱子正面
-  '7_1': url +'/temp/box_white1_1.png', //白色箱子正面有颜色镂空
-  '7_2': url +'/temp/box_white1_2.png', //白色箱子正面镂空无颜色
-  '8': url +'/temp/box_white2.png',//白色箱子反面
-  '8_1': url +'/temp/box_white2_1.png', //白色箱子镂空
-  '8_2': url +'/temp/box_white2_2.png', //白色箱子镂空无颜色
+let changeImg = {
+  '5': url + '/temp/box_silvery1.png', //银色箱子正面
+  '5_1': url + '/temp/box_silvery1_1.png', //银色箱子正面镂空
+  '5_2': url + '/temp/box_silvery1_2.png', //银色箱子正面
+  '6': url + '/temp/box_silvery2.png', //银色箱子反面
+  '6_1': url + '/temp/box_silvery2_1.png', //银色箱子镂空
+  '6_2': url + '/temp/box_silvery2_2.png', //银色箱子
+  '7': url + '/temp/box_white1.png', //白色箱子正面
+  '7_1': url + '/temp/box_white1_1.png', //白色箱子正面有颜色镂空
+  '7_2': url + '/temp/box_white1_2.png', //白色箱子正面镂空无颜色
+  '8': url + '/temp/box_white2.png', //白色箱子反面
+  '8_1': url + '/temp/box_white2_1.png', //白色箱子镂空
+  '8_2': url + '/temp/box_white2_2.png', //白色箱子镂空无颜色
 
-  '9': url +'/temp/shirt1.png',//黑色T恤
-  '9_1': url +'/temp/shirt1_1.png', //黑色T恤镂空
-  '9_2': url +'/temp/shirt1_2.png', //黑色T恤
-  '10': url +'/temp/shirt2.png',//红色T恤
-  '10_1': url +'//temp/shirt2_1.png',//红色T恤镂空
-  '10_2': url +'/temp/shirt2_2.png',//红色T恤
-  '11': url +'/temp/cup1.png',//白色杯子
-  '11_1': url +'/temp/cup1_1.png',//白色杯子镂空
-  '11_2': url +'/temp/cup1_2.png',//白色杯子
-  '12': url +'/temp/cup2.png',//黑色杯子
-  '12_1': url +'/temp/cup2_1.png',//黑色杯子镂空
-  '12_2': url +'/temp/cup2_2.png',//黑色杯子
+  '9': url + '/temp/shirt1.png', //黑色T恤
+  '9_1': url + '/temp/shirt1_1.png', //黑色T恤镂空
+  '9_2': url + '/temp/shirt1_2.png', //黑色T恤
+  '10': url + '/temp/shirt2.png', //红色T恤
+  '10_1': url + '//temp/shirt2_1.png', //红色T恤镂空
+  '10_2': url + '/temp/shirt2_2.png', //红色T恤
+  '11': url + '/temp/cup1.png', //白色杯子
+  '11_1': url + '/temp/cup1_1.png', //白色杯子镂空
+  '11_2': url + '/temp/cup1_2.png', //白色杯子
+  '12': url + '/temp/cup2.png', //黑色杯子
+  '12_1': url + '/temp/cup2_1.png', //黑色杯子镂空
+  '12_2': url + '/temp/cup2_2.png', //黑色杯子
 }