From 1e827fb42a6724970a14d2c9a89bb4c1322508f5 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Sat, 18 Sep 2021 10:41:44 +0800 Subject: [PATCH] no message --- components/notice-bar3/index.js | 121 ---------------------------- components/notice-bar3/index.json | 4 - components/notice-bar3/index.wxml | 15 ---- components/notice-bar3/index.wxss | 45 ----------- components/notice-bar3/node-util.js | 49 ----------- 5 files changed, 234 deletions(-) delete mode 100644 components/notice-bar3/index.js delete mode 100644 components/notice-bar3/index.json delete mode 100644 components/notice-bar3/index.wxml delete mode 100644 components/notice-bar3/index.wxss delete mode 100644 components/notice-bar3/node-util.js diff --git a/components/notice-bar3/index.js b/components/notice-bar3/index.js deleted file mode 100644 index d9c5846..0000000 --- a/components/notice-bar3/index.js +++ /dev/null @@ -1,121 +0,0 @@ -import nodeUtil from './node-util'; - -Component({ - externalClasses: ['l-class', 'l-icon-class'], - options: { - addGlobalClass: true, - }, - properties: { - type: { - type: String, - value: 'still' - }, - // 轮播数组 - swipArr: Array, - // 前置图标 - icon: { - type: String, - value: '' - }, - endIconSize: { - type: Number, - value: 28 - }, - endIconColor: { - type: String, - value: '#3683D6' - }, - // 背景颜色 - backgroundcolor: { - type: String, - value: '#DFEDFF' - }, - // 字体及图标颜色 - color: { - type: String, - value: '#333333' - }, - // 滚动速度 - speed: { - type: Number, - value: 1500 - }, - show: { - type: Boolean, - value: true - }, - loop: { - type: Boolean, - value: false - }, - close: { - type: Boolean, - value: false - } - }, - data: { - wrapWidth: 0, - width: 0, - duration: 0, - animation: null, - timer: null, - }, - detached() { - this.destroyTimer() - }, - ready() { - if (this.properties.type === 'roll' && this.properties.show) { - this.initAnimation() - } - }, - methods: { - async initAnimation() { - if(!this.data.animation){ - const rect = await nodeUtil.getNodeRectFromComponent(this, '.l-noticebar-content') - const wrapRect = await nodeUtil.getNodeRectFromComponent(this, '.l-noticebar-content-wrap') - const duration = rect.width / 40 * this.data.speed - const animation = wx.createAnimation({ duration: duration, timingFunction: 'linear' }) - this.setData({ wrapWidth: wrapRect.width, width: rect.width, duration: duration, animation: animation}, () => { - this.startAnimation() - }) - } - }, - startAnimation() { - //reset - if (this.data.animation.option.transition.duration !== 0) { - this.data.animation.option.transition.duration = 0 - const resetAnimation = this.data.animation.translateX(this.data.wrapWidth).step() - this.setData({ animationData: resetAnimation.export() }) - } - this.data.animation.option.transition.duration = this.data.duration; - const animationData = this.data.animation.translateX(-this.data.width).step() - setTimeout(() => { this.setData({ animationData: animationData.export() }) }, 100) - const timer = setTimeout(() => { - this.startAnimation() - if(this.data.loop){ - this.triggerEvent('loop') - } - }, this.data.duration) - this.setData({ timer }) - }, - destroyTimer() { - if (this.data.timer) { - clearTimeout(this.data.timer) - } - }, - handleTap() { - this.triggerEvent('click', {}, { bubbles: true, composed: true }) - this.setData({ timer: null }) - }, - onSwip(e) { - this.triggerEvent('lintap', { ...e.currentTarget.dataset }, { bubbles: true, composed: true }) - }, - onIconTap() { - this.triggerEvent('linicontap', {}, { bubbles: true, composed: true }) - this.setData({ timer: null }) - }, - onClose() { - this.setData({ timer: null, show: false }) - } - } -}) diff --git a/components/notice-bar3/index.json b/components/notice-bar3/index.json deleted file mode 100644 index 7e37c03..0000000 --- a/components/notice-bar3/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/components/notice-bar3/index.wxml b/components/notice-bar3/index.wxml deleted file mode 100644 index 9e7ea07..0000000 --- a/components/notice-bar3/index.wxml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - {{item}} - - - - - - - - - diff --git a/components/notice-bar3/index.wxss b/components/notice-bar3/index.wxss deleted file mode 100644 index 9df4915..0000000 --- a/components/notice-bar3/index.wxss +++ /dev/null @@ -1,45 +0,0 @@ -.l-noticebar { - display: flex; - height: 60rpx; - width: 750rpx; - line-height: 60rpx; - padding-right: 32rpx; - font-size: 28rpx; - /* color: #008AFF; */ - /* background-color: #dfedff; */ - overflow: hidden; -} - -.l-noticebar-icon { - display: flex; - margin-left: 32rpx; - margin-right: 8rpx; - align-items: center -} - -.l-noticebar-icon+.l-noticebar-content-wrap-view { - margin-left: 5rpx; -} - -.l-noticebar-operation { - display: flex; - margin-right: 16rpx; - margin-left: 8rpx; - align-items: center -} - -.l-noticebar-content-wrap { - display: flex; - margin-left: 5rpx; - flex: 1; - height: 60rpx; - position: relative; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap -} - -.l-noticebar-content-wrap .l-noticebar-content { - position: absolute; - transition-duration: 20s -} \ No newline at end of file diff --git a/components/notice-bar3/node-util.js b/components/notice-bar3/node-util.js deleted file mode 100644 index 2bc81db..0000000 --- a/components/notice-bar3/node-util.js +++ /dev/null @@ -1,49 +0,0 @@ -class NodeUtil { - /** - * 获取组件内部节点位置信息(单个) - * @param component 组件实例 - * @param selector {String} css选择器 - * @returns boundingClientRect() 回调函数的值 - */ - async getNodeRectFromComponent(component, selector) { - return await new Promise((resolve) => { - component - .createSelectorQuery() - .select(selector) - .boundingClientRect((res) => { - resolve(res); - }).exec(); - }); - } - - /** - * 获取组件内部节点位置信息(多个) - * @param component 组件实例 - * @param selector {String} css选择器 - * @returns boundingClientRect() 回调函数的值 - */ - async getNodesRectFromComponent(component, selector) { - return await new Promise((resolve) => { - component - .createSelectorQuery() - .selectAll(selector) - .boundingClientRect((res) => { - resolve(res); - }).exec(); - }); - } - - async getNodeFieldsFromComponent(component, selector, fields) { - return await new Promise((resolve) => { - component - .createSelectorQuery() - .select(selector) - .fields(fields, (res) => { - resolve(res); - }).exec(); - }); - } -} - -const nodeUtil = new NodeUtil(); -export default nodeUtil;