diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index a97fd25..4bbcf3c 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -14,6 +14,10 @@
{
"launchtype" : "local"
},
+ "mp-weixin" :
+ {
+ "launchtype" : "local"
+ },
"type" : "uniCloud"
}
]
diff --git a/apis/interfaces/scan.js b/apis/interfaces/scan.js
index 7208570..82c5faf 100644
--- a/apis/interfaces/scan.js
+++ b/apis/interfaces/scan.js
@@ -1,33 +1,33 @@
-/**
- * Web-zdx
- * moduleName:核销相关操作
- */
-
-import {
- request
-} from '../index'
-
-
-// 扫码前置条件 get 核销前置 post 表示核销
-const scanInfo = (apiUrl, data, method) => {
- return request({
- url: apiUrl,
- method: method,
- data: data
- })
-}
-
-// 核销记录
-const scanList = (apiUrl, data) => {
- return request({
- url: apiUrl,
- method: 'GET',
- data: data
- })
-}
-
-
-export {
- scanInfo,
- scanList
+/**
+ * Web-zdx
+ * moduleName:核销相关操作
+ */
+
+import {
+ request
+} from '../index'
+
+
+// 扫码前置条件 get 核销前置 post 表示核销
+const scanInfo = (apiUrl, data, method) => {
+ return request({
+ url: apiUrl,
+ method: method,
+ data: data
+ })
+}
+
+// 核销记录
+const scanList = (apiUrl, data) => {
+ return request({
+ url: apiUrl,
+ method: 'GET',
+ data: data
+ })
+}
+
+
+export {
+ scanInfo,
+ scanList
}
diff --git a/apis/interfaces/setting.js b/apis/interfaces/setting.js
new file mode 100644
index 0000000..956163f
--- /dev/null
+++ b/apis/interfaces/setting.js
@@ -0,0 +1,84 @@
+/**
+ * Web-zdx
+ * moduleName: 登录(手机号)
+ */
+
+import { request } from '../index'
+
+// 手机号登陆接口
+const login = (data) => {
+ return request({
+ url: 'user/socialite/login/wechat/mini',
+ method: 'POST',
+ data: data
+ })
+}
+// 修改用户信息
+const wechatbind = (data) => {
+ return request({
+ url: 'user/socialite/wechatbind',
+ method: 'PUT',
+ data: data
+ })
+}
+
+// 修改用户头像或昵称
+const resetUserInfo = (data) => {
+ return request({
+ url: 'user/' + data.key,
+ method: 'PUT',
+ data: {
+ value: data.value
+ }
+ })
+}
+
+// 获取用户的Openid
+const getOpenid = (code) => {
+ return request({
+ url: 'user/socialite/login/wechat/openid',
+ method: 'GET',
+ data: {
+ code: code
+ }
+ })
+
+}
+// 隐私条款
+const agreementSecret = (data) => {
+ return request({
+ url: 'articles/agreement/secret'
+ })
+}
+
+// 注册协议
+const agreementLogin = (data) => {
+ return request({
+ url: 'articles/agreement/login'
+ })
+}
+
+// 获取用户设置中心的信息
+const getUserSettingInfo = () => {
+ return request({
+ url: 'user/setting'
+ })
+}
+
+// 关于我们
+const aboutUs = () => {
+ return request({
+ url: 'articles/about'
+ })
+}
+
+export {
+ login,
+ wechatbind,
+ getOpenid,
+ agreementSecret,
+ agreementLogin,
+ resetUserInfo,
+ getUserSettingInfo,
+ aboutUs
+}
diff --git a/components/tn-datepicker/tn-datepicker.vue b/components/tn-datepicker/tn-datepicker.vue
index 8ca83fe..b6f926d 100644
--- a/components/tn-datepicker/tn-datepicker.vue
+++ b/components/tn-datepicker/tn-datepicker.vue
@@ -1,206 +1,206 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{date.title}}
-
-
-
-
- {{date.tips}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages.json b/pages.json
index 8340288..ecff9b5 100644
--- a/pages.json
+++ b/pages.json
@@ -1,118 +1,132 @@
{
"pages": [{
- "path": "pages/index/index",
- "name": "Index",
- "aliasPath": "/",
- "style": {
- "navigationBarTitleText":"发现能量"
+ "path": "pages/index/index",
+ "name": "Index",
+ "aliasPath": "/",
+ "style": {
+ "navigationBarTitleText": "发现能量"
}
}, {
- "path": "pages/found/index",
- "name": "Found",
- "auth": true,
- "style": {
- "navigationBarTitleText":"发现更多"
+ "path": "pages/found/index",
+ "name": "Found",
+ "auth": true,
+ "style": {
+ "navigationBarTitleText": "发现更多"
}
}, {
- "path": "pages/user/index",
- "name": "User",
- "auth": true,
- "style": {
- "navigationBarTitleText":"节点中心"
+ "path": "pages/user/index",
+ "name": "User",
+ "auth": true,
+ "style": {
+ "navigationBarTitleText": "节点中心"
}
}, {
- "path": "pages/instrument/basics",
- "name": "instrumentBasics",
- "style": {
- "navigationBarTitleText":"企业基础信息"
+ "path": "pages/instrument/basics",
+ "name": "instrumentBasics",
+ "style": {
+ "navigationBarTitleText": "企业基础信息"
}
}, {
- "path": "pages/goods/management",
- "name": "goodsManagement",
- "style": {
- "navigationBarTitleText":"商品权证管理"
+ "path": "pages/goods/management",
+ "name": "goodsManagement",
+ "style": {
+ "navigationBarTitleText": "商品权证管理"
}
}, {
- "path": "pages/goods/addClassify",
- "name": "goodsaddClassify",
- "style": {
- "navigationBarTitleText":"发布商品类目"
+ "path": "pages/goods/addClassify",
+ "name": "goodsaddClassify",
+ "style": {
+ "navigationBarTitleText": "发布商品类目"
}
}, {
- "path": "pages/goods/add",
- "name": "goodsAdd",
- "style": {
- "navigationBarTitleText":"商品权证创建"
+ "path": "pages/goods/add",
+ "name": "goodsAdd",
+ "style": {
+ "navigationBarTitleText": "商品权证创建"
}
}, {
- "path": "pages/goods/goodsAuth",
- "name": "goodsAddAuth",
- "style": {
- "navigationBarTitleText":"商品权证认证"
- }
+ "path": "pages/goods/goodsAuth",
+ "name": "goodsAddAuth",
+ "style": {
+ "navigationBarTitleText": "商品权证认证"
+ }
}, {
- "path": "pages/coupons/management",
- "name": "couponsManagement",
- "style": {
- "navigationBarTitleText":"优惠券管理"
- }
+ "path": "pages/coupons/management",
+ "name": "couponsManagement",
+ "style": {
+ "navigationBarTitleText": "创建优惠券"
+ }
}, {
- "path": "pages/coupons/add",
- "name": "couponsAdd",
- "style": {
- "navigationBarTitleText":"创建优惠券"
- }
+ "path": "pages/coupons/add",
+ "name": "couponsAdd",
+ "style": {
+ "navigationBarTitleText": "创建优惠券"
+ }
}, {
- "path": "pages/coupons/magDetails",
- "name": "couponsDetails",
- "style": {
- "navigationBarTitleText":"优惠券详情"
- }
+ "path": "pages/coupons/magDetails",
+ "name": "couponsDetails",
+ "style": {
+ "navigationBarTitleText": "优惠券详情"
+ }
}, {
- "path": "pages/coupons/selectGoods",
- "name": "couponsSelectGoods",
- "style": {
- "navigationBarTitleText":"关联产品"
- }
- }, {
- "path": "pages/login/login",
- "name": "Login",
- "style": {
- "navigationBarTitleText":"登录"
- }
- }, {
- "path" : "pages/certification/personal",
- "name" : "Personal",
- "auth" : true,
- "style": {
- "navigationBarTitleText":"个人认证"
- }
+ "path": "pages/coupons/selectGoods",
+ "name": "couponsSelectGoods",
+ "style": {
+ "navigationBarTitleText": "关联产品"
+ }
+ }, {
+ "path": "pages/login/login",
+ "name": "Login",
+ "style": {
+ "navigationBarTitleText": "登录"
+ }
+ }, {
+ "path": "pages/certification/personal",
+ "name": "Personal",
+ "auth": true,
+ "style": {
+ "navigationBarTitleText": "个人认证"
+ }
+ }, {
+ "path": "pages/setting/setting",
+ "name": "setting",
+ "auth": true,
+ "style": {
+ "navigationBarTitleText": "设置中心"
+ }
+ }, {
+ "path": "pages/setting/aboutUs",
+ "name": "aboutUs",
+ "auth": true,
+ "style": {
+ "navigationBarTitleText": "关于我们"
+ }
}],
"globalStyle": {
"navigationStyle": "custom",
"backgroundColor": "#F5F5F5"
},
- "tabBar": {
- "borderStyle": "white",
- "backgroundColor": "#FFFFFF",
- "selectedColor" : "#774ffd",
- "iconWidth":"26px",
- "spacing": "0",
- "height":"60px",
+ "tabBar": {
+ "borderStyle": "white",
+ "backgroundColor": "#FFFFFF",
+ "selectedColor": "#774ffd",
+ "iconWidth": "26px",
+ "spacing": "0",
+ "height": "60px",
"list": [{
- "text": "发现能量",
- "iconPath":"static/tabBar/tabBar_icon_00.png",
- "selectedIconPath":"static/tabBar/tabBar_show_00.png",
+ "text": "发现能量",
+ "iconPath": "static/tabBar/tabBar_icon_00.png",
+ "selectedIconPath": "static/tabBar/tabBar_show_00.png",
"pagePath": "pages/index/index"
}, {
- "text": "发现更多",
- "iconPath":"static/tabBar/tabBar_icon_01.png",
- "selectedIconPath":"static/tabBar/tabBar_show_01.png",
+ "text": "发现更多",
+ "iconPath": "static/tabBar/tabBar_icon_01.png",
+ "selectedIconPath": "static/tabBar/tabBar_show_01.png",
"pagePath": "pages/found/index"
}, {
- "text": "节点中心",
- "iconPath":"static/tabBar/tabBar_icon_02.png",
- "selectedIconPath":"static/tabBar/tabBar_show_02.png",
+ "text": "节点中心",
+ "iconPath": "static/tabBar/tabBar_icon_02.png",
+ "selectedIconPath": "static/tabBar/tabBar_show_02.png",
"pagePath": "pages/user/index"
}]
},
diff --git a/pages/certification/personal.vue b/pages/certification/personal.vue
index 227847d..33ffa42 100644
--- a/pages/certification/personal.vue
+++ b/pages/certification/personal.vue
@@ -73,9 +73,16 @@
front_card: this.positive.path,
back_card: this.reverse.path,
}).then(res=>{
- console.log(res)
+ uni.showModal({
+ title: '提示',
+ content: '个人认证信息已提交,请耐心等待审核',
+ showCancel: false,
+ confirmColor: '#8b64fd',
+ success: modalRes => {
+ this.$Router.back()
+ }
+ })
}).catch(err => {
- console.log(err)
uni.showToast({
icon: 'none',
title: err.message
diff --git a/pages/found/index.vue b/pages/found/index.vue
index 9d93727..706aafc 100644
--- a/pages/found/index.vue
+++ b/pages/found/index.vue
@@ -1,549 +1,549 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 原石 {{ account.coin }}
- 水晶 {{ account.crystal }}
-
-
-
-
-
-
-
-
- 水晶{{ item.amount || '-'}}
-
-
-
-
- 购物
-
-
-
-
-
-
-
- {{ item.remark }}
-
-
-
- {{ item.title }}
-
-
-
-
-
-
-
-
- 每日签到
-
- 累计天数越多。水晶奖励越多
-
-
-
- 立即签到
-
-
-
-
-
-
-
-
- +{{ item.crystal }}
- {{ item.text }}
-
-
- 再签到{{ sign.nextTask.day }}天额外赠送{{ sign.nextTask.diff }}个水晶奖励
-
-
-
-
-
- 水晶任务
-
-
-
-
-
- {{item.title || '-'}}
- {{item.remark || '-'}}
- {{item.tips || '-'}}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ 原石 {{ account.coin }}
+ 水晶 {{ account.crystal }}
+
+
+
+
+
+
+
+
+ 水晶{{ item.amount || '-'}}
+
+
+
+
+ 购物
+
+
+
+
+
+
+
+ {{ item.remark }}
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+ 每日签到
+
+ 累计天数越多。水晶奖励越多
+
+
+
+ 立即签到
+
+
+
+
+
+
+
+
+ +{{ item.crystal }}
+ {{ item.text }}
+
+
+ 再签到{{ sign.nextTask.day }}天额外赠送{{ sign.nextTask.diff }}个水晶奖励
+
+
+
+
+
+ 水晶任务
+
+
+
+
+
+ {{item.title || '-'}}
+ {{item.remark || '-'}}
+ {{item.tips || '-'}}
+
+
+
+
+
+
+
+
+
diff --git a/pages/goods/add.vue b/pages/goods/add.vue
index 441f033..02c9fb6 100644
--- a/pages/goods/add.vue
+++ b/pages/goods/add.vue
@@ -1,4 +1,4 @@
-
+
@@ -19,7 +19,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
@@ -69,7 +69,7 @@
元{{skus_unit != '' ? '/' + skus_unit : ''}}
-
+
@@ -169,15 +169,15 @@
-
-
-
-
-
+ }
+ }
+
+
+ }
+
diff --git a/pages/goods/goodsAuth.vue b/pages/goods/goodsAuth.vue
index 585dc8e..320340f 100644
--- a/pages/goods/goodsAuth.vue
+++ b/pages/goods/goodsAuth.vue
@@ -1,4 +1,4 @@
-
+
@@ -51,22 +51,22 @@
-
+
-
-
-
-
-
+ }
+ }
+
+
+ }
+
diff --git a/pages/goods/management.vue b/pages/goods/management.vue
index df68e74..31470bd 100644
--- a/pages/goods/management.vue
+++ b/pages/goods/management.vue
@@ -1,5 +1,5 @@
-
-
+
+
已发布
@@ -33,43 +33,43 @@
-
-
+
+ 数量
+
+
+ 确认
+
-
-
-
+
+
+
-
+ }
+ }
+
+
diff --git a/pages/index/deal.vue b/pages/index/deal.vue
index 535a8ba..3533994 100644
--- a/pages/index/deal.vue
+++ b/pages/index/deal.vue
@@ -101,16 +101,16 @@
diff --git a/pages/index/info.vue b/pages/index/info.vue
index 6781875..7f6d803 100644
--- a/pages/index/info.vue
+++ b/pages/index/info.vue
@@ -1,74 +1,74 @@
-
-
-
-
-
-
-
-
- {{ item.name || '-' }}
-
-
- {{ item.balance || '0.00' }}
- {{ item.symbol || '-' }}
-
-
-
-
-
- 区块链变化
-
-
-
-
-
-
- 区块记录
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ {{ item.name || '-' }}
+
+
+ {{ item.balance || '0.00' }}
+ {{ item.symbol || '-' }}
+
+
+
+
+
+ 区块链变化
+
+
+
+
+
+
+ 区块记录
+
+
+
+
+
+
+
-
-
diff --git a/pages/index/kline.vue b/pages/index/kline.vue
index 17932b4..b0a2013 100644
--- a/pages/index/kline.vue
+++ b/pages/index/kline.vue
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 5d02017..91f21c4 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -1,20 +1,22 @@
-
-
+
- 易品新境
+
+
+
+
+ 链商星球(中国)
+
+
+
+
-
+
-
-
+
+
@@ -25,86 +27,133 @@
- 未注册的手机号验证后将自动创建账号,登录即表示同意接收用户隐私规格和用户服务协议
-
-
-
+ 未注册的手机号验证后将自动创建账号,登录即表示同意接收用户隐私规格和用户服务协议
+
+
+
+
+
-
-
diff --git a/pages/setting/aboutUs.vue b/pages/setting/aboutUs.vue
new file mode 100644
index 0000000..d4b4769
--- /dev/null
+++ b/pages/setting/aboutUs.vue
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue
new file mode 100644
index 0000000..82949ad
--- /dev/null
+++ b/pages/setting/setting.vue
@@ -0,0 +1,432 @@
+
+
+
+
+
+
+
+
+ 修改头像
+
+
+
+
+
+
+
+
+
+
+ 修改昵称
+
+
+
+
+
+
+
+
+
+
+
+
+ 个人认证
+
+
+
+
+
+
+
+ 企业认证
+
+
+
+
+
+
+
+ 关于链商星球
+
+
+
+
+
+
+
+ 切换账户
+
+
+
+
+
+
+ 链商星球 beta 1.0.0
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/user/index.vue b/pages/user/index.vue
index 718388a..5cc5b36 100644
--- a/pages/user/index.vue
+++ b/pages/user/index.vue
@@ -8,6 +8,7 @@
成交客户
个人认证
企业认证
+ 设置中心
diff --git a/public/date.js b/public/date.js
index ca30b41..abb6103 100644
--- a/public/date.js
+++ b/public/date.js
@@ -1,9 +1,9 @@
-/**
- * Web唐明明
- * 匆匆数载恍如梦,岁月迢迢华发增。
- * 碌碌无为枉半生,一朝惊醒万事空。
- * moduleName: 日期
+/**
+ * Web唐明明
+ * 匆匆数载恍如梦,岁月迢迢华发增。
+ * 碌碌无为枉半生,一朝惊醒万事空。
+ * moduleName: 日期
*/
export default getDate = (type) =>{
diff --git a/public/userAuth.js b/public/userAuth.js
index 2349145..fd9b22b 100644
--- a/public/userAuth.js
+++ b/public/userAuth.js
@@ -1,16 +1,16 @@
-/**
- * Web唐明明
- * 匆匆数载恍如梦,岁月迢迢华发增。
- * 碌碌无为枉半生,一朝惊醒万事空。
- * moduleName: 登录
+/**
+ * Web唐明明
+ * 匆匆数载恍如梦,岁月迢迢华发增。
+ * 碌碌无为枉半生,一朝惊醒万事空。
+ * moduleName: 登录
*/
import { router } from '../router'
import { keyAuth } from '../apis/interfaces/auth'
import store from '../store'
-class userAuth {
+class userAuth {
constructor() {
this.univerfyConfig = {
fullScreen : true,
@@ -130,6 +130,6 @@ class userAuth {
updAuthToken(){
}
-}
-
+}
+
export default userAuth
diff --git a/scss/globa.scss b/scss/globa.scss
index 2876f60..6966e36 100644
--- a/scss/globa.scss
+++ b/scss/globa.scss
@@ -10,7 +10,7 @@ $text-color: #333;
$text-gray: #555;
$text-gray-m: #999;
$text-price: #8b64fd;
-$mian-color: #8b64fd;
+$mian-color: #b11eff;
$mian-color-deep: #824f9a;
// 边框颜色
diff --git a/static/imgs/company-icon.png b/static/imgs/company-icon.png
new file mode 100644
index 0000000..ad8e0f4
Binary files /dev/null and b/static/imgs/company-icon.png differ
diff --git a/static/imgs/link-wechat.png b/static/imgs/link-wechat.png
new file mode 100644
index 0000000..2775884
Binary files /dev/null and b/static/imgs/link-wechat.png differ
diff --git a/static/imgs/mine-about.png b/static/imgs/mine-about.png
new file mode 100644
index 0000000..88cca13
Binary files /dev/null and b/static/imgs/mine-about.png differ
diff --git a/static/imgs/mine-self-name.png b/static/imgs/mine-self-name.png
new file mode 100644
index 0000000..d527b4c
Binary files /dev/null and b/static/imgs/mine-self-name.png differ
diff --git a/static/imgs/no-avatar.png b/static/imgs/no-avatar.png
new file mode 100644
index 0000000..5ebdf71
Binary files /dev/null and b/static/imgs/no-avatar.png differ
diff --git a/static/imgs/reset-info.png b/static/imgs/reset-info.png
new file mode 100644
index 0000000..06e2ea6
Binary files /dev/null and b/static/imgs/reset-info.png differ
diff --git a/static/imgs/self-icon.png b/static/imgs/self-icon.png
new file mode 100644
index 0000000..09c8644
Binary files /dev/null and b/static/imgs/self-icon.png differ
diff --git a/static/imgs/top_bg.png b/static/imgs/top_bg.png
new file mode 100644
index 0000000..6f9be4a
Binary files /dev/null and b/static/imgs/top_bg.png differ
diff --git a/static/imgs/top_logo.png b/static/imgs/top_logo.png
new file mode 100644
index 0000000..5f56a8f
Binary files /dev/null and b/static/imgs/top_logo.png differ
diff --git a/static/imgs/user-avatar.png b/static/imgs/user-avatar.png
new file mode 100644
index 0000000..8f95acc
Binary files /dev/null and b/static/imgs/user-avatar.png differ
diff --git a/uni_modules/lime-f2/changelog.md b/uni_modules/lime-f2/changelog.md
index f565cda..d96c8d1 100644
--- a/uni_modules/lime-f2/changelog.md
+++ b/uni_modules/lime-f2/changelog.md
@@ -6,18 +6,18 @@
## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example)
## 0.4.9(2021-05-12)
- fix: 修复 百度平台 多个图表时 只生效一个的bug
-## 0.4.8(2021-05-10)
-- feat: 增加 `destroy` 方法,用于销毁实例
-- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片
-```js
-this.$refs.chart.canvasToTempFilePath({success: res => {
- console.log('tempFilePath:', res.tempFilePath)
-}})
-```
-## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example)
-
-## 0.4.7(2021-05-10)
-- chore: F2 版本更新至 3.8.7
+## 0.4.8(2021-05-10)
+- feat: 增加 `destroy` 方法,用于销毁实例
+- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片
+```js
+this.$refs.chart.canvasToTempFilePath({success: res => {
+ console.log('tempFilePath:', res.tempFilePath)
+}})
+```
+## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example)
+
+## 0.4.7(2021-05-10)
+- chore: F2 版本更新至 3.8.7
## 0.4.6(2021-05-05)
- docs: nvue 使用文档更新
## [代码示例:http://liangei.gitee.io/limeui/#/f2-example](http://liangei.gitee.io/limeui/#/f2-example)
diff --git a/uni_modules/lime-f2/components/lime-f2/canvas.js b/uni_modules/lime-f2/components/lime-f2/canvas.js
index e747e3a..0e107e5 100644
--- a/uni_modules/lime-f2/components/lime-f2/canvas.js
+++ b/uni_modules/lime-f2/components/lime-f2/canvas.js
@@ -1,121 +1,121 @@
-import {
- pixelRatio,
- sleep
-} from './utils';
-
-const UNI_CANVAS_CONTEXT_MAP = {
- // #ifndef MP-WEIXIN
- fillStyle: 'FillStyle',
- fontSize: 'FontSize',
- globalAlpha: 'GlobalAlpha',
- opacity: 'GlobalAlpha',
- lineCap: 'LineCap',
- lineJoin: 'LineJoin',
- lineWidth: 'LineWidth',
- miterLimit: 'MiterLimit',
- strokeStyle: 'StrokeStyle',
- textAlign: 'TextAlign',
- textBaseline: 'TextBaseline',
- shadow: 'Shadow',
- // #endif
- // #ifdef MP-TOUTIAO || H5 || APP-PLUS
- font: 'FontSize',
- // #endif
-};
-
-function strLen(str) {
- let len = 0;
- for (let i = 0; i < str.length; i++) {
- if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
- len++;
- } else {
- len += 2;
- }
- }
- return len;
-}
-
-// 头条小程序目前仅支持 setFontSize
-// f2 会将所有属性整合为 font 简写,从中提取 fontSize 支持
-const fontSizeReg = /(\d*\.?\d*)px/;
-const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g;
-export default (ctx) => {
- // #ifdef H5 || APP-PLUS
- ctx.uniTransform = ctx.transform
- ctx.transform = (...agrs) => {
- if (ctx.draw && agrs[6]) {
- agrs[4] *= pixelRatio
- agrs[5] *= pixelRatio
- }
- if (agrs.length > 6) {
- agrs.pop()
- }
- ctx.uniTransform(...agrs)
- }
- // #endif
- // #ifdef MP-ALIPAY
- ctx.canvasGetImageData = ctx.getImageData
- ctx.getImageData = null
- // #endif
- if (!ctx.getImageData) {
- ctx.getImageData = (...agrs) => {
- const [x, y, width, height] = agrs
- return new Promise(resolve => {
- const parms = {
- canvasId: ctx.id || ctx.canvasId,
- x,
- y,
- width,
- height,
- success: res => {
- resolve(res.data)
- }
- }
- // #ifndef MP-ALIPAY || MP-TOUTIAO
- uni.canvasGetImageData(parms)
- // #endif
- // #ifdef MP-ALIPAY || MP-TOUTIAO
- ctx.canvasGetImageData(parms)
- // #endif
- })
- }
- }
- // 钉钉小程序框架不支持 measureText 方法,用此方法 mock
- if (!ctx.measureText) {
- ctx.measureText = text => {
- let fontSize = 12;
- const font = ctx.__font;
- if (font) {
- fontSize = parseInt(font.split(' ')[3], 10);
- }
- fontSize /= 2;
- return {
- width: strLen(text) * fontSize
- };
- }
- }
- Object.keys(UNI_CANVAS_CONTEXT_MAP).forEach(key => {
- Object.defineProperty(ctx, key, {
- set(val) {
- const name = `set${UNI_CANVAS_CONTEXT_MAP[key]}`;
- if (!ctx[name]) {
- return;
- }
- if (key === 'font' && fontSizeReg.test(val)) {
- const match = fontSizeReg.exec(val);
- ctx[name](match[1]);
- return;
- }
- if (key === 'shadow' && Array.isArray(val)) {
- ctx[name](...val);
- return;
- }
- if(colorReg.test(val)) {
- val = val.replace(colorReg, '#$1$1$2$2$3$3')
- }
- ctx[name](val);
- }
- });
- });
- return ctx
+import {
+ pixelRatio,
+ sleep
+} from './utils';
+
+const UNI_CANVAS_CONTEXT_MAP = {
+ // #ifndef MP-WEIXIN
+ fillStyle: 'FillStyle',
+ fontSize: 'FontSize',
+ globalAlpha: 'GlobalAlpha',
+ opacity: 'GlobalAlpha',
+ lineCap: 'LineCap',
+ lineJoin: 'LineJoin',
+ lineWidth: 'LineWidth',
+ miterLimit: 'MiterLimit',
+ strokeStyle: 'StrokeStyle',
+ textAlign: 'TextAlign',
+ textBaseline: 'TextBaseline',
+ shadow: 'Shadow',
+ // #endif
+ // #ifdef MP-TOUTIAO || H5 || APP-PLUS
+ font: 'FontSize',
+ // #endif
+};
+
+function strLen(str) {
+ let len = 0;
+ for (let i = 0; i < str.length; i++) {
+ if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
+ len++;
+ } else {
+ len += 2;
+ }
+ }
+ return len;
+}
+
+// 头条小程序目前仅支持 setFontSize
+// f2 会将所有属性整合为 font 简写,从中提取 fontSize 支持
+const fontSizeReg = /(\d*\.?\d*)px/;
+const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g;
+export default (ctx) => {
+ // #ifdef H5 || APP-PLUS
+ ctx.uniTransform = ctx.transform
+ ctx.transform = (...agrs) => {
+ if (ctx.draw && agrs[6]) {
+ agrs[4] *= pixelRatio
+ agrs[5] *= pixelRatio
+ }
+ if (agrs.length > 6) {
+ agrs.pop()
+ }
+ ctx.uniTransform(...agrs)
+ }
+ // #endif
+ // #ifdef MP-ALIPAY
+ ctx.canvasGetImageData = ctx.getImageData
+ ctx.getImageData = null
+ // #endif
+ if (!ctx.getImageData) {
+ ctx.getImageData = (...agrs) => {
+ const [x, y, width, height] = agrs
+ return new Promise(resolve => {
+ const parms = {
+ canvasId: ctx.id || ctx.canvasId,
+ x,
+ y,
+ width,
+ height,
+ success: res => {
+ resolve(res.data)
+ }
+ }
+ // #ifndef MP-ALIPAY || MP-TOUTIAO
+ uni.canvasGetImageData(parms)
+ // #endif
+ // #ifdef MP-ALIPAY || MP-TOUTIAO
+ ctx.canvasGetImageData(parms)
+ // #endif
+ })
+ }
+ }
+ // 钉钉小程序框架不支持 measureText 方法,用此方法 mock
+ if (!ctx.measureText) {
+ ctx.measureText = text => {
+ let fontSize = 12;
+ const font = ctx.__font;
+ if (font) {
+ fontSize = parseInt(font.split(' ')[3], 10);
+ }
+ fontSize /= 2;
+ return {
+ width: strLen(text) * fontSize
+ };
+ }
+ }
+ Object.keys(UNI_CANVAS_CONTEXT_MAP).forEach(key => {
+ Object.defineProperty(ctx, key, {
+ set(val) {
+ const name = `set${UNI_CANVAS_CONTEXT_MAP[key]}`;
+ if (!ctx[name]) {
+ return;
+ }
+ if (key === 'font' && fontSizeReg.test(val)) {
+ const match = fontSizeReg.exec(val);
+ ctx[name](match[1]);
+ return;
+ }
+ if (key === 'shadow' && Array.isArray(val)) {
+ ctx[name](...val);
+ return;
+ }
+ if(colorReg.test(val)) {
+ val = val.replace(colorReg, '#$1$1$2$2$3$3')
+ }
+ ctx[name](val);
+ }
+ });
+ });
+ return ctx
}
diff --git a/uni_modules/lime-f2/components/lime-f2/index.vue b/uni_modules/lime-f2/components/lime-f2/index.vue
index 94bcf5a..8e3ef78 100644
--- a/uni_modules/lime-f2/components/lime-f2/index.vue
+++ b/uni_modules/lime-f2/components/lime-f2/index.vue
@@ -1,417 +1,417 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
index a747b9f..6ef26a2 100644
--- a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
+++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
@@ -1,45 +1,45 @@
-// #ifdef H5
-export default {
- name: 'Keypress',
- props: {
- disable: {
- type: Boolean,
- default: false
- }
- },
- mounted () {
- const keyNames = {
- esc: ['Esc', 'Escape'],
- tab: 'Tab',
- enter: 'Enter',
- space: [' ', 'Spacebar'],
- up: ['Up', 'ArrowUp'],
- left: ['Left', 'ArrowLeft'],
- right: ['Right', 'ArrowRight'],
- down: ['Down', 'ArrowDown'],
- delete: ['Backspace', 'Delete', 'Del']
- }
- const listener = ($event) => {
- if (this.disable) {
- return
- }
- const keyName = Object.keys(keyNames).find(key => {
- const keyName = $event.key
- const value = keyNames[key]
- return value === keyName || (Array.isArray(value) && value.includes(keyName))
- })
- if (keyName) {
- // 避免和其他按键事件冲突
- setTimeout(() => {
- this.$emit(keyName, {})
- }, 0)
- }
- }
- document.addEventListener('keyup', listener)
- this.$once('hook:beforeDestroy', () => {
- document.removeEventListener('keyup', listener)
- })
- },
- render: () => {}
-}
-// #endif
+// #ifdef H5
+export default {
+ name: 'Keypress',
+ props: {
+ disable: {
+ type: Boolean,
+ default: false
+ }
+ },
+ mounted () {
+ const keyNames = {
+ esc: ['Esc', 'Escape'],
+ tab: 'Tab',
+ enter: 'Enter',
+ space: [' ', 'Spacebar'],
+ up: ['Up', 'ArrowUp'],
+ left: ['Left', 'ArrowLeft'],
+ right: ['Right', 'ArrowRight'],
+ down: ['Down', 'ArrowDown'],
+ delete: ['Backspace', 'Delete', 'Del']
+ }
+ const listener = ($event) => {
+ if (this.disable) {
+ return
+ }
+ const keyName = Object.keys(keyNames).find(key => {
+ const keyName = $event.key
+ const value = keyNames[key]
+ return value === keyName || (Array.isArray(value) && value.includes(keyName))
+ })
+ if (keyName) {
+ // 避免和其他按键事件冲突
+ setTimeout(() => {
+ this.$emit(keyName, {})
+ }, 0)
+ }
+ }
+ document.addEventListener('keyup', listener)
+ this.$once('hook:beforeDestroy', () => {
+ document.removeEventListener('keyup', listener)
+ })
+ },
+ render: () => {}
+}
+// #endif
diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
index 7c8a0d3..291634c 100644
--- a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
+++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
@@ -1,263 +1,263 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue
index f6bbccd..f4c85e2 100644
--- a/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue
+++ b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue
@@ -1,143 +1,143 @@
-
-
+
+
+
-
+ }
+ }
+ }
+
+
diff --git a/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
index 3d9365a..705902d 100644
--- a/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
+++ b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
@@ -1,185 +1,185 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/en.json b/uni_modules/uni-popup/components/uni-popup/i18n/en.json
index 8c0f5f3..7f1bd06 100644
--- a/uni_modules/uni-popup/components/uni-popup/i18n/en.json
+++ b/uni_modules/uni-popup/components/uni-popup/i18n/en.json
@@ -1,6 +1,6 @@
-{
- "uni-popup.cancel": "cancel",
- "uni-popup.ok": "ok",
+{
+ "uni-popup.cancel": "cancel",
+ "uni-popup.ok": "ok",
"uni-popup.placeholder": "pleace enter",
"uni-popup.title": "Hint",
"uni-popup.shareTitle": "Share to"
diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/index.js b/uni_modules/uni-popup/components/uni-popup/i18n/index.js
index fa8f0f3..de7509c 100644
--- a/uni_modules/uni-popup/components/uni-popup/i18n/index.js
+++ b/uni_modules/uni-popup/components/uni-popup/i18n/index.js
@@ -1,8 +1,8 @@
-import en from './en.json'
-import zhHans from './zh-Hans.json'
-import zhHant from './zh-Hant.json'
-export default {
- en,
- 'zh-Hans': zhHans,
- 'zh-Hant': zhHant
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+import zhHant from './zh-Hant.json'
+export default {
+ en,
+ 'zh-Hans': zhHans,
+ 'zh-Hant': zhHant
}
diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json
index 8e5b99f..5e3003c 100644
--- a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json
+++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json
@@ -1,7 +1,7 @@
-{
- "uni-popup.cancel": "取消",
+{
+ "uni-popup.cancel": "取消",
"uni-popup.ok": "确定",
"uni-popup.placeholder": "请输入",
"uni-popup.title": "提示",
- "uni-popup.shareTitle": "分享到"
+ "uni-popup.shareTitle": "分享到"
}
diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json
index 06ce162..13e39eb 100644
--- a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json
+++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json
@@ -1,7 +1,7 @@
-{
- "uni-popup.cancel": "取消",
+{
+ "uni-popup.cancel": "取消",
"uni-popup.ok": "確定",
"uni-popup.placeholder": "請輸入",
"uni-popup.title": "提示",
- "uni-popup.shareTitle": "分享到"
+ "uni-popup.shareTitle": "分享到"
}
diff --git a/uni_modules/uni-popup/components/uni-popup/keypress.js b/uni_modules/uni-popup/components/uni-popup/keypress.js
index 16a5818..62dda46 100644
--- a/uni_modules/uni-popup/components/uni-popup/keypress.js
+++ b/uni_modules/uni-popup/components/uni-popup/keypress.js
@@ -1,45 +1,45 @@
-// #ifdef H5
-export default {
- name: 'Keypress',
- props: {
- disable: {
- type: Boolean,
- default: false
- }
- },
- mounted () {
- const keyNames = {
- esc: ['Esc', 'Escape'],
- tab: 'Tab',
- enter: 'Enter',
- space: [' ', 'Spacebar'],
- up: ['Up', 'ArrowUp'],
- left: ['Left', 'ArrowLeft'],
- right: ['Right', 'ArrowRight'],
- down: ['Down', 'ArrowDown'],
- delete: ['Backspace', 'Delete', 'Del']
- }
- const listener = ($event) => {
- if (this.disable) {
- return
- }
- const keyName = Object.keys(keyNames).find(key => {
- const keyName = $event.key
- const value = keyNames[key]
- return value === keyName || (Array.isArray(value) && value.includes(keyName))
- })
- if (keyName) {
- // 避免和其他按键事件冲突
- setTimeout(() => {
- this.$emit(keyName, {})
- }, 0)
- }
- }
- document.addEventListener('keyup', listener)
- // this.$once('hook:beforeDestroy', () => {
- // document.removeEventListener('keyup', listener)
- // })
- },
- render: () => {}
-}
-// #endif
+// #ifdef H5
+export default {
+ name: 'Keypress',
+ props: {
+ disable: {
+ type: Boolean,
+ default: false
+ }
+ },
+ mounted () {
+ const keyNames = {
+ esc: ['Esc', 'Escape'],
+ tab: 'Tab',
+ enter: 'Enter',
+ space: [' ', 'Spacebar'],
+ up: ['Up', 'ArrowUp'],
+ left: ['Left', 'ArrowLeft'],
+ right: ['Right', 'ArrowRight'],
+ down: ['Down', 'ArrowDown'],
+ delete: ['Backspace', 'Delete', 'Del']
+ }
+ const listener = ($event) => {
+ if (this.disable) {
+ return
+ }
+ const keyName = Object.keys(keyNames).find(key => {
+ const keyName = $event.key
+ const value = keyNames[key]
+ return value === keyName || (Array.isArray(value) && value.includes(keyName))
+ })
+ if (keyName) {
+ // 避免和其他按键事件冲突
+ setTimeout(() => {
+ this.$emit(keyName, {})
+ }, 0)
+ }
+ }
+ document.addEventListener('keyup', listener)
+ // this.$once('hook:beforeDestroy', () => {
+ // document.removeEventListener('keyup', listener)
+ // })
+ },
+ render: () => {}
+}
+// #endif
diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js
index a37fb9f..c4e5781 100644
--- a/uni_modules/uni-popup/components/uni-popup/popup.js
+++ b/uni_modules/uni-popup/components/uni-popup/popup.js
@@ -1,9 +1,9 @@
-export default {
- data() {
- return {
-
- }
+export default {
+ data() {
+ return {
+
+ }
},
created(){
this.popup = this.getParent()
@@ -22,5 +22,5 @@ export default {
}
return parent;
},
- }
-}
+ }
+}
diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue
index 32419d8..59698b7 100644
--- a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue
+++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue
@@ -1,240 +1,240 @@
-
+
-
-
-
-
diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md
index 2c33b5e..dca8178 100644
--- a/uni_modules/uni-transition/changelog.md
+++ b/uni_modules/uni-transition/changelog.md
@@ -1,13 +1,13 @@
## 1.2.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
-## 1.1.1(2021-05-12)
-- 新增 示例地址
-- 修复 示例项目缺少组件的Bug
-## 1.1.0(2021-04-22)
-- 新增 通过方法自定义动画
-- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式
-- 优化 动画触发逻辑,使动画更流畅
-- 优化 支持单独的动画类型
-- 优化 文档示例
-## 1.0.2(2021-02-05)
-- 调整为uni_modules目录规范
+## 1.1.1(2021-05-12)
+- 新增 示例地址
+- 修复 示例项目缺少组件的Bug
+## 1.1.0(2021-04-22)
+- 新增 通过方法自定义动画
+- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式
+- 优化 动画触发逻辑,使动画更流畅
+- 优化 支持单独的动画类型
+- 优化 文档示例
+## 1.0.2(2021-02-05)
+- 调整为uni_modules目录规范
diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js
index af47dbc..5f54365 100644
--- a/uni_modules/uni-transition/components/uni-transition/createAnimation.js
+++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js
@@ -1,128 +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 = ''
+// 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
+ }
+ 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
- }
- }
-
+ 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.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) {
+ this.next++
+ // #endif
+ return this
+ }
+
+ run(fn) {
// #ifndef APP-NVUE
- this.$.animationData = this.animation.export()
+ this.$.animationData = this.animation.export()
this.$.timer = setTimeout(() => {
- typeof fn === 'function' && fn()
- }, this.$.durationTime)
- // #endif
- // #ifdef APP-NVUE
+ 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) {
+ 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
- }
-})
-
+ // #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)
+ if(!_this) return
+ clearTimeout(_this.timer)
+ return new MPAnimation(option, _this)
}
diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue
index 5a16f89..69ff9d9 100644
--- a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue
+++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue
@@ -1,277 +1,277 @@
-
-
-
-
-
-
+ return this
+ },
+ /**
+ * ref 触发 执行动画
+ */
+ run(fn) {
+ if (!this.animation) return
+ this.animation.run(fn)
+ },
+ // 开始过度动画
+ open() {
+ clearTimeout(this.timer)
+ this.transform = ''
+ this.isShow = true
+ let { opacity, transform } = this.styleInit(false)
+ if (typeof opacity !== 'undefined') {
+ this.opacity = opacity
+ }
+ this.transform = transform
+ // 确保动态样式已经生效后,执行动画,如果不加 nextTick ,会导致 wx 动画执行异常
+ this.$nextTick(() => {
+ // TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器
+ this.timer = setTimeout(() => {
+ this.animation = createAnimation(this.config, this)
+ this.tranfromInit(false).step()
+ this.animation.run()
+ this.$emit('change', {
+ detail: this.isShow
+ })
+ }, 20)
+ })
+ },
+ // 关闭过度动画
+ close(type) {
+ if (!this.animation) return
+ this.tranfromInit(true)
+ .step()
+ .run(() => {
+ this.isShow = false
+ this.animationData = null
+ this.animation = null
+ let { opacity, transform } = this.styleInit(false)
+ this.opacity = opacity || 1
+ this.transform = transform
+ this.$emit('change', {
+ detail: this.isShow
+ })
+ })
+ },
+ // 处理动画开始前的默认样式
+ styleInit(type) {
+ let styles = {
+ transform: ''
+ }
+ let buildStyle = (type, mode) => {
+ if (mode === 'fade') {
+ styles.opacity = this.animationType(type)[mode]
+ } else {
+ styles.transform += this.animationType(type)[mode] + ' '
+ }
+ }
+ if (typeof this.modeClass === 'string') {
+ buildStyle(type, this.modeClass)
+ } else {
+ this.modeClass.forEach(mode => {
+ buildStyle(type, mode)
+ })
+ }
+ return styles
+ },
+ // 处理内置组合动画
+ tranfromInit(type) {
+ let buildTranfrom = (type, mode) => {
+ let aniNum = null
+ if (mode === 'fade') {
+ aniNum = type ? 0 : 1
+ } else {
+ aniNum = type ? '-100%' : '0'
+ if (mode === 'zoom-in') {
+ aniNum = type ? 0.8 : 1
+ }
+ if (mode === 'zoom-out') {
+ aniNum = type ? 1.2 : 1
+ }
+ if (mode === 'slide-right') {
+ aniNum = type ? '100%' : '0'
+ }
+ if (mode === 'slide-bottom') {
+ aniNum = type ? '100%' : '0'
+ }
+ }
+ this.animation[this.animationMode()[mode]](aniNum)
+ }
+ if (typeof this.modeClass === 'string') {
+ buildTranfrom(type, this.modeClass)
+ } else {
+ this.modeClass.forEach(mode => {
+ buildTranfrom(type, mode)
+ })
+ }
+
+ return this.animation
+ },
+ animationType(type) {
+ return {
+ fade: type ? 1 : 0,
+ 'slide-top': `translateY(${type ? '0' : '-100%'})`,
+ 'slide-right': `translateX(${type ? '0' : '100%'})`,
+ 'slide-bottom': `translateY(${type ? '0' : '100%'})`,
+ 'slide-left': `translateX(${type ? '0' : '-100%'})`,
+ 'zoom-in': `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
+ 'zoom-out': `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
+ }
+ },
+ // 内置动画类型与实际动画对应字典
+ animationMode() {
+ return {
+ fade: 'opacity',
+ 'slide-top': 'translateY',
+ 'slide-right': 'translateX',
+ 'slide-bottom': 'translateY',
+ 'slide-left': 'translateX',
+ 'zoom-in': 'scale',
+ 'zoom-out': 'scale'
+ }
+ },
+ // 驼峰转中横线
+ toLine(name) {
+ return name.replace(/([A-Z])/g, '-$1').toLowerCase()
+ }
+ }
+}
+
+
diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json
index 481270d..0a709c9 100644
--- a/uni_modules/uni-transition/package.json
+++ b/uni_modules/uni-transition/package.json
@@ -1,83 +1,83 @@
-{
- "id": "uni-transition",
- "displayName": "uni-transition 过渡动画",
- "version": "1.2.0",
- "description": "元素的简单过渡动画",
- "keywords": [
- "uni-ui",
- "uniui",
- "动画",
- "过渡",
- "过渡动画"
-],
- "repository": "https://github.com/dcloudio/uni-ui",
- "engines": {
- "HBuilderX": ""
- },
- "directories": {
- "example": "../../temps/example_temps"
- },
- "dcloudext": {
- "category": [
- "前端组件",
- "通用组件"
- ],
- "sale": {
- "regular": {
- "price": "0.00"
- },
- "sourcecode": {
- "price": "0.00"
- }
- },
- "contact": {
- "qq": ""
- },
- "declaration": {
- "ads": "无",
- "data": "无",
- "permissions": "无"
- },
- "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
- },
- "uni_modules": {
- "dependencies": [],
- "encrypt": [],
- "platforms": {
- "cloud": {
- "tcb": "y",
- "aliyun": "y"
- },
- "client": {
- "App": {
- "app-vue": "y",
- "app-nvue": "y"
- },
- "H5-mobile": {
- "Safari": "y",
- "Android Browser": "y",
- "微信浏览器(Android)": "y",
- "QQ浏览器(Android)": "y"
- },
- "H5-pc": {
- "Chrome": "y",
- "IE": "y",
- "Edge": "y",
- "Firefox": "y",
- "Safari": "y"
- },
- "小程序": {
- "微信": "y",
- "阿里": "y",
- "百度": "y",
- "字节跳动": "y",
- "QQ": "y"
- },
- "快应用": {
- "华为": "u",
- "联盟": "u"
- }
- }
- }
- }
+{
+ "id": "uni-transition",
+ "displayName": "uni-transition 过渡动画",
+ "version": "1.2.0",
+ "description": "元素的简单过渡动画",
+ "keywords": [
+ "uni-ui",
+ "uniui",
+ "动画",
+ "过渡",
+ "过渡动画"
+],
+ "repository": "https://github.com/dcloudio/uni-ui",
+ "engines": {
+ "HBuilderX": ""
+ },
+ "directories": {
+ "example": "../../temps/example_temps"
+ },
+ "dcloudext": {
+ "category": [
+ "前端组件",
+ "通用组件"
+ ],
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ }
+ }
+ }
+ }
}
\ No newline at end of file