From 1e71dd86f6d0c4fc7e5143600d4bc4b50992a2a7 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Thu, 04 Jul 2024 14:51:28 +0800 Subject: [PATCH] fix: 高德密钥修改 --- uni_modules/uview-ui/components/u-swipe-action-item/index - backup.wxs | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 256 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u-swipe-action-item/index - backup.wxs b/uni_modules/uview-ui/components/u-swipe-action-item/index - backup.wxs new file mode 100644 index 0000000..04cab92 --- /dev/null +++ b/uni_modules/uview-ui/components/u-swipe-action-item/index - backup.wxs @@ -0,0 +1,256 @@ +/** + * ������wxs������������������APP-VUE������������QQ���������������H5������ + * wxs���������������es6���������������������������var��������������������������������������������������� + */ + +// ������������ +function touchstart(event, ownerInstance) { + // ������������������������ComponentDescriptor������ + var instance = event.instance + // wxs������������������������������������������������������������������touchstart���touchmove��������������������������������������� + var state = instance.getState() + if (state.disable) return + var touches = event.touches + // ������������������������������������������������������ + if (touches && touches.length > 1) return + // ������������������������������ + state.moving = true + // ��������������������������������� + state.startX = touches[0].pageX + state.startY = touches[0].pageY +} + +// ������������ +function touchmove(event, ownerInstance) { + // ������������������������ComponentDescriptor������ + var instance = event.instance + // wxs������������������������ + var state = instance.getState() + if (state.disabled || !state.moving) return + + var touches = event.touches + var pageX = touches[0].pageX + var pageY = touches[0].pageY + var moveX = pageX - state.startX + var moveY = pageY - state.startY + var buttonsWidth = state.buttonsWidth + + // ���������X���������������Y���������������������������������������������������X���������������45��������������������������� + if (Math.abs(moveX) > Math.abs(moveY) || Math.abs(moveX) > state.threshold) { + event.preventDefault() + event.stopPropagation() + } + // ���������������X���������������Y���������������������������������������������������������Y���������������45��������������������������������������������������������������������� + if (Math.abs(moveX) < Math.abs(moveY)) return + + // ���������������������������������������������������������������������������X������������������0������������������ + // ������������������return������������������������������������������������������������������������������������������������ + // ������������������������0 + if (state.status === 'open') { + // ��������������������������������������������� + if (moveX < 0) moveX = 0 + // ������������������������������������������������������������������ + if (moveX > buttonsWidth) moveX = buttonsWidth + // ������������������������������������������������������������������������ + moveSwipeAction(-buttonsWidth + moveX, instance, ownerInstance) + } else { + // ������������������������������������ + if (moveX > 0) moveX = 0 + // ��������������������������������������������������������������������������������������������������������������������������������� + if (Math.abs(moveX) > buttonsWidth) moveX = -buttonsWidth + // ������������������������������������������������������������������������������������������������������ + moveSwipeAction(moveX, instance, ownerInstance) + } +} + +// ������������ +function touchend(event, ownerInstance) { + // ������������������������ComponentDescriptor������ + var instance = event.instance + // wxs������������������������ + var state = instance.getState() + if (!state.moving || state.disabled) return + var touches = event.changedTouches ? event.changedTouches[0] : {} + var pageX = touches.pageX + var pageY = touches.pageY + var moveX = pageX - state.startX + if (state.status === 'open') { + // ��������������������������������������������������� + if (moveX < 0) return + // ������������������������������������������������moveX���0������������������������������������������������������������ + if (moveX === 0) { + return closeSwipeAction(instance, ownerInstance) + } + // ��������������������������������������������������������������������������������������������������������� + if (Math.abs(moveX) < state.threshold) { + openSwipeAction(instance, ownerInstance) + } else { + // ������������������������������������������������������ + closeSwipeAction(instance, ownerInstance) + } + } else { + // ��������������������������������������������� + if (moveX > 0) return + // ������������ + if (Math.abs(moveX) < state.threshold) { + closeSwipeAction(instance, ownerInstance) + } else { + openSwipeAction(instance, ownerInstance) + } + } +} + +// ������������������ +function getDuration(value) { + if (value.toString().indexOf('s') >= 0) return value + return value > 30 ? value + 'ms' : value + 's' +} + +// ������������������������������������ +function getMoveDirection(instance, ownerInstance) { + var state = instance.getState() +} + +// ��������������������������������������������������������������������� +function moveSwipeAction(moveX, instance, ownerInstance) { + var state = instance.getState() + // ��������������������������������������������������������������������� + var buttons = ownerInstance.selectAllComponents('.u-swipe-action-item__right__button') + var len = buttons.length + var previewButtonsMoveX = 0 + + // ��������������������������������� + instance.requestAnimationFrame(function() { + instance.setStyle({ + // ������translateX������ + 'transition': 'none', + transform: 'translateX(' + moveX + 'px)', + '-webkit-transform': 'translateX(' + moveX + 'px)' + }) + // ������������������ + for (var i = len - 1; i >= 0; i--) { + // ��������������������������������������������������� + var translateX = state.buttons[i].width / state.buttonsWidth * moveX + // ��������������������������������������������������������������������������������������������������������������������� + var realTranslateX = translateX + previewButtonsMoveX + buttons[i].setStyle({ + // ��������������������������������������������������������������������������������������������������������������������������������������������������� + 'transition': 'none', + 'transform': 'translateX(' + realTranslateX + 'px)', + '-webkit-transform': 'translateX(' + realTranslateX + 'px)' + }) + // ��������������������������������������������������������� + previewButtonsMoveX += translateX + } + }) +} + +// ��������������������������� +function openSwipeAction(instance, ownerInstance) { + var state = instance.getState() + // ��������������������������������������������������������������������� + var buttons = ownerInstance.selectAllComponents('.u-swipe-action-item__right__button') + var len = buttons.length + // ������duration������������ + const duration = getDuration(state.duration) + // ������������������������������������������X������������������������ + var buttonsWidth = -state.buttonsWidth + var previewButtonsMoveX = 0 + instance.requestAnimationFrame(function() { + // ������������������������ + instance.setStyle({ + 'transition': 'transform ' + duration, + 'transform': 'translateX(' + buttonsWidth + 'px)', + '-webkit-transform': 'translateX(' + buttonsWidth + 'px)', + }) + // ��������������������������������������������� + for (var i = len - 1; i >= 0; i--) { + // ��������������������������������������������������� + var translateX = state.buttons[i].width / state.buttonsWidth * buttonsWidth + // ��������������������������������������������������������������������������������������������������������������������� + var realTranslateX = translateX + previewButtonsMoveX + buttons[i].setStyle({ + // ������������������������������������������ + 'transition': 'transform ' + duration, + 'transform': 'translateX(' + realTranslateX + 'px)', + '-webkit-transform': 'translateX(' + realTranslateX + 'px)' + }) + // ��������������������������������������������������������� + previewButtonsMoveX += translateX + } + }) + setStatus('open', instance) +} + +// ������������������������������open-���������������close-������������ +function setStatus(status, instance) { + var state = instance.getState() + state.status = status +} + +// ��������������������������� +function closeSwipeAction(instance, ownerInstance) { + var state = instance.getState() + // ��������������������������������������������������������������������� + var buttons = ownerInstance.selectAllComponents('.u-swipe-action-item__right__button') + var len = buttons.length + // ������duration������������ + const duration = getDuration(state.duration) + instance.requestAnimationFrame(function() { + // ������������������������ + instance.setStyle({ + 'transition': 'transform ' + duration, + 'transform': 'translateX(0px)', + '-webkit-transform': 'translateX(0px)' + }) + // ��������������������������������������������� + for (var i = len - 1; i >= 0; i--) { + buttons[i].setStyle({ + 'transition': 'transform ' + duration, + 'transform': 'translateX(0px)', + '-webkit-transform': 'translateX(0px)' + }) + } + }) + setStatus('close', instance) +} + +// show��������������������� +function showChange(newValue, oldValue, ownerInstance, instance) { + var state = instance.getState() + if (state.disabled) return + // ������������������������ + if (newValue) { + openSwipeAction(instance, ownerInstance) + } else { + closeSwipeAction(instance, ownerInstance) + } +} + +// ������������������������ +function sizeChange(newValue, oldValue, ownerInstance, instance) { + // wxs������������������������ + var state = instance.getState() + state.disabled = newValue.disabled + state.duration = newValue.duration + state.show = newValue.show + state.threshold = newValue.threshold + state.buttons = newValue.buttons + + var len = state.buttons.length + if (len) { + var buttonsWidth = 0 + var buttons = newValue.buttons + for (var i = 0; i < len; i++) { + buttonsWidth += buttons[i].width + } + } + state.buttonsWidth = buttonsWidth +} + +module.exports = { + touchstart: touchstart, + touchmove: touchmove, + touchend: touchend, + sizeChange: sizeChange +} -- Gitblit v1.8.0