@aochuang/common 1.0.1 → 1.0.126

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.
Files changed (283) hide show
  1. package/common/index.js +13 -0
  2. package/common/resizable/index.js +3 -0
  3. package/common/resizable/resizable.vue +260 -0
  4. package/common/scroll-load-more/index.js +3 -0
  5. package/common/scroll-load-more/scroll-load-more.vue +397 -0
  6. package/common/static-map/index.js +3 -0
  7. package/common/static-map/static-map.vue +87 -0
  8. package/common/tooltip/tooltip.vue +27 -7
  9. package/common/viewer/index.js +4 -0
  10. package/common/viewer/util.js +40 -0
  11. package/common/viewer/viewer.vue +607 -0
  12. package/common/viewer-pedestal/index.js +3 -0
  13. package/common/viewer-pedestal/viewer-pedestal.vue +70 -0
  14. package/common/voice/index.js +21 -0
  15. package/common/voice/util.js +18 -0
  16. package/common/voice/voice-player-aac.js +584 -0
  17. package/common/voice/voice-player-audio.js +159 -0
  18. package/common/voice/voice-player.js +309 -0
  19. package/common/voice/voice.vue +274 -0
  20. package/common/voice-player/index.js +3 -0
  21. package/common/voice-player/voice-player.vue +785 -0
  22. package/common/waterfall/index.js +3 -0
  23. package/common/waterfall/waterfall.vue +169 -0
  24. package/common/wechat-emoji/emoji/666.png +0 -0
  25. package/common/wechat-emoji/emoji/Emm.png +0 -0
  26. package/common/wechat-emoji/emoji/OK.png +0 -0
  27. package/common/wechat-emoji/emoji//344/272/262/344/272/262.png +0 -0
  28. package/common/wechat-emoji/emoji//344/276/277/344/276/277.png +0 -0
  29. package/common/wechat-emoji/emoji//345/201/267/347/254/221.png +0 -0
  30. package/common/wechat-emoji/emoji//345/202/262/346/205/242.png +0 -0
  31. package/common/wechat-emoji/emoji//345/206/215/350/247/201.png +0 -0
  32. package/common/wechat-emoji/emoji//345/207/213/350/260/242.png +0 -0
  33. package/common/wechat-emoji/emoji//345/210/240/351/231/244.png +0 -0
  34. package/common/wechat-emoji/emoji//345/212/240/346/262/271.png +0 -0
  35. package/common/wechat-emoji/emoji//345/213/276/345/274/225.png +0 -0
  36. package/common/wechat-emoji/emoji//345/217/221/345/221/206.png +0 -0
  37. package/common/wechat-emoji/emoji//345/217/221/346/200/222.png +0 -0
  38. package/common/wechat-emoji/emoji//345/217/221/346/212/226.png +0 -0
  39. package/common/wechat-emoji/emoji//345/217/257/346/200/234.png +0 -0
  40. package/common/wechat-emoji/emoji//345/217/263/345/223/274/345/223/274.png +0 -0
  41. package/common/wechat-emoji/emoji//345/217/271/346/260/224.png +0 -0
  42. package/common/wechat-emoji/emoji//345/220/203/347/223/234.png +0 -0
  43. package/common/wechat-emoji/emoji//345/220/210/345/215/201.png +0 -0
  44. package/common/wechat-emoji/emoji//345/220/220.png +0 -0
  45. package/common/wechat-emoji/emoji//345/220/220/350/210/214/345/244/264.png +0 -0
  46. package/common/wechat-emoji/emoji//345/221/262/347/211/231.png +0 -0
  47. package/common/wechat-emoji/emoji//345/222/222/351/252/202.png +0 -0
  48. package/common/wechat-emoji/emoji//345/222/226/345/225/241.png +0 -0
  49. package/common/wechat-emoji/emoji//345/223/207.png +0 -0
  50. package/common/wechat-emoji/emoji//345/223/210/346/254/240.png +0 -0
  51. package/common/wechat-emoji/emoji//345/225/244/351/205/222.png +0 -0
  52. package/common/wechat-emoji/emoji//345/230/230.png +0 -0
  53. package/common/wechat-emoji/emoji//345/230/264/345/224/207.png +0 -0
  54. package/common/wechat-emoji/emoji//345/230/277/345/223/210.png +0 -0
  55. package/common/wechat-emoji/emoji//345/233/247.png +0 -0
  56. package/common/wechat-emoji/emoji//345/233/260.png +0 -0
  57. package/common/wechat-emoji/emoji//345/235/217/347/254/221.png +0 -0
  58. package/common/wechat-emoji/emoji//345/244/247/345/223/255.png +0 -0
  59. package/common/wechat-emoji/emoji//345/244/251/345/225/212.png +0 -0
  60. package/common/wechat-emoji/emoji//345/244/252/351/230/263.png +0 -0
  61. package/common/wechat-emoji/emoji//345/244/261/346/234/233.png +0 -0
  62. package/common/wechat-emoji/emoji//345/245/213/346/226/227.png +0 -0
  63. package/common/wechat-emoji/emoji//345/245/270/347/254/221.png +0 -0
  64. package/common/wechat-emoji/emoji//345/245/275/347/232/204.png +0 -0
  65. package/common/wechat-emoji/emoji//345/247/224/345/261/210.png +0 -0
  66. package/common/wechat-emoji/emoji//345/256/263/347/276/236.png +0 -0
  67. package/common/wechat-emoji/emoji//345/260/264/345/260/254.png +0 -0
  68. package/common/wechat-emoji/emoji//345/267/246/345/223/274/345/223/274.png +0 -0
  69. package/common/wechat-emoji/emoji//345/272/206/347/245/235.png +0 -0
  70. package/common/wechat-emoji/emoji//345/274/261.png +0 -0
  71. package/common/wechat-emoji/emoji//345/274/272.png +0 -0
  72. package/common/wechat-emoji/emoji//345/276/227/346/204/217.png +0 -0
  73. package/common/wechat-emoji/emoji//345/276/256/347/254/221.png +0 -0
  74. package/common/wechat-emoji/emoji//345/277/203/347/242/216.png +0 -0
  75. package/common/wechat-emoji/emoji//345/277/253/345/223/255/344/272/206.png +0 -0
  76. package/common/wechat-emoji/emoji//346/200/204/347/201/253.png +0 -0
  77. package/common/wechat-emoji/emoji//346/201/220/346/203/247.png +0 -0
  78. package/common/wechat-emoji/emoji//346/202/240/351/227/262.png +0 -0
  79. package/common/wechat-emoji/emoji//346/203/212/346/201/220.png +0 -0
  80. package/common/wechat-emoji/emoji//346/203/212/350/256/266.png +0 -0
  81. package/common/wechat-emoji/emoji//346/204/211/345/277/253.png +0 -0
  82. package/common/wechat-emoji/emoji//346/206/250/347/254/221.png +0 -0
  83. package/common/wechat-emoji/emoji//346/211/223/350/204/270.png +0 -0
  84. package/common/wechat-emoji/emoji//346/212/223/347/213/202.png +0 -0
  85. package/common/wechat-emoji/emoji//346/212/240/351/274/273.png +0 -0
  86. package/common/wechat-emoji/emoji//346/212/261/346/213/263.png +0 -0
  87. package/common/wechat-emoji/emoji//346/213/245/346/212/261.png +0 -0
  88. package/common/wechat-emoji/emoji//346/213/263/345/244/264.png +0 -0
  89. package/common/wechat-emoji/emoji//346/215/202/350/204/270.png +0 -0
  90. package/common/wechat-emoji/emoji//346/217/241/346/211/213.png +0 -0
  91. package/common/wechat-emoji/emoji//346/222/207/345/230/264.png +0 -0
  92. package/common/wechat-emoji/emoji//346/223/246/346/261/227.png +0 -0
  93. package/common/wechat-emoji/emoji//346/225/262/346/211/223.png +0 -0
  94. package/common/wechat-emoji/emoji//346/227/240/350/257/255.png +0 -0
  95. package/common/wechat-emoji/emoji//346/227/272/346/237/264.png +0 -0
  96. package/common/wechat-emoji/emoji//346/231/225.png +0 -0
  97. package/common/wechat-emoji/emoji//346/234/210/344/272/256.png +0 -0
  98. package/common/wechat-emoji/emoji//346/234/272/346/231/272.png +0 -0
  99. package/common/wechat-emoji/emoji//346/261/227.png +0 -0
  100. package/common/wechat-emoji/emoji//346/265/201/346/261/227.png +0 -0
  101. package/common/wechat-emoji/emoji//346/265/201/346/263/252.png +0 -0
  102. package/common/wechat-emoji/emoji//347/202/270/345/274/271.png +0 -0
  103. package/common/wechat-emoji/emoji//347/203/237/350/212/261.png +0 -0
  104. package/common/wechat-emoji/emoji//347/210/206/347/253/271.png +0 -0
  105. package/common/wechat-emoji/emoji//347/210/261/345/277/203.png +0 -0
  106. package/common/wechat-emoji/emoji//347/214/252/345/244/264.png +0 -0
  107. package/common/wechat-emoji/emoji//347/216/253/347/221/260.png +0 -0
  108. package/common/wechat-emoji/emoji//347/224/237/347/227/205.png +0 -0
  109. package/common/wechat-emoji/emoji//347/226/221/351/227/256.png +0 -0
  110. package/common/wechat-emoji/emoji//347/231/274.png +0 -0
  111. package/common/wechat-emoji/emoji//347/231/275/347/234/274.png +0 -0
  112. package/common/wechat-emoji/emoji//347/232/261/347/234/211.png +0 -0
  113. package/common/wechat-emoji/emoji//347/235/241.png +0 -0
  114. package/common/wechat-emoji/emoji//347/240/264/346/266/225/344/270/272/347/254/221.png +0 -0
  115. package/common/wechat-emoji/emoji//347/244/274/347/211/251.png +0 -0
  116. package/common/wechat-emoji/emoji//347/244/276/344/274/232/347/244/276/344/274/232.png +0 -0
  117. package/common/wechat-emoji/emoji//347/246/217.png +0 -0
  118. package/common/wechat-emoji/emoji//347/254/221/350/204/270.png +0 -0
  119. package/common/wechat-emoji/emoji//347/272/242/345/214/205.png +0 -0
  120. package/common/wechat-emoji/emoji//347/277/273/347/231/275/347/234/274.png +0 -0
  121. package/common/wechat-emoji/emoji//350/200/266.png +0 -0
  122. package/common/wechat-emoji/emoji//350/203/234/345/210/251.png +0 -0
  123. package/common/wechat-emoji/emoji//350/204/270/347/272/242.png +0 -0
  124. package/common/wechat-emoji/emoji//350/211/262.png +0 -0
  125. package/common/wechat-emoji/emoji//350/213/246/346/266/251.png +0 -0
  126. package/common/wechat-emoji/emoji//350/217/234/345/210/200.png +0 -0
  127. package/common/wechat-emoji/emoji//350/233/213/347/263/225.png +0 -0
  128. package/common/wechat-emoji/emoji//350/241/260.png +0 -0
  129. package/common/wechat-emoji/emoji//350/243/202/345/274/200.png +0 -0
  130. package/common/wechat-emoji/emoji//350/245/277/347/223/234.png +0 -0
  131. package/common/wechat-emoji/emoji//350/256/251/346/210/221/347/234/213/347/234/213.png +0 -0
  132. package/common/wechat-emoji/emoji//350/260/203/347/232/256.png +0 -0
  133. package/common/wechat-emoji/emoji//350/267/263/350/267/263.png +0 -0
  134. package/common/wechat-emoji/emoji//350/275/254/345/234/210.png +0 -0
  135. package/common/wechat-emoji/emoji//351/204/231/350/247/206.png +0 -0
  136. package/common/wechat-emoji/emoji//351/227/255/345/230/264.png +0 -0
  137. package/common/wechat-emoji/emoji//351/230/264/351/231/251.png +0 -0
  138. package/common/wechat-emoji/emoji//351/232/276/350/277/207.png +0 -0
  139. package/common/wechat-emoji/emoji//351/252/267/351/253/205.png +0 -0
  140. package/common/wechat-emoji/emoji//351/254/274/350/204/270.png +0 -0
  141. package/common/wechat-emoji/emoji//351/270/241.png +0 -0
  142. package/common/wechat-emoji/emoji//351/274/223/346/216/214.png +0 -0
  143. package/common/wechat-emoji/index.js +14 -0
  144. package/common/wechat-emoji/order.json +111 -0
  145. package/common/wechat-emoji/utils.js +52 -0
  146. package/common/wechat-emoji/wechat-emoji.vue +74 -0
  147. package/common/wechat-emoji-select/index.js +3 -0
  148. package/common/wechat-emoji-select/wechat-emoji-select.vue +67 -0
  149. package/components/advanced-filter/advanced-filter-condition.vue +1 -1
  150. package/components/advanced-filter/advanced-filter.vue +6 -1
  151. package/components/advanced-filter/index.js +11 -12
  152. package/components/avatar/avatar.vue +9 -5
  153. package/components/button/button.vue +15 -2
  154. package/components/date-picker/date-picker.vue +9 -2
  155. package/components/dialog/dialog.vue +6 -1
  156. package/components/dropdown/dropdown-item.vue +10 -2
  157. package/components/dropdown/dropdown.vue +45 -5
  158. package/components/dropdown/index.js +8 -8
  159. package/components/empty/empty.vue +29 -2
  160. package/components/filter/filter.vue +1 -1
  161. package/components/filter/index.js +10 -10
  162. package/components/form/form.vue +33 -2
  163. package/components/form/index.js +11 -0
  164. package/components/grid/grid-column.vue +1 -0
  165. package/components/grid/grid-table.vue +6 -4
  166. package/components/grid/grid.vue +15 -3
  167. package/components/grid/index.js +31 -32
  168. package/components/icon/demo_index.html +2752 -1073
  169. package/components/icon/iconfont.css +299 -7
  170. package/components/icon/iconfont.js +1 -1
  171. package/components/icon/iconfont.json +518 -7
  172. package/components/icon/iconfont.ttf +0 -0
  173. package/components/icon/iconfont.woff +0 -0
  174. package/components/icon/iconfont.woff2 +0 -0
  175. package/components/image/image.vue +91 -13
  176. package/components/image/index.js +3 -1
  177. package/components/image/util.js +82 -1
  178. package/components/index.js +6 -2
  179. package/components/menu/index.js +13 -7
  180. package/components/menu/menu-group.vue +6 -1
  181. package/components/menu/menu-item.vue +57 -3
  182. package/components/menu/menu.vue +1 -1
  183. package/components/message/message.js +12 -9
  184. package/components/message-box/index.js +4 -0
  185. package/components/pagination/pagination.vue +11 -7
  186. package/components/popover/popover.vue +24 -1
  187. package/components/searchbox/searchbox.vue +15 -3
  188. package/components/select/index.js +2 -0
  189. package/components/select/select.vue +7 -1
  190. package/components/skeleton/index.js +2 -0
  191. package/components/sortable/index.js +7 -5
  192. package/components/sortable/sortable.vue +5 -0
  193. package/components/tabbar/index.js +9 -0
  194. package/components/tabbar/tabbar-item.vue +162 -0
  195. package/components/tabbar/tabbar.vue +49 -0
  196. package/components/tabs/index.js +2 -0
  197. package/components/tabs/tabs.vue +5 -0
  198. package/components/tag/index.js +4 -4
  199. package/components/tag/tag.less +12 -3
  200. package/components/textarea/textarea.vue +19 -3
  201. package/components/time-picker/time-picker.vue +7 -0
  202. package/components/toolbar/index.js +2 -0
  203. package/components/transfer/index.js +4 -4
  204. package/components/transfer/transfer-element.vue +109 -0
  205. package/components/transfer/transfer.vue +22 -7
  206. package/components/tree/tree.vue +175 -16
  207. package/components/video/video.vue +50 -2
  208. package/package.json +12 -1
  209. package/uni-common/more-button/more-button.vue +23 -0
  210. package/uni-common/popup-select/popup-select.vue +217 -0
  211. package/uni-common/portray/portray.vue +54 -0
  212. package/uni-common/refresh-view/refresh-view.vue +94 -0
  213. package/uni-common/scroll-load-more/scroll-load-more.vue +201 -0
  214. package/uni-common/tree-popup-select/index.js +3 -0
  215. package/uni-common/tree-popup-select/tree-popup-select-panel.vue +92 -0
  216. package/uni-common/tree-popup-select/tree-popup-select.vue +124 -0
  217. package/uni-common/tree-popup-select/util.js +19 -0
  218. package/uni-common/wechat-emoji/index.js +13 -0
  219. package/uni-common/wechat-emoji/order.json +438 -0
  220. package/uni-common/wechat-emoji/utils.js +52 -0
  221. package/uni-common/wechat-emoji/wechat-emoji.vue +74 -0
  222. package/uni-components/avatar/avatar.vue +81 -0
  223. package/uni-components/badge/badge.vue +57 -0
  224. package/uni-components/empty/empty.vue +27 -0
  225. package/uni-components/exception/exception.vue +47 -0
  226. package/uni-components/icon/demo.css +539 -0
  227. package/uni-components/icon/demo_index.html +1591 -0
  228. package/uni-components/icon/icon.vue +48 -0
  229. package/uni-components/icon/iconfont.css +259 -0
  230. package/uni-components/icon/iconfont.js +1 -0
  231. package/uni-components/icon/iconfont.json +436 -0
  232. package/uni-components/icon/iconfont.ttf +0 -0
  233. package/uni-components/icon/iconfont.woff +0 -0
  234. package/uni-components/icon/iconfont.woff2 +0 -0
  235. package/uni-components/icon/index.js +3 -0
  236. package/uni-components/image/image.vue +38 -0
  237. package/uni-components/image/index.js +3 -0
  238. package/uni-components/loading/index.js +3 -0
  239. package/uni-components/loading/loading.vue +30 -0
  240. package/uni-components/message/message-item.vue +29 -0
  241. package/uni-components/message/message.js +80 -0
  242. package/uni-components/message/message.vue +30 -0
  243. package/uni-components/message-box/message-box-item.vue +54 -0
  244. package/uni-components/message-box/message-box.js +91 -0
  245. package/uni-components/message-box/message-box.vue +52 -0
  246. package/uni-components/picker/picker.vue +270 -0
  247. package/uni-components/popup/index.js +3 -0
  248. package/uni-components/popup/popup.vue +143 -0
  249. package/uni-components/search/index.js +3 -0
  250. package/uni-components/search/search.vue +86 -0
  251. package/uni-components/skeleton/skeleton-chat.vue +85 -0
  252. package/uni-components/skeleton/skeleton-contact.vue +84 -0
  253. package/uni-components/skeleton/skeleton-detail.vue +84 -0
  254. package/uni-components/skeleton/skeleton.vue +32 -0
  255. package/uni-components/tabbar/tabbar-item.vue +33 -0
  256. package/uni-components/tabbar/tabbar.vue +87 -0
  257. package/uni-components/tree/index.js +3 -0
  258. package/uni-components/tree/tree-select-loading.vue +48 -0
  259. package/uni-components/tree/tree-select-node.vue +202 -0
  260. package/uni-components/tree/tree-select-store.js +520 -0
  261. package/uni-components/tree/tree-select.vue +210 -0
  262. package/uni-components/tree/utils.js +33 -0
  263. package/uni-components/video/index.js +3 -0
  264. package/uni-components/video/video.vue +29 -0
  265. package/uni-components/voice/index.js +3 -0
  266. package/uni-components/voice/voice.vue +24 -0
  267. package/uni-components/waterfall/index.js +3 -0
  268. package/uni-components/waterfall/util.js +72 -0
  269. package/uni-components/waterfall/waterfall.vue +147 -0
  270. package/utils/data.js +128 -0
  271. package/utils/date.js +484 -44
  272. package/utils/dom.js +37 -0
  273. package/utils/event.js +92 -0
  274. package/utils/file.js +76 -0
  275. package/utils/json.js +22 -1
  276. package/utils/network-detector.js +258 -0
  277. package/utils/oss.js +11 -0
  278. package/utils/share-message.js +81 -0
  279. package/utils/share-websocket.js +127 -0
  280. package/utils/string.js +59 -0
  281. package/utils/time-task.js +60 -0
  282. package/utils/url.js +46 -0
  283. package/utils/util.js +416 -1
@@ -4,6 +4,7 @@
4
4
  :class="className"
5
5
  :style="style"
6
6
  :title="title"
7
+ @click="handleClick"
7
8
  >
8
9
  <div class="ui-image__main" :style="mainStyle">
9
10
  <img
@@ -17,6 +18,7 @@
17
18
  <ui-icon
18
19
  v-if="status === 'error'"
19
20
  name="image-error-line"
21
+ class="ui-image__error"
20
22
  :size="iconSize"
21
23
  color="#aaa"
22
24
  ></ui-icon>
@@ -28,7 +30,8 @@
28
30
  </template>
29
31
  <script>
30
32
  import UiIcon from '../icon'
31
- import { fileToBase64, getImageClickFn } from './util'
33
+ import { fileToBase64, getImageClickFn, getThumbnailSrc } from './util'
34
+ import { formatOssPath } from '../../utils/oss'
32
35
 
33
36
  const LoadStatus = {
34
37
  normal: 'normal',
@@ -54,6 +57,14 @@ export default {
54
57
  maxHeight: {
55
58
  type: Number
56
59
  },
60
+ /**
61
+ * 启动裁剪
62
+ * 开启了服务端裁剪,图片尺寸默认等比根据宽带进行处理,如果width是100px那么裁剪的尺寸就是200px,放大一倍,如果没有给width|maxWidth,那么就给固定的1024px
63
+ */
64
+ enableThumbnail: {
65
+ type: Boolean,
66
+ default: true
67
+ },
57
68
  fit: {
58
69
  type: String,
59
70
  default: 'none',
@@ -62,7 +73,7 @@ export default {
62
73
  }
63
74
  },
64
75
  src: {
65
- type: [String, File]
76
+ type: [String, File, Function]
66
77
  },
67
78
  alt: {
68
79
  type: String
@@ -72,7 +83,7 @@ export default {
72
83
  default: false
73
84
  },
74
85
  radius: {
75
- type: Number,
86
+ type: [Number, String],
76
87
  default: 6
77
88
  },
78
89
  loading: {
@@ -104,13 +115,19 @@ export default {
104
115
  }
105
116
  return sy
106
117
  },
118
+ innerRadius () {
119
+ if (typeof this.radius === 'number') {
120
+ return this.radius + 'px'
121
+ }
122
+ return this.radius
123
+ },
107
124
  mainStyle () {
108
125
  const sy = {
109
- 'border-radius': this.radius + 'px'
126
+ 'border-radius': this.innerRadius + 'px'
110
127
  }
111
- if (this.fit) {
128
+ if (this.fit && this.status !== LoadStatus.error) {
112
129
  if (this.fit === 'none') {
113
- sy['background-color'] = '#000'
130
+ sy['background-color'] = 'rgba(0,0,0,.05)'
114
131
  }
115
132
  }
116
133
  return sy
@@ -125,6 +142,8 @@ export default {
125
142
  sy.height = 'auto'
126
143
  } else {
127
144
  sy['object-fit'] = this.fit
145
+ sy['max-width'] = this.maxWidth ? this.maxWidth + 'px' : ''
146
+ sy['max-height'] = this.maxHeight ? this.maxHeight + 'px' : ''
128
147
  sy.width = '100%'
129
148
  sy.height = '100%'
130
149
  }
@@ -138,7 +157,7 @@ export default {
138
157
  return this.alt
139
158
  },
140
159
  iconSize () {
141
- return this.clientWidth / 2
160
+ return Math.max(this.clientWidth / 2, 18)
142
161
  },
143
162
  className () {
144
163
  return ['is-' + this.status, { 'is-gray': this.gray }]
@@ -160,6 +179,9 @@ export default {
160
179
  this.clientWidth = this.$el.clientWidth
161
180
  },
162
181
  methods: {
182
+ handleClick () {
183
+ this.$emit('click')
184
+ },
163
185
  handlePreviewClick () {
164
186
  if (this.previewMethod) {
165
187
  this.previewMethod()
@@ -175,17 +197,28 @@ export default {
175
197
  this.$emit('load')
176
198
  },
177
199
  handleImageError () {
178
- this.status = LoadStatus.error
179
- this.$emit('error')
200
+ // 阿里云缩放只支持20971520字节大小图片,超过会报错,所以需要回退到原图
201
+ if (this.enableThumbnail) {
202
+ const nextSource = formatOssPath(this.source)
203
+ if (nextSource !== this.source) {
204
+ this.source = nextSource
205
+ } else {
206
+ this.status = LoadStatus.error
207
+ this.$emit('error')
208
+ }
209
+ } else {
210
+ this.status = LoadStatus.error
211
+ this.$emit('error')
212
+ }
180
213
  },
181
214
  preview () {
182
- if (!this.src) {
215
+ if (!this.source) {
183
216
  return
184
217
  }
185
218
  const clickFn = getImageClickFn()
186
219
  if (clickFn) {
187
220
  clickFn({
188
- src: this.src
221
+ src: formatOssPath(this.source)
189
222
  })
190
223
  }
191
224
  },
@@ -202,13 +235,36 @@ export default {
202
235
  }, () => {
203
236
  this.status = LoadStatus.error
204
237
  })
238
+ } else if (typeof this.src === 'function') {
239
+ const rs = this.src()
240
+ if (rs && rs.then) {
241
+ this.status = LoadStatus.loading
242
+ rs.then(rs => {
243
+ this.source = rs
244
+ }, () => {
245
+ this.status = LoadStatus.error
246
+ })
247
+ } else {
248
+ this.source = rs
249
+ }
205
250
  } else {
206
- this.source = this.src
251
+ if (this.enableThumbnail) {
252
+ // 放大1.5倍
253
+ let thumbnailWidth = parseInt(this.width)
254
+ if (!isNaN(thumbnailWidth)) {
255
+ thumbnailWidth = thumbnailWidth * 1.5
256
+ } else {
257
+ thumbnailWidth = 720
258
+ }
259
+ this.source = formatOssPath(getThumbnailSrc(this.src, thumbnailWidth))
260
+ } else {
261
+ this.source = formatOssPath(this.src)
262
+ }
207
263
  }
208
264
  }
209
265
  },
210
266
  updateLoading () {
211
- if (!this.src) {
267
+ if (!this.source) {
212
268
  this.status = this.loading ? LoadStatus.loading : LoadStatus.normal
213
269
  } else {
214
270
  if (typeof this.loading === 'boolean') {
@@ -247,6 +303,27 @@ export default {
247
303
  &.is-error,&.is-normal{
248
304
  background-color: #eee;
249
305
  }
306
+ &.is-error {
307
+ line-height: 1em;
308
+ width: 100%;
309
+ height: 100%;
310
+ .ui-image__main{
311
+ width: 100%;
312
+ height: 100%;
313
+ min-width: 32px;
314
+ min-height: 32px;
315
+ position: relative;
316
+ }
317
+ img {
318
+ display: none!important;
319
+ }
320
+ .ui-image__error{
321
+ position: absolute;
322
+ left: 50%;
323
+ top: 50%;
324
+ transform: translate(-50%, -50%);
325
+ }
326
+ }
250
327
  &.is-success{
251
328
  .ui-image__img{
252
329
  display: inline-block;
@@ -265,6 +342,7 @@ export default {
265
342
  align-items: center;
266
343
  overflow: hidden;
267
344
  position: relative;
345
+ border-radius: 4px;
268
346
  }
269
347
  .ui-image__img{
270
348
  display: none;
@@ -1,5 +1,5 @@
1
1
  import Image from './image'
2
- import { setImageClickFn } from './util'
2
+ import { setImageClickFn, getThumbnailSrc as _getThumbnailSrc } from './util'
3
3
 
4
4
  Image.install = (Vue, options) => {
5
5
  options = Object.assign({
@@ -9,4 +9,6 @@ Image.install = (Vue, options) => {
9
9
  Vue.component(Image.name, Image)
10
10
  }
11
11
 
12
+ export const getThumbnailSrc = _getThumbnailSrc
13
+
12
14
  export default Image
@@ -1,3 +1,5 @@
1
+ import { buildUrl, getUrlParams } from "../../utils/url"
2
+
1
3
  export function fileToBase64 (file) {
2
4
  return new Promise((resolve, reject) => {
3
5
  if (!file) {
@@ -23,4 +25,83 @@ export function setImageClickFn (fn) {
23
25
 
24
26
  export function getImageClickFn () {
25
27
  return imageClickFn
26
- }
28
+ }
29
+
30
+ /**
31
+ * 获取裁剪路径
32
+ */
33
+ export function getThumbnailSrc (url, width) {
34
+ if (!url || !width) {
35
+ return url
36
+ }
37
+ let hash = url.split('#')[1]
38
+ // 新的后端拼接的oss地址
39
+ if (url.indexOf('/oss/view') > -1) {
40
+ // 这是1.0的
41
+ // http://localhost:8090/oss/view?url=https://wpj-dev3-kefures.oss-cn-shenzhen.aliyuncs.com/weremote/chat-logs/90fab9f6a2a54d60bfeba431adeb9e38/7eabb34fa8e824381310fbd8667a4404/3/3957413896365727039.jpg
42
+ const urlParams = getUrlParams(url)
43
+ if (!urlParams.url) {
44
+ return url
45
+ }
46
+ let nextUrl = urlParams.url
47
+ if (nextUrl.indexOf('.aliyuncs.com') > -1) {
48
+ if (nextUrl.indexOf('?') >= 0) {
49
+ nextUrl = nextUrl + '&x-oss-process=image/resize,w_' + width
50
+ } else {
51
+ nextUrl = nextUrl + '?x-oss-process=image/resize,w_' + width
52
+ }
53
+ } else if (nextUrl.indexOf('.myqcloud.com') > -1) {
54
+ if (nextUrl.indexOf('?') >= 0) {
55
+ nextUrl = nextUrl + '&imageMogr2/thumbnail/' + width
56
+ } else {
57
+ nextUrl = nextUrl + '?imageMogr2/thumbnail/' + width
58
+ }
59
+ }
60
+ url = buildUrl(url.substr(0, url.indexOf('/oss/view') + 9), Object.assign({}, urlParams, {
61
+ url: nextUrl
62
+ }))
63
+ } else if (url.indexOf('/oss/') > -1) {
64
+ // 这是3.0的
65
+ // https://dev.ifangzhou.com/oss/?url=https%3A%2F%2Fw…5856.jpg%3Fx-oss-process%3Dimage%2Fresize%2Cw_720
66
+ const urlParams = getUrlParams(url)
67
+ if (!urlParams.url) {
68
+ return url
69
+ }
70
+ let nextUrl = urlParams.url
71
+ if (nextUrl.indexOf('.aliyuncs.com') > -1) {
72
+ if (nextUrl.indexOf('?') >= 0) {
73
+ nextUrl = nextUrl + '&x-oss-process=image/resize,w_' + width
74
+ } else {
75
+ nextUrl = nextUrl + '?x-oss-process=image/resize,w_' + width
76
+ }
77
+ } else if (nextUrl.indexOf('.myqcloud.com') > -1) {
78
+ if (nextUrl.indexOf('?') >= 0) {
79
+ nextUrl = nextUrl + '&imageMogr2/thumbnail/' + width
80
+ } else {
81
+ nextUrl = nextUrl + '?imageMogr2/thumbnail/' + width
82
+ }
83
+ }
84
+ url = buildUrl(url.substr(0, url.indexOf('/oss/') + 5), Object.assign({}, urlParams, {
85
+ url: nextUrl
86
+ }))
87
+ } else {
88
+ if (url.indexOf('.aliyuncs.com') > -1) {
89
+ if (url.indexOf('?') >= 0) {
90
+ url = url + '&x-oss-process=image/resize,w_' + width
91
+ } else {
92
+ url = url + '?x-oss-process=image/resize,w_' + width
93
+ }
94
+ } else if (url.indexOf('.myqcloud.com') > -1) {
95
+ if (url.indexOf('?') >= 0) {
96
+ url = url + '&imageMogr2/thumbnail/' + width
97
+ } else {
98
+ url = url + '?imageMogr2/thumbnail/' + width
99
+ }
100
+ }
101
+ }
102
+ if (hash) {
103
+ return url + '#' + hash
104
+ } else {
105
+ return url
106
+ }
107
+ }
@@ -47,6 +47,7 @@ import Tree from './tree'
47
47
  import PopupSelect from './popup-select'
48
48
  import Panel from './panel'
49
49
  import Transfer from './transfer'
50
+ import Tabbar from './tabbar'
50
51
 
51
52
  export {
52
53
  AdvancedFilter,
@@ -97,16 +98,18 @@ export {
97
98
  Tag,
98
99
  Tree,
99
100
  Transfer,
100
- Video
101
+ Video,
102
+ Tabbar
101
103
  }
102
104
 
103
105
  export default {
104
106
  install (Vue, options = {}) {
105
107
  Vue.use(Button)
106
108
  Vue.use(Dropdown)
109
+ Vue.use(AdvancedFilter)
107
110
  Vue.use(Switch)
108
111
  Vue.use(Icon)
109
- Vue.use(Image)
112
+ Vue.use(Image, options.image)
110
113
  Vue.use(Popover)
111
114
  Vue.use(Toolbar)
112
115
  Vue.use(Tooltip)
@@ -149,5 +152,6 @@ export default {
149
152
  Vue.use(Transfer)
150
153
  Vue.use(Tree)
151
154
  Vue.use(Skeleton)
155
+ Vue.use(Tabbar)
152
156
  }
153
157
  }
@@ -2,13 +2,19 @@ import Menu from './menu'
2
2
  import MenuGroup from './menu-group'
3
3
  import MenuItem from './menu-item'
4
4
 
5
- export default {
5
+ Menu.install = (Vue) => {
6
+ Vue.component(Menu.name, Menu)
7
+ Vue.component(MenuGroup.name, MenuGroup)
8
+ Vue.component(MenuItem.name, MenuItem)
9
+ }
10
+
11
+ Menu.MenuGroup = MenuGroup
12
+ Menu.MenuItem = MenuItem
13
+
14
+ export {
6
15
  Menu,
7
16
  MenuGroup,
8
- MenuItem,
9
- install (Vue) {
10
- Vue.component(Menu.name, Menu)
11
- Vue.component(MenuGroup.name, MenuGroup)
12
- Vue.component(MenuItem.name, MenuItem)
13
- }
17
+ MenuItem
14
18
  }
19
+
20
+ export default Menu
@@ -3,6 +3,7 @@
3
3
  <router-link
4
4
  v-if="isLink"
5
5
  :to="path"
6
+ :exact="exact"
6
7
  class="ui-menu-group__head"
7
8
  @click="handleToggleClick"
8
9
  >
@@ -61,6 +62,10 @@ export default {
61
62
  path: {
62
63
  type: String
63
64
  },
65
+ exact: {
66
+ type: Boolean,
67
+ default: true
68
+ },
64
69
  checkActiveMethod: {
65
70
  type: Function
66
71
  }
@@ -135,7 +140,7 @@ export default {
135
140
  if (isExactActive) {
136
141
  return true
137
142
  }
138
- if (isActive) {
143
+ if (!this.exact && isActive) {
139
144
  if (this.activeLink && this.activeLink !== href) {
140
145
  return false
141
146
  } else {
@@ -4,6 +4,7 @@
4
4
  :is="isLink ? 'router-link' : 'span'"
5
5
  class="ui-menu-item__main"
6
6
  :to="path"
7
+ :exact="exact"
7
8
  >
8
9
  <ui-icon v-if="icon" :name="icon" class="ui-menu-item__icon"></ui-icon>
9
10
  <span v-if="label || $slots.default" class="ui-menu-item__text" :title="label">
@@ -35,6 +36,10 @@ export default {
35
36
  path: {
36
37
  type: String
37
38
  },
39
+ exact: {
40
+ type: Boolean,
41
+ default: true
42
+ },
38
43
  type: {
39
44
  type: String,
40
45
  default: 'default',
@@ -86,6 +91,12 @@ export default {
86
91
  display: block;
87
92
  }
88
93
  .ui-menu--float{
94
+ .ui-menu-item {
95
+ &.is-active .ui-menu-item__main{
96
+ background-color: #edf3fb;
97
+ color: #0052CC;
98
+ }
99
+ }
89
100
  .ui-menu-item__main{
90
101
  display: block;
91
102
  line-height: 24px;
@@ -93,15 +104,14 @@ export default {
93
104
  cursor: pointer;
94
105
  transition: all .3s;
95
106
  &:hover{
96
- background-color: #f0f8fc;
97
- color: #00A0EB;
107
+ background-color: #f8f8f8;
98
108
  }
99
109
  }
100
110
  .ui-menu-item__icon{
101
111
  display: inline-block;
102
112
  vertical-align: top;
103
113
  margin-right: 4px;
104
- }
114
+ }
105
115
  .ui-menu-item{
106
116
  &.is-devided{
107
117
  padding: 0;
@@ -212,4 +222,48 @@ export default {
212
222
  }
213
223
  }
214
224
  }
225
+ .ui-menu--radius{
226
+ padding: 8px;
227
+ .ui-menu-item__main{
228
+ display: block;
229
+ line-height: 24px;
230
+ padding: 6px 8px;
231
+ white-space: nowrap;
232
+ overflow: hidden;
233
+ text-overflow: ellipsis;
234
+ cursor: pointer;
235
+ transition: all .3s;
236
+ border-radius: 5px;
237
+ color: #4E5969;
238
+ &:hover{
239
+ background-color: #f7f8fa;
240
+ color: #4c9aff;
241
+ }
242
+ }
243
+ .ui-menu-item__icon{
244
+ display: inline-block;
245
+ vertical-align: top;
246
+ margin-right: 4px;
247
+ }
248
+ .ui-menu-item{
249
+ &:not(:last-child) {
250
+ margin-bottom: 6px;
251
+ }
252
+ &:hover, &.is-active {
253
+ .ui-menu-item__main{
254
+ background-color: #f7f8fa;
255
+ color: #4c9aff;
256
+ }
257
+ }
258
+ &.is-devided{
259
+ padding: 0;
260
+ height: 1px;
261
+ background: #eee;
262
+ margin: 6px 0;
263
+ .ui-menu-item__main{
264
+ display: none;
265
+ }
266
+ }
267
+ }
268
+ }
215
269
  </style>
@@ -16,7 +16,7 @@ export default {
16
16
  type: String,
17
17
  default: 'static',
18
18
  validator (value) {
19
- return ['static', 'float', 'box'].indexOf(value) >= 0
19
+ return ['static', 'float', 'box', 'radius'].indexOf(value) >= 0
20
20
  }
21
21
  },
22
22
  current: {
@@ -2,22 +2,25 @@ import Message from 'element-ui/lib/message'
2
2
  import 'element-ui/lib/theme-chalk/icon.css'
3
3
  import 'element-ui/lib/theme-chalk/message.css'
4
4
 
5
- const warn = (message) => {
6
- Message({
5
+ const warn = (message, onClose) => {
6
+ return Message({
7
7
  message,
8
- type: 'warning'
8
+ type: 'warning',
9
+ onClose
9
10
  })
10
11
  }
11
- const success = (message) => {
12
- Message({
12
+ const success = (message, onClose) => {
13
+ return Message({
13
14
  message,
14
- type: 'success'
15
+ type: 'success',
16
+ onClose
15
17
  })
16
18
  }
17
- const error = (message) => {
18
- Message({
19
+ const error = (message, onClose) => {
20
+ return Message({
19
21
  message,
20
- type: 'error'
22
+ type: 'error',
23
+ onClose
21
24
  })
22
25
  }
23
26
 
@@ -7,4 +7,8 @@ MessageBox.install = (Vue) => {
7
7
  // Vue.prototype.$confirmDel = MessageBox.confirmDel
8
8
  }
9
9
 
10
+ MessageBox.message = MessageBox.message
11
+ MessageBox.alert = MessageBox.alert
12
+ MessageBox.confirm = MessageBox.confirm
13
+
10
14
  export default MessageBox
@@ -61,6 +61,10 @@ export default {
61
61
  allowSelectPageSize: {
62
62
  type: Boolean,
63
63
  default: false
64
+ },
65
+ pageSizeList: {
66
+ type: Array,
67
+ default: () => [20, 50, 100, 200]
64
68
  }
65
69
  },
66
70
  data () {
@@ -68,11 +72,11 @@ export default {
68
72
  innerPageSize: this.pageSize
69
73
  }
70
74
  },
71
- computed: {
72
- pageSizeList () {
73
- return [20, 50, 100, 200]
74
- }
75
- },
75
+ // computed: {
76
+ // pageSizeList () {
77
+ // return [20, 50, 100, 200]
78
+ // }
79
+ // },
76
80
  methods: {
77
81
  // 每页显示行数发生变化触发
78
82
  handlePageSizeChange (value) {
@@ -156,9 +160,11 @@ export default {
156
160
  margin-left: 6px;
157
161
  font-weight: normal;
158
162
  &:hover {
163
+ color: #172b4d;
159
164
  border-color: #172b4d;
160
165
  }
161
166
  &.active {
167
+ background-color: #172b4d;
162
168
  border-color: #172b4d;
163
169
  color: #fff;
164
170
  }
@@ -180,8 +186,6 @@ export default {
180
186
  color: #172b4d;
181
187
  }
182
188
  }
183
- .el-pagination__total{
184
- }
185
189
  .el-pagination__sizes,
186
190
  .el-pagination__jump {
187
191
  .el-input__inner {
@@ -13,7 +13,8 @@
13
13
  @after-enter="handleAfterShow"
14
14
  @after-leave="handleAfterHide"
15
15
  >
16
- <slot></slot>
16
+ <component v-if="contentComponent" :is="contentComponent" :visible="innerVisible"></component>
17
+ <slot v-else></slot>
17
18
  <template slot="reference">
18
19
  <slot name="reference"></slot>
19
20
  </template>
@@ -65,6 +66,11 @@ export default {
65
66
  type: String
66
67
  }
67
68
  },
69
+ data () {
70
+ return {
71
+ contentComponent: null
72
+ }
73
+ },
68
74
  computed: {
69
75
  popperClass () {
70
76
  const cls = ['ui-popover']
@@ -96,6 +102,20 @@ export default {
96
102
  updatePopper () {
97
103
  this.$refs.popover && this.$refs.popover.updatePopper()
98
104
  },
105
+ setReferenceElm ($el) {
106
+ clearTimeout(this._timer)
107
+ this._timer = setTimeout(() => {
108
+ if (this.$refs.popover.popperJS) {
109
+ this.$refs.popover.popperJS._reference = $el
110
+ } else {
111
+ this.$refs.popover.referenceElm = $el
112
+ }
113
+ this.$refs.popover.updatePopper()
114
+ }, 30)
115
+ },
116
+ setContentComponent (component) {
117
+ this.contentComponent = component
118
+ },
99
119
  handleShow () {
100
120
  this.$emit('show')
101
121
  },
@@ -108,6 +128,9 @@ export default {
108
128
  handleAfterHide () {
109
129
  this.$emit('after-hide')
110
130
  }
131
+ },
132
+ beforeDestroy () {
133
+ clearTimeout(this._timer)
111
134
  }
112
135
  }
113
136
  </script>