Prechádzať zdrojové kódy

产品设计展示完成

wangyong 6 rokov pred
rodič
commit
ae2c7e5062

+ 0 - 2
app.js

@@ -3,11 +3,9 @@ App({
   data: {
     deviceInfo: {}
   },
-
   onLaunch: function () {
     var that = this;
     that.data.deviceInfo = wx.getSystemInfoSync();
-
     //调用API从本地缓存中获取数据
     var logs = wx.getStorageSync('logs') || []
     logs.unshift(Date.now());

+ 102 - 94
customized/pages/made/made.js

@@ -1,4 +1,5 @@
 // pages/customized/made/made.js
+import * as util from '../../../utils/util.js'
 Page({
 
   /**
@@ -24,33 +25,67 @@ Page({
       '3': '/customized/images/customized/cup_black_handle.png',/*手柄 */
       '4': '/customized/images/customized/cup_black_bottom.png',/*底部 */
     },
-    fontColor: ['#000', '#fff', '#e70012', '#ff8500', '#fff100', '#22ad38', '#00b7f0','#920784']
+    fontColor: ['#000', '#fff', '#e70012', '#ff8500', '#fff100', '#22ad38', '#00b7f0','#920784'],
     // obverseImg: '/images/customized/cup_black_big.png',/*正面 */
+    imgTouch:{}, // 图片的对象,分为正面,侧面,手柄,底部
+    fontTouch: {}, //文字的对象,分为正面,侧面,手柄,底部
+    imgAnimationData:{}, // 图片的旋转
+    fontAnimationData: {}, // 文字的旋转
+    touchStatic:true,
+    fontContent:'可定制区域',
+    rpx:1, // 获取页面的rpx
+
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    this.changeCupImg(this.data.isActive);
+    let that = this;
+    wx.getSystemInfo({
+      success: function (res) {
+        let rpx = res.windowWidth / 750;
+        that.setData({
+          rpx: rpx
+        });
+        console.log(rpx, 'rpx')
+      },
+    })
+    if('id' in options){
+      this.setData({
+        isActive: options.id
+      })
+    }
+   
+    
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
-    // console.log('页面开始准备中')
-    
-  
-    const ctx = wx.createCanvasContext('madeBox');
-    // Canvas.SetLeft(ctx, '10rpx'); 
+    let that = this;
+    // console.log('页面开始准备中'
+    that.imgAnimation = wx.createAnimation({
+      timingFunction: 'step-start', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
+    })
+    that.fontAnimation = wx.createAnimation({
+      timingFunction: 'step-start', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
+    })
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    console.log('onshow')
+    let that = this;
+    let cupNum = util.changeCup(that.data.isActive);
+    that.setData({
+      dataPositionObj: cupNum.dataPositionObj,
+      propSize: cupNum.propSize
+    })
+    that.getDataTouch(that)
   },
 
   /**
@@ -87,97 +122,70 @@ Page({
   onShareAppMessage: function () {
 
   },
-  changeCupImg(index){
-    let canvasBg = this.data.obverseImgObject[index];
-    wx.getSystemInfo({
-      success: function (res) {
-        let rpx = res.windowWidth / 750;
-        const ctx = wx.createCanvasContext('madeContent');
-        ctx.drawImage(canvasBg, 0, 0, 750 * rpx, 588 * rpx)
-        ctx.draw()
-      },
-    })
-  },
+  // changeCupImg(index){
+  //   console.log(this.data.imgTouch,"this.data.imgTouch")
+  //   let rpx = this.data.rpx;
+  //   let canvasBg = this.data.obverseImgObject[index];
+  //   const ctx = wx.createCanvasContext('madeContent');
+  //   ctx.drawImage(canvasBg, 0, 0, 750 * rpx, 588 * rpx)
+  //   ctx.draw()
+  // },
   changeCup(e){
     // data-id== 1正面,2背面,3手柄,4杯底
-    this.changeCupImg(e.currentTarget.dataset.id);
-    let dataPositionObj = null, propSize=null;
-    switch (e.currentTarget.dataset.id){
-      case '1':
-      // console.log('正面')
-        dataPositionObj = { // 正面数据
-          top: '156rpx',
-          left: '286rpx',
-          width: '',
-          height: ''
-        };
-        propSize={
-          top: '8cm',
-          right: '8cm',
-          bottom: '8cm',
-          left: '8cm',
-        };
-      break;
-      case '2':
-        dataPositionObj = { // 正面数据
-          top: '156rpx',
-          left: '180rpx',
-          width: '',
-          height: ''
-        };
-        propSize = {
-          top: '8cm',
-          right: '8cm',
-          bottom: '8cm',
-          left: '8cm',
-        };
-      // console.log('背面');
-      break;
-      case '3':
-        dataPositionObj = { // 正面数据
-          top: '150rpx',
-          left: '348rpx',
-          width: '70rpx',
-          height: '268rpx'
-        };
-        propSize = {
-          top: '1cm',
-          right: '6cm',
-          bottom: '1cm',
-          left: '6cm',
-        };
-      // console.log('手柄');
-      break;
-      case '4':
-        dataPositionObj = { // 正面数据
-          top: '160rpx',
-          left: '190rpx',
-          width: '265rpx',
-          height: '265rpx'
-        };
-        propSize = {
-          top: '6cm',
-          right: '6cm',
-          bottom: '6cm',
-          left: '6cm',
-        };
-      // console.log('杯底');
-      break;
-      default:
-      break;
-
-    }
-    this.setData({
+    // this.changeCupImg(e.currentTarget.dataset.id);
+    let that = this;
+    let cupNum = util.changeCup(e.currentTarget.dataset.id)
+    that.setData({
       isActive: e.currentTarget.dataset.id,
-      dataPositionObj: dataPositionObj,
-      propSize: propSize
+      dataPositionObj: cupNum.dataPositionObj,
+      propSize: cupNum.propSize
     })
+    that.getDataTouch(that)
     
   },
-  addImg(){
-    console.log('添加图片')
+  addImgRouter(){
+    console.log('添加图片');
+    wx.navigateTo({
+      url: '/customized/pages/made/madeImg/madeImg?id=' + this.data.isActive,
+    })
+  },
+  addFontRouter() {
+    console.log('添加文字');
+    wx.navigateTo({
+      url: '/customized/pages/made/madeFont/madeFont?id=' + this.data.isActive,
+    })
+  },
+  getDataTouch(that){
+    let madeTouchImg = wx.getStorageSync('madeCupImgData' + that.data.isActive)
+    let madeTouchFont = wx.getStorageSync('madeCupFontData' + that.data.isActive)
+    console.log(madeTouchImg, madeTouchFont,"madeTouchFontmadeTouchFont")
+    if (madeTouchImg || madeTouchFont){
+      that.setData({
+        touchStatic: false
+      })
+      if (madeTouchImg){
+        that.imgAnimation.rotate(madeTouchImg.angle).step();
+        that.setData({
+          imgAnimationData: that.imgAnimation.export(),
+        })
+      }
+      if (madeTouchFont){
+        that.fontAnimation.rotate(madeTouchFont.angle).step();
+        that.setData({
+          fontAnimationData: that.fontAnimation.export(),
+        })
+      }
+
+      
+    }else {
+      that.setData({
+        touchStatic: true
+      })
+    }
+  
+    that.setData({
+      imgTouch: madeTouchImg ? madeTouchImg : {}, //存储图片数据
+      fontTouch: madeTouchFont ? madeTouchFont : {},
+    })
   },
-  addFont() {
-    console.log('添加文字')
-  }
 })

+ 34 - 18
customized/pages/made/made.wxml

@@ -1,21 +1,35 @@
-<canvas canvas-id='madeContent' class='made-content'>
-  <canvas canvas-id='myCanvasImg' class='made-img' style='width:{{dataPositionObj.width}};height:{{dataPositionObj.height}};margin:{{dataPositionObj.top}} 0 0 {{dataPositionObj.left}}'>
+
+<!-- <canvas canvas-id='madeContent' class='made-content'> -->
+  <!-- <canvas canvas-id='myCanvasImg' class='made-img' style='width:{{dataPositionObj.width}};height:{{dataPositionObj.height}};margin:{{dataPositionObj.top}} 0 0 {{dataPositionObj.left}}'>
     <canvas canvas-id='myCanvasFont' class='made-font' style='width:{{dataPositionObj.width}};height:{{dataPositionObj.height}}'></canvas>
-  </canvas> 
-</canvas>
-<view class='content'>
-<!-- 定制杯子 canvas 不合适 -->
-<!-- <view class='cup-box'>
-  <image src='{{obverseImgObject[isActive]}}'></image>
-  <made-solid prop-position="{{dataPositionObj}}" prop-size="{{propSize}}">
-    <view class='f-box f-align-items-center f-justify-content-center made-prompt'>可定制区域</view>
-  </made-solid>
-</view> -->
- <!-- <made-solid prop-position="{{dataPositionObj}}" prop-size="{{propSize}}">
-    <view class='f-box f-align-items-center f-justify-content-center made-prompt'>可定制区域</view>
-  </made-solid> -->
+  </canvas>  -->
+<!-- </canvas> -->
+
 
 
+<view class='content'>
+<view class='made-content'>
+  <view class='made-img-box'>
+    <image class='made-img-image' src='{{obverseImgObject[isActive]}}' mode="aspectFill"></image>
+    <made-solid prop-position="{{dataPositionObj}}" prop-size="{{propSize}}">
+      <view class='f-box f-align-items-center f-justify-content-center made-prompt ' wx:if="{{touchStatic}}">{{fontContent}}</view>
+      <view class='made-box'>
+      <!-- img -->
+      <view wx:if="{{!touchStatic}}" class='edit-content' style='top:{{imgTouch.y}}px;left:{{imgTouch.x}}px;width:{{dataPositionObj.width}}rpx;height:{{dataPositionObj.height}}rpx'>
+        <view animation="{{imgAnimationData}}">
+          <image src="{{imgTouch.src}}" mode="aspectFit" style='width:{{imgTouch.width}}rpx;height:{{imgTouch.height}}rpx'></image>
+        </view>
+      </view>
+      <!-- font -->
+     <view wx:if="{{!touchStatic}}" class='made-prompt made-font' style='color:{{fontTouch.isColor}};font-size:{{fontTouch.fontSize}}px;width:{{dataPositionObj.width}}rpx;height:{{dataPositionObj.height}}rpx'>
+        <view class='font-content' style='top:{{fontTouch.y}}px;left:{{fontTouch.x}}px'>
+          <view animation="{{fontAnimationData}}">{{fontTouch.fontContent}}</view>
+        </view>
+      </view>
+      </view>
+    </made-solid>
+  </view>
+</view>
 <view class='btn-box'>
   <view class='f-box f-justify-content-between'>
     <button type="default" hover-class="none" bindtap="changeCup" data-id='1' class='{{isActive === "1" ? "active" : ""}}' size="mini">正面</button>
@@ -28,9 +42,11 @@
 </view>
 
 <view class='footer f-box f-justify-content-between'>
-  <navigator url="/customized/pages/made/madeImg/madeImg" class='f-item footer-btn'>添加图片</navigator>
-  <navigator url="/customized/pages/made/madeFont/madeFont" class='f-item footer-btn'>添加文字</navigator>
-  <navigator url="" class='f-item footer-btn'>完成设计</navigator>
+<!-- url="/customized/pages/made/madeImg/madeImg" -->
+<!-- url="/customized/pages/made/madeFont/madeFont" -->
+  <view class='f-item footer-btn' bindtap='addImgRouter'>添加图片</view>
+  <view class='f-item footer-btn' bindtap='addFontRouter'>添加文字</view>
+  <view url="" class='f-item footer-btn'>完成设计</view>
 </view>
 
 </view>

+ 51 - 9
customized/pages/made/made.wxss

@@ -2,36 +2,78 @@
 page{
   background:#fff;
 }
+
 .made-content{
- width:100%;
+ width:750rpx;
  height:588rpx;
- margin:60rpx 0;
- /* position:relative; */
-}
 
+
+}
+.made-content-canvas{
+ position:absolute;
+ top:0;
+ left:0;
+ /* opacity:0; */
+}
+.made-img-box{
+  margin-top:60rpx;
+  position: relative;
+}
 .made-prompt{
   width:inherit;
   height:inherit;
 }
 .made-img{
-  /* position:absolute;
-  z-index:100; */
-background:red;
+  background:red;
   width:270rpx;
   height:270rpx;
   padding:1rpx;
   margin:0 auto;
+  position:fixed;
+  top:0;
+  left:0;
 }
-.made-font{
+.made-img-image{
+  width:750rpx;
+  height:588rpx;
+}
+/* .made-font{
   background:blue;
   width:270rpx;
   height:270rpx;
   padding:1rpx;
   margin:0 auto;
+} */
+.font-content{
+  display: inline-block;
+  position:relative;
+}
+.made-box{
+  position:relative;
+  width: inherit;
+  height: inherit;
+}
+.edit-content{
+   /* width:270rpx;
+  height:270rpx; */
+  position:absolute;
+  top:0;
+  left:0;
+  /* overflow: hidden; */
+  z-index:30;
+}
+.made-font{
+   /* width:270rpx;
+  height:270rpx; */
+  position:absolute;
+  top:0;
+  left:0;
+  /* overflow: hidden; */
+  z-index:40;
 }
 .btn-box{
   width:70%;
-  margin:0 auto;
+  margin:60rpx auto;
 }
 .btn-box button{
   width:200rpx;

+ 43 - 4
customized/pages/made/madeFont/madeFont.js

@@ -1,4 +1,5 @@
 // pages/customized/made/madeFont/madeFont.js
+import * as util from '../../../../utils/util.js'
 Page({
 
   /**
@@ -31,6 +32,7 @@ Page({
     addFontStatic: false, // 添加文字
     inputFont:null,
     touch:{
+      isActive:'1', // 表示正面
       fontContent: '可定制区域',
       isColor: '#ffffff', // 默认是白色
       x:10, // 字体的top值 x坐标
@@ -48,7 +50,32 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-   
+    let that = this;
+    that.animation = wx.createAnimation({
+      timingFunction: 'step-start', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
+    })
+    if('id' in options){
+      let cupNum = util.changeCup(options.id);
+      let madeTouchFont = wx.getStorageSync('madeCupFontData' + options.id);
+      if (madeTouchFont){
+        that.animation.rotate(madeTouchFont.angle).step();
+        that.setData({
+          touch: madeTouchFont,
+          animationData: that.animation.export(),
+          isActive: options.id,
+          dataPositionObj: cupNum.dataPositionObj,
+          propSize: cupNum.propSize
+        })
+      }else {
+        that.setData({
+          'touch.isActive': options.id,
+          isActive: options.id,
+          dataPositionObj: cupNum.dataPositionObj,
+          propSize: cupNum.propSize
+        })
+      }
+     
+    }
   },
 
   /**
@@ -57,9 +84,7 @@ Page({
   onReady: function () {
     let that = this;
     that.changeCupImg('1');
-    that.animation = wx.createAnimation({
-      timingFunction: 'step-start', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
-    })
+   
   },
 
   /**
@@ -220,5 +245,19 @@ Page({
       animationData:this.animation.export(),
       'touch.angle': e.detail.value
     })
+  },
+  madeConfirm(){ // 设计完成进行确定
+    if(this.data.touch.fontSize){
+      wx.setStorageSync('madeCupFontData'+ this.data.isActive, this.data.touch);
+      wx.navigateBack()
+      // wx.redirectTo({
+      //   url: '/customized/pages/made/made?id='+ this.data.isActive,
+      // })
+    } else {
+      wx.showToast({
+        title: '您还没有添加文字进行设计',
+        icon: 'none'
+      })
+    }
   }
 })

+ 3 - 3
customized/pages/made/madeFont/madeFont.wxml

@@ -17,13 +17,13 @@
 </view>
 <view class='public-prompt'>该预览为仿真效果图,具体请以实物为准</view>
 <view class='footer f-box'>
-  <view class="f-box f-align-items-center f-justify-content-center footer-icon">
+  <navigator open-type="navigateBack" class="f-box f-align-items-center f-justify-content-center footer-icon">
     <block>
       <icon class='f-box' type="clear" />
     </block>
-  </view>
+  </navigator>
   <view class='f-item footer-add-btn' bindtap='addFont'>添加文字</view>
-  <view class="f-box f-align-items-center footer-icon f-justify-content-center">
+  <view class="f-box f-align-items-center footer-icon f-justify-content-center" bindtap='madeConfirm'>
     <block>
       <icon  class='f-box' type="success" />
     </block>

+ 2 - 2
customized/pages/made/madeFont/madeFont.wxss

@@ -57,8 +57,8 @@ page{
   z-index:10;
 }
 .icon-close{
-  top:'-20rpx';
-  left:'-20rpx';
+  top:-50rpx;
+  left:-50rpx;
 }
 .icon-rotate{
   bottom:'-20rpx';

+ 74 - 19
customized/pages/made/madeImg/madeImg.js

@@ -1,7 +1,7 @@
 // pages/customized/made/madeImg/madeImg.js
+import * as util from '../../../../utils/util.js'
 let app = getApp();
 let host = app.globalData.servsers; // 请求的url
-let userid = app.globalData.user_id; //用户的userid
 Page({
 
   /**
@@ -21,8 +21,7 @@ Page({
       bottom: '8cm',
       left: '8cm',
     },
-
-    isActive: '1', // 默认是正面
+    host:null,
     obverseImgObject: {
       '1': '/customized/images/customized/cup_black_big.png',/*正面 */
       '2': '/customized/images/customized/cup_black_side.png',/*侧面面 */
@@ -33,18 +32,14 @@ Page({
     madeImg: null, // 定制图 
     madeStatic: false, // 定制状态,表示是否已经定制了,false 表示没有定制
     animationData: {},//旋转动画
-    imageArray:[
-      {
-        id:1,
-        src:'/customized/images/customized/cover-img.png'
-      }
-    ],//请求数据后的图片列表
+    imageArray:[],//请求数据后的图片列表
     imageId: null, // 用户选中图片的id
     imageSrc:null, // 选中图片后的路径
     touch:{
+      isActive: '1', // 1表示是正面
       src: null,
-      x:30,
-      y:30,
+      x:0,
+      y:0,
       clientX:0,
       clientY:0,
       width:null, // 图片的宽度
@@ -58,7 +53,33 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    
+    let that = this
+    that.animation = wx.createAnimation({
+      timingFunction: 'step-start', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
+    })
+    if('id' in options){
+      let cupNum = util.changeCup(options.id);
+      let madeTouchImg = wx.getStorageSync('madeCupImgData' + options.id);
+      if (madeTouchImg){
+        that.animation.rotate(madeTouchImg.angle).step();
+        that.setData({
+          touch: madeTouchImg,
+          animationData: this.animation.export(),
+          dataPositionObj: cupNum.dataPositionObj,
+          propSize: cupNum.propSize,
+          madeStatic:true,
+        });
+      }else {
+        that.setData({
+          'touch.isActive': options.id,
+          dataPositionObj: cupNum.dataPositionObj,
+          propSize: cupNum.propSize
+        });
+      }
+      
+
+      
+    }
   },
 
   /**
@@ -66,17 +87,17 @@ Page({
    */
   onReady: function () {
     let that = this;
-    
-    that.animation = wx.createAnimation({
-      timingFunction: 'step-start', // "linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end"
+    that.setData({
+      host:host,
     })
+    
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.getImgList();
   },
 
   /**
@@ -153,8 +174,27 @@ Page({
       'touch.angle': e.detail.value
     })
   },
+  getImgList(){ // 根据userid 获取图片列表
+    // /queryCustomGoodsUserListByUserId
+    let that = this
+    wx.request({
+      url: host+'/queryCustomGoodsUserListByUserId',
+      data:{
+        userId: app.globalData.user_id,
+      },
+      type:'get',
+      success(res){
+        console.log(res,'图片列表请求结束')
+        that.setData({
+          imageArray:res.data
+        })
+      }
+    })
+   
+  },
   uploadImg(){
     console.log('点击上传图片');
+    let that = this;
     wx.chooseImage({
       success(res) {
         const tempFilePaths = res.tempFilePaths
@@ -164,10 +204,11 @@ Page({
           name: 'file',
           formData: {
             file: tempFilePaths[0],
-            userid:userid,
+            userId: app.globalData.user_id,
           },
           success(res) {
-            console.log(res)
+            console.log(res,'我上传完了')
+            that.getImgList()
           }
         })
       }
@@ -211,6 +252,20 @@ Page({
         icon: 'none'
       })
     }
-    
+  },
+  madeConfirm(){
+    // 确认设计
+    if (this.data.madeStatic){ // 设计完成存储数据
+      wx.setStorageSync('madeCupImgData'+this.data.touch.isActive, this.data.touch);
+      wx.navigateBack()
+      // wx.redirectTo({
+      //   url: '/customized/pages/made/made?id=' + this.data.touch.isActive
+      // })
+    } else {
+      wx.showToast({
+        title: '您还没有选择图片进行设计',
+        icon:'none'
+      })
+    } 
   }
 })

+ 10 - 10
customized/pages/made/madeImg/madeImg.wxml

@@ -1,7 +1,7 @@
 <view class='container'>
   <view class='made-content'>
     <view class='made-img-box'>
-      <image class='made-image' src='{{obverseImgObject[isActive]}}'></image>
+      <image class='made-image' src='{{obverseImgObject[touch.isActive]}}'></image>
       <made-solid prop-position="{{dataPositionObj}}" prop-size="{{propSize}}">
         <view class='f-box f-align-items-center f-justify-content-center made-prompt' wx:if="{{!madeStatic}}">{{fontContent}}</view>
         <view wx:else class='edit-content' style='top:{{touch.y}}px;left:{{touch.x}}px'>
@@ -18,7 +18,7 @@
     <view class='f-box'>
       <!-- <view class='upload-list'><button hover-class="none" class='upload-btn f-box f-align-items-center'>点击上传图片</button></view> -->
       <scroll-view class="scroll-view_H f-box" scroll-x style="width: 100%">
-        <view wx:for="{{imageArray}}" wx:for-index="idx" wx:for-item="itemName" class='scroll-item {{itemName.id === imageId ? "active" : ""}}'><image src="{{itemName.src}}" data-id='{{itemName.id}}' data-src='{{itemName.src}}' mode="aspectFill" bindtap='selectImgBtn'></image></view>
+        <view wx:for="{{imageArray}}" wx:for-index="idx" wx:for-item="itemName" class='scroll-item {{itemName.id === imageId ? "active" : ""}}'><image src="{{host}}{{itemName.customGoodsImg}}" data-id='{{itemName.id}}' data-src='{{host}}{{itemName.customGoodsImg}}' mode="aspectFit" bindtap='selectImgBtn'></image></view>
       </scroll-view>
     </view>
   </view>
@@ -43,15 +43,15 @@
 </view>
 
   <view class='public-prompt'>该预览为仿真效果图,具体请以实物为准</view>
-  <view class='footer f-box'>
-    <view class="f-box f-align-items-center f-justify-content-center footer-icon">
+  <view class='footer f-box' hover-class='none'>
+    <navigator open-type="navigateBack"  class="f-box f-align-items-center f-justify-content-center footer-icon">
       <block>
-        <icon class='f-box' type="clear" />
-      </block>
-    </view>
-    <view class='f-item footer-upload-btn' bindtap='uploadImg'>上传图片</view>
-    <view class='f-item footer-add-btn' bindtap='addImg'>添加图片</view>
-    <view class="f-box f-align-items-center footer-icon f-justify-content-center">
+          <icon class='f-box' type="clear" />
+        </block>
+    </navigator>
+    <view class='f-item footer-upload-btn' bindtap='uploadImg' hover-class="none">上传图片</view>
+    <view class='f-item footer-add-btn' bindtap='addImg' hover-class="none">添加图片</view>
+    <view class="f-box f-align-items-center footer-icon f-justify-content-center" hover-class="none" bindtap='madeConfirm'>
       <block>
         <icon class='f-box' type="success"/>
       </block>

+ 1 - 1
customized/pages/made/madeImg/madeImg.wxss

@@ -7,7 +7,7 @@ page{
   margin-top:60rpx;
 }
 .made-image {
-  width:100%;
+  width:750rpx;
   height:588rpx;
 }
 .made-prompt{

+ 80 - 1
utils/util.js

@@ -16,8 +16,87 @@ function formatNumber(n) {
   return n[1] ? n : '0' + n
 }
 
+function changeCup(e) {
+  // e== 1正面,2背面,3手柄,4杯底
+  let dataPositionObj = null, propSize = null;
+  switch (e) {
+    case '1':
+      // console.log('正面')
+      dataPositionObj = { // 正面数据
+        top: '156rpx',
+        left: '286rpx',
+        width: '',
+        height: ''
+      };
+      propSize = {
+        top: '8cm',
+        right: '8cm',
+        bottom: '8cm',
+        left: '8cm',
+      };
+      break;
+    case '2':
+      dataPositionObj = { // 正面数据
+        top: '156rpx',
+        left: '180rpx',
+        width: '',
+        height: ''
+      };
+      propSize = {
+        top: '8cm',
+        right: '8cm',
+        bottom: '8cm',
+        left: '8cm',
+      };
+      // console.log('背面');
+      break;
+    case '3':
+      dataPositionObj = { // 正面数据
+        top: '150rpx',
+        left: '348rpx',
+        width: '70rpx',
+        height: '268rpx'
+      };
+      propSize = {
+        top: '1cm',
+        right: '6cm',
+        bottom: '1cm',
+        left: '6cm',
+      };
+      // console.log('手柄');
+      break;
+    case '4':
+      dataPositionObj = { // 正面数据
+        top: '160rpx',
+        left: '190rpx',
+        width: '265rpx',
+        height: '265rpx'
+      };
+      propSize = {
+        top: '6cm',
+        right: '6cm',
+        bottom: '6cm',
+        left: '6cm',
+      };
+      // console.log('杯底');
+      break;
+    default:
+      break;
+
+  }
+
+  return {
+    dataPositionObj: dataPositionObj,
+    propSize: propSize
+  }
+  
+
+}
+
+
 module.exports = {
-  formatTime: formatTime
+  formatTime: formatTime,
+  changeCup: changeCup
 }