@@ -143,9 +143,11 @@
title: "Apple",
code: "APPLE",
},
- ],
+ ],
+ initurl:false
};
- },
+ },
+
onShow() {
//#ifdef H5
let isWXBrowser = /micromessenger/i.test(navigator.userAgent);
@@ -282,13 +284,26 @@
}
},
},
- onLoad(options) {
+ onLoad(options) {
+ if(options.init=='index'){
+ this.initurl = true
+ }
console.log((options))
if (options && options.state) {
this.stateLogin(options.state);
- }
+ }
+
},
- methods: {
+ methods: {
+ customback(){
+ if(this.initurl){
+ uni.switchTab({
+ url:'/pages/tabbar/vlog/index?init=ok'
+ })
+ }else{
+ uni.navigateBack()
+ }
+ },
//联合信息返回登录
stateLogin(state) {
loginCallback(state).then((res) => {
diff --git a/pages/publish/preview.nvue b/pages/publish/preview.nvue
index ee9a8374..0f133aa5 100755
--- a/pages/publish/preview.nvue
+++ b/pages/publish/preview.nvue
@@ -1,7 +1,7 @@
-
+
@@ -240,29 +241,30 @@
right: 0;
top: 0;
bottom: 0;
- background-color: #181b27;
+ background-color: #181b27;
}
- .main-body-img {
+ .main-body-img-m {
+ min-height: 400rpx;
/* width: 750rpx; */
- flex: 1;
border: 2rpx solid #545456;
border-radius: 20rpx;
- align-self: center;
+ align-items: center;
}
.choose-cover-text {
color: #ffffff;
font-size: 28rpx;
- align-self: center;
+ align-items: center;
}
.choose-cover {
display: flex;
flex-direction: column;
justify-content: center;
- margin-left: 100rpx;
+ margin-left: 100rpx;
+ margin-top: 10px;
width: 200rpx;
height: 100rpx;
position: relative;
@@ -273,13 +275,13 @@
.preplay-icon {
width: 22rpx;
height: 22rpx;
- align-self: center;
+ align-items: center;
}
.preplay-text {
color: #e6e6e6;
font-size: 28rpx;
- align-self: center;
+ align-items: center;
margin-left: 15rpx;
}
@@ -292,7 +294,7 @@
}
.main-body-content {
- display: flex;
+ /* display: flex; */
flex-direction: row;
justify-content: flex-start;
@@ -314,30 +316,34 @@
.btn-text {
color: #e6e6e6;
font-size: 36rpx;
- align-self: center;
+ align-items: center;
font-weight: 500;
}
- .btn {
+ .mbtn {
margin-top: 30rpx;
height: 90rpx;
- display: flex;
- justify-content: center;
- border-radius: 40rpx;
+ /* display: flex; */
+ justify-content: center;
+ align-items: center;
+ border-radius: 40rpx;
+ border: transparent;
}
.btn-publish {
- background-color: #ef274d;
+ background-color: #ef274d;
+ overflow: hidden;
}
.btn-publish-touched {
- background-color: #de6981;
+ background-color: #de6981;
+ overflow: hidden;
}
.main-body {
margin-top: 20rpx;
-
+ padding: 0 20rpx;
}
.line {
@@ -347,7 +353,7 @@
}
.progress {
- margintop: 60rpx;
+ margin-top: 60rpx;
display: flex;
flex-direction: column;
justify-content: center;
@@ -364,6 +370,6 @@
.progress-img {
width: 600rpx;
height: 600rpx;
- align-self: center;
+ align-items: center;
}
\ No newline at end of file
diff --git a/pages/tabbar/im/index.vue b/pages/tabbar/im/index.vue
index 580a7b8e..87446759 100644
--- a/pages/tabbar/im/index.vue
+++ b/pages/tabbar/im/index.vue
@@ -1,285 +1,3 @@
-
-
-
-
-
-
+
im
+
\ No newline at end of file
diff --git a/pages/tabbar/vlog/index.nvue b/pages/tabbar/vlog/index.nvue
index a61b856b..f6ff22b1 100644
--- a/pages/tabbar/vlog/index.nvue
+++ b/pages/tabbar/vlog/index.nvue
@@ -1,5 +1,5 @@
-
+
-->
-
+
{
this.selectorQuery();
clearTimeout(timer)
- },100)
+ },300);
},
onTabItemTap: function(e) {
@@ -163,10 +163,13 @@
// me.playStatus = true;
// me.playFollowStatus = false;
// }
- },
+ },
onShow() {
let me = this;
- this.myUserInfo = storage.getVlogUserInfo() || null;
+ if(uni.getStorageSync('refreshVlogIndex')=='1'){
+ storage.setRefreshVlogIndex('0') //不需要刷新
+ this.$refs.videoComp.displayVideoPaging(1, true);
+ }
// 如果当前没有list, 则relaunch
if (this.$refs.videoComp != undefined) {
@@ -209,16 +212,16 @@
},
// 当前页下拉刷新
- onPullDownRefresh() {
- var me = this;
- // 下拉刷新判断,如果是不同tab,那么组件中刷新的请求也不同
- if (me.curIndex == 0) {
- this.$refs.videoFollowComp.displayVideoPaging(1, true);
- } else if (me.curIndex == 1) {
- this.$refs.videoComp.displayVideoPaging(1, true);
- }
+ // onPullDownRefresh() {
+ // var me = this;
+ // // 下拉刷新判断,如果是不同tab,那么组件中刷新的请求也不同
+ // if (me.curIndex == 0) {
+ // this.$refs.videoFollowComp.displayVideoPaging(1, true);
+ // } else if (me.curIndex == 1) {
+ // this.$refs.videoComp.displayVideoPaging(1, true);
+ // }
- },
+ // },
methods: {
// 前往搜索页面
goSearch() {
@@ -266,8 +269,9 @@
});
},
- onswiperscroll(e) {
- var offsetX = e.detail.dx;
+ onswiperscroll(e) {
+ // if(!this.tabListSize[this._lastTabIndex]) return
+ var offsetX = e.detail.dx;
var preloadIndex = this._lastTabIndex;
if (offsetX > TAB_PRELOAD_OFFSET) {
preloadIndex++;
@@ -282,7 +286,7 @@
if (obj.playerList.length === 0) {
// this.loadTabData(preloadIndex);
}
-
+ // console.log(this.tabListSize)
var percentage = Math.abs(this.swiperWidth / offsetX);
var currentSize = this.tabListSize[this._lastTabIndex];
var preloadSize = this.tabListSize[preloadIndex];
@@ -290,27 +294,35 @@
var lineW = currentSize.width + (preloadSize.width - currentSize.width) / percentage;
this.updateIndicator(lineL, lineW);
},
- animationfinish(e) {
- let index = e.detail.current;
- this._lastTabIndex = index;
- this.switchTab(index);
- this.updateIndicator(this.tabListSize[index].left, this.tabListSize[index].width);
+ animationfinish(e) {
+ let index = e.detail.current;
+ this._lastTabIndex = index;
+ this.switchTab(index);
+ if(!this.tabListSize[index]) {
+ return
+ }else{
+ this.updateIndicator(this.tabListSize[index].left, this.tabListSize[index].width);
+ }
+
},
updateIndicator(left, width) {
- // console.log(left)
- // console.log(width)
- this.indicatorLineLeft = left
+ this.indicatorLineLeft = left;
this.indicatorLineWidth = width;
},
switchTab(index) {
// console.dir(this.$refs)
- let props = this.pageList[index]
+ let props = this.pageList[index]
+ console.log(props)
+ console.log(index)
let obj = this.$refs[props]
- if (obj.playerList.length === 0) {
- // this.loadTabData(index);
- }
+ // if (obj.playerList.length === 0) {
+ // var info = storage.getVlogUserInfo() || null
+ // if(info!=null&&index==0){
+ // obj.displayVideoPaging(this.page + 1, true);
+ // }
+ // }
obj.setScrollRef(this._headHeight);
@@ -368,15 +380,15 @@
this.switchTab(current)
this.curIndex = current;
this.tabIndex = current
- this.playFollowStatus = this.curIndex === 1 ? true : false;
- this.playStatus = this.curIndex === 2 ? true : false;
+ this.playFollowStatus = this.curIndex === 0 ? true : false;
+ this.playStatus = this.curIndex === 1 ? true : false;
},
// 点击头部选项卡,切换页面
tapFollow: function(current) {
this.curIndex = current;
this.tabIndex = current
- this.playFollowStatus = this.curIndex === 1 ? true : false;
- this.playStatus = this.curIndex === 2 ? true : false;
+ this.playFollowStatus = this.curIndex === 0 ? true : false;
+ this.playStatus = this.curIndex === 1 ? true : false;
},
// 下拉刷新,改变head的字样显示
@@ -395,7 +407,7 @@
diff --git a/uni_modules/Sansnn-uQRCode/package.json b/uni_modules/Sansnn-uQRCode/package.json
new file mode 100755
index 00000000..5ed666fa
--- /dev/null
+++ b/uni_modules/Sansnn-uQRCode/package.json
@@ -0,0 +1,78 @@
+{
+ "id": "Sansnn-uQRCode",
+ "displayName": "uQRCode 二维码生成插件",
+ "version": "2.0.23",
+ "description": "uQRCode 是一款使用方式简单,易于扩展的二维码生成插件。",
+ "keywords": [
+ "uQRCode",
+ "二维码",
+ "qrcode"
+],
+ "repository": "https://github.com/Sansnn/uQRCode",
+ "engines": {
+ "HBuilderX": "^3.1.0"
+ },
+ "dcloudext": {
+ "category": [
+ "JS SDK",
+ "通用 SDK"
+ ],
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "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",
+ "阿里": "u",
+ "百度": "u",
+ "字节跳动": "u",
+ "QQ": "u"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/Sansnn-uQRCode/readme.md b/uni_modules/Sansnn-uQRCode/readme.md
new file mode 100755
index 00000000..bda5bc6b
--- /dev/null
+++ b/uni_modules/Sansnn-uQRCode/readme.md
@@ -0,0 +1,167 @@
+# uQRCode
+
+uQRCode 生成方式简单,可扩展性高,如有复杂需求可通过自定义组件或修改源码完成需求。已测试H5、微信小程序、iPhoneXsMax真机。
+
+支持自定义二维码渲染规则,可通过 ``getModules`` 方法得到矩阵信息后,自行实现canvas渲染二维码,如随机颜色、圆点、方块、块与块之间的间距等,详情见示例中的 ``custom``。
+
+支持nvue生成,但暂不支持保存。
+
+### 二维码
+**什么是QR码**
+
+QR码属于矩阵式二维码中的一个种类,由DENSO(日本电装)公司开发,由JIS和ISO将其标准化。
+
+**QR码的特点**
+
+一是高速读取(QR就是取自“Quick Response”的首字母),通过摄像头从拍摄到解码到显示内容也就三秒左右,对摄像的角度也没有什么要求;
+
+二是高容量、高密度,理论上内容经过压缩处理后可以存7089个数字,4296个字母和数字混合字符,2953个8位字节数据,1817个汉字;
+
+三是支持纠错处理,按照QR码的标准文档说明,QR码的纠错分为4个级别,分别是:
+- level L : 最大 7% 的错误能够被纠正;
+- level M : 最大 15% 的错误能够被纠正;
+- level Q : 最大 25% 的错误能够被纠正;
+- level H : 最大 30% 的错误能够被纠正;
+
+四是结构化,看似无规则的图形,其实对区域有严格的定义。
+
+更多二维码介绍及原理:[https://blog.csdn.net/jason_ldh/article/details/11801355](https://blog.csdn.net/jason_ldh/article/details/11801355)
+
+### 简单使用
+
+在 ``template`` 中创建 ```` 并设置 ``ref`` 属性
+
+```html
+
+```
+
+在 ``script`` 中调用生成方法
+
+```javascript
+export default {
+ onReady() {
+ this.$refs
+ .uqrcode
+ .make({
+ size: 354,
+ text: 'uQRCode'
+ })
+ .then(res => {
+ // 返回的res与uni.canvasToTempFilePath返回一致
+ console.log(res)
+ })
+ }
+}
+```
+
+### 高级使用
+
+在 ``template`` 中创建 ```` 并设置 ``id``,画布宽高
+
+```html
+
+```
+
+在 ``script`` 中引用js文件并调用生成方法
+
+```javascript
+import uQRCode from '@/components/uqrcode/common/uqrcode.js'
+
+export default {
+ onReady() {
+ uQRCode.make({
+ canvasId: 'qrcode',
+ componentInstance: this,
+ size: 354,
+ margin: 10,
+ text: 'uQRCode',
+ backgroundColor: '#ffffff',
+ foregroundColor: '#ff0000',
+ fileType: 'png',
+ errorCorrectLevel: uQRCode.errorCorrectLevel.H
+ })
+ .then(res => {
+ console.log(res)
+ })
+ }
+}
+```
+
+### 属性说明
+
+|属性名|说明|
+|---|:---|
+|errorCorrectLevel|纠错等级,包含 `errorCorrectLevel.L`、`errorCorrectLevel.M`、`errorCorrectLevel.Q`、`errorCorrectLevel.H` 四个级别,`L`: 最大 7% 的错误能够被纠正;`M`: 最大 15% 的错误能够被纠正;`Q`: 最大 25% 的错误能够被纠正;`H`: 最大 30% 的错误能够被纠正。|
+|defaults|二维码生成参数的默认值。|
+
+### 方法说明
+
+|方法名|说明|
+|---|:---|
+|[make](#makeoptions)|生成二维码。|
+|[getModules](#getModulesoptions)|可以得到二维码矩阵信息,可根据返回的矩阵信息自行实现二维码生成。|
+
+### make(options)
+
+生成二维码
+
+**options参数说明:**
+
+|参数|类型|必填|说明|
+|---|---|---|:---|
+|canvasId|String|是|画布标识,传入 `` 的 `canvas-id`|
+|componentInstance|Object|否|自定义组件实例 `this` ,表示在这个自定义组件下查找拥有 `canvas-id` 的 `` ,如果省略,则不在任何自定义组件内查找|
+|text|String|是|二维码内容|
+|size|Number|否|画布尺寸大小,请与 `` 所设 `width` , `height` 保持一致(默认:`354`)|
+|margin|Number|否|边距,二维码实际尺寸会根据所设边距值进行缩放调整(默认:`0`)|
+|backgroundColor|String|否|背景色,若设置为透明背景, `fileType` 需设置为 `'png'` , 然后设置背景色为 `'rgba(255,255,255,0)'` 即可(默认:`'#ffffff'`)|
+|foregroundColor|String|否|前景色(默认:`'#000000'`)|
+|fileType|String|否|输出图片的类型,只支持 `'jpg'` 和 `'png'`(默认:`'png'`)|
+|errorCorrectLevel|Number|否|纠错等级,参考属性说明 `errorCorrectLevel`(默认:`errorCorrectLevel.H`)|
+|enableDelay|Boolen|否|启用延迟绘制(默认:`false`)|
+
+### getModules(options)
+
+根据内容得到二维码矩阵信息
+
+|参数|类型|必填|说明|
+|---|---|---|:---|
+|text|String|是|二维码内容|
+|errorCorrectLevel|Number|否|纠错等级,参考属性说明 `errorCorrectLevel`(默认:`errorCorrectLevel.H`)|
+
+### 使用建议
+如需在进入页面时生成二维码,建议使用`onReady`,不推荐在`onLoad`中生成。
+
+关于高级使用:canvas在二维码生成中请当做一个生成工具来看待,它的作用仅是绘制出二维码。应把生成回调得到的资源保存并使用,显示用image图片组件,原因是方便操作,例如调整大小,或是H5端长按保存或识别,所以canvas应将它放在看不见的地方。不能用`display:none;overflow:hidden;`隐藏,否则生成空白。这里推荐canvas的隐藏样式代码
+```html
+
+```
+
+### 常见问题
+**二维码生成不完整**
+
+size的单位是px,请尽量避免使用rpx,如果canvas的单位是rpx,那么不同设备屏幕分辨率不一样,rpx转换成px后的画布尺寸不足以放下全部内容,实际绘制图案超出,就会出现不完整或者没有填充完整画布的情况。
+
+另外还可以尝试延迟绘制,``enableDelay`` 设置为 ``true``。
+
+**如何扫码跳转指定网页**
+
+text参数直接放入完整的网页地址即可,例如:`https://ext.dcloud.net.cn/plugin?id=1287`。微信客户端不能是ip地址。
+
+**H5长按识别**
+
+canvas无法长按识别,长按识别需要是图片才行,所以只需将回调过来的资源用image组件显示即可。
+
+### Tips
+- 示例项目中的图片采集于互联网,仅作为案例展示,不作为广告/商业,如有侵权,请告知删除。下载使用的用户,请勿把示例项目中的图片应用到你的项目。
diff --git a/uni_modules/uni-popup/changelog.md b/uni_modules/uni-popup/changelog.md
new file mode 100755
index 00000000..f46daceb
--- /dev/null
+++ b/uni_modules/uni-popup/changelog.md
@@ -0,0 +1,35 @@
+## 1.6.1(2021-07-30)
+- 优化 vue3下事件警告的问题
+## 1.6.0(2021-07-13)
+- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
+## 1.5.0(2021-06-23)
+- 新增 mask-click 遮罩层点击事件
+## 1.4.5(2021-06-22)
+- 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug
+## 1.4.4(2021-06-18)
+- 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug
+## 1.4.3(2021-06-08)
+- 修复 错误的 watch 字段
+- 修复 safeArea 属性不生效的问题
+- 修复 点击内容,再点击遮罩无法关闭的Bug
+## 1.4.2(2021-05-12)
+- 新增 组件示例地址
+## 1.4.1(2021-04-29)
+- 修复 组件内放置 input 、textarea 组件,无法聚焦的问题
+## 1.4.0 (2021-04-29)
+- 新增 type 属性的 left\right 值,支持左右弹出
+- 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗
+- 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色
+- 新增 safeArea 属性,是否适配底部安全区
+- 修复 App\h5\微信小程序底部安全区占位不对的Bug
+- 修复 App 端弹出等待的Bug
+- 优化 提升低配设备性能,优化动画卡顿问题
+- 优化 更简单的组件自定义方式
+## 1.2.9(2021-02-05)
+- 优化 组件引用关系,通过uni_modules引用组件
+## 1.2.8(2021-02-05)
+- 调整为uni_modules目录规范
+## 1.2.7(2021-02-05)
+- 调整为uni_modules目录规范
+- 新增 支持 PC 端
+- 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端
diff --git a/uni_modules/uni-popup/components/uni-popup-comments/uni-popup-comments.vue b/uni_modules/uni-popup/components/uni-popup-comments/uni-popup-comments.vue
new file mode 100755
index 00000000..0f79c753
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup-comments/uni-popup-comments.vue
@@ -0,0 +1,728 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
new file mode 100755
index 00000000..6ef26a26
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js
@@ -0,0 +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
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
new file mode 100755
index 00000000..9ddb8368
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue
@@ -0,0 +1,244 @@
+
+
+
+
+
+
+
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
new file mode 100755
index 00000000..f4c85e25
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue
@@ -0,0 +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
new file mode 100755
index 00000000..3327bf09
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+
+
+
+
+ 保存到相册
+
+
+
+
+
+
+ 复制链接
+
+
+
+
+
+
+ 二维码
+
+
+
+
+
+
+
+ 转为私密
+
+
+
+
+
+ 转为公开
+
+
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-popup/components/uni-popup/keypress.js b/uni_modules/uni-popup/components/uni-popup/keypress.js
new file mode 100755
index 00000000..62dda461
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup/keypress.js
@@ -0,0 +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
diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js
new file mode 100755
index 00000000..c4e5781d
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup/popup.js
@@ -0,0 +1,26 @@
+
+export default {
+ data() {
+ return {
+
+ }
+ },
+ created(){
+ this.popup = this.getParent()
+ },
+ methods:{
+ /**
+ * 获取父元素实例
+ */
+ getParent(name = 'uniPopup') {
+ let parent = this.$parent;
+ let parentName = parent.$options.name;
+ while (parentName !== name) {
+ parent = parent.$parent;
+ if (!parent) return false
+ parentName = parent.$options.name;
+ }
+ 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
new file mode 100755
index 00000000..508a6cb1
--- /dev/null
+++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue
@@ -0,0 +1,404 @@
+
+
+
+
+
+
diff --git a/uni_modules/uni-popup/package.json b/uni_modules/uni-popup/package.json
new file mode 100755
index 00000000..c69a3338
--- /dev/null
+++ b/uni_modules/uni-popup/package.json
@@ -0,0 +1,85 @@
+{
+ "id": "uni-popup",
+ "displayName": "uni-popup 弹出层",
+ "version": "1.6.1",
+ "description": " Popup 组件,提供常用的弹层",
+ "keywords": [
+ "uni-ui",
+ "弹出层",
+ "弹窗",
+ "popup",
+ "弹框"
+ ],
+ "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": [
+ "uni-transition"
+ ],
+ "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"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-popup/readme.md b/uni_modules/uni-popup/readme.md
new file mode 100755
index 00000000..d8a08994
--- /dev/null
+++ b/uni_modules/uni-popup/readme.md
@@ -0,0 +1,296 @@
+
+
+## Popup 弹出层
+> **组件名:uni-popup**
+> 代码块: `uPopup`
+> 关联组件:`uni-popup-dialog`,`uni-popup-message`,`uni-popup-share`,`uni-transition`
+
+
+弹出层组件,在应用中弹出一个消息提示窗口、提示框等
+
+
+> **注意事项**
+> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
+> - 组件需要依赖 `sass` 插件 ,请自行手动安装
+> - `uni-popup-message` 、 `uni-popup-dialog` 等扩展ui组件,需要和 `uni-popup` 配套使用,暂不支持单独使用
+> - `nvue` 中使用 `uni-popup` 时,尽量将组件置于其他元素后面,避免出现层级问题
+> - `uni-popup` 并不能完全阻止页面滚动,可在打开 `uni-popup` 的时候手动去做一些处理,禁止页面滚动
+> - 如果想在页面渲染完毕后就打开 `uni-popup` ,请在 `onReady` 或 `mounted` 生命周期内调用,确保组件渲染完毕
+> - 在微信小程序开发者工具中,启用真机调试,popup 会延时出现,是因为 setTimeout 在真机调试中的延时问题导致的,预览和发布小程序不会出现此问题
+> - 使用 `npm` 方式引入组件,如果确认引用正确,但是提示未注册组件或显示不正常,请尝试重新编译项目
+> - `uni-popup` 中尽量不要使用 `scroll-view` 嵌套过多的内容,可能会影响组件的性能,导致组件无法打开或者打开卡顿
+> - `uni-popup` 不会覆盖原生 tabbar 和原生导航栏
+> - 组件支持 nvue ,需要在 `manifest.json > app-plus` 节点下配置 `"nvueStyleCompiler" : "uni-app"`
+> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
+
+
+
+### 安装方式
+
+本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
+
+如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
+
+
+### 基本用法
+
+**示例**
+
+```html
+
+底部弹出 Popup
+```
+
+```javascript
+export default {
+ methods:{
+ open(){
+ // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
+ this.$refs.popup.open('top')
+ }
+ }
+}
+
+```
+
+### 设置主窗口背景色
+
+在大多数场景下,并不需要设置 `background-color` 属性,因为`uni-popup`的主窗口默认是透明的,在向里面插入内容的时候 ,样式完全交由用户定制,如果设置了背景色 ,例如 `uni-popup-dialog` 中的圆角就很难去实现,不设置背景色,更适合用户去自由发挥。
+
+而也有特例,需要我们主动去设置背景色,例如 `type = 'bottom'` 的时候 ,在异型屏中遇到了底部安全区问题(如 iphone 11),因为 `uni-popup`的主要内容避开了安全区(设置`safe-area:true`),导致底部的颜色我们无法自定义,这时候使用 `background-color` 就可以解决这个问题。
+
+**示例**
+
+```html
+
+底部弹出 Popup
+```
+
+### 禁用打开动画
+在某些场景 ,可能不希望弹层有动画效果 ,只需要将 `animation` 属性设置为 `false` 即可以关闭动画。
+
+**示例**
+
+```html
+
+中间弹出 Popup
+```
+
+### 禁用点击遮罩关闭
+默认情况下,点击遮罩会自动关闭`uni-popup`,如不想点击关闭,只需将`mask-click`设置为`false`,这时候要关闭`uni-popup`,只能手动调用 `close` 方法。
+
+**示例**
+
+```html
+
+
+ Popup
+
+
+```
+
+```javascript
+export default {
+ data() {
+ return {}
+ },
+ onReady() {},
+ methods: {
+ open() {
+ this.$refs.popup.open('top')
+ },
+ close() {
+ this.$refs.popup.close()
+ }
+ }
+}
+
+```
+
+## API
+
+### Popup Props
+
+|属性名|类型|默认值|说明|
+|:-:|:-:|:-:|:-:|
+|animation|Boolean|true|是否开启动画|
+|type|String|'center'|弹出方式|
+|mask-click|Boolean|true|蒙版点击是否关闭弹窗|
+|background-color|String|'none'|主窗口背景色|
+|safe-area|Boolean|true|是否适配底部安全区|
+
+#### Type Options
+
+|属性名|说明|
+|:-:| :-:|
+|top|顶部弹出 |
+|center|居中弹出|
+|bottom|底部弹出|
+|left|左侧弹出|
+|right|右侧弹出|
+|message|预置样式 :消息提示|
+|dialog|预置样式 :对话框|
+|share|预置样式 :底部弹出分享示例 |
+
+
+### Popup Methods
+
+|方法称名 |说明|参数|
+|:-:|:-:|:-:|
+|open|打开弹出层|open(String:type) ,如果参数可代替 type 属性|
+|close|关闭弹出层 |-|
+
+
+### Popup Events
+
+|事件称名|说明|返回值|
+|:-:|:-:|:-:|
+|change|组件状态发生变化触发|e={show: true|false,type:当前模式}|
+|maskClick|点击遮罩层触发|-|
+
+
+## 扩展组件说明
+`uni-popup` 其实并没有任何样式,只提供基础的动画效果,给用户一个弹出层解决方案,仅仅是这样并不能满足开发需求,所以我们提供了三种基础扩展样式
+
+### uni-popup-message 提示信息
+
+将 `uni-popup` 的`type`属性改为 `message`,并引入对应组件即可使用消息提示 ,*该组件不支持单独使用*
+
+**示例**
+
+```html
+
+
+
+```
+
+### PopupMessage Props
+
+|属性名|类型|默认值|说明|
+|:-:|:-:|:-:|:-:|
+|type|String|success|消息提示主题|
+|message|String|-|消息提示文字|
+|duration|Number|3000|消息显示时间,超过显示时间组件自动关闭,设置为0 将不会关闭,需手动调用 close 方法关闭|
+
+#### Type Options
+
+|属性名|说明|
+|:-:| :-:|
+|success|成功 |
+|warn|警告|
+|error|失败|
+|info|消息|
+
+### PopupMessage Slots
+
+|名称|说明|
+|:-:|:-:|
+|default|消息内容,会覆盖 message 属性|
+
+### uni-popup-dialog 对话框
+
+将 `uni-popup` 的`type`属性改为 `dialog`,并引入对应组件即可使用对话框 ,*该组件不支持单独使用*
+
+**示例**
+
+```html
+
+
+
+
+```
+
+```javascript
+export default {
+ methods: {
+ open() {
+ this.$refs.popup.open()
+ },
+ /**
+ * 点击取消按钮触发
+ * @param {Object} done
+ */
+ close() {
+ // TODO 做一些其他的事情,before-close 为true的情况下,手动执行 close 才会关闭对话框
+ // ...
+ this.$refs.popup.close()
+ },
+ /**
+ * 点击确认按钮触发
+ * @param {Object} done
+ * @param {Object} value
+ */
+ confirm(value) {
+ // 输入框的值
+ console.log(value)
+ // TODO 做一些其他的事情,手动执行 close 才会关闭对话框
+ // ...
+ this.$refs.popup.close()
+ }
+ }
+}
+```
+
+### PopupDialog Props
+
+|属性名|类型|默认值|说明|
+|:-:|:-:|:-:|:-:|
+|type|String|success|对话框标题主题,可选值: success/warn/info/error|
+|mode|String|base| 对话框模式,可选值:base(提示对话框)/input(可输入对话框)|
+|title|String|-|对话框标题|
+|content|String|-|对话框内容,base模式下生效|
+|value| String\Number|-|输入框默认值,input模式下生效|
+|placeholder|String|-|输入框提示文字,input模式下生效|
+|before-close|Boolean|false | 是否拦截按钮事件,如为true,则不会关闭对话框,关闭需要手动执行 uni-popup 的 close 方法|
+
+#### PopupDialog Events
+
+|事件称名 |说明|返回值|
+|:-:|:-:|:-:|
+|close|点击dialog取消按钮触发|-|
+|confirm|点击dialog确定按钮触发|e={value:input模式下输入框的值}|
+
+### PopupDialog Slots
+
+|名称|说明|
+|:-:|:-:|
+|default|自定义内容,回覆盖原有的内容显示|
+
+### uni-popup-share 分享示例
+
+分享示例,不作为最终可使用的组件,只做为样式组件,供用户自行修改,`后续的开发计划是实现实际的分享逻辑,参数可配置`。
+
+将 `uni-popup` 的 `type` 属性改为 `share`,并引入对应组件即可使用 ,*该组件不支持单独使用*
+
+**示例**
+
+```html
+
+
+
+```
+
+### PopupShare Props
+
+|属性名|类型|默认值|说明|
+|:-:|:-:|:-:| :-: |
+|title|String|-|分享弹窗标题|
+|before-close|Boolean|false | 是否拦截按钮事件,如为true,则不会关闭对话框,关闭需要手动执行 uni-popup 的 close 方法|
+
+### PopupShare Events
+
+|事件称名|说明|返回值|
+|:-:|:-:|:-:|
+|select|选择触发|e = {item,index}:所选参数|
+
+**Tips**
+- share 分享组件,只是作为一个扩展示例,如果需要修改数据源,请到组件内修改
+
+## 帮助
+在使用中如遇到无法解决的问题,请提 [Issues](https://github.com/dcloudio/uni-ui/issues) 给我们。
+
+
+
+## 组件示例
+
+点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/popup/popup](https://hellouniapp.dcloud.net.cn/pages/extUI/popup/popup)
\ No newline at end of file
diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md
new file mode 100755
index 00000000..dca8178c
--- /dev/null
+++ b/uni_modules/uni-transition/changelog.md
@@ -0,0 +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目录规范
diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js
new file mode 100755
index 00000000..5f54365e
--- /dev/null
+++ b/uni_modules/uni-transition/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/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue
new file mode 100755
index 00000000..69ff9d98
--- /dev/null
+++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue
@@ -0,0 +1,277 @@
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json
new file mode 100755
index 00000000..0a709c9a
--- /dev/null
+++ b/uni_modules/uni-transition/package.json
@@ -0,0 +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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md
new file mode 100755
index 00000000..f3986238
--- /dev/null
+++ b/uni_modules/uni-transition/readme.md
@@ -0,0 +1,397 @@
+
+
+## Transition 过渡动画
+> **组件名:uni-transition**
+> 代码块: `uTransition`
+
+
+元素过渡动画
+
+> **注意事项**
+> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
+> - 组件需要依赖 `sass` 插件 ,请自行手动安装
+> - rotate 旋转动画不需要填写 deg 单位,在小程序上填写单位动画不会执行
+> - NVUE 下修改宽高动画,不能定位到中心点
+> - 百度小程序下修改宽高 ,可能会影响其他动画,需注意
+> - nvue 不支持 costom-class , 请使用 styles
+> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
+
+
+### 安装方式
+
+本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
+
+如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
+
+### 基本用法
+
+在 ``template`` 中使用组件
+
+```html
+
+
+
+
+
+
+
+
+```
+
+### 样式覆盖
+
+**注意:`nvue` 不支持 `custom-class` 属性 ,需要使用 `styles` 属性进行兼容**
+
+使用 `custom-class` 属性绑定样式,可以自定义 `uni-transition` 的样式
+
+```html
+
+
+
+
+
+
+
+
+```
+
+
+如果使用 `styles` 注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
+
+```html
+
+
+
+
+
+
+```
+
+### 自定义动画
+当内置动画类型不能满足需求的时候 ,可以使用 `step()` 和 `run()` 自定义动画,入参以及具体用法参考下方属性说明
+
+`init()` 方法可以覆盖默认配置
+
+
+```html
+
+
+
+
+
+
+
+
+```
+
+
+## API
+
+### Transition Props
+
+|属性名 |类型 |默认值 |说明 |
+|:-: |:-: |:-: |:-:|
+|show |Boolean|false |控制组件显示或隐藏 |
+|mode-class |Array/String |- |内置过渡动画类型 |
+|custom-class |String |- |自定义类名 |
+|duration |Number |300 |过渡动画持续时间 |
+|styles |Object |- |组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red` |
+
+#### mode-class 内置过渡动画类型说明
+**格式为** :`'fade'` 或者 `['fade','slide-top']`
+
+|属性名 |说明 |
+|:-: |:-: |
+|fade |渐隐渐出过渡 |
+|slide-top |由上至下过渡 |
+|slide-right |由右至左过渡 |
+|slide-bottom |由下至上过渡 |
+|slide-left |由左至右过渡 |
+|zoom-in |由小到大过渡 |
+|zoom-out |由大到小过渡 |
+
+**注意**
+
+组合使用时,同一种类型相反的过渡动画如(slide-top、slide-bottom)同时使用时,只有最后一个生效
+
+### Transition Events
+
+|事件名 |说明 |返回值 |
+|:-: |:-: |:-: |
+|click |点击组件触发 |- |
+|change |过渡动画结束时触发 | e = {detail:true} |
+
+### Transition Methons
+
+|方法名|说明|参数|
+|:-:|:-:|:-:|
+|init()|手动初始化配置|Function(OBJECT:config)|
+|step()|动画队列|Function(OBJECT:type,OBJECT:config)|
+|run()|执行动画|Function(FUNCTION:callback) |
+
+### init(OBJECT:config)
+**通过 ref 调用方法**
+
+手动设置动画配置,需要在页面渲染完毕后调用
+
+```javascript
+this.$refs.ani.init({
+ duration: 1000,
+ timingFunction:'ease',
+ delay:500,
+ transformOrigin:'left center'
+})
+```
+
+### step(OBJECT:type,OBJECT:config) 动画队列
+**通过 ref 调用方法**
+
+调用 `step()` 来表示一组动画完成,`step` 第一个参数可以传入任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。`step` 第二个参数可以传入一个跟 `uni.createAnimation()` 一样的配置参数用于指定当前组动画的配置。
+
+Tips
+- 第一个参数支持的动画参考下面的 `支持的动画`
+- 第二个参数参考下面的 `动画配置`,可省略,如果省略继承`init`的配置
+
+
+```javascript
+this.$refs.ani.step({
+ translateX: '100px'
+},{
+ duration: 1000,
+ timingFunction:'ease',
+ delay:500,
+ transformOrigin:'left center'
+})
+```
+
+### run(FUNCTION:callback) 执行动画
+**通过 ref 调用方法**
+
+在执行 `step()` 后,需要调用 `run()` 来运行动画 ,否则动画会一直等待
+
+`run()` 方法可以传入一个 `callback` 函数 ,会在所有动画执行完毕后回调
+
+```javascript
+this.$refs.ani.step({
+ translateX: '100px'
+})
+this.$refs.ani.run(()=>{
+ console.log('动画执行完毕')
+})
+
+```
+
+### 动画配置
+动画配置 , `init()` 与 `step()` 第二个参数配置相同 ,如果配置`step() `第二个参数,将会覆盖 `init()` 的配置
+
+|属性名|值|必填|默认值|说明|平台差异|
+|:-:|:-:|:-:|:-:|:-:|:-:|
+|duration|Number|否|400|动画持续时间,单位ms|-|
+|timingFunction|String|否|"linear"|定义动画的效果|-|
+|delay|Number|否|0|动画延迟时间,单位 ms|-|
+|needLayout|Boolean|否|false |动画执行是否影响布局|仅 nvue 支持|
+|transformOrigin|String |否|"center center"|设置 [transform-origin](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin)|-|
+
+
+### timingFunction 属性说明
+
+|值|说明|平台差异|
+|:-:|:-:|:-:|
+|linear|动画从头到尾的速度是相同的|-|
+|ease|动画以低速开始,然后加快,在结束前变慢|-|
+|ease-in| 动画以低速开始|-|
+|ease-in-out| 动画以低速开始和结束|-|
+|ease-out|动画以低速结束|-|
+|step-start|动画第一帧就跳至结束状态直到结束|nvue不支持|
+|step-end|动画一直保持开始状态,最后一帧跳到结束状态|nvue不支持|
+
+```javascript
+// init 配置
+this.$refs.ani.init({
+ duration: 1000,
+ timingFunction:'ease',
+ delay:500,
+ transformOrigin:'left center'
+})
+// step 配置
+this.$refs.ani.step({
+ translateX: '100px'
+},{
+ duration: 1000,
+ timingFunction:'ease',
+ delay:500,
+ transformOrigin:'left center'
+})
+```
+
+### 支持的动画
+动画方法
+
+如果同一个动画方法有多个值,多个值使用数组分隔
+
+```javascript
+this.$refs.ani.step({
+ width:'100px',
+ scale: [1.2,0.8],
+})
+```
+
+**样式:**
+
+|属性名|值|说明|平台差异|
+|:-:|:-:|:-:|:-:|
+|opacity|value|透明度,参数范围 0~1|-|
+|backgroundColor|color|颜色值|-|
+|width|length|长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值|-|
+|height|length|长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值|-|
+|top|length|长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值|nvue 不支持|
+|left|length|长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值|nvue 不支持|
+|bottom|length|长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值|nvue 不支持|
+|right|length|长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值|nvue 不支持|
+
+```javascript
+this.$refs.ani.step({
+ opacity: 1,
+ backgroundColor: '#ff5a5f',
+ widht:'100px',
+ height:'50rpx',
+})
+```
+
+**旋转:**
+
+旋转属性的值不需要填写单位
+
+|属性名|值|说明|平台差异 |
+|:-:|:-:|:-:|:-:|
+|rotate|deg|deg的范围-180~180,从原点顺时针旋转一个deg角度 |-|
+|rotateX|deg|deg的范围-180~180,在X轴旋转一个deg角度 |-|
+|rotateY|deg|deg的范围-180~180,在Y轴旋转一个deg角度 |-|
+|rotateZ|deg|deg的范围-180~180,在Z轴旋转一个deg角度 |nvue不支持|
+|rotate3d|x,y,z,deg| 同 [transform-function rotate3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d()) |nvue不支持|
+
+```javascript
+this.$refs.ani.step({
+ rotateX: 45,
+ rotateY: 45
+})
+```
+
+**缩放:**
+
+|属性名|值|说明|平台差异|
+|:-:|:-:|:-: |:-:|
+|scale|sx,[sy]|一个参数时,表示在X轴、Y轴同时缩放sx倍数;两个参数时表示在X轴缩放sx倍数,在Y轴缩放sy倍数|-|
+|scaleX|sx|在X轴缩放sx倍数|-|
+|scaleY|sy|在Y轴缩放sy倍数|-|
+|scaleZ|sz|在Z轴缩放sy倍数|nvue不支持|
+|scale3d|sx,sy,sz|在X轴缩放sx倍数,在Y轴缩放sy倍数,在Z轴缩放sz倍数|nvue不支持|
+
+```javascript
+this.$refs.ani.step({
+ scale: [1.2,0.8]
+})
+```
+
+**偏移:**
+
+|属性名|值|说明|平台差异|
+|:-:|:-:|:-:|:-:|
+|translate|tx,[ty]|一个参数时,表示在X轴偏移tx,单位px;两个参数时,表示在X轴偏移tx,在Y轴偏移ty,单位px。|-|
+|translateX|tx| 在X轴偏移tx,单位px|-|
+|translateY|ty| 在Y轴偏移tx,单位px|-|
+|translateZ|tz| 在Z轴偏移tx,单位px|nvue不支持|
+|translate3d|tx,ty,tz| 在X轴偏移tx,在Y轴偏移ty,在Z轴偏移tz,单位px|nvue不支持|
+
+```javascript
+this.$refs.ani.step({
+ translateX: '100px'
+})
+```
+
+
+
+## 组件示例
+
+点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/transition/transition](https://hellouniapp.dcloud.net.cn/pages/extUI/transition/transition)
\ No newline at end of file
diff --git a/utils/Foundation.js b/utils/Foundation.js
index 51c33184..29d77adc 100644
--- a/utils/Foundation.js
+++ b/utils/Foundation.js
@@ -81,9 +81,12 @@ export function checkBankno(bankno) {
*/
export function whetherNavigate(type = "default") {
- let navigation = getCurrentPages()[getCurrentPages().length - (getCurrentPages().length ) ];
+ let navigation = getCurrentPages()[getCurrentPages().length - (getCurrentPages().length ) ];
+ console.log(navigation.route)
+ console.log(getCurrentPages().length)
+ uni.setStorageSync('refreshVlogIndex','1') //需要刷新
if (getCurrentPages().length > 1) {
- console.log(navigation, getCurrentPages());
+ // console.log(navigation, getCurrentPages());
if (navigation.route == "pages/passport/login") {
navigationToBack(type);
} else {
@@ -94,10 +97,11 @@ export function whetherNavigate(type = "default") {
delta: getCurrentPages().length,
});
}
- }
+ }
+
} else {
uni.switchTab({
- url: "/pages/tabbar/home/index",
+ url: "/pages/tabbar/vlog/index",
});
}
}
@@ -224,7 +228,7 @@ function navigationToBack(type) {
});
} else {
uni.switchTab({
- url: "/pages/tabbar/home/index",
+ url: "/pages/tabbar/vlog/index",
});
}
}
diff --git a/utils/request.js b/utils/request.js
index 6dce3d0a..0e86b214 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -30,9 +30,9 @@ function cleanStorage() {
// 清理vlog信息
storage.setVlogToken("")
storage.setVlogUserInfo({})
-
-
-
+ // 清除初始化数据内容
+ storage.setRefreshVlogIndex('0') //不需要刷新
+
// 防抖处理跳转
// #ifdef MP-WEIXIN
@@ -194,6 +194,9 @@ http.interceptors.response.use(
duration: 1500,
});
}
+ }
+ else if (response.data.code==502){
+ cleanStorage();
}
return response;
},
diff --git a/utils/storage.js b/utils/storage.js
index 6eb29859..b2a14228 100644
--- a/utils/storage.js
+++ b/utils/storage.js
@@ -11,7 +11,15 @@ const FINGER_LOGIN = isDev ? "finger_login_dev" : "finger_login";
const CART_BACKBTN = isDev ? "cart_backbtn_dev" : "cart_backbtn";
const AFTERSALE_DATA = isDev ? "aftersale_data_dev" : "aftersale_data";
export default {
-
+ /**
+ * 写入RefreshVlogIndex
+ */
+ setRefreshVlogIndex(val) {
+ return uni.setStorageSync('refreshVlogIndex',val) //0=不需要刷新
+ },
+ getRefreshVlogIndex() {
+ return uni.getStorageSync('refreshVlogIndex') //0=不需要刷新
+ },
/**
* 获取Vlogtoken
*/
@@ -34,7 +42,7 @@ export default {
* 获取VlogUserInfo
*/
getVlogUserInfo(val) {
- return uni.getStorageSync(VLOG_USER_INFO);
+ return uni.getStorageSync(VLOG_USER_INFO)||null;
},
// 写入热门搜索时间戳
diff --git a/utils/tools.js b/utils/tools.js
index 6ca72f84..5b254718 100644
--- a/utils/tools.js
+++ b/utils/tools.js
@@ -151,6 +151,82 @@ const isStrEmpty = (str) => {
}
}
+// 获得星座
+const getAstro = (m, d) => {
+ return "魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯".substr(
+ m * 2 - (d < "102223444433".charAt(m - 1) - -19) * 2,
+ 2
+ );
+}
+
+// 获得生肖
+const getAnimal = (year) => {
+ year = year % 12;
+ let animal = "";
+ switch (year) {
+ case 1:
+ animal = "鸡";
+ break;
+ case 2:
+ animal = "狗";
+ break;
+ case 3:
+ animal = "猪";
+ break;
+ case 4:
+ animal = "鼠";
+ break;
+ case 5:
+ animal = "牛";
+ break;
+ case 6:
+ animal = "虎";
+ break;
+ case 7:
+ animal = "兔";
+ break;
+ case 8:
+ animal = "龙";
+ break;
+ case 9:
+ animal = "蛇";
+ break;
+ case 10:
+ animal = "马";
+ break;
+ case 11:
+ animal = "羊";
+ break;
+ case 0:
+ animal = "猴";
+ break;
+ }
+ return animal;
+}
+
+// 日期格式化
+const dateFormat = (fmt, date) => {
+ let ret;
+ const opt = {
+ "Y+": date.getFullYear().toString(), // 年
+ "m+": (date.getMonth() + 1).toString(), // 月
+ "d+": date.getDate().toString(), // 日
+ "H+": date.getHours().toString(), // 时
+ "M+": date.getMinutes().toString(), // 分
+ "S+": date.getSeconds().toString(), // 秒
+ };
+ for (let k in opt) {
+ ret = new RegExp("(" + k + ")").exec(fmt);
+ if (ret) {
+ fmt = fmt.replace(
+ ret[1],
+ ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
+ );
+ }
+ }
+ return fmt;
+}
+
export {
getNetworkType,
@@ -158,6 +234,9 @@ export {
countTimeDown,
theNextDayTime,
graceNumber,
- getDateBeforeNow,
- isStrEmpty
+ getDateBeforeNow,
+ isStrEmpty,
+ getAstro,
+ getAnimal,
+ dateFormat
};
\ No newline at end of file