@10yun/cv-mobile-ui 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  /// null = 未请求,1 = 已允许,0 = 拒绝|受限, 2 = 系统未开启
2
2
 
3
- var isIOS
3
+ var isIOS;
4
4
 
5
5
  function album() {
6
6
  var result = 0;
7
- var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
7
+ var PHPhotoLibrary = plus.ios.import('PHPhotoLibrary');
8
8
  var authStatus = PHPhotoLibrary.authorizationStatus();
9
9
  if (authStatus === 0) {
10
10
  result = null;
@@ -19,7 +19,7 @@ function album() {
19
19
 
20
20
  function camera() {
21
21
  var result = 0;
22
- var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
22
+ var AVCaptureDevice = plus.ios.import('AVCaptureDevice');
23
23
  var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
24
24
  if (authStatus === 0) {
25
25
  result = null;
@@ -34,7 +34,7 @@ function camera() {
34
34
 
35
35
  function location() {
36
36
  var result = 0;
37
- var cllocationManger = plus.ios.import("CLLocationManager");
37
+ var cllocationManger = plus.ios.import('CLLocationManager');
38
38
  var enable = cllocationManger.locationServicesEnabled();
39
39
  var status = cllocationManger.authorizationStatus();
40
40
  if (!enable) {
@@ -52,28 +52,28 @@ function location() {
52
52
 
53
53
  function push() {
54
54
  var result = 0;
55
- var UIApplication = plus.ios.import("UIApplication");
55
+ var UIApplication = plus.ios.import('UIApplication');
56
56
  var app = UIApplication.sharedApplication();
57
57
  var enabledTypes = 0;
58
58
  if (app.currentUserNotificationSettings) {
59
59
  var settings = app.currentUserNotificationSettings();
60
- enabledTypes = settings.plusGetAttribute("types");
60
+ enabledTypes = settings.plusGetAttribute('types');
61
61
  if (enabledTypes == 0) {
62
62
  result = 0;
63
- console.log("推送权限没有开启");
63
+ console.log('推送权限没有开启');
64
64
  } else {
65
65
  result = 1;
66
- console.log("已经开启推送功能!")
66
+ console.log('已经开启推送功能!');
67
67
  }
68
68
  plus.ios.deleteObject(settings);
69
69
  } else {
70
70
  enabledTypes = app.enabledRemoteNotificationTypes();
71
71
  if (enabledTypes == 0) {
72
72
  result = 3;
73
- console.log("推送权限没有开启!");
73
+ console.log('推送权限没有开启!');
74
74
  } else {
75
75
  result = 4;
76
- console.log("已经开启推送功能!")
76
+ console.log('已经开启推送功能!');
77
77
  }
78
78
  }
79
79
  plus.ios.deleteObject(app);
@@ -83,7 +83,7 @@ function push() {
83
83
 
84
84
  function contact() {
85
85
  var result = 0;
86
- var CNContactStore = plus.ios.import("CNContactStore");
86
+ var CNContactStore = plus.ios.import('CNContactStore');
87
87
  var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
88
88
  if (cnAuthStatus === 0) {
89
89
  result = null;
@@ -98,10 +98,10 @@ function contact() {
98
98
 
99
99
  function record() {
100
100
  var result = null;
101
- var avaudiosession = plus.ios.import("AVAudioSession");
101
+ var avaudiosession = plus.ios.import('AVAudioSession');
102
102
  var avaudio = avaudiosession.sharedInstance();
103
103
  var status = avaudio.recordPermission();
104
- console.log("permissionStatus:" + status);
104
+ console.log('permissionStatus:' + status);
105
105
  if (status === 1970168948) {
106
106
  result = null;
107
107
  } else if (status === 1735552628) {
@@ -115,13 +115,13 @@ function record() {
115
115
 
116
116
  function calendar() {
117
117
  var result = null;
118
- var EKEventStore = plus.ios.import("EKEventStore");
118
+ var EKEventStore = plus.ios.import('EKEventStore');
119
119
  var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
120
120
  if (ekAuthStatus == 3) {
121
121
  result = 1;
122
- console.log("日历权限已经开启");
122
+ console.log('日历权限已经开启');
123
123
  } else {
124
- console.log("日历权限没有开启");
124
+ console.log('日历权限没有开启');
125
125
  }
126
126
  plus.ios.deleteObject(EKEventStore);
127
127
  return result;
@@ -129,44 +129,43 @@ function calendar() {
129
129
 
130
130
  function memo() {
131
131
  var result = null;
132
- var EKEventStore = plus.ios.import("EKEventStore");
132
+ var EKEventStore = plus.ios.import('EKEventStore');
133
133
  var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
134
134
  if (ekAuthStatus == 3) {
135
135
  result = 1;
136
- console.log("备忘录权限已经开启");
136
+ console.log('备忘录权限已经开启');
137
137
  } else {
138
- console.log("备忘录权限没有开启");
138
+ console.log('备忘录权限没有开启');
139
139
  }
140
140
  plus.ios.deleteObject(EKEventStore);
141
141
  return result;
142
142
  }
143
143
 
144
-
145
144
  function requestIOS(permissionID) {
146
145
  return new Promise((resolve, reject) => {
147
146
  switch (permissionID) {
148
- case "push":
147
+ case 'push':
149
148
  resolve(push());
150
149
  break;
151
- case "location":
150
+ case 'location':
152
151
  resolve(location());
153
152
  break;
154
- case "record":
153
+ case 'record':
155
154
  resolve(record());
156
155
  break;
157
- case "camera":
156
+ case 'camera':
158
157
  resolve(camera());
159
158
  break;
160
- case "album":
159
+ case 'album':
161
160
  resolve(album());
162
161
  break;
163
- case "contact":
162
+ case 'contact':
164
163
  resolve(contact());
165
164
  break;
166
- case "calendar":
165
+ case 'calendar':
167
166
  resolve(calendar());
168
167
  break;
169
- case "memo":
168
+ case 'memo':
170
169
  resolve(memo());
171
170
  break;
172
171
  default:
@@ -185,22 +184,22 @@ function requestAndroid(permissionID) {
185
184
  for (var i = 0; i < resultObj.granted.length; i++) {
186
185
  var grantedPermission = resultObj.granted[i];
187
186
  console.log('已获取的权限:' + grantedPermission);
188
- result = 1
187
+ result = 1;
189
188
  }
190
189
  for (var i = 0; i < resultObj.deniedPresent.length; i++) {
191
190
  var deniedPresentPermission = resultObj.deniedPresent[i];
192
191
  console.log('拒绝本次申请的权限:' + deniedPresentPermission);
193
- result = 0
192
+ result = 0;
194
193
  }
195
194
  for (var i = 0; i < resultObj.deniedAlways.length; i++) {
196
195
  var deniedAlwaysPermission = resultObj.deniedAlways[i];
197
196
  console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
198
- result = -1
197
+ result = -1;
199
198
  }
200
199
  resolve(result);
201
200
  },
202
201
  function (error) {
203
- console.log('result error: ' + error.message)
202
+ console.log('result error: ' + error.message);
204
203
  resolve({
205
204
  code: error.code,
206
205
  message: error.message
@@ -212,32 +211,32 @@ function requestAndroid(permissionID) {
212
211
 
213
212
  function gotoAppPermissionSetting() {
214
213
  if (permission.isIOS) {
215
- var UIApplication = plus.ios.import("UIApplication");
214
+ var UIApplication = plus.ios.import('UIApplication');
216
215
  var application2 = UIApplication.sharedApplication();
217
- var NSURL2 = plus.ios.import("NSURL");
218
- var setting2 = NSURL2.URLWithString("app-settings:");
216
+ var NSURL2 = plus.ios.import('NSURL');
217
+ var setting2 = NSURL2.URLWithString('app-settings:');
219
218
  application2.openURL(setting2);
220
219
  plus.ios.deleteObject(setting2);
221
220
  plus.ios.deleteObject(NSURL2);
222
221
  plus.ios.deleteObject(application2);
223
222
  } else {
224
- var Intent = plus.android.importClass("android.content.Intent");
225
- var Settings = plus.android.importClass("android.provider.Settings");
226
- var Uri = plus.android.importClass("android.net.Uri");
223
+ var Intent = plus.android.importClass('android.content.Intent');
224
+ var Settings = plus.android.importClass('android.provider.Settings');
225
+ var Uri = plus.android.importClass('android.net.Uri');
227
226
  var mainActivity = plus.android.runtimeMainActivity();
228
227
  var intent = new Intent();
229
228
  intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
230
- var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
229
+ var uri = Uri.fromParts('package', mainActivity.getPackageName(), null);
231
230
  intent.setData(uri);
232
231
  mainActivity.startActivity(intent);
233
232
  }
234
233
  }
235
234
 
236
235
  function gotoiOSPermissionSetting() {
237
- var UIApplication = plus.ios.import("UIApplication");
236
+ var UIApplication = plus.ios.import('UIApplication');
238
237
  var application2 = UIApplication.sharedApplication();
239
- var NSURL2 = plus.ios.import("NSURL");
240
- var setting2 = NSURL2.URLWithString("App-prefs:root=General");
238
+ var NSURL2 = plus.ios.import('NSURL');
239
+ var setting2 = NSURL2.URLWithString('App-prefs:root=General');
241
240
  application2.openURL(setting2);
242
241
 
243
242
  plus.ios.deleteObject(setting2);
@@ -247,12 +246,12 @@ function gotoiOSPermissionSetting() {
247
246
 
248
247
  const permission = {
249
248
  get isIOS() {
250
- return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios')
249
+ return typeof isIOS === 'boolean' ? isIOS : (isIOS = uni.getSystemInfoSync().platform === 'ios');
251
250
  },
252
251
  requestIOS: requestIOS,
253
252
  requestAndroid: requestAndroid,
254
253
  gotoAppSetting: gotoAppPermissionSetting,
255
254
  gotoiOSSetting: gotoiOSPermissionSetting
256
- }
255
+ };
257
256
 
258
- module.exports = permission
257
+ module.exports = permission;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@10yun/cv-mobile-ui",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "十云cvjs移动端ui,适用uniapp",
5
5
  "author": "",
6
6
  "license": "Apache-2.0",
7
- "homepage": "https://cvjs.cn/cv-mobile-ui",
7
+ "homepage": "https://cvjs.cn/cv-mobile-ui/",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org/"
10
10
  },
@@ -15,7 +15,7 @@
15
15
  "dependencies": {},
16
16
  "devDependencies": {},
17
17
  "browserslist": [
18
- "Android >= 4",
19
- "ios >= 8"
18
+ "Android >= 7",
19
+ "ios >= 9"
20
20
  ]
21
21
  }
@@ -13,7 +13,7 @@ const MessageTip = function (options) {
13
13
 
14
14
  let setting = {
15
15
  title: options.message || '提示',
16
- duration: options.duration || 1200,
16
+ duration: options.duration || 800,
17
17
  icon: typeIcon || 'none',
18
18
  mask: true
19
19
  };
@@ -33,7 +33,7 @@ const MessageTip = function (options) {
33
33
  MessageTip['info'] = (title, duration, icon) => {
34
34
  uni.showToast({
35
35
  title: title || '提示',
36
- duration: duration || 1200,
36
+ duration: duration || 800,
37
37
  icon: icon || 'none'
38
38
  // mask: true
39
39
  });
@@ -14,5 +14,4 @@ for (let i in modules) {
14
14
  iconsAll = Object.assign({}, iconsAll, modules[i]);
15
15
  }
16
16
  }
17
- console.log('---iconsAll---', iconsAll);
18
17
  export default iconsAll;
@@ -59,8 +59,8 @@ export default {
59
59
  items_index: [0, 0, 0], //当前下标
60
60
  lastRetDataIndex: [0, 0, 0], // 最终确定选中的下标
61
61
  localDataType: 'text',
62
- dataValue: 'value',
63
- dataText: 'label',
62
+ localDataValue: 'value',
63
+ localDataText: 'label',
64
64
  localProvince: {},
65
65
  localCity: {},
66
66
  localCounty: {}
@@ -53,6 +53,9 @@ export default {
53
53
  localArr: [],
54
54
  // 当前选中下标
55
55
  localIndex: null,
56
+ localDataType: 'text',
57
+ localDataValue: 'value',
58
+ localDataText: 'label',
56
59
  iconTop: false,
57
60
  pickerLists: []
58
61
  };
@@ -102,14 +105,14 @@ export default {
102
105
  * 处理-选中
103
106
  */
104
107
  _dealValue() {
105
- this.dataType = this.dataType != 'text' ? 'value' : 'text';
108
+ this.localDataType = this.dataType != 'text' ? 'value' : 'text';
106
109
  //默认Value
107
110
  let tempArr = this.localArr;
108
111
  let localIndex = null;
109
112
  for (let index = 0; index < tempArr.length; index++) {
110
- if (this.dataType == 'text' && this.localVal == tempArr[index].text) {
113
+ if (this.localDataType == 'text' && this.localVal == tempArr[index].text) {
111
114
  localIndex = index;
112
- } else if (this.dataType == 'value' && this.localVal == tempArr[index].value) {
115
+ } else if (this.localDataType == 'value' && this.localVal == tempArr[index].value) {
113
116
  localIndex = index;
114
117
  }
115
118
  }
@@ -145,7 +148,7 @@ export default {
145
148
 
146
149
  this.localIndex = localIndex;
147
150
  const rowData = this.localArr[localIndex];
148
- if (this.dataType == 'text') {
151
+ if (this.localDataType == 'text') {
149
152
  this.localVal = rowData.text;
150
153
  } else {
151
154
  this.localVal = rowData.value;
@@ -52,9 +52,9 @@ export default {
52
52
  type: String,
53
53
  default: 'text'
54
54
  },
55
- free: {
55
+ dataTree: {
56
56
  type: String,
57
- default: 'free'
57
+ default: 'tree'
58
58
  },
59
59
  joint: {
60
60
  type: String,
@@ -83,7 +83,9 @@ export default {
83
83
  items_sub: [],
84
84
  items_index: [0, 0], //当前下标
85
85
  lastRetDataIndex: [0, 0], // 最终确定选中的下标
86
- localDataType: ''
86
+ localDataType: '',
87
+ localDataValue: 'value',
88
+ localDataText: 'label'
87
89
  };
88
90
  },
89
91
  created() {
@@ -107,7 +109,7 @@ export default {
107
109
  let items = [];
108
110
  let dataValue = this.dataValue ? this.dataValue : 'value';
109
111
  let dataText = this.dataText ? this.dataText : 'text';
110
- let free = this.free;
112
+ let tree = this.dataTree;
111
113
  let items_index = this.items_index;
112
114
  let dataType = this.localDataType;
113
115
  for (let i in original) {
@@ -125,11 +127,11 @@ export default {
125
127
  value: data[dataValue].toString(),
126
128
  text: data[dataText]
127
129
  });
128
- if (original[i][free]) {
129
- let free_data = original[i][free];
130
+ if (original[i][tree]) {
131
+ let tree_data = original[i][tree];
130
132
  let temp = [];
131
- for (const ii in free_data) {
132
- let data = free_data[ii];
133
+ for (const ii in tree_data) {
134
+ let data = tree_data[ii];
133
135
 
134
136
  //查找二级绑定参数
135
137
  if (this.localVal[1]) {
@@ -144,7 +146,7 @@ export default {
144
146
  text: data[dataText]
145
147
  });
146
148
  }
147
- items[i].free = temp;
149
+ items[i].tree = temp;
148
150
  }
149
151
  }
150
152
  if (!items) {
@@ -152,7 +154,7 @@ export default {
152
154
  }
153
155
  //默认Value
154
156
  this.items = items;
155
- this.items_sub = items[items_index[0] ?? 0].free;
157
+ this.items_sub = items[items_index[0] ?? 0].tree;
156
158
  this.range_data = [items, this.items_sub];
157
159
  this.last_range_data = [...this.range_data];
158
160
  this.items_index = items_index;
@@ -180,7 +182,7 @@ export default {
180
182
  items_index[0] = e.detail.value;
181
183
  items_index[1] = 0;
182
184
  let range_data = this.range_data;
183
- range_data[1] = range_data[0][items_index[0]].free;
185
+ range_data[1] = range_data[0][items_index[0]].tree;
184
186
  this.range_data = range_data;
185
187
  }
186
188
  this.items_index = items_index;
@@ -194,10 +196,10 @@ export default {
194
196
  let items = this.items;
195
197
  if (this.dataType == 'text') {
196
198
  value[0] = items[items_index[0]].text;
197
- value[1] = items[items_index[0]].free[items_index[1]].text;
199
+ value[1] = items[items_index[0]].tree[items_index[1]].text;
198
200
  } else {
199
201
  value[0] = items[items_index[0]].value;
200
- value[1] = items[items_index[0]].free[items_index[1]].value;
202
+ value[1] = items[items_index[0]].tree[items_index[1]].value;
201
203
  }
202
204
  this.localVal = value;
203
205
  this.$emit('input', value);
@@ -63,9 +63,9 @@ export default {
63
63
  type: String,
64
64
  default: 'text'
65
65
  },
66
- free: {
66
+ dataTree: {
67
67
  type: String,
68
- default: 'free'
68
+ default: 'tree'
69
69
  },
70
70
  joint: {
71
71
  type: String,
@@ -118,7 +118,8 @@ export default {
118
118
  let items = [];
119
119
  let dataValue = this.dataValue ? this.dataValue : 'value';
120
120
  let dataText = this.dataText ? this.dataText : 'text';
121
- let free = this.free;
121
+
122
+ let tree = this.dataTree;
122
123
  let items_index = this.items_index;
123
124
  let dataType = this.localDataType;
124
125
  for (let i in original) {
@@ -132,16 +133,15 @@ export default {
132
133
  items_index[0] = i;
133
134
  }
134
135
  }
135
-
136
136
  items.push({
137
137
  value: data[dataValue].toString(),
138
138
  text: data[dataText]
139
139
  });
140
- if (original[i][free]) {
141
- let free_data = original[i][free];
140
+ if (original[i][tree]) {
141
+ let tree_data = original[i][tree];
142
142
  let temp = [];
143
- for (const ii in free_data) {
144
- let data = free_data[ii];
143
+ for (const ii in tree_data) {
144
+ let data = tree_data[ii];
145
145
 
146
146
  //查找二级绑定参数
147
147
  if (this.localVal.length >= 2) {
@@ -155,14 +155,14 @@ export default {
155
155
  value: data[dataValue].toString(),
156
156
  text: data[dataText]
157
157
  });
158
- if (free_data[ii][free] == undefined) {
159
- free_data[ii][free] = [{}];
158
+ if (tree_data[ii][tree] == undefined) {
159
+ tree_data[ii][tree] = [{}];
160
160
  }
161
- if (free_data[ii][free]) {
162
- let free_data2 = free_data[ii][free];
161
+ if (tree_data[ii][tree]) {
162
+ let tree_data2 = tree_data[ii][tree];
163
163
  let temp2 = [];
164
- for (const iii in free_data2) {
165
- let data = free_data2[iii];
164
+ for (const iii in tree_data2) {
165
+ let data = tree_data2[iii];
166
166
  //查找三级绑定参数
167
167
  if (this.localVal.length >= 3) {
168
168
  if (dataType == 'text' && this.localVal[2] == data[dataText]) {
@@ -183,10 +183,10 @@ export default {
183
183
  text: data[dataText]
184
184
  });
185
185
  }
186
- temp[ii].free = temp2;
186
+ temp[ii].tree = temp2;
187
187
  }
188
188
  }
189
- items[i].free = temp;
189
+ items[i].tree = temp;
190
190
  }
191
191
  }
192
192
  if (!items) {
@@ -194,8 +194,8 @@ export default {
194
194
  }
195
195
  //默认Value
196
196
  this.items = items;
197
- this.items_sub = items[items_index[0] ?? 0].free;
198
- this.items_sub2 = this.items_sub[items_index[1] ?? 0].free;
197
+ this.items_sub = items[items_index[0] ?? 0].tree;
198
+ this.items_sub2 = this.items_sub[items_index[1] ?? 0].tree;
199
199
  this.range_data = [items, this.items_sub, this.items_sub2];
200
200
  this.items_index = items_index;
201
201
  this.last_range_data = [...this.range_data];
@@ -225,15 +225,15 @@ export default {
225
225
  //滑动二级
226
226
  items_index[1] = e.detail.value;
227
227
  items_index[2] = 0;
228
- range_data[2] = range_data[1][items_index[1]].free || [];
228
+ range_data[2] = range_data[1][items_index[1]].tree || [];
229
229
  // this.range_data = range_data;
230
230
  } else if (e.detail.column == 0) {
231
231
  //滑动一级
232
232
  items_index[0] = e.detail.value;
233
233
  items_index[1] = 0;
234
234
  items_index[2] = 0;
235
- range_data[1] = range_data[0][items_index[0]].free || [];
236
- range_data[2] = range_data[1][items_index[1]].free || [];
235
+ range_data[1] = range_data[0][items_index[0]].tree || [];
236
+ range_data[2] = range_data[1][items_index[1]].tree || [];
237
237
  // this.range_data = range_data;
238
238
  }
239
239
  this.$set(this, 'range_data', range_data);
@@ -249,17 +249,17 @@ export default {
249
249
  let value = [];
250
250
  let items = this.items;
251
251
  // 2022-07-22,修复三级选项为空时取值异常
252
- if (!items[items_index[0]].free[items_index[1]].free || items[items_index[0]].free[items_index[1]].free.length == 0) {
253
- items[items_index[0]].free[items_index[1]].free = [{ text: '', value: '' }];
252
+ if (!items[items_index[0]].tree[items_index[1]].tree || items[items_index[0]].tree[items_index[1]].tree.length == 0) {
253
+ items[items_index[0]].tree[items_index[1]].tree = [{ text: '', value: '' }];
254
254
  }
255
- if (this.dataType == 'text') {
255
+ if (this.localDataType == 'text') {
256
256
  value[0] = items[items_index[0]].text;
257
- value[1] = items[items_index[0]].free[items_index[1]].text;
258
- value[2] = items[items_index[0]].free[items_index[1]].free[items_index[2]].text;
257
+ value[1] = items[items_index[0]].tree[items_index[1]].text;
258
+ value[2] = items[items_index[0]].tree[items_index[1]].tree[items_index[2]].text;
259
259
  } else {
260
260
  value[0] = items[items_index[0]].value;
261
- value[1] = items[items_index[0]].free[items_index[1]].value;
262
- value[2] = items[items_index[0]].free[items_index[1]].free[items_index[2]].value;
261
+ value[1] = items[items_index[0]].tree[items_index[1]].value;
262
+ value[2] = items[items_index[0]].tree[items_index[1]].tree[items_index[2]].value;
263
263
  }
264
264
  this.$emit('input', value);
265
265
  }