shizhongqi 1 ano atrás
pai
commit
24582b8a0e
2 arquivos alterados com 6 adições e 3 exclusões
  1. 5 2
      hdApp/src/admin/goods/categorySort.vue
  2. 1 1
      hdApp/src/pages.json

+ 5 - 2
hdApp/src/admin/goods/categorySort.vue

@@ -130,13 +130,15 @@ export default {
 			const currentY = e.touches[0].clientY
 			const deltaY = currentY - this.startY
 			
+			const systemInfo = uni.getSystemInfoSync()
+			const pixelRatio = 750 / systemInfo.windowWidth
 			// 根据设备像素比例转换为upx单位
-			const deltaYupx = deltaY * (750 / uni.getSystemInfoSync().windowWidth)
+			const deltaYupx = deltaY * pixelRatio
 			
 			this.dragOffsetY = deltaYupx
 			
 			// 计算目标位置
-			const itemHeightUpx = this.itemHeight * (750 / uni.getSystemInfoSync().windowWidth)
+			const itemHeightUpx = this.itemHeight * pixelRatio
 			
 			// 使用更精确的计算方法确定移动的项目数
 			const moveDistance = Math.abs(deltaYupx)
@@ -180,6 +182,7 @@ export default {
 			const sortData = this.list.data.map((item, index) => ({
 				id: item.id,
 				inTurn: this.list.data.length - index // 反向索引,使第一个项目有最大值
+				// 如果是分页加载的,请用 data.total 替换掉 this.list.data.length
 			}))
 			
 			// 调用API更新排序

+ 1 - 1
hdApp/src/pages.json

@@ -293,7 +293,7 @@
 				{ "path": "pdGoods", "style": { "navigationBarTitleText": "选择商品" } },
 				{ "path": "pdGoodsConfirm", "style": { "navigationBarTitleText": "确认盘点" } },
 				{ "path": "pdGoodsDetail", "style": { "navigationBarTitleText": "详情" } },
-				{ "path": "categorySort", "style": { "navigationBarTitleText": "分类排序" } },
+				{ "path": "categorySort", "style": { "navigationBarTitleText": "排序" } },
 				{ "path": "goodsSort", "style": { "navigationBarTitleText": "商品排序" } }
 			]
 		},