浏览代码

feature: 对壁纸裁剪和壁纸测试分包处理

332777428@qq.com 4 月之前
父节点
当前提交
dcfe46c8b8

+ 7 - 2
app.json

@@ -13,9 +13,7 @@
     "pages/deviceMode/deviceMode",
     "pages/connectBle/connectBle",
     "pages/deviceDetail/deviceDetail",
-    "pages/piano/wallpaper/wallpaper",
     "pages/ota/ota",
-    "pages/piano/cropper/cropper",
     "pages/setWifi/setWifi",
     "pages/vipPurchase/vipPurchase",
     "pages/vipRecord/vipRecord",
@@ -32,6 +30,13 @@
         "deviceConnect3/deviceConnect3",
         "deviceConnect4/deviceConnect4"
       ]
+    },
+    {
+      "root": "pages/piano/",
+      "pages": [
+        "cropper/cropper",
+        "wallpaper/wallpaper"
+      ]
     }
   ],
   "window": {

+ 3 - 3
pages/deviceDetail/deviceDetail.js

@@ -7,6 +7,7 @@ import {
   CmdEvent
 } from '../../devices/cmd_key_event';
 import eventBus from '../../utils/eventBus'
+import routePath from '../../utils/routePath';
 import routeUtil from '../../utils/routeUtil';
 
 Page({
@@ -20,20 +21,19 @@ Page({
     updateData: {},
     powerOpen: false,
     isShowWallpaper: false,
-
   },
 
 
   goToWallpaper: function () {
     var param = "?param=" + JSON.stringify(this.data.device);
-    routeUtil.jumpParam('/pages/piano/wallpaper/wallpaper', param);
+    routeUtil.jumpParam(routePath.wallpaper, param);
   },
 
   goToOta: function () {
     var p = {
       "device": this.data.device,
     }
-    var param = "?param=" +  JSON.stringify(p);
+    var param = "?param=" + JSON.stringify(p);
     routeUtil.jumpParam('/pages/ota/ota', param);
   },
   powerTap(e) {

+ 0 - 2
pages/piano/cropper/cropper.js

@@ -1,5 +1,3 @@
-// pages/piano/cropper/cropper.js
-
 const { BtCmd } = require('../../../devices/bluetooth/bt_cmd');
 import eventBus from '../../../utils/eventBus'
 import { EnumCmdEvent, CmdEvent } from '../../../devices/cmd_key_event';

+ 9 - 10
pages/piano/cropper/cropper.wxml

@@ -1,13 +1,12 @@
-<!-- pages/piano/cropper/cropper.wxml -->
 <nav-bar class="navi_bar" bind:goBack="_goBack" nav-bgc-class="ex-nav-bgc-class" navbarData='{{navbarData}}' bind:callback="callback"></nav-bar>
 <view class="container">
-    <image-cropper id="image-cropper" bindload="cropperload" bindimageload="loadimage" bindtapcut="clickcut" limit_move="true" disable_rotate="true" width="{{width}}" height="{{height}}" imgSrc="{{src}}" disable_width="true" max_width="{{width}}" max_height="{{height}}" disable_height="true" disable_ratio="true" min_width="{{width}}" min_height="{{height}}" max_scale="{{max_scale}}" export_scale="1.5"></image-cropper>
-    <view wx:if="{{showProgress}}" class="progress-container">
-        <progress class="progress" border-radius="26rpx" percent="{{progress}}" activeColor="rgba(101, 70, 163, 1)" backgroundColor="rgba(0, 0, 0, 0.40)" stroke-width="26" border-radius="13" />
-        <view class="progress-text">保存壁纸中…{{progress}}%</view>
-    </view>
-    <view wx:if="{{!showProgress}}" class='bottom'>
-        <view class="left_btn btn_title" catchtap='cancel'>取消</view>
-        <view class="right_btn btn_title" bindtap='submit'>确定</view>
-    </view>
+  <image-cropper id="image-cropper" bindload="cropperload" bindimageload="loadimage" bindtapcut="clickcut" limit_move="true" disable_rotate="true" width="{{width}}" height="{{height}}" imgSrc="{{src}}" disable_width="true" max_width="{{width}}" max_height="{{height}}" disable_height="true" disable_ratio="true" min_width="{{width}}" min_height="{{height}}" max_scale="{{max_scale}}" export_scale="1.5"></image-cropper>
+  <view wx:if="{{showProgress}}" class="progress-container">
+    <progress class="progress" border-radius="26rpx" percent="{{progress}}" activeColor="rgba(101, 70, 163, 1)" backgroundColor="rgba(0, 0, 0, 0.40)" stroke-width="26" border-radius="13" />
+    <view class="progress-text">保存壁纸中…{{progress}}%</view>
+  </view>
+  <view wx:if="{{!showProgress}}" class='bottom'>
+    <view class="left_btn btn_title" catchtap='cancel'>取消</view>
+    <view class="right_btn btn_title" bindtap='submit'>确定</view>
+  </view>
 </view>

+ 0 - 1
pages/piano/cropper/cropper.wxss

@@ -1,4 +1,3 @@
-/* pages/piano/cropper/cropper.wxss */
 .container {
 	position: relative;
 	overflow: hidden;

+ 16 - 11
pages/piano/wallpaper/wallpaper.js

@@ -1,9 +1,11 @@
-// pages/piano/wallpaper/wallpaper.js
-const { deviceWallPaper } = require('../../../request/deviceListRequest')
+const {
+  deviceWallPaper
+} = require('../../../request/deviceListRequest')
 // const sharp = require('sharp');
 // const fs = require('fs');
 
 import routeUtil from '../../../utils/routeUtil';
+import routePath from '../../../utils/routePath';
 import store from '../../../utils/store';
 
 Page({
@@ -11,8 +13,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    topImg:
-    {
+    topImg: {
       //      pic: "",
       //      id: "",
     },
@@ -37,8 +38,8 @@ Page({
       "deviceId": this.data._device.deviceId,
       "topImg": this.data.topImg
     }
-    var param = "?param=" +  JSON.stringify(p);
-    routeUtil.jumpParam("../cropper/cropper", param);
+    var param = "?param=" + JSON.stringify(p);
+    routeUtil.jumpParam(routePath.cropper, param);
   },
   imageTopTap() {
     this.setData({
@@ -99,7 +100,8 @@ Page({
     let _this = this;
 
     let newImg = {
-      "pic": topUrl, "id": "0"
+      "pic": topUrl,
+      "id": "0"
     }
     let myImgList = store.getStore(_this.data._localImgPicKey)
     myImgList = myImgList ?? []
@@ -111,7 +113,9 @@ Page({
 
     let imgList = _this.data._netImageList
     // 移除网络的重复图片
-    let findImg = imgList.find(function (img) { return img.pic === topUrl })
+    let findImg = imgList.find(function (img) {
+      return img.pic === topUrl
+    })
     console.log("updateTopImg3", findImg)
     if (findImg) {
       // 官方不动位置
@@ -152,7 +156,9 @@ Page({
 
     this.setData({
       showCropImg: true,
-      topImg: { "pic": img.path }
+      topImg: {
+        "pic": img.path
+      }
     })
 
   },
@@ -196,8 +202,7 @@ Page({
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload() {
-  },
+  onUnload() {},
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作

+ 17 - 18
pages/piano/wallpaper/wallpaper.wxml

@@ -1,22 +1,21 @@
-<!-- pages/piano/wallpaper/wallpaper.wxml -->
 <view class="container">
-    <!-- <nav-bar bind:goBack="_goBack" nav-bgc-class="ex-nav-bgc-class" nav-title-class="ex-nav-title-class" ex-back-pre="ex-back-pre" navbar-data='{{navbarData}}'></nav-bar> -->
-    <view wx:if="{{topImg.pic}}" class="img_section" bind:tap="imageTopTap">
-        <image src="{{topImg.pic}}" class="select_img"></image>
-        <image src="../../../images/common/icon_sel.png" class="select_icon"></image>
+  <!-- <nav-bar bind:goBack="_goBack" nav-bgc-class="ex-nav-bgc-class" nav-title-class="ex-nav-title-class" ex-back-pre="ex-back-pre" navbar-data='{{navbarData}}'></nav-bar> -->
+  <view wx:if="{{topImg.pic}}" class="img_section" bind:tap="imageTopTap">
+    <image src="{{topImg.pic}}" class="select_img"></image>
+    <image src="../../../../images/common/icon_sel.png" class="select_icon"></image>
+  </view>
+  <view class="grid_container_super">
+    <view class="grid-container">
+      <block wx:for="{{showAllImages ? imageList : image4List}}" wx:key="index" wx:for-item="item" wx:for-index="index">
+        <image class="device_img" src="{{item.pic}}" mode="aspectFill" bind:tap="imageTap" data-image="{{item}}" />
+      </block>
     </view>
-    <view class="grid_container_super">
-        <view class="grid-container">
-            <block wx:for="{{showAllImages ? imageList : image4List}}" wx:key="index" wx:for-item="item" wx:for-index="index">
-                <image class="device_img" src="{{item.pic}}" mode="aspectFill" bind:tap="imageTap" data-image="{{item}}" />
-            </block>
-        </view>
-        <view class="up_down_img" bindtap="toggleShowAll">
-            <image src="{{showAllImages ? '../../../img/j_top.png' : '../../../img/j_bottom.png'}}"></image>
-        </view>
-    </view>
-    <view class="footer" bind:tap="footerTap">
-        <image src="../../../images/common/icon_add.png" mode="aspectFill" />
-        <view>上传图片</view>
+    <view class="up_down_img" bindtap="toggleShowAll">
+      <image src="{{showAllImages ? '../../../../img/j_top.png' : '../../../../img/j_bottom.png'}}"></image>
     </view>
+  </view>
+  <view class="footer" bind:tap="footerTap">
+    <image src="../../../../images/common/icon_add.png" mode="aspectFill" />
+    <view>上传图片</view>
+  </view>
 </view>

+ 0 - 1
pages/piano/wallpaper/wallpaper.wxss

@@ -1,4 +1,3 @@
-/* pages/piano/wallpaper/wallpaper.wxss */
 /* .ex-nav-bgc-class {
     position: fixed;
     top: 0;

+ 7 - 3
utils/routePath.js

@@ -6,22 +6,22 @@ const login = "../../pageA/login/login";
 const deviceList = "../../pageA/deviceList/deviceList";
 
 /// B
-
 const deviceConnect0 = "../../pageB/deviceConnect0/deviceConnect0";
 const deviceConnect1 = "../../pageB/deviceConnect1/deviceConnect1";
 const deviceConnect2 = "../../pageB/deviceConnect2/deviceConnect2";
 const deviceConnect3 = "../../pageB/deviceConnect3/deviceConnect3";
 const deviceConnect4 = "../../pageB/deviceConnect4/deviceConnect4";
 
+/// piano
+const cropper = "../../piano/cropper/cropper";
+const wallpaper = "../../piano/wallpaper/wallpaper";
 
 const about = "../about/about";
 const setWifi = "../setWifi/setWifi";
 
 /// 抽奖记录
-
 const connectMode = "../deviceConMode/index";
 const connectBle = "../connectBle/connectBle";
-
 const webview = "../webview/webview";
 
 module.exports = {
@@ -36,6 +36,10 @@ module.exports = {
   deviceConnect3: deviceConnect3,
   deviceConnect4: deviceConnect4,
 
+  /// piano
+  cropper: cropper,
+  wallpaper: wallpaper,
+
   about: about,
   connectMode: connectMode,
   connectBle: connectBle,