Compare commits
No commits in common. "c7b4db67bfe292cb32ab74c7727df4e345cf83bb" and "9bca5bebd5409c3056c02681d61afe04667c20c7" have entirely different histories.
c7b4db67bf
...
9bca5bebd5
@ -1,11 +1,11 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-43e3941654fa3054c9684bf53d1b1d356a1.png">
|
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-43e3941654fa3054c9684bf53d1b1d356a1.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v1.1.0</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v1.0.0</h1>
|
||||||
<h4 align="center">基于UniApp开发的轻量级移动端框架</h4>
|
<h4 align="center">基于UniApp开发的轻量级移动端框架</h4>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitee.com/y_project/RuoYi-App/stargazers"><img src="https://gitee.com/y_project/RuoYi-App/badge/star.svg?theme=dark"></a>
|
<a href="https://gitee.com/y_project/RuoYi-App/stargazers"><img src="https://gitee.com/y_project/RuoYi-App/badge/star.svg?theme=dark"></a>
|
||||||
<a href="https://gitee.com/y_project/RuoYi-App"><img src="https://img.shields.io/badge/RuoYi-v1.1.0-brightgreen.svg"></a>
|
<a href="https://gitee.com/y_project/RuoYi-App"><img src="https://img.shields.io/badge/RuoYi-v1.0.0-brightgreen.svg"></a>
|
||||||
<a href="https://gitee.com/y_project/RuoYi-App/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
<a href="https://gitee.com/y_project/RuoYi-App/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ RuoYi App 移动解决方案,采用uniapp框架,一份代码多终端适配
|
|||||||
- 官网网站:[http://ruoyi.vip](http://ruoyi.vip)
|
- 官网网站:[http://ruoyi.vip](http://ruoyi.vip)
|
||||||
- 文档地址:[http://doc.ruoyi.vip](http://doc.ruoyi.vip)
|
- 文档地址:[http://doc.ruoyi.vip](http://doc.ruoyi.vip)
|
||||||
- H5页体验:[http://h5.ruoyi.vip](http://h5.ruoyi.vip)
|
- H5页体验:[http://h5.ruoyi.vip](http://h5.ruoyi.vip)
|
||||||
- QQ交流群: ①133713780(满)、②146013835
|
- QQ交流群: ①133713780
|
||||||
- 小程序体验
|
- 小程序体验
|
||||||
|
|
||||||
<img src="https://oscimg.oschina.net/oscnet/up-26c76dc90b92acdbd9ac8cd5252f07c8ad9.jpg" alt="小程序演示"/>
|
<img src="https://oscimg.oschina.net/oscnet/up-26c76dc90b92acdbd9ac8cd5252f07c8ad9.jpg" alt="小程序演示"/>
|
||||||
|
12
api/login.js
12
api/login.js
@ -18,18 +18,6 @@ export function login(username, password, code, uuid) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注册方法
|
|
||||||
export function register(data) {
|
|
||||||
return request({
|
|
||||||
url: '/register',
|
|
||||||
headers: {
|
|
||||||
isToken: false
|
|
||||||
},
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户详细信息
|
// 获取用户详细信息
|
||||||
export function getInfo() {
|
export function getInfo() {
|
||||||
return request({
|
return request({
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
import upload from '@/utils/upload'
|
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询单位换算列表
|
|
||||||
export function listConversion(query) {
|
|
||||||
return request({
|
|
||||||
url: '/system/conversion/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 查询单位换算详细
|
|
||||||
export function getConversion(id) {
|
|
||||||
return request({
|
|
||||||
url: '/system/conversion/' + id,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增单位换算
|
|
||||||
export function addConversion(data) {
|
|
||||||
return request({
|
|
||||||
url: '/system/conversion',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改单位换算
|
|
||||||
export function updateConversion(data) {
|
|
||||||
return request({
|
|
||||||
url: '/system/conversion',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除单位换算
|
|
||||||
export function delConversion(id) {
|
|
||||||
return request({
|
|
||||||
url: '/system/conversion/' + id,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
45
config.js
45
config.js
@ -1,26 +1,25 @@
|
|||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
|
baseUrl: 'http://localhost:8080',
|
||||||
baseUrl: 'http://192.168.3.19:9090',
|
// 应用信息
|
||||||
// 应用信息
|
appInfo: {
|
||||||
appInfo: {
|
// 应用名称
|
||||||
// 应用名称
|
name: "ruoyi-app",
|
||||||
name: "ruoyi-app",
|
// 应用版本
|
||||||
// 应用版本
|
version: "1.0.0",
|
||||||
version: "1.1.0",
|
// 应用logo
|
||||||
// 应用logo
|
logo: "/static/logo.png",
|
||||||
logo: "/static/logo.png",
|
// 官方网站
|
||||||
// 官方网站
|
site_url: "http://ruoyi.vip",
|
||||||
site_url: "http://ruoyi.vip",
|
// 政策协议
|
||||||
// 政策协议
|
agreements: [{
|
||||||
agreements: [{
|
title: "隐私政策",
|
||||||
title: "隐私政策",
|
url: "https://ruoyi.vip/protocol.html"
|
||||||
url: "https://ruoyi.vip/protocol.html"
|
},
|
||||||
},
|
{
|
||||||
{
|
title: "用户服务协议",
|
||||||
title: "用户服务协议",
|
url: "https://ruoyi.vip/protocol.html"
|
||||||
url: "https://ruoyi.vip/protocol.html"
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
|
||||||
}
|
}
|
134
manifest.json
134
manifest.json
@ -1,69 +1,69 @@
|
|||||||
{
|
{
|
||||||
"name": "若依移动端",
|
"name" : "若依移动端",
|
||||||
"appid": "__UNI__1347B29",
|
"appid" : "__UNI__25A9D80",
|
||||||
"description": "",
|
"description" : "",
|
||||||
"versionName": "1.1.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode": "100",
|
"versionCode" : "100",
|
||||||
"transformPx": false,
|
"transformPx" : false,
|
||||||
"app-plus": {
|
"app-plus" : {
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"nvueCompiler": "uni-app",
|
"nvueCompiler" : "uni-app",
|
||||||
"splashscreen": {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender": true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting": true,
|
"waiting" : true,
|
||||||
"autoclose": true,
|
"autoclose" : true,
|
||||||
"delay": 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
"modules": {},
|
"modules" : {},
|
||||||
"distribute": {
|
"distribute" : {
|
||||||
"android": {
|
"android" : {
|
||||||
"permissions": [
|
"permissions" : [
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ios": {},
|
"ios" : {},
|
||||||
"sdkConfigs": {}
|
"sdkConfigs" : {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"quickapp": {},
|
"quickapp" : {},
|
||||||
"mp-weixin": {
|
"mp-weixin" : {
|
||||||
"appid": "wxccd7e2a0911b3397",
|
"appid" : "wxccd7e2a0911b3397",
|
||||||
"setting": {
|
"setting" : {
|
||||||
"urlCheck": false,
|
"urlCheck" : false,
|
||||||
"es6": false,
|
"es6" : false,
|
||||||
"minified": true,
|
"minified" : true,
|
||||||
"postcss": true
|
"postcss" : true
|
||||||
},
|
},
|
||||||
"optimization": {
|
"optimization" : {
|
||||||
"subPackages": true
|
"subPackages" : true
|
||||||
},
|
},
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"vueVersion": "2",
|
"vueVersion" : "2",
|
||||||
"h5": {
|
"h5" : {
|
||||||
"template": "static/index.html",
|
"template" : "static/index.html",
|
||||||
"devServer": {
|
"devServer" : {
|
||||||
"port": 9090,
|
"port" : 9090,
|
||||||
"https": false
|
"https" : false
|
||||||
},
|
},
|
||||||
"title": "RuoYi-App",
|
"title" : "RuoYi-App",
|
||||||
"router": {
|
"router" : {
|
||||||
"mode": "hash",
|
"mode" : "hash",
|
||||||
"base": "./"
|
"base" : "./"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"bignumber.js": "^9.1.2"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
/* ===pages-tool===
|
|
||||||
该文件是pages-tool插件的配置文件模板,仅供参考。可以删除,不影响插件的使用。
|
|
||||||
pages-tool插件可实现将pages.josn中的配置拆分到多个配置文件中,以便实现模块化配置。
|
|
||||||
在应用中配置项较多、页面较多时,分别在不同文件中进行配置,可使项目代码更为清晰。
|
|
||||||
在团队多人合作时,按模块分工,分别管理不同的配置文件,可避免同时修改pages.json带来的代码冲突问题。
|
|
||||||
|
|
||||||
注意:启用该插件并设置了配置文件之后,pages.json配置文件中相关配置项的内容可能会被替换,应根据paes-config.json的设置情况决定哪些配置应该在pages.josn中设置,哪些应该在指定的文件中设置。
|
|
||||||
提示:插件只会处理已设置的相关项点,不会覆盖pages.json中未指定的项点。详见配置示例
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
{
|
|
||||||
//可指定一个文件路径,从该文件读取globalStyle配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"globalStyle" : "pages-config/globalStyle.json"
|
|
||||||
//文件的格式同pages.json,但只应包含globalStyle配置项
|
|
||||||
"globalStyle" : "",
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取easycom配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"easycom" : "pages-config/easycom.json"
|
|
||||||
//文件的格式同pages.json,但只应包含easycom配置项
|
|
||||||
"easycom" : "",
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取tabBar配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"tabBar" : "pages-config/tabBar.json"
|
|
||||||
//文件的格式同pages.json,但只应包含tabBar配置项
|
|
||||||
"tabBar" : "",
|
|
||||||
|
|
||||||
//可指定多个文件路径,合并多个文件的内容作为pages配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置为:"pages" : ["pages-config/pages-moduleA.json", "pages-config/pages-moduleB.json", "pages-config/pages-moduleC.json", ...]
|
|
||||||
//每个文件的格式同pages.json,但只应包含pages配置项
|
|
||||||
"pages" : [],
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取condition配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"condition" : "pages-config/condition.json"
|
|
||||||
//文件的格式同pages.json,但只应包含condition配置项
|
|
||||||
"condition" : "",
|
|
||||||
|
|
||||||
//可对每个分包指定一个文件路径,从该文件读取对应分包的pages配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"subPackages" : [pages-config/subPackages-moduleNameA.json, pages-config/subPackages-moduleNameB.json, ...],
|
|
||||||
//文件的格式同pages.json,但只应包含subPackages配置项
|
|
||||||
//需要注意:分包中的pages不能再拆分为多个文件
|
|
||||||
"subPackages" : [],
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取preloadRule配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"preloadRule" : "pages-config/preloadRule.json"
|
|
||||||
//文件的格式同pages.json,但只应包含preloadRule配置项
|
|
||||||
"preloadRule" : "",
|
|
||||||
|
|
||||||
//推荐配置:"workers" : "pages-config/workers.json"
|
|
||||||
//格式同pages.json
|
|
||||||
"workers" : "",
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取leftWindow配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"leftWindow" : "pages-config/leftWindow.json"
|
|
||||||
//文件的格式同pages.json,但只应包含leftWindow配置项
|
|
||||||
"leftWindow" : "",
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取topWindow配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"topWindow" : "pages-config/topWindow.json"
|
|
||||||
//文件的格式同pages.json,但只应包含topWindow配置项
|
|
||||||
"topWindow" : "",
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取rightWindow配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"rightWindow" : "pages-config/rightWindow.json"
|
|
||||||
//文件的格式同pages.json,但只应包含rightWindow配置项
|
|
||||||
"rightWindow" : "",
|
|
||||||
|
|
||||||
//可指定一个文件路径,从该文件读取uniIdRouter配置;如果不设置,仍然使用pages.json中的配置项
|
|
||||||
//推荐配置:"uniIdRouter" : "pages-config/uniIdRouter.json"
|
|
||||||
//文件的格式同pages.json,但只应包含uniIdRouter配置项
|
|
||||||
"uniIdRouter" : "",
|
|
||||||
|
|
||||||
//默认启动首页,字符串配置(可以引入文件,也可以不引入文件),也可以直接在page.json中配置
|
|
||||||
//推荐配置:"entryPagePath" : "/...." 或 "entryPagePath" : "pages-config/entryPagePath.json"
|
|
||||||
"entryPagePath": ""
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
/* ===pages-tool===
|
|
||||||
该文件是pages-tool插件的配置文件
|
|
||||||
pages-tool插件可实现将pages.josn中的配置拆分到多个配置文件中,以便实现模块化配置。
|
|
||||||
在应用中配置项较多、页面较多时,分别在不同文件中进行配置,可使项目代码更为清晰。
|
|
||||||
在团队多人合作时,按模块分工,分别管理不同的配置文件,可避免同时修改pages.json带来的代码冲突问题。
|
|
||||||
|
|
||||||
注意:启用该插件并设置了配置文件之后,pages.json配置文件中相关配置项的内容可能会被替换,应根据paes-config.json的设置情况决定哪些配置应该在pages.josn中设置,哪些应该在指定的文件中设置。
|
|
||||||
提示:插件只会处理已设置的相关项点,不会覆盖pages.json中未指定的项点。详见配置示例
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
{
|
|
||||||
"globalStyle" : "pages-config/globalStyle.json",
|
|
||||||
|
|
||||||
"easycom" : "",
|
|
||||||
|
|
||||||
"tabBar" : "pages-config/tabBar.json",
|
|
||||||
|
|
||||||
"pages" : ["pages-config/pages-all.json"],
|
|
||||||
|
|
||||||
"condition" : "",
|
|
||||||
|
|
||||||
"leftWindow" : "",
|
|
||||||
|
|
||||||
"topWindow" : "",
|
|
||||||
|
|
||||||
"rightWindow" : "",
|
|
||||||
|
|
||||||
"uniIdRouter" : "",
|
|
||||||
|
|
||||||
///以下各项为小程序特有配置
|
|
||||||
|
|
||||||
"subPackages" : [],
|
|
||||||
|
|
||||||
"preloadRule" : "",
|
|
||||||
|
|
||||||
"workers" : "",
|
|
||||||
|
|
||||||
"entryPagePath": ""
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
/* /// Pages-Tool: 该文件是pages-tool插件的配置文件,根据pages-config.json的配置,本文件的内容可能合并到pages.json*/
|
|
||||||
{
|
|
||||||
"globalStyle": {
|
|
||||||
"navigationBarTextStyle": "black",
|
|
||||||
"navigationBarTitleText": "RuoYi",
|
|
||||||
"navigationBarBackgroundColor": "#FFFFFF"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
/* /// Pages-Tool: 该文件是pages-tool插件的配置文件,根据pages-config.json的配置,本文件的内容可能合并到pages.json*/
|
|
||||||
{
|
|
||||||
"pages": [{
|
|
||||||
"path": "pages/login",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "登录"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/register",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "注册"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "若依移动端框架",
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/work/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "工作台"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "我的"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/avatar/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "修改头像"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/info/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "个人信息"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/info/edit",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "编辑资料"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/pwd/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "修改密码"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/setting/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "应用设置"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/help/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "常见问题"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/mine/about/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "关于我们"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/common/webview/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "浏览网页"
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
"path": "pages/common/textview/index",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "浏览文本"
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/* /// Pages-Tool: 该文件是pages-tool插件的配置文件,根据pages-config.json的配置,本文件的内容可能合并到pages.json*/
|
|
||||||
{
|
|
||||||
"tabBar": {
|
|
||||||
"color": "#000000",
|
|
||||||
"selectedColor": "#000000",
|
|
||||||
"borderStyle": "white",
|
|
||||||
"backgroundColor": "#ffffff",
|
|
||||||
"list": [{
|
|
||||||
"pagePath": "pages/index",
|
|
||||||
"iconPath": "static/images/tabbar/home.png",
|
|
||||||
"selectedIconPath": "static/images/tabbar/home_.png",
|
|
||||||
"text": "首页"
|
|
||||||
}, {
|
|
||||||
"pagePath": "pages/work/index",
|
|
||||||
"iconPath": "static/images/tabbar/work.png",
|
|
||||||
"selectedIconPath": "static/images/tabbar/work_.png",
|
|
||||||
"text": "计算工具"
|
|
||||||
}, {
|
|
||||||
"pagePath": "pages/mine/index",
|
|
||||||
"iconPath": "static/images/tabbar/mine.png",
|
|
||||||
"selectedIconPath": "static/images/tabbar/mine_.png",
|
|
||||||
"text": "我的"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
48
pages.json
48
pages.json
@ -4,11 +4,6 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "登录"
|
"navigationBarTitleText": "登录"
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
"path": "pages/register",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "注册"
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/index",
|
"path": "pages/index",
|
||||||
"style": {
|
"style": {
|
||||||
@ -72,27 +67,28 @@
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"color": "#000000",
|
"color": "#000000",
|
||||||
"selectedColor": "#000000",
|
"selectedColor": "#000000",
|
||||||
"borderStyle": "white",
|
"borderStyle": "white",
|
||||||
"backgroundColor": "#ffffff",
|
"backgroundColor": "#ffffff",
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/index",
|
"pagePath": "pages/index",
|
||||||
"iconPath": "static/images/tabbar/home.png",
|
"iconPath": "static/images/tabbar/home.png",
|
||||||
"selectedIconPath": "static/images/tabbar/home_.png",
|
"selectedIconPath": "static/images/tabbar/home_.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
}, {
|
}, {
|
||||||
"pagePath": "pages/work/index",
|
"pagePath": "pages/work/index",
|
||||||
"iconPath": "static/images/tabbar/work.png",
|
"iconPath": "static/images/tabbar/work.png",
|
||||||
"selectedIconPath": "static/images/tabbar/work_.png",
|
"selectedIconPath": "static/images/tabbar/work_.png",
|
||||||
"text": "计算工具"
|
"text": "工作台"
|
||||||
}, {
|
}, {
|
||||||
"pagePath": "pages/mine/index",
|
"pagePath": "pages/mine/index",
|
||||||
"iconPath": "static/images/tabbar/mine.png",
|
"iconPath": "static/images/tabbar/mine.png",
|
||||||
"selectedIconPath": "static/images/tabbar/mine_.png",
|
"selectedIconPath": "static/images/tabbar/mine_.png",
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
}]
|
}
|
||||||
},
|
]
|
||||||
|
},
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
"navigationBarTitleText": "RuoYi",
|
"navigationBarTitleText": "RuoYi",
|
||||||
|
344
pages/login.vue
344
pages/login.vue
@ -1,207 +1,181 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="normal-login-container">
|
<view class="normal-login-container">
|
||||||
<view class="logo-content align-center justify-center flex">
|
<view class="logo-content align-center justify-center flex">
|
||||||
<image style="width: 100rpx; height: 100rpx" :src="globalConfig.appInfo.logo" mode="widthFix"></image>
|
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
||||||
<text class="title">若依移动端登录</text>
|
</image>
|
||||||
</view>
|
<text class="title">若依移动端登录</text>
|
||||||
<view class="login-form-content">
|
</view>
|
||||||
<view class="input-item flex align-center">
|
<view class="login-form-content">
|
||||||
<view class="iconfont icon-user icon"></view>
|
<view class="input-item flex align-center">
|
||||||
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
<view class="iconfont icon-user icon"></view>
|
||||||
</view>
|
<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
||||||
<view class="input-item flex align-center">
|
</view>
|
||||||
<view class="iconfont icon-password icon"></view>
|
<view class="input-item flex align-center">
|
||||||
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
<view class="iconfont icon-password icon"></view>
|
||||||
</view>
|
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
||||||
<view class="input-item flex align-center" style="width: 60%; margin: 0px" v-if="captchaEnabled">
|
</view>
|
||||||
<view class="iconfont icon-code icon"></view>
|
<view class="input-item flex align-center" v-if="captchaEnabled">
|
||||||
<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
<view class="iconfont icon-code icon"></view>
|
||||||
<view class="login-code">
|
<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
||||||
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<view class="action-btn">
|
||||||
<view class="action-btn">
|
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
||||||
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="reg text-center" v-if="register">
|
|
||||||
<text class="text-grey1">没有账号?</text>
|
<view class="xieyi text-center">
|
||||||
<text @click="handleUserRegister" class="text-blue">立即注册</text>
|
<text class="text-grey1">登录即代表同意</text>
|
||||||
</view>
|
<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
|
||||||
<view class="xieyi text-center">
|
<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
|
||||||
<text class="text-grey1">登录即代表同意</text>
|
</view>
|
||||||
<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
|
</view>
|
||||||
<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg } from '@/api/login';
|
import { getCodeImg } from '@/api/login'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
codeUrl: '',
|
codeUrl: "",
|
||||||
captchaEnabled: true,
|
captchaEnabled: true,
|
||||||
// 用户注册开关
|
globalConfig: getApp().globalData.config,
|
||||||
register: false,
|
loginForm: {
|
||||||
globalConfig: getApp().globalData.config,
|
username: "admin",
|
||||||
loginForm: {
|
password: "admin123",
|
||||||
username: 'admin',
|
code: "",
|
||||||
password: 'admin123',
|
uuid: ''
|
||||||
code: '',
|
}
|
||||||
uuid: ''
|
}
|
||||||
}
|
},
|
||||||
};
|
created() {
|
||||||
},
|
this.getCode()
|
||||||
created() {
|
},
|
||||||
this.getCode();
|
methods: {
|
||||||
},
|
// 隐私协议
|
||||||
methods: {
|
handlePrivacy() {
|
||||||
handleConversion(result) {
|
let site = this.globalConfig.appInfo.agreements[0]
|
||||||
// console.log('初始值:', result.initialValue);
|
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
||||||
// console.log('新值:', result.newValue);
|
},
|
||||||
// console.log('老单位:', result.oldUnit);
|
// 用户协议
|
||||||
// console.log('新单位:', result.newUnit);
|
handleUserAgrement() {
|
||||||
},
|
let site = this.globalConfig.appInfo.agreements[1]
|
||||||
// 用户注册
|
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
||||||
handleUserRegister() {
|
},
|
||||||
this.$tab.redirectTo(`/pages/register`);
|
// 获取图形验证码
|
||||||
},
|
getCode() {
|
||||||
// 隐私协议
|
getCodeImg().then(res => {
|
||||||
handlePrivacy() {
|
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
||||||
let site = this.globalConfig.appInfo.agreements[0];
|
if (this.captchaEnabled) {
|
||||||
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`);
|
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||||
},
|
this.loginForm.uuid = res.uuid
|
||||||
// 用户协议
|
}
|
||||||
handleUserAgrement() {
|
})
|
||||||
let site = this.globalConfig.appInfo.agreements[1];
|
},
|
||||||
this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`);
|
// 登录方法
|
||||||
},
|
async handleLogin() {
|
||||||
// 获取图形验证码
|
if (this.loginForm.username === "") {
|
||||||
getCode() {
|
this.$modal.msgError("请输入您的账号")
|
||||||
getCodeImg().then((res) => {
|
} else if (this.loginForm.password === "") {
|
||||||
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
this.$modal.msgError("请输入您的密码")
|
||||||
if (this.captchaEnabled) {
|
} else if (this.loginForm.code === "" && this.captchaEnabled) {
|
||||||
this.codeUrl = 'data:image/gif;base64,' + res.img;
|
this.$modal.msgError("请输入验证码")
|
||||||
this.loginForm.uuid = res.uuid;
|
} else {
|
||||||
}
|
this.$modal.loading("登录中,请耐心等待...")
|
||||||
});
|
this.pwdLogin()
|
||||||
},
|
}
|
||||||
// 登录方法
|
},
|
||||||
async handleLogin() {
|
// 密码登录
|
||||||
if (this.loginForm.username === '') {
|
async pwdLogin() {
|
||||||
this.$modal.msgError('请输入您的账号');
|
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||||
} else if (this.loginForm.password === '') {
|
this.$modal.closeLoading()
|
||||||
this.$modal.msgError('请输入您的密码');
|
this.loginSuccess()
|
||||||
} else if (this.loginForm.code === '' && this.captchaEnabled) {
|
}).catch(() => {
|
||||||
this.$modal.msgError('请输入验证码');
|
if (this.captchaEnabled) {
|
||||||
} else {
|
this.getCode()
|
||||||
this.$modal.loading('登录中,请耐心等待...');
|
}
|
||||||
this.pwdLogin();
|
})
|
||||||
}
|
},
|
||||||
},
|
// 登录成功后,处理函数
|
||||||
// 密码登录
|
loginSuccess(result) {
|
||||||
async pwdLogin() {
|
// 设置用户信息
|
||||||
this.$store
|
this.$store.dispatch('GetInfo').then(res => {
|
||||||
.dispatch('Login', this.loginForm)
|
this.$tab.reLaunch('/pages/index')
|
||||||
.then(() => {
|
})
|
||||||
this.$modal.closeLoading();
|
}
|
||||||
this.loginSuccess();
|
}
|
||||||
})
|
}
|
||||||
.catch(() => {
|
|
||||||
if (this.captchaEnabled) {
|
|
||||||
this.getCode();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 登录成功后,处理函数
|
|
||||||
loginSuccess(result) {
|
|
||||||
// 设置用户信息
|
|
||||||
this.$store.dispatch('GetInfo').then((res) => {
|
|
||||||
this.$tab.reLaunch('/pages/index');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.normal-login-container {
|
.normal-login-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.logo-content {
|
.logo-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 15%;
|
padding-top: 15%;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form-content {
|
.login-form-content {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
margin-top: 15%;
|
margin-top: 15%;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
|
||||||
.input-item {
|
.input-item {
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
background-color: #f5f6f7;
|
background-color: #f5f6f7;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 38rpx;
|
font-size: 38rpx;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.login-btn {
|
}
|
||||||
margin-top: 40px;
|
|
||||||
height: 45px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reg {
|
.login-btn {
|
||||||
margin-top: 15px;
|
margin-top: 40px;
|
||||||
}
|
height: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
.xieyi {
|
.xieyi {
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.login-code {
|
.easyinput {
|
||||||
height: 38px;
|
width: 100%;
|
||||||
float: right;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.login-code-img {
|
.login-code-img {
|
||||||
height: 38px;
|
height: 45px;
|
||||||
position: absolute;
|
}
|
||||||
margin-left: 10px;
|
|
||||||
width: 200rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,209 +1,198 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="mine-container" :style="{ height: `${windowHeight}px` }">
|
<view class="mine-container" :style="{height: `${windowHeight}px`}">
|
||||||
<yjly-number_unit
|
<!--顶部个人信息栏-->
|
||||||
:unitType="'length'"
|
<view class="header-section">
|
||||||
:unitName.sync="selectedUnitName"
|
<view class="flex padding justify-between">
|
||||||
:value.sync="inputValue"
|
<view class="flex align-center">
|
||||||
:showEnglishOnly="true"
|
<view v-if="!avatar" class="cu-avatar xl round bg-white">
|
||||||
:decimalPlaces="5"
|
<view class="iconfont icon-people text-gray icon"></view>
|
||||||
@conversion="handleConversion"
|
</view>
|
||||||
></yjly-number_unit>
|
<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
|
||||||
<!--顶部个人信息栏-->
|
</image>
|
||||||
<view class="header-section">
|
<view v-if="!name" @click="handleToLogin" class="login-tip">
|
||||||
<view class="flex padding justify-between">
|
点击登录
|
||||||
<view class="flex align-center">
|
</view>
|
||||||
<view v-if="!avatar" class="cu-avatar xl round bg-white">
|
<view v-if="name" @click="handleToInfo" class="user-info">
|
||||||
<view class="iconfont icon-people text-gray icon"></view>
|
<view class="u_title">
|
||||||
</view>
|
用户名:{{ name }}
|
||||||
<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix"></image>
|
</view>
|
||||||
<view v-if="!name" @click="handleToLogin" class="login-tip">点击登录</view>
|
</view>
|
||||||
<view v-if="name" @click="handleToInfo" class="user-info">
|
</view>
|
||||||
<view class="u_title">用户名:{{ name }}</view>
|
<view @click="handleToInfo" class="flex align-center">
|
||||||
</view>
|
<text>个人信息</text>
|
||||||
</view>
|
<view class="iconfont icon-right"></view>
|
||||||
<view @click="handleToInfo" class="flex align-center">
|
</view>
|
||||||
<text>个人信息</text>
|
</view>
|
||||||
<view class="iconfont icon-right"></view>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="content-section">
|
<view class="content-section">
|
||||||
<view class="mine-actions grid col-4 text-center">
|
<view class="mine-actions grid col-4 text-center">
|
||||||
<view class="action-item" @click="handleJiaoLiuQun">
|
<view class="action-item" @click="handleJiaoLiuQun">
|
||||||
<view class="iconfont icon-friendfill text-pink icon"></view>
|
<view class="iconfont icon-friendfill text-pink icon"></view>
|
||||||
<text class="text">交流群</text>
|
<text class="text">交流群</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="action-item" @click="handleBuilding">
|
<view class="action-item" @click="handleBuilding">
|
||||||
<view class="iconfont icon-service text-blue icon"></view>
|
<view class="iconfont icon-service text-blue icon"></view>
|
||||||
<text class="text">在线客服</text>
|
<text class="text">在线客服</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="action-item" @click="handleBuilding">
|
<view class="action-item" @click="handleBuilding">
|
||||||
<view class="iconfont icon-community text-mauve icon"></view>
|
<view class="iconfont icon-community text-mauve icon"></view>
|
||||||
<text class="text">反馈社区</text>
|
<text class="text">反馈社区</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="action-item" @click="handleBuilding">
|
<view class="action-item" @click="handleBuilding">
|
||||||
<view class="iconfont icon-dianzan text-green icon"></view>
|
<view class="iconfont icon-dianzan text-green icon"></view>
|
||||||
<text class="text">点赞我们</text>
|
<text class="text">点赞我们</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="menu-list">
|
<view class="menu-list">
|
||||||
<view class="list-cell list-cell-arrow" @click="handleToEditInfo">
|
<view class="list-cell list-cell-arrow" @click="handleToEditInfo">
|
||||||
<view class="menu-item-box">
|
<view class="menu-item-box">
|
||||||
<view class="iconfont icon-user menu-icon"></view>
|
<view class="iconfont icon-user menu-icon"></view>
|
||||||
<view>编辑资料</view>
|
<view>编辑资料</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="list-cell list-cell-arrow" @click="handleHelp">
|
<view class="list-cell list-cell-arrow" @click="handleHelp">
|
||||||
<view class="menu-item-box">
|
<view class="menu-item-box">
|
||||||
<view class="iconfont icon-help menu-icon"></view>
|
<view class="iconfont icon-help menu-icon"></view>
|
||||||
<view>常见问题</view>
|
<view>常见问题</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="list-cell list-cell-arrow" @click="handleAbout">
|
<view class="list-cell list-cell-arrow" @click="handleAbout">
|
||||||
<view class="menu-item-box">
|
<view class="menu-item-box">
|
||||||
<view class="iconfont icon-aixin menu-icon"></view>
|
<view class="iconfont icon-aixin menu-icon"></view>
|
||||||
<view>关于我们</view>
|
<view>关于我们</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="list-cell list-cell-arrow" @click="handleToSetting">
|
<view class="list-cell list-cell-arrow" @click="handleToSetting">
|
||||||
<view class="menu-item-box">
|
<view class="menu-item-box">
|
||||||
<view class="iconfont icon-setting menu-icon"></view>
|
<view class="iconfont icon-setting menu-icon"></view>
|
||||||
<view>应用设置</view>
|
<view>应用设置</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/utils/storage';
|
import storage from '@/utils/storage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedUnitName: 'm(米)',
|
name: this.$store.state.user.name,
|
||||||
inputValue: 12,
|
version: getApp().globalData.config.appInfo.version
|
||||||
|
}
|
||||||
name: this.$store.state.user.name,
|
},
|
||||||
version: getApp().globalData.config.appInfo.version
|
computed: {
|
||||||
};
|
avatar() {
|
||||||
},
|
return this.$store.state.user.avatar
|
||||||
computed: {
|
},
|
||||||
avatar() {
|
windowHeight() {
|
||||||
return this.$store.state.user.avatar;
|
return uni.getSystemInfoSync().windowHeight - 50
|
||||||
},
|
}
|
||||||
windowHeight() {
|
},
|
||||||
return uni.getSystemInfoSync().windowHeight - 50;
|
methods: {
|
||||||
}
|
handleToInfo() {
|
||||||
},
|
this.$tab.navigateTo('/pages/mine/info/index')
|
||||||
methods: {
|
},
|
||||||
handleConversion(result) {
|
handleToEditInfo() {
|
||||||
// console.log('初始值:', result.initialValue);
|
this.$tab.navigateTo('/pages/mine/info/edit')
|
||||||
// console.log('新值:', result.newValue);
|
},
|
||||||
// console.log('老单位:', result.oldUnit);
|
handleToSetting() {
|
||||||
// console.log('新单位:', result.newUnit);
|
this.$tab.navigateTo('/pages/mine/setting/index')
|
||||||
},
|
},
|
||||||
|
handleToLogin() {
|
||||||
handleToInfo() {
|
this.$tab.reLaunch('/pages/login')
|
||||||
this.$tab.navigateTo('/pages/mine/info/index');
|
},
|
||||||
},
|
handleToAvatar() {
|
||||||
handleToEditInfo() {
|
this.$tab.navigateTo('/pages/mine/avatar/index')
|
||||||
this.$tab.navigateTo('/pages/mine/info/edit');
|
},
|
||||||
},
|
handleLogout() {
|
||||||
handleToSetting() {
|
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
||||||
this.$tab.navigateTo('/pages/mine/setting/index');
|
this.$store.dispatch('LogOut').then(() => {
|
||||||
},
|
this.$tab.reLaunch('/pages/index')
|
||||||
handleToLogin() {
|
})
|
||||||
this.$tab.reLaunch('/pages/login');
|
})
|
||||||
},
|
},
|
||||||
handleToAvatar() {
|
handleHelp() {
|
||||||
this.$tab.navigateTo('/pages/mine/avatar/index');
|
this.$tab.navigateTo('/pages/mine/help/index')
|
||||||
},
|
},
|
||||||
handleLogout() {
|
handleAbout() {
|
||||||
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
this.$tab.navigateTo('/pages/mine/about/index')
|
||||||
this.$store.dispatch('LogOut').then(() => {
|
},
|
||||||
this.$tab.reLaunch('/pages/index');
|
handleJiaoLiuQun() {
|
||||||
});
|
this.$modal.showToast('QQ群:133713780')
|
||||||
});
|
},
|
||||||
},
|
handleBuilding() {
|
||||||
handleHelp() {
|
this.$modal.showToast('模块建设中~')
|
||||||
this.$tab.navigateTo('/pages/mine/help/index');
|
}
|
||||||
},
|
}
|
||||||
handleAbout() {
|
}
|
||||||
this.$tab.navigateTo('/pages/mine/about/index');
|
|
||||||
},
|
|
||||||
handleJiaoLiuQun() {
|
|
||||||
this.$modal.showToast('QQ群:①133713780、②146013835');
|
|
||||||
},
|
|
||||||
handleBuilding() {
|
|
||||||
this.$modal.showToast('模块建设中~');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background-color: #f5f6f7;
|
background-color: #f5f6f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mine-container {
|
.mine-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
.header-section {
|
|
||||||
padding: 15px 15px 45px 15px;
|
|
||||||
background-color: #3c96f3;
|
|
||||||
color: white;
|
|
||||||
|
|
||||||
.login-tip {
|
.header-section {
|
||||||
font-size: 18px;
|
padding: 15px 15px 45px 15px;
|
||||||
margin-left: 10px;
|
background-color: #3c96f3;
|
||||||
}
|
color: white;
|
||||||
|
|
||||||
.cu-avatar {
|
.login-tip {
|
||||||
border: 2px solid #eaeaea;
|
font-size: 18px;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.icon {
|
.cu-avatar {
|
||||||
font-size: 40px;
|
border: 2px solid #eaeaea;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-info {
|
.icon {
|
||||||
margin-left: 15px;
|
font-size: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.u_title {
|
.user-info {
|
||||||
font-size: 18px;
|
margin-left: 15px;
|
||||||
line-height: 30px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-section {
|
.u_title {
|
||||||
position: relative;
|
font-size: 18px;
|
||||||
top: -50px;
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mine-actions {
|
.content-section {
|
||||||
margin: 15px 15px;
|
position: relative;
|
||||||
padding: 20px 0px;
|
top: -50px;
|
||||||
border-radius: 8px;
|
|
||||||
background-color: white;
|
|
||||||
|
|
||||||
.action-item {
|
.mine-actions {
|
||||||
.icon {
|
margin: 15px 15px;
|
||||||
font-size: 28px;
|
padding: 20px 0px;
|
||||||
}
|
border-radius: 8px;
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
.text {
|
.action-item {
|
||||||
display: block;
|
.icon {
|
||||||
font-size: 13px;
|
font-size: 28px;
|
||||||
margin: 8px 0px;
|
}
|
||||||
}
|
|
||||||
}
|
.text {
|
||||||
}
|
display: block;
|
||||||
}
|
font-size: 13px;
|
||||||
}
|
margin: 8px 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,196 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="normal-login-container">
|
|
||||||
<view class="logo-content align-center justify-center flex">
|
|
||||||
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
|
||||||
</image>
|
|
||||||
<text class="title">若依移动端注册</text>
|
|
||||||
</view>
|
|
||||||
<view class="login-form-content">
|
|
||||||
<view class="input-item flex align-center">
|
|
||||||
<view class="iconfont icon-user icon"></view>
|
|
||||||
<input v-model="registerForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
|
||||||
</view>
|
|
||||||
<view class="input-item flex align-center">
|
|
||||||
<view class="iconfont icon-password icon"></view>
|
|
||||||
<input v-model="registerForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
|
||||||
</view>
|
|
||||||
<view class="input-item flex align-center">
|
|
||||||
<view class="iconfont icon-password icon"></view>
|
|
||||||
<input v-model="registerForm.confirmPassword" type="password" class="input" placeholder="请输入重复密码" maxlength="20" />
|
|
||||||
</view>
|
|
||||||
<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
|
||||||
<view class="iconfont icon-code icon"></view>
|
|
||||||
<input v-model="registerForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
|
||||||
<view class="login-code">
|
|
||||||
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="action-btn">
|
|
||||||
<button @click="handleRegister()" class="register-btn cu-btn block bg-blue lg round">注册</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="xieyi text-center">
|
|
||||||
<text @click="handleUserLogin" class="text-blue">使用已有账号登录</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getCodeImg, register } from '@/api/login'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
codeUrl: "",
|
|
||||||
captchaEnabled: true,
|
|
||||||
globalConfig: getApp().globalData.config,
|
|
||||||
registerForm: {
|
|
||||||
username: "",
|
|
||||||
password: "",
|
|
||||||
confirmPassword: "",
|
|
||||||
code: "",
|
|
||||||
uuid: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getCode()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 用户登录
|
|
||||||
handleUserLogin() {
|
|
||||||
this.$tab.navigateTo(`/pages/login`)
|
|
||||||
},
|
|
||||||
// 获取图形验证码
|
|
||||||
getCode() {
|
|
||||||
getCodeImg().then(res => {
|
|
||||||
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
|
||||||
if (this.captchaEnabled) {
|
|
||||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
|
||||||
this.registerForm.uuid = res.uuid
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 注册方法
|
|
||||||
async handleRegister() {
|
|
||||||
if (this.registerForm.username === "") {
|
|
||||||
this.$modal.msgError("请输入您的账号")
|
|
||||||
} else if (this.registerForm.password === "") {
|
|
||||||
this.$modal.msgError("请输入您的密码")
|
|
||||||
} else if (this.registerForm.confirmPassword === "") {
|
|
||||||
this.$modal.msgError("请再次输入您的密码")
|
|
||||||
} else if (this.registerForm.password !== this.registerForm.confirmPassword) {
|
|
||||||
this.$modal.msgError("两次输入的密码不一致")
|
|
||||||
} else if (this.registerForm.code === "" && this.captchaEnabled) {
|
|
||||||
this.$modal.msgError("请输入验证码")
|
|
||||||
} else {
|
|
||||||
this.$modal.loading("注册中,请耐心等待...")
|
|
||||||
this.register()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 用户注册
|
|
||||||
async register() {
|
|
||||||
register(this.registerForm).then(res => {
|
|
||||||
this.$modal.closeLoading()
|
|
||||||
uni.showModal({
|
|
||||||
title: "系统提示",
|
|
||||||
content: "恭喜你,您的账号 " + this.registerForm.username + " 注册成功!",
|
|
||||||
success: function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.redirectTo({ url: `/pages/login` });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}).catch(() => {
|
|
||||||
if (this.captchaEnabled) {
|
|
||||||
this.getCode()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 注册成功后,处理函数
|
|
||||||
registerSuccess(result) {
|
|
||||||
// 设置用户信息
|
|
||||||
this.$store.dispatch('GetInfo').then(res => {
|
|
||||||
this.$tab.reLaunch('/pages/index')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
page {
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.normal-login-container {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
.logo-content {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 21px;
|
|
||||||
text-align: center;
|
|
||||||
padding-top: 15%;
|
|
||||||
|
|
||||||
image {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-form-content {
|
|
||||||
text-align: center;
|
|
||||||
margin: 20px auto;
|
|
||||||
margin-top: 15%;
|
|
||||||
width: 80%;
|
|
||||||
|
|
||||||
.input-item {
|
|
||||||
margin: 20px auto;
|
|
||||||
background-color: #f5f6f7;
|
|
||||||
height: 45px;
|
|
||||||
border-radius: 20px;
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
font-size: 38rpx;
|
|
||||||
margin-left: 10px;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 20px;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.register-btn {
|
|
||||||
margin-top: 40px;
|
|
||||||
height: 45px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.xieyi {
|
|
||||||
color: #333;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-code {
|
|
||||||
height: 38px;
|
|
||||||
float: right;
|
|
||||||
|
|
||||||
.login-code-img {
|
|
||||||
height: 38px;
|
|
||||||
position: absolute;
|
|
||||||
margin-left: 10px;
|
|
||||||
width: 200rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
@ -5,7 +5,7 @@ const loginPage = "/pages/login"
|
|||||||
|
|
||||||
// 页面白名单
|
// 页面白名单
|
||||||
const whiteList = [
|
const whiteList = [
|
||||||
'/pages/login', '/pages/register', '/pages/common/webview/index'
|
'/pages/login', '/pages/common/webview/index'
|
||||||
]
|
]
|
||||||
|
|
||||||
// 检查地址白名单
|
// 检查地址白名单
|
||||||
|
@ -25,18 +25,18 @@ export default {
|
|||||||
uni.hideToast()
|
uni.hideToast()
|
||||||
},
|
},
|
||||||
// 弹出提示
|
// 弹出提示
|
||||||
alert(content, title) {
|
alert(content) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: title || '系统提示',
|
title: '提示',
|
||||||
content: content,
|
content: content,
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 确认窗体
|
// 确认窗体
|
||||||
confirm(content, title) {
|
confirm(content) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: title || '系统提示',
|
title: '系统提示',
|
||||||
content: content,
|
content: content,
|
||||||
cancelText: '取消',
|
cancelText: '取消',
|
||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,3 @@
|
|||||||
## 1.2.2(2023-01-28)
|
|
||||||
- 修复 运行/打包 控制台警告问题
|
|
||||||
## 1.2.1(2022-09-05)
|
|
||||||
- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
|
|
||||||
## 1.2.0(2021-11-19)
|
## 1.2.0(2021-11-19)
|
||||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge)
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-badge--x">
|
<view class="uni-badge--x">
|
||||||
<slot />
|
<slot />
|
||||||
<text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]"
|
<text v-if="text" :class="classNames" :style="[badgeWidth, positionStyle, customStyle, dotStyle]"
|
||||||
class="uni-badge" @click="onClick()">{{displayValue}}</text>
|
class="uni-badge" @click="onClick()">{{displayValue}}</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -130,13 +130,16 @@
|
|||||||
const match = whiteList[this.absolute]
|
const match = whiteList[this.absolute]
|
||||||
return match ? match : whiteList['rightTop']
|
return match ? match : whiteList['rightTop']
|
||||||
},
|
},
|
||||||
|
badgeWidth() {
|
||||||
|
return {
|
||||||
|
width: `${this.width}px`
|
||||||
|
}
|
||||||
|
},
|
||||||
dotStyle() {
|
dotStyle() {
|
||||||
if (!this.isDot) return {}
|
if (!this.isDot) return {}
|
||||||
return {
|
return {
|
||||||
width: '10px',
|
width: '10px',
|
||||||
minWidth: '0',
|
|
||||||
height: '10px',
|
height: '10px',
|
||||||
padding: '0',
|
|
||||||
borderRadius: '10px'
|
borderRadius: '10px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -192,13 +195,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-feature-settings: "tnum";
|
|
||||||
min-width: 20px;
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
padding: 0 4px;
|
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-badge",
|
"id": "uni-badge",
|
||||||
"displayName": "uni-badge 数字角标",
|
"displayName": "uni-badge 数字角标",
|
||||||
"version": "1.2.2",
|
"version": "1.2.0",
|
||||||
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
|
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"",
|
"",
|
||||||
@ -18,7 +18,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -35,8 +39,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-scss"],
|
"dependencies": ["uni-scss"],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
## 0.1.2(2022-06-08)
|
## 0.1.2(2022-06-08)
|
||||||
- 修复 微信小程序 separator 不显示的Bug
|
- 修复 微信小程序 separator 不显示问题
|
||||||
## 0.1.1(2022-06-02)
|
## 0.1.1(2022-06-02)
|
||||||
- 新增 支持 uni.scss 修改颜色
|
- 新增 支持 uni.scss 修改颜色
|
||||||
## 0.1.0(2022-04-21)
|
## 0.1.0(2022-04-21)
|
||||||
|
@ -1,23 +1,13 @@
|
|||||||
## 1.4.10(2023-04-10)
|
|
||||||
- 修复 某些情况 monthSwitch 未触发的Bug
|
|
||||||
## 1.4.9(2023-02-02)
|
|
||||||
- 修复 某些情况切换月份错误的Bug
|
|
||||||
## 1.4.8(2023-01-30)
|
|
||||||
- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/161964)
|
|
||||||
## 1.4.7(2022-09-16)
|
|
||||||
- 优化 支持使用 uni-scss 控制主题色
|
|
||||||
## 1.4.6(2022-09-08)
|
|
||||||
- 修复 表头年月切换,导致改变当前日期为选择月1号,且未触发change事件的Bug
|
|
||||||
## 1.4.5(2022-02-25)
|
## 1.4.5(2022-02-25)
|
||||||
- 修复 条件编译 nvue 不支持的 css 样式的Bug
|
- 修复 条件编译 nvue 不支持的 css 样式
|
||||||
## 1.4.4(2022-02-25)
|
## 1.4.4(2022-02-25)
|
||||||
- 修复 条件编译 nvue 不支持的 css 样式的Bug
|
- 修复 条件编译 nvue 不支持的 css 样式
|
||||||
## 1.4.3(2021-09-22)
|
## 1.4.3(2021-09-22)
|
||||||
- 修复 startDate、 endDate 属性失效的Bug
|
- 修复 startDate、 endDate 属性失效的 bug
|
||||||
## 1.4.2(2021-08-24)
|
## 1.4.2(2021-08-24)
|
||||||
- 新增 支持国际化
|
- 新增 支持国际化
|
||||||
## 1.4.1(2021-08-05)
|
## 1.4.1(2021-08-05)
|
||||||
- 修复 弹出层被 tabbar 遮盖的Bug
|
- 修复 弹出层被 tabbar 遮盖 bug
|
||||||
## 1.4.0(2021-07-30)
|
## 1.4.0(2021-07-30)
|
||||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||||
## 1.3.16(2021-05-12)
|
## 1.3.16(2021-05-12)
|
||||||
|
@ -51,10 +51,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
import {
|
||||||
import i18nMessages from './i18n/index.js'
|
initVueI18n
|
||||||
const { t } = initVueI18n(i18nMessages)
|
} from '@dcloudio/uni-i18n'
|
||||||
|
import messages from './i18n/index.js'
|
||||||
|
const { t } = initVueI18n(messages)
|
||||||
export default {
|
export default {
|
||||||
emits:['change'],
|
emits:['change'],
|
||||||
props: {
|
props: {
|
||||||
@ -101,7 +102,7 @@
|
|||||||
$uni-color-error: #e43d33;
|
$uni-color-error: #e43d33;
|
||||||
$uni-opacity-disabled: 0.3;
|
$uni-opacity-disabled: 0.3;
|
||||||
$uni-text-color-disable:#c0c0c0;
|
$uni-text-color-disable:#c0c0c0;
|
||||||
$uni-primary: #2979ff !default;
|
$uni-color-primary: #2979ff;
|
||||||
.uni-calendar-item__weeks-box {
|
.uni-calendar-item__weeks-box {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -151,11 +152,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item--isDay-text {
|
.uni-calendar-item--isDay-text {
|
||||||
color: $uni-primary;
|
color: $uni-color-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item--isDay {
|
.uni-calendar-item--isDay {
|
||||||
background-color: $uni-primary;
|
background-color: $uni-color-primary;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@ -166,13 +167,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item--checked {
|
.uni-calendar-item--checked {
|
||||||
background-color: $uni-primary;
|
background-color: $uni-color-primary;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item--multiple {
|
.uni-calendar-item--multiple {
|
||||||
background-color: $uni-primary;
|
background-color: $uni-color-primary;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<view class="uni-calendar__header-btn-box" @click.stop="next">
|
<view class="uni-calendar__header-btn-box" @click.stop="next">
|
||||||
<view class="uni-calendar__header-btn uni-calendar--right"></view>
|
<view class="uni-calendar__header-btn uni-calendar--right"></view>
|
||||||
</view>
|
</view>
|
||||||
<text class="uni-calendar__backtoday" @click="backToday">{{todayText}}</text>
|
<text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-calendar__box">
|
<view class="uni-calendar__box">
|
||||||
@ -62,12 +62,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Calendar from './util.js';
|
import Calendar from './util.js';
|
||||||
import CalendarItem from './uni-calendar-item.vue'
|
import calendarItem from './uni-calendar-item.vue'
|
||||||
|
import {
|
||||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
initVueI18n
|
||||||
import i18nMessages from './i18n/index.js'
|
} from '@dcloudio/uni-i18n'
|
||||||
const { t } = initVueI18n(i18nMessages)
|
import messages from './i18n/index.js'
|
||||||
|
const { t } = initVueI18n(messages)
|
||||||
/**
|
/**
|
||||||
* Calendar 日历
|
* Calendar 日历
|
||||||
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
|
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
|
||||||
@ -90,7 +90,7 @@
|
|||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
CalendarItem
|
calendarItem
|
||||||
},
|
},
|
||||||
emits:['close','confirm','change','monthSwitch'],
|
emits:['close','confirm','change','monthSwitch'],
|
||||||
props: {
|
props: {
|
||||||
@ -199,26 +199,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
// 获取日历方法实例
|
||||||
this.cale = new Calendar({
|
this.cale = new Calendar({
|
||||||
|
// date: new Date(),
|
||||||
selected: this.selected,
|
selected: this.selected,
|
||||||
startDate: this.startDate,
|
startDate: this.startDate,
|
||||||
endDate: this.endDate,
|
endDate: this.endDate,
|
||||||
range: this.range,
|
range: this.range,
|
||||||
})
|
})
|
||||||
|
// 选中某一天
|
||||||
|
// this.cale.setDate(this.date)
|
||||||
this.init(this.date)
|
this.init(this.date)
|
||||||
|
// this.setDay
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 取消穿透
|
// 取消穿透
|
||||||
clean() {},
|
clean() {},
|
||||||
bindDateChange(e) {
|
bindDateChange(e) {
|
||||||
const value = e.detail.value + '-1'
|
const value = e.detail.value + '-1'
|
||||||
this.setDate(value)
|
console.log(this.cale.getDate(value));
|
||||||
|
this.init(value)
|
||||||
const { year,month } = this.cale.getDate(value)
|
|
||||||
this.$emit('monthSwitch', {
|
|
||||||
year,
|
|
||||||
month
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 初始化日期显示
|
* 初始化日期显示
|
||||||
@ -323,16 +323,11 @@
|
|||||||
/**
|
/**
|
||||||
* 回到今天
|
* 回到今天
|
||||||
*/
|
*/
|
||||||
backToday() {
|
backtoday() {
|
||||||
const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`
|
console.log(this.cale.getDate(new Date()).fullDate);
|
||||||
const date = this.cale.getDate(new Date())
|
let date = this.cale.getDate(new Date()).fullDate
|
||||||
const todayYearMonth = `${date.year}-${date.month}`
|
// this.cale.setDate(date)
|
||||||
|
this.init(date)
|
||||||
if(nowYearMonth !== todayYearMonth) {
|
|
||||||
this.monthSwitch()
|
|
||||||
}
|
|
||||||
|
|
||||||
this.init(date.fullDate)
|
|
||||||
this.change()
|
this.change()
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -451,6 +446,7 @@
|
|||||||
|
|
||||||
.uni-calendar--fixed-width {
|
.uni-calendar--fixed-width {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
|
// padding: 0 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar__backtoday {
|
.uni-calendar__backtoday {
|
||||||
|
@ -76,20 +76,10 @@ class Calendar {
|
|||||||
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
break
|
break
|
||||||
case 'month':
|
case 'month':
|
||||||
if (dd.getDate() === 31 && AddDayCount>0) {
|
if (dd.getDate() === 31) {
|
||||||
dd.setDate(dd.getDate() + AddDayCount)
|
dd.setDate(dd.getDate() + AddDayCount)
|
||||||
} else {
|
} else {
|
||||||
const preMonth = dd.getMonth()
|
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期
|
|
||||||
const nextMonth = dd.getMonth()
|
|
||||||
// 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
|
|
||||||
if(AddDayCount<0 && preMonth!==0 && nextMonth-preMonth>AddDayCount){
|
|
||||||
dd.setMonth(nextMonth+(nextMonth-preMonth+AddDayCount))
|
|
||||||
}
|
|
||||||
// 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
|
|
||||||
if(AddDayCount>0 && nextMonth-preMonth>AddDayCount){
|
|
||||||
dd.setMonth(nextMonth-(nextMonth-preMonth-AddDayCount))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'year':
|
case 'year':
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-calendar",
|
"id": "uni-calendar",
|
||||||
"displayName": "uni-calendar 日历",
|
"displayName": "uni-calendar 日历",
|
||||||
"version": "1.4.10",
|
"version": "1.4.5",
|
||||||
"description": "日历组件",
|
"description": "日历组件",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -18,7 +18,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -35,8 +39,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
|||||||
### Calendar Props
|
### Calendar Props
|
||||||
|
|
||||||
| 属性名 | 类型 | 默认值| 说明 |
|
| 属性名 | 类型 | 默认值| 说明 |
|
||||||
| - | - | - | - |
|
| | |
|
||||||
| date | String |- | 自定义当前时间,默认为今天 |
|
| date | String |- | 自定义当前时间,默认为今天 |
|
||||||
| lunar | Boolean | false | 显示农历 |
|
| lunar | Boolean | false | 显示农历 |
|
||||||
| startDate | String |- | 日期选择范围-开始日期 |
|
| startDate | String |- | 日期选择范围-开始日期 |
|
||||||
@ -91,7 +91,7 @@ export default {
|
|||||||
### Calendar Events
|
### Calendar Events
|
||||||
|
|
||||||
| 事件名 | 说明 |返回值|
|
| 事件名 | 说明 |返回值|
|
||||||
| - | - | - |
|
| | | |
|
||||||
| open | 弹出日历组件,`insert :false` 时生效|- |
|
| open | 弹出日历组件,`insert :false` 时生效|- |
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-card__header-extra" @click="onClick('extra')">
|
<view class="uni-card__header-extra" @click="onClick('extra')">
|
||||||
<slot name="extra">
|
<text class="uni-card__header-extra-text">{{ extra }}</text>
|
||||||
<text class="uni-card__header-extra-text">{{ extra }}</text>
|
|
||||||
</slot>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
|
@ -5,23 +5,23 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="uni-combox__input-box">
|
<view class="uni-combox__input-box">
|
||||||
<input class="uni-combox__input" type="text" :placeholder="placeholder"
|
<input class="uni-combox__input" type="text" :placeholder="placeholder"
|
||||||
placeholder-class="uni-combox__input-plac" v-model="inputVal" @input="onInput" @focus="onFocus" @blur="onBlur" />
|
placeholder-class="uni-combox__input-plac" v-model="inputVal" @input="onInput" @focus="onFocus"
|
||||||
|
@blur="onBlur" />
|
||||||
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector">
|
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector">
|
||||||
</uni-icons>
|
</uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-combox__selector" v-if="showSelector">
|
<view class="uni-combox__selector" v-if="showSelector">
|
||||||
<view class="uni-popper__arrow"></view>
|
<view class="uni-popper__arrow"></view>
|
||||||
<scroll-view scroll-y="true" class="uni-combox__selector-scroll" @scroll="onScroll">
|
<scroll-view scroll-y="true" class="uni-combox__selector-scroll">
|
||||||
<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
|
<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
|
||||||
<text>{{emptyTips}}</text>
|
<text>{{emptyTips}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index" @click="onSelectorClick(index)">
|
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index"
|
||||||
|
@click="onSelectorClick(index)">
|
||||||
<text>{{item}}</text>
|
<text>{{item}}</text>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 新增蒙层,点击蒙层时关闭选项显示 -->
|
|
||||||
<view class="uni-combox__mask" v-show="showSelector" @click="showSelector = false"></view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -83,8 +83,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showSelector: false,
|
showSelector: false,
|
||||||
inputVal: '',
|
inputVal: ''
|
||||||
blurTimer:null,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -95,9 +94,6 @@
|
|||||||
return `width: ${this.labelWidth}`
|
return `width: ${this.labelWidth}`
|
||||||
},
|
},
|
||||||
filterCandidates() {
|
filterCandidates() {
|
||||||
if (this.inputVal !== 0 && !this.inputVal) {
|
|
||||||
return this.candidates
|
|
||||||
}
|
|
||||||
return this.candidates.filter((item) => {
|
return this.candidates.filter((item) => {
|
||||||
return item.toString().indexOf(this.inputVal) > -1
|
return item.toString().indexOf(this.inputVal) > -1
|
||||||
})
|
})
|
||||||
@ -132,16 +128,10 @@
|
|||||||
this.showSelector = true
|
this.showSelector = true
|
||||||
},
|
},
|
||||||
onBlur() {
|
onBlur() {
|
||||||
this.blurTimer = setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.showSelector = false
|
this.showSelector = false
|
||||||
}, 153)
|
}, 153)
|
||||||
},
|
},
|
||||||
onScroll(){ // 滚动时将blur的定时器关掉
|
|
||||||
if(this.blurTimer) {
|
|
||||||
clearTimeout(this.blurTimer)
|
|
||||||
this.blurTimer = null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSelectorClick(index) {
|
onSelectorClick(index) {
|
||||||
this.inputVal = this.filterCandidates[index]
|
this.inputVal = this.filterCandidates[index]
|
||||||
this.showSelector = false
|
this.showSelector = false
|
||||||
@ -158,7 +148,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" >
|
||||||
.uni-combox {
|
.uni-combox {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border: 1px solid #DCDFE6;
|
border: 1px solid #DCDFE6;
|
||||||
@ -215,7 +205,7 @@
|
|||||||
border: 1px solid #EBEEF5;
|
border: 1px solid #EBEEF5;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
z-index: 3;
|
z-index: 2;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,13 +272,4 @@
|
|||||||
.uni-combox__no-border {
|
.uni-combox__no-border {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-combox__mask {
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -86,10 +86,6 @@
|
|||||||
timestamp: {
|
timestamp: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
|
||||||
zeroPad: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -203,10 +199,18 @@
|
|||||||
} else {
|
} else {
|
||||||
this.timeUp()
|
this.timeUp()
|
||||||
}
|
}
|
||||||
day = (day < 10 && this.zeroPad) ? `0${day}` : day
|
if (day < 10) {
|
||||||
hour = (hour < 10 && this.zeroPad) ? `0${hour}` : hour
|
day = '0' + day
|
||||||
minute = (minute < 10 && this.zeroPad) ? `0${minute}` : minute
|
}
|
||||||
second = (second < 10 && this.zeroPad) ? `0${second}` : second
|
if (hour < 10) {
|
||||||
|
hour = '0' + hour
|
||||||
|
}
|
||||||
|
if (minute < 10) {
|
||||||
|
minute = '0' + minute
|
||||||
|
}
|
||||||
|
if (second < 10) {
|
||||||
|
second = '0' + second
|
||||||
|
}
|
||||||
this.d = day
|
this.d = day
|
||||||
this.h = hour
|
this.h = hour
|
||||||
this.i = minute
|
this.i = minute
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
## 1.0.3(2022-09-16)
|
|
||||||
- 可以使用 uni-scss 控制主题色
|
|
||||||
## 1.0.2(2022-06-30)
|
## 1.0.2(2022-06-30)
|
||||||
- 优化 在 uni-forms 中的依赖注入方式
|
- 优化 在 uni-forms 中的依赖注入方式
|
||||||
## 1.0.1(2022-02-07)
|
## 1.0.1(2022-02-07)
|
||||||
|
@ -384,13 +384,11 @@
|
|||||||
setStyleBackgroud(item) {
|
setStyleBackgroud(item) {
|
||||||
let styles = {}
|
let styles = {}
|
||||||
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
||||||
if (this.selectedColor) {
|
if (this.mode !== 'list') {
|
||||||
if (this.mode !== 'list') {
|
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
||||||
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
}
|
||||||
}
|
if (this.mode === 'tag') {
|
||||||
if (this.mode === 'tag') {
|
styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
|
||||||
styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let classles = ''
|
let classles = ''
|
||||||
for (let i in styles) {
|
for (let i in styles) {
|
||||||
@ -401,16 +399,15 @@
|
|||||||
setStyleIcon(item) {
|
setStyleIcon(item) {
|
||||||
let styles = {}
|
let styles = {}
|
||||||
let classles = ''
|
let classles = ''
|
||||||
if (this.selectedColor) {
|
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
||||||
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
styles['background-color'] = item.selected?selectedColor:'#fff'
|
||||||
styles['background-color'] = item.selected?selectedColor:'#fff'
|
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
||||||
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
|
||||||
|
|
||||||
if(!item.selected && item.disabled){
|
if(!item.selected && item.disabled){
|
||||||
styles['background-color'] = '#F2F6FC'
|
styles['background-color'] = '#F2F6FC'
|
||||||
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i in styles) {
|
for (let i in styles) {
|
||||||
classles += `${i}:${styles[i]};`
|
classles += `${i}:${styles[i]};`
|
||||||
}
|
}
|
||||||
@ -419,17 +416,16 @@
|
|||||||
setStyleIconText(item) {
|
setStyleIconText(item) {
|
||||||
let styles = {}
|
let styles = {}
|
||||||
let classles = ''
|
let classles = ''
|
||||||
if (this.selectedColor) {
|
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
||||||
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
if (this.mode === 'tag') {
|
||||||
if (this.mode === 'tag') {
|
styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
|
||||||
styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
|
} else {
|
||||||
} else {
|
styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:selectedColor):'#666'
|
||||||
styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:selectedColor):'#666'
|
|
||||||
}
|
|
||||||
if(!item.selected && item.disabled){
|
|
||||||
styles.color = '#999'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if(!item.selected && item.disabled){
|
||||||
|
styles.color = '#999'
|
||||||
|
}
|
||||||
|
|
||||||
for (let i in styles) {
|
for (let i in styles) {
|
||||||
classles += `${i}:${styles[i]};`
|
classles += `${i}:${styles[i]};`
|
||||||
}
|
}
|
||||||
@ -452,7 +448,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
$uni-primary: #2979ff !default;
|
$checked-color: #2979ff;
|
||||||
$border-color: #DCDFE6;
|
$border-color: #DCDFE6;
|
||||||
$disable:0.4;
|
$disable:0.4;
|
||||||
|
|
||||||
@ -618,8 +614,8 @@
|
|||||||
// 选中
|
// 选中
|
||||||
&.is-checked {
|
&.is-checked {
|
||||||
.checkbox__inner {
|
.checkbox__inner {
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
background-color: $uni-primary;
|
background-color: $checked-color;
|
||||||
|
|
||||||
.checkbox__inner-icon {
|
.checkbox__inner-icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@ -627,14 +623,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.radio__inner {
|
.radio__inner {
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
.radio__inner-icon {
|
.radio__inner-icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
background-color: $uni-primary;
|
background-color: $checked-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.checklist-text {
|
.checklist-text {
|
||||||
color: $uni-primary;
|
color: $checked-color;
|
||||||
}
|
}
|
||||||
// 选中禁用
|
// 选中禁用
|
||||||
&.is-disable {
|
&.is-disable {
|
||||||
@ -687,10 +683,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.is-checked {
|
&.is-checked {
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
.checkbox__inner {
|
.checkbox__inner {
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
background-color: $uni-primary;
|
background-color: $checked-color;
|
||||||
.checkbox__inner-icon {
|
.checkbox__inner-icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: rotate(45deg);
|
transform: rotate(45deg);
|
||||||
@ -698,16 +694,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.radio__inner {
|
.radio__inner {
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
|
|
||||||
.radio__inner-icon {
|
.radio__inner-icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
background-color: $uni-primary;
|
background-color: $checked-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.checklist-text {
|
.checklist-text {
|
||||||
color: $uni-primary;
|
color: $checked-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选中禁用
|
// 选中禁用
|
||||||
@ -739,8 +735,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.is-checked {
|
&.is-checked {
|
||||||
background-color: $uni-primary;
|
background-color: $checked-color;
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
|
|
||||||
.checklist-text {
|
.checklist-text {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@ -779,8 +775,8 @@
|
|||||||
|
|
||||||
&.is-checked {
|
&.is-checked {
|
||||||
.checkbox__inner {
|
.checkbox__inner {
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
background-color: $uni-primary;
|
background-color: $checked-color;
|
||||||
|
|
||||||
.checkbox__inner-icon {
|
.checkbox__inner-icon {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@ -793,13 +789,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.checklist-text {
|
.checklist-text {
|
||||||
color: $uni-primary;
|
color: $checked-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checklist-content {
|
.checklist-content {
|
||||||
.checkobx__list {
|
.checkobx__list {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
border-color: $uni-primary;
|
border-color: $checked-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-data-checkbox",
|
"id": "uni-data-checkbox",
|
||||||
"displayName": "uni-data-checkbox 数据选择器",
|
"displayName": "uni-data-checkbox 数据选择器",
|
||||||
"version": "1.0.3",
|
"version": "1.0.2",
|
||||||
"description": "通过数据驱动的单选框和复选框",
|
"description": "通过数据驱动的单选框和复选框",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-load-more","uni-scss"],
|
"dependencies": ["uni-load-more","uni-scss"],
|
||||||
|
@ -1,14 +1,3 @@
|
|||||||
## 1.1.2(2023-04-11)
|
|
||||||
- 修复 更改 modelValue 报错的 bug
|
|
||||||
- 修复 v-for 未使用 key 值控制台 warning
|
|
||||||
## 1.1.1(2023-02-21)
|
|
||||||
- 修复代码合并时引发 value 属性为空时不渲染数据的问题
|
|
||||||
## 1.1.0(2023-02-15)
|
|
||||||
- 修复 localdata 不支持动态更新的bug
|
|
||||||
## 1.0.9(2023-02-15)
|
|
||||||
- 修复 localdata 不支持动态更新的bug
|
|
||||||
## 1.0.8(2022-09-16)
|
|
||||||
- 可以使用 uni-scss 控制主题色
|
|
||||||
## 1.0.7(2022-07-06)
|
## 1.0.7(2022-07-06)
|
||||||
- 优化 pc端图标位置不正确的问题
|
- 优化 pc端图标位置不正确的问题
|
||||||
## 1.0.6(2022-07-05)
|
## 1.0.6(2022-07-05)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,7 @@ export default {
|
|||||||
},
|
},
|
||||||
pageSize: {
|
pageSize: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 500
|
default: 20
|
||||||
},
|
},
|
||||||
getcount: {
|
getcount: {
|
||||||
type: [Boolean, String],
|
type: [Boolean, String],
|
||||||
@ -94,7 +94,7 @@ export default {
|
|||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default () {
|
default() {
|
||||||
return {
|
return {
|
||||||
text: "text",
|
text: "text",
|
||||||
value: "value"
|
value: "value"
|
||||||
@ -122,22 +122,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isLocalData() {
|
isLocaldata() {
|
||||||
return !this.collection.length;
|
return !this.collection.length
|
||||||
},
|
},
|
||||||
isCloudData() {
|
postField() {
|
||||||
return this.collection.length > 0;
|
let fields = [this.field];
|
||||||
},
|
if (this.parentField) {
|
||||||
isCloudDataList() {
|
fields.push(`${this.parentField} as parent_value`);
|
||||||
return (this.isCloudData && (!this.parentField && !this.selfField));
|
}
|
||||||
},
|
return fields.join(',');
|
||||||
isCloudDataTree() {
|
|
||||||
return (this.isCloudData && this.parentField && this.selfField);
|
|
||||||
},
|
},
|
||||||
dataValue() {
|
dataValue() {
|
||||||
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null ||
|
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined)
|
||||||
this.modelValue !== undefined);
|
return isModelValue ? this.modelValue : this.value
|
||||||
return isModelValue ? this.modelValue : this.value;
|
|
||||||
},
|
},
|
||||||
hasValue() {
|
hasValue() {
|
||||||
if (typeof this.dataValue === 'number') {
|
if (typeof this.dataValue === 'number') {
|
||||||
@ -186,169 +183,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onPropsChange() {
|
onPropsChange() {
|
||||||
this._treeData = [];
|
this._treeData = []
|
||||||
},
|
},
|
||||||
|
|
||||||
// 填充 pickview 数据
|
|
||||||
async loadData() {
|
|
||||||
if (this.isLocalData) {
|
|
||||||
this.loadLocalData();
|
|
||||||
} else if (this.isCloudDataList) {
|
|
||||||
this.loadCloudDataList();
|
|
||||||
} else if (this.isCloudDataTree) {
|
|
||||||
this.loadCloudDataTree();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 加载本地数据
|
|
||||||
async loadLocalData() {
|
|
||||||
this._treeData = [];
|
|
||||||
this._extractTree(this.localdata, this._treeData);
|
|
||||||
|
|
||||||
let inputValue = this.dataValue;
|
|
||||||
if (inputValue === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(inputValue)) {
|
|
||||||
inputValue = inputValue[inputValue.length - 1];
|
|
||||||
if (typeof inputValue === 'object' && inputValue[this.map.value]) {
|
|
||||||
inputValue = inputValue[this.map.value];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.selected = this._findNodePath(inputValue, this.localdata);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 加载 Cloud 数据 (单列)
|
|
||||||
async loadCloudDataList() {
|
|
||||||
if (this.loading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
let response = await this.getCommand();
|
|
||||||
let responseData = response.result.data;
|
|
||||||
|
|
||||||
this._treeData = responseData;
|
|
||||||
|
|
||||||
this._updateBindData();
|
|
||||||
this._updateSelected();
|
|
||||||
|
|
||||||
this.onDataChange();
|
|
||||||
} catch (e) {
|
|
||||||
this.errorMessage = e;
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 加载 Cloud 数据 (树形)
|
|
||||||
async loadCloudDataTree() {
|
|
||||||
if (this.loading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
let commandOptions = {
|
|
||||||
field: this._cloudDataPostField(),
|
|
||||||
where: this._cloudDataTreeWhere()
|
|
||||||
};
|
|
||||||
if (this.gettree) {
|
|
||||||
commandOptions.startwith = `${this.selfField}=='${this.dataValue}'`;
|
|
||||||
}
|
|
||||||
|
|
||||||
let response = await this.getCommand(commandOptions);
|
|
||||||
let responseData = response.result.data;
|
|
||||||
|
|
||||||
this._treeData = responseData;
|
|
||||||
this._updateBindData();
|
|
||||||
this._updateSelected();
|
|
||||||
|
|
||||||
this.onDataChange();
|
|
||||||
} catch (e) {
|
|
||||||
this.errorMessage = e;
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 加载 Cloud 数据 (节点)
|
|
||||||
async loadCloudDataNode(callback) {
|
|
||||||
if (this.loading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
let commandOptions = {
|
|
||||||
field: this._cloudDataPostField(),
|
|
||||||
where: this._cloudDataNodeWhere()
|
|
||||||
};
|
|
||||||
|
|
||||||
let response = await this.getCommand(commandOptions);
|
|
||||||
let responseData = response.result.data;
|
|
||||||
|
|
||||||
callback(responseData);
|
|
||||||
} catch (e) {
|
|
||||||
this.errorMessage = e;
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 回显 Cloud 数据
|
|
||||||
getCloudDataValue() {
|
|
||||||
if (this.isCloudDataList) {
|
|
||||||
return this.getCloudDataListValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isCloudDataTree) {
|
|
||||||
return this.getCloudDataTreeValue();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 回显 Cloud 数据 (单列)
|
|
||||||
getCloudDataListValue() {
|
|
||||||
// 根据 field's as value标识匹配 where 条件
|
|
||||||
let where = [];
|
|
||||||
let whereField = this._getForeignKeyByField();
|
|
||||||
if (whereField) {
|
|
||||||
where.push(`${whereField} == '${this.dataValue}'`)
|
|
||||||
}
|
|
||||||
|
|
||||||
where = where.join(' || ');
|
|
||||||
|
|
||||||
if (this.where) {
|
|
||||||
where = `(${this.where}) && (${where})`
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getCommand({
|
|
||||||
field: this._cloudDataPostField(),
|
|
||||||
where
|
|
||||||
}).then((res) => {
|
|
||||||
this.selected = res.result.data;
|
|
||||||
return res.result.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 回显 Cloud 数据 (树形)
|
|
||||||
getCloudDataTreeValue() {
|
|
||||||
return this.getCommand({
|
|
||||||
field: this._cloudDataPostField(),
|
|
||||||
getTreePath: {
|
|
||||||
startWith: `${this.selfField}=='${this.dataValue}'`
|
|
||||||
}
|
|
||||||
}).then((res) => {
|
|
||||||
let treePath = [];
|
|
||||||
this._extractTreePath(res.result.data, treePath);
|
|
||||||
this.selected = treePath;
|
|
||||||
return treePath;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getCommand(options = {}) {
|
getCommand(options = {}) {
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
let db = uniCloud.database(this.spaceInfo)
|
let db = uniCloud.database(this.spaceInfo)
|
||||||
@ -393,16 +229,125 @@ export default {
|
|||||||
|
|
||||||
return db
|
return db
|
||||||
},
|
},
|
||||||
|
getNodeData(callback) {
|
||||||
_cloudDataPostField() {
|
if (this.loading) {
|
||||||
let fields = [this.field];
|
return
|
||||||
if (this.parentField) {
|
}
|
||||||
fields.push(`${this.parentField} as parent_value`);
|
this.loading = true
|
||||||
|
this.getCommand({
|
||||||
|
field: this.postField,
|
||||||
|
where: this._pathWhere()
|
||||||
|
}).then((res) => {
|
||||||
|
this.loading = false
|
||||||
|
this.selected = res.result.data
|
||||||
|
callback && callback()
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
this.errorMessage = err
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTreePath(callback) {
|
||||||
|
if (this.loading) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return fields.join(',');
|
this.loading = true
|
||||||
},
|
|
||||||
|
|
||||||
_cloudDataTreeWhere() {
|
this.getCommand({
|
||||||
|
field: this.postField,
|
||||||
|
getTreePath: {
|
||||||
|
startWith: `${this.selfField}=='${this.dataValue}'`
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
this.loading = false
|
||||||
|
let treePath = []
|
||||||
|
this._extractTreePath(res.result.data, treePath)
|
||||||
|
this.selected = treePath
|
||||||
|
callback && callback()
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
this.errorMessage = err
|
||||||
|
})
|
||||||
|
},
|
||||||
|
loadData() {
|
||||||
|
if (this.isLocaldata) {
|
||||||
|
this._processLocalData()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.dataValue != null) {
|
||||||
|
this._loadNodeData((data) => {
|
||||||
|
this._treeData = data
|
||||||
|
this._updateBindData()
|
||||||
|
this._updateSelected()
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.stepSearh) {
|
||||||
|
this._loadNodeData((data) => {
|
||||||
|
this._treeData = data
|
||||||
|
this._updateBindData()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this._loadAllData((data) => {
|
||||||
|
this._treeData = []
|
||||||
|
this._extractTree(data, this._treeData, null)
|
||||||
|
this._updateBindData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_loadAllData(callback) {
|
||||||
|
if (this.loading) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
|
||||||
|
this.getCommand({
|
||||||
|
field: this.postField,
|
||||||
|
gettree: true,
|
||||||
|
startwith: `${this.selfField}=='${this.dataValue}'`
|
||||||
|
}).then((res) => {
|
||||||
|
this.loading = false
|
||||||
|
callback(res.result.data)
|
||||||
|
this.onDataChange()
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
this.errorMessage = err
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_loadNodeData(callback, pw) {
|
||||||
|
if (this.loading) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
|
||||||
|
this.getCommand({
|
||||||
|
field: this.postField,
|
||||||
|
where: pw || this._postWhere(),
|
||||||
|
pageSize: 500
|
||||||
|
}).then((res) => {
|
||||||
|
this.loading = false
|
||||||
|
callback(res.result.data)
|
||||||
|
this.onDataChange()
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
this.errorMessage = err
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_pathWhere() {
|
||||||
|
let result = []
|
||||||
|
let where_field = this._getParentNameByField();
|
||||||
|
if (where_field) {
|
||||||
|
result.push(`${where_field} == '${this.dataValue}'`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.where) {
|
||||||
|
return `(${this.where}) && (${result.join(' || ')})`
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.join(' || ')
|
||||||
|
},
|
||||||
|
_postWhere() {
|
||||||
let result = []
|
let result = []
|
||||||
let selected = this.selected
|
let selected = this.selected
|
||||||
let parentField = this.parentField
|
let parentField = this.parentField
|
||||||
@ -419,35 +364,17 @@ export default {
|
|||||||
if (this.where) {
|
if (this.where) {
|
||||||
where.push(`(${this.where})`)
|
where.push(`(${this.where})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.length) {
|
if (result.length) {
|
||||||
where.push(`(${result.join(' || ')})`)
|
where.push(`(${result.join(' || ')})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return where.join(' && ')
|
return where.join(' && ')
|
||||||
},
|
},
|
||||||
|
_nodeWhere() {
|
||||||
_cloudDataNodeWhere() {
|
|
||||||
let where = []
|
|
||||||
let selected = this.selected;
|
|
||||||
if (selected.length) {
|
|
||||||
where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`);
|
|
||||||
}
|
|
||||||
|
|
||||||
where = where.join(' || ');
|
|
||||||
|
|
||||||
if (this.where) {
|
|
||||||
return `(${this.where}) && (${where})`
|
|
||||||
}
|
|
||||||
|
|
||||||
return where
|
|
||||||
},
|
|
||||||
|
|
||||||
_getWhereByForeignKey() {
|
|
||||||
let result = []
|
let result = []
|
||||||
let whereField = this._getForeignKeyByField();
|
let selected = this.selected
|
||||||
if (whereField) {
|
if (selected.length) {
|
||||||
result.push(`${whereField} == '${this.dataValue}'`)
|
result.push(`${this.parentField} == '${selected[selected.length - 1].value}'`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.where) {
|
if (this.where) {
|
||||||
@ -456,23 +383,41 @@ export default {
|
|||||||
|
|
||||||
return result.join(' || ')
|
return result.join(' || ')
|
||||||
},
|
},
|
||||||
|
_getParentNameByField() {
|
||||||
_getForeignKeyByField() {
|
const fields = this.field.split(',');
|
||||||
let fields = this.field.split(',');
|
let where_field = null;
|
||||||
let whereField = null;
|
|
||||||
for (let i = 0; i < fields.length; i++) {
|
for (let i = 0; i < fields.length; i++) {
|
||||||
const items = fields[i].split('as');
|
const items = fields[i].split('as');
|
||||||
if (items.length < 2) {
|
if (items.length < 2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (items[1].trim() === 'value') {
|
if (items[1].trim() === 'value') {
|
||||||
whereField = items[0].trim();
|
where_field = items[0].trim();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return whereField;
|
return where_field
|
||||||
|
},
|
||||||
|
_isTreeView() {
|
||||||
|
return (this.parentField && this.selfField)
|
||||||
|
},
|
||||||
|
_updateSelected() {
|
||||||
|
var dl = this.dataList
|
||||||
|
var sl = this.selected
|
||||||
|
let textField = this.map.text
|
||||||
|
let valueField = this.map.value
|
||||||
|
for (var i = 0; i < sl.length; i++) {
|
||||||
|
var value = sl[i].value
|
||||||
|
var dl2 = dl[i]
|
||||||
|
for (var j = 0; j < dl2.length; j++) {
|
||||||
|
var item2 = dl2[j]
|
||||||
|
if (item2[valueField] === value) {
|
||||||
|
sl[i].text = item2[textField]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBindData(node) {
|
_updateBindData(node) {
|
||||||
const {
|
const {
|
||||||
dataList,
|
dataList,
|
||||||
@ -500,25 +445,6 @@ export default {
|
|||||||
hasNodes
|
hasNodes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelected() {
|
|
||||||
let dl = this.dataList
|
|
||||||
let sl = this.selected
|
|
||||||
let textField = this.map.text
|
|
||||||
let valueField = this.map.value
|
|
||||||
for (let i = 0; i < sl.length; i++) {
|
|
||||||
let value = sl[i].value
|
|
||||||
let dl2 = dl[i]
|
|
||||||
for (let j = 0; j < dl2.length; j++) {
|
|
||||||
let item2 = dl2[j]
|
|
||||||
if (item2[valueField] === value) {
|
|
||||||
sl[i].text = item2[textField]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_filterData(data, paths) {
|
_filterData(data, paths) {
|
||||||
let dataList = []
|
let dataList = []
|
||||||
let hasNodes = true
|
let hasNodes = true
|
||||||
@ -527,8 +453,8 @@ export default {
|
|||||||
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
|
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
|
||||||
}))
|
}))
|
||||||
for (let i = 0; i < paths.length; i++) {
|
for (let i = 0; i < paths.length; i++) {
|
||||||
let value = paths[i].value
|
var value = paths[i].value
|
||||||
let nodes = data.filter((item) => {
|
var nodes = data.filter((item) => {
|
||||||
return item.parent_value === value
|
return item.parent_value === value
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -544,7 +470,6 @@ export default {
|
|||||||
hasNodes
|
hasNodes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_extractTree(nodes, result, parent_value) {
|
_extractTree(nodes, result, parent_value) {
|
||||||
let list = result || []
|
let list = result || []
|
||||||
let valueField = this.map.value
|
let valueField = this.map.value
|
||||||
@ -568,7 +493,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_extractTreePath(nodes, result) {
|
_extractTreePath(nodes, result) {
|
||||||
let list = result || []
|
let list = result || []
|
||||||
for (let i = 0; i < nodes.length; i++) {
|
for (let i = 0; i < nodes.length; i++) {
|
||||||
@ -588,7 +512,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_findNodePath(key, nodes, path = []) {
|
_findNodePath(key, nodes, path = []) {
|
||||||
let textField = this.map.text
|
let textField = this.map.text
|
||||||
let valueField = this.map.value
|
let valueField = this.map.value
|
||||||
@ -617,6 +540,24 @@ export default {
|
|||||||
path.pop()
|
path.pop()
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
|
},
|
||||||
|
_processLocalData() {
|
||||||
|
this._treeData = []
|
||||||
|
this._extractTree(this.localdata, this._treeData)
|
||||||
|
|
||||||
|
var inputValue = this.dataValue
|
||||||
|
if (inputValue === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(inputValue)) {
|
||||||
|
inputValue = inputValue[inputValue.length - 1]
|
||||||
|
if (typeof inputValue === 'object' && inputValue[this.map.value]) {
|
||||||
|
inputValue = inputValue[this.map.value]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selected = this._findNodePath(inputValue, this.localdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,174 +1,183 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-data-pickerview">
|
<view class="uni-data-pickerview">
|
||||||
<scroll-view v-if="!isCloudDataList" class="selected-area" scroll-x="true">
|
<scroll-view class="selected-area" scroll-x="true" scroll-y="false" :show-scrollbar="false">
|
||||||
<view class="selected-list">
|
<view class="selected-list">
|
||||||
<view
|
<template v-for="(item,index) in selected">
|
||||||
class="selected-item"
|
<view class="selected-item"
|
||||||
v-for="(item,index) in selected"
|
:class="{'selected-item-active':index==selectedIndex, 'selected-item-text-overflow': ellipsis}"
|
||||||
:key="index"
|
v-if="item.text" @click="handleSelect(index)">
|
||||||
:class="{
|
<text class="">{{item.text}}</text>
|
||||||
'selected-item-active':index == selectedIndex
|
</view>
|
||||||
}"
|
</template>
|
||||||
@click="handleSelect(index)"
|
</view>
|
||||||
>
|
</scroll-view>
|
||||||
<text>{{item.text || ''}}</text>
|
<view class="tab-c">
|
||||||
</view>
|
<template v-for="(child, i) in dataList" >
|
||||||
</view>
|
<scroll-view class="list" :key="i" v-if="i==selectedIndex" :scroll-y="true">
|
||||||
</scroll-view>
|
<view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in child"
|
||||||
<view class="tab-c">
|
@click="handleNodeClick(item, i, j)">
|
||||||
<scroll-view class="list" :scroll-y="true">
|
<text class="item-text item-text-overflow">{{item[map.text]}}</text>
|
||||||
<view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in dataList[selectedIndex]" :key="j"
|
<view class="check" v-if="selected.length > i && item[map.value] == selected[i].value"></view>
|
||||||
@click="handleNodeClick(item, selectedIndex, j)">
|
</view>
|
||||||
<text class="item-text">{{item[map.text]}}</text>
|
</scroll-view>
|
||||||
<view class="check" v-if="selected.length > selectedIndex && item[map.value] == selected[selectedIndex].value"></view>
|
</template>
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
<view class="loading-cover" v-if="loading">
|
<view class="loading-cover" v-if="loading">
|
||||||
<uni-load-more class="load-more" :contentText="loadMore" status="loading"></uni-load-more>
|
<uni-load-more class="load-more" :contentText="loadMore" status="loading"></uni-load-more>
|
||||||
</view>
|
</view>
|
||||||
<view class="error-message" v-if="errorMessage">
|
<view class="error-message" v-if="errorMessage">
|
||||||
<text class="error-text">{{errorMessage}}</text>
|
<text class="error-text">{{errorMessage}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import dataPicker from "./uni-data-picker.js"
|
import dataPicker from "./uni-data-picker.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DataPickerview
|
* DataPickerview
|
||||||
* @description uni-data-pickerview
|
* @description uni-data-pickerview
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796
|
||||||
* @property {Array} localdata 本地数据,参考
|
* @property {Array} localdata 本地数据,参考
|
||||||
* @property {Boolean} step-searh = [true|false] 是否分布查询
|
* @property {Boolean} step-searh = [true|false] 是否分布查询
|
||||||
* @value true 启用分布查询,仅查询当前选中节点
|
* @value true 启用分布查询,仅查询当前选中节点
|
||||||
* @value false 关闭分布查询,一次查询出所有数据
|
* @value false 关闭分布查询,一次查询出所有数据
|
||||||
* @property {String|DBFieldString} self-field 分布查询当前字段名称
|
* @property {String|DBFieldString} self-field 分布查询当前字段名称
|
||||||
* @property {String|DBFieldString} parent-field 分布查询父字段名称
|
* @property {String|DBFieldString} parent-field 分布查询父字段名称
|
||||||
* @property {String|DBCollectionString} collection 表名
|
* @property {String|DBCollectionString} collection 表名
|
||||||
* @property {String|DBFieldString} field 查询字段,多个字段用 `,` 分割
|
* @property {String|DBFieldString} field 查询字段,多个字段用 `,` 分割
|
||||||
* @property {String} orderby 排序字段及正序倒叙设置
|
* @property {String} orderby 排序字段及正序倒叙设置
|
||||||
* @property {String|JQLString} where 查询条件
|
* @property {String|JQLString} where 查询条件
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
name: 'UniDataPickerView',
|
name: 'UniDataPickerView',
|
||||||
emits: ['nodeclick', 'change', 'datachange', 'update:modelValue'],
|
emits: ['nodeclick', 'change', 'datachange', 'update:modelValue'],
|
||||||
mixins: [dataPicker],
|
mixins: [dataPicker],
|
||||||
props: {
|
props: {
|
||||||
managedMode: {
|
managedMode: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
ellipsis: {
|
ellipsis: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
data() {
|
||||||
if (!this.managedMode) {
|
return {}
|
||||||
this.$nextTick(() => {
|
},
|
||||||
this.loadData();
|
created() {
|
||||||
})
|
if (this.managedMode) {
|
||||||
}
|
return
|
||||||
},
|
}
|
||||||
methods: {
|
|
||||||
onPropsChange() {
|
|
||||||
this._treeData = [];
|
|
||||||
this.selectedIndex = 0;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.loadData();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleSelect(index) {
|
|
||||||
this.selectedIndex = index;
|
|
||||||
},
|
|
||||||
handleNodeClick(item, i, j) {
|
|
||||||
if (item.disable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const node = this.dataList[i][j];
|
this.$nextTick(() => {
|
||||||
const text = node[this.map.text];
|
this.load()
|
||||||
const value = node[this.map.value];
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onPropsChange() {
|
||||||
|
this._treeData = []
|
||||||
|
this.selectedIndex = 0
|
||||||
|
this.load()
|
||||||
|
},
|
||||||
|
load() {
|
||||||
|
if (this.isLocaldata) {
|
||||||
|
this.loadData()
|
||||||
|
} else if (this.dataValue.length) {
|
||||||
|
this.getTreePath((res) => {
|
||||||
|
this.loadData()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSelect(index) {
|
||||||
|
this.selectedIndex = index
|
||||||
|
},
|
||||||
|
handleNodeClick(item, i, j) {
|
||||||
|
if (item.disable) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const node = this.dataList[i][j]
|
||||||
|
const text = node[this.map.text]
|
||||||
|
const value = node[this.map.value]
|
||||||
|
if (i < this.selected.length - 1) {
|
||||||
|
this.selected.splice(i, this.selected.length - i)
|
||||||
|
this.selected.push({
|
||||||
|
text,
|
||||||
|
value
|
||||||
|
})
|
||||||
|
} else if (i === this.selected.length - 1) {
|
||||||
|
this.selected.splice(i, 1, {
|
||||||
|
text,
|
||||||
|
value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (i < this.selected.length - 1) {
|
if (node.isleaf) {
|
||||||
this.selected.splice(i, this.selected.length - i)
|
this.onSelectedChange(node, node.isleaf)
|
||||||
this.selected.push({
|
return
|
||||||
text,
|
}
|
||||||
value
|
|
||||||
})
|
|
||||||
} else if (i === this.selected.length - 1) {
|
|
||||||
this.selected.splice(i, 1, {
|
|
||||||
text,
|
|
||||||
value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.isleaf) {
|
const {
|
||||||
this.onSelectedChange(node, node.isleaf)
|
isleaf,
|
||||||
return
|
hasNodes
|
||||||
}
|
} = this._updateBindData()
|
||||||
|
|
||||||
const {
|
if (!this._isTreeView() && !hasNodes) {
|
||||||
isleaf,
|
this.onSelectedChange(node, true)
|
||||||
hasNodes
|
return
|
||||||
} = this._updateBindData()
|
}
|
||||||
|
|
||||||
// 本地数据
|
if (this.isLocaldata && (!hasNodes || isleaf)) {
|
||||||
if (this.isLocalData) {
|
this.onSelectedChange(node, true)
|
||||||
this.onSelectedChange(node, (!hasNodes || isleaf))
|
return
|
||||||
} else if (this.isCloudDataList) { // Cloud 数据 (单列)
|
}
|
||||||
this.onSelectedChange(node, true)
|
|
||||||
} else if (this.isCloudDataTree) { // Cloud 数据 (树形)
|
|
||||||
if (isleaf) {
|
|
||||||
this.onSelectedChange(node, node.isleaf)
|
|
||||||
} else if (!hasNodes) { // 请求一次服务器以确定是否为叶子节点
|
|
||||||
this.loadCloudDataNode((data) => {
|
|
||||||
if (!data.length) {
|
|
||||||
node.isleaf = true
|
|
||||||
} else {
|
|
||||||
this._treeData.push(...data)
|
|
||||||
this._updateBindData(node)
|
|
||||||
}
|
|
||||||
this.onSelectedChange(node, node.isleaf)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
updateData(data) {
|
|
||||||
this._treeData = data.treeData
|
|
||||||
this.selected = data.selected
|
|
||||||
if (!this._treeData.length) {
|
|
||||||
this.loadData()
|
|
||||||
} else {
|
|
||||||
//this.selected = data.selected
|
|
||||||
this._updateBindData()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onDataChange() {
|
|
||||||
this.$emit('datachange');
|
|
||||||
},
|
|
||||||
onSelectedChange(node, isleaf) {
|
|
||||||
if (isleaf) {
|
|
||||||
this._dispatchEvent()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node) {
|
if (!isleaf && !hasNodes) {
|
||||||
this.$emit('nodeclick', node)
|
this._loadNodeData((data) => {
|
||||||
}
|
if (!data.length) {
|
||||||
},
|
node.isleaf = true
|
||||||
_dispatchEvent() {
|
} else {
|
||||||
this.$emit('change', this.selected.slice(0))
|
this._treeData.push(...data)
|
||||||
}
|
this._updateBindData(node)
|
||||||
}
|
}
|
||||||
}
|
this.onSelectedChange(node, node.isleaf)
|
||||||
|
}, this._nodeWhere())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.onSelectedChange(node, false)
|
||||||
|
},
|
||||||
|
updateData(data) {
|
||||||
|
this._treeData = data.treeData
|
||||||
|
this.selected = data.selected
|
||||||
|
if (!this._treeData.length) {
|
||||||
|
this.loadData()
|
||||||
|
} else {
|
||||||
|
//this.selected = data.selected
|
||||||
|
this._updateBindData()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDataChange() {
|
||||||
|
this.$emit('datachange')
|
||||||
|
},
|
||||||
|
onSelectedChange(node, isleaf) {
|
||||||
|
if (isleaf) {
|
||||||
|
this._dispatchEvent()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node) {
|
||||||
|
this.$emit('nodeclick', node)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_dispatchEvent() {
|
||||||
|
this.$emit('change', this.selected.slice(0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style >
|
||||||
<style lang="scss">
|
|
||||||
$uni-primary: #007aff !default;
|
|
||||||
|
|
||||||
.uni-data-pickerview {
|
.uni-data-pickerview {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -179,137 +188,138 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-text {
|
.error-text {
|
||||||
color: #DD524D;
|
color: #DD524D;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-cover {
|
.loading-cover {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(255, 255, 255, .5);
|
background-color: rgba(255, 255, 255, .5);
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
}
|
}
|
||||||
|
|
||||||
.load-more {
|
.load-more {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
margin: auto;
|
margin: auto;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
opacity: .9;
|
opacity: .9;
|
||||||
z-index: 102;
|
z-index: 102;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #ifdef APP-NVUE */
|
/* #ifdef APP-NVUE */
|
||||||
.selected-area {
|
.selected-area {
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
}
|
}
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
.selected-list {
|
/* #endif */
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
/* #endif */
|
|
||||||
flex-direction: row;
|
|
||||||
padding: 0 5px;
|
|
||||||
border-bottom: 1px solid #f8f8f8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selected-item {
|
.selected-list {
|
||||||
margin-left: 10px;
|
/* #ifndef APP-NVUE */
|
||||||
margin-right: 10px;
|
display: flex;
|
||||||
padding: 12px 0;
|
/* #endif */
|
||||||
text-align: center;
|
flex-direction: row;
|
||||||
/* #ifndef APP-NVUE */
|
flex-wrap: nowrap;
|
||||||
white-space: nowrap;
|
padding: 0 5px;
|
||||||
/* #endif */
|
border-bottom: 1px solid #f8f8f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-item-text-overflow {
|
.selected-item {
|
||||||
width: 168px;
|
margin-left: 10px;
|
||||||
/* fix nvue */
|
margin-right: 10px;
|
||||||
overflow: hidden;
|
padding: 12px 0;
|
||||||
/* #ifndef APP-NVUE */
|
text-align: center;
|
||||||
width: 6em;
|
/* #ifndef APP-NVUE */
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
/* #endif */
|
||||||
-o-text-overflow: ellipsis;
|
}
|
||||||
/* #endif */
|
|
||||||
}
|
.selected-item-text-overflow {
|
||||||
|
width: 168px;
|
||||||
|
/* fix nvue */
|
||||||
|
overflow: hidden;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
width: 6em;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
-o-text-overflow: ellipsis;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
.selected-item-active {
|
.selected-item-active {
|
||||||
border-bottom: 2px solid $uni-primary;
|
border-bottom: 2px solid #007aff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-item-text {
|
.selected-item-text {
|
||||||
color: $uni-primary;
|
color: #007aff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-c {
|
.tab-c {
|
||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 12px 15px;
|
padding: 12px 15px;
|
||||||
/* border-bottom: 1px solid #f0f0f0; */
|
/* border-bottom: 1px solid #f0f0f0; */
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-disabled {
|
.is-disabled {
|
||||||
opacity: .5;
|
opacity: .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-text {
|
.item-text {
|
||||||
/* flex: 1; */
|
/* flex: 1; */
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-text-overflow {
|
.item-text-overflow {
|
||||||
width: 280px;
|
width: 280px;
|
||||||
/* fix nvue */
|
/* fix nvue */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
width: 20em;
|
width: 20em;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
-o-text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.check {
|
.check {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
border: 2px solid $uni-primary;
|
border: 2px solid #007aff;
|
||||||
border-left: 0;
|
border-left: 0;
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-data-picker",
|
"id": "uni-data-picker",
|
||||||
"displayName": "uni-data-picker 数据驱动的picker选择器",
|
"displayName": "uni-data-picker 数据驱动的picker选择器",
|
||||||
"version": "1.1.2",
|
"version": "1.0.7",
|
||||||
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
|
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -18,7 +18,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -35,8 +39,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
@ -53,7 +56,7 @@
|
|||||||
"client": {
|
"client": {
|
||||||
"App": {
|
"App": {
|
||||||
"app-vue": "y",
|
"app-vue": "y",
|
||||||
"app-nvue": "u"
|
"app-nvue": "y"
|
||||||
},
|
},
|
||||||
"H5-mobile": {
|
"H5-mobile": {
|
||||||
"Safari": "y",
|
"Safari": "y",
|
||||||
|
@ -1,22 +1,3 @@
|
|||||||
## 1.0.6(2023-04-12)
|
|
||||||
- 修复 微信小程序点击时会改变背景颜色的 bug
|
|
||||||
## 1.0.5(2023-02-03)
|
|
||||||
- 修复 禁用时会显示清空按钮
|
|
||||||
## 1.0.4(2023-02-02)
|
|
||||||
- 优化 查询条件短期内多次变更只查询最后一次变更后的结果
|
|
||||||
- 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue
|
|
||||||
## 1.0.3(2023-01-16)
|
|
||||||
- 修复 不关联服务空间报错的问题
|
|
||||||
## 1.0.2(2023-01-14)
|
|
||||||
- 新增 属性 `format` 可用于格式化显示选项内容
|
|
||||||
## 1.0.1(2022-12-06)
|
|
||||||
- 修复 当where变化时,数据不会自动更新的问题
|
|
||||||
## 0.1.9(2022-09-05)
|
|
||||||
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
|
|
||||||
## 0.1.8(2022-08-29)
|
|
||||||
- 修复 点击的位置不准确
|
|
||||||
## 0.1.7(2022-08-12)
|
|
||||||
- 新增 支持 disabled 属性
|
|
||||||
## 0.1.6(2022-07-06)
|
## 0.1.6(2022-07-06)
|
||||||
- 修复 pc端宽度异常的bug
|
- 修复 pc端宽度异常的bug
|
||||||
## 0.1.5
|
## 0.1.5
|
||||||
|
@ -2,16 +2,12 @@
|
|||||||
<view class="uni-stat__select">
|
<view class="uni-stat__select">
|
||||||
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ':'}}</span>
|
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ':'}}</span>
|
||||||
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
|
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
|
||||||
<view class="uni-select" :class="{'uni-select--disabled':disabled}">
|
<view class="uni-select">
|
||||||
<view class="uni-select__input-box" @click="toggleSelector">
|
<view class="uni-select__input-box" @click="toggleSelector">
|
||||||
<view v-if="current" class="uni-select__input-text">{{current}}</view>
|
<view v-if="current" class="uni-select__input-text">{{current}}</view>
|
||||||
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
|
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
|
||||||
<view v-if="current && clear && !disabled" @click.stop="clearVal" >
|
<uni-icons v-if="current && clear" type="clear" color="#c0c4cc" size="24" @click="clearVal" />
|
||||||
<uni-icons type="clear" color="#c0c4cc" size="24"/>
|
<uni-icons v-else :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
|
||||||
</view>
|
|
||||||
<view v-else>
|
|
||||||
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
|
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
|
||||||
<view class="uni-select__selector" v-if="showSelector">
|
<view class="uni-select__selector" v-if="showSelector">
|
||||||
@ -20,9 +16,10 @@
|
|||||||
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
|
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
|
||||||
<text>{{emptyTips}}</text>
|
<text>{{emptyTips}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
|
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData"
|
||||||
@click="change(item)">
|
:key="index" @click="change(item)">
|
||||||
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
|
<text
|
||||||
|
:class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
@ -42,13 +39,21 @@
|
|||||||
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
|
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
|
||||||
* @property {String} label 左侧标题
|
* @property {String} label 左侧标题
|
||||||
* @property {String} placeholder 输入框的提示文字
|
* @property {String} placeholder 输入框的提示文字
|
||||||
* @property {Boolean} disabled 是否禁用
|
|
||||||
* @event {Function} change 选中发生变化触发
|
* @event {Function} change 选中发生变化触发
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "uni-data-select",
|
name: "uni-stat-select",
|
||||||
mixins: [uniCloud.mixinDatacom || {}],
|
mixins: [uniCloud.mixinDatacom || {}],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showSelector: false,
|
||||||
|
current: '',
|
||||||
|
mixinDatacomResData: [],
|
||||||
|
apps: [],
|
||||||
|
channels: []
|
||||||
|
};
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
localdata: {
|
localdata: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@ -83,33 +88,12 @@
|
|||||||
defItem: {
|
defItem: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
},
|
}
|
||||||
disabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
// 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
|
|
||||||
format: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
showSelector: false,
|
|
||||||
current: '',
|
|
||||||
mixinDatacomResData: [],
|
|
||||||
apps: [],
|
|
||||||
channels: [],
|
|
||||||
cacheKey: "uni-data-select-lastSelectedValue",
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.debounceGet = this.debounce(() => {
|
this.last = `${this.collection}_last_selected_option_value`
|
||||||
this.query();
|
|
||||||
}, 300);
|
|
||||||
if (this.collection && !this.localdata.length) {
|
if (this.collection && !this.localdata.length) {
|
||||||
this.debounceGet();
|
this.mixinDatacomEasyGet()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -124,14 +108,6 @@
|
|||||||
return placeholder ?
|
return placeholder ?
|
||||||
common + placeholder :
|
common + placeholder :
|
||||||
common
|
common
|
||||||
},
|
|
||||||
valueCom(){
|
|
||||||
// #ifdef VUE3
|
|
||||||
return this.modelValue;
|
|
||||||
// #endif
|
|
||||||
// #ifndef VUE3
|
|
||||||
return this.value;
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -143,9 +119,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
valueCom(val, old) {
|
// #ifndef VUE3
|
||||||
|
value() {
|
||||||
this.initDefVal()
|
this.initDefVal()
|
||||||
},
|
},
|
||||||
|
// #endif
|
||||||
|
// #ifdef VUE3
|
||||||
|
modelValue() {
|
||||||
|
this.initDefVal()
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
mixinDatacomResData: {
|
mixinDatacomResData: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(val) {
|
handler(val) {
|
||||||
@ -156,46 +139,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
debounce(fn, time = 100){
|
|
||||||
let timer = null
|
|
||||||
return function(...args) {
|
|
||||||
if (timer) clearTimeout(timer)
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
fn.apply(this, args)
|
|
||||||
}, time)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 执行数据库查询
|
|
||||||
query(){
|
|
||||||
this.mixinDatacomEasyGet();
|
|
||||||
},
|
|
||||||
// 监听查询条件变更事件
|
|
||||||
onMixinDatacomPropsChange(){
|
|
||||||
if (this.collection) {
|
|
||||||
this.debounceGet();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initDefVal() {
|
initDefVal() {
|
||||||
let defValue = ''
|
let defValue = ''
|
||||||
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
|
if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
|
||||||
defValue = this.valueCom
|
defValue = this.value
|
||||||
|
} else if ((this.modelValue || this.modelValue === 0) && !this.isDisabled(this.modelValue)) {
|
||||||
|
defValue = this.modelValue
|
||||||
} else {
|
} else {
|
||||||
let strogeValue
|
let strogeValue
|
||||||
if (this.collection) {
|
if (this.collection) {
|
||||||
strogeValue = this.getCache()
|
strogeValue = uni.getStorageSync(this.last)
|
||||||
}
|
}
|
||||||
if (strogeValue || strogeValue === 0) {
|
if (strogeValue || strogeValue === 0) {
|
||||||
defValue = strogeValue
|
defValue = strogeValue
|
||||||
} else {
|
} else {
|
||||||
let defItem = ''
|
let defItem = ''
|
||||||
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
|
if (this.defItem > 0 && this.defItem < this.mixinDatacomResData.length) {
|
||||||
defItem = this.mixinDatacomResData[this.defItem - 1].value
|
defItem = this.mixinDatacomResData[this.defItem - 1].value
|
||||||
}
|
}
|
||||||
defValue = defItem
|
defValue = defItem
|
||||||
}
|
}
|
||||||
if (defValue || defValue === 0) {
|
this.emit(defValue)
|
||||||
this.emit(defValue)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const def = this.mixinDatacomResData.find(item => item.value === defValue)
|
const def = this.mixinDatacomResData.find(item => item.value === defValue)
|
||||||
this.current = def ? this.formatItemName(def) : ''
|
this.current = def ? this.formatItemName(def) : ''
|
||||||
@ -220,7 +184,7 @@
|
|||||||
clearVal() {
|
clearVal() {
|
||||||
this.emit('')
|
this.emit('')
|
||||||
if (this.collection) {
|
if (this.collection) {
|
||||||
this.removeCache()
|
uni.removeStorageSync(this.last)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
change(item) {
|
change(item) {
|
||||||
@ -231,18 +195,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
emit(val) {
|
emit(val) {
|
||||||
|
this.$emit('change', val)
|
||||||
this.$emit('input', val)
|
this.$emit('input', val)
|
||||||
this.$emit('update:modelValue', val)
|
this.$emit('update:modelValue', val)
|
||||||
this.$emit('change', val)
|
|
||||||
if (this.collection) {
|
if (this.collection) {
|
||||||
this.setCache(val);
|
uni.setStorageSync(this.last, val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleSelector() {
|
|
||||||
if (this.disabled) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
toggleSelector() {
|
||||||
this.showSelector = !this.showSelector
|
this.showSelector = !this.showSelector
|
||||||
},
|
},
|
||||||
formatItemName(item) {
|
formatItemName(item) {
|
||||||
@ -252,50 +213,14 @@
|
|||||||
channel_code
|
channel_code
|
||||||
} = item
|
} = item
|
||||||
channel_code = channel_code ? `(${channel_code})` : ''
|
channel_code = channel_code ? `(${channel_code})` : ''
|
||||||
|
return this.collection.indexOf('app-list') > 0 ?
|
||||||
if (this.format) {
|
`${text}(${value})` :
|
||||||
// 格式化输出
|
(
|
||||||
let str = "";
|
text ?
|
||||||
str = this.format;
|
text :
|
||||||
for (let key in item) {
|
`未命名${channel_code}`
|
||||||
str = str.replace(new RegExp(`{${key}}`,"g"),item[key]);
|
)
|
||||||
}
|
}
|
||||||
return str;
|
|
||||||
} else {
|
|
||||||
return this.collection.indexOf('app-list') > 0 ?
|
|
||||||
`${text}(${value})` :
|
|
||||||
(
|
|
||||||
text ?
|
|
||||||
text :
|
|
||||||
`未命名${channel_code}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 获取当前加载的数据
|
|
||||||
getLoadData(){
|
|
||||||
return this.mixinDatacomResData;
|
|
||||||
},
|
|
||||||
// 获取当前缓存key
|
|
||||||
getCurrentCacheKey(){
|
|
||||||
return this.collection;
|
|
||||||
},
|
|
||||||
// 获取缓存
|
|
||||||
getCache(name=this.getCurrentCacheKey()){
|
|
||||||
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
|
||||||
return cacheData[name];
|
|
||||||
},
|
|
||||||
// 设置缓存
|
|
||||||
setCache(value, name=this.getCurrentCacheKey()){
|
|
||||||
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
|
||||||
cacheData[name] = value;
|
|
||||||
uni.setStorageSync(this.cacheKey, cacheData);
|
|
||||||
},
|
|
||||||
// 删除缓存
|
|
||||||
removeCache(name=this.getCurrentCacheKey()){
|
|
||||||
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
|
||||||
delete cacheData[name];
|
|
||||||
uni.setStorageSync(this.cacheKey, cacheData);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -319,9 +244,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
// padding: 15px;
|
// padding: 15px;
|
||||||
/* #ifdef H5 */
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
/* #endif */
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -364,11 +287,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
|
|
||||||
&--disabled {
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-select__label {
|
.uni-select__label {
|
||||||
@ -380,7 +298,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-select__input-box {
|
.uni-select__input-box {
|
||||||
height: 35px;
|
// height: 35px;
|
||||||
position: relative;
|
position: relative;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -414,7 +332,7 @@
|
|||||||
border: 1px solid #EBEEF5;
|
border: 1px solid #EBEEF5;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
z-index: 3;
|
z-index: 2;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,14 +343,6 @@
|
|||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #ifdef H5 */
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
.uni-select__selector-scroll {
|
|
||||||
max-height: 600px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
.uni-select__selector-empty,
|
.uni-select__selector-empty,
|
||||||
.uni-select__selector-item {
|
.uni-select__selector-item {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -512,6 +422,5 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 2;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-data-select",
|
"id": "uni-data-select",
|
||||||
"displayName": "uni-data-select 下拉框选择器",
|
"displayName": "uni-data-select 下拉框选择器",
|
||||||
"version": "1.0.6",
|
"version": "0.1.6",
|
||||||
"description": "通过数据驱动的下拉框选择器",
|
"description": "通过数据驱动的下拉框选择器",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-load-more"],
|
"dependencies": ["uni-load-more"],
|
||||||
|
@ -1,71 +1,31 @@
|
|||||||
## 2.2.22(2023-03-30)
|
|
||||||
- 修复 日历 picker 修改年月后,自动选中当月1日 [详情](https://ask.dcloud.net.cn/question/165937)
|
|
||||||
- 修复 小程序端 低版本 ios NaN [详情](https://ask.dcloud.net.cn/question/162979)
|
|
||||||
## 2.2.21(2023-02-20)
|
|
||||||
- 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362)
|
|
||||||
## 2.2.20(2023-02-17)
|
|
||||||
- 优化 值为空依然选中当天问题
|
|
||||||
- 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间
|
|
||||||
- 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间
|
|
||||||
- 优化 字节小程序日期时间范围选择,底部日期换行问题
|
|
||||||
## 2.2.19(2023-02-09)
|
|
||||||
- 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686)
|
|
||||||
## 2.2.18(2023-02-08)
|
|
||||||
- 修复 移动端范围选择change事件触发异常的Bug [详情](https://github.com/dcloudio/uni-ui/issues/684)
|
|
||||||
- 优化 PC端输入日期格式错误时返回当前日期时间
|
|
||||||
- 优化 PC端输入日期时间超出 start、end 限制的Bug
|
|
||||||
- 优化 移动端日期时间范围用法时间展示不完整问题
|
|
||||||
## 2.2.17(2023-02-04)
|
|
||||||
- 修复 小程序端绑定 Date 类型报错的Bug [详情](https://github.com/dcloudio/uni-ui/issues/679)
|
|
||||||
- 修复 vue3 time-picker 无法显示绑定时分秒的Bug
|
|
||||||
## 2.2.16(2023-02-02)
|
|
||||||
- 修复 字节小程序报错的Bug
|
|
||||||
## 2.2.15(2023-02-02)
|
|
||||||
- 修复 某些情况切换月份错误的Bug
|
|
||||||
## 2.2.14(2023-01-30)
|
|
||||||
- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/162033)
|
|
||||||
## 2.2.13(2023-01-10)
|
|
||||||
- 修复 多次加载组件造成内存占用的Bug
|
|
||||||
## 2.2.12(2022-12-01)
|
|
||||||
- 修复 vue3 下 i18n 国际化初始值不正确的Bug
|
|
||||||
## 2.2.11(2022-09-19)
|
|
||||||
- 修复 支付宝小程序样式错乱的Bug [详情](https://github.com/dcloudio/uni-app/issues/3861)
|
|
||||||
## 2.2.10(2022-09-19)
|
|
||||||
- 修复 反向选择日期范围,日期显示异常的Bug [详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false)
|
|
||||||
## 2.2.9(2022-09-16)
|
|
||||||
- 可以使用 uni-scss 控制主题色
|
|
||||||
## 2.2.8(2022-09-08)
|
|
||||||
- 修复 close事件无效的Bug
|
|
||||||
## 2.2.7(2022-09-05)
|
|
||||||
- 修复 移动端 maskClick 无效的Bug [详情](https://ask.dcloud.net.cn/question/140824)
|
|
||||||
## 2.2.6(2022-06-30)
|
## 2.2.6(2022-06-30)
|
||||||
- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致
|
- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致
|
||||||
## 2.2.5(2022-06-24)
|
## 2.2.5(2022-06-24)
|
||||||
- 修复 日历顶部年月及底部确认未国际化的Bug
|
- 修复 日历顶部年月及底部确认未国际化 bug
|
||||||
## 2.2.4(2022-03-31)
|
## 2.2.4(2022-03-31)
|
||||||
- 修复 Vue3 下动态赋值,单选类型未响应的Bug
|
- 修复 Vue3 下动态赋值,单选类型未响应的 bug
|
||||||
## 2.2.3(2022-03-28)
|
## 2.2.3(2022-03-28)
|
||||||
- 修复 Vue3 下动态赋值未响应的Bug
|
- 修复 Vue3 下动态赋值未响应的 bug
|
||||||
## 2.2.2(2021-12-10)
|
## 2.2.2(2021-12-10)
|
||||||
- 修复 clear-icon 属性在小程序平台不生效的Bug
|
- 修复 clear-icon 属性在小程序平台不生效的 bug
|
||||||
## 2.2.1(2021-12-10)
|
## 2.2.1(2021-12-10)
|
||||||
- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的Bug
|
- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug
|
||||||
## 2.2.0(2021-11-19)
|
## 2.2.0(2021-11-19)
|
||||||
- 优化 组件UI,并提供设计资源 [详情](https://uniapp.dcloud.io/component/uniui/resource)
|
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||||
- 文档迁移 [https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
|
||||||
## 2.1.5(2021-11-09)
|
## 2.1.5(2021-11-09)
|
||||||
- 新增 提供组件设计资源,组件样式调整
|
- 新增 提供组件设计资源,组件样式调整
|
||||||
## 2.1.4(2021-09-10)
|
## 2.1.4(2021-09-10)
|
||||||
- 修复 hide-second 在移动端的Bug
|
- 修复 hide-second 在移动端的 bug
|
||||||
- 修复 单选赋默认值时,赋值日期未高亮的Bug
|
- 修复 单选赋默认值时,赋值日期未高亮的 bug
|
||||||
- 修复 赋默认值时,移动端未正确显示时间的Bug
|
- 修复 赋默认值时,移动端未正确显示时间的 bug
|
||||||
## 2.1.3(2021-09-09)
|
## 2.1.3(2021-09-09)
|
||||||
- 新增 hide-second 属性,支持只使用时分,隐藏秒
|
- 新增 hide-second 属性,支持只使用时分,隐藏秒
|
||||||
## 2.1.2(2021-09-03)
|
## 2.1.2(2021-09-03)
|
||||||
- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次
|
- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次
|
||||||
- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法
|
- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法
|
||||||
- 优化 调整字号大小,美化日历界面
|
- 优化 调整字号大小,美化日历界面
|
||||||
- 修复 因国际化导致的 placeholder 失效的Bug
|
- 修复 因国际化导致的 placeholder 失效的 bug
|
||||||
## 2.1.1(2021-08-24)
|
## 2.1.1(2021-08-24)
|
||||||
- 新增 支持国际化
|
- 新增 支持国际化
|
||||||
- 优化 范围选择器在 pc 端过宽的问题
|
- 优化 范围选择器在 pc 端过宽的问题
|
||||||
@ -73,50 +33,50 @@
|
|||||||
- 新增 适配 vue3
|
- 新增 适配 vue3
|
||||||
## 2.0.19(2021-08-09)
|
## 2.0.19(2021-08-09)
|
||||||
- 新增 支持作为 uni-forms 子组件相关功能
|
- 新增 支持作为 uni-forms 子组件相关功能
|
||||||
- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的Bug
|
- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug
|
||||||
## 2.0.18(2021-08-05)
|
## 2.0.18(2021-08-05)
|
||||||
- 修复 type 属性动态赋值无效的Bug
|
- 修复 type 属性动态赋值无效的 bug
|
||||||
- 修复 ‘确认’按钮被 tabbar 遮盖 bug
|
- 修复 ‘确认’按钮被 tabbar 遮盖 bug
|
||||||
- 修复 组件未赋值时范围选左、右日历相同的Bug
|
- 修复 组件未赋值时范围选左、右日历相同的 bug
|
||||||
## 2.0.17(2021-08-04)
|
## 2.0.17(2021-08-04)
|
||||||
- 修复 范围选未正确显示当前值的Bug
|
- 修复 范围选未正确显示当前值的 bug
|
||||||
- 修复 h5 平台(移动端)报错 'cale' of undefined 的Bug
|
- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug
|
||||||
## 2.0.16(2021-07-21)
|
## 2.0.16(2021-07-21)
|
||||||
- 新增 return-type 属性支持返回 date 日期对象
|
- 新增 return-type 属性支持返回 date 日期对象
|
||||||
## 2.0.15(2021-07-14)
|
## 2.0.15(2021-07-14)
|
||||||
- 修复 单选日期类型,初始赋值后不在当前日历的Bug
|
- 修复 单选日期类型,初始赋值后不在当前日历的 bug
|
||||||
- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效)
|
- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效)
|
||||||
- 优化 移动端移除显示框的清空按钮,无实际用途
|
- 优化 移动端移除显示框的清空按钮,无实际用途
|
||||||
## 2.0.14(2021-07-14)
|
## 2.0.14(2021-07-14)
|
||||||
- 修复 组件赋值为空,界面未更新的Bug
|
- 修复 组件赋值为空,界面未更新的 bug
|
||||||
- 修复 start 和 end 不能动态赋值的Bug
|
- 修复 start 和 end 不能动态赋值的 bug
|
||||||
- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的Bug
|
- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug
|
||||||
## 2.0.13(2021-07-08)
|
## 2.0.13(2021-07-08)
|
||||||
- 修复 范围选择不能动态赋值的Bug
|
- 修复 范围选择不能动态赋值的 bug
|
||||||
## 2.0.12(2021-07-08)
|
## 2.0.12(2021-07-08)
|
||||||
- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug
|
- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug
|
||||||
## 2.0.11(2021-07-08)
|
## 2.0.11(2021-07-08)
|
||||||
- 优化 弹出层在超出视窗边缘定位不准确的问题
|
- 优化 弹出层在超出视窗边缘定位不准确的问题
|
||||||
## 2.0.10(2021-07-08)
|
## 2.0.10(2021-07-08)
|
||||||
- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的Bug
|
- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug
|
||||||
- 优化 弹出层在超出视窗边缘被遮盖的问题
|
- 优化 弹出层在超出视窗边缘被遮盖的问题
|
||||||
## 2.0.9(2021-07-07)
|
## 2.0.9(2021-07-07)
|
||||||
- 新增 maskClick 事件
|
- 新增 maskClick 事件
|
||||||
- 修复 特殊情况日历 rpx 布局错误的Bug,rpx -> px
|
- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px
|
||||||
- 修复 范围选择时清空返回值不合理的bug,['', ''] -> []
|
- 修复 范围选择时清空返回值不合理的bug,['', ''] -> []
|
||||||
## 2.0.8(2021-07-07)
|
## 2.0.8(2021-07-07)
|
||||||
- 新增 日期时间显示框支持插槽
|
- 新增 日期时间显示框支持插槽
|
||||||
## 2.0.7(2021-07-01)
|
## 2.0.7(2021-07-01)
|
||||||
- 优化 添加 uni-icons 依赖
|
- 优化 添加 uni-icons 依赖
|
||||||
## 2.0.6(2021-05-22)
|
## 2.0.6(2021-05-22)
|
||||||
- 修复 图标在小程序上不显示的Bug
|
- 修复 图标在小程序上不显示的 bug
|
||||||
- 优化 重命名引用组件,避免潜在组件命名冲突
|
- 优化 重命名引用组件,避免潜在组件命名冲突
|
||||||
## 2.0.5(2021-05-20)
|
## 2.0.5(2021-05-20)
|
||||||
- 优化 代码目录扁平化
|
- 优化 代码目录扁平化
|
||||||
## 2.0.4(2021-05-12)
|
## 2.0.4(2021-05-12)
|
||||||
- 新增 组件示例地址
|
- 新增 组件示例地址
|
||||||
## 2.0.3(2021-05-10)
|
## 2.0.3(2021-05-10)
|
||||||
- 修复 ios 下不识别 '-' 日期格式的Bug
|
- 修复 ios 下不识别 '-' 日期格式的 bug
|
||||||
- 优化 pc 下弹出层添加边框和阴影
|
- 优化 pc 下弹出层添加边框和阴影
|
||||||
## 2.0.2(2021-05-08)
|
## 2.0.2(2021-05-08)
|
||||||
- 修复 在 admin 中获取弹出层定位错误的bug
|
- 修复 在 admin 中获取弹出层定位错误的bug
|
||||||
@ -127,7 +87,7 @@
|
|||||||
> 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)
|
> 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)
|
||||||
## 1.0.6(2021-03-18)
|
## 1.0.6(2021-03-18)
|
||||||
- 新增 hide-second 属性,时间支持仅选择时、分
|
- 新增 hide-second 属性,时间支持仅选择时、分
|
||||||
- 修复 选择跟显示的日期不一样的Bug
|
- 修复 选择跟显示的日期不一样的 bug
|
||||||
- 修复 chang事件触发2次的Bug
|
- 修复 chang事件触发2次的 bug
|
||||||
- 修复 分、秒 end 范围错误的Bug
|
- 修复 分、秒 end 范围错误的 bug
|
||||||
- 优化 更好的 nvue 适配
|
- 优化 更好的 nvue 适配
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||||
'uni-calendar-item--disable':weeks.disable,
|
'uni-calendar-item--disable':weeks.disable,
|
||||||
}">
|
}">
|
||||||
<text v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
|
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
|
||||||
<text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{weeks.date}}</text>
|
<text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{weeks.date}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view :class="{'uni-calendar-item--today': weeks.isToday}"></view>
|
<view :class="{'uni-calendar-item--isDay': weeks.isDay}"></view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -41,6 +41,10 @@
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
lunar: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
checkHover: {
|
checkHover: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@ -58,8 +62,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" >
|
<style lang="scss" >
|
||||||
$uni-primary: #007aff !default;
|
|
||||||
|
|
||||||
.uni-calendar-item__weeks-box {
|
.uni-calendar-item__weeks-box {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -76,7 +78,12 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
// font-family: Lato-Bold, Lato;
|
// font-family: Lato-Bold, Lato;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: darken($color: $uni-primary, $amount: 40%);
|
color: #455997;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item__weeks-lunar-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item__weeks-box-item {
|
.uni-calendar-item__weeks-box-item {
|
||||||
@ -107,6 +114,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item__weeks-box .uni-calendar-item--disable {
|
.uni-calendar-item__weeks-box .uni-calendar-item--disable {
|
||||||
|
// background-color: rgba(249, 249, 249, $uni-opacity-disabled);
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +122,7 @@
|
|||||||
color: #D1D1D1;
|
color: #D1D1D1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item--today {
|
.uni-calendar-item--isDay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 17%;
|
right: 17%;
|
||||||
@ -130,7 +138,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-calendar-item__weeks-box .uni-calendar-item--checked {
|
.uni-calendar-item__weeks-box .uni-calendar-item--checked {
|
||||||
background-color: $uni-primary;
|
background-color: #007aff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 3px solid #fff;
|
border: 3px solid #fff;
|
||||||
@ -151,7 +159,7 @@
|
|||||||
|
|
||||||
.uni-calendar-item--multiple .uni-calendar-item--before-checked,
|
.uni-calendar-item--multiple .uni-calendar-item--before-checked,
|
||||||
.uni-calendar-item--multiple .uni-calendar-item--after-checked {
|
.uni-calendar-item--multiple .uni-calendar-item--after-checked {
|
||||||
background-color: $uni-primary;
|
background-color: #409eff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 3px solid #F6F7FC;
|
border: 3px solid #F6F7FC;
|
||||||
|
@ -1,37 +1,31 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-calendar" @mouseleave="leaveCale">
|
<view class="uni-calendar" @mouseleave="leaveCale">
|
||||||
|
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
|
||||||
<view v-if="!insert && show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
|
@click="clean"></view>
|
||||||
@click="maskClick"></view>
|
|
||||||
|
|
||||||
<view v-if="insert || show" class="uni-calendar__content"
|
<view v-if="insert || show" class="uni-calendar__content"
|
||||||
:class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}">
|
:class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}">
|
||||||
<view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}">
|
<view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}">
|
||||||
|
<view v-if="left" class="uni-calendar__header-btn-box" @click.stop="pre">
|
||||||
<view class="uni-calendar__header-btn-box" @click.stop="changeMonth('pre')">
|
|
||||||
<view class="uni-calendar__header-btn uni-calendar--left"></view>
|
<view class="uni-calendar__header-btn uni-calendar--left"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<picker mode="date" :value="date" fields="month" @change="bindDateChange">
|
<picker mode="date" :value="date" fields="month" @change="bindDateChange">
|
||||||
<text
|
<text
|
||||||
class="uni-calendar__header-text">{{ (nowDate.year||'') + yearText + ( nowDate.month||'') + monthText}}</text>
|
class="uni-calendar__header-text">{{ (nowDate.year||'') + yearText + ( nowDate.month||'') + monthText}}</text>
|
||||||
</picker>
|
</picker>
|
||||||
|
<view v-if="right" class="uni-calendar__header-btn-box" @click.stop="next">
|
||||||
<view class="uni-calendar__header-btn-box" @click.stop="changeMonth('next')">
|
|
||||||
<view class="uni-calendar__header-btn uni-calendar--right"></view>
|
<view class="uni-calendar__header-btn uni-calendar--right"></view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="!insert" class="dialog-close" @click="clean">
|
||||||
<view v-if="!insert" class="dialog-close" @click="close">
|
|
||||||
<view class="dialog-close-plus" data-id="close"></view>
|
<view class="dialog-close-plus" data-id="close"></view>
|
||||||
<view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
|
<view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- <text class="uni-calendar__backtoday" @click="backtoday">回到今天</text> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-calendar__box">
|
<view class="uni-calendar__box">
|
||||||
|
|
||||||
<view v-if="showMonth" class="uni-calendar__box-bg">
|
<view v-if="showMonth" class="uni-calendar__box-bg">
|
||||||
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
|
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="uni-calendar__weeks" style="padding-bottom: 7px;">
|
<view class="uni-calendar__weeks" style="padding-bottom: 7px;">
|
||||||
<view class="uni-calendar__weeks-day">
|
<view class="uni-calendar__weeks-day">
|
||||||
<text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
|
<text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
|
||||||
@ -55,45 +49,43 @@
|
|||||||
<text class="uni-calendar__weeks-day-text">{{SATText}}</text>
|
<text class="uni-calendar__weeks-day-text">{{SATText}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
|
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
|
||||||
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
|
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
|
||||||
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar"
|
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar"
|
||||||
:selected="selected" :checkHover="range" @change="choiceDate"
|
:selected="selected" :lunar="lunar" :checkHover="range" @change="choiceDate"
|
||||||
@handleMouse="handleMouse">
|
@handleMouse="handleMouse">
|
||||||
</calendar-item>
|
</calendar-item>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="!insert && !range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top"
|
||||||
<view v-if="!insert && !range && hasTime" class="uni-date-changed uni-calendar--fixed-top"
|
|
||||||
style="padding: 0 80px;">
|
style="padding: 0 80px;">
|
||||||
<view class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</view>
|
<view class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</view>
|
||||||
<time-picker type="time" :start="timepickerStartTime" :end="timepickerEndTime" v-model="time"
|
<time-picker type="time" :start="reactStartTime" :end="reactEndTime" v-model="time"
|
||||||
:disabled="!tempSingleDate" :border="false" :hide-second="hideSecond" class="time-picker-style">
|
:disabled="!tempSingleDate" :border="false" :hide-second="hideSecond" class="time-picker-style">
|
||||||
</time-picker>
|
</time-picker>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="!insert && range && hasTime" class="uni-date-changed uni-calendar--fixed-top">
|
<view v-if="!insert && range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top">
|
||||||
<view class="uni-date-changed--time-start">
|
<view class="uni-date-changed--time-start">
|
||||||
<view class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}}
|
<view class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}}
|
||||||
</view>
|
</view>
|
||||||
<time-picker type="time" :start="timepickerStartTime" v-model="timeRange.startTime" :border="false"
|
<time-picker type="time" :start="reactStartTime" v-model="timeRange.startTime" :border="false"
|
||||||
:hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style">
|
:hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style">
|
||||||
</time-picker>
|
</time-picker>
|
||||||
</view>
|
</view>
|
||||||
<view style="line-height: 50px;">
|
<uni-icons type="arrowthinright" color="#999" style="line-height: 50px;"></uni-icons>
|
||||||
<uni-icons type="arrowthinright" color="#999"></uni-icons>
|
|
||||||
</view>
|
|
||||||
<view class="uni-date-changed--time-end">
|
<view class="uni-date-changed--time-end">
|
||||||
<view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
|
<view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
|
||||||
<time-picker type="time" :end="timepickerEndTime" v-model="timeRange.endTime" :border="false"
|
<time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false"
|
||||||
:hide-second="hideSecond" :disabled="!tempRange.after" class="time-picker-style">
|
:hide-second="hideSecond" :disabled="!tempRange.after" class="time-picker-style">
|
||||||
</time-picker>
|
</time-picker>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="!insert" class="uni-date-changed uni-date-btn--ok">
|
<view v-if="!insert" class="uni-date-changed uni-date-btn--ok">
|
||||||
|
<!-- <view class="uni-calendar__header-btn-box">
|
||||||
|
<text class="uni-calendar__button-text uni-calendar--fixed-width">{{okText}}</text>
|
||||||
|
</view> -->
|
||||||
<view class="uni-datetime-picker--btn" @click="confirm">{{confirmText}}</view>
|
<view class="uni-datetime-picker--btn" @click="confirm">{{confirmText}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -101,19 +93,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Calendar, getDate, getTime } from './util.js';
|
import Calendar from './util.js';
|
||||||
import calendarItem from './calendar-item.vue'
|
import calendarItem from './calendar-item.vue'
|
||||||
import timePicker from './time-picker.vue'
|
import timePicker from './time-picker.vue'
|
||||||
|
import {
|
||||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
initVueI18n
|
||||||
import i18nMessages from './i18n/index.js'
|
} from '@dcloudio/uni-i18n'
|
||||||
const { t } = initVueI18n(i18nMessages)
|
import messages from './i18n/index.js'
|
||||||
|
const {
|
||||||
|
t
|
||||||
|
} = initVueI18n(messages)
|
||||||
/**
|
/**
|
||||||
* Calendar 日历
|
* Calendar 日历
|
||||||
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
|
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=56
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=56
|
||||||
* @property {String} date 自定义当前时间,默认为今天
|
* @property {String} date 自定义当前时间,默认为今天
|
||||||
|
* @property {Boolean} lunar 显示农历
|
||||||
* @property {String} startDate 日期选择范围-开始日期
|
* @property {String} startDate 日期选择范围-开始日期
|
||||||
* @property {String} endDate 日期选择范围-结束日期
|
* @property {String} endDate 日期选择范围-结束日期
|
||||||
* @property {Boolean} range 范围选择
|
* @property {Boolean} range 范围选择
|
||||||
@ -123,11 +118,10 @@
|
|||||||
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
|
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
|
||||||
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
|
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
|
||||||
* @property {Boolean} showMonth 是否选择月份为背景
|
* @property {Boolean} showMonth 是否选择月份为背景
|
||||||
* @property {[String} defaultValue 选择器打开时默认显示的时间
|
|
||||||
* @event {Function} change 日期改变,`insert :ture` 时生效
|
* @event {Function} change 日期改变,`insert :ture` 时生效
|
||||||
* @event {Function} confirm 确认选择`insert :false` 时生效
|
* @event {Function} confirm 确认选择`insert :false` 时生效
|
||||||
* @event {Function} monthSwitch 切换月份时触发
|
* @event {Function} monthSwitch 切换月份时触发
|
||||||
* @example <uni-calendar :insert="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
|
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -155,6 +149,10 @@
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
lunar: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
startDate: {
|
startDate: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
@ -163,19 +161,11 @@
|
|||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
startPlaceholder: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
endPlaceholder: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
range: {
|
range: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
hasTime: {
|
typeHasTime: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
@ -191,6 +181,14 @@
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
left: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
checkHover: {
|
checkHover: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
@ -209,18 +207,14 @@
|
|||||||
fulldate: ''
|
fulldate: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
defaultValue: {
|
|
||||||
type: [String, Object, Array],
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: false,
|
show: false,
|
||||||
weeks: [],
|
weeks: [],
|
||||||
calendar: {},
|
calendar: {},
|
||||||
nowDate: {},
|
nowDate: '',
|
||||||
aniMaskShow: false,
|
aniMaskShow: false,
|
||||||
firstEnter: true,
|
firstEnter: true,
|
||||||
time: '',
|
time: '',
|
||||||
@ -238,7 +232,7 @@
|
|||||||
watch: {
|
watch: {
|
||||||
date: {
|
date: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(newVal) {
|
handler(newVal, oldVal) {
|
||||||
if (!this.range) {
|
if (!this.range) {
|
||||||
this.tempSingleDate = newVal
|
this.tempSingleDate = newVal
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -249,44 +243,33 @@
|
|||||||
},
|
},
|
||||||
defTime: {
|
defTime: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(newVal) {
|
handler(newVal, oldVal) {
|
||||||
if (!this.range) {
|
if (!this.range) {
|
||||||
this.time = newVal
|
this.time = newVal
|
||||||
} else {
|
} else {
|
||||||
|
// console.log('-----', newVal);
|
||||||
this.timeRange.startTime = newVal.start
|
this.timeRange.startTime = newVal.start
|
||||||
this.timeRange.endTime = newVal.end
|
this.timeRange.endTime = newVal.end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startDate(val) {
|
startDate(val) {
|
||||||
// 字节小程序 watch 早于 created
|
this.cale.resetSatrtDate(val)
|
||||||
if(!this.cale){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.cale.setStartDate(val)
|
|
||||||
this.cale.setDate(this.nowDate.fullDate)
|
this.cale.setDate(this.nowDate.fullDate)
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
},
|
},
|
||||||
endDate(val) {
|
endDate(val) {
|
||||||
// 字节小程序 watch 早于 created
|
this.cale.resetEndDate(val)
|
||||||
if(!this.cale){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.cale.setEndDate(val)
|
|
||||||
this.cale.setDate(this.nowDate.fullDate)
|
this.cale.setDate(this.nowDate.fullDate)
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
},
|
},
|
||||||
selected(newVal) {
|
selected(newVal) {
|
||||||
// 字节小程序 watch 早于 created
|
|
||||||
if(!this.cale){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
|
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
},
|
},
|
||||||
pleStatus: {
|
pleStatus: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(newVal) {
|
handler(newVal, oldVal) {
|
||||||
const {
|
const {
|
||||||
before,
|
before,
|
||||||
after,
|
after,
|
||||||
@ -309,16 +292,11 @@
|
|||||||
this.cale.lastHover = false
|
this.cale.lastHover = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 字节小程序 watch 早于 created
|
|
||||||
if(!this.cale){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.cale.setDefaultMultiple(before, after)
|
this.cale.setDefaultMultiple(before, after)
|
||||||
if (which === 'left' && before) {
|
if (which === 'left') {
|
||||||
this.setDate(before)
|
this.setDate(before)
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
} else if(after) {
|
} else {
|
||||||
this.setDate(after)
|
this.setDate(after)
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
}
|
}
|
||||||
@ -329,13 +307,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
timepickerStartTime() {
|
reactStartTime() {
|
||||||
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate
|
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate
|
||||||
return activeDate === this.startDate ? this.selectableTimes.start : ''
|
const res = activeDate === this.startDate ? this.selectableTimes.start : ''
|
||||||
|
return res
|
||||||
},
|
},
|
||||||
timepickerEndTime() {
|
reactEndTime() {
|
||||||
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
|
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
|
||||||
return activeDate === this.endDate ? this.selectableTimes.end : ''
|
const res = activeDate === this.endDate ? this.selectableTimes.end : ''
|
||||||
|
return res
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* for i18n
|
* for i18n
|
||||||
@ -386,13 +366,17 @@
|
|||||||
created() {
|
created() {
|
||||||
// 获取日历方法实例
|
// 获取日历方法实例
|
||||||
this.cale = new Calendar({
|
this.cale = new Calendar({
|
||||||
|
// date: new Date(),
|
||||||
selected: this.selected,
|
selected: this.selected,
|
||||||
startDate: this.startDate,
|
startDate: this.startDate,
|
||||||
endDate: this.endDate,
|
endDate: this.endDate,
|
||||||
range: this.range,
|
range: this.range,
|
||||||
|
// multipleStatus: this.pleStatus
|
||||||
})
|
})
|
||||||
// 选中某一天
|
// 选中某一天
|
||||||
|
// this.cale.setDate(this.date)
|
||||||
this.init(this.date)
|
this.init(this.date)
|
||||||
|
// this.setDay
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
leaveCale() {
|
leaveCale() {
|
||||||
@ -421,10 +405,10 @@
|
|||||||
const [yearB, monthB] = B.split('-')
|
const [yearB, monthB] = B.split('-')
|
||||||
return yearA === yearB && monthA === monthB
|
return yearA === yearB && monthA === monthB
|
||||||
},
|
},
|
||||||
// 蒙版点击事件
|
|
||||||
maskClick() {
|
// 取消穿透
|
||||||
this.close()
|
clean() {
|
||||||
this.$emit('maskClose')
|
this.close()
|
||||||
},
|
},
|
||||||
|
|
||||||
clearCalender() {
|
clearCalender() {
|
||||||
@ -442,49 +426,33 @@
|
|||||||
this.tempSingleDate = ''
|
this.tempSingleDate = ''
|
||||||
}
|
}
|
||||||
this.calendar.fullDate = ''
|
this.calendar.fullDate = ''
|
||||||
this.setDate(new Date())
|
this.setDate()
|
||||||
},
|
},
|
||||||
|
|
||||||
bindDateChange(e) {
|
bindDateChange(e) {
|
||||||
const value = e.detail.value + '-1'
|
const value = e.detail.value + '-1'
|
||||||
this.setDate(value)
|
this.init(value)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 初始化日期显示
|
* 初始化日期显示
|
||||||
* @param {Object} date
|
* @param {Object} date
|
||||||
*/
|
*/
|
||||||
init(date) {
|
init(date) {
|
||||||
// 字节小程序 watch 早于 created
|
this.cale.setDate(date)
|
||||||
if(!this.cale){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.cale.setDate(date || new Date())
|
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
this.nowDate = this.cale.getInfo(date)
|
this.nowDate = this.calendar = this.cale.getInfo(date)
|
||||||
this.calendar = {...this.nowDate}
|
|
||||||
if(!date){
|
|
||||||
// 优化date为空默认不选中今天
|
|
||||||
this.calendar.fullDate = ''
|
|
||||||
if(this.defaultValue && !this.range){
|
|
||||||
// 暂时只支持移动端非范围选择
|
|
||||||
const defaultDate = new Date(this.defaultValue)
|
|
||||||
const fullDate = getDate(defaultDate)
|
|
||||||
const year = defaultDate.getFullYear()
|
|
||||||
const month = defaultDate.getMonth()+1
|
|
||||||
const date = defaultDate.getDate()
|
|
||||||
const day = defaultDate.getDay()
|
|
||||||
this.calendar = {
|
|
||||||
fullDate,
|
|
||||||
year,
|
|
||||||
month,
|
|
||||||
date,
|
|
||||||
day
|
|
||||||
},
|
|
||||||
this.tempSingleDate = fullDate
|
|
||||||
this.time = getTime(defaultDate, this.hideSecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
// choiceDate(weeks) {
|
||||||
|
// if (weeks.disable) return
|
||||||
|
// this.calendar = weeks
|
||||||
|
// // 设置多选
|
||||||
|
// this.cale.setMultiple(this.calendar.fullDate, true)
|
||||||
|
// this.weeks = this.cale.weeks
|
||||||
|
// this.tempSingleDate = this.calendar.fullDate
|
||||||
|
// this.tempRange.before = this.cale.multipleStatus.before
|
||||||
|
// this.tempRange.after = this.cale.multipleStatus.after
|
||||||
|
// this.change()
|
||||||
|
// },
|
||||||
/**
|
/**
|
||||||
* 打开日历弹窗
|
* 打开日历弹窗
|
||||||
*/
|
*/
|
||||||
@ -492,6 +460,7 @@
|
|||||||
// 弹窗模式并且清理数据
|
// 弹窗模式并且清理数据
|
||||||
if (this.clearDate && !this.insert) {
|
if (this.clearDate && !this.insert) {
|
||||||
this.cale.cleanMultipleStatus()
|
this.cale.cleanMultipleStatus()
|
||||||
|
// this.cale.setDate(this.date)
|
||||||
this.init(this.date)
|
this.init(this.date)
|
||||||
}
|
}
|
||||||
this.show = true
|
this.show = true
|
||||||
@ -545,20 +514,12 @@
|
|||||||
* @param {Object} name
|
* @param {Object} name
|
||||||
*/
|
*/
|
||||||
setEmit(name) {
|
setEmit(name) {
|
||||||
if(!this.range){
|
|
||||||
if(!this.calendar.fullDate){
|
|
||||||
this.calendar = this.cale.getInfo(new Date())
|
|
||||||
this.tempSingleDate = this.calendar.fullDate
|
|
||||||
}
|
|
||||||
if(this.hasTime && !this.time) {
|
|
||||||
this.time = getTime(new Date(), this.hideSecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let {
|
let {
|
||||||
year,
|
year,
|
||||||
month,
|
month,
|
||||||
date,
|
date,
|
||||||
fullDate,
|
fullDate,
|
||||||
|
lunar,
|
||||||
extraInfo
|
extraInfo
|
||||||
} = this.calendar
|
} = this.calendar
|
||||||
this.$emit(name, {
|
this.$emit(name, {
|
||||||
@ -569,6 +530,7 @@
|
|||||||
time: this.time,
|
time: this.time,
|
||||||
timeRange: this.timeRange,
|
timeRange: this.timeRange,
|
||||||
fulldate: fullDate,
|
fulldate: fullDate,
|
||||||
|
lunar,
|
||||||
extraInfo: extraInfo || {}
|
extraInfo: extraInfo || {}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -584,28 +546,50 @@
|
|||||||
this.cale.setMultiple(this.calendar.fullDate, true)
|
this.cale.setMultiple(this.calendar.fullDate, true)
|
||||||
this.weeks = this.cale.weeks
|
this.weeks = this.cale.weeks
|
||||||
this.tempSingleDate = this.calendar.fullDate
|
this.tempSingleDate = this.calendar.fullDate
|
||||||
const beforeDate = new Date(this.cale.multipleStatus.before).getTime()
|
this.tempRange.before = this.cale.multipleStatus.before
|
||||||
const afterDate = new Date(this.cale.multipleStatus.after).getTime()
|
this.tempRange.after = this.cale.multipleStatus.after
|
||||||
if (beforeDate > afterDate && afterDate) {
|
|
||||||
this.tempRange.before = this.cale.multipleStatus.after
|
|
||||||
this.tempRange.after = this.cale.multipleStatus.before
|
|
||||||
} else {
|
|
||||||
this.tempRange.before = this.cale.multipleStatus.before
|
|
||||||
this.tempRange.after = this.cale.multipleStatus.after
|
|
||||||
}
|
|
||||||
this.change()
|
this.change()
|
||||||
},
|
},
|
||||||
changeMonth(type) {
|
/**
|
||||||
let newDate
|
* 回到今天
|
||||||
if(type === 'pre') {
|
*/
|
||||||
newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate
|
backtoday() {
|
||||||
} else if(type === 'next') {
|
let date = this.cale.getDate(new Date()).fullDate
|
||||||
newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate
|
// this.cale.setDate(date)
|
||||||
}
|
this.init(date)
|
||||||
|
this.change()
|
||||||
this.setDate(newDate)
|
},
|
||||||
|
/**
|
||||||
|
* 比较时间大小
|
||||||
|
*/
|
||||||
|
dateCompare(startDate, endDate) {
|
||||||
|
// 计算截止时间
|
||||||
|
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
|
||||||
|
// 计算详细项的截止时间
|
||||||
|
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
|
||||||
|
if (startDate <= endDate) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 上个月
|
||||||
|
*/
|
||||||
|
pre() {
|
||||||
|
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
|
||||||
|
this.setDate(preDate)
|
||||||
this.monthSwitch()
|
this.monthSwitch()
|
||||||
},
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 下个月
|
||||||
|
*/
|
||||||
|
next() {
|
||||||
|
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
|
||||||
|
this.setDate(nextDate)
|
||||||
|
this.monthSwitch()
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 设置日期
|
* 设置日期
|
||||||
* @param {Object} date
|
* @param {Object} date
|
||||||
@ -620,8 +604,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" >
|
<style lang="scss" >
|
||||||
$uni-primary: #007aff !default;
|
|
||||||
|
|
||||||
.uni-calendar {
|
.uni-calendar {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -732,7 +714,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: $uni-primary;
|
color: #007aff;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
letter-spacing: 3px;
|
letter-spacing: 3px;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
@ -855,17 +837,14 @@
|
|||||||
|
|
||||||
.uni-date-changed--time-end {
|
.uni-date-changed--time-end {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-date-changed--time-date {
|
.uni-date-changed--time-date {
|
||||||
color: #999;
|
color: #999;
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
/* #ifdef MP-TOUTIAO */
|
|
||||||
font-size: 16px;
|
|
||||||
/* #endif */
|
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
// opacity: 0.6;
|
// opacity: 0.6;
|
||||||
}
|
}
|
||||||
@ -914,7 +893,7 @@
|
|||||||
border-radius: 100px;
|
border-radius: 100px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
background-color: $uni-primary;
|
background-color: #007aff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
letter-spacing: 2px;
|
letter-spacing: 2px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"uni-datetime-picker.selectDate": "select date",
|
"uni-datetime-picker.selectDate": "select date",
|
||||||
"uni-datetime-picker.selectTime": "select time",
|
"uni-datetime-picker.selectTime": "select time",
|
||||||
"uni-datetime-picker.selectDateTime": "select date and time",
|
"uni-datetime-picker.selectDateTime": "select datetime",
|
||||||
"uni-datetime-picker.startDate": "start date",
|
"uni-datetime-picker.startDate": "start date",
|
||||||
"uni-datetime-picker.endDate": "end date",
|
"uni-datetime-picker.endDate": "end date",
|
||||||
"uni-datetime-picker.startTime": "start time",
|
"uni-datetime-picker.startTime": "start time",
|
||||||
|
@ -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
|
@ -77,14 +77,21 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<!-- <keypress v-if="visible" @esc="tiggerTimePicker" @enter="setTime" /> -->
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
// #ifdef H5
|
||||||
import i18nMessages from './i18n/index.js'
|
import keypress from './keypress'
|
||||||
const { t } = initVueI18n(i18nMessages)
|
// #endif
|
||||||
import { fixIosDateFormat } from './util'
|
import {
|
||||||
|
initVueI18n
|
||||||
|
} from '@dcloudio/uni-i18n'
|
||||||
|
import messages from './i18n/index.js'
|
||||||
|
const { t } = initVueI18n(messages)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DatetimePicker 时间选择器
|
* DatetimePicker 时间选择器
|
||||||
@ -101,6 +108,11 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UniDatetimePicker',
|
name: 'UniDatetimePicker',
|
||||||
|
components: {
|
||||||
|
// #ifdef H5
|
||||||
|
keypress
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
indicatorStyle: `height: 50px;`,
|
indicatorStyle: `height: 50px;`,
|
||||||
@ -173,25 +185,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// #ifndef VUE3
|
|
||||||
value: {
|
value: {
|
||||||
handler(newVal) {
|
handler(newVal, oldVal) {
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
this.parseValue(fixIosDateFormat(newVal))
|
this.parseValue(this.fixIosDateFormat(newVal)) //兼容 iOS、safari 日期格式
|
||||||
this.initTime(false)
|
|
||||||
} else {
|
|
||||||
this.time = ''
|
|
||||||
this.parseValue(Date.now())
|
|
||||||
}
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
// #ifdef VUE3
|
|
||||||
modelValue: {
|
|
||||||
handler(newVal) {
|
|
||||||
if (newVal) {
|
|
||||||
this.parseValue(fixIosDateFormat(newVal))
|
|
||||||
this.initTime(false)
|
this.initTime(false)
|
||||||
} else {
|
} else {
|
||||||
this.time = ''
|
this.time = ''
|
||||||
@ -200,7 +197,6 @@
|
|||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
},
|
||||||
// #endif
|
|
||||||
type: {
|
type: {
|
||||||
handler(newValue) {
|
handler(newValue) {
|
||||||
if (newValue === 'date') {
|
if (newValue === 'date') {
|
||||||
@ -221,13 +217,13 @@
|
|||||||
},
|
},
|
||||||
start: {
|
start: {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
this.parseDatetimeRange(fixIosDateFormat(newVal), 'start')
|
this.parseDatetimeRange(this.fixIosDateFormat(newVal), 'start') //兼容 iOS、safari 日期格式
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
this.parseDatetimeRange(fixIosDateFormat(newVal), 'end')
|
this.parseDatetimeRange(this.fixIosDateFormat(newVal), 'end') //兼容 iOS、safari 日期格式
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
},
|
||||||
@ -531,7 +527,7 @@
|
|||||||
const day = now.getDate()
|
const day = now.getDate()
|
||||||
dateBase = year + '/' + month + '/' + day + ' '
|
dateBase = year + '/' + month + '/' + day + ' '
|
||||||
}
|
}
|
||||||
if (Number(value)) {
|
if (Number(value) && typeof value !== NaN) {
|
||||||
value = parseInt(value)
|
value = parseInt(value)
|
||||||
dateBase = 0
|
dateBase = 0
|
||||||
}
|
}
|
||||||
@ -602,7 +598,7 @@
|
|||||||
pointType === 'start' ? this.startYear = this.year - 60 : this.endYear = this.year + 60
|
pointType === 'start' ? this.startYear = this.year - 60 : this.endYear = this.year + 60
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (Number(point)) {
|
if (Number(point) && Number(point) !== NaN) {
|
||||||
point = parseInt(point)
|
point = parseInt(point)
|
||||||
}
|
}
|
||||||
// datetime 的 end 没有时分秒, 则不限制
|
// datetime 的 end 没有时分秒, 则不限制
|
||||||
@ -740,7 +736,7 @@
|
|||||||
*/
|
*/
|
||||||
initTimePicker() {
|
initTimePicker() {
|
||||||
if (this.disabled) return
|
if (this.disabled) return
|
||||||
const value = fixIosDateFormat(this.time)
|
const value = this.fixIosDateFormat(this.value)
|
||||||
this.initPickerValue(value)
|
this.initPickerValue(value)
|
||||||
this.visible = !this.visible
|
this.visible = !this.visible
|
||||||
},
|
},
|
||||||
@ -774,9 +770,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style>
|
||||||
$uni-primary: #007aff !default;
|
|
||||||
|
|
||||||
.uni-datetime-picker {
|
.uni-datetime-picker {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
/* width: 100%; */
|
/* width: 100%; */
|
||||||
@ -810,7 +804,7 @@
|
|||||||
|
|
||||||
.uni-datetime-picker-btn-text {
|
.uni-datetime-picker-btn-text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: $uni-primary;
|
color: #007AFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-datetime-picker-btn-group {
|
.uni-datetime-picker-btn-group {
|
||||||
@ -895,7 +889,6 @@
|
|||||||
|
|
||||||
.uni-datetime-picker-text {
|
.uni-datetime-picker-text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 50px
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-datetime-picker-sign {
|
.uni-datetime-picker-sign {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,27 @@
|
|||||||
class Calendar {
|
class Calendar {
|
||||||
constructor({
|
constructor({
|
||||||
|
date,
|
||||||
selected,
|
selected,
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
range,
|
range,
|
||||||
|
// multipleStatus
|
||||||
} = {}) {
|
} = {}) {
|
||||||
// 当前日期
|
// 当前日期
|
||||||
this.date = this.getDateObj(new Date()) // 当前初入日期
|
this.date = this.getDate(new Date()) // 当前初入日期
|
||||||
// 打点信息
|
// 打点信息
|
||||||
this.selected = selected || [];
|
this.selected = selected || [];
|
||||||
// 起始时间
|
// 范围开始
|
||||||
this.startDate = startDate
|
this.startDate = startDate
|
||||||
// 终止时间
|
// 范围结束
|
||||||
this.endDate = endDate
|
this.endDate = endDate
|
||||||
// 是否范围选择
|
|
||||||
this.range = range
|
this.range = range
|
||||||
// 多选状态
|
// 多选状态
|
||||||
this.cleanMultipleStatus()
|
this.cleanMultipleStatus()
|
||||||
// 每周日期
|
// 每周日期
|
||||||
this.weeks = {}
|
this.weeks = {}
|
||||||
|
// this._getWeek(this.date.fullDate)
|
||||||
|
// this.multipleStatus = multipleStatus
|
||||||
this.lastHover = false
|
this.lastHover = false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -26,8 +29,8 @@ class Calendar {
|
|||||||
* @param {Object} date
|
* @param {Object} date
|
||||||
*/
|
*/
|
||||||
setDate(date) {
|
setDate(date) {
|
||||||
const selectDate = this.getDateObj(date)
|
this.selectDate = this.getDate(date)
|
||||||
this.getWeeks(selectDate.fullDate)
|
this._getWeek(this.selectDate.fullDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,82 +44,93 @@ class Calendar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setStartDate(startDate) {
|
/**
|
||||||
|
* 重置开始日期
|
||||||
|
*/
|
||||||
|
resetSatrtDate(startDate) {
|
||||||
|
// 范围开始
|
||||||
this.startDate = startDate
|
this.startDate = startDate
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setEndDate(endDate) {
|
/**
|
||||||
|
* 重置结束日期
|
||||||
|
*/
|
||||||
|
resetEndDate(endDate) {
|
||||||
|
// 范围结束
|
||||||
this.endDate = endDate
|
this.endDate = endDate
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreMonthObj(date){
|
|
||||||
date = fixIosDateFormat(date)
|
|
||||||
date = new Date(date)
|
|
||||||
|
|
||||||
const oldMonth = date.getMonth()
|
|
||||||
date.setMonth(oldMonth - 1)
|
|
||||||
const newMonth = date.getMonth()
|
|
||||||
if(oldMonth !== 0 && newMonth - oldMonth === 0){
|
|
||||||
date.setMonth(newMonth - 1)
|
|
||||||
}
|
|
||||||
return this.getDateObj(date)
|
|
||||||
}
|
|
||||||
getNextMonthObj(date){
|
|
||||||
date = fixIosDateFormat(date)
|
|
||||||
date = new Date(date)
|
|
||||||
|
|
||||||
const oldMonth = date.getMonth()
|
|
||||||
date.setMonth(oldMonth + 1)
|
|
||||||
const newMonth = date.getMonth()
|
|
||||||
if(newMonth - oldMonth > 1){
|
|
||||||
date.setMonth(newMonth - 1)
|
|
||||||
}
|
|
||||||
return this.getDateObj(date)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定格式Date对象
|
* 获取任意时间
|
||||||
*/
|
*/
|
||||||
getDateObj(date) {
|
getDate(date, AddDayCount = 0, str = 'day') {
|
||||||
date = fixIosDateFormat(date)
|
if (!date) {
|
||||||
date = new Date(date)
|
date = new Date()
|
||||||
|
}
|
||||||
|
if (typeof date !== 'object') {
|
||||||
|
date = date.replace(/-/g, '/')
|
||||||
|
}
|
||||||
|
const dd = new Date(date)
|
||||||
|
switch (str) {
|
||||||
|
case 'day':
|
||||||
|
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
|
break
|
||||||
|
case 'month':
|
||||||
|
if (dd.getDate() === 31) {
|
||||||
|
dd.setDate(dd.getDate() + AddDayCount)
|
||||||
|
} else {
|
||||||
|
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'year':
|
||||||
|
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
|
break
|
||||||
|
}
|
||||||
|
const y = dd.getFullYear()
|
||||||
|
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
|
||||||
|
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
|
||||||
return {
|
return {
|
||||||
fullDate: getDate(date),
|
fullDate: y + '-' + m + '-' + d,
|
||||||
year: date.getFullYear(),
|
year: y,
|
||||||
month: addZero(date.getMonth() + 1),
|
month: m,
|
||||||
date: addZero(date.getDate()),
|
date: d,
|
||||||
day: date.getDay()
|
day: dd.getDay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取上一个月日期集合
|
* 获取上月剩余天数
|
||||||
*/
|
*/
|
||||||
getPreMonthDays(amount, dateObj) {
|
_getLastMonthDays(firstDay, full) {
|
||||||
const result = []
|
let dateArr = []
|
||||||
for (let i = amount - 1; i >= 0; i--) {
|
for (let i = firstDay; i > 0; i--) {
|
||||||
const month = dateObj.month - 1
|
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate()
|
||||||
result.push({
|
dateArr.push({
|
||||||
date: new Date(dateObj.year, month, -i).getDate(),
|
date: beforeDate,
|
||||||
month,
|
month: full.month - 1,
|
||||||
disable: true
|
disable: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return result
|
return dateArr
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取本月日期集合
|
* 获取本月天数
|
||||||
*/
|
*/
|
||||||
getCurrentMonthDays(amount, dateObj) {
|
_currentMonthDys(dateData, full) {
|
||||||
const result = []
|
let dateArr = []
|
||||||
const fullDate = this.date.fullDate
|
let fullDate = this.date.fullDate
|
||||||
for (let i = 1; i <= amount; i++) {
|
for (let i = 1; i <= dateData; i++) {
|
||||||
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`
|
let isinfo = false
|
||||||
const isToday = fullDate === currentDate
|
let nowDate = full.year + '-' + (full.month < 10 ?
|
||||||
|
full.month : full.month) + '-' + (i < 10 ?
|
||||||
|
'0' + i : i)
|
||||||
|
// 是否今天
|
||||||
|
let isDay = fullDate === nowDate
|
||||||
// 获取打点信息
|
// 获取打点信息
|
||||||
const info = this.selected && this.selected.find((item) => {
|
let info = this.selected && this.selected.find((item) => {
|
||||||
if (this.dateEqual(currentDate, item.date)) {
|
if (this.dateEqual(nowDate, item.date)) {
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -125,52 +139,62 @@ class Calendar {
|
|||||||
let disableBefore = true
|
let disableBefore = true
|
||||||
let disableAfter = true
|
let disableAfter = true
|
||||||
if (this.startDate) {
|
if (this.startDate) {
|
||||||
disableBefore = dateCompare(this.startDate, currentDate)
|
// let dateCompBefore = this.dateCompare(this.startDate, fullDate)
|
||||||
|
// disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
|
||||||
|
disableBefore = this.dateCompare(this.startDate, nowDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.endDate) {
|
if (this.endDate) {
|
||||||
disableAfter = dateCompare(currentDate, this.endDate)
|
// let dateCompAfter = this.dateCompare(fullDate, this.endDate)
|
||||||
|
// disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
|
||||||
|
disableAfter = this.dateCompare(nowDate, this.endDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
let multiples = this.multipleStatus.data
|
let multiples = this.multipleStatus.data
|
||||||
|
let checked = false
|
||||||
let multiplesStatus = -1
|
let multiplesStatus = -1
|
||||||
if (this.range && multiples) {
|
if (this.range) {
|
||||||
multiplesStatus = multiples.findIndex((item) => {
|
if (multiples) {
|
||||||
return this.dateEqual(item, currentDate)
|
multiplesStatus = multiples.findIndex((item) => {
|
||||||
})
|
return this.dateEqual(item, nowDate)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (multiplesStatus !== -1) {
|
||||||
|
checked = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const checked = multiplesStatus !== -1
|
let data = {
|
||||||
|
fullDate: nowDate,
|
||||||
result.push({
|
year: full.year,
|
||||||
fullDate: currentDate,
|
|
||||||
year: dateObj.year,
|
|
||||||
date: i,
|
date: i,
|
||||||
multiple: this.range ? checked : false,
|
multiple: this.range ? checked : false,
|
||||||
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
beforeMultiple: this.isLogicBefore(nowDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||||
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
afterMultiple: this.isLogicAfter(nowDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||||
month: dateObj.month,
|
month: full.month,
|
||||||
disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate,this.endDate)),
|
disable: !(disableBefore && disableAfter),
|
||||||
isToday,
|
isDay,
|
||||||
userChecked: false,
|
userChecked: false
|
||||||
extraInfo: info
|
}
|
||||||
})
|
if (info) {
|
||||||
|
data.extraInfo = info
|
||||||
|
}
|
||||||
|
|
||||||
|
dateArr.push(data)
|
||||||
}
|
}
|
||||||
return result
|
return dateArr
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获取下一个月日期集合
|
* 获取下月天数
|
||||||
*/
|
*/
|
||||||
_getNextMonthDays(amount, dateObj) {
|
_getNextMonthDays(surplus, full) {
|
||||||
const result = []
|
let dateArr = []
|
||||||
const month = dateObj.month + 1
|
for (let i = 1; i < surplus + 1; i++) {
|
||||||
for (let i = 1; i <= amount; i++) {
|
dateArr.push({
|
||||||
result.push({
|
|
||||||
date: i,
|
date: i,
|
||||||
month,
|
month: Number(full.month) + 1,
|
||||||
disable: true
|
disable: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return result
|
return dateArr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,37 +205,58 @@ class Calendar {
|
|||||||
if (!date) {
|
if (!date) {
|
||||||
date = new Date()
|
date = new Date()
|
||||||
}
|
}
|
||||||
|
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate)
|
||||||
|
return dateInfo
|
||||||
|
}
|
||||||
|
|
||||||
return this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate)
|
/**
|
||||||
|
* 比较时间大小
|
||||||
|
*/
|
||||||
|
dateCompare(startDate, endDate) {
|
||||||
|
// 计算截止时间
|
||||||
|
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
|
||||||
|
// 计算详细项的截止时间
|
||||||
|
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
|
||||||
|
if (startDate <= endDate) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比较时间是否相等
|
* 比较时间是否相等
|
||||||
*/
|
*/
|
||||||
dateEqual(before, after) {
|
dateEqual(before, after) {
|
||||||
before = new Date(fixIosDateFormat(before))
|
// 计算截止时间
|
||||||
after = new Date(fixIosDateFormat(after))
|
before = new Date(before.replace('-', '/').replace('-', '/'))
|
||||||
return before.valueOf() === after.valueOf()
|
// 计算详细项的截止时间
|
||||||
|
after = new Date(after.replace('-', '/').replace('-', '/'))
|
||||||
|
if (before.getTime() - after.getTime() === 0) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比较真实起始日期
|
* 比较真实起始日期
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isLogicBefore(currentDate, before, after) {
|
isLogicBefore(currentDay, before, after) {
|
||||||
let logicBefore = before
|
let logicBefore = before
|
||||||
if (before && after) {
|
if (before && after) {
|
||||||
logicBefore = dateCompare(before, after) ? before : after
|
logicBefore = this.dateCompare(before, after) ? before : after
|
||||||
}
|
}
|
||||||
return this.dateEqual(logicBefore, currentDate)
|
return this.dateEqual(logicBefore, currentDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
isLogicAfter(currentDate, before, after) {
|
isLogicAfter(currentDay, before, after) {
|
||||||
let logicAfter = after
|
let logicAfter = after
|
||||||
if (before && after) {
|
if (before && after) {
|
||||||
logicAfter = dateCompare(before, after) ? after : before
|
logicAfter = this.dateCompare(before, after) ? after : before
|
||||||
}
|
}
|
||||||
return this.dateEqual(logicAfter, currentDate)
|
return this.dateEqual(logicAfter, currentDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,7 +276,7 @@ class Calendar {
|
|||||||
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
|
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
|
||||||
for (var k = unixDb; k <= unixDe;) {
|
for (var k = unixDb; k <= unixDe;) {
|
||||||
k = k + 24 * 60 * 60 * 1000
|
k = k + 24 * 60 * 60 * 1000
|
||||||
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate)
|
arr.push(this.getDate(new Date(parseInt(k))).fullDate)
|
||||||
}
|
}
|
||||||
return arr
|
return arr
|
||||||
}
|
}
|
||||||
@ -240,12 +285,11 @@ class Calendar {
|
|||||||
* 获取多选状态
|
* 获取多选状态
|
||||||
*/
|
*/
|
||||||
setMultiple(fullDate) {
|
setMultiple(fullDate) {
|
||||||
if (!this.range) return
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
before,
|
before,
|
||||||
after
|
after
|
||||||
} = this.multipleStatus
|
} = this.multipleStatus
|
||||||
|
if (!this.range) return
|
||||||
if (before && after) {
|
if (before && after) {
|
||||||
if (!this.lastHover) {
|
if (!this.lastHover) {
|
||||||
this.lastHover = true
|
this.lastHover = true
|
||||||
@ -262,7 +306,7 @@ class Calendar {
|
|||||||
this.lastHover = false
|
this.lastHover = false
|
||||||
} else {
|
} else {
|
||||||
this.multipleStatus.after = fullDate
|
this.multipleStatus.after = fullDate
|
||||||
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
||||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus
|
||||||
.after);
|
.after);
|
||||||
} else {
|
} else {
|
||||||
@ -272,28 +316,32 @@ class Calendar {
|
|||||||
this.lastHover = true
|
this.lastHover = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getWeeks(fullDate)
|
this._getWeek(fullDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 鼠标 hover 更新多选状态
|
* 鼠标 hover 更新多选状态
|
||||||
*/
|
*/
|
||||||
setHoverMultiple(fullDate) {
|
setHoverMultiple(fullDate) {
|
||||||
if (!this.range || this.lastHover) return
|
let {
|
||||||
|
before,
|
||||||
|
after
|
||||||
|
} = this.multipleStatus
|
||||||
|
|
||||||
const { before } = this.multipleStatus
|
if (!this.range) return
|
||||||
|
if (this.lastHover) return
|
||||||
|
|
||||||
if (!before) {
|
if (!before) {
|
||||||
this.multipleStatus.before = fullDate
|
this.multipleStatus.before = fullDate
|
||||||
} else {
|
} else {
|
||||||
this.multipleStatus.after = fullDate
|
this.multipleStatus.after = fullDate
|
||||||
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
||||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
||||||
} else {
|
} else {
|
||||||
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getWeeks(fullDate)
|
this._getWeek(fullDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -303,12 +351,12 @@ class Calendar {
|
|||||||
this.multipleStatus.before = before
|
this.multipleStatus.before = before
|
||||||
this.multipleStatus.after = after
|
this.multipleStatus.after = after
|
||||||
if (before && after) {
|
if (before && after) {
|
||||||
if (dateCompare(before, after)) {
|
if (this.dateCompare(before, after)) {
|
||||||
this.multipleStatus.data = this.geDateAll(before, after);
|
this.multipleStatus.data = this.geDateAll(before, after);
|
||||||
this.getWeeks(after)
|
this._getWeek(after)
|
||||||
} else {
|
} else {
|
||||||
this.multipleStatus.data = this.geDateAll(after, before);
|
this.multipleStatus.data = this.geDateAll(after, before);
|
||||||
this.getWeeks(before)
|
this._getWeek(before)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,87 +365,46 @@ class Calendar {
|
|||||||
* 获取每周数据
|
* 获取每周数据
|
||||||
* @param {Object} dateData
|
* @param {Object} dateData
|
||||||
*/
|
*/
|
||||||
getWeeks(dateData) {
|
_getWeek(dateData) {
|
||||||
const {
|
const {
|
||||||
|
fullDate,
|
||||||
year,
|
year,
|
||||||
month,
|
month,
|
||||||
} = this.getDateObj(dateData)
|
date,
|
||||||
|
day
|
||||||
const preMonthDayAmount = new Date(year, month - 1, 1).getDay()
|
} = this.getDate(dateData)
|
||||||
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData))
|
let firstDay = new Date(year, month - 1, 1).getDay()
|
||||||
|
let currentDay = new Date(year, month, 0).getDate()
|
||||||
const currentMonthDayAmount = new Date(year, month, 0).getDate()
|
let dates = {
|
||||||
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData))
|
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
|
||||||
|
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
|
||||||
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount
|
nextMonthDays: [], // 下个月开始几天
|
||||||
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData))
|
weeks: []
|
||||||
|
|
||||||
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays]
|
|
||||||
|
|
||||||
const weeks = new Array(6)
|
|
||||||
for (let i = 0; i < calendarDays.length; i++) {
|
|
||||||
const index = Math.floor(i / 7)
|
|
||||||
if(!weeks[index]){
|
|
||||||
weeks[index] = new Array(7)
|
|
||||||
}
|
|
||||||
weeks[index][i % 7] = calendarDays[i]
|
|
||||||
}
|
}
|
||||||
|
let canlender = []
|
||||||
this.calendar = calendarDays
|
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
|
||||||
|
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData))
|
||||||
|
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays)
|
||||||
|
let weeks = {}
|
||||||
|
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
|
||||||
|
for (let i = 0; i < canlender.length; i++) {
|
||||||
|
if (i % 7 === 0) {
|
||||||
|
weeks[parseInt(i / 7)] = new Array(7)
|
||||||
|
}
|
||||||
|
weeks[parseInt(i / 7)][i % 7] = canlender[i]
|
||||||
|
}
|
||||||
|
this.canlender = canlender
|
||||||
this.weeks = weeks
|
this.weeks = weeks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//静态方法
|
||||||
|
// static init(date) {
|
||||||
|
// if (!this.instance) {
|
||||||
|
// this.instance = new Calendar(date);
|
||||||
|
// }
|
||||||
|
// return this.instance;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDateTime(date, hideSecond){
|
|
||||||
return `${getDate(date)} ${getTime(date, hideSecond)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDate(date) {
|
export default Calendar
|
||||||
date = fixIosDateFormat(date)
|
|
||||||
date = new Date(date)
|
|
||||||
const year = date.getFullYear()
|
|
||||||
const month = date.getMonth()+1
|
|
||||||
const day = date.getDate()
|
|
||||||
return `${year}-${addZero(month)}-${addZero(day)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTime(date, hideSecond){
|
|
||||||
date = fixIosDateFormat(date)
|
|
||||||
date = new Date(date)
|
|
||||||
const hour = date.getHours()
|
|
||||||
const minute = date.getMinutes()
|
|
||||||
const second = date.getSeconds()
|
|
||||||
return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function addZero(num) {
|
|
||||||
if(num < 10){
|
|
||||||
num = `0${num}`
|
|
||||||
}
|
|
||||||
return num
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaultSecond(hideSecond) {
|
|
||||||
return hideSecond ? '00:00' : '00:00:00'
|
|
||||||
}
|
|
||||||
|
|
||||||
function dateCompare(startDate, endDate) {
|
|
||||||
startDate = new Date(fixIosDateFormat(startDate))
|
|
||||||
endDate = new Date(fixIosDateFormat(endDate))
|
|
||||||
return startDate <= endDate
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkDate(date){
|
|
||||||
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g
|
|
||||||
return date.match(dateReg)
|
|
||||||
}
|
|
||||||
|
|
||||||
const dateTimeReg = /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])( [0-5][0-9]:[0-5][0-9]:[0-5][0-9])?$/
|
|
||||||
function fixIosDateFormat(value) {
|
|
||||||
if (typeof value === 'string' && dateTimeReg.test(value)) {
|
|
||||||
value = value.replace(/-/g, '/')
|
|
||||||
}
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
export {Calendar, getDateTime, getDate, getTime, addZero, getDefaultSecond, dateCompare, checkDate, fixIosDateFormat}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-datetime-picker",
|
"id": "uni-datetime-picker",
|
||||||
"displayName": "uni-datetime-picker 日期选择器",
|
"displayName": "uni-datetime-picker 日期选择器",
|
||||||
"version": "2.2.22",
|
"version": "2.2.6",
|
||||||
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
|
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-datetime-picker",
|
"uni-datetime-picker",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -1,97 +1,47 @@
|
|||||||
## 1.1.9(2023-04-11)
|
|
||||||
- 修复 vue3 下 keyboardheightchange 事件报错的bug
|
|
||||||
## 1.1.8(2023-03-29)
|
|
||||||
- 优化 trim 属性默认值
|
|
||||||
## 1.1.7(2023-03-29)
|
|
||||||
- 新增 cursor-spacing 属性
|
|
||||||
## 1.1.6(2023-01-28)
|
|
||||||
- 新增 keyboardheightchange 事件,可监听键盘高度变化
|
|
||||||
## 1.1.5(2022-11-29)
|
|
||||||
- 优化 主题样式
|
|
||||||
## 1.1.4(2022-10-27)
|
|
||||||
- 修复 props 中背景颜色无默认值的bug
|
|
||||||
## 1.1.0(2022-06-30)
|
## 1.1.0(2022-06-30)
|
||||||
|
|
||||||
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
|
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
|
||||||
- 新增 clear 事件,点击右侧叉号图标触发
|
- 新增 clear 事件,点击右侧叉号图标触发
|
||||||
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
|
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
|
||||||
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
|
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
|
||||||
|
-
|
||||||
## 1.0.5(2022-06-07)
|
## 1.0.5(2022-06-07)
|
||||||
|
|
||||||
- 优化 clearable 显示策略
|
- 优化 clearable 显示策略
|
||||||
|
|
||||||
## 1.0.4(2022-06-07)
|
## 1.0.4(2022-06-07)
|
||||||
|
|
||||||
- 优化 clearable 显示策略
|
- 优化 clearable 显示策略
|
||||||
|
|
||||||
## 1.0.3(2022-05-20)
|
## 1.0.3(2022-05-20)
|
||||||
|
- 修复 关闭图标某些情况下无法取消的bug
|
||||||
- 修复 关闭图标某些情况下无法取消的 bug
|
|
||||||
|
|
||||||
## 1.0.2(2022-04-12)
|
## 1.0.2(2022-04-12)
|
||||||
|
- 修复 默认值不生效的bug
|
||||||
- 修复 默认值不生效的 bug
|
|
||||||
|
|
||||||
## 1.0.1(2022-04-02)
|
## 1.0.1(2022-04-02)
|
||||||
|
- 修复 value不能为0的bug
|
||||||
- 修复 value 不能为 0 的 bug
|
|
||||||
|
|
||||||
## 1.0.0(2021-11-19)
|
## 1.0.0(2021-11-19)
|
||||||
|
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||||
- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
|
||||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
|
||||||
|
|
||||||
## 0.1.4(2021-08-20)
|
## 0.1.4(2021-08-20)
|
||||||
|
|
||||||
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
|
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
|
||||||
|
|
||||||
## 0.1.3(2021-08-11)
|
## 0.1.3(2021-08-11)
|
||||||
|
|
||||||
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
|
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
|
||||||
|
|
||||||
## 0.1.2(2021-07-30)
|
## 0.1.2(2021-07-30)
|
||||||
|
- 优化 vue3下事件警告的问题
|
||||||
- 优化 vue3 下事件警告的问题
|
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
- 优化 errorMessage 属性支持 Boolean 类型
|
- 优化 errorMessage 属性支持 Boolean 类型
|
||||||
|
|
||||||
## 0.1.0(2021-07-13)
|
## 0.1.0(2021-07-13)
|
||||||
|
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||||
- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
|
||||||
|
|
||||||
## 0.0.16(2021-06-29)
|
## 0.0.16(2021-06-29)
|
||||||
|
|
||||||
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
|
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
|
||||||
|
|
||||||
## 0.0.15(2021-06-21)
|
## 0.0.15(2021-06-21)
|
||||||
|
|
||||||
- 修复 passwordIcon 属性拼写错误的 bug
|
- 修复 passwordIcon 属性拼写错误的 bug
|
||||||
|
|
||||||
## 0.0.14(2021-06-18)
|
## 0.0.14(2021-06-18)
|
||||||
|
- 新增 passwordIcon 属性,当type=password时是否显示小眼睛图标
|
||||||
- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标
|
|
||||||
- 修复 confirmType 属性不生效的问题
|
- 修复 confirmType 属性不生效的问题
|
||||||
|
|
||||||
## 0.0.13(2021-06-04)
|
## 0.0.13(2021-06-04)
|
||||||
|
|
||||||
- 修复 disabled 状态可清出内容的 bug
|
- 修复 disabled 状态可清出内容的 bug
|
||||||
|
|
||||||
## 0.0.12(2021-05-12)
|
## 0.0.12(2021-05-12)
|
||||||
|
|
||||||
- 新增 组件示例地址
|
- 新增 组件示例地址
|
||||||
|
|
||||||
## 0.0.11(2021-05-07)
|
## 0.0.11(2021-05-07)
|
||||||
|
|
||||||
- 修复 input-border 属性不生效的问题
|
- 修复 input-border 属性不生效的问题
|
||||||
|
|
||||||
## 0.0.10(2021-04-30)
|
## 0.0.10(2021-04-30)
|
||||||
|
|
||||||
- 修复 ios 遮挡文字、显示一半的问题
|
- 修复 ios 遮挡文字、显示一半的问题
|
||||||
|
|
||||||
## 0.0.9(2021-02-05)
|
## 0.0.9(2021-02-05)
|
||||||
|
- 调整为uni_modules目录规范
|
||||||
- 调整为 uni_modules 目录规范
|
|
||||||
- 优化 兼容 nvue 页面
|
- 优化 兼容 nvue 页面
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-easyinput",
|
"id": "uni-easyinput",
|
||||||
"displayName": "uni-easyinput 增强输入框",
|
"displayName": "uni-easyinput 增强输入框",
|
||||||
"version": "1.1.9",
|
"version": "1.1.0",
|
||||||
"description": "Easyinput 组件是对原生input组件的增强",
|
"description": "Easyinput 组件是对原生input组件的增强",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
## 1.2.5(2023-03-29)
|
|
||||||
- 新增 pattern.icon 属性,可自定义图标
|
|
||||||
## 1.2.4(2022-09-07)
|
|
||||||
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
|
|
||||||
## 1.2.3(2022-09-05)
|
|
||||||
- 修复 nvue 环境下,具有 tabBar 时,fab 组件下部位置无法正常获取 --window-bottom 的bug,详见:[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310)
|
|
||||||
## 1.2.2(2021-12-29)
|
## 1.2.2(2021-12-29)
|
||||||
- 更新 组件依赖
|
- 更新 组件依赖
|
||||||
## 1.2.1(2021-11-19)
|
## 1.2.1(2021-11-19)
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
'uni-fab--rightBottom': rightBottom,
|
'uni-fab--rightBottom': rightBottom,
|
||||||
'uni-fab--leftTop': leftTop,
|
'uni-fab--leftTop': leftTop,
|
||||||
'uni-fab--rightTop': rightTop
|
'uni-fab--rightTop': rightTop
|
||||||
}" class="uni-fab"
|
}" class="uni-fab">
|
||||||
:style="nvueBottom"
|
|
||||||
>
|
|
||||||
<view :class="{
|
<view :class="{
|
||||||
'uni-fab__content--left': horizontal === 'left',
|
'uni-fab__content--left': horizontal === 'left',
|
||||||
'uni-fab__content--right': horizontal === 'right',
|
'uni-fab__content--right': horizontal === 'right',
|
||||||
@ -34,8 +32,8 @@
|
|||||||
'uni-fab__circle--leftTop': leftTop,
|
'uni-fab__circle--leftTop': leftTop,
|
||||||
'uni-fab__circle--rightTop': rightTop,
|
'uni-fab__circle--rightTop': rightTop,
|
||||||
'uni-fab__content--other-platform': !isAndroidNvue
|
'uni-fab__content--other-platform': !isAndroidNvue
|
||||||
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick">
|
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor }" @click="_onClick">
|
||||||
<uni-icons class="fab-circle-icon" :type="styles.icon" :color="styles.iconColor" size="32"
|
<uni-icons class="fab-circle-icon" type="plusempty" :color="styles.iconColor" size="32"
|
||||||
:class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons>
|
:class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons>
|
||||||
<!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
|
<!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
|
||||||
<view class="fab-circle-h" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> -->
|
<view class="fab-circle-h" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> -->
|
||||||
@ -115,8 +113,7 @@
|
|||||||
selectedColor: '#007AFF',
|
selectedColor: '#007AFF',
|
||||||
backgroundColor: '#fff',
|
backgroundColor: '#fff',
|
||||||
buttonColor: '#007AFF',
|
buttonColor: '#007AFF',
|
||||||
iconColor: '#fff',
|
iconColor: '#fff'
|
||||||
icon: 'plusempty'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -161,16 +158,6 @@
|
|||||||
},
|
},
|
||||||
horizontalRight() {
|
horizontalRight() {
|
||||||
return this.getPosition(2, 'horizontal', 'right')
|
return this.getPosition(2, 'horizontal', 'right')
|
||||||
},
|
|
||||||
// 计算 nvue bottom
|
|
||||||
nvueBottom() {
|
|
||||||
const safeBottom = uni.getSystemInfoSync().windowBottom;
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
return 30 + safeBottom
|
|
||||||
// #endif
|
|
||||||
// #ifndef APP-NVUE
|
|
||||||
return 30
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -207,9 +194,6 @@
|
|||||||
* 按钮点击事件
|
* 按钮点击事件
|
||||||
*/
|
*/
|
||||||
_onItemClick(index, item) {
|
_onItemClick(index, item) {
|
||||||
if (!this.isShow) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.$emit('trigger', {
|
this.$emit('trigger', {
|
||||||
index,
|
index,
|
||||||
item
|
item
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-fab",
|
"id": "uni-fab",
|
||||||
"displayName": "uni-fab 悬浮按钮",
|
"displayName": "uni-fab 悬浮按钮",
|
||||||
"version": "1.2.5",
|
"version": "1.2.2",
|
||||||
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
|
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-scss","uni-icons"],
|
"dependencies": ["uni-scss","uni-icons"],
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
## 1.0.4(2023-03-29)
|
|
||||||
- 修复 手动上传删除一个文件后不能再上传的bug
|
|
||||||
## 1.0.3(2022-12-19)
|
|
||||||
- 新增 sourceType 属性, 可以自定义图片和视频选择的来源
|
|
||||||
## 1.0.2(2022-07-04)
|
## 1.0.2(2022-07-04)
|
||||||
- 修复 在uni-forms下样式不生效的bug
|
- 修复 在uni-forms下样式不生效的bug
|
||||||
## 1.0.1(2021-11-23)
|
## 1.0.1(2021-11-23)
|
||||||
|
@ -7,7 +7,7 @@ function chooseImage(opts) {
|
|||||||
const {
|
const {
|
||||||
count,
|
count,
|
||||||
sizeType = ['original', 'compressed'],
|
sizeType = ['original', 'compressed'],
|
||||||
sourceType,
|
sourceType = ['album', 'camera'],
|
||||||
extension
|
extension
|
||||||
} = opts
|
} = opts
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -33,7 +33,7 @@ function chooseVideo(opts) {
|
|||||||
camera,
|
camera,
|
||||||
compressed,
|
compressed,
|
||||||
maxDuration,
|
maxDuration,
|
||||||
sourceType,
|
sourceType = ['album', 'camera'],
|
||||||
extension
|
extension
|
||||||
} = opts;
|
} = opts;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -185,12 +185,6 @@
|
|||||||
default () {
|
default () {
|
||||||
return ['original', 'compressed']
|
return ['original', 'compressed']
|
||||||
}
|
}
|
||||||
},
|
|
||||||
sourceType: {
|
|
||||||
type: Array,
|
|
||||||
default () {
|
|
||||||
return ['album', 'camera']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -355,7 +349,6 @@
|
|||||||
type: this.fileMediatype,
|
type: this.fileMediatype,
|
||||||
compressed: false,
|
compressed: false,
|
||||||
sizeType: this.sizeType,
|
sizeType: this.sizeType,
|
||||||
sourceType: this.sourceType,
|
|
||||||
// TODO 如果为空,video 有问题
|
// TODO 如果为空,video 有问题
|
||||||
extension: _extname.length > 0 ? _extname : undefined,
|
extension: _extname.length > 0 ? _extname : undefined,
|
||||||
count: this.limitLength - this.files.length, //默认9
|
count: this.limitLength - this.files.length, //默认9
|
||||||
@ -583,11 +576,7 @@
|
|||||||
path: v.path,
|
path: v.path,
|
||||||
size: v.size,
|
size: v.size,
|
||||||
fileID:v.fileID,
|
fileID:v.fileID,
|
||||||
url: v.url,
|
url: v.url
|
||||||
// 修改删除一个文件后不能再上传的bug, #694
|
|
||||||
uuid: v.uuid,
|
|
||||||
status: v.status,
|
|
||||||
cloudPath: v.cloudPath
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return newFilesData
|
return newFilesData
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-file-picker",
|
"id": "uni-file-picker",
|
||||||
"displayName": "uni-file-picker 文件选择上传",
|
"displayName": "uni-file-picker 文件选择上传",
|
||||||
"version": "1.0.4",
|
"version": "1.0.2",
|
||||||
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
|
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -16,7 +16,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -33,8 +37,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-scss"],
|
"dependencies": ["uni-scss"],
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
## 1.4.9(2023-02-10)
|
|
||||||
- 修复 required 参数无法动态绑定
|
|
||||||
## 1.4.8(2022-08-23)
|
|
||||||
- 优化 根据 rules 自动添加 required 的问题
|
|
||||||
## 1.4.7(2022-08-22)
|
|
||||||
- 修复 item 未设置 require 属性,rules 设置 require 后,星号也显示的 bug,详见:[https://ask.dcloud.net.cn/question/151540](https://ask.dcloud.net.cn/question/151540)
|
|
||||||
## 1.4.6(2022-07-13)
|
## 1.4.6(2022-07-13)
|
||||||
- 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug
|
- 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug
|
||||||
## 1.4.5(2022-07-05)
|
## 1.4.5(2022-07-05)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
<view class="uni-forms-item"
|
<view class="uni-forms-item"
|
||||||
:class="['is-direction-' + localLabelPos ,border?'uni-forms-item--border':'' ,border && isFirstBorder?'is-first-border':'']">
|
:class="['is-direction-' + localLabelPos ,border?'uni-forms-item--border':'' ,border && isFirstBorder?'is-first-border':'']">
|
||||||
<slot name="label">
|
<slot name="label">
|
||||||
<view class="uni-forms-item__label" :class="{'no-label':!label && !required}"
|
<view class="uni-forms-item__label" :class="{'no-label':!label && !isRequired}"
|
||||||
:style="{width:localLabelWidth,justifyContent: localLabelAlign}">
|
:style="{width:localLabelWidth,justifyContent: localLabelAlign}">
|
||||||
<text v-if="required" class="is-required">*</text>
|
<text v-if="isRequired" class="is-required">*</text>
|
||||||
<text>{{label}}</text>
|
<text>{{label}}</text>
|
||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
@ -126,6 +126,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
errMsg: '',
|
errMsg: '',
|
||||||
|
isRequired: false,
|
||||||
userRules: null,
|
userRules: null,
|
||||||
localLabelAlign: 'left',
|
localLabelAlign: 'left',
|
||||||
localLabelWidth: '65px',
|
localLabelWidth: '65px',
|
||||||
@ -314,6 +315,7 @@
|
|||||||
this.localLabelWidth = this._labelWidthUnit(labelWidth)
|
this.localLabelWidth = this._labelWidthUnit(labelWidth)
|
||||||
// 标签位置
|
// 标签位置
|
||||||
this.localLabelPos = this._labelPosition()
|
this.localLabelPos = this._labelPosition()
|
||||||
|
this.isRequired = this.required
|
||||||
// 将需要校验的子组件加入form 队列
|
// 将需要校验的子组件加入form 队列
|
||||||
this.form && type && childrens.push(this)
|
this.form && type && childrens.push(this)
|
||||||
|
|
||||||
@ -349,6 +351,8 @@
|
|||||||
this.validator = validator
|
this.validator = validator
|
||||||
// 默认值赋予
|
// 默认值赋予
|
||||||
this.itemSetValue(_getDataValue(this.name, localData))
|
this.itemSetValue(_getDataValue(this.name, localData))
|
||||||
|
this.isRequired = this._isRequired()
|
||||||
|
|
||||||
},
|
},
|
||||||
unInit() {
|
unInit() {
|
||||||
if (this.form) {
|
if (this.form) {
|
||||||
@ -383,13 +387,9 @@
|
|||||||
|
|
||||||
// 是否显示星号
|
// 是否显示星号
|
||||||
_isRequired() {
|
_isRequired() {
|
||||||
// TODO 不根据规则显示 星号,考虑后续兼容
|
if (this.form) {
|
||||||
// if (this.form) {
|
return this.required || this.form._isRequiredField(this.itemRules.rules || [])
|
||||||
// if (this.form._isRequiredField(this.itemRules.rules || []) && this.required) {
|
}
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
return this.required
|
return this.required
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-forms",
|
"id": "uni-forms",
|
||||||
"displayName": "uni-forms 表单",
|
"displayName": "uni-forms 表单",
|
||||||
"version": "1.4.9",
|
"version": "1.4.6",
|
||||||
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
|
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -1,29 +1,3 @@
|
|||||||
## 1.2.14(2023-04-14)
|
|
||||||
- 优化 uni-list-chat 具名插槽`header` 非app端套一层元素,方便使用时通过外层元素定位实现样式修改
|
|
||||||
## 1.2.13(2023-03-03)
|
|
||||||
- uni-list-chat 新增 支持具名插槽`header`
|
|
||||||
## 1.2.12(2023-02-01)
|
|
||||||
- 新增 列表图标新增 customPrefix 属性 ,用法 [详见](https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html#icons-props)
|
|
||||||
## 1.2.11(2023-01-31)
|
|
||||||
- 修复 无反馈效果呈现的bug
|
|
||||||
## 1.2.9(2022-11-22)
|
|
||||||
- 修复 uni-list-chat 在vue3下跳转报错的bug
|
|
||||||
## 1.2.8(2022-11-21)
|
|
||||||
- 修复 uni-list-chat avatar属性 值为本地路径时错误的问题
|
|
||||||
## 1.2.7(2022-11-21)
|
|
||||||
- 修复 uni-list-chat avatar属性 在腾讯云版uniCloud下错误的问题
|
|
||||||
## 1.2.6(2022-11-18)
|
|
||||||
- 修复 uni-list-chat note属性 支持:“草稿”字样功能 文本少1位的问题
|
|
||||||
## 1.2.5(2022-11-15)
|
|
||||||
- 修复 uni-list-item 的 customStyle 属性 padding值在 H5端 无效的bug
|
|
||||||
## 1.2.4(2022-11-15)
|
|
||||||
- 修复 uni-list-item 的 customStyle 属性 padding值在nvue(vue2)下无效的bug
|
|
||||||
## 1.2.3(2022-11-14)
|
|
||||||
- uni-list-chat 新增 avatar 支持 fileId
|
|
||||||
## 1.2.2(2022-11-11)
|
|
||||||
- uni-list 新增属性 render-reverse 详情参考:[https://uniapp.dcloud.net.cn/component/list.html](https://uniapp.dcloud.net.cn/component/list.html)
|
|
||||||
- uni-list-chat note属性 支持:“草稿”字样 加红显示 详情参考uni-im:[https://ext.dcloud.net.cn/plugin?name=uni-im](https://ext.dcloud.net.cn/plugin?name=uni-im)
|
|
||||||
- uni-list-item 新增属性 customStyle 支持设置padding、backgroundColor
|
|
||||||
## 1.2.1(2022-03-30)
|
## 1.2.1(2022-03-30)
|
||||||
- 删除无用文件
|
- 删除无用文件
|
||||||
## 1.2.0(2021-11-23)
|
## 1.2.0(2021-11-23)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<view class="uni-list-chat__container">
|
<view class="uni-list-chat__container">
|
||||||
<view class="uni-list-chat__header-warp">
|
<view class="uni-list-chat__header-warp">
|
||||||
<view v-if="avatarCircle || avatarList.length === 0" class="uni-list-chat__header" :class="{ 'header--circle': avatarCircle }">
|
<view v-if="avatarCircle || avatarList.length === 0" class="uni-list-chat__header" :class="{ 'header--circle': avatarCircle }">
|
||||||
<image class="uni-list-chat__header-image" :class="{ 'header--circle': avatarCircle }" :src="avatarUrl" mode="aspectFill"></image>
|
<image class="uni-list-chat__header-image" :class="{ 'header--circle': avatarCircle }" :src="avatar" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<!-- 头像组 -->
|
<!-- 头像组 -->
|
||||||
<view v-else class="uni-list-chat__header">
|
<view v-else class="uni-list-chat__header">
|
||||||
@ -18,23 +18,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifndef APP -->
|
|
||||||
<view class="slot-header">
|
|
||||||
<!-- #endif -->
|
|
||||||
<slot name="header"></slot>
|
|
||||||
<!-- #ifndef APP -->
|
|
||||||
</view>
|
|
||||||
<!-- #endif -->
|
|
||||||
<view v-if="badgeText && badgePositon === 'left'" class="uni-list-chat__badge uni-list-chat__badge-pos" :class="[isSingle]">
|
<view v-if="badgeText && badgePositon === 'left'" class="uni-list-chat__badge uni-list-chat__badge-pos" :class="[isSingle]">
|
||||||
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
|
<text class="uni-list-chat__badge-text">{{ badgeText === 'dot' ? '' : badgeText }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-list-chat__content">
|
<view class="uni-list-chat__content">
|
||||||
<view class="uni-list-chat__content-main">
|
<view class="uni-list-chat__content-main">
|
||||||
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
|
<text class="uni-list-chat__content-title uni-ellipsis">{{ title }}</text>
|
||||||
<view style="flex-direction: row;">
|
<text class="uni-list-chat__content-note uni-ellipsis">{{ note }}</text>
|
||||||
<text class="draft" v-if="isDraft">[草稿]</text>
|
|
||||||
<text class="uni-list-chat__content-note uni-ellipsis">{{isDraft?note.slice(14):note}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-list-chat__content-extra">
|
<view class="uni-list-chat__content-extra">
|
||||||
<slot>
|
<slot>
|
||||||
@ -131,9 +121,6 @@
|
|||||||
},
|
},
|
||||||
// inject: ['list'],
|
// inject: ['list'],
|
||||||
computed: {
|
computed: {
|
||||||
isDraft(){
|
|
||||||
return this.note.slice(0,14) == '[uni-im-draft]'
|
|
||||||
},
|
|
||||||
isSingle() {
|
isSingle() {
|
||||||
if (this.badgeText === 'dot') {
|
if (this.badgeText === 'dot') {
|
||||||
return 'uni-badge--dot';
|
return 'uni-badge--dot';
|
||||||
@ -159,32 +146,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
avatar:{
|
|
||||||
handler(avatar) {
|
|
||||||
if(avatar.substr(0,8) == 'cloud://'){
|
|
||||||
uniCloud.getTempFileURL({
|
|
||||||
fileList: [avatar]
|
|
||||||
}).then(res=>{
|
|
||||||
// console.log(res);
|
|
||||||
// 兼容uniCloud私有化部署
|
|
||||||
let fileList = res.fileList || res.result.fileList
|
|
||||||
this.avatarUrl = fileList[0].tempFileURL
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.avatarUrl = avatar
|
|
||||||
}
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isFirstChild: false,
|
isFirstChild: false,
|
||||||
border: true,
|
border: true,
|
||||||
// avatarList: 3,
|
// avatarList: 3,
|
||||||
imageWidth: 50,
|
imageWidth: 50
|
||||||
avatarUrl:''
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -231,7 +198,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
pageApi(api) {
|
pageApi(api) {
|
||||||
let callback = {
|
uni[api]({
|
||||||
url: this.to,
|
url: this.to,
|
||||||
success: res => {
|
success: res => {
|
||||||
this.$emit('click', {
|
this.$emit('click', {
|
||||||
@ -242,24 +209,9 @@
|
|||||||
this.$emit('click', {
|
this.$emit('click', {
|
||||||
data: err
|
data: err
|
||||||
});
|
});
|
||||||
|
console.error(err.errMsg);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
switch (api) {
|
|
||||||
case 'navigateTo':
|
|
||||||
uni.navigateTo(callback)
|
|
||||||
break
|
|
||||||
case 'redirectTo':
|
|
||||||
uni.redirectTo(callback)
|
|
||||||
break
|
|
||||||
case 'reLaunch':
|
|
||||||
uni.reLaunch(callback)
|
|
||||||
break
|
|
||||||
case 'switchTab':
|
|
||||||
uni.switchTab(callback)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
uni.navigateTo(callback)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -493,20 +445,13 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.draft ,.uni-list-chat__content-note {
|
.uni-list-chat__content-note {
|
||||||
margin-top: 3px;
|
margin-top: 3px;
|
||||||
color: $note-color;
|
color: $note-color;
|
||||||
font-size: $note-size;
|
font-size: $note-size;
|
||||||
font-weight: $title-weight;
|
font-weight: $title-weight;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.draft{
|
|
||||||
color: #eb3a41;
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
flex-shrink: 0;
|
|
||||||
/* #endif */
|
|
||||||
padding-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-list-chat__content-extra {
|
.uni-list-chat__content-extra {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- #ifdef APP-NVUE -->
|
<!-- #ifdef APP-NVUE -->
|
||||||
<cell :keep-scroll-position="keepScrollPosition">
|
<cell>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<view :class="{ 'uni-list-item--disabled': disabled }" :style="{'background-color':customStyle.backgroundColor}"
|
|
||||||
|
<view :class="{ 'uni-list-item--disabled': disabled }"
|
||||||
:hover-class="(!clickable && !link) || disabled || showSwitch ? '' : 'uni-list-item--hover'"
|
:hover-class="(!clickable && !link) || disabled || showSwitch ? '' : 'uni-list-item--hover'"
|
||||||
class="uni-list-item" @click="onClick">
|
class="uni-list-item" @click="onClick">
|
||||||
<view v-if="!isFirstChild" class="border--left" :class="{ 'uni-list--border': border }"></view>
|
<view v-if="!isFirstChild" class="border--left" :class="{ 'uni-list--border': border }"></view>
|
||||||
<view class="uni-list-item__container"
|
<view class="uni-list-item__container"
|
||||||
:class="{ 'container--right': showArrow || link, 'flex--direction': direction === 'column'}"
|
:class="{ 'container--right': showArrow || link, 'flex--direction': direction === 'column' }">
|
||||||
:style="{paddingTop:padding.top,paddingLeft:padding.left,paddingRight:padding.right,paddingBottom:padding.bottom}">
|
|
||||||
<slot name="header">
|
<slot name="header">
|
||||||
<view class="uni-list-item__header">
|
<view class="uni-list-item__header">
|
||||||
<view v-if="thumb" class="uni-list-item__icon">
|
<view v-if="thumb" class="uni-list-item__icon">
|
||||||
<image :src="thumb" class="uni-list-item__icon-img" :class="['uni-list--' + thumbSize]" />
|
<image :src="thumb" class="uni-list-item__icon-img" :class="['uni-list--' + thumbSize]" />
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="showExtraIcon" class="uni-list-item__icon">
|
<view v-else-if="showExtraIcon" class="uni-list-item__icon">
|
||||||
<uni-icons :customPrefix="extraIcon.customPrefix" :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" />
|
<uni-icons :color="extraIcon.color" :size="extraIcon.size" :type="extraIcon.type" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
@ -96,7 +96,7 @@
|
|||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
ellipsis: {
|
ellipsis: {
|
||||||
type: [Number, String],
|
type: [Number,String],
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
@ -139,7 +139,7 @@
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'success'
|
default: 'success'
|
||||||
},
|
},
|
||||||
badgeStyle: {
|
badgeStyle:{
|
||||||
type: Object,
|
type: Object,
|
||||||
default () {
|
default () {
|
||||||
return {}
|
return {}
|
||||||
@ -167,75 +167,19 @@
|
|||||||
return {
|
return {
|
||||||
type: '',
|
type: '',
|
||||||
color: '#000000',
|
color: '#000000',
|
||||||
size: 20,
|
size: 20
|
||||||
customPrefix: ''
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
border: {
|
border: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
|
||||||
customStyle: {
|
|
||||||
type: Object,
|
|
||||||
default () {
|
|
||||||
return {
|
|
||||||
padding: '',
|
|
||||||
backgroundColor: '#FFFFFF'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
keepScrollPosition: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
'customStyle.padding': {
|
|
||||||
handler(padding) {
|
|
||||||
if(typeof padding == 'number'){
|
|
||||||
padding += ''
|
|
||||||
}
|
|
||||||
let paddingArr = padding.split(' ')
|
|
||||||
if (paddingArr.length === 1) {
|
|
||||||
const allPadding = paddingArr[0]
|
|
||||||
this.padding = {
|
|
||||||
"top": allPadding,
|
|
||||||
"right": allPadding,
|
|
||||||
"bottom": allPadding,
|
|
||||||
"left": allPadding
|
|
||||||
}
|
|
||||||
} else if (paddingArr.length === 2) {
|
|
||||||
const [verticalPadding, horizontalPadding] = paddingArr;
|
|
||||||
this.padding = {
|
|
||||||
"top": verticalPadding,
|
|
||||||
"right": horizontalPadding,
|
|
||||||
"bottom": verticalPadding,
|
|
||||||
"left": horizontalPadding
|
|
||||||
}
|
|
||||||
} else if (paddingArr.length === 4) {
|
|
||||||
const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr;
|
|
||||||
this.padding = {
|
|
||||||
"top": topPadding,
|
|
||||||
"right": rightPadding,
|
|
||||||
"bottom": bottomPadding,
|
|
||||||
"left": leftPadding
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// inject: ['list'],
|
// inject: ['list'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isFirstChild: false,
|
isFirstChild: false
|
||||||
padding: {
|
|
||||||
top: "",
|
|
||||||
right: "",
|
|
||||||
bottom: "",
|
|
||||||
left: ""
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -311,7 +255,7 @@
|
|||||||
uni.switchTab(callback)
|
uni.switchTab(callback)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
uni.navigateTo(callback)
|
uni.navigateTo(callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +275,6 @@
|
|||||||
$uni-bg-color-hover:#f1f1f1;
|
$uni-bg-color-hover:#f1f1f1;
|
||||||
$uni-text-color-grey:#999;
|
$uni-text-color-grey:#999;
|
||||||
$list-item-pd: $uni-spacing-col-lg $uni-spacing-row-lg;
|
$list-item-pd: $uni-spacing-col-lg $uni-spacing-row-lg;
|
||||||
|
|
||||||
.uni-list-item {
|
.uni-list-item {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -346,15 +289,12 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item--disabled {
|
.uni-list-item--disabled {
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item--hover {
|
.uni-list-item--hover {
|
||||||
background-color: $uni-bg-color-hover !important;
|
background-color: $uni-bg-color-hover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__container {
|
.uni-list-item__container {
|
||||||
position: relative;
|
position: relative;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -367,11 +307,9 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
// align-items: center;
|
// align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container--right {
|
.container--right {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .border--left {
|
// .border--left {
|
||||||
// margin-left: $uni-spacing-row-lg;
|
// margin-left: $uni-spacing-row-lg;
|
||||||
// }
|
// }
|
||||||
@ -386,7 +324,6 @@
|
|||||||
border-top-width: 0.5px;
|
border-top-width: 0.5px;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
.uni-list--border:after {
|
.uni-list--border:after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -399,7 +336,6 @@
|
|||||||
transform: scaleY(0.5);
|
transform: scaleY(0.5);
|
||||||
background-color: $uni-border-color;
|
background-color: $uni-border-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
.uni-list-item__content {
|
.uni-list-item__content {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -413,24 +349,20 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__content--center {
|
.uni-list-item__content--center {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__content-title {
|
.uni-list-item__content-title {
|
||||||
font-size: $uni-font-size-base;
|
font-size: $uni-font-size-base;
|
||||||
color: #3b4144;
|
color: #3b4144;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__content-note {
|
.uni-list-item__content-note {
|
||||||
margin-top: 6rpx;
|
margin-top: 6rpx;
|
||||||
color: $uni-text-color-grey;
|
color: $uni-text-color-grey;
|
||||||
font-size: $uni-font-size-sm;
|
font-size: $uni-font-size-sm;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__extra {
|
.uni-list-item__extra {
|
||||||
// width: 25%;
|
// width: 25%;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@ -440,7 +372,6 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__header {
|
.uni-list-item__header {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -448,14 +379,12 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__icon {
|
.uni-list-item__icon {
|
||||||
margin-right: 18rpx;
|
margin-right: 18rpx;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__icon-img {
|
.uni-list-item__icon-img {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: block;
|
display: block;
|
||||||
@ -464,7 +393,6 @@
|
|||||||
width: $uni-img-size-base;
|
width: $uni-img-size-base;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-icon-wrapper {
|
.uni-icon-wrapper {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -472,40 +400,33 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex--direction {
|
.flex--direction {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
align-items: initial;
|
align-items: initial;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex--justify {
|
.flex--justify {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
justify-content: initial;
|
justify-content: initial;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list--lg {
|
.uni-list--lg {
|
||||||
height: $uni-img-size-lg;
|
height: $uni-img-size-lg;
|
||||||
width: $uni-img-size-lg;
|
width: $uni-img-size-lg;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list--base {
|
.uni-list--base {
|
||||||
height: $uni-img-size-base;
|
height: $uni-img-size-base;
|
||||||
width: $uni-img-size-base;
|
width: $uni-img-size-base;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list--sm {
|
.uni-list--sm {
|
||||||
height: $uni-img-size-sm;
|
height: $uni-img-size-sm;
|
||||||
width: $uni-img-size-sm;
|
width: $uni-img-size-sm;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-list-item__extra-text {
|
.uni-list-item__extra-text {
|
||||||
color: $uni-text-color-grey;
|
color: $uni-text-color-grey;
|
||||||
font-size: $uni-font-size-sm;
|
font-size: $uni-font-size-sm;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-ellipsis-1 {
|
.uni-ellipsis-1 {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -514,10 +435,9 @@
|
|||||||
/* #endif */
|
/* #endif */
|
||||||
/* #ifdef APP-NVUE */
|
/* #ifdef APP-NVUE */
|
||||||
lines: 1;
|
lines: 1;
|
||||||
text-overflow: ellipsis;
|
text-overflow:ellipsis;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-ellipsis-2 {
|
.uni-ellipsis-2 {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -528,7 +448,7 @@
|
|||||||
/* #endif */
|
/* #endif */
|
||||||
/* #ifdef APP-NVUE */
|
/* #ifdef APP-NVUE */
|
||||||
lines: 2;
|
lines: 2;
|
||||||
text-overflow: ellipsis;
|
text-overflow:ellipsis;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -7,117 +7,102 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifdef APP-NVUE -->
|
<!-- #ifdef APP-NVUE -->
|
||||||
<list :bounce="false" :scrollable="true" show-scrollbar :render-reverse="renderReverse" @scroll="scroll" class="uni-list" :class="{ 'uni-list--border': border }" :enableBackToTop="enableBackToTop"
|
<list class="uni-list" :class="{ 'uni-list--border': border }" :enableBackToTop="enableBackToTop" loadmoreoffset="15"><slot /></list>
|
||||||
loadmoreoffset="15">
|
|
||||||
<slot />
|
|
||||||
</list>
|
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**
|
/**
|
||||||
* List 列表
|
* List 列表
|
||||||
* @description 列表组件
|
* @description 列表组件
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=24
|
||||||
* @property {String} border = [true|false] 标题
|
* @property {String} border = [true|false] 标题
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
name: 'uniList',
|
name: 'uniList',
|
||||||
'mp-weixin': {
|
'mp-weixin': {
|
||||||
options: {
|
options: {
|
||||||
multipleSlots: false
|
multipleSlots: false
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
stackFromEnd:{
|
|
||||||
type: Boolean,
|
|
||||||
default:false
|
|
||||||
},
|
|
||||||
enableBackToTop: {
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
scrollY: {
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
border: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
renderReverse:{
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// provide() {
|
|
||||||
// return {
|
|
||||||
// list: this
|
|
||||||
// };
|
|
||||||
// },
|
|
||||||
created() {
|
|
||||||
this.firstChildAppend = false;
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
loadMore(e) {
|
|
||||||
this.$emit('scrolltolower');
|
|
||||||
},
|
|
||||||
scroll(e) {
|
|
||||||
this.$emit('scroll', e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
props: {
|
||||||
|
enableBackToTop: {
|
||||||
|
type: [Boolean, String],
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
scrollY: {
|
||||||
|
type: [Boolean, String],
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
border: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// provide() {
|
||||||
|
// return {
|
||||||
|
// list: this
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
created() {
|
||||||
|
this.firstChildAppend = false;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadMore(e) {
|
||||||
|
this.$emit('scrolltolower');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss" >
|
||||||
$uni-bg-color:#ffffff;
|
$uni-bg-color:#ffffff;
|
||||||
$uni-border-color:#e5e5e5;
|
$uni-border-color:#e5e5e5;
|
||||||
|
.uni-list {
|
||||||
.uni-list {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
display: flex;
|
|
||||||
/* #endif */
|
|
||||||
background-color: $uni-bg-color;
|
|
||||||
position: relative;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-list--border {
|
|
||||||
position: relative;
|
|
||||||
/* #ifdef APP-NVUE */
|
|
||||||
border-top-color: $uni-border-color;
|
|
||||||
border-top-style: solid;
|
|
||||||
border-top-width: 0.5px;
|
|
||||||
border-bottom-color: $uni-border-color;
|
|
||||||
border-bottom-style: solid;
|
|
||||||
border-bottom-width: 0.5px;
|
|
||||||
/* #endif */
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
.uni-list--border-top {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 1px;
|
|
||||||
-webkit-transform: scaleY(0.5);
|
|
||||||
transform: scaleY(0.5);
|
|
||||||
background-color: $uni-border-color;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-list--border-bottom {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 1px;
|
|
||||||
-webkit-transform: scaleY(0.5);
|
|
||||||
transform: scaleY(0.5);
|
|
||||||
background-color: $uni-border-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
background-color: $uni-bg-color;
|
||||||
|
position: relative;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-list--border {
|
||||||
|
position: relative;
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
border-top-color: $uni-border-color;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-width: 0.5px;
|
||||||
|
border-bottom-color: $uni-border-color;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
border-bottom-width: 0.5px;
|
||||||
|
/* #endif */
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
|
||||||
|
.uni-list--border-top {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 1px;
|
||||||
|
-webkit-transform: scaleY(0.5);
|
||||||
|
transform: scaleY(0.5);
|
||||||
|
background-color: $uni-border-color;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-list--border-bottom {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 1px;
|
||||||
|
-webkit-transform: scaleY(0.5);
|
||||||
|
transform: scaleY(0.5);
|
||||||
|
background-color: $uni-border-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-list",
|
"id": "uni-list",
|
||||||
"displayName": "uni-list 列表",
|
"displayName": "uni-list 列表",
|
||||||
"version": "1.2.14",
|
"version": "1.2.1",
|
||||||
"description": "List 组件 ,帮助使用者快速构建列表。",
|
"description": "List 组件 ,帮助使用者快速构建列表。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"",
|
"",
|
||||||
@ -18,7 +18,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -35,8 +39,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
## 1.3.11(2023-03-29)
|
|
||||||
- 修复 自定义状态栏高度闪动BUG
|
|
||||||
## 1.3.10(2023-03-29)
|
|
||||||
- 修复 暗黑模式下边线颜色错误的bug
|
|
||||||
## 1.3.9(2022-10-13)
|
|
||||||
- 修复 条件编译错误的bug
|
|
||||||
## 1.3.8(2022-10-12)
|
|
||||||
- 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug
|
|
||||||
## 1.3.7(2022-08-11)
|
|
||||||
- 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug
|
|
||||||
## 1.3.6(2022-06-30)
|
## 1.3.6(2022-06-30)
|
||||||
- 修复 组件示例中插槽用法无法显示内容的bug
|
- 修复 组件示例中插槽用法无法显示内容的bug
|
||||||
## 1.3.5(2022-05-24)
|
## 1.3.5(2022-05-24)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
|
<view class="uni-navbar" :class="{'uni-dark':dark}">
|
||||||
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
<view :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||||
:style="{ 'background-color': themeBgColor, 'border-bottom-color':themeColor }" >
|
:style="{ 'background-color': themeBgColor }" class="uni-navbar__content">
|
||||||
<status-bar v-if="statusBar" />
|
<status-bar v-if="statusBar" />
|
||||||
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
|
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
|
||||||
class="uni-navbar__header">
|
class="uni-navbar__header">
|
||||||
@ -38,12 +38,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifndef APP-NVUE -->
|
|
||||||
<view class="uni-navbar__placeholder" v-if="fixed">
|
<view class="uni-navbar__placeholder" v-if="fixed">
|
||||||
<status-bar v-if="statusBar" />
|
<status-bar v-if="statusBar" />
|
||||||
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -52,8 +50,6 @@
|
|||||||
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* NavBar 自定义导航栏
|
* NavBar 自定义导航栏
|
||||||
* @description 导航栏组件,主要用于头部导航
|
* @description 导航栏组件,主要用于头部导航
|
||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
||||||
@ -200,11 +196,6 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$nav-height: 44px;
|
$nav-height: 44px;
|
||||||
|
|
||||||
.uni-nvue-fixed {
|
|
||||||
/* #ifdef APP-NVUE */
|
|
||||||
position: sticky;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
.uni-navbar {
|
.uni-navbar {
|
||||||
// box-sizing: border-box;
|
// box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,11 @@
|
|||||||
name: 'UniStatusBar',
|
name: 'UniStatusBar',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px'
|
statusBarHeight: 20
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-nav-bar",
|
"id": "uni-nav-bar",
|
||||||
"displayName": "uni-nav-bar 自定义导航栏",
|
"displayName": "uni-nav-bar 自定义导航栏",
|
||||||
"version": "1.3.11",
|
"version": "1.3.6",
|
||||||
"description": "自定义导航栏组件,主要用于头部导航。",
|
"description": "自定义导航栏组件,主要用于头部导航。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -16,7 +16,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -33,8 +37,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
## 1.2.1(2022-09-05)
|
|
||||||
- 新增 属性 fontSize,可修改文字大小。
|
|
||||||
## 1.2.0(2021-11-19)
|
## 1.2.0(2021-11-19)
|
||||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-notice-bar](https://uniapp.dcloud.io/component/uniui/uni-notice-bar)
|
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-notice-bar](https://uniapp.dcloud.io/component/uniui/uni-notice-bar)
|
||||||
|
@ -1,47 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="show" class="uni-noticebar" :style="{ backgroundColor }" @click="onClick">
|
<view v-if="show" class="uni-noticebar" :style="{ backgroundColor: backgroundColor }" @click="onClick">
|
||||||
<uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound"
|
<uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound"
|
||||||
:color="color" :size="fontSize * 1.5" />
|
:color="color" size="22" />
|
||||||
<view ref="textBox" class="uni-noticebar__content-wrapper"
|
<view ref="textBox" class="uni-noticebar__content-wrapper"
|
||||||
:class="{
|
:class="{'uni-noticebar__content-wrapper--scrollable':scrollable, 'uni-noticebar__content-wrapper--single':!scrollable && (single || moreText)}">
|
||||||
'uni-noticebar__content-wrapper--scrollable': scrollable,
|
|
||||||
'uni-noticebar__content-wrapper--single': !scrollable && (single || moreText)
|
|
||||||
}"
|
|
||||||
:style="{ height: scrollable ? fontSize * 1.5 + 'px' : 'auto' }"
|
|
||||||
>
|
|
||||||
<view :id="elIdBox" class="uni-noticebar__content"
|
<view :id="elIdBox" class="uni-noticebar__content"
|
||||||
:class="{
|
:class="{'uni-noticebar__content--scrollable':scrollable, 'uni-noticebar__content--single':!scrollable && (single || moreText)}">
|
||||||
'uni-noticebar__content--scrollable': scrollable,
|
|
||||||
'uni-noticebar__content--single': !scrollable && (single || moreText)
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<text :id="elId" ref="animationEle" class="uni-noticebar__content-text"
|
<text :id="elId" ref="animationEle" class="uni-noticebar__content-text"
|
||||||
:class="{
|
:class="{'uni-noticebar__content-text--scrollable':scrollable,'uni-noticebar__content-text--single':!scrollable && (single || showGetMore)}"
|
||||||
'uni-noticebar__content-text--scrollable': scrollable,
|
:style="{color:color, width:wrapWidth+'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration ,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}">{{text}}</text>
|
||||||
'uni-noticebar__content-text--single': !scrollable && (single || showGetMore)
|
|
||||||
}"
|
|
||||||
:style="{
|
|
||||||
color: color,
|
|
||||||
fontSize: fontSize + 'px',
|
|
||||||
lineHeight: fontSize * 1.5 + 'px',
|
|
||||||
width: wrapWidth + 'px',
|
|
||||||
'animationDuration': animationDuration,
|
|
||||||
'-webkit-animationDuration': animationDuration,
|
|
||||||
animationPlayState: webviewHide ? 'paused' : animationPlayState,
|
|
||||||
'-webkit-animationPlayState': webviewHide ? 'paused' : animationPlayState,
|
|
||||||
animationDelay: animationDelay,
|
|
||||||
'-webkit-animationDelay': animationDelay
|
|
||||||
}"
|
|
||||||
>{{text}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isShowGetMore" class="uni-noticebar__more uni-cursor-point"
|
<view v-if="showGetMore === true || showGetMore === 'true'" class="uni-noticebar__more uni-cursor-point"
|
||||||
@click="clickMore">
|
@click="clickMore">
|
||||||
<text v-if="moreText.length > 0" :style="{ color: moreColor, fontSize: fontSize + 'px' }">{{ moreText }}</text>
|
<text v-if="moreText.length > 0" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}</text>
|
||||||
<uni-icons v-else type="right" :color="moreColor" :size="fontSize * 1.1" />
|
<uni-icons v-else type="right" :color="moreColor" size="16" />
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-noticebar-close uni-cursor-point" v-if="isShowClose">
|
<view class="uni-noticebar-close uni-cursor-point" v-if="(showClose === true || showClose === 'true') && (showGetMore === false || showGetMore === 'false')">
|
||||||
<uni-icons type="closeempty" :color="color" :size="fontSize * 1.1" @click="close" />
|
<uni-icons
|
||||||
|
type="closeempty" :color="color" size="16" @click="close" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -97,10 +74,6 @@
|
|||||||
type: String,
|
type: String,
|
||||||
default: '#FF9A43'
|
default: '#FF9A43'
|
||||||
},
|
},
|
||||||
fontSize: {
|
|
||||||
type: Number,
|
|
||||||
default: 14
|
|
||||||
},
|
|
||||||
moreColor: {
|
moreColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#FF9A43'
|
default: '#FF9A43'
|
||||||
@ -150,15 +123,6 @@
|
|||||||
animationDelay: '0s'
|
animationDelay: '0s'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
isShowGetMore() {
|
|
||||||
return this.showGetMore === true || this.showGetMore === 'true'
|
|
||||||
},
|
|
||||||
isShowClose() {
|
|
||||||
return (this.showClose === true || this.showClose === 'true')
|
|
||||||
&& (this.showGetMore === false || this.showGetMore === 'false')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
var pages = getCurrentPages();
|
var pages = getCurrentPages();
|
||||||
@ -298,7 +262,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" >
|
||||||
.uni-noticebar {
|
.uni-noticebar {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -346,6 +310,7 @@
|
|||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
.uni-noticebar__content-wrapper--scrollable {
|
.uni-noticebar__content-wrapper--scrollable {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
@ -418,6 +383,10 @@
|
|||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uni-noticebar__more-text {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes notice {
|
@keyframes notice {
|
||||||
100% {
|
100% {
|
||||||
transform: translate3d(-100%, 0, 0);
|
transform: translate3d(-100%, 0, 0);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-notice-bar",
|
"id": "uni-notice-bar",
|
||||||
"displayName": "uni-notice-bar 通告栏",
|
"displayName": "uni-notice-bar 通告栏",
|
||||||
"version": "1.2.1",
|
"version": "1.2.0",
|
||||||
"description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告",
|
"description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,7 +17,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
## 1.2.4(2022-09-19)
|
|
||||||
- 修复,未对主题色设置默认色,导致未引入 uni-scss 变量文件报错。
|
|
||||||
- 修复,未对移动端当前页文字做主题色适配。
|
|
||||||
## 1.2.3(2022-09-15)
|
|
||||||
- 修复未使用 uni-scss 主题色的 bug。
|
|
||||||
## 1.2.2(2022-07-06)
|
|
||||||
- 修复 es 语言 i18n 错误
|
|
||||||
## 1.2.1(2021-11-22)
|
## 1.2.1(2021-11-22)
|
||||||
- 修复 vue3中某些scss变量无法找到的问题
|
- 修复 vue3中某些scss变量无法找到的问题
|
||||||
## 1.2.0(2021-11-19)
|
## 1.2.0(2021-11-19)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"uni-pagination.prevText": "prev",
|
"uni-pagination.prevText": "prev",
|
||||||
"uni-pagination.nextText": "next",
|
"uni-pagination.nextText": "next"
|
||||||
"uni-pagination.piecePerPage": "piece/page"
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"uni-pagination.prevText": "anterior",
|
"uni-pagination.prevText": "anterior",
|
||||||
"uni-pagination.nextText": "prxima",
|
"uni-pagination.nextText": "próxima"
|
||||||
"uni-pagination.piecePerPage": "Art¨ªculo/P¨¢gina"
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"uni-pagination.prevText": "précédente",
|
"uni-pagination.prevText": "précédente",
|
||||||
"uni-pagination.nextText": "suivante",
|
"uni-pagination.nextText": "suivante"
|
||||||
"uni-pagination.piecePerPage": "Articles/Pages"
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"uni-pagination.prevText": "上一页",
|
"uni-pagination.prevText": "上一页",
|
||||||
"uni-pagination.nextText": "下一页",
|
"uni-pagination.nextText": "下一页"
|
||||||
"uni-pagination.piecePerPage": "条/页"
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"uni-pagination.prevText": "上一頁",
|
"uni-pagination.prevText": "上一頁",
|
||||||
"uni-pagination.nextText": "下一頁",
|
"uni-pagination.nextText": "下一頁"
|
||||||
"uni-pagination.piecePerPage": "條/頁"
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="uni-pagination">
|
<view class="uni-pagination">
|
||||||
<!-- #ifndef MP -->
|
|
||||||
<picker v-if="showPageSize === true || showPageSize === 'true'" class="select-picker" mode="selector"
|
|
||||||
:value="pageSizeIndex" :range="pageSizeRange" @change="pickerChange" @cancel="pickerClick"
|
|
||||||
@click.native="pickerClick">
|
|
||||||
<button type="default" size="mini" :plain="true">
|
|
||||||
<text>{{pageSizeRange[pageSizeIndex]}} {{piecePerPage}}</text>
|
|
||||||
<uni-icons class="select-picker-icon" type="arrowdown" size="12" color="#999"></uni-icons>
|
|
||||||
</button>
|
|
||||||
</picker>
|
|
||||||
<!-- #endif -->
|
|
||||||
<!-- #ifndef APP-NVUE -->
|
<!-- #ifndef APP-NVUE -->
|
||||||
<view class="uni-pagination__total is-phone-hide">共 {{ total }} 条</view>
|
<view class="uni-pagination__total is-phone-hide">共 {{ total }} 条</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
@ -26,7 +16,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="uni-pagination__num uni-pagination__num-flex-none">
|
<view class="uni-pagination__num uni-pagination__num-flex-none">
|
||||||
<view class="uni-pagination__num-current">
|
<view class="uni-pagination__num-current">
|
||||||
<text class="uni-pagination__num-current-text is-pc-hide current-index-text">{{ currentIndex }}</text>
|
<text class="uni-pagination__num-current-text is-pc-hide"
|
||||||
|
style="color:#409EFF">{{ currentIndex }}</text>
|
||||||
<text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text>
|
<text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text>
|
||||||
<!-- #ifndef APP-NVUE -->
|
<!-- #ifndef APP-NVUE -->
|
||||||
<view v-for="(item, index) in paper" :key="index" :class="{ 'page--active': item === currentIndex }"
|
<view v-for="(item, index) in paper" :key="index" :class="{ 'page--active': item === currentIndex }"
|
||||||
@ -58,15 +49,11 @@
|
|||||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=32
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=32
|
||||||
* @property {String} prevText 左侧按钮文字
|
* @property {String} prevText 左侧按钮文字
|
||||||
* @property {String} nextText 右侧按钮文字
|
* @property {String} nextText 右侧按钮文字
|
||||||
* @property {String} piecePerPageText 条/页文字
|
|
||||||
* @property {Number} current 当前页
|
* @property {Number} current 当前页
|
||||||
* @property {Number} total 数据总量
|
* @property {Number} total 数据总量
|
||||||
* @property {Number} pageSize 每页数据量
|
* @property {Number} pageSize 每页数据量
|
||||||
* @property {Boolean} showIcon = [true|false] 是否以 icon 形式展示按钮
|
* @property {Number} showIcon = [true|false] 是否以 icon 形式展示按钮
|
||||||
* @property {Boolean} showPageSize = [true|false] 是否展示每页条数
|
|
||||||
* @property {Array} pageSizeRange = [20, 50, 100, 500] 每页条数选框
|
|
||||||
* @event {Function} change 点击页码按钮时触发 ,e={type,current} current为当前页,type值为:next/prev,表示点击的是上一页还是下一个
|
* @event {Function} change 点击页码按钮时触发 ,e={type,current} current为当前页,type值为:next/prev,表示点击的是上一页还是下一个
|
||||||
* * @event {Function} pageSizeChange 当前每页条数改变时触发 ,e={pageSize} pageSize 为当前所选的每页条数
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -78,7 +65,7 @@
|
|||||||
} = initVueI18n(messages)
|
} = initVueI18n(messages)
|
||||||
export default {
|
export default {
|
||||||
name: 'UniPagination',
|
name: 'UniPagination',
|
||||||
emits: ['update:modelValue', 'input', 'change', 'pageSizeChange'],
|
emits: ['update:modelValue', 'input', 'change'],
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
@ -94,9 +81,6 @@
|
|||||||
nextText: {
|
nextText: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
piecePerPageText: {
|
|
||||||
type: String
|
|
||||||
},
|
|
||||||
current: {
|
current: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
@ -116,32 +100,18 @@
|
|||||||
type: [Boolean, String],
|
type: [Boolean, String],
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
showPageSize: {
|
|
||||||
// 是否以 icon 形式展示按钮
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
pagerCount: {
|
pagerCount: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 7
|
default: 7
|
||||||
},
|
|
||||||
pageSizeRange: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [20, 50, 100, 500]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pageSizeIndex: 0,
|
|
||||||
currentIndex: 1,
|
currentIndex: 1,
|
||||||
paperData: [],
|
paperData: []
|
||||||
pickerShow: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
piecePerPage() {
|
|
||||||
return this.piecePerPageText || t('uni-pagination.piecePerPage')
|
|
||||||
},
|
|
||||||
prevPageText() {
|
prevPageText() {
|
||||||
return this.prevText || t('uni-pagination.prevText')
|
return this.prevText || t('uni-pagination.prevText')
|
||||||
},
|
},
|
||||||
@ -229,31 +199,9 @@
|
|||||||
this.currentIndex = val
|
this.currentIndex = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
pageSizeIndex(val) {
|
|
||||||
this.$emit('pageSizeChange', this.pageSizeRange[val])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
pickerChange(e) {
|
|
||||||
this.pageSizeIndex = e.detail.value
|
|
||||||
this.pickerClick()
|
|
||||||
},
|
|
||||||
pickerClick() {
|
|
||||||
// #ifdef H5
|
|
||||||
const body = document.querySelector('body')
|
|
||||||
if (!body) return
|
|
||||||
|
|
||||||
const className = 'uni-pagination-picker-show'
|
|
||||||
this.pickerShow = !this.pickerShow
|
|
||||||
|
|
||||||
if (this.pickerShow) {
|
|
||||||
body.classList.add(className)
|
|
||||||
} else {
|
|
||||||
setTimeout(() => body.classList.remove(className), 300)
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
},
|
|
||||||
// 选择标签
|
// 选择标签
|
||||||
selectPage(e, index) {
|
selectPage(e, index) {
|
||||||
if (parseInt(e)) {
|
if (parseInt(e)) {
|
||||||
@ -308,8 +256,8 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" >
|
||||||
$uni-primary: #2979ff !default;
|
$uni-primary: #2979ff;
|
||||||
.uni-pagination {
|
.uni-pagination {
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -404,10 +352,6 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-index-text{
|
|
||||||
color: $uni-primary;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-pagination--enabled {
|
.uni-pagination--enabled {
|
||||||
color: #333333;
|
color: #333333;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-pagination",
|
"id": "uni-pagination",
|
||||||
"displayName": "uni-pagination 分页器",
|
"displayName": "uni-pagination 分页器",
|
||||||
"version": "1.2.4",
|
"version": "1.2.1",
|
||||||
"description": "Pagination 分页器组件,用于展示页码、请求数据等。",
|
"description": "Pagination 分页器组件,用于展示页码、请求数据等。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -16,7 +16,11 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
@ -33,8 +37,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": ["uni-scss","uni-icons"],
|
"dependencies": ["uni-scss","uni-icons"],
|
||||||
|
@ -9,3 +9,5 @@
|
|||||||
|
|
||||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-pagination)
|
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-pagination)
|
||||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
## 1.8.3(2023-04-17)
|
|
||||||
- 修复 uni-popup 重复打开时的 bug
|
|
||||||
## 1.8.2(2023-02-02)
|
|
||||||
- uni-popup-dialog 组件新增 inputType 属性
|
|
||||||
## 1.8.1(2022-12-01)
|
|
||||||
- 修复 nvue 下 v-show 报错
|
|
||||||
## 1.8.0(2022-11-29)
|
|
||||||
- 优化 主题样式
|
|
||||||
## 1.7.9(2022-04-02)
|
## 1.7.9(2022-04-02)
|
||||||
- 修复 弹出层内部无法滚动的bug
|
- 修复 弹出层内部无法滚动的bug
|
||||||
## 1.7.8(2022-03-28)
|
## 1.7.8(2022-03-28)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-else class="uni-dialog-content">
|
<view v-else class="uni-dialog-content">
|
||||||
<slot>
|
<slot>
|
||||||
<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus" >
|
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" >
|
||||||
</slot>
|
</slot>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-dialog-button-group">
|
<view class="uni-dialog-button-group">
|
||||||
@ -57,10 +57,6 @@
|
|||||||
mixins: [popup],
|
mixins: [popup],
|
||||||
emits:['confirm','close'],
|
emits:['confirm','close'],
|
||||||
props: {
|
props: {
|
||||||
inputType:{
|
|
||||||
type: String,
|
|
||||||
default: 'text'
|
|
||||||
},
|
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: ''
|
default: ''
|
||||||
|
@ -269,7 +269,8 @@
|
|||||||
open(direction) {
|
open(direction) {
|
||||||
// fix by mehaotian 处理快速打开关闭的情况
|
// fix by mehaotian 处理快速打开关闭的情况
|
||||||
if (this.showPopup) {
|
if (this.showPopup) {
|
||||||
return
|
clearTimeout(this.timer)
|
||||||
|
this.showPopup = false
|
||||||
}
|
}
|
||||||
let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
|
let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
|
||||||
if (!(direction && innerType.indexOf(direction) !== -1)) {
|
if (!(direction && innerType.indexOf(direction) !== -1)) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-popup",
|
"id": "uni-popup",
|
||||||
"displayName": "uni-popup 弹出层",
|
"displayName": "uni-popup 弹出层",
|
||||||
"version": "1.8.3",
|
"version": "1.7.9",
|
||||||
"description": " Popup 组件,提供常用的弹层",
|
"description": " Popup 组件,提供常用的弹层",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
@ -17,8 +17,12 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "../../temps/example_temps"
|
"example": "../../temps/example_temps"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
"sale": {
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
},
|
},
|
||||||
@ -34,8 +38,7 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
"type": "component-vue"
|
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
@ -258,34 +258,32 @@
|
|||||||
* 获取星星个数
|
* 获取星星个数
|
||||||
*/
|
*/
|
||||||
_getRateCount(clientX) {
|
_getRateCount(clientX) {
|
||||||
const _this = this;
|
this._getSize()
|
||||||
this._getSize(function() {
|
const size = Number(this.size)
|
||||||
const size = Number(_this.size)
|
if (isNaN(size)) {
|
||||||
if (isNaN(size)) {
|
return new Error('size 属性只能设置为数字')
|
||||||
return new Error('size 属性只能设置为数字')
|
}
|
||||||
}
|
const rateMoveRange = clientX - this._rateBoxLeft
|
||||||
const rateMoveRange = clientX - _this._rateBoxLeft
|
let index = parseInt(rateMoveRange / (size + this.marginNumber))
|
||||||
let index = parseInt(rateMoveRange / (size + _this.marginNumber))
|
index = index < 0 ? 0 : index;
|
||||||
index = index < 0 ? 0 : index;
|
index = index > this.max ? this.max : index;
|
||||||
index = index > _this.max ? _this.max : index;
|
const range = parseInt(rateMoveRange - (size + this.marginNumber) * index);
|
||||||
const range = parseInt(rateMoveRange - (size + _this.marginNumber) * index);
|
let value = 0;
|
||||||
let value = 0;
|
if (this._oldValue === index && !this.PC) return;
|
||||||
if (_this._oldValue === index && !_this.PC) return;
|
this._oldValue = index;
|
||||||
_this._oldValue = index;
|
if (this.allowHalf) {
|
||||||
if (_this.allowHalf) {
|
if (range > (size / 2)) {
|
||||||
if (range > (size / 2)) {
|
|
||||||
value = index + 1
|
|
||||||
} else {
|
|
||||||
value = index + 0.5
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
value = index + 1
|
value = index + 1
|
||||||
|
} else {
|
||||||
|
value = index + 0.5
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
value = index + 1
|
||||||
|
}
|
||||||
|
|
||||||
value = Math.max(0.5, Math.min(value, _this.max))
|
value = Math.max(0.5, Math.min(value, this.max))
|
||||||
_this.valueSync = value
|
this.valueSync = value
|
||||||
_this._onChange()
|
this._onChange()
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -302,7 +300,7 @@
|
|||||||
/**
|
/**
|
||||||
* 获取星星距离屏幕左侧距离
|
* 获取星星距离屏幕左侧距离
|
||||||
*/
|
*/
|
||||||
_getSize(fn) {
|
_getSize() {
|
||||||
// #ifndef APP-NVUE
|
// #ifndef APP-NVUE
|
||||||
uni.createSelectorQuery()
|
uni.createSelectorQuery()
|
||||||
.in(this)
|
.in(this)
|
||||||
@ -311,7 +309,6 @@
|
|||||||
.exec(ret => {
|
.exec(ret => {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
this._rateBoxLeft = ret[0].left
|
this._rateBoxLeft = ret[0].left
|
||||||
fn && fn()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
@ -320,7 +317,6 @@
|
|||||||
const size = ret.size
|
const size = ret.size
|
||||||
if (size) {
|
if (size) {
|
||||||
this._rateBoxLeft = size.left
|
this._rateBoxLeft = size.left
|
||||||
fn && fn()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
index === currentIndex&&styleType === 'button' ? 'segmented-control__item--button--active': '',
|
index === currentIndex&&styleType === 'button' ? 'segmented-control__item--button--active': '',
|
||||||
index === 0&&styleType === 'button' ? 'segmented-control__item--button--first': '',
|
index === 0&&styleType === 'button' ? 'segmented-control__item--button--first': '',
|
||||||
index === values.length - 1&&styleType === 'button' ? 'segmented-control__item--button--last': '' ]" :key="index"
|
index === values.length - 1&&styleType === 'button' ? 'segmented-control__item--button--last': '' ]" :key="index"
|
||||||
:style="{ backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : '',borderColor: index === currentIndex&&(styleType === 'text'||styleType === 'button')?activeColor:'#d9d9d9' }"
|
:style="{ backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : '',borderColor: index === currentIndex&&styleType === 'text'||styleType === 'button'?activeColor:'transparent' }"
|
||||||
class="segmented-control__item" @click="_onClick(index)">
|
class="segmented-control__item" @click="_onClick(index)">
|
||||||
<view>
|
<view>
|
||||||
<text :style="{color:
|
<text :style="{color:
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
## 1.3.8(2023-04-13)
|
|
||||||
- 修复`uni-swipe-action`和`uni-swipe-action-item`不同时使用导致 closeOther 方法报错的 bug
|
|
||||||
## 1.3.7(2022-06-06)
|
## 1.3.7(2022-06-06)
|
||||||
- 修复 vue3 下使用组件不能正常运行的Bug
|
- 修复 vue3 下使用组件不能正常运行的Bug
|
||||||
## 1.3.6(2022-05-31)
|
## 1.3.6(2022-05-31)
|
||||||
|
@ -31,7 +31,7 @@ bindIngXMixins = {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.swipeaction = this.getSwipeAction()
|
this.swipeaction = this.getSwipeAction()
|
||||||
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
if (this.swipeaction.children !== undefined) {
|
||||||
this.swipeaction.children.push(this)
|
this.swipeaction.children.push(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -74,7 +74,7 @@ bindIngXMixins = {
|
|||||||
// 每次只触发一次,避免多次监听造成闪烁
|
// 每次只触发一次,避免多次监听造成闪烁
|
||||||
if (this.stop) return
|
if (this.stop) return
|
||||||
this.stop = true
|
this.stop = true
|
||||||
if (this.autoClose && this.swipeaction) {
|
if (this.autoClose) {
|
||||||
this.swipeaction.closeOther(this)
|
this.swipeaction.closeOther(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.swipeaction = this.getSwipeAction()
|
this.swipeaction = this.getSwipeAction()
|
||||||
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
if (this.swipeaction.children !== undefined) {
|
||||||
this.swipeaction.children.push(this)
|
this.swipeaction.children.push(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -65,9 +65,7 @@ export default {
|
|||||||
touchstart(e) {
|
touchstart(e) {
|
||||||
this.transition = false
|
this.transition = false
|
||||||
this.isclose = true
|
this.isclose = true
|
||||||
if (this.autoClose && this.swipeaction) {
|
this.autoClose && this.swipeaction.closeOther(this)
|
||||||
this.swipeaction.closeOther(this)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
touchmove(e) {},
|
touchmove(e) {},
|
||||||
touchend(e) {
|
touchend(e) {
|
||||||
|
@ -36,7 +36,7 @@ otherMixins = {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.swipeaction = this.getSwipeAction()
|
this.swipeaction = this.getSwipeAction()
|
||||||
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
if (this.swipeaction.children !== undefined) {
|
||||||
this.swipeaction.children.push(this)
|
this.swipeaction.children.push(this)
|
||||||
}
|
}
|
||||||
this.init()
|
this.init()
|
||||||
@ -53,9 +53,8 @@ otherMixins = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
closeSwipe(e) {
|
closeSwipe(e) {
|
||||||
if (this.autoClose && this.swipeaction) {
|
if (!this.autoClose) return
|
||||||
this.swipeaction.closeOther(this)
|
this.swipeaction.closeOther(this)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
appTouchStart(e) {
|
appTouchStart(e) {
|
||||||
const {
|
const {
|
||||||
|
@ -21,7 +21,7 @@ mpMixins = {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.swipeaction = this.getSwipeAction()
|
this.swipeaction = this.getSwipeAction()
|
||||||
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
|
if (this.swipeaction.children !== undefined) {
|
||||||
this.swipeaction.children.push(this)
|
this.swipeaction.children.push(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -31,9 +31,8 @@ mpMixins = {
|
|||||||
methods: {
|
methods: {
|
||||||
// wxs 中调用
|
// wxs 中调用
|
||||||
closeSwipe(e) {
|
closeSwipe(e) {
|
||||||
if (this.autoClose && this.swipeaction) {
|
if (!this.autoClose) return
|
||||||
this.swipeaction.closeOther(this)
|
this.swipeaction.closeOther(this)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
change(e) {
|
change(e) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-swipe-action",
|
"id": "uni-swipe-action",
|
||||||
"displayName": "uni-swipe-action 滑动操作",
|
"displayName": "uni-swipe-action 滑动操作",
|
||||||
"version": "1.3.8",
|
"version": "1.3.7",
|
||||||
"description": "SwipeAction 滑动操作操作组件",
|
"description": "SwipeAction 滑动操作操作组件",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"",
|
"",
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
## 1.2.3(2023-03-28)
|
|
||||||
- 修复 在vue3模式下可能会出现错误的问题
|
|
||||||
## 1.2.2(2022-11-29)
|
|
||||||
- 优化 主题样式
|
|
||||||
## 1.2.1(2022-06-06)
|
## 1.2.1(2022-06-06)
|
||||||
- 修复 微信小程序存在无使用组件的问题
|
- 修复 微信小程序存在无使用组件的问题
|
||||||
## 1.2.0(2021-11-19)
|
## 1.2.0(2021-11-19)
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
<!-- #ifdef H5 -->
|
<!-- #ifdef H5 -->
|
||||||
<table class="uni-table" border="0" cellpadding="0" cellspacing="0" :class="{ 'table--stripe': stripe }" :style="{ 'min-width': minWidth + 'px' }">
|
<table class="uni-table" border="0" cellpadding="0" cellspacing="0" :class="{ 'table--stripe': stripe }" :style="{ 'min-width': minWidth + 'px' }">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
<tr v-if="noData" class="uni-table-loading">
|
<view v-if="noData" class="uni-table-loading">
|
||||||
<td class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</td>
|
<view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view>
|
||||||
</tr>
|
</view>
|
||||||
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
|
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
|
||||||
</table>
|
</table>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
@ -125,7 +125,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
startIndex = theadChildren.rowspan - 1
|
startIndex = theadChildren.rowspan - 1
|
||||||
}
|
}
|
||||||
let isHaveData = this.data && this.data.length > 0
|
let isHaveData = this.data && this.data.length.length > 0
|
||||||
theadChildren.checked = true
|
theadChildren.checked = true
|
||||||
theadChildren.indeterminate = false
|
theadChildren.indeterminate = false
|
||||||
this.trChildren.forEach((item, index) => {
|
this.trChildren.forEach((item, index) => {
|
||||||
|
@ -112,12 +112,6 @@
|
|||||||
value: 'value'
|
value: 'value'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
filterDefaultValue: {
|
|
||||||
type: [Array,String],
|
|
||||||
default () {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -163,7 +157,7 @@
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
isOpened: false,
|
isOpened: false,
|
||||||
dataList: [],
|
dataList: [],
|
||||||
filterValue: this.filterDefaultValue,
|
filterValue: '',
|
||||||
checkedValues: [],
|
checkedValues: [],
|
||||||
gtValue: '',
|
gtValue: '',
|
||||||
ltValue: '',
|
ltValue: '',
|
||||||
@ -292,8 +286,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
$uni-primary: #1890ff !default;
|
|
||||||
|
|
||||||
.flex-r {
|
.flex-r {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -323,8 +315,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon-select.active {
|
.icon-select.active {
|
||||||
background-color: $uni-primary;
|
background-color: #1890ff;
|
||||||
border-top-color: $uni-primary;
|
border-top-color: #1890ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-search {
|
.icon-search {
|
||||||
@ -351,11 +343,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon-search.active .icon-search-0 {
|
.icon-search.active .icon-search-0 {
|
||||||
border-color: $uni-primary;
|
border-color: #1890ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-search.active .icon-search-1 {
|
.icon-search.active .icon-search-1 {
|
||||||
background-color: $uni-primary;
|
background-color: #1890ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-calendar {
|
.icon-calendar {
|
||||||
@ -395,14 +387,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon-calendar.active {
|
.icon-calendar.active {
|
||||||
color: $uni-primary;
|
color: #1890ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-calendar.active .icon-calendar-0,
|
.icon-calendar.active .icon-calendar-0,
|
||||||
.icon-calendar.active .icon-calendar-1,
|
.icon-calendar.active .icon-calendar-1,
|
||||||
.icon-calendar.active .icon-calendar-0:before,
|
.icon-calendar.active .icon-calendar-0:before,
|
||||||
.icon-calendar.active .icon-calendar-0:after {
|
.icon-calendar.active .icon-calendar-0:after {
|
||||||
background-color: $uni-primary;
|
background-color: #1890ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-filter-dropdown {
|
.uni-filter-dropdown {
|
||||||
@ -505,7 +497,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-submit {
|
.btn-submit {
|
||||||
background-color: $uni-primary;
|
background-color: #1890ff;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user