@aochuang/common 1.0.146 → 1.0.148

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.
@@ -9,6 +9,13 @@ import { md5 } from '../../utils/string'
9
9
  export default {
10
10
  name: 'BiStaticMap',
11
11
  props: {
12
+ type: {
13
+ type: String,
14
+ default: 'tencent',
15
+ validator (value) {
16
+ return ['tencent', 'amap'].includes(value)
17
+ }
18
+ },
12
19
  width: {
13
20
  type: String,
14
21
  default: '400'
@@ -39,6 +46,9 @@ export default {
39
46
  },
40
47
  computed: {
41
48
  mapHref () {
49
+ if (this.type === 'amap') {
50
+ return `https://uri.amap.com/marker?position=${this.amapCenter}&src=workphone&coordinate=gaode&callnative=0`
51
+ }
42
52
  return `https://apis.map.qq.com/uri/v1/geocoder?coord=${this.center}&referer=workphone`
43
53
  },
44
54
  isVisible () {
@@ -47,6 +57,9 @@ export default {
47
57
  center () {
48
58
  return `${this.lat},${this.lng}`
49
59
  },
60
+ amapCenter () {
61
+ return `${this.lng},${this.lat}`
62
+ },
50
63
  size () {
51
64
  return `${this.width}*${this.height}`
52
65
  },
@@ -60,20 +73,27 @@ export default {
60
73
  return `/ws/staticmap/v2/?center=${this.center}&key=${this.mapKey}&markers=color:blue|${this.center}&size=${this.size}&zoom=15pIwHI3PGMl0wtRP7Zvj1kqlXlQiVej7B`
61
74
  },
62
75
  mapUrl () {
76
+ if (this.type === 'amap') {
77
+ return `https://restapi.amap.com/v3/staticmap?location=${this.amapCenter}&zoom=15&size=${this.size}&markers=mid,,A:${this.amapCenter}&key=${this.mapKey}`
78
+ }
63
79
  return `https://apis.map.qq.com/ws/staticmap/v2/?size=${this.size}&key=${this.mapKey}&center=${this.center}&markers=color:blue|${this.center}&zoom=15&sig=${this.sign}`
64
80
  }
65
81
  },
66
82
  created () {
67
83
  this.ready = false
68
84
  if (!this.mapKey) {
69
- throw new Error('缺少腾讯地图授权key配置')
85
+ throw new Error(`缺少${this.type === 'amap' ? '高德' : '腾讯'}地图授权key配置`)
70
86
  }
71
- md5(this.encryptUrl).then(rs => {
72
- this.sign = rs
73
- this.ready = true
74
- }, () => {
87
+ if (this.type === 'amap') {
75
88
  this.ready = true
76
- })
89
+ } else {
90
+ md5(this.encryptUrl).then(rs => {
91
+ this.sign = rs
92
+ this.ready = true
93
+ }, () => {
94
+ this.ready = true
95
+ })
96
+ }
77
97
  this.$emit('map-created', {
78
98
  mapHref: this.mapHref
79
99
  })
@@ -80,7 +80,7 @@
80
80
  <div class="ac-voice-player__download" v-if="allowDownload" @click="handleDownloadClick">
81
81
  <ui-icon
82
82
  class="ac-voice-player__download-btn"
83
- name="download-line"
83
+ :name="downloading ? 'loading' : 'download-line'"
84
84
  title="下载"
85
85
  ></ui-icon>
86
86
  </div>
@@ -139,6 +139,9 @@ export default {
139
139
  type: Boolean,
140
140
  default: true
141
141
  },
142
+ downloadMethod: {
143
+ type: Function
144
+ },
142
145
  getUrlMethod: {
143
146
  type: Function
144
147
  },
@@ -153,6 +156,7 @@ export default {
153
156
  data () {
154
157
  return {
155
158
  loading: false,
159
+ downloading: false,
156
160
  progressing: false, // 真正的播放中
157
161
  converting: false,
158
162
  innerUrl: this.url,
@@ -387,6 +391,15 @@ export default {
387
391
  this.$refs.popover.hide()
388
392
  },
389
393
  handleDownloadClick () {
394
+ if (this.downloading) {
395
+ return Promise.resolve()
396
+ }
397
+ if (this.downloadMethod) {
398
+ this.downloading = true
399
+ return Promise.resolve().then(() => this.downloadMethod()).finally(() => {
400
+ this.downloading = false
401
+ })
402
+ }
390
403
  if (!this.voiceSrc) {
391
404
  if (this.getUrlMethod) {
392
405
  this.$warn('请先点击播放按钮,获取录音文件地址后再来下载')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/common",
3
- "version": "1.0.146",
3
+ "version": "1.0.148",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {