lanxin 3 veckor sedan
förälder
incheckning
ee8a2ef2e2
5 ändrade filer med 53 tillägg och 12 borttagningar
  1. 12 0
      app.js
  2. BIN
      assets/fonts/cexwz.TTF
  3. 35 6
      pages/work/index.js
  4. 3 4
      pages/work/index.wxml
  5. 3 2
      pages/work/index.wxss

+ 12 - 0
app.js

@@ -6,6 +6,18 @@ App({
     let info = wx.getSystemInfoSync()
     this.globalData.deviceInfo = info
     this.globalData.top = wx.getMenuButtonBoundingClientRect()
+    wx.loadFontFace({
+      family: 'cexwz',  // 自定义名称
+      source: 'url("https://houseoss.4dkankan.com/project/4dage-sxb/ZHS2409020-1/cexwz.TTF")',  // 必须是 https 地址
+      global: true,
+      scopes: ['webview', 'native'],
+      success: (res) => {
+        console.log('字体加载成功', res)
+      },
+      fail: (err) => {
+        console.error('字体加载失败', err)
+      }
+    })
   },
   globalData: {
     userInfo: null,

BIN
assets/fonts/cexwz.TTF


+ 35 - 6
pages/work/index.js

@@ -62,6 +62,30 @@ VueLikePage([], {
     selectedDate: '' // 最终选中的日期
   },
   methods: {
+    selectConfirm(e){
+      this.confirmIp()
+      // 拿到item,从confirmedIps去掉当前item
+      const selectedItem = e.currentTarget.dataset.item
+      console.log(selectedItem)
+      this.setData({
+        confirmedIps:this.data.confirmedIps.filter(i=>i.id!==selectedItem.id),
+          // 再重新还原到选中状态 设置
+          selectedIp: selectedItem.selectedIp,
+          selectedIpIndex: selectedItem.selectedIpIndex,
+        tabIndex: selectedItem.typeIndex, // 判断是贴图还是标题还是日期
+        rgb: selectedItem.rgb,
+        imgUrl:selectedItem.typeIndex==1? selectedItem?.imgUrl:'',
+        title: selectedItem.typeIndex==2?selectedItem?.title:'',
+        date: selectedItem.typeIndex==3?selectedItem?.date:'',
+        ipScaleX: selectedItem.scaleX,
+        ipScaleY: selectedItem.scaleY,
+        ipRotate: selectedItem.rotate,
+        ipLeft: selectedItem.left,
+        ipTop: selectedItem.top,
+        positionInitialized:true
+      })
+      // console.log(this.data)
+    },
     loadDate() {
       const now = new Date();
       const currentYear = now.getFullYear();
@@ -226,9 +250,9 @@ VueLikePage([], {
       if (type == "0") {
         link = `${VIDEO_BASE_URL}4dvedio/${rdw}.mp4`;
       } else {
-        link = `${VIDEO_BASE_URL}4dpic/${rdw}.jpg`;
+        // link = `${VIDEO_BASE_URL}4dpic/${rdw}.jpg`;
         // test
-        // link = 'https://pic.616pic.com/phototwo/00/06/02/618e27a7290161785.jpg'
+        link = 'https://pic.616pic.com/phototwo/00/06/02/618e27a7290161785.jpg'
         this.loadDate()
       }
 
@@ -519,7 +543,7 @@ VueLikePage([], {
             const padding = paddingRpx * ratio;
             const borderRadius = 40 * ratio;
 
-            ctx.font = ` ${fontSizePx}px iconfont`;
+            ctx.font = ` ${fontSizePx}px cexwz`;
             ctx.fillStyle = ov.rgb || '#000000';
             ctx.textAlign = 'center';
             ctx.textBaseline = 'middle';
@@ -545,7 +569,7 @@ VueLikePage([], {
             const finalWidth = contentWidth + padding * 2;
 
             // 绘制圆角矩形背景
-            ctx.fillStyle = 'rgba(156, 208, 255, 1)';
+            ctx.fillStyle = 'rgba(255, 255, 255, 0.70)';
             ctx.beginPath();
             this.drawRoundRect(
               ctx,
@@ -748,8 +772,10 @@ VueLikePage([], {
       });
     },
     selectIp(e) {
-      const index = e.currentTarget.dataset.index;
+      
+      const index = e.currentTarget.dataset.index ;
       const item = this.data.ipsImgList[index];
+      console.log(index,item)
       // 这里日期和标题选择的index都没用,但是也需要传,相当于限制了添加上限为ips数组长度
       if (!item) return;
       if (this.data.selectedIp && !this.data.ipConfirmed) {
@@ -907,6 +933,7 @@ VueLikePage([], {
       });
     },
     confirmIp() {
+    
       if (!this.data.selectedIp) return;
       const overlayItem = {
         typeIndex: this.data.tabIndex, // 判断是贴图还是标题还是日期
@@ -919,7 +946,9 @@ VueLikePage([], {
         scaleY: this.data.ipScaleY,
         rotate: this.data.ipRotate,
         left: this.data.ipLeft,
-        top: this.data.ipTop
+        top: this.data.ipTop,
+        selectedIp:this.data.selectedIp,
+        selectedIpIndex:this.data.selectedIpIndex
       };
       this.setData({
         confirmedIps: [...this.data.confirmedIps, overlayItem],

+ 3 - 4
pages/work/index.wxml

@@ -25,15 +25,14 @@
           style="left:{{item.left}}px; top:{{item.top}}px; right:auto; bottom:auto;">
           <!-- 贴图 -->
           <image wx:if="{{item.typeIndex==1}}" class="ip-main" src="{{item.imgUrl}}"
-            style="transform:scale({{item.scaleX}}, {{item.scaleY}}) rotate({{item.rotate}}deg) translateZ(0); will-change: transform;" />
+            style="transform:scale({{item.scaleX}}, {{item.scaleY}}) rotate({{item.rotate}}deg) translateZ(0); will-change: transform;" bind:tap="selectConfirm" data-item="{{item}}"/>
           <!-- 标题 -->
           <view wx:if="{{item.typeIndex==2}}" class="ip-title-main"
             style="color:{{item.rgb}};transform:scale({{item.scaleX}}, {{item.scaleY}}) rotate({{item.rotate}}deg) translateZ(0); will-change: transform;"
-            catchtouchstart="dragStart" catchtouchmove="dragMove">{{item.title}}</view>
+             bind:tap="selectConfirm" data-item="{{item}}">{{item.title}}</view>
             <!-- 日期 -->
           <view wx:if="{{item.typeIndex==3}}" class="ip-title-main"
-            style="color:{{item.rgb}};transform:scale({{item.scaleX}}, {{item.scaleY}}) rotate({{item.rotate}}deg) translateZ(0); will-change: transform;"
-            catchtouchstart="dragStart" catchtouchmove="dragMove">{{item.date}}</view>
+            style="color:{{item.rgb}};transform:scale({{item.scaleX}}, {{item.scaleY}}) rotate({{item.rotate}}deg) translateZ(0); will-change: transform;" bind:tap="selectConfirm" data-item="{{item}}">{{item.date}}</view>
         </view>
       </block>
       <!-- 可以操作的情况 -->

+ 3 - 2
pages/work/index.wxss

@@ -351,9 +351,10 @@
   width: 240rpx;
   height: 240rpx;
 }
+
 .ip-title-main{
-  font-family: TsangerXWZ, TsangerXWZ;
-  background-color: rgba(156, 208, 255, 1);
+  font-family: 'cexwz';
+  background-color: rgba(255, 255, 255, 0.70);
   border-radius: 20px;
   text-align: center;
   font-size: 35rpx;