From aa47166ae7df893ab0f0ccb13fd978f423888b12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=98=BF=E6=80=AA?= <690927457@qq.com>
Date: Wed, 18 Oct 2023 21:00:42 +0800
Subject: [PATCH] =?UTF-8?q?10.18=E5=89=8D=E7=9A=84=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/index.js | 5 +
api/request.js | 22 +-
config/index.js | 2 +-
manifest.json | 4 +-
pages.json | 10 +-
pages/index/index.vue | 88 +-
pages/login/login.vue | 173 +++
pages/user/index.vue | 90 +-
static/avatar.png | Bin 0 -> 7203 bytes
store/index.js | 2 +-
uni_modules/uni-datetime-picker/changelog.md | 140 +++
.../uni-datetime-picker/calendar-item.vue | 177 +++
.../uni-datetime-picker/calendar.vue | 929 +++++++++++++++
.../uni-datetime-picker/i18n/en.json | 22 +
.../uni-datetime-picker/i18n/index.js | 8 +
.../uni-datetime-picker/i18n/zh-Hans.json | 22 +
.../uni-datetime-picker/i18n/zh-Hant.json | 22 +
.../uni-datetime-picker/time-picker.vue | 934 +++++++++++++++
.../uni-datetime-picker.vue | 1032 +++++++++++++++++
.../components/uni-datetime-picker/util.js | 453 ++++++++
uni_modules/uni-datetime-picker/package.json | 87 ++
uni_modules/uni-datetime-picker/readme.md | 21 +
uni_modules/uni-easyinput/changelog.md | 97 ++
.../components/uni-easyinput/common.js | 56 +
.../uni-easyinput/uni-easyinput.vue | 657 +++++++++++
uni_modules/uni-easyinput/package.json | 87 ++
uni_modules/uni-easyinput/readme.md | 11 +
unpackage/dist/dev/mp-weixin/api/index.js | 6 +
unpackage/dist/dev/mp-weixin/api/request.js | 10 +-
unpackage/dist/dev/mp-weixin/app.js | 1 +
unpackage/dist/dev/mp-weixin/app.json | 7 +-
unpackage/dist/dev/mp-weixin/common/vendor.js | 435 +++++--
unpackage/dist/dev/mp-weixin/config/index.js | 2 +-
.../dist/dev/mp-weixin/pages/index/index.js | 51 +-
.../dist/dev/mp-weixin/pages/index/index.json | 2 +
.../dist/dev/mp-weixin/pages/index/index.wxml | 2 +-
.../dist/dev/mp-weixin/pages/index/index.wxss | 30 +
.../dist/dev/mp-weixin/pages/login/login.js | 111 ++
.../dist/dev/mp-weixin/pages/login/login.json | 6 +
.../dist/dev/mp-weixin/pages/login/login.wxml | 1 +
.../dist/dev/mp-weixin/pages/login/login.wxss | 75 ++
.../dist/dev/mp-weixin/pages/user/index.js | 57 +-
.../dist/dev/mp-weixin/pages/user/index.wxml | 2 +-
.../dist/dev/mp-weixin/pages/user/index.wxss | 51 +
.../dist/dev/mp-weixin/static/avatar.png | Bin 0 -> 7203 bytes
unpackage/dist/dev/mp-weixin/store/index.js | 1 -
.../uni-datetime-picker/calendar-item.js | 58 +
.../uni-datetime-picker/calendar-item.json | 4 +
.../uni-datetime-picker/calendar-item.wxml | 1 +
.../uni-datetime-picker/calendar-item.wxss | 113 ++
.../uni-datetime-picker/calendar.js | 597 ++++++++++
.../uni-datetime-picker/calendar.json | 8 +
.../uni-datetime-picker/calendar.wxml | 1 +
.../uni-datetime-picker/calendar.wxss | 251 ++++
.../uni-datetime-picker/i18n/index.js | 73 ++
.../uni-datetime-picker/time-picker.js | 696 +++++++++++
.../uni-datetime-picker/time-picker.json | 4 +
.../uni-datetime-picker/time-picker.wxml | 1 +
.../uni-datetime-picker/time-picker.wxss | 127 ++
.../uni-datetime-picker.js | 828 +++++++++++++
.../uni-datetime-picker.json | 8 +
.../uni-datetime-picker.wxml | 1 +
.../uni-datetime-picker.wxss | 201 ++++
.../components/uni-datetime-picker/util.js | 406 +++++++
.../components/uni-easyinput/uni-easyinput.js | 448 +++++++
.../uni-easyinput/uni-easyinput.json | 6 +
.../uni-easyinput/uni-easyinput.wxml | 1 +
.../uni-easyinput/uni-easyinput.wxss | 133 +++
unpackage/dist/dev/mp-weixin/utils/index.js | 101 ++
utils/index.js | 40 +-
70 files changed, 9936 insertions(+), 172 deletions(-)
create mode 100644 pages/login/login.vue
create mode 100644 static/avatar.png
create mode 100644 uni_modules/uni-datetime-picker/changelog.md
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
create mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
create mode 100644 uni_modules/uni-datetime-picker/package.json
create mode 100644 uni_modules/uni-datetime-picker/readme.md
create mode 100644 uni_modules/uni-easyinput/changelog.md
create mode 100644 uni_modules/uni-easyinput/components/uni-easyinput/common.js
create mode 100644 uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue
create mode 100644 uni_modules/uni-easyinput/package.json
create mode 100644 uni_modules/uni-easyinput/readme.md
create mode 100644 unpackage/dist/dev/mp-weixin/pages/login/login.js
create mode 100644 unpackage/dist/dev/mp-weixin/pages/login/login.json
create mode 100644 unpackage/dist/dev/mp-weixin/pages/login/login.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/pages/login/login.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/static/avatar.png
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.json
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.json
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.json
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.json
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.json
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.wxss
create mode 100644 unpackage/dist/dev/mp-weixin/utils/index.js
diff --git a/api/index.js b/api/index.js
index 3bc6212..b2dbea8 100644
--- a/api/index.js
+++ b/api/index.js
@@ -5,6 +5,11 @@ const API = {
//微信登录
getToken: data => net.POST('/login/token',data), // 获取token
wx_login: (data,userId) => net.POST('/user/binding/wechat',data,true,{"userId":userId}), // 微信登录
+ // upload: (data) => net.POST('/user/upload',data), // 文件上传
+ userinfoUpdae:data => net.PUT('/user/info',data), // 更新用户信息
+ // 首页
+ getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息
+
/*
首页信息
*/
diff --git a/api/request.js b/api/request.js
index d7407f5..7dc2c7b 100644
--- a/api/request.js
+++ b/api/request.js
@@ -3,13 +3,23 @@ import config from '../config'
// import store from '../store'
const loginUrl = 'pages/user/login';
-
+// function JSON_to_URLEncoded(element,key,list){
+// var list = list || [];
+// if(typeof(element)=='object'){
+// for (var idx in element)
+// JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list);
+// } else {
+// list.push(key+'='+encodeURIComponent(element));
+// }
+// return list.join('&');
+// }
export default {
REQUEST(url, method = 'GET', data, checkLogin = true, header) {
- let token = uni.getStorageSync('access_token') || 'Basic ZGV20mRldjEyMw==';
+
+ let token = uni.getStorageSync('access_token') || 'Basic ZGV2OmRldjEyMw==';
const headers = {
- "Content-Type": "application/json",
- // "Content-Type": "application/x-www-form-urlencoded",
+ // "Content-Type": "application/json",
+ "Content-Type": "application/x-www-form-urlencoded",
"Authorization": token,
"x-token": token,
"token":token,
@@ -18,10 +28,6 @@ export default {
}
var pages = getCurrentPages();
var page = pages[pages.length - 1];
- if(!header) {
- headers["Content-Type"] = 'application/x-www-form-urlencode'
- }
- console.log("headers :",headers)
return uni.request({
url: config.baseUrl + url,
method,
diff --git a/config/index.js b/config/index.js
index 631383e..2972aff 100644
--- a/config/index.js
+++ b/config/index.js
@@ -1,6 +1,6 @@
// isdev 为 true 表示开发环境 false 表示发布环境
const isdev = true;
-const baseUrl = isdev ? 'https://71e86bc1.r15.cpolar.top' : 'http://niunai.zhitou1688.com';// 办公室接口 & 测试环境
+const baseUrl = isdev ? 'http://2580c89.r18.cpolar.top/' : 'http://niunai.zhitou1688.com';// 办公室接口 & 测试环境
// const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境
// const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)
diff --git a/manifest.json b/manifest.json
index 7110b62..ec17600 100644
--- a/manifest.json
+++ b/manifest.json
@@ -52,7 +52,9 @@
"mp-weixin" : {
"appid" : "wxaaf66dbb5c3983b3",
"setting" : {
- "urlCheck" : false
+ "urlCheck" : false
+ // "ignoreDevUnusedFiles": false ,
+ // "ignoreUploadUnusedFiles": false”
},
"usingComponents" : true
},
diff --git a/pages.json b/pages.json
index b1e3ed8..1624c66 100644
--- a/pages.json
+++ b/pages.json
@@ -17,12 +17,18 @@
"style": {
"navigationBarTitleText": "我的"
}
+ },
+ {
+ "path": "pages/login/login",
+ "style": {
+ "navigationBarTitleText": "登录"
+ }
}
],
"globalStyle": {
- "navigationBarTextStyle": "black",
+ "navigationBarTextStyle": "white",
"navigationBarTitleText": "uni-app",
- "navigationBarBackgroundColor": "#F8F8F8",
+ "navigationBarBackgroundColor": "#26758d",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {},
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 02bb541..7cde14a 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,5 +1,7 @@
@@ -78,9 +95,33 @@
- 手术信息
+ 完善手术信息
+
+
+ 已经手术
+
+
+
+
+
+
+
+
+ 手术时间
+
+
+
+
+
+
+ 医院名称
+
+
+
+
+
-
+
关闭
- 登录
-
+
+
+
+ {{is_login?userinfo.nickname:'未登录'}}
+
+
+
+ 登录
+
-
\ No newline at end of file
diff --git a/static/avatar.png b/static/avatar.png
new file mode 100644
index 0000000000000000000000000000000000000000..c552c1fd953a5eb51ade2d075b94491ce143ff58
GIT binary patch
literal 7203
zcmV+;9NgoHP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@
z1ONa40RR91f}jHc1ONa40RR91f&c&j0OoSX&;S4%jY&j7RCodHT?v>}#kD?ld+(m<
z?%5cIMfQCWFhDR61!6=c8e>orkSr!KQDeTm7nf(=XLwnjQD1y7d1_vk?*)ZKlFM^?y3$TuHVReJu`Gy{O%*2!Kf#8V+
zCvs6-!GJI09EM~ngkGPaW;lZVj@3qku*PL|9o8$K#Fs9CKyAA>99+zqbRS-SRL=rb
z%o}4HK!67tt?s`mPNQK&T>*jAe`mzM1izyDuqQuNLpf-c6>5oX0vG<>ZLj?!USl!!
z5p)3r1c0$K>bn^g!MzBAvHB2AdAUHr?_q-QK%LdO76Cz{k&1?j1EDiQ!#?qG{4^$4
zR1y`+oHT@i!|iT|dwYdgkh85A5Q027AQ4VJjGw}aN(w*^d6P!Kk6r0>7u;>i&(^{Rd5f&>4wb#CdEjf?psze0i$gM*R70Mc(LgYeHecn5`aKO+*NdfQTrvJYqZqvE0*!1f#8e!MkPgf
zUN63b?Wp#jTlcKodoNZP)tU~Qe_iVWrtdMXf%@i9oEeiG_74I?V^C-iTEEu5X>kvGqvK!v3KwH`s7~y+uOFo
zd%O3lMY<$9)bXUlVzHD&r|86-FX#;W?#J{i3#C!89f1r+h&t2;+J$Lp24P-3IfoSO7EU%m%auYREb}W3?NnVSnMY(o7Wt0lz>a
z_6u-`qFs~V>F~f)Py7~*Ic-YIqsw^BEdynXV|_!tX8e(JOM}CGh0+Wa0|A?a?;sc+
zR!X?kct;K&fu~phuIjWvwsMnpxN-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zPX7A4mB^p+tSAtA3;p<^^-Ds@&`;Z9{yaNi^rkpJ&Ms5UDZ#+*yl?#S-&eXsx&T72
z5FS7D?2@n;d+1EeKMd{Fy5g;uM>WnaQ|&Pv72f;Zi7VEsK~D`Dx)k;=j{RwFA{Kx2
zM6`1%4m)+pW1+$~FasZGtJ{_k`M2+yaO0Lj)0aEGu7&)(XX}tNzRn+?jCro}#k*?C
zEsS!|w;QbCW~=)dZZzM0`-p2!mm?1~XzCgWsRdkfY{SB6GICEx%r_4^mpOh6Dm7JQ
zu5m$Ztj<`oHO`Vh4UJv8er1LoN-D!y_FSt52&qMQ>C`({pNyQo4Oc^5+8+1gy7$WW
zC!8inpwaByVz*d-zGCQ=f9#$vPUTwP*HsCGRFOV-Xw8sX$@$eJB(4f1!xQ|;5dPXn
zd4VAa23}{h`>jUHJ}&VMC#B9O9-jF1L#cdK+jZ3gp})Xa?)`PW&Fq+KO`0wfL7EW}
z px
+- 修复 范围选择时清空返回值不合理的bug,['', ''] -> []
+## 2.0.8(2021-07-07)
+- 新增 日期时间显示框支持插槽
+## 2.0.7(2021-07-01)
+- 优化 添加 uni-icons 依赖
+## 2.0.6(2021-05-22)
+- 修复 图标在小程序上不显示的Bug
+- 优化 重命名引用组件,避免潜在组件命名冲突
+## 2.0.5(2021-05-20)
+- 优化 代码目录扁平化
+## 2.0.4(2021-05-12)
+- 新增 组件示例地址
+## 2.0.3(2021-05-10)
+- 修复 ios 下不识别 '-' 日期格式的Bug
+- 优化 pc 下弹出层添加边框和阴影
+## 2.0.2(2021-05-08)
+- 修复 在 admin 中获取弹出层定位错误的bug
+## 2.0.1(2021-05-08)
+- 修复 type 属性向下兼容,默认值从 date 变更为 datetime
+## 2.0.0(2021-04-30)
+- 支持日历形式的日期+时间的范围选择
+ > 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)
+## 1.0.6(2021-03-18)
+- 新增 hide-second 属性,时间支持仅选择时、分
+- 修复 选择跟显示的日期不一样的Bug
+- 修复 chang事件触发2次的Bug
+- 修复 分、秒 end 范围错误的Bug
+- 优化 更好的 nvue 适配
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
new file mode 100644
index 0000000..8f3c461
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
@@ -0,0 +1,177 @@
+
+
+
+
+ {{weeks.date}}
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
new file mode 100644
index 0000000..ec8e472
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
@@ -0,0 +1,929 @@
+
+
+
+
+
+
+
+
+
+
+ {{nowDate.month}}
+
+
+
+
+ {{SUNText}}
+
+
+ {{MONText}}
+
+
+ {{TUEText}}
+
+
+ {{WEDText}}
+
+
+ {{THUText}}
+
+
+ {{FRIText}}
+
+
+ {{SATText}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{tempSingleDate ? tempSingleDate : selectDateText}}
+
+
+
+
+
+
+ {{tempRange.before ? tempRange.before : startDateText}}
+
+
+
+
+
+
+
+
+ {{tempRange.after ? tempRange.after : endDateText}}
+
+
+
+
+
+
+ {{confirmText}}
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
new file mode 100644
index 0000000..56cd0a6
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
@@ -0,0 +1,22 @@
+{
+ "uni-datetime-picker.selectDate": "select date",
+ "uni-datetime-picker.selectTime": "select time",
+ "uni-datetime-picker.selectDateTime": "select date and time",
+ "uni-datetime-picker.startDate": "start date",
+ "uni-datetime-picker.endDate": "end date",
+ "uni-datetime-picker.startTime": "start time",
+ "uni-datetime-picker.endTime": "end time",
+ "uni-datetime-picker.ok": "ok",
+ "uni-datetime-picker.clear": "clear",
+ "uni-datetime-picker.cancel": "cancel",
+ "uni-datetime-picker.year": "-",
+ "uni-datetime-picker.month": "",
+ "uni-calender.MON": "MON",
+ "uni-calender.TUE": "TUE",
+ "uni-calender.WED": "WED",
+ "uni-calender.THU": "THU",
+ "uni-calender.FRI": "FRI",
+ "uni-calender.SAT": "SAT",
+ "uni-calender.SUN": "SUN",
+ "uni-calender.confirm": "confirm"
+}
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
new file mode 100644
index 0000000..fa8f0f3
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
@@ -0,0 +1,8 @@
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+import zhHant from './zh-Hant.json'
+export default {
+ en,
+ 'zh-Hans': zhHans,
+ 'zh-Hant': zhHant
+}
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json
new file mode 100644
index 0000000..d2df5e7
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json
@@ -0,0 +1,22 @@
+{
+ "uni-datetime-picker.selectDate": "选择日期",
+ "uni-datetime-picker.selectTime": "选择时间",
+ "uni-datetime-picker.selectDateTime": "选择日期时间",
+ "uni-datetime-picker.startDate": "开始日期",
+ "uni-datetime-picker.endDate": "结束日期",
+ "uni-datetime-picker.startTime": "开始时间",
+ "uni-datetime-picker.endTime": "结束时间",
+ "uni-datetime-picker.ok": "确定",
+ "uni-datetime-picker.clear": "清除",
+ "uni-datetime-picker.cancel": "取消",
+ "uni-datetime-picker.year": "年",
+ "uni-datetime-picker.month": "月",
+ "uni-calender.SUN": "日",
+ "uni-calender.MON": "一",
+ "uni-calender.TUE": "二",
+ "uni-calender.WED": "三",
+ "uni-calender.THU": "四",
+ "uni-calender.FRI": "五",
+ "uni-calender.SAT": "六",
+ "uni-calender.confirm": "确认"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json
new file mode 100644
index 0000000..d23fa3c
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json
@@ -0,0 +1,22 @@
+{
+ "uni-datetime-picker.selectDate": "選擇日期",
+ "uni-datetime-picker.selectTime": "選擇時間",
+ "uni-datetime-picker.selectDateTime": "選擇日期時間",
+ "uni-datetime-picker.startDate": "開始日期",
+ "uni-datetime-picker.endDate": "結束日期",
+ "uni-datetime-picker.startTime": "開始时间",
+ "uni-datetime-picker.endTime": "結束时间",
+ "uni-datetime-picker.ok": "確定",
+ "uni-datetime-picker.clear": "清除",
+ "uni-datetime-picker.cancel": "取消",
+ "uni-datetime-picker.year": "年",
+ "uni-datetime-picker.month": "月",
+ "uni-calender.SUN": "日",
+ "uni-calender.MON": "一",
+ "uni-calender.TUE": "二",
+ "uni-calender.WED": "三",
+ "uni-calender.THU": "四",
+ "uni-calender.FRI": "五",
+ "uni-calender.SAT": "六",
+ "uni-calender.confirm": "確認"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
new file mode 100644
index 0000000..f03dff6
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
@@ -0,0 +1,934 @@
+
+
+
+
+
+ {{time}}
+
+ {{selectTimeText}}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
new file mode 100644
index 0000000..7650d0f
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
@@ -0,0 +1,1032 @@
+
+
+
+
+
+
+
+ {{ displayValue || singlePlaceholderText }}
+
+
+
+
+ {{ displayRangeValue.startDate || startPlaceholderText }}
+
+ {{rangeSeparator}}
+
+ {{ displayRangeValue.endDate || endPlaceholderText }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
new file mode 100644
index 0000000..3ea5bb1
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
@@ -0,0 +1,453 @@
+class Calendar {
+ constructor({
+ selected,
+ startDate,
+ endDate,
+ range,
+ } = {}) {
+ // 当前日期
+ this.date = this.getDateObj(new Date()) // 当前初入日期
+ // 打点信息
+ this.selected = selected || [];
+ // 起始时间
+ this.startDate = startDate
+ // 终止时间
+ this.endDate = endDate
+ // 是否范围选择
+ this.range = range
+ // 多选状态
+ this.cleanMultipleStatus()
+ // 每周日期
+ this.weeks = {}
+ this.lastHover = false
+ }
+ /**
+ * 设置日期
+ * @param {Object} date
+ */
+ setDate(date) {
+ const selectDate = this.getDateObj(date)
+ this.getWeeks(selectDate.fullDate)
+ }
+
+ /**
+ * 清理多选状态
+ */
+ cleanMultipleStatus() {
+ this.multipleStatus = {
+ before: '',
+ after: '',
+ data: []
+ }
+ }
+
+ setStartDate(startDate) {
+ this.startDate = startDate
+ }
+
+ setEndDate(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) {
+ date = fixIosDateFormat(date)
+ date = new Date(date)
+
+ return {
+ fullDate: getDate(date),
+ year: date.getFullYear(),
+ month: addZero(date.getMonth() + 1),
+ date: addZero(date.getDate()),
+ day: date.getDay()
+ }
+ }
+
+ /**
+ * 获取上一个月日期集合
+ */
+ getPreMonthDays(amount, dateObj) {
+ const result = []
+ for (let i = amount - 1; i >= 0; i--) {
+ const month = dateObj.month > 1 ? dateObj.month -1 : 12
+ const year = month === 12 ? dateObj.year - 1 : dateObj.year
+ const date = new Date(year,month,-i).getDate()
+ const fullDate = `${year}-${addZero(month)}-${addZero(date)}`
+ let multiples = this.multipleStatus.data
+ let multiplesStatus = -1
+ if (this.range && multiples) {
+ multiplesStatus = multiples.findIndex((item) => {
+ return this.dateEqual(item, fullDate)
+ })
+ }
+ const checked = multiplesStatus !== -1
+ // 获取打点信息
+ const extraInfo = this.selected && this.selected.find((item) => {
+ if (this.dateEqual(fullDate, item.date)) {
+ return item
+ }
+ })
+ result.push({
+ fullDate,
+ year,
+ month,
+ date,
+ multiple: this.range ? checked : false,
+ beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after),
+ afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after),
+ disable: (this.startDate && !dateCompare(this.startDate, fullDate)) || (this.endDate && !dateCompare(fullDate,this.endDate)),
+ isToday: fullDate === this.date.fullDate,
+ userChecked: false,
+ extraInfo
+ })
+ }
+ return result
+ }
+ /**
+ * 获取本月日期集合
+ */
+ getCurrentMonthDays(amount, dateObj) {
+ const result = []
+ const fullDate = this.date.fullDate
+ for (let i = 1; i <= amount; i++) {
+ const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`
+ const isToday = fullDate === currentDate
+ // 获取打点信息
+ const extraInfo = this.selected && this.selected.find((item) => {
+ if (this.dateEqual(currentDate, item.date)) {
+ return item
+ }
+ })
+
+ // 日期禁用
+ let disableBefore = true
+ let disableAfter = true
+ if (this.startDate) {
+ disableBefore = dateCompare(this.startDate, currentDate)
+ }
+
+ if (this.endDate) {
+ disableAfter = dateCompare(currentDate, this.endDate)
+ }
+
+ let multiples = this.multipleStatus.data
+ let multiplesStatus = -1
+ if (this.range && multiples) {
+ multiplesStatus = multiples.findIndex((item) => {
+ return this.dateEqual(item, currentDate)
+ })
+ }
+ const checked = multiplesStatus !== -1
+
+ result.push({
+ fullDate: currentDate,
+ year: dateObj.year,
+ month: dateObj.month,
+ date: i,
+ multiple: this.range ? checked : false,
+ beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
+ afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
+ disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate,this.endDate)),
+ isToday,
+ userChecked: false,
+ extraInfo
+ })
+ }
+ return result
+ }
+ /**
+ * 获取下一个月日期集合
+ */
+ _getNextMonthDays(amount, dateObj) {
+ const result = []
+ const month = dateObj.month + 1
+ for (let i = 1; i <= amount; i++) {
+ const month = dateObj.month === 12 ? 1 : dateObj.month*1 + 1
+ const year = month === 1 ? dateObj.year + 1 : dateObj.year
+ const fullDate = `${year}-${addZero(month)}-${addZero(i)}`
+ let multiples = this.multipleStatus.data
+ let multiplesStatus = -1
+ if (this.range && multiples) {
+ multiplesStatus = multiples.findIndex((item) => {
+ return this.dateEqual(item, fullDate)
+ })
+ }
+ const checked = multiplesStatus !== -1
+ // 获取打点信息
+ const extraInfo = this.selected && this.selected.find((item) => {
+ if (this.dateEqual(fullDate, item.date)) {
+ return item
+ }
+ })
+ result.push({
+ fullDate,
+ year,
+ date: i,
+ month,
+ multiple: this.range ? checked : false,
+ beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after),
+ afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after),
+ disable: (this.startDate && !dateCompare(this.startDate, fullDate)) || (this.endDate && !dateCompare(fullDate,this.endDate)),
+ isToday: fullDate === this.date.fullDate,
+ userChecked: false,
+ extraInfo
+ })
+ }
+ return result
+ }
+
+ /**
+ * 获取当前日期详情
+ * @param {Object} date
+ */
+ getInfo(date) {
+ if (!date) {
+ date = new Date()
+ }
+
+ return this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate)
+ }
+
+ /**
+ * 比较时间是否相等
+ */
+ dateEqual(before, after) {
+ before = new Date(fixIosDateFormat(before))
+ after = new Date(fixIosDateFormat(after))
+ return before.valueOf() === after.valueOf()
+ }
+
+ /**
+ * 比较真实起始日期
+ */
+
+ isLogicBefore(currentDate, before, after) {
+ let logicBefore = before
+ if (before && after) {
+ logicBefore = dateCompare(before, after) ? before : after
+ }
+ return this.dateEqual(logicBefore, currentDate)
+ }
+
+ isLogicAfter(currentDate, before, after) {
+ let logicAfter = after
+ if (before && after) {
+ logicAfter = dateCompare(before, after) ? after : before
+ }
+ return this.dateEqual(logicAfter, currentDate)
+ }
+
+ /**
+ * 获取日期范围内所有日期
+ * @param {Object} begin
+ * @param {Object} end
+ */
+ geDateAll(begin, end) {
+ var arr = []
+ var ab = begin.split('-')
+ var ae = end.split('-')
+ var db = new Date()
+ db.setFullYear(ab[0], ab[1] - 1, ab[2])
+ var de = new Date()
+ de.setFullYear(ae[0], ae[1] - 1, ae[2])
+ var unixDb = db.getTime() - 24 * 60 * 60 * 1000
+ var unixDe = de.getTime() - 24 * 60 * 60 * 1000
+ for (var k = unixDb; k <= unixDe;) {
+ k = k + 24 * 60 * 60 * 1000
+ arr.push(this.getDateObj(new Date(parseInt(k))).fullDate)
+ }
+ return arr
+ }
+
+ /**
+ * 获取多选状态
+ */
+ setMultiple(fullDate) {
+ if (!this.range) return
+
+ let {
+ before,
+ after
+ } = this.multipleStatus
+ if (before && after) {
+ if (!this.lastHover) {
+ this.lastHover = true
+ return
+ }
+ this.multipleStatus.before = fullDate
+ this.multipleStatus.after = ''
+ this.multipleStatus.data = []
+ this.multipleStatus.fulldate = ''
+ this.lastHover = false
+ } else {
+ if (!before) {
+ this.multipleStatus.before = fullDate
+ this.lastHover = false
+ } else {
+ this.multipleStatus.after = fullDate
+ if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
+ this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus
+ .after);
+ } else {
+ this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus
+ .before);
+ }
+ this.lastHover = true
+ }
+ }
+ this.getWeeks(fullDate)
+ }
+
+ /**
+ * 鼠标 hover 更新多选状态
+ */
+ setHoverMultiple(fullDate) {
+ if (!this.range || this.lastHover) return
+
+ const { before } = this.multipleStatus
+
+ if (!before) {
+ this.multipleStatus.before = fullDate
+ } else {
+ this.multipleStatus.after = fullDate
+ if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
+ this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
+ } else {
+ this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
+ }
+ }
+ this.getWeeks(fullDate)
+ }
+
+ /**
+ * 更新默认值多选状态
+ */
+ setDefaultMultiple(before, after) {
+ this.multipleStatus.before = before
+ this.multipleStatus.after = after
+ if (before && after) {
+ if (dateCompare(before, after)) {
+ this.multipleStatus.data = this.geDateAll(before, after);
+ this.getWeeks(after)
+ } else {
+ this.multipleStatus.data = this.geDateAll(after, before);
+ this.getWeeks(before)
+ }
+ }
+ }
+
+ /**
+ * 获取每周数据
+ * @param {Object} dateData
+ */
+ getWeeks(dateData) {
+ const {
+ year,
+ month,
+ } = this.getDateObj(dateData)
+
+ const preMonthDayAmount = new Date(year, month - 1, 1).getDay()
+ const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData))
+
+ const currentMonthDayAmount = new Date(year, month, 0).getDate()
+ const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData))
+
+ const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount
+ const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData))
+
+ 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]
+ }
+
+ this.calendar = calendarDays
+ this.weeks = weeks
+ }
+}
+
+function getDateTime(date, hideSecond){
+ return `${getDate(date)} ${getTime(date, hideSecond)}`
+}
+
+function getDate(date) {
+ 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}
\ No newline at end of file
diff --git a/uni_modules/uni-datetime-picker/package.json b/uni_modules/uni-datetime-picker/package.json
new file mode 100644
index 0000000..cabb668
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/package.json
@@ -0,0 +1,87 @@
+{
+ "id": "uni-datetime-picker",
+ "displayName": "uni-datetime-picker 日期选择器",
+ "version": "2.2.24",
+ "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
+ "keywords": [
+ "uni-datetime-picker",
+ "uni-ui",
+ "uniui",
+ "日期时间选择器",
+ "日期时间"
+],
+ "repository": "https://github.com/dcloudio/uni-ui",
+ "engines": {
+ "HBuilderX": ""
+ },
+ "directories": {
+ "example": "../../temps/example_temps"
+ },
+"dcloudext": {
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
+ "type": "component-vue"
+ },
+ "uni_modules": {
+ "dependencies": [
+ "uni-scss",
+ "uni-icons"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "n"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ },
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-datetime-picker/readme.md b/uni_modules/uni-datetime-picker/readme.md
new file mode 100644
index 0000000..162fbef
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/readme.md
@@ -0,0 +1,21 @@
+
+
+> `重要通知:组件升级更新 2.0.0 后,支持日期+时间范围选择,组件 ui 将使用日历选择日期,ui 变化较大,同时支持 PC 和 移动端。此版本不向后兼容,不再支持单独的时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)。若仍需使用旧版本,可在插件市场下载*非uni_modules版本*,旧版本将不再维护`
+
+## DatetimePicker 时间选择器
+
+> **组件名:uni-datetime-picker**
+> 代码块: `uDatetimePicker`
+
+
+该组件的优势是,支持**时间戳**输入和输出(起始时间、终止时间也支持时间戳),可**同时选择**日期和时间。
+
+若只是需要单独选择日期和时间,不需要时间戳输入和输出,可使用原生的 picker 组件。
+
+**_点击 picker 默认值规则:_**
+
+- 若设置初始值 value, 会显示在 picker 显示框中
+- 若无初始值 value,则初始值 value 为当前本地时间 Date.now(), 但不会显示在 picker 显示框中
+
+### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
+#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
diff --git a/uni_modules/uni-easyinput/changelog.md b/uni_modules/uni-easyinput/changelog.md
new file mode 100644
index 0000000..765401a
--- /dev/null
+++ b/uni_modules/uni-easyinput/changelog.md
@@ -0,0 +1,97 @@
+## 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)
+
+- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
+- 新增 clear 事件,点击右侧叉号图标触发
+- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
+- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
+
+## 1.0.5(2022-06-07)
+
+- 优化 clearable 显示策略
+
+## 1.0.4(2022-06-07)
+
+- 优化 clearable 显示策略
+
+## 1.0.3(2022-05-20)
+
+- 修复 关闭图标某些情况下无法取消的 bug
+
+## 1.0.2(2022-04-12)
+
+- 修复 默认值不生效的 bug
+
+## 1.0.1(2022-04-02)
+
+- 修复 value 不能为 0 的 bug
+
+## 1.0.0(2021-11-19)
+
+- 优化 组件 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)
+
+## 0.1.4(2021-08-20)
+
+- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
+
+## 0.1.3(2021-08-11)
+
+- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
+
+## 0.1.2(2021-07-30)
+
+- 优化 vue3 下事件警告的问题
+
+## 0.1.1
+
+- 优化 errorMessage 属性支持 Boolean 类型
+
+## 0.1.0(2021-07-13)
+
+- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
+
+## 0.0.16(2021-06-29)
+
+- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
+
+## 0.0.15(2021-06-21)
+
+- 修复 passwordIcon 属性拼写错误的 bug
+
+## 0.0.14(2021-06-18)
+
+- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标
+- 修复 confirmType 属性不生效的问题
+
+## 0.0.13(2021-06-04)
+
+- 修复 disabled 状态可清出内容的 bug
+
+## 0.0.12(2021-05-12)
+
+- 新增 组件示例地址
+
+## 0.0.11(2021-05-07)
+
+- 修复 input-border 属性不生效的问题
+
+## 0.0.10(2021-04-30)
+
+- 修复 ios 遮挡文字、显示一半的问题
+
+## 0.0.9(2021-02-05)
+
+- 调整为 uni_modules 目录规范
+- 优化 兼容 nvue 页面
diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/common.js b/uni_modules/uni-easyinput/components/uni-easyinput/common.js
new file mode 100644
index 0000000..5549cc9
--- /dev/null
+++ b/uni_modules/uni-easyinput/components/uni-easyinput/common.js
@@ -0,0 +1,56 @@
+/**
+ * @desc 函数防抖
+ * @param func 目标函数
+ * @param wait 延迟执行毫秒数
+ * @param immediate true - 立即执行, false - 延迟执行
+ */
+export const debounce = function(func, wait = 1000, immediate = true) {
+ let timer;
+ console.log(1);
+ return function() {
+ console.log(123);
+ let context = this,
+ args = arguments;
+ if (timer) clearTimeout(timer);
+ if (immediate) {
+ let callNow = !timer;
+ timer = setTimeout(() => {
+ timer = null;
+ }, wait);
+ if (callNow) func.apply(context, args);
+ } else {
+ timer = setTimeout(() => {
+ func.apply(context, args);
+ }, wait)
+ }
+ }
+}
+/**
+ * @desc 函数节流
+ * @param func 函数
+ * @param wait 延迟执行毫秒数
+ * @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发
+ */
+export const throttle = (func, wait = 1000, type = 1) => {
+ let previous = 0;
+ let timeout;
+ return function() {
+ let context = this;
+ let args = arguments;
+ if (type === 1) {
+ let now = Date.now();
+
+ if (now - previous > wait) {
+ func.apply(context, args);
+ previous = now;
+ }
+ } else if (type === 2) {
+ if (!timeout) {
+ timeout = setTimeout(() => {
+ timeout = null;
+ func.apply(context, args)
+ }, wait)
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue
new file mode 100644
index 0000000..7f5113e
--- /dev/null
+++ b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue
@@ -0,0 +1,657 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json
new file mode 100644
index 0000000..bd128e1
--- /dev/null
+++ b/uni_modules/uni-easyinput/package.json
@@ -0,0 +1,87 @@
+{
+ "id": "uni-easyinput",
+ "displayName": "uni-easyinput 增强输入框",
+ "version": "1.1.9",
+ "description": "Easyinput 组件是对原生input组件的增强",
+ "keywords": [
+ "uni-ui",
+ "uniui",
+ "input",
+ "uni-easyinput",
+ "输入框"
+],
+ "repository": "https://github.com/dcloudio/uni-ui",
+ "engines": {
+ "HBuilderX": ""
+ },
+ "directories": {
+ "example": "../../temps/example_temps"
+ },
+"dcloudext": {
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
+ "type": "component-vue"
+ },
+ "uni_modules": {
+ "dependencies": [
+ "uni-scss",
+ "uni-icons"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ },
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-easyinput/readme.md b/uni_modules/uni-easyinput/readme.md
new file mode 100644
index 0000000..f1faf8f
--- /dev/null
+++ b/uni_modules/uni-easyinput/readme.md
@@ -0,0 +1,11 @@
+
+
+### Easyinput 增强输入框
+> **组件名:uni-easyinput**
+> 代码块: `uEasyinput`
+
+
+easyinput 组件是对原生input组件的增强 ,是专门为配合表单组件[uni-forms](https://ext.dcloud.net.cn/plugin?id=2773)而设计的,easyinput 内置了边框,图标等,同时包含 input 所有功能
+
+### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
+#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
diff --git a/unpackage/dist/dev/mp-weixin/api/index.js b/unpackage/dist/dev/mp-weixin/api/index.js
index 4f304a3..8491bb6 100644
--- a/unpackage/dist/dev/mp-weixin/api/index.js
+++ b/unpackage/dist/dev/mp-weixin/api/index.js
@@ -7,6 +7,12 @@ const API = {
// 获取token
wx_login: (data, userId) => api_request.net.POST("/user/binding/wechat", data, true, { "userId": userId }),
// 微信登录
+ // upload: (data) => net.POST('/user/upload',data), // 文件上传
+ userinfoUpdae: (data) => api_request.net.PUT("/user/info", data),
+ // 更新用户信息
+ // 首页
+ getHospitalList: (data) => api_request.net.GET("/hospital/list", data),
+ // 获取医院信息
/*
首页信息
*/
diff --git a/unpackage/dist/dev/mp-weixin/api/request.js b/unpackage/dist/dev/mp-weixin/api/request.js
index 0e6ce17..bff5e5e 100644
--- a/unpackage/dist/dev/mp-weixin/api/request.js
+++ b/unpackage/dist/dev/mp-weixin/api/request.js
@@ -4,10 +4,10 @@ const config_index = require("../config/index.js");
const loginUrl = "pages/user/login";
const net = {
REQUEST(url, method = "GET", data, checkLogin = true, header) {
- let token = common_vendor.index.getStorageSync("access_token") || "Basic ZGV20mRldjEyMw==";
+ let token = common_vendor.index.getStorageSync("access_token") || "Basic ZGV2OmRldjEyMw==";
const headers = {
- "Content-Type": "application/json",
- // "Content-Type": "application/x-www-form-urlencoded",
+ // "Content-Type": "application/json",
+ "Content-Type": "application/x-www-form-urlencoded",
"Authorization": token,
"x-token": token,
"token": token
@@ -16,10 +16,6 @@ const net = {
};
var pages = getCurrentPages();
var page = pages[pages.length - 1];
- if (!header) {
- headers["Content-Type"] = "application/x-www-form-urlencode";
- }
- console.log("headers :", headers);
return common_vendor.index.request({
url: config_index.config.baseUrl + url,
method,
diff --git a/unpackage/dist/dev/mp-weixin/app.js b/unpackage/dist/dev/mp-weixin/app.js
index 26f2973..9901132 100644
--- a/unpackage/dist/dev/mp-weixin/app.js
+++ b/unpackage/dist/dev/mp-weixin/app.js
@@ -5,6 +5,7 @@ if (!Math) {
"./pages/index/index.js";
"./pages/wikipedia/index.js";
"./pages/user/index.js";
+ "./pages/login/login.js";
}
const _sfc_main = {
onLaunch: function() {
diff --git a/unpackage/dist/dev/mp-weixin/app.json b/unpackage/dist/dev/mp-weixin/app.json
index 8f785f9..55033ec 100644
--- a/unpackage/dist/dev/mp-weixin/app.json
+++ b/unpackage/dist/dev/mp-weixin/app.json
@@ -2,12 +2,13 @@
"pages": [
"pages/index/index",
"pages/wikipedia/index",
- "pages/user/index"
+ "pages/user/index",
+ "pages/login/login"
],
"window": {
- "navigationBarTextStyle": "black",
+ "navigationBarTextStyle": "white",
"navigationBarTitleText": "uni-app",
- "navigationBarBackgroundColor": "#F8F8F8",
+ "navigationBarBackgroundColor": "#26758d",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
diff --git a/unpackage/dist/dev/mp-weixin/common/vendor.js b/unpackage/dist/dev/mp-weixin/common/vendor.js
index 8fb5b39..b71fcf8 100644
--- a/unpackage/dist/dev/mp-weixin/common/vendor.js
+++ b/unpackage/dist/dev/mp-weixin/common/vendor.js
@@ -29,7 +29,7 @@ function normalizeStyle(value) {
return res;
} else if (isString(value)) {
return value;
- } else if (isObject(value)) {
+ } else if (isObject$1(value)) {
return value;
}
}
@@ -57,7 +57,7 @@ function normalizeClass(value) {
res += normalized + " ";
}
}
- } else if (isObject(value)) {
+ } else if (isObject$1(value)) {
for (const name in value) {
if (value[name]) {
res += name + " ";
@@ -66,6 +66,28 @@ function normalizeClass(value) {
}
return res.trim();
}
+const toDisplayString = (val) => {
+ return isString(val) ? val : val == null ? "" : isArray(val) || isObject$1(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
+};
+const replacer = (_key, val) => {
+ if (val && val.__v_isRef) {
+ return replacer(_key, val.value);
+ } else if (isMap(val)) {
+ return {
+ [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
+ entries[`${key} =>`] = val2;
+ return entries;
+ }, {})
+ };
+ } else if (isSet(val)) {
+ return {
+ [`Set(${val.size})`]: [...val.values()]
+ };
+ } else if (isObject$1(val) && !isArray(val) && !isPlainObject$1(val)) {
+ return String(val);
+ }
+ return val;
+};
const EMPTY_OBJ = Object.freeze({});
const EMPTY_ARR = Object.freeze([]);
const NOOP = () => {
@@ -81,17 +103,17 @@ const remove = (arr, el) => {
arr.splice(i, 1);
}
};
-const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
-const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
+const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
+const hasOwn$1 = (val, key) => hasOwnProperty$2.call(val, key);
const isArray = Array.isArray;
const isMap = (val) => toTypeString(val) === "[object Map]";
const isSet = (val) => toTypeString(val) === "[object Set]";
const isFunction = (val) => typeof val === "function";
const isString = (val) => typeof val === "string";
const isSymbol = (val) => typeof val === "symbol";
-const isObject = (val) => val !== null && typeof val === "object";
+const isObject$1 = (val) => val !== null && typeof val === "object";
const isPromise = (val) => {
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
+ return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
@@ -362,11 +384,96 @@ E.prototype = {
}
};
var E$1 = E;
+const isObject = (val) => val !== null && typeof val === "object";
+const defaultDelimiters = ["{", "}"];
+class BaseFormatter {
+ constructor() {
+ this._caches = /* @__PURE__ */ Object.create(null);
+ }
+ interpolate(message, values, delimiters = defaultDelimiters) {
+ if (!values) {
+ return [message];
+ }
+ let tokens = this._caches[message];
+ if (!tokens) {
+ tokens = parse(message, delimiters);
+ this._caches[message] = tokens;
+ }
+ return compile$1(tokens, values);
+ }
+}
+const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
+const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
+function parse(format, [startDelimiter, endDelimiter]) {
+ const tokens = [];
+ let position = 0;
+ let text = "";
+ while (position < format.length) {
+ let char = format[position++];
+ if (char === startDelimiter) {
+ if (text) {
+ tokens.push({ type: "text", value: text });
+ }
+ text = "";
+ let sub = "";
+ char = format[position++];
+ while (char !== void 0 && char !== endDelimiter) {
+ sub += char;
+ char = format[position++];
+ }
+ const isClosed = char === endDelimiter;
+ const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
+ tokens.push({ value: sub, type });
+ } else {
+ text += char;
+ }
+ }
+ text && tokens.push({ type: "text", value: text });
+ return tokens;
+}
+function compile$1(tokens, values) {
+ const compiled = [];
+ let index2 = 0;
+ const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
+ if (mode === "unknown") {
+ return compiled;
+ }
+ while (index2 < tokens.length) {
+ const token = tokens[index2];
+ switch (token.type) {
+ case "text":
+ compiled.push(token.value);
+ break;
+ case "list":
+ compiled.push(values[parseInt(token.value, 10)]);
+ break;
+ case "named":
+ if (mode === "named") {
+ compiled.push(values[token.value]);
+ } else {
+ {
+ console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
+ }
+ }
+ break;
+ case "unknown":
+ {
+ console.warn(`Detect 'unknown' type of token!`);
+ }
+ break;
+ }
+ index2++;
+ }
+ return compiled;
+}
const LOCALE_ZH_HANS = "zh-Hans";
const LOCALE_ZH_HANT = "zh-Hant";
const LOCALE_EN = "en";
const LOCALE_FR = "fr";
const LOCALE_ES = "es";
+const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
+const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
+const defaultFormatter = new BaseFormatter();
function include(str, parts) {
return !!parts.find((part) => str.indexOf(part) !== -1);
}
@@ -406,6 +513,161 @@ function normalizeLocale(locale, messages) {
return lang;
}
}
+class I18n {
+ constructor({ locale, fallbackLocale, messages, watcher, formater }) {
+ this.locale = LOCALE_EN;
+ this.fallbackLocale = LOCALE_EN;
+ this.message = {};
+ this.messages = {};
+ this.watchers = [];
+ if (fallbackLocale) {
+ this.fallbackLocale = fallbackLocale;
+ }
+ this.formater = formater || defaultFormatter;
+ this.messages = messages || {};
+ this.setLocale(locale || LOCALE_EN);
+ if (watcher) {
+ this.watchLocale(watcher);
+ }
+ }
+ setLocale(locale) {
+ const oldLocale = this.locale;
+ this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
+ if (!this.messages[this.locale]) {
+ this.messages[this.locale] = {};
+ }
+ this.message = this.messages[this.locale];
+ if (oldLocale !== this.locale) {
+ this.watchers.forEach((watcher) => {
+ watcher(this.locale, oldLocale);
+ });
+ }
+ }
+ getLocale() {
+ return this.locale;
+ }
+ watchLocale(fn) {
+ const index2 = this.watchers.push(fn) - 1;
+ return () => {
+ this.watchers.splice(index2, 1);
+ };
+ }
+ add(locale, message, override = true) {
+ const curMessages = this.messages[locale];
+ if (curMessages) {
+ if (override) {
+ Object.assign(curMessages, message);
+ } else {
+ Object.keys(message).forEach((key) => {
+ if (!hasOwn(curMessages, key)) {
+ curMessages[key] = message[key];
+ }
+ });
+ }
+ } else {
+ this.messages[locale] = message;
+ }
+ }
+ f(message, values, delimiters) {
+ return this.formater.interpolate(message, values, delimiters).join("");
+ }
+ t(key, locale, values) {
+ let message = this.message;
+ if (typeof locale === "string") {
+ locale = normalizeLocale(locale, this.messages);
+ locale && (message = this.messages[locale]);
+ } else {
+ values = locale;
+ }
+ if (!hasOwn(message, key)) {
+ console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
+ return key;
+ }
+ return this.formater.interpolate(message[key], values).join("");
+ }
+}
+function watchAppLocale(appVm, i18n) {
+ if (appVm.$watchLocale) {
+ appVm.$watchLocale((newLocale) => {
+ i18n.setLocale(newLocale);
+ });
+ } else {
+ appVm.$watch(() => appVm.$locale, (newLocale) => {
+ i18n.setLocale(newLocale);
+ });
+ }
+}
+function getDefaultLocale() {
+ if (typeof index !== "undefined" && index.getLocale) {
+ return index.getLocale();
+ }
+ if (typeof global !== "undefined" && global.getLocale) {
+ return global.getLocale();
+ }
+ return LOCALE_EN;
+}
+function initVueI18n(locale, messages = {}, fallbackLocale, watcher) {
+ if (typeof locale !== "string") {
+ [locale, messages] = [
+ messages,
+ locale
+ ];
+ }
+ if (typeof locale !== "string") {
+ locale = getDefaultLocale();
+ }
+ if (typeof fallbackLocale !== "string") {
+ fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
+ }
+ const i18n = new I18n({
+ locale,
+ fallbackLocale,
+ messages,
+ watcher
+ });
+ let t2 = (key, values) => {
+ if (typeof getApp !== "function") {
+ t2 = function(key2, values2) {
+ return i18n.t(key2, values2);
+ };
+ } else {
+ let isWatchedAppLocale = false;
+ t2 = function(key2, values2) {
+ const appVm = getApp().$vm;
+ if (appVm) {
+ appVm.$locale;
+ if (!isWatchedAppLocale) {
+ isWatchedAppLocale = true;
+ watchAppLocale(appVm, i18n);
+ }
+ }
+ return i18n.t(key2, values2);
+ };
+ }
+ return t2(key, values);
+ };
+ return {
+ i18n,
+ f(message, values, delimiters) {
+ return i18n.f(message, values, delimiters);
+ },
+ t(key, values) {
+ return t2(key, values);
+ },
+ add(locale2, message, override = true) {
+ return i18n.add(locale2, message, override);
+ },
+ watch(fn) {
+ return i18n.watchLocale(fn);
+ },
+ getLocale() {
+ return i18n.getLocale();
+ },
+ setLocale(newLocale) {
+ return i18n.setLocale(newLocale);
+ }
+ };
+}
function getBaseSystemInfo() {
return wx.getSystemInfoSync();
}
@@ -417,7 +679,7 @@ function validateProtocol(name, data, protocol, onFail) {
onFail = validateProtocolFail;
}
for (const key in protocol) {
- const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn(data, key));
+ const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn$1(data, key));
if (isString(errMsg)) {
onFail(name, errMsg);
}
@@ -474,13 +736,13 @@ function assertType$1(value, type) {
let valid;
const expectedType = getType$1(type);
if (isSimpleType$1(expectedType)) {
- const t = typeof value;
- valid = t === expectedType.toLowerCase();
- if (!valid && t === "object") {
+ const t2 = typeof value;
+ valid = t2 === expectedType.toLowerCase();
+ if (!valid && t2 === "object") {
valid = value instanceof type;
}
} else if (expectedType === "Object") {
- valid = isObject(value);
+ valid = isObject$1(value);
} else if (expectedType === "Array") {
valid = isArray(value);
} else {
@@ -736,7 +998,7 @@ function formatApiArgs(args, options) {
return errMsg;
}
} else {
- if (!hasOwn(params, name)) {
+ if (!hasOwn$1(params, name)) {
params[name] = formatterOrDefaultValue;
}
}
@@ -1104,7 +1366,7 @@ function initWrapper(protocols2) {
argsOption = argsOption(fromArgs, toArgs) || {};
}
for (const key in fromArgs) {
- if (hasOwn(argsOption, key)) {
+ if (hasOwn$1(argsOption, key)) {
let keyOption = argsOption[key];
if (isFunction(keyOption)) {
keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
@@ -1122,7 +1384,7 @@ function initWrapper(protocols2) {
toArgs[key] = processCallback(methodName, callback, returnValue);
}
} else {
- if (!keepFromArgs && !hasOwn(toArgs, key)) {
+ if (!keepFromArgs && !hasOwn$1(toArgs, key)) {
toArgs[key] = fromArgs[key];
}
}
@@ -1140,7 +1402,7 @@ function initWrapper(protocols2) {
return processArgs(methodName, res, returnValue, {}, keepReturnValue);
}
return function wrapper(methodName, method) {
- if (!hasOwn(protocols2, methodName)) {
+ if (!hasOwn$1(protocols2, methodName)) {
return method;
}
const protocol = protocols2[methodName];
@@ -1434,13 +1696,13 @@ function initUni(api, protocols2, platform = wx) {
const wrapper = initWrapper(protocols2);
const UniProxyHandlers = {
get(target, key) {
- if (hasOwn(target, key)) {
+ if (hasOwn$1(target, key)) {
return target[key];
}
- if (hasOwn(api, key)) {
+ if (hasOwn$1(api, key)) {
return promisify(key, api[key]);
}
- if (hasOwn(baseApis, key)) {
+ if (hasOwn$1(baseApis, key)) {
return promisify(key, baseApis[key]);
}
return promisify(key, wrapper(key, platform[key]));
@@ -1941,7 +2203,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
}
const targetIsArray = isArray(target);
if (!isReadonly2) {
- if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
+ if (targetIsArray && hasOwn$1(arrayInstrumentations, key)) {
return Reflect.get(arrayInstrumentations, key, receiver);
}
if (key === "hasOwnProperty") {
@@ -1961,7 +2223,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
if (isRef(res)) {
return targetIsArray && isIntegerKey(key) ? res : res.value;
}
- if (isObject(res)) {
+ if (isObject$1(res)) {
return isReadonly2 ? readonly(res) : reactive(res);
}
return res;
@@ -1985,7 +2247,7 @@ function createSetter(shallow = false) {
return true;
}
}
- const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
+ const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$1(target, key);
const result = Reflect.set(target, key, value, receiver);
if (target === toRaw(receiver)) {
if (!hadKey) {
@@ -1998,7 +2260,7 @@ function createSetter(shallow = false) {
};
}
function deleteProperty(target, key) {
- const hadKey = hasOwn(target, key);
+ const hadKey = hasOwn$1(target, key);
const oldValue = target[key];
const result = Reflect.deleteProperty(target, key);
if (result && hadKey) {
@@ -2315,7 +2577,7 @@ function createInstrumentationGetter(isReadonly2, shallow) {
} else if (key === "__v_raw") {
return target;
}
- return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
+ return Reflect.get(hasOwn$1(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
};
}
const mutableCollectionHandlers = {
@@ -2377,7 +2639,7 @@ function shallowReadonly(target) {
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
}
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
- if (!isObject(target)) {
+ if (!isObject$1(target)) {
{
console.warn(`value cannot be made reactive: ${String(target)}`);
}
@@ -2442,8 +2704,8 @@ function markRaw(value) {
def(value, "__v_skip", true);
return value;
}
-const toReactive = (value) => isObject(value) ? reactive(value) : value;
-const toReadonly = (value) => isObject(value) ? readonly(value) : value;
+const toReactive = (value) => isObject$1(value) ? reactive(value) : value;
+const toReadonly = (value) => isObject$1(value) ? readonly(value) : value;
function trackRefValue(ref2) {
if (shouldTrack && activeEffect) {
ref2 = toRaw(ref2);
@@ -3235,7 +3497,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
}
}
if (!raw && !hasExtends) {
- if (isObject(comp)) {
+ if (isObject$1(comp)) {
cache.set(comp, null);
}
return null;
@@ -3245,7 +3507,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
} else {
extend(normalized, raw);
}
- if (isObject(comp)) {
+ if (isObject$1(comp)) {
cache.set(comp, normalized);
}
return normalized;
@@ -3255,7 +3517,7 @@ function isEmitListener(options, key) {
return false;
}
key = key.slice(2).replace(/Once$/, "");
- return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
+ return hasOwn$1(options, key[0].toLowerCase() + key.slice(1)) || hasOwn$1(options, hyphenate(key)) || hasOwn$1(options, key);
}
let currentRenderingInstance = null;
function setCurrentRenderingInstance(instance) {
@@ -3472,7 +3734,7 @@ function createPathGetter(ctx, path) {
};
}
function traverse(value, seen) {
- if (!isObject(value) || value[
+ if (!isObject$1(value) || value[
"__v_skip"
/* ReactiveFlags.SKIP */
]) {
@@ -3687,7 +3949,7 @@ const publicPropertiesMap = (
})
);
const isReservedPrefix = (key) => key === "_" || key === "$";
-const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
+const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn$1(state, key);
const PublicInstanceProxyHandlers = {
get({ _: instance }, key) {
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -3711,17 +3973,17 @@ const PublicInstanceProxyHandlers = {
} else if (hasSetupBinding(setupState, key)) {
accessCache[key] = 1;
return setupState[key];
- } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
+ } else if (data !== EMPTY_OBJ && hasOwn$1(data, key)) {
accessCache[key] = 2;
return data[key];
} else if (
// only cache other properties when instance has declared (thus stable)
// props
- (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
+ (normalizedProps = instance.propsOptions[0]) && hasOwn$1(normalizedProps, key)
) {
accessCache[key] = 3;
return props[key];
- } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
+ } else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
accessCache[key] = 4;
return ctx[key];
} else if (shouldCacheAccess) {
@@ -3740,12 +4002,12 @@ const PublicInstanceProxyHandlers = {
(cssModule = type.__cssModules) && (cssModule = cssModule[key])
) {
return cssModule;
- } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
+ } else if (ctx !== EMPTY_OBJ && hasOwn$1(ctx, key)) {
accessCache[key] = 4;
return ctx[key];
} else if (
// global properties
- globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
+ globalProperties = appContext.config.globalProperties, hasOwn$1(globalProperties, key)
) {
{
return globalProperties[key];
@@ -3753,7 +4015,7 @@ const PublicInstanceProxyHandlers = {
} else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
// to infinite warning loop
key.indexOf("__v") !== 0)) {
- if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
+ if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$1(data, key)) {
warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`);
} else if (instance === currentRenderingInstance) {
warn(`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`);
@@ -3765,13 +4027,13 @@ const PublicInstanceProxyHandlers = {
if (hasSetupBinding(setupState, key)) {
setupState[key] = value;
return true;
- } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
+ } else if (setupState.__isScriptSetup && hasOwn$1(setupState, key)) {
warn(`Cannot mutate