diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index 5f99f6f..7181f97 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -2,13 +2,23 @@
"version" : "1.0",
"configurations" : [
{
- "playground" : "standard",
+ "playground" : "custom",
"type" : "uni-app:app-ios"
},
{
"customPlaygroundType" : "local",
- "playground" : "standard",
+ "playground" : "custom",
"type" : "uni-app:app-android"
+ },
+ {
+ "app" : {
+ "launchtype" : "remote"
+ },
+ "default" : {
+ "launchtype" : "local"
+ },
+ "provider" : "aliyun",
+ "type" : "uniCloud"
}
]
}
diff --git a/App.vue b/App.vue
index 35e20f9..d01ee49 100644
--- a/App.vue
+++ b/App.vue
@@ -29,19 +29,55 @@
// uni.clearStorageSync();
//以上代码仅在开发时使用,否则会出现不可预知的问题。
- // #ifdef APP-PLUS
+ // #ifdef APP|APP-PLUS
+
+ bleTool.getBleTool();
+
var appid = plus.runtime.appid;
console.log('应用的 appid 为:' + appid);
+
+
+ uni.getPushClientId({
+ success(res) {
+ console.log("推送信息:", res);
+ uni.setStorageSync('push_cid', res.cid);
+ },
+ fail(err) {
+ console.error(err)
+ }
+ });
+ if(!uni.setAppBadgeNumber){//兼容鸿蒙的写法
+ uni.setAppBadgeNumber=plus.runtime.setBadgeNumber;
+ }
+ uni.onPushMessage((res) => {
+ console.log("收到推送消息:", res); //监听推送消息
+ if(res.type=='click'){
+ //将App角标设置为0,清空app在消息中心的所有消息
+ uni.setAppBadgeNumber(0);
+ plus.push.clear();
+ return;
+ }
+ uni.createPushMessage({
+ title: res.data.title,
+ content: res.data.content,
+ payload:res.data.payload
+ });
+
+ });
+
+
+
+
// #endif
},
onShow: function() {
console.log('App Show');
-
+
//将检查更新换到onshow,因为苹果用户喜欢一直挂着
uni.getSystemInfo({
success: function(res) {
if (res.uniPlatform == 'app') {
- bleTool.getBleTool();
+
let appid = plus.runtime.appid;
if (appid !== 'HBuilder') {
console.log("appid=", appid);
@@ -55,7 +91,7 @@
console.log('App Hide');
},
onError(ex) {
- console.error("出现了未知的异常",ex);
+ console.error("出现了未知的异常", ex);
}
}
@@ -152,7 +188,8 @@
.displayNone {
display: none !important;
}
- .visibilityHidden{
+
+ .visibilityHidden {
visibility: hidden !important;
}
diff --git a/androidPrivacy.json b/androidPrivacy.json
index 6e900af..3e91c29 100644
--- a/androidPrivacy.json
+++ b/androidPrivacy.json
@@ -2,7 +2,7 @@
"version" : "1",
"prompt" : "template",
"title" : "服务协议和隐私政策",
- "message" : " 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
你可阅读《服务协议》和《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
+ "message" : " 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
你可阅读《服务协议》和《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意",
"hrefLoader" : "system",
diff --git a/api/6170/callPolice.js b/api/6170/callPolice.js
index 88a5e01..ccbac70 100644
--- a/api/6170/callPolice.js
+++ b/api/6170/callPolice.js
@@ -6,4 +6,8 @@ export function deviceSendAlarmMessage(data) {
method: 'post',
data: data
})
+}
+
+export function deviceDefaultAlarm(data){
+ return Promise.reject(data);
}
\ No newline at end of file
diff --git a/components/MessagePopup/MessagePopup.vue b/components/MessagePopup/MessagePopup.vue
index 46291b3..8f3a628 100644
--- a/components/MessagePopup/MessagePopup.vue
+++ b/components/MessagePopup/MessagePopup.vue
@@ -48,7 +48,7 @@
diff --git a/components/MsgBox/MsgBox.vue b/components/MsgBox/MsgBox.vue
new file mode 100644
index 0000000..77e99f1
--- /dev/null
+++ b/components/MsgBox/MsgBox.vue
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/config/index.js b/config/index.js
index 31d9e3c..d8101c0 100644
--- a/config/index.js
+++ b/config/index.js
@@ -2,7 +2,7 @@
const config = {
// 开发环境
development: {
- BASE_URL: 'http://192.168.2.34:8000',//http://139.224.253.23:8000
+ BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000
API_PREFIX: '',
// MQTT 配置
MQTT_HOST: '47.120.79.150',
diff --git a/manifest.json b/manifest.json
index d9ccd8e..c0b6df4 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"name" : "星汉物联",
"appid" : "__UNI__A21EF43",
"description" : "设备管控",
- "versionName" : "1.0.15",
+ "versionName" : "1.0.18",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
@@ -27,7 +27,8 @@
"Geolocation" : {},
"Maps" : {},
"Record" : {},
- "VideoPlayer" : {}
+ "VideoPlayer" : {},
+ "Push" : {}
},
/* 应用发布信息 */
"distribute" : {
@@ -99,7 +100,8 @@
},
"push" : {
"unipush" : {
- "offline" : false
+ "version" : "2",
+ "offline" : true
}
}
},
@@ -165,7 +167,12 @@
},
"vueVersion" : "2",
"locale" : "zh-Hans",
- "fallbackLocale" : "zh-Hans"
+ "fallbackLocale" : "zh-Hans",
+ "app-harmony" : {
+ "distribute" : {
+ "modules" : {}
+ }
+ }
}
/* 5+App特有相关 */
diff --git a/pages.json b/pages.json
index 8ee4097..8002641 100644
--- a/pages.json
+++ b/pages.json
@@ -414,9 +414,33 @@
{
"navigationBarTitleText" : "录制语音"
}
+ },
+ {
+ "path" : "pages/common/addScan/ScanEquip",
+ "style" :
+ {
+ "navigationBarTitleText" : "扫码",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/addDevice/TypeList",
+ "style": {
+ "navigationBarTitleText": "设备类型"
+ }
+ },
+ {
+ "path": "pages/common/addDevice/addImei",
+ "style": {
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/common/addDevice/addBle",
+ "style": {
+ "navigationBarTitleText": "蓝牙添加设备"
+ }
}
-
-
],
"tabBar": {
diff --git a/pages/018A/HBY018A.vue b/pages/018A/HBY018A.vue
index bcb5419..3d5fb41 100644
--- a/pages/018A/HBY018A.vue
+++ b/pages/018A/HBY018A.vue
@@ -505,7 +505,11 @@
return;
}
if (res.deviceId == these.formData.deviceId) {
- this.formData.bleStatu = false;
+ if(res.device){
+ these.formData.bleStatu = 'connecting';
+ }else{
+ this.formData.bleStatu = false;
+ }
setTimeout(() => {
hideLoading(these, 1000);
});
diff --git a/pages/100/HBY100.vue b/pages/100/HBY100.vue
index eff28dd..ea99012 100644
--- a/pages/100/HBY100.vue
+++ b/pages/100/HBY100.vue
@@ -57,9 +57,9 @@
蓝牙名称
{{device.bluetoothName}}
-
+
蓝牙状态
- {{formData.bleStatu?'已连接':'未连接'}}
+ {{getbleStatu}}
@@ -58,9 +55,9 @@
蓝牙名称
{{device.bluetoothName}}
-
+
蓝牙状态
- {{formData.bleStatu?'已连接':'未连接'}}
+ {{getbleStatu}}
设备状态
@@ -550,7 +547,8 @@
these.formData['imei'] = these.device.deviceImei;
}
these.getDetail();
- these.formData.bleStatu = false;
+
+ these.formData.bleStatu='connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
});
@@ -567,9 +565,49 @@
ble.removeReceiveCallback(pagePath);
},
computed: {
-
+ getbleStatu(){
+ if(this.formData.bleStatu===true){
+ return '已连接';
+ }
+ if(this.formData.bleStatu==='connecting'){
+ return '连接中';
+ }
+ if(this.formData.bleStatu==='dicconnect'){
+ return '正在断开';
+ }
+ if(this.formData.bleStatu==='err'){
+ return '连接异常';
+ }
+ return '未连接';
+ }
},
methods: {
+ bleStatuToggle(){
+ let f=this.getDevice();
+ if(!f){
+ this.showBleUnConnect();
+ return;
+ }
+ if(this.formData.bleStatu===true){
+ this.formData.bleStatu='dicconnect';
+ ble.disconnectDevice(f.deviceId).finally(r=>{
+ this.formData.bleStatu=false;
+ });
+ return;
+ }
+
+ if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
+ this.formData.bleStatu='connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ these.formData.bleStatu = true;
+ }).catch(ex=>{
+ these.formData.bleStatu = 'err';
+ });
+ return;
+ }
+
+
+ },
prevPage() {
uni.navigateBack({
@@ -596,7 +634,11 @@
return;
}
if (res.deviceId == these.formData.deviceId) {
- this.formData.bleStatu = false;
+ if(res.device){
+ these.formData.bleStatu = 'connecting';
+ }else{
+ this.formData.bleStatu = false;
+ }
setTimeout(() => {
hideLoading(these, 1000);
});
@@ -629,6 +671,7 @@
showLoading(this, {
text: "蓝牙恢复可用,正在连接设备"
});
+ this.formData.bleStatu='connecting';
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
updateLoading(these, {
@@ -1848,7 +1891,7 @@
these.Status.BottomMenu.show = false;
these.picPath = data.picPath;
- these.rgb565Data = ble.convertToRGB565(data.piexls);
+ these.rgb565Data = Common.convertToRGB565(data.piexls);
setTimeout(function() {
sendImagePackets().catch(() => {
diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue
index 924123d..24d67ff 100644
--- a/pages/7305/BJQ7305.vue
+++ b/pages/7305/BJQ7305.vue
@@ -9,16 +9,16 @@
-
+
{{item.math>9?'9+':item.math}}
-
+
-
+
-
+
@@ -60,9 +60,9 @@
-
+
蓝牙状态
- {{formData.bleStatu?'已连接':'未连接'}}
+ {{getbleStatu}}
@@ -182,7 +182,7 @@
updateLoading
} from '@/utils/loading.js'
import BleReceive from '@/utils/BleReceive';
-import Common from '@/utils/Common.js';
+ import Common from '@/utils/Common.js';
var ble = null;
var these = null;
@@ -201,10 +201,10 @@ import Common from '@/utils/Common.js';
icons: [{
src: '/static/images/common/shape.png',
callback: this.gotoShare,
- apiType:'listA'
+ apiType: 'listA'
}],
title: 'BJQ6155'
-
+
},
pageHide: false,
Pop: {
@@ -320,8 +320,8 @@ import Common from '@/utils/Common.js';
let device = data.data;
these.device = device;
-these.Status.apiType = data.apiType;
- these.Status.navbar.title=device.deviceName;
+ these.Status.apiType = data.apiType;
+ these.Status.navbar.title = device.deviceName;
if (data.apiType !== 'listA') {
Common.getdeviceShareId(data.data.id).then(res => {
if (res.code == 200) {
@@ -358,7 +358,7 @@ these.Status.apiType = data.apiType;
these.formData.id = device.id;
these.formData.deviceId = f.deviceId;
- these.formData.bleStatu = false;
+ these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
console.log("连接成功")
these.formData.bleStatu = true;
@@ -378,21 +378,20 @@ these.Status.apiType = data.apiType;
this.Status.pageHide = false;
},
computed: {
- RSSIRemark: function() {
- let remark = '极弱';
- if (this.formData.RSSI <= 0 && this.formData.RSSI >= -30) {
- remark = '强';
+ getbleStatu() {
+ if (this.formData.bleStatu === true) {
+ return '已连接';
}
-
- if (this.formData.RSSI < -30 && this.formData.RSSI >= -60) {
- remark = '一般';
+ if (this.formData.bleStatu === 'connecting') {
+ return '连接中';
}
- if (this.formData.RSSI < -60 && this.formData.RSSI >= -85) {
- remark = '弱';
+ if (this.formData.bleStatu === 'dicconnect') {
+ return '正在断开';
}
- if (this.formData.RSSI < -85 && this.formData.RSSI >= -100) {
- remark = '微弱';
+ if (this.formData.bleStatu === 'err') {
+ return '连接异常';
}
+ return '未连接';
},
getMode() {
let txt = "关闭";
@@ -425,6 +424,32 @@ these.Status.apiType = data.apiType;
}
},
methods: {
+ bleStatuToggle() {
+ let f = this.getDevice();
+ if (!f) {
+ this.showBleUnConnect();
+ return;
+ }
+ if (this.formData.bleStatu === true) {
+ this.formData.bleStatu = 'dicconnect';
+ ble.disconnectDevice(f.deviceId).finally(r => {
+ this.formData.bleStatu = false;
+ });
+ return;
+ }
+
+ if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
+ these.formData.bleStatu = 'connecting';
+ ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
+ these.formData.bleStatu = true;
+ }).catch(ex => {
+ these.formData.bleStatu = 'err';
+ });
+ return;
+ }
+
+
+ },
handleRightClick(item, s) {
if (item && item.callback) {
item.callback(item, s);
@@ -432,7 +457,7 @@ these.Status.apiType = data.apiType;
uni.showModal({
content: '敬请期待'
})
-
+
}
},
navigatorBack() {
@@ -477,7 +502,12 @@ these.Status.apiType = data.apiType;
return;
}
if (res.deviceId == these.formData.deviceId) {
- this.formData.bleStatu = false;
+ if (res.device) {
+ these.formData.bleStatu = 'connecting';
+ } else {
+ this.formData.bleStatu = false;
+ }
+
// 断开连接时先将充电状态复位,避免保持旧值
this.formData.statu = '未充电';
this.setBleFormData();
@@ -513,6 +543,7 @@ these.Status.apiType = data.apiType;
showLoading(this, {
text: "蓝牙恢复可用,正在连接设备"
});
+ these.formData.bleStatu = 'connecting';
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
updateLoading(these, {
@@ -554,9 +585,9 @@ these.Status.apiType = data.apiType;
if (this.Status.pageHide) {
return;
}
-
+
let json = recei.ReceiveData(receive, device, path, recArr);
- console.log("收到消息:",receive.hexs);
+ console.log("收到消息:", receive.hexs);
if (!json) {
return;
}
@@ -590,7 +621,7 @@ these.Status.apiType = data.apiType;
proParam: function() {
uni.navigateTo({
- url: '/pages/common/productDes/index?id=' + this.formData.id,
+ url: '/pages/common/productDes/index?id=' + this.device.id,
success(ev) {
}
@@ -598,7 +629,7 @@ these.Status.apiType = data.apiType;
},
handRemark: function() {
uni.navigateTo({
- url: '/pages/common/operatingInstruct/index?id=' + this.formData.id,
+ url: '/pages/common/operatingInstruct/index?id=' + this.device.id,
success(ev) {
}
@@ -606,7 +637,7 @@ these.Status.apiType = data.apiType;
},
handVideo: function() {
uni.navigateTo({
- url: '/pages/common/operationVideo/index?id=' + this.formData.id,
+ url: '/pages/common/operationVideo/index?id=' + this.device.id,
success(ev) {
}
@@ -887,7 +918,7 @@ these.Status.apiType = data.apiType;
},
UploadOpenImg: function() {
if (!this.permissions.includes('3') && this.Status.apiType !== 'listA') {
-
+
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
@@ -898,7 +929,7 @@ these.Status.apiType = data.apiType;
})
return;
}
-
+
//上传开机画面
this.Status.BottomMenu.menuItems = [];
this.Status.BottomMenu.title = "上传开机画面";
@@ -906,7 +937,7 @@ these.Status.apiType = data.apiType;
this.Status.BottomMenu.show = true;
},
ModeSetting: function(type) {
-if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
+ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
this.showPop({
message: '无操作权限',
@@ -1151,7 +1182,7 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
},
sendUsr() {
if (!this.permissions.includes('4') && this.Status.apiType !== 'listA') {
-
+
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
@@ -1366,7 +1397,7 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
//给蓝牙设备发送信号更新亮度
BrighInteval = setTimeout(() => {
if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
-
+
this.showPop({
message: '无操作权限',
iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
@@ -1377,7 +1408,7 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
})
return;
}
-
+
this.sendBrightness();
this.setBleFormData();
}, 100);
@@ -1896,27 +1927,27 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
left: -99999rpx;
visibility: hidden;
}
-
-
+
+
.navbarRight {
width: 40px;
height: 100%;
-
+
}
-
+
.navbarRight .imgContent {
width: 36rpx;
height: 36rpx;
position: relative;
}
-
+
.navbarRight .imgContent:first-child {
-
+
width: 38rpx !important;
height: 38rpx !important;
margin-top: -2rpx;
}
-
+
.navbarRight .imgContent .baber {
position: absolute;
z-index: 100;
@@ -1932,33 +1963,33 @@ if (!this.permissions.includes('1') && this.Status.apiType !== 'listA') {
font-style: Regular;
font-size: 20rpx;
font-weight: 400;
-
+
text-align: center;
overflow: hidden;
white-space: nowrap;
-
+
}
-
+
.navbarRight .imgContent .img {
width: 100%;
height: 100%;
-
+
box-sizing: border-box;
position: relative;
}
-
+
.navbarRight .imgContent .img:last-child {
padding: 1rpx;
}
-
+
.nvbar {
top: 0px;
}
-
+
/deep/ .uni-navbar--fixed {
top: 0px;
}
-
+
.uninavebartext {
width: 100%;
font-size: 32rpx;
diff --git a/pages/common/addBLE/addEquip.vue b/pages/common/addBLE/addEquip.vue
index 9d89df0..371aca4 100644
--- a/pages/common/addBLE/addEquip.vue
+++ b/pages/common/addBLE/addEquip.vue
@@ -481,7 +481,10 @@
}
plus.android.requestPermissions(
- ['android.permission.BLUETOOTH','android.permission.BLUETOOTH_ADMIN','android.permission.ACCESS_FINE_LOCATION','android.permission.ACCESS_COARSE_LOCATION'],
+ ['android.permission.BLUETOOTH', 'android.permission.BLUETOOTH_ADMIN',
+ 'android.permission.ACCESS_FINE_LOCATION',
+ 'android.permission.ACCESS_COARSE_LOCATION'
+ ],
(result) => {
if (result.granted && result.granted.length > 0) {
console.log('定位权限已授予');
@@ -533,22 +536,24 @@
return;
}
}
- showLoading(these,{text:'正在刷新'})
+ showLoading(these, {
+ text: '正在刷新'
+ })
let time = null;
let startSearch = () => {
-
- if(time!==null){
- clearTimeout(time);
+
+ if (time !== null) {
+ clearTimeout(time);
}
-
+
time = setTimeout(() => {
these.EquipMents = [];
these.PairEquip = [];
ble.StartSearch().then(result => {
- console.log("开始搜索成功",result);
-
- }).catch(err => {
+ console.log("开始搜索成功", result);
+
+ }).catch(err => {
console.error("开始搜索失败:", err);
if (err.code === 10001) {
these.showOpenSetting();
@@ -557,9 +562,9 @@
title: '提示',
content: '出现错误:' + err.msg
});
-
+
}
- }).finally(()=>{
+ }).finally(() => {
hideLoading(these);
});
}, 200);
@@ -905,11 +910,11 @@
position: absolute;
border-radius: 50%;
background-color: #bbe60033;
- animation: expand 4s infinite ease-out;
+
display: inline-block;
transform: translate(-50%, -50%);
border: 1rpx solid #bbe6003d;
- animation: expand 5s infinite ease-in-out;
+ animation: expand 4s infinite ease-in-out;
}
.circle:nth-child(2) {
@@ -927,17 +932,16 @@
opacity: 0.8;
}
- 80% {
- width: 18.75rem;
- height: 18.75rem;
- opacity: 0.2;
+ 90% {
+ width: 18rem;
+ height: 18rem;
+ opacity: 0;
}
100% {
-
- width: 0.5rem;
- height: 0.5rem;
- opacity: 0.5;
+ width: 0rem;
+ height: 0rem;
+ opacity: 0;
}
}
diff --git a/pages/common/addDevice/TypeList.vue b/pages/common/addDevice/TypeList.vue
new file mode 100644
index 0000000..2633fa4
--- /dev/null
+++ b/pages/common/addDevice/TypeList.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item['typeName']}}
+
+ ({{(item['communicationMode']=='0' || item['communicationMode']===0)?'4G':(item['communicationMode']===1|| item['communicationMode']==='1')?'蓝牙':'蓝牙&4G'}})
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/addDevice/addBle.vue b/pages/common/addDevice/addBle.vue
new file mode 100644
index 0000000..0063bf4
--- /dev/null
+++ b/pages/common/addDevice/addBle.vue
@@ -0,0 +1,1296 @@
+
+
+
+
+
+
+
+ 搜不到设备时,请尝试重启蓝牙,或重启App后重试。
+
+
+
+ 添加:{{type.typeName}} 设备数量:{{devicesCnt}}
+ 刷新
+
+
+
+
+
+
+ 蓝牙设备列表
+
+
+ {{SearchEquips.length}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 蓝牙名:{{item.name?item.name:'Unnamed'}}
+ {{item.link?'已连接':'未连接'}}
+
+
+ Mac:
+ {{item.macAddress}}
+
+
+
+
+
+
+
+ IMEI:
+ {{item.imei}}
+
+
+
+
+
+
+
+ 信号:{{item.RSSI}}dBm
+
+ 状态:
+ {{item.remark}}
+
+
+ 设备名:
+ {{item.device_name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/addDevice/addImei.vue b/pages/common/addDevice/addImei.vue
new file mode 100644
index 0000000..1b91ae7
--- /dev/null
+++ b/pages/common/addDevice/addImei.vue
@@ -0,0 +1,507 @@
+
+
+
+
+
+
+
+
+ {{Status.navbar.title}}
+
+
+
+
+
+ {{item.math>9?'9+':item.math}}
+
+
+
+
+
+
+
+
+
+
+
+ 扫码或输入IMEI,以添加设备
+ IMEI列表:
+
+
+ IMEI:{{item.imei}}
+ Mac:{{item.mac}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/addScan/ScanEquip.vue b/pages/common/addScan/ScanEquip.vue
new file mode 100644
index 0000000..aa323f8
--- /dev/null
+++ b/pages/common/addScan/ScanEquip.vue
@@ -0,0 +1,396 @@
+
+
+
+
+
+
+
+ {{Status.navbar.title}}
+
+
+
+
+
+ {{item.math>9?'9+':item.math}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 对准二维码进行扫描
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/allShare/index.vue b/pages/common/allShare/index.vue
index 5da6725..02ff8d3 100644
--- a/pages/common/allShare/index.vue
+++ b/pages/common/allShare/index.vue
@@ -147,7 +147,7 @@
// 页面跳转成功后的回调函数
res.eventChannel.emit('detailData', {
data: item,
- apiType: 'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
+ apiType:this.activeTab===0?'listA':'listB' // 自定义标识 // 自定义标识,详情哪里根据这个参数不同信息
});
}
})
diff --git a/pages/common/audioManager/AudioList.vue b/pages/common/audioManager/AudioList.vue
index 883141f..1015b47 100644
--- a/pages/common/audioManager/AudioList.vue
+++ b/pages/common/audioManager/AudioList.vue
@@ -91,9 +91,9 @@
-
+
@@ -216,16 +216,16 @@
statu: "", //状态,是否公开
isApply: "" //是否使用中
- },
- cPlay: {
- Id: "", //编号
- name: "", //名称
- createTime: "", //创建时间
- localPath: "", //本地地址
- webPath: "", //网络地址
- statu: "", //状态,是否公开
- isApply: "" //是否使用中
- }
+ }//,
+ // cPlay: {
+ // Id: "", //编号
+ // name: "", //名称
+ // createTime: "", //创建时间
+ // localPath: "", //本地地址
+ // webPath: "", //网络地址
+ // statu: "", //状态,是否公开
+ // isApply: "" //是否使用中
+ // }
}
},
onLoad() {
diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue
index 4db99e0..7c19474 100644
--- a/pages/common/index/index.vue
+++ b/pages/common/index/index.vue
@@ -116,7 +116,7 @@
-
+
{{ item.text }}
@@ -243,9 +243,9 @@ import BleReceive from '@/utils/BleReceive';
// 底部 footer 高度约 220rpx + 120rpx = 340rpx,转换为 px(1rpx = sysInfo.pixelRatio / 750 * 屏幕宽度?不,直接用 rpx 转 px 公式)
let footerHeight = 340 * (sysInfo.screenWidth / 750); // rpx 转 px
- console.log("footerHeight=", footerHeight);
+ // console.log("footerHeight=", footerHeight);
this.mescrollHeight = sysInfo.screenHeight - footerHeight;
- console.log("mescrollHeight=", this.mescrollHeight);
+ // console.log("mescrollHeight=", this.mescrollHeight);
},
mescrollInit(mescroll) {
this.mescroll = mescroll;
@@ -253,7 +253,7 @@ import BleReceive from '@/utils/BleReceive';
// 下拉刷新
downCallback() {
- console.log("下拉加载")
+
if (this.mescroll) {
this.mescroll.resetUpScroll(false);
this.mescroll.scrollTo(0, 0);
@@ -265,7 +265,7 @@ import BleReceive from '@/utils/BleReceive';
// 上拉加载
upCallback() {
- console.log("上拉加载")
+
this.getData();
},
@@ -414,7 +414,7 @@ import BleReceive from '@/utils/BleReceive';
getData() {
var task = () => {
- console.error("正在加载第" + this.mescroll.num + "页数据");
+
return new Promise((resolve, reject) => {
let data = {
pageNum: this.mescroll.num,
@@ -497,60 +497,21 @@ import BleReceive from '@/utils/BleReceive';
switch (item.action) {
case 'scan':
// 扫一扫
- uni.scanCode({
- autoDecodeCharset:true,
- autoZoom:true,
- barCodeInput:true,
- success: (res) => {
- console.log('条码内容:', res);
- // 清除之前的数据
- this.previousScanResult = null;
- // 处理新的扫码结果
- const cleanedResult = res.result.trim();
- console.log('扫码结果:', cleanedResult);
- let url =
- `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`;
- try {
- let json = JSON.parse(cleanedResult);
- if ('imei' in json) {
- url =
- `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(json.imei)}`;
- } else if ('blue' in json || 'ble' in json) {
- if(json.ble){
- json.blue=json.ble;
- }
- if(json.blue){
- if (!json.blue.includes(':')) {
- json.blue = json.blue.replace(
- /(.{2})/g, '$1:')
- .slice(0, -1)
- }
- }
-
- url =`/pages/common/addBLE/LinkBle?mac=${encodeURIComponent(json.blue)}`;
- }
- } catch (ex) {
-
- }
- // 跳转并传递扫描结果
- uni.navigateTo({
- url: url
- });
- },
- fail: (err) => {
- console.log('扫码失败', err);
- uni.showToast({
- title: '扫码失败',
- icon: 'none'
- });
- }
+ uni.navigateTo({
+ url:'/pages/common/addScan/ScanEquip'
});
+
break;
case 'bluetooth':
uni.navigateTo({
url: "/pages/common/addBLE/addEquip"
})
break;
+ case "add":
+ uni.navigateTo({
+ url: "/pages/common/addDevice/TypeList"
+ })
+ break;
}
},
// 右滑点击事件处理
@@ -765,9 +726,11 @@ import BleReceive from '@/utils/BleReceive';
},
onLoad() {
- console.error("首页加载");
+ // console.error("首页加载");
this.getTab()
this.downCallback();
+
+
// 绑定页面做了监听,新增成功,刷新页面
uni.$on('refreshDeviceList', () => {
this.getTab() // 刷新数据
@@ -810,7 +773,15 @@ import BleReceive from '@/utils/BleReceive';
recei.ReceiveData(receive, device, path, recArr);
this.updateBleStatu();
}, pagePath);
-
+
+ let phone=uni.getStorageSync("phone");
+ if(phone==='17671332251'){//先写死方便自己使用,后面按人员权限区分
+ this.menuItems.push({
+ text: '上报设备',
+ icon: '/static/images/common/add.png',
+ action: 'add'
+ });
+ }
this.getSystemInfoSyncH();
},
diff --git a/pages/common/login/index.vue b/pages/common/login/index.vue
index ad40230..546e8c9 100644
--- a/pages/common/login/index.vue
+++ b/pages/common/login/index.vue
@@ -92,7 +92,7 @@
}
let currTime = new Date().getTime();
if (currTime < time) {
- console.log("登陆过,并且没过期,自动进入设备页");
+ // console.log("登陆过,并且没过期,自动进入设备页");
uni.switchTab({
url: '/pages/common/index/index'
});
diff --git a/pages/common/shareDevices/index.vue b/pages/common/shareDevices/index.vue
index a994a7b..55bbeca 100644
--- a/pages/common/shareDevices/index.vue
+++ b/pages/common/shareDevices/index.vue
@@ -147,6 +147,19 @@
});
return false;
}
+ else{
+ let phone= uni.getStorageSync('phone');
+ if(phone==phoneNumber){
+ uni.showToast({
+ title: '手机号不能是自己账号',
+ icon: 'none',
+ duration: 1000
+ });
+ return false;
+ }
+ }
+
+
try {
await deviceShareCode({
phonenumber: this.phone
diff --git a/static/images/common/scan.png b/static/images/common/scan.png
index 93e40fe..591d48f 100644
Binary files a/static/images/common/scan.png and b/static/images/common/scan.png differ
diff --git a/static/images/common/warning.png b/static/images/common/warning.png
new file mode 100644
index 0000000..fd4fce9
Binary files /dev/null and b/static/images/common/warning.png differ
diff --git a/uniCloud-aliyun/cloudfunctions/push/index.js b/uniCloud-aliyun/cloudfunctions/push/index.js
new file mode 100644
index 0000000..484c04b
--- /dev/null
+++ b/uniCloud-aliyun/cloudfunctions/push/index.js
@@ -0,0 +1,16 @@
+// 简单的使用示例
+'use strict';
+const uniPush = uniCloud.getPushManager({appId:"__UNI__A21EF43"});
+exports.main = async (event, context) => {
+ let body=JSON.parse(event.body);
+ let push_clientid=body.push_clientid;
+ let title=body.title;
+ let content=body.content;
+ let payload=body.payload;
+ return await uniPush.sendMessage({
+ "push_clientid": push_clientid,
+ "title": title?title:"消息",
+ "content": content?content:"消息通知",
+ "payload":payload
+ })
+};
diff --git a/uniCloud-aliyun/cloudfunctions/push/package.json b/uniCloud-aliyun/cloudfunctions/push/package.json
new file mode 100644
index 0000000..e5da2aa
--- /dev/null
+++ b/uniCloud-aliyun/cloudfunctions/push/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "push",
+ "dependencies": {
+ "uni-config-center": "file:../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center",
+ "uni-id-common": "file:../../../uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common",
+ "uni-open-bridge-common": "file:../../../uni_modules/uni-open-bridge-common/uniCloud/cloudfunctions/common/uni-open-bridge-common"
+ },
+ "extensions": {
+ "uni-cloud-push": {}
+ }
+}
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/JQL查询.jql b/uniCloud-aliyun/database/JQL查询.jql
new file mode 100644
index 0000000..0dab697
--- /dev/null
+++ b/uniCloud-aliyun/database/JQL查询.jql
@@ -0,0 +1,12 @@
+// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理
+// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法
+// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码
+// 如果文档中存在多条JQL语句,只有最后一条语句生效
+// 如果混写了普通js,最后一条语句需是数据库操作语句
+// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission
+// 不支持clientDB的action
+// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database.html#limit
+// 详细JQL语法,请参考:https://uniapp.dcloud.net.cn/uniCloud/jql.html
+
+// 下面示例查询uni-id-users表的所有数据
+db.collection('JqUsrClent').get();
diff --git a/uniCloud-aliyun/database/jq-usr-device.schema.json b/uniCloud-aliyun/database/jq-usr-device.schema.json
new file mode 100644
index 0000000..fcc5a8b
--- /dev/null
+++ b/uniCloud-aliyun/database/jq-usr-device.schema.json
@@ -0,0 +1,24 @@
+// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
+{
+ "bsonType": "object",
+ "required": [],
+ "permission": {
+ "read": true,
+ "create": true,
+ "update": true,
+ "delete": true
+ },
+ "properties": {
+ "_id": {
+ "description": "ID,系统自动生成"
+ },
+ "phone":{
+ "bsonType": "string",
+ "description": "用户手机号"
+ },
+ "pushcid":{
+ "bsonType": "string",
+ "description": "用户的推送cid"
+ }
+ }
+}
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/opendb-device.index.json b/uniCloud-aliyun/database/opendb-device.index.json
new file mode 100644
index 0000000..e74d962
--- /dev/null
+++ b/uniCloud-aliyun/database/opendb-device.index.json
@@ -0,0 +1,14 @@
+[
+ {
+ "IndexName": "index_device_id",
+ "MgoKeySchema": {
+ "MgoIndexKeys": [
+ {
+ "Name": "device_id",
+ "Direction": "1"
+ }
+ ],
+ "MgoIsUnique": true
+ }
+ }
+]
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/opendb-device.schema.json b/uniCloud-aliyun/database/opendb-device.schema.json
new file mode 100644
index 0000000..3143026
--- /dev/null
+++ b/uniCloud-aliyun/database/opendb-device.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"},"appid":{"bsonType":"string","description":"DCloud appid"},"device_id":{"bsonType":"string","description":"设备唯一标识"},"vendor":{"bsonType":"string","description":"设备厂商"},"push_clientid":{"bsonType":"string","description":"推送设备客户端标识"},"imei":{"bsonType":"string","description":"国际移动设备识别码IMEI(International Mobile Equipment Identity)"},"oaid":{"bsonType":"string","description":"移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"},"idfa":{"bsonType":"string","description":"iOS平台配置应用使用广告标识(IDFA)"},"imsi":{"bsonType":"string","description":"国际移动用户识别码(International Mobile Subscriber Identification Number)"},"model":{"bsonType":"string","description":"设备型号"},"platform":{"bsonType":"string","description":"平台类型"},"uni_platform":{"bsonType":"string","description":"uni-app 运行平台,与条件编译平台相同。"},"os_name":{"bsonType":"string","description":"ios|android|windows|mac|linux "},"os_version":{"bsonType":"string","description":"操作系统版本号 "},"os_language":{"bsonType":"string","description":"操作系统语言 "},"os_theme":{"bsonType":"string","description":"操作系统主题 light|dark"},"pixel_ratio":{"bsonType":"string","description":"设备像素比 "},"network_model":{"bsonType":"string","description":"设备网络型号wifi\/3G\/4G\/"},"window_width":{"bsonType":"string","description":"设备窗口宽度 "},"window_height":{"bsonType":"string","description":"设备窗口高度"},"screen_width":{"bsonType":"string","description":"设备屏幕宽度"},"screen_height":{"bsonType":"string","description":"设备屏幕高度"},"rom_name":{"bsonType":"string","description":"rom 名称"},"rom_version":{"bsonType":"string","description":"rom 版本"},"location_latitude":{"bsonType":"double","description":"纬度"},"location_longitude":{"bsonType":"double","description":"经度"},"location_country":{"bsonType":"string","description":"国家"},"location_province":{"bsonType":"string","description":"省份"},"location_city":{"bsonType":"string","description":"城市"},"create_date":{"bsonType":"timestamp","description":"创建时间","forceDefaultValue":{"$env":"now"}},"last_update_date":{"bsonType":"timestamp","description":"最后一次修改时间","forceDefaultValue":{"$env":"now"}}},"version":"0.0.1"}
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/opendb-tempdata.schema.json b/uniCloud-aliyun/database/opendb-tempdata.schema.json
new file mode 100644
index 0000000..f7a9a3b
--- /dev/null
+++ b/uniCloud-aliyun/database/opendb-tempdata.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":["value","expired"],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"},"value":{"description":"值"},"expired":{"description":"过期时间","bsonType":"timestamp"}},"version":"0.0.1"}
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/uni-id-device.index.json b/uniCloud-aliyun/database/uni-id-device.index.json
new file mode 100644
index 0000000..a0e74a7
--- /dev/null
+++ b/uniCloud-aliyun/database/uni-id-device.index.json
@@ -0,0 +1,38 @@
+[
+ {
+ "IndexName": "device_id",
+ "MgoKeySchema": {
+ "MgoIndexKeys": [
+ {
+ "Name": "device_id",
+ "Direction": "1"
+ }
+ ],
+ "MgoIsUnique": false
+ }
+ },
+ {
+ "IndexName": "oaid",
+ "MgoKeySchema": {
+ "MgoIndexKeys": [
+ {
+ "Name": "oaid",
+ "Direction": "1"
+ }
+ ],
+ "MgoIsUnique": false
+ }
+ },
+ {
+ "IndexName": "imei",
+ "MgoKeySchema": {
+ "MgoIndexKeys": [
+ {
+ "Name": "imei",
+ "Direction": "1"
+ }
+ ],
+ "MgoIsUnique": false
+ }
+ }
+]
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/uni-id-device.schema.json b/uniCloud-aliyun/database/uni-id-device.schema.json
new file mode 100644
index 0000000..dd47958
--- /dev/null
+++ b/uniCloud-aliyun/database/uni-id-device.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":["user_id"],"properties":{"_id":{"description":"ID,系统自动生成"},"user_id":{"bsonType":"string","description":"用户id,参考uni-id-users表"},"ua":{"bsonType":"string","description":"userAgent"},"uuid":{"bsonType":"string","description":"设备唯一标识(需要加密存储)"},"os_name":{"bsonType":"string","description":"ios|android|windows|mac|linux "},"os_version":{"bsonType":"string","description":"操作系统版本号 "},"os_language":{"bsonType":"string","description":"操作系统语言 "},"os_theme":{"bsonType":"string","description":"操作系统主题 light|dark"},"vendor":{"bsonType":"string","description":"设备厂商"},"push_clientid":{"bsonType":"string","description":"推送设备客户端标识"},"device_id":{"bsonType":"string","description":"设备id"},"imei":{"bsonType":"string","description":"国际移动设备识别码IMEI(International Mobile Equipment Identity)"},"oaid":{"bsonType":"string","description":"移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"},"idfa":{"bsonType":"string","description":"iOS平台配置应用使用广告标识(IDFA)"},"model":{"bsonType":"string","description":"设备型号"},"platform":{"bsonType":"string","description":"平台类型"},"create_date":{"bsonType":"timestamp","description":"创建时间","forceDefaultValue":{"$env":"now"}},"last_active_date":{"bsonType":"timestamp","description":"最后登录时间"},"last_active_ip":{"bsonType":"string","description":"最后登录IP"}},"version":"0.0.1"}
\ No newline at end of file
diff --git a/uniCloud-aliyun/database/uni-push-message.schema.json b/uniCloud-aliyun/database/uni-push-message.schema.json
new file mode 100644
index 0000000..459db83
--- /dev/null
+++ b/uniCloud-aliyun/database/uni-push-message.schema.json
@@ -0,0 +1 @@
+{"bsonType":"object","required":[],"permission":{"read":true,"create":false,"update":"doc.user_id == auth.uid","delete":false},"properties":{"_id":{"description":"ID,系统自动生成"},"is_read":{"bsonType":"bool","defaultValue":false},"payload":{"state":[]}},"version":"0.0.1"}
\ No newline at end of file
diff --git a/uni_modules/uni-config-center/changelog.md b/uni_modules/uni-config-center/changelog.md
new file mode 100644
index 0000000..5af5257
--- /dev/null
+++ b/uni_modules/uni-config-center/changelog.md
@@ -0,0 +1,6 @@
+## 0.0.3(2022-11-11)
+- 修复 config 方法获取根节点为数组格式配置时错误的转化为了对象的Bug
+## 0.0.2(2021-04-16)
+- 修改插件package信息
+## 0.0.1(2021-03-15)
+- 初始化项目
diff --git a/uni_modules/uni-config-center/package.json b/uni_modules/uni-config-center/package.json
new file mode 100644
index 0000000..0798109
--- /dev/null
+++ b/uni_modules/uni-config-center/package.json
@@ -0,0 +1,81 @@
+{
+ "id": "uni-config-center",
+ "displayName": "uni-config-center",
+ "version": "0.0.3",
+ "description": "uniCloud 配置中心",
+ "keywords": [
+ "配置",
+ "配置中心"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.1.0"
+ },
+"dcloudext": {
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": "",
+ "type": "unicloud-template-function"
+ },
+ "directories": {
+ "example": "../../../scripts/dist"
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "App": {
+ "app-vue": "u",
+ "app-nvue": "u"
+ },
+ "H5-mobile": {
+ "Safari": "u",
+ "Android Browser": "u",
+ "微信浏览器(Android)": "u",
+ "QQ浏览器(Android)": "u"
+ },
+ "H5-pc": {
+ "Chrome": "u",
+ "IE": "u",
+ "Edge": "u",
+ "Firefox": "u",
+ "Safari": "u"
+ },
+ "小程序": {
+ "微信": "u",
+ "阿里": "u",
+ "百度": "u",
+ "字节跳动": "u",
+ "QQ": "u"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ },
+ "Vue": {
+ "vue2": "y",
+ "vue3": "u"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-config-center/readme.md b/uni_modules/uni-config-center/readme.md
new file mode 100644
index 0000000..0bd8ac4
--- /dev/null
+++ b/uni_modules/uni-config-center/readme.md
@@ -0,0 +1,93 @@
+# 为什么使用uni-config-center
+
+实际开发中很多插件需要配置文件才可以正常运行,如果每个插件都单独进行配置的话就会产生下面这样的目录结构
+
+```bash
+cloudfunctions
+└─────common 公共模块
+ ├─plugin-a // 插件A对应的目录
+ │ ├─index.js
+ │ ├─config.json // plugin-a对应的配置文件
+ │ └─other-file.cert // plugin-a依赖的其他文件
+ └─plugin-b // plugin-b对应的目录
+ ├─index.js
+ └─config.json // plugin-b对应的配置文件
+```
+
+假设插件作者要发布一个项目模板,里面使用了很多需要配置的插件,无论是作者发布还是用户使用都是一个大麻烦。
+
+uni-config-center就是用了统一管理这些配置文件的,使用uni-config-center后的目录结构如下
+
+```bash
+cloudfunctions
+└─────common 公共模块
+ ├─plugin-a // 插件A对应的目录
+ │ └─index.js
+ ├─plugin-b // plugin-b对应的目录
+ │ └─index.js
+ └─uni-config-center
+ ├─index.js // config-center入口文件
+ ├─plugin-a
+ │ ├─config.json // plugin-a对应的配置文件
+ │ └─other-file.cert // plugin-a依赖的其他文件
+ └─plugin-b
+ └─config.json // plugin-b对应的配置文件
+```
+
+使用uni-config-center后的优势
+
+- 配置文件统一管理,分离插件主体和配置信息,更新插件更方便
+- 支持对config.json设置schema,插件使用者在HBuilderX内编写config.json文件时会有更好的提示(后续HBuilderX会提供支持)
+
+# 用法
+
+在要使用uni-config-center的公共模块或云函数内引入uni-config-center依赖,请参考:[使用公共模块](https://uniapp.dcloud.net.cn/uniCloud/cf-common)
+
+```js
+const createConfig = require('uni-config-center')
+
+const uniIdConfig = createConfig({
+ pluginId: 'uni-id', // 插件id
+ defaultConfig: { // 默认配置
+ tokenExpiresIn: 7200,
+ tokenExpiresThreshold: 600,
+ },
+ customMerge: function(defaultConfig, userConfig) { // 自定义默认配置和用户配置的合并规则,不设置的情况侠会对默认配置和用户配置进行深度合并
+ // defaudltConfig 默认配置
+ // userConfig 用户配置
+ return Object.assign(defaultConfig, userConfig)
+ }
+})
+
+
+// 以如下配置为例
+// {
+// "tokenExpiresIn": 7200,
+// "passwordErrorLimit": 6,
+// "bindTokenToDevice": false,
+// "passwordErrorRetryTime": 3600,
+// "app-plus": {
+// "tokenExpiresIn": 2592000
+// },
+// "service": {
+// "sms": {
+// "codeExpiresIn": 300
+// }
+// }
+// }
+
+// 获取配置
+uniIdConfig.config() // 获取全部配置,注意:uni-config-center内不存在对应插件目录时会返回空对象
+uniIdConfig.config('tokenExpiresIn') // 指定键值获取配置,返回:7200
+uniIdConfig.config('service.sms.codeExpiresIn') // 指定键值获取配置,返回:300
+uniIdConfig.config('tokenExpiresThreshold', 600) // 指定键值获取配置,如果不存在则取传入的默认值,返回:600
+
+// 获取文件绝对路径
+uniIdConfig.resolve('custom-token.js') // 获取uni-config-center/uni-id/custom-token.js文件的路径
+
+// 引用文件(require)
+uniIDConfig.requireFile('custom-token.js') // 使用require方式引用uni-config-center/uni-id/custom-token.js文件。文件不存在时返回undefined,文件内有其他错误导致require失败时会抛出错误。
+
+// 判断是否包含某文件
+uniIDConfig.hasFile('custom-token.js') // 配置目录是否包含某文件,true: 文件存在,false: 文件不存在
+```
\ No newline at end of file
diff --git a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/index.js b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/index.js
new file mode 100644
index 0000000..00ba62f
--- /dev/null
+++ b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/index.js
@@ -0,0 +1 @@
+"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t 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..9796c78
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
@@ -0,0 +1,948 @@
+
+
+
+
+
+
+
+
+
+
+ {{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..8716d42
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
@@ -0,0 +1,940 @@
+
+
+
+
+
+ {{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..021300f
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
@@ -0,0 +1,1068 @@
+
+
+
+
+
+
+
+ {{ 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..ea62fbc
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
@@ -0,0 +1,421 @@
+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
+ result.push({
+ date: new Date(dateObj.year, month, -i).getDate(),
+ month,
+ disable: true
+ })
+ }
+ 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 info = 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,
+ 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),
+ month: dateObj.month,
+ disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(
+ currentDate, this.endDate)),
+ isToday,
+ userChecked: false,
+ extraInfo: info
+ })
+ }
+ return result
+ }
+ /**
+ * 获取下一个月日期集合
+ */
+ _getNextMonthDays(amount, dateObj) {
+ const result = []
+ const month = dateObj.month + 1
+ for (let i = 1; i <= amount; i++) {
+ result.push({
+ date: i,
+ month,
+ disable: true
+ })
+ }
+ return result
+ }
+
+ /**
+ * 获取当前日期详情
+ * @param {Object} date
+ */
+ getInfo(date) {
+ if (!date) {
+ date = new Date()
+ }
+ const res = this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate)
+ return res ? res : this.getDateObj(date)
+ }
+
+ /**
+ * 比较时间是否相等
+ */
+ 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.multipleStatus.after = undefined;
+ 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) {
+ //抖音小程序点击会触发hover事件,需要避免一下
+ // #ifndef MP-TOUTIAO
+ 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)
+ // #endif
+
+ }
+
+ /**
+ * 更新默认值多选状态
+ */
+ 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(typeof startDate === 'string' ? startDate.trim() : startDate))
+ endDate = new Date(fixIosDateFormat(typeof endDate === 'string' ? endDate.trim() : endDate))
+ return startDate <= endDate
+}
+
+function checkDate(date) {
+ const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g
+ return date.match(dateReg)
+}
+//ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号
+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
+}
diff --git a/uni_modules/uni-datetime-picker/package.json b/uni_modules/uni-datetime-picker/package.json
new file mode 100644
index 0000000..55b8155
--- /dev/null
+++ b/uni_modules/uni-datetime-picker/package.json
@@ -0,0 +1,107 @@
+{
+ "id": "uni-datetime-picker",
+ "displayName": "uni-datetime-picker 日期选择器",
+ "version": "2.2.42",
+ "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
+ "keywords": [
+ "uni-datetime-picker",
+ "uni-ui",
+ "uniui",
+ "日期时间选择器",
+ "日期时间"
+],
+ "repository": "https://github.com/dcloudio/uni-ui",
+ "engines": {
+ "HBuilderX": "",
+ "uni-app": "^4.07",
+ "uni-app-x": ""
+ },
+ "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",
+ "darkmode": "x",
+ "i18n": "x",
+ "widescreen": "x"
+ },
+ "uni_modules": {
+ "dependencies": [
+ "uni-scss",
+ "uni-icons"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "x",
+ "aliyun": "x",
+ "alipay": "x"
+ },
+ "client": {
+ "uni-app": {
+ "vue": {
+ "vue2": "√",
+ "vue3": "√"
+ },
+ "web": {
+ "safari": "√",
+ "chrome": "√"
+ },
+ "app": {
+ "vue": "√",
+ "nvue": "√",
+ "android": "√",
+ "ios": "√",
+ "harmony": "√"
+ },
+ "mp": {
+ "weixin": "√",
+ "alipay": "√",
+ "toutiao": "√",
+ "baidu": "√",
+ "kuaishou": "-",
+ "jd": "-",
+ "harmony": "-",
+ "qq": "√",
+ "lark": "-"
+ },
+ "quickapp": {
+ "huawei": "√",
+ "union": "√"
+ }
+ },
+ "uni-app-x": {
+ "web": {
+ "safari": "-",
+ "chrome": "-"
+ },
+ "app": {
+ "android": "-",
+ "ios": "-",
+ "harmony": "-"
+ },
+ "mp": {
+ "weixin": "-"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
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-id-common/changelog.md b/uni_modules/uni-id-common/changelog.md
new file mode 100644
index 0000000..fed0894
--- /dev/null
+++ b/uni_modules/uni-id-common/changelog.md
@@ -0,0 +1,38 @@
+## 1.0.19(2025-12-16)
+- 增加配置参数缺失时的错误提示,指明配置文件路径
+## 1.0.18(2024-07-08)
+- checkToken时如果传入的token为空则返回uni-id-check-token-failed错误码以便uniIdRouter能正常跳转
+## 1.0.17(2024-04-26)
+- 兼容uni-app-x对客户端uniPlatform的调整(uni-app-x内uniPlatform区分app-android、app-ios)
+## 1.0.16(2023-04-25)
+- 新增maxTokenLength配置,用于限制数据库用户记录token数组的最大长度
+## 1.0.15(2023-04-06)
+- 修复部分语言国际化出错的Bug
+## 1.0.14(2023-03-07)
+- 修复 admin用户包含其他角色时未包含在token的Bug
+## 1.0.13(2022-07-21)
+- 修复 创建token时未传角色权限信息生成的token不正确的bug
+## 1.0.12(2022-07-15)
+- 提升与旧版本uni-id的兼容性(补充读取配置文件时回退平台app-plus、h5),但是仍推荐使用新平台名进行配置(app、web)
+## 1.0.11(2022-07-14)
+- 修复 部分情况下报`read property 'reduce' of undefined`的错误
+## 1.0.10(2022-07-11)
+- 将token存储在用户表的token字段内,与旧版本uni-id保持一致
+## 1.0.9(2022-07-01)
+- checkToken兼容token内未缓存角色权限的情况,此时将查库获取角色权限
+## 1.0.8(2022-07-01)
+- 修复clientDB默认依赖时部分情况下获取不到uni-id配置的Bug
+## 1.0.7(2022-06-30)
+- 修复config文件不合法时未抛出具体错误的Bug
+## 1.0.6(2022-06-28)
+- 移除插件内的数据表schema
+## 1.0.5(2022-06-27)
+- 修复使用多应用配置时报`Cannot read property 'appId' of undefined`的Bug
+## 1.0.4(2022-06-27)
+- 修复使用自定义token内容功能报错的Bug [详情](https://ask.dcloud.net.cn/question/147945)
+## 1.0.2(2022-06-23)
+- 对齐旧版本uni-id默认配置
+## 1.0.1(2022-06-22)
+- 补充对uni-config-center的依赖
+## 1.0.0(2022-06-21)
+- 提供uni-id token创建、校验、刷新接口,简化旧版uni-id公共模块
diff --git a/uni_modules/uni-id-common/package.json b/uni_modules/uni-id-common/package.json
new file mode 100644
index 0000000..9c24c8e
--- /dev/null
+++ b/uni_modules/uni-id-common/package.json
@@ -0,0 +1,101 @@
+{
+ "id": "uni-id-common",
+ "displayName": "uni-id-common",
+ "version": "1.0.19",
+ "description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
+ "keywords": [
+ "uni-id-common",
+ "uniCloud",
+ "token",
+ "权限"
+],
+ "repository": "https://gitcode.net/dcloud/uni-id-common",
+ "engines": {
+ "uni-app": "^3.1.0",
+ "uni-app-x": "^3.1.0"
+ },
+ "dcloudext": {
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "无"
+ },
+ "npmurl": "",
+ "type": "unicloud-template-function",
+ "darkmode": "-",
+ "i18n": "-",
+ "widescreen": "-"
+ },
+ "uni_modules": {
+ "dependencies": [
+ "uni-config-center"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "√",
+ "aliyun": "√",
+ "alipay": "√"
+ },
+ "client": {
+ "uni-app": {
+ "vue": {
+ "vue2": "-",
+ "vue3": "-"
+ },
+ "web": {
+ "safari": "-",
+ "chrome": "-"
+ },
+ "app": {
+ "vue": "-",
+ "nvue": "-",
+ "android": "-",
+ "ios": "-",
+ "harmony": "-"
+ },
+ "mp": {
+ "weixin": "-",
+ "alipay": "-",
+ "toutiao": "-",
+ "baidu": "-",
+ "kuaishou": "-",
+ "jd": "-",
+ "harmony": "-",
+ "qq": "-",
+ "lark": "-"
+ },
+ "quickapp": {
+ "huawei": "-",
+ "union": "-"
+ }
+ },
+ "uni-app-x": {
+ "web": {
+ "safari": "-",
+ "chrome": "-"
+ },
+ "app": {
+ "android": "-",
+ "ios": "-",
+ "harmony": "-"
+ },
+ "mp": {
+ "weixin": "-"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-id-common/readme.md b/uni_modules/uni-id-common/readme.md
new file mode 100644
index 0000000..5f6a37a
--- /dev/null
+++ b/uni_modules/uni-id-common/readme.md
@@ -0,0 +1,3 @@
+# uni-id-common
+
+文档请参考:[uni-id-common](https://uniapp.dcloud.net.cn/uniCloud/uni-id-common.html)
\ No newline at end of file
diff --git a/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/index.js b/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/index.js
new file mode 100644
index 0000000..303d1cd
--- /dev/null
+++ b/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/index.js
@@ -0,0 +1 @@
+"use strict";var e,n=(e=require("crypto"))&&"object"==typeof e&&"default"in e?e.default:e;const i={TOKEN_EXPIRED:"uni-id-token-expired",CHECK_TOKEN_FAILED:"uni-id-check-token-failed",PARAM_REQUIRED:"uni-id-param-required",ACCOUNT_EXISTS:"uni-id-account-exists",ACCOUNT_NOT_EXISTS:"uni-id-account-not-exists",ACCOUNT_CONFLICT:"uni-id-account-conflict",ACCOUNT_BANNED:"uni-id-account-banned",ACCOUNT_AUDITING:"uni-id-account-auditing",ACCOUNT_AUDIT_FAILED:"uni-id-account-audit-failed",ACCOUNT_CLOSED:"uni-id-account-closed"};function t(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function r(e){if(!e)return;const n=e.match(/^(\d+).(\d+).(\d+)/);return n?n.slice(1,4).map(e=>parseInt(e)):void 0}function o(e,n){const i=r(e),t=r(n);return i?t?function(e,n){const i=Math.max(e.length,n.length);for(let t=0;tr)return 1;if(i=e)throw new Error("Config error, tokenExpiresThreshold should be less than tokenExpiresIn");n>e/2&&console.warn(`Please check whether the tokenExpiresThreshold configuration is set too large, tokenExpiresThreshold: ${n}, tokenExpiresIn: ${e}`)}get customToken(){return this.uniId.interceptorMap.get("customToken")}isTokenInDb(e){return o(e,"1.0.10")>=0}async getUserRecord(){if(this.userRecord)return this.userRecord;const e=await C.doc(this.uid).get();if(this.userRecord=e.data[0],!this.userRecord)throw{errCode:i.ACCOUNT_NOT_EXISTS};switch(this.userRecord.status){case void 0:case 0:break;case 1:throw{errCode:i.ACCOUNT_BANNED};case 2:throw{errCode:i.ACCOUNT_AUDITING};case 3:throw{errCode:i.ACCOUNT_AUDIT_FAILED};case 4:throw{errCode:i.ACCOUNT_CLOSED}}if(this.oldTokenPayload){if(this.isTokenInDb(this.oldTokenPayload.uniIdVersion)){if(-1===(this.userRecord.token||[]).indexOf(this.oldToken))throw{errCode:i.CHECK_TOKEN_FAILED}}if(this.userRecord.valid_token_date&&this.userRecord.valid_token_date>1e3*this.oldTokenPayload.iat)throw{errCode:i.TOKEN_EXPIRED}}return this.userRecord}async updateUserRecord(e){await C.doc(this.uid).update(e)}async getUserPermission(){if(this.userPermission)return this.userPermission;const e=(await this.getUserRecord()).role||[];if(0===e.length)return this.userPermission={role:[],permission:[]},this.userPermission;if(e.includes("admin"))return this.userPermission={role:e,permission:[]},this.userPermission;const n=await T.where({role_id:I.in(e)}).get(),i=(t=n.data.reduce((e,n)=>(n.permission&&e.push(...n.permission),e),[]),Array.from(new Set(t)));var t;return this.userPermission={role:e,permission:i},this.userPermission}async _createToken({uid:e,role:n,permission:t}={}){if(!n||!t){const e=await this.getUserPermission();n=e.role,t=e.permission}let r={uid:e,role:n,permission:t};if(this.uniId.interceptorMap.has("customToken")){const i=this.uniId.interceptorMap.get("customToken");if("function"!=typeof i)throw new Error("Invalid custom token file");r=await i({uid:e,role:n,permission:t})}const o=Date.now(),{tokenSecret:s,tokenExpiresIn:c,maxTokenLength:a=10}=this.config,u=g({...r,uniIdVersion:"1.0.19"},s,{expiresIn:c}),d=await this.getUserRecord(),l=(d.token||[]).filter(e=>{try{const n=this._checkToken(e);if(d.valid_token_date&&d.valid_token_date>1e3*n.iat)return!1}catch(e){if(e.errCode===i.TOKEN_EXPIRED)return!1}return!0});return l.push(u),l.length>a&&l.splice(0,l.length-a),await this.updateUserRecord({last_login_ip:this.clientInfo.clientIP,last_login_date:o,token:l}),{token:u,tokenExpired:o+1e3*c}}async createToken({uid:e,role:n,permission:t}={}){if(!e)throw{errCode:i.PARAM_REQUIRED,errMsgValue:{param:"uid"}};this.uid=e;const{token:r,tokenExpired:o}=await this._createToken({uid:e,role:n,permission:t});return{errCode:0,token:r,tokenExpired:o}}async refreshToken({token:e}={}){if(!e)throw{errCode:i.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const n=this._checkToken(e);this.uid=n.uid,this.oldTokenPayload=n;const{uid:t}=n,{role:r,permission:o}=await this.getUserPermission(),{token:s,tokenExpired:c}=await this._createToken({uid:t,role:r,permission:o});return{errCode:0,token:s,tokenExpired:c}}_checkToken(e){const{tokenSecret:n}=this.config;let t;try{t=k(e,n)}catch(e){if("TokenExpiredError"===e.name)throw{errCode:i.TOKEN_EXPIRED};throw{errCode:i.CHECK_TOKEN_FAILED}}return t}async checkToken(e,{autoRefresh:n=!0}={}){if(!e)throw{errCode:i.CHECK_TOKEN_FAILED};this.oldToken=e;const t=this._checkToken(e);this.uid=t.uid,this.oldTokenPayload=t;const{tokenExpiresThreshold:r}=this.config,{uid:o,role:s,permission:c}=t,a={role:s,permission:c};if(!s&&!c){const{role:e,permission:n}=await this.getUserPermission();a.role=e,a.permission=n}if(!r||!n){const e={code:0,errCode:0,...t,...a};return delete e.uniIdVersion,e}const u=Date.now();let d={};1e3*t.exp-u<1e3*r&&(d=await this._createToken({uid:o}));const l={code:0,errCode:0,...t,...a,...d};return delete l.uniIdVersion,l}}var E=Object.freeze({__proto__:null,checkToken:async function(e,{autoRefresh:n=!0}={}){return new m({uniId:this}).checkToken(e,{autoRefresh:n})},createToken:async function({uid:e,role:n,permission:i}={}){return new m({uniId:this}).createToken({uid:e,role:n,permission:i})},refreshToken:async function({token:e}={}){return new m({uniId:this}).refreshToken({token:e})}});const w=require("uni-config-center")({pluginId:"uni-id"});class x{constructor({context:e,clientInfo:n,config:i}={}){this._clientInfo=e?function(e){return{appId:e.APPID,platform:e.PLATFORM,locale:e.LOCALE,clientIP:e.CLIENTIP,deviceId:e.DEVICEID}}(e):n,this._config=i,this.config=this._getOriginConfig(),this.interceptorMap=new Map,w.hasFile("custom-token.js")&&this.setInterceptor("customToken",require(w.resolve("custom-token.js")));this._i18n=uniCloud.initI18n({locale:this._clientInfo.locale,fallbackLocale:"zh-Hans",messages:JSON.parse(JSON.stringify(d))}),d[this._i18n.locale]||this._i18n.setLocale("zh-Hans")}setInterceptor(e,n){this.interceptorMap.set(e,n)}_t(...e){return this._i18n.t(...e)}_parseOriginConfig(e){return Array.isArray(e)?e:e[0]?Object.values(e):e}_getOriginConfig(){if(this._config)return this._config;if(w.hasFile("config.json")){let e;try{e=w.config()}catch(e){throw new Error("Invalid uni-id config file\n"+e.message)}return this._parseOriginConfig(e)}try{return this._parseOriginConfig(require("uni-id/config.json"))}catch(e){throw new Error("Invalid uni-id config file")}}_getAppConfig(){const e=this._getOriginConfig();return Array.isArray(e)?e.find(e=>e.dcloudAppid===this._clientInfo.appId)||e.find(e=>e.isDefaultConfig):e}_getPlatformConfig(){const e=this._getAppConfig();if(!e)throw new Error(`Config for current app (${this._clientInfo.appId}) was not found, please check your config file or client appId`);let n;switch(["app-plus","app-android","app-ios"].indexOf(this._clientInfo.platform)>-1&&(this._clientInfo.platform="app"),"h5"===this._clientInfo.platform&&(this._clientInfo.platform="web"),this._clientInfo.platform){case"web":n="h5";break;case"app":n="app-plus"}const i=[{tokenExpiresIn:7200,tokenExpiresThreshold:1200,passwordErrorLimit:6,passwordErrorRetryTime:3600},e];n&&e[n]&&i.push(e[n]),i.push(e[this._clientInfo.platform]);const t=Object.assign(...i);return["tokenSecret","tokenExpiresIn"].forEach(e=>{if(!t||!t[e])throw new Error(`Config parameter missing, ${e} is required, please check your config file uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json`)}),t}_getConfig(){return this._getPlatformConfig()}}for(const e in E)x.prototype[e]=E[e];function y(e){const n=new x(e);return new Proxy(n,{get(e,n){if(n in e&&0!==n.indexOf("_")){if("function"==typeof e[n])return(i=e[n],function(){let e;try{e=i.apply(this,arguments)}catch(e){if(a(e))return c.call(this,e),e;throw e}return t(e)?e.then(e=>(a(e)&&c.call(this,e),e),e=>{if(a(e))return c.call(this,e),e;throw e}):(a(e)&&c.call(this,e),e)}).bind(e);if("context"!==n&&"config"!==n)return e[n]}var i}})}x.prototype.createInstance=y;const O={createInstance:y};module.exports=O;
diff --git a/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/package.json b/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/package.json
new file mode 100644
index 0000000..37b425a
--- /dev/null
+++ b/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "uni-id-common",
+ "version": "1.0.19",
+ "description": "uni-id token生成、校验、刷新",
+ "main": "index.js",
+ "homepage": "https:\/\/uniapp.dcloud.io\/uniCloud\/uni-id-common.html",
+ "repository": {
+ "type": "git",
+ "url": "git+https:\/\/gitee.com\/dcloud\/uni-id-common.git"
+ },
+ "author": "DCloud",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "uni-config-center": "file:..\/..\/..\/..\/..\/uni-config-center\/uniCloud\/cloudfunctions\/common\/uni-config-center"
+ },
+ "origin-plugin-dev-name": "uni-id-common",
+ "origin-plugin-version": "1.0.19",
+ "plugin-dev-name": "uni-id-common",
+ "plugin-version": "1.0.19"
+}
\ No newline at end of file
diff --git a/utils/BleHelper.js b/utils/BleHelper.js
index 49fcec1..c127d69 100644
--- a/utils/BleHelper.js
+++ b/utils/BleHelper.js
@@ -779,23 +779,23 @@ class BleHelper {
str: str,
hexs: hexs
};
- console.log("监听到特征值:" + JSON.stringify(recData));
+ // console.log("监听到特征值:",recData);
if (this.cfg.receivDataCallback) {
if (this.cfg.receivDataCallback.length > 0) {
- // console.log("有人订阅消息")
+ // console.log("有人订阅消息")
this.cfg.receivDataCallback.forEach((
rec) => {
- // console.log("有人订阅消息111", )
+ // console.log("有人订阅消息111", )
if (rec.callback) {
try {
- // console.log("正在处理订阅消息",rec);
+ // console.log("正在处理订阅消息",rec);
rec.callback(recData, f,
rec.key, this.cfg
.receivDataCallback
);
- // console.log("处理订阅消息完毕");
+ // console.log("处理订阅消息完毕");
} catch (err) {
console.error(
"订阅消息出现异常",
@@ -2030,29 +2030,7 @@ class BleHelper {
}
- //将点阵数据转换成RGB565
- convertToRGB565(pixels, type) {
- if (!type) {
- type = 'rgb';
- }
- const result = new Uint16Array(pixels.length / 4);
- let index = 0;
- for (let i = 0; i < pixels.length; i += 4) {
- let r = pixels[i];
- let g = pixels[i + 1];
- let b = pixels[i + 2];
- let a = pixels[i + 3];
-
- if (type == 'bgr') {
- result[index++] = ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3);
- } else {
- result[index++] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
- }
-
- }
-
- return result;
- }
+
diff --git a/utils/BleReceive.js b/utils/BleReceive.js
index b31a44b..e4a7caf 100644
--- a/utils/BleReceive.js
+++ b/utils/BleReceive.js
@@ -37,6 +37,7 @@ class BleReceive {
});
uni.setStorageSync(this.StorageKey, linkedList);
+ return true;
}
});
}
@@ -49,20 +50,20 @@ class BleReceive {
let handler = null;
let keys = Object.keys(this.HandlerMap);
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replace(/\//g, '').toLowerCase() : '';
- // console.log("查找handler - detailPageUrl:", f.device.detailPageUrl, "转换后:", devKey);
+
for (let index = 0; index < keys.length; index++) {
let devKey = f.device.detailPageUrl ? f.device.detailPageUrl.replace(/\//g, "").toLowerCase() : '';
let key = keys[index].replace(/\//g, '').toLowerCase();
if (key == devKey) {
handler = this.HandlerMap[keys[index]];
- // console.log("找到匹配的handler:", keys[index]);
+
break;
}
}
if (handler) {
- let data = handler(receive, f, path, recArr);
- // console.log("设备"+f.device.deviceName+"收到消息,数据:", data);
+ let data = handler(receive, f, path, recArr);
+ this.setBleFormData(data, f);
return data;
} else {
console.error("已收到消息,但无指定处理程序, deviceUrl:", f.device.detailPageUrl, "可用handlers:", keys);
@@ -159,7 +160,7 @@ class BleReceive {
formData.modeCurr = modeCurr;
formData.warnLevel = warn;
formData.iswarn = iswarn;
- this.setBleFormData(formData, f);
+
let recCnt = recArr.find(v => {
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
@@ -208,7 +209,7 @@ class BleReceive {
if (str.indexOf('mac address:') == 0) {
let formData = {};
formData.macAddress = str.split(':')[1];
- this.setBleFormData(formData, f);
+
return formData;
} else {
let receiveData = {
@@ -327,7 +328,7 @@ class BleReceive {
receiveData.fourGStrenth = fourGStrenth;
receiveData.SOS = sosTxt;
receiveData.qzwarn = sosTxt === 'sg';
- this.setBleFormData(receiveData, f);
+
console.log("recArr=", recArr);
let recCnt = recArr.find(v => {
return v.key.replace(/\//g, "").toLowerCase() == f.device.detailPageUrl
@@ -415,8 +416,7 @@ class BleReceive {
console.log('将数据转文本失败', ex);
}
}
- // console.log("todo",receiveData);
- this.setBleFormData(receiveData, f);
+
return receiveData;
}
@@ -503,8 +503,6 @@ class BleReceive {
}
}
-
- this.setBleFormData(formData, f);
return formData;
} catch (error) {
console.log('7305数据解析错误:', error);
@@ -605,8 +603,6 @@ class BleReceive {
}
}
-
- this.setBleFormData(formData, f);
return formData;
} catch (error) {
console.log('7305数据解析错误:', error);
diff --git a/utils/Common.js b/utils/Common.js
index 756a443..3570666 100644
--- a/utils/Common.js
+++ b/utils/Common.js
@@ -462,5 +462,30 @@ export default {
url='https://www.pgyer.com/xhwl';
}
return {os:os,url:url};
+ },
+
+
+ //将点阵数据转换成RGB565
+ convertToRGB565(pixels, type) {
+ if (!type) {
+ type = 'rgb';
+ }
+ const result = new Uint16Array(pixels.length / 4);
+ let index = 0;
+ for (let i = 0; i < pixels.length; i += 4) {
+ let r = pixels[i];
+ let g = pixels[i + 1];
+ let b = pixels[i + 2];
+ let a = pixels[i + 3];
+
+ if (type == 'bgr') {
+ result[index++] = ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3);
+ } else {
+ result[index++] = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
+ }
+
+ }
+
+ return result;
}
}
\ No newline at end of file
diff --git a/utils/MsgPops.js b/utils/MsgPops.js
new file mode 100644
index 0000000..295ba05
--- /dev/null
+++ b/utils/MsgPops.js
@@ -0,0 +1,162 @@
+var MsgType = {
+ error: "error",
+ succ: "succ",
+ warn: "warn"
+}
+var time = null;
+// 显示成功
+export const MsgSuccess = (msg, btnTxt, ev) => {
+
+ if (!ev) {
+
+ return null;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return null;
+ }
+ let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.succ);
+
+ createClear(ev);
+ return option;
+}
+//显示失败
+export const MsgError = (msg, btnTxt, ev) => {
+
+ if (!ev) {
+
+ return null;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return null;
+ }
+
+ let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.error);
+ createClear(ev);
+ return option;
+}
+//显示警告
+export const MsgWarning = (msg, btnTxt, ev, isClear) => {
+ if (!ev) {
+
+ return null;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return null;
+ }
+ let option = ev.$refs.msgPop.showMsg(msg, btnTxt, MsgType.warn);
+ if (isClear === undefined || isClear) {
+ createClear(ev);
+ }
+
+ return option;
+
+
+}
+
+
+// 隐藏loading
+export const MsgClose = (options, ev) => {
+
+
+ if (!ev) {
+
+ return;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return;
+ }
+ if (typeof(options) == 'string') {
+ options = {
+ key: options
+ }
+ }
+ ev.$refs.msgPop.closePop(options);
+
+}
+
+
+
+export const showPop = (options, ev, isClear) => {
+
+
+ if (!ev) {
+
+ return null;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return null;
+ }
+ let option = ev.$refs.msgPop.showPop(options);
+
+ if (isClear === undefined || isClear) {
+ createClear(ev);
+ }
+
+ return option;
+}
+
+const createClear = (ev) => {
+ let cnt = getPops(ev);
+ if (cnt >= 5) {
+ clearTimeout(time);
+ time = setTimeout(() => {
+ let key = new Date().getTime();
+ showPop({
+ key: key,
+ message: "消息太多, 是否全部关闭",
+ iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png",
+ borderColor: "#e034344d",
+ buttonBgColor: "#E03434",
+ buttonText: '全部关闭',
+ buttonTextColor: '#232323de',
+ showCancel: true,
+ buttonCancelText: "取消",
+ cancelCallback: () => {
+
+ MsgClose(key, ev);
+ },
+ okCallback: function() {
+
+ MsgClear(ev);
+ }
+
+ }, ev, false);
+ }, 500);
+
+
+ }
+}
+
+//获取当前弹窗数量
+export const getPops = (ev) => {
+ if (!ev) {
+
+ return null;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return null;
+ }
+ return ev.$refs.msgPop.getPops();
+
+}
+
+
+//清空所有弹窗
+export const MsgClear = (ev) => {
+ if (!ev) {
+
+ return null;
+ }
+ if (!ev.$refs.msgPop) {
+
+ return null;
+ }
+ return ev.$refs.msgPop.clearPops();
+
+}
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index 544409c..0ba3db7 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -2,7 +2,7 @@ import config from '../config/index.js';
export const env = 'production'; //production development //开发of线上 改这里就行
const BASE = config[env];
const request = (options) => {
- console.log("options" + JSON.stringify(options), BASE.BASE_URL)
+ // console.log("options" + JSON.stringify(options), BASE.BASE_URL)
return new Promise((resolve, reject) => {
// 处理GET请求参数
let url ="";
@@ -15,7 +15,7 @@ const request = (options) => {
url=BASE.BASE_URL + options.url;
}
- console.log("url" + url)
+ // console.log("url" + url)
if (options.method === 'GET' && options.data) {
// 使用qs序列化参数
const params = Object.keys(options.data)
@@ -31,7 +31,7 @@ const request = (options) => {
header: options.header || {},
timeout: 30000,
success: (res) => {
- console.log(res, 'resss');
+ // console.log(res, 'resss');
if (res.data.code === 401) {
uni.removeStorageSync('token');
uni.removeStorageSync('clientID');
diff --git a/utils/update.js b/utils/update.js
index 880e9de..83ce66f 100644
--- a/utils/update.js
+++ b/utils/update.js
@@ -17,13 +17,13 @@ function checkAndUpdateWgt(updateUrl) {
// 1. 获取当前应用版本信息
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
const currentVersion = widgetInfo.version;
- console.log("当前版本:" + currentVersion);
+ // console.log("当前版本:" + currentVersion);
let callbck = (res) => {
let flag = false;
uni.hideLoading();
- console.log("检查更新成功=", res)
+ // console.log("检查更新成功=", res)
if (res.statusCode === 200) {
const updateInfo = res.data.data;
@@ -51,7 +51,7 @@ function checkAndUpdateWgt(updateUrl) {
};
let Update = (url) => {
- console.log("url=", url);
+ // console.log("url=", url);
return new Promise((resolve, reject) => {
uni.request({
url: url,
@@ -76,7 +76,7 @@ function checkAndUpdateWgt(updateUrl) {
reject(err);
},
complete: () => {
- console.log("complete");
+ // console.log("complete");
}
});
});
@@ -146,7 +146,7 @@ function checkAndUpdateWgt(updateUrl) {
let length = results.length;
let flag = false;
for (var i = 0; i < length; i++) {
- console.log('results[' + i + ']=', results[i]);
+ // console.log('results[' + i + ']=', results[i]);
if (results[i].status == 'fulfilled' && results[i].value.type === '1' && !flag) {
if (results[i].value.statusCode === 200) {
flag = callbck(results[i].value)
@@ -161,9 +161,9 @@ function checkAndUpdateWgt(updateUrl) {
}
}
if (!flag) {
- console.log("检查更新失败了");
+ console.error("检查更新失败了");
} else {
- console.log("检查更新成功");
+ // console.log("检查更新成功");
}
});