From 2cf76eb3e7af0707d16e0fe3b56d4331d9efa58d Mon Sep 17 00:00:00 2001
From: wuhui_zzw <1760308791@qq.com>
Date: Tue, 28 Feb 2023 17:40:56 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=92=E6=9D=80=E5=95=86=E5=93=81=E8=AF=A6?=
=?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/uni-transition/createAnimation.js | 128 +++++++
components/uni-transition/uni-transition.vue | 277 +++++++++++++++
pages.json | 19 +-
pages_promotion/futures/details.vue | 334 +++++++++++++++++++
pages_promotion/futures/my_shop.vue | 68 ++++
pages_promotion/futures/seckill.vue | 14 +-
6 files changed, 830 insertions(+), 10 deletions(-)
create mode 100644 components/uni-transition/createAnimation.js
create mode 100644 components/uni-transition/uni-transition.vue
create mode 100644 pages_promotion/futures/details.vue
create mode 100644 pages_promotion/futures/my_shop.vue
diff --git a/components/uni-transition/createAnimation.js b/components/uni-transition/createAnimation.js
new file mode 100644
index 0000000..5f54365
--- /dev/null
+++ b/components/uni-transition/createAnimation.js
@@ -0,0 +1,128 @@
+// const defaultOption = {
+// duration: 300,
+// timingFunction: 'linear',
+// delay: 0,
+// transformOrigin: '50% 50% 0'
+// }
+// #ifdef APP-NVUE
+const nvueAnimation = uni.requireNativePlugin('animation')
+// #endif
+class MPAnimation {
+ constructor(options, _this) {
+ this.options = options
+ this.animation = uni.createAnimation(options)
+ this.currentStepAnimates = {}
+ this.next = 0
+ this.$ = _this
+
+ }
+
+ _nvuePushAnimates(type, args) {
+ let aniObj = this.currentStepAnimates[this.next]
+ let styles = {}
+ if (!aniObj) {
+ styles = {
+ styles: {},
+ config: {}
+ }
+ } else {
+ styles = aniObj
+ }
+ if (animateTypes1.includes(type)) {
+ if (!styles.styles.transform) {
+ styles.styles.transform = ''
+ }
+ let unit = ''
+ if(type === 'rotate'){
+ unit = 'deg'
+ }
+ styles.styles.transform += `${type}(${args+unit}) `
+ } else {
+ styles.styles[type] = `${args}`
+ }
+ this.currentStepAnimates[this.next] = styles
+ }
+ _animateRun(styles = {}, config = {}) {
+ let ref = this.$.$refs['ani'].ref
+ if (!ref) return
+ return new Promise((resolve, reject) => {
+ nvueAnimation.transition(ref, {
+ styles,
+ ...config
+ }, res => {
+ resolve()
+ })
+ })
+ }
+
+ _nvueNextAnimate(animates, step = 0, fn) {
+ let obj = animates[step]
+ if (obj) {
+ let {
+ styles,
+ config
+ } = obj
+ this._animateRun(styles, config).then(() => {
+ step += 1
+ this._nvueNextAnimate(animates, step, fn)
+ })
+ } else {
+ this.currentStepAnimates = {}
+ typeof fn === 'function' && fn()
+ this.isEnd = true
+ }
+ }
+
+ step(config = {}) {
+ // #ifndef APP-NVUE
+ this.animation.step(config)
+ // #endif
+ // #ifdef APP-NVUE
+ this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config)
+ this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin
+ this.next++
+ // #endif
+ return this
+ }
+
+ run(fn) {
+ // #ifndef APP-NVUE
+ this.$.animationData = this.animation.export()
+ this.$.timer = setTimeout(() => {
+ typeof fn === 'function' && fn()
+ }, this.$.durationTime)
+ // #endif
+ // #ifdef APP-NVUE
+ this.isEnd = false
+ let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref
+ if(!ref) return
+ this._nvueNextAnimate(this.currentStepAnimates, 0, fn)
+ this.next = 0
+ // #endif
+ }
+}
+
+
+const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d',
+ 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY',
+ 'translateZ'
+]
+const animateTypes2 = ['opacity', 'backgroundColor']
+const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']
+animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => {
+ MPAnimation.prototype[type] = function(...args) {
+ // #ifndef APP-NVUE
+ this.animation[type](...args)
+ // #endif
+ // #ifdef APP-NVUE
+ this._nvuePushAnimates(type, args)
+ // #endif
+ return this
+ }
+})
+
+export function createAnimation(option, _this) {
+ if(!_this) return
+ clearTimeout(_this.timer)
+ return new MPAnimation(option, _this)
+}
diff --git a/components/uni-transition/uni-transition.vue b/components/uni-transition/uni-transition.vue
new file mode 100644
index 0000000..0d739bd
--- /dev/null
+++ b/components/uni-transition/uni-transition.vue
@@ -0,0 +1,277 @@
+
+
+
+
+
+
+
diff --git a/pages.json b/pages.json
index a4a8727..cd690eb 100644
--- a/pages.json
+++ b/pages.json
@@ -1003,6 +1003,24 @@
// #endif
"navigationBarTitleText": "限时秒杀"
}
+ },
+ {
+ "path": "futures/details",
+ "style": {
+ // #ifdef H5
+ "navigationStyle": "custom",
+ // #endif
+ "navigationBarTitleText": "商品详情"
+ }
+ },
+ {
+ "path": "futures/my_shop",
+ "style": {
+ // #ifdef H5
+ "navigationStyle": "custom",
+ // #endif
+ "navigationBarTitleText": "我的小店"
+ }
}
@@ -1010,7 +1028,6 @@
-
]
},
{
diff --git a/pages_promotion/futures/details.vue b/pages_promotion/futures/details.vue
new file mode 100644
index 0000000..37e94db
--- /dev/null
+++ b/pages_promotion/futures/details.vue
@@ -0,0 +1,334 @@
+
+
+
+
+
+
+
+
+
+
+ 正在销售
+
+
+ {{ h }}:
+ {{ i }}:
+ {{ s }}
+
+
+
+
+
+ 脑黄金为智慧加分 澳大利亚进口保健品 适合中老年人长期熬夜人群使用
+
+ 售卖价格:¥1200/件
+
+
+ 采购价格:¥600.34
+
+
+
+ 采购数量:12件
+
+
+ 销售商:一颗柚子
+
+
+
+
+
+
+ 采购商品详情
+
+ 展开
+
+
+
+
+
+
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+ 这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
这里是富文本的监听内容
+
+
+
+
+
+ 添加备注
+ 立即采购
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages_promotion/futures/my_shop.vue b/pages_promotion/futures/my_shop.vue
new file mode 100644
index 0000000..65e3821
--- /dev/null
+++ b/pages_promotion/futures/my_shop.vue
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages_promotion/futures/seckill.vue b/pages_promotion/futures/seckill.vue
index 163cb68..c95a31f 100644
--- a/pages_promotion/futures/seckill.vue
+++ b/pages_promotion/futures/seckill.vue
@@ -32,7 +32,7 @@
采购价:¥1199.99
- 前去采购
+ 前去采购
@@ -58,9 +58,9 @@ export default {
// 倒计时
end_time: 1680170346,// 结束时间 时间戳
diff_time: 0,
- h: 0,
- i: 0,
- s: 0,
+ h: '00',
+ i: '00',
+ s: '00',
interval: '',
@@ -119,10 +119,6 @@ export default {
}
-
-
-
-
},
onBackPress(options) {
if (options.from === 'navigateBack') return false;
@@ -162,7 +158,7 @@ export default {
--size--: 45rpx;
background: #ffffff;
color: #fe7671;
- max-width: var(--size--);
+ min-width: calc(var(--size--) - 20rpx);
height: var(--size--);
border-radius: 10rpx;
display: inline-flex;