@10yun/cv-mobile-ui 0.5.58 → 0.5.59

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10yun/cv-mobile-ui",
3
- "version": "0.5.58",
3
+ "version": "0.5.59",
4
4
  "description": "十云cvjs移动端ui,适用uniapp",
5
5
  "homepage": "http://cvjs.cn/cv-mobile-ui/",
6
6
  "license": "Apache-2.0",
@@ -11,14 +11,14 @@
11
11
  auto-height
12
12
  />
13
13
  <view @tap="chooseLocation" class="cv-geo-local-button">
14
- <cv-icons type="actionSearch" size="20" color="#999999" />
14
+ <cv-icons type="geoLocateoutline" size="20" color="#999999" />
15
15
  </view>
16
16
  </view>
17
17
  <view class="cv-geo-local-map" v-if="isShowMap">
18
18
  <map
19
19
  style="width: 100%; height: 170px"
20
- :longitude="map_location.longitude"
21
- :latitude="map_location.latitude"
20
+ :longitude="localLongitude"
21
+ :latitude="localLatitude"
22
22
  :scale="localScale"
23
23
  show-location
24
24
  :markers="markers"
@@ -32,7 +32,7 @@ import mixin from '../../libs/mixin/mixin.js';
32
32
  export default {
33
33
  mixins: [mpMixin, mixin],
34
34
  name: 'cvGeoLocal',
35
- emits: ['input', 'update:modelValue', 'location'],
35
+ emits: ['input', 'update:modelValue', 'update:longitude', 'update:latitude'],
36
36
  props: {
37
37
  value: {
38
38
  type: [Number, String],
@@ -42,6 +42,16 @@ export default {
42
42
  type: [Number, String],
43
43
  default: ''
44
44
  },
45
+ // 经度
46
+ longitude: {
47
+ type: [Number, String],
48
+ default: ''
49
+ },
50
+ // 纬度
51
+ latitude: {
52
+ type: [Number, String],
53
+ default: ''
54
+ },
45
55
  placeholder: {
46
56
  type: [String],
47
57
  default: '请输入定位地址'
@@ -83,7 +93,13 @@ export default {
83
93
  }
84
94
  }
85
95
  },
86
- location(n) {
96
+ longitude(n) {
97
+ if (this.isShowMap) {
98
+ console.log('change:location');
99
+ this.initLocation();
100
+ }
101
+ },
102
+ latitude(n) {
87
103
  if (this.isShowMap) {
88
104
  console.log('change:location');
89
105
  this.initLocation();
@@ -111,10 +127,8 @@ export default {
111
127
  markers: [],
112
128
  //当前选择的位置
113
129
  localScale: 14,
114
- map_location: {
115
- longitude: 119.296411,
116
- latitude: 26.074286
117
- },
130
+ localLongitude: 119.296411,
131
+ localLatitude: 26.074286,
118
132
  parentObj: null
119
133
  };
120
134
  },
@@ -173,12 +187,12 @@ export default {
173
187
  this.funcOnInput();
174
188
  },
175
189
  initLocation() {
176
- if (this.location.longitude && this.location.latitude) {
177
- this.map_location = this.location;
190
+ if (this.longitude && this.latitude) {
191
+ this.localLongitude = this.longitude;
192
+ this.localLatitude = this.latitude;
178
193
  }
179
- console.log('--', this.map_location);
180
194
  if (this.localVal) {
181
- this.map_location['address'] = this.localVal;
195
+ this.localVal = this.localVal;
182
196
  }
183
197
  },
184
198
  chooseLocation() {
@@ -188,9 +202,11 @@ export default {
188
202
  console.log(res);
189
203
  if (res.errMsg == 'chooseLocation:ok') {
190
204
  this.localVal = res.address || '';
191
- this.map_location = { ...res };
205
+ this.localLongitude = res.longitude || '';
206
+ this.localLatitude = res.latitude || '';
192
207
  this.localScale = 16;
193
- this.$emit('location', { ...res });
208
+ this.$emit('update:longitude', this.localLongitude);
209
+ this.$emit('update:latitude', this.localLatitude);
194
210
  this.funcOnInput();
195
211
  }
196
212
  }
@@ -198,12 +214,11 @@ export default {
198
214
  },
199
215
  initMarkers() {
200
216
  let markers = [];
201
- let map_location = this.map_location;
202
217
  markers.push({
203
- latitude: map_location.latitude,
204
- longitude: map_location.longitude,
218
+ latitude: this.localLatitude,
219
+ longitude: this.localLongitude,
205
220
  callout: {
206
- content: map_location.address,
221
+ content: this.localVal,
207
222
  color: '#333333',
208
223
  borderRadius: 5,
209
224
  bgColor: '#ffffff',
@@ -224,6 +239,7 @@ export default {
224
239
  display: flex;
225
240
  flex-direction: column;
226
241
  width: 100%;
242
+ position: relative;
227
243
  }
228
244
  .cv-geo-local-info {
229
245
  display: flex;
@@ -28,9 +28,21 @@ import mpMixin from '../../libs/mixin/mpMixin.js';
28
28
  import mixin from '../../libs/mixin/mixin.js';
29
29
  export default {
30
30
  mixins: [mpMixin, mixin],
31
- name: 'cvPickerRegion',
32
- emits: ['input', 'update:modelValue', 'onChoose'],
31
+ name: 'cvGeoRegion',
32
+ emits: ['input', 'update:modelValue', 'update:province', 'update:city', 'update:district', 'onChoose'],
33
33
  props: {
34
+ province: {
35
+ type: [String, Number],
36
+ default: ''
37
+ },
38
+ city: {
39
+ type: [String, Number],
40
+ default: ''
41
+ },
42
+ district: {
43
+ type: [String, Number],
44
+ default: ''
45
+ },
34
46
  value: {
35
47
  type: [Array, Object],
36
48
  default: () => []
@@ -54,6 +66,18 @@ export default {
54
66
  }
55
67
  },
56
68
  watch: {
69
+ province(newVal) {
70
+ this.localVal[0] = newVal;
71
+ this.itemsSortOut();
72
+ },
73
+ city(newVal) {
74
+ this.localVal[1] = newVal;
75
+ this.itemsSortOut();
76
+ },
77
+ district(newVal) {
78
+ this.localVal[2] = newVal;
79
+ this.itemsSortOut();
80
+ },
57
81
  value(newVal) {
58
82
  this.localVal = newVal;
59
83
  this.itemsSortOut();
@@ -71,7 +95,7 @@ export default {
71
95
  last_range_data: [], //最终显示页面数组
72
96
  items_index: [0, 0, 0], //当前下标
73
97
  lastRetDataIndex: [0, 0, 0], // 最终确定选中的下标
74
- localDataType: 'text',
98
+ localValField: 'text',
75
99
  localDataValue: 'value',
76
100
  localDataText: 'label',
77
101
  localProvince: {},
@@ -81,7 +105,7 @@ export default {
81
105
  },
82
106
  created() {
83
107
  this.localVal = this.doValueGet();
84
- this.localDataType = this.dataType != 'value' ? 'text' : 'value';
108
+ this.localValField = this.dataType != 'value' ? 'text' : 'value';
85
109
  this.itemsSortOut();
86
110
  },
87
111
  methods: {
@@ -146,7 +170,7 @@ export default {
146
170
  if (localValue) {
147
171
  /* 便利省级列表 找出省级的位置 */
148
172
  for (const key in data) {
149
- if (localValue == data[key][this.localDataType]) {
173
+ if (localValue == data[key][this.localValField]) {
150
174
  localKey = parseInt(key);
151
175
  }
152
176
  }
@@ -203,18 +227,18 @@ export default {
203
227
  this.lastRetDataIndex = [...items_index];
204
228
  let value = [];
205
229
  let items = this.items;
206
- if (this.localDataType == 'text') {
207
- value[0] = this.range_data[0][items_index[0]].text;
208
- value[1] = this.range_data[1][items_index[1]].text;
209
- value[2] = this.range_data[2][items_index[2]].text;
210
- } else {
211
- value[0] = this.range_data[0][items_index[0]].value;
212
- value[1] = this.range_data[1][items_index[1]].value;
213
- value[2] = this.range_data[2][items_index[2]].value;
214
- }
230
+ let item_key = this.localValField == 'text' ? 'text' : 'value';
231
+ value[0] = this.range_data[0][items_index[0]][item_key];
232
+ value[1] = this.range_data[1][items_index[1]][item_key];
233
+ value[2] = this.range_data[2][items_index[2]][item_key];
234
+
215
235
  this.$emit('input', value);
216
236
  this.$emit('update:modelValue', value);
217
237
 
238
+ this.$emit('update:province', value[0]);
239
+ this.$emit('update:city', value[1]);
240
+ this.$emit('update:district', value[2]);
241
+
218
242
  // 把选中的3个数组传递出去
219
243
 
220
244
  let selectAllArr = {
@@ -145,7 +145,7 @@ export function parseFormData(data) {
145
145
  // formData['file']= file; // file 必须为最后一个表单域
146
146
  return formData;
147
147
  }
148
- function getFileInfo(imgStr) {
148
+ export function getFileInfo(imgStr) {
149
149
  let index = imgStr.lastIndexOf('/');
150
150
  let strName = imgStr.substring(index + 1, imgStr.length);
151
151
  let strType = '';
@@ -165,7 +165,8 @@ import {
165
165
  generateUniqidName,
166
166
  parseJsonSafe,
167
167
  parseFormData,
168
- content_to_array
168
+ content_to_array,
169
+ getFileInfo
169
170
  } from './file.js';
170
171
  /**
171
172
  * upload 上传
@@ -257,6 +258,7 @@ export default {
257
258
  'delete',
258
259
  'clickPreview',
259
260
  'update:modelValue',
261
+ 'update:initValue',
260
262
  'update:fileList',
261
263
  'afterAutoUpload'
262
264
  ],
@@ -542,6 +544,8 @@ export default {
542
544
  let res2 = res1?.data || res1 || {};
543
545
  // TODO 判断是否多图,
544
546
  this.$emit('update:modelValue', res2.filelog_id || '');
547
+ this.localList.push(getFileInfo(res2.cdn_full_path));
548
+ this.formatFileList();
545
549
  that.$emit(
546
550
  'afterAutoUpload',
547
551
  Object.assign(res2, {
@@ -666,6 +670,9 @@ export default {
666
670
  },
667
671
  deleteItem(index) {
668
672
  if (this.autoDelete) {
673
+ this.localList.splice(index, 1);
674
+ this.$emit('update:initValue', this.localList);
675
+
669
676
  this.fileList.splice(index, 1);
670
677
  this.$emit('update:fileList', this.fileList);
671
678
  } else {
@@ -1,53 +0,0 @@
1
- /**
2
- * 复制文本 兼容H5
3
- * 来自 ThorUI www.thorui.cn | 文档地址: www.donarui.com
4
- * @author echo.
5
- * @version 1.0.0
6
- **/
7
- // #ifdef H5
8
- import ClipboardJS from '../js-sdk/clipboard.min.js';
9
- // #endif
10
- const thorui = {
11
- /**
12
- * data 需要复制的数据
13
- * callback 回调
14
- * e 当用户点击后需要先请求接口再进行复制时,需要传入此参数,或者将异步请求转为同步 (H5端)
15
- * **/
16
- getClipboardData: function (data, callback, e) {
17
- // #ifdef APP-PLUS || MP
18
- uni.setClipboardData({
19
- data: data,
20
- success(res) {
21
- 'function' == typeof callback && callback(true);
22
- },
23
- fail(res) {
24
- 'function' == typeof callback && callback(false);
25
- }
26
- });
27
- // #endif
28
-
29
- // #ifdef H5
30
- let event = window.event || e || {};
31
- let clipboard = new ClipboardJS('', {
32
- text: () => data
33
- });
34
- clipboard.on('success', (e) => {
35
- 'function' == typeof callback && callback(true);
36
- clipboard.off('success');
37
- clipboard.off('error');
38
- clipboard.destroy();
39
- });
40
- clipboard.on('error', (e) => {
41
- 'function' == typeof callback && callback(false);
42
- clipboard.off('success');
43
- clipboard.off('error');
44
- clipboard.destroy();
45
- });
46
- clipboard.onClick(event);
47
- // #endif
48
- }
49
- };
50
-
51
- export default {
52
- getClipboardData: thorui.getClipboardData
53
- };