cmd-progress.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <view class="cmd-progress cmd-progress-default" :class="setStatusClass">
  3. <block v-if="type == 'circle' || type == 'dashboard'">
  4. <view class="cmd-progress cmd-progress-default" :class="setStatusClass">
  5. <view class="cmd-progress-inner" :style="setCircleStyle">
  6. <!-- 绘制圈 start -->
  7. <!-- #ifdef H5 -->
  8. <svg viewBox="0 0 100 100" class="cmd-progress-circle">
  9. <path :d="setCirclePath" stroke="#f3f3f3" :stroke-linecap="strokeShape" :stroke-width="strokeWidth"
  10. fill-opacity="0" class="cmd-progress-circle-trail" :style="setCircleTrailStyle"></path>
  11. <path :d="setCirclePath" :stroke-linecap="strokeShape" :stroke-width="strokeWidth" fill-opacity="0" class="cmd-progress-circle-path"
  12. :style="setCirclePathStyle"></path>
  13. </svg>
  14. <!-- #endif -->
  15. <!-- #ifndef H5 -->
  16. <text :style="setCircle"></text>
  17. <!-- #endif -->
  18. <!-- 绘制圈 end -->
  19. <!-- 状态文本 start -->
  20. <block v-if="showInfo">
  21. <text class="cmd-progress-text" :title="setFormat">
  22. <block v-if="status != 'success' && status != 'exception' && setProgress < 100">{{setFormat}}</block>
  23. <!-- #ifdef H5 -->
  24. <svg v-if="status == 'exception'" viewBox="64 64 896 896" data-icon="close" width="1em" height="1em" fill="currentColor"
  25. aria-hidden="true">
  26. <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path>
  27. </svg>
  28. <svg v-if="status == 'success' || setProgress == 100" viewBox="64 64 896 896" data-icon="check" width="1em"
  29. height="1em" fill="currentColor" aria-hidden="true" :style="{'color': strokeColor ? strokeColor : ''}">
  30. <path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path>
  31. </svg>
  32. <!-- #endif -->
  33. <!-- #ifndef H5 -->
  34. <text v-if="status == 'exception' || status == 'success' || setProgress == 100" :style="setCircleIcon"></text>
  35. <!-- #endif -->
  36. </text>
  37. </block>
  38. <!-- 状态文本 end -->
  39. </view>
  40. </view>
  41. </block>
  42. <block v-if="type == 'line'">
  43. <!-- 进度条 start -->
  44. <view class="cmd-progress-outer">
  45. <view class="cmd-progress-inner" :style="{'border-radius': strokeShape == 'square' ? 0 : '100px'}">
  46. <view class="cmd-progress-bg" :style="setLineStyle"></view>
  47. <view v-if="successPercent" class="cmd-progress-success-bg" :style="setLineSuccessStyle"></view>
  48. </view>
  49. </view>
  50. <!-- 进度条 end -->
  51. <!-- 进度条是否显示信息 start -->
  52. <block v-if="showInfo">
  53. <text class="cmd-progress-text" :title="setFormat">
  54. <block v-if="status != 'success' && status != 'exception' && setProgress < 100">{{setFormat}}</block>
  55. <!-- #ifdef H5 -->
  56. <svg v-if="status == 'exception'" viewBox="64 64 896 896" data-icon="close-circle" width="1em" height="1em"
  57. fill="currentColor" aria-hidden="true">
  58. <path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"></path>
  59. </svg>
  60. <svg v-if="status == 'success' || setProgress == 100" viewBox="64 64 896 896" data-icon="check-circle" width="1em"
  61. height="1em" fill="currentColor" aria-hidden="true" :style="{'color': strokeColor ? strokeColor : ''}">
  62. <path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"></path>
  63. </svg>
  64. <!-- #endif -->
  65. <!-- #ifndef H5 -->
  66. <text v-if="status == 'exception' || status == 'success' || setProgress == 100" :style="setLineStatusIcon"></text>
  67. <!-- #endif -->
  68. </text>
  69. </block>
  70. <!-- 进度条是否显示信息 end -->
  71. </block>
  72. </view>
  73. </template>
  74. <script>
  75. /**
  76. * 进度条组件
  77. * @description 显示一个操作完成的百分比时,为用户显示该操作的当前进度和状态。
  78. * @tutorial https://ext.dcloud.net.cn/plugin?id=259
  79. * @property {String} type 进度类型 - 线型:line、圆圈形:circle、仪表盘:dashboard,默认线型:line
  80. * @property {Number} percent 进度百分比值 - 显示范围0-100 ,可能数比较大就需要自己转成百分比的值
  81. * @property {Number} success-percent 进度已完成的百分几 - 仅支持进度线型:line
  82. * @property {String} status 进度状态 - 涌动:active(仅支持线型:line)、正常:normal、完成:success、失败:exception,默认正常:normal
  83. * @property {Boolean} show-info 进度状态信息 - 是否显示进度数值或状态图标,默认true
  84. * @property {Number} stroke-width 进度线条的宽度 - 建议在条线的宽度范围:1-50,与进度条显示宽度有关,默认8
  85. * @property {String} stroke-color 进度线条的颜色 - 渐变色仅支持线型:line
  86. * @property {String} stroke-shape 进度线条两端的形状 - 圆:round、方块直角:square,默认圆:round
  87. * @property {Number} width 进度画布宽度 - 仅支持圆圈形:circle、仪表盘:dashboard,默认80
  88. * @property {String} gap-degree 进度圆形缺口角度 - 可取值 0 ~ 360,仅支持圆圈形:circle、仪表盘:dashboard
  89. * @property {String} gap-position 进度圆形缺口位置 - 可取值'top', 'bottom', 'left', 'right',仅支持圆圈形:circle、仪表盘:dashboard
  90. * @example <cmd-progress :percent="30"></cmd-progress>
  91. */
  92. export default {
  93. name: 'cmd-progress',
  94. props: {
  95. /**
  96. * 类型默认:line,可选 line circle dashboard
  97. */
  98. type: {
  99. validator: val => {
  100. return ['line', 'circle', 'dashboard'].includes(val);
  101. },
  102. default: 'line'
  103. },
  104. /**
  105. * 百分比
  106. */
  107. percent: {
  108. type: Number,
  109. default: 0
  110. },
  111. /**
  112. * 已完成的分段百分,仅支持类型line
  113. */
  114. successPercent: {
  115. type: Number,
  116. default: 0
  117. },
  118. /**
  119. * 是否显示进度数值或状态图标
  120. */
  121. showInfo: {
  122. type: Boolean,
  123. default: true
  124. },
  125. /**
  126. * 进度状态,可选:normal success exception (active仅支持类型line
  127. */
  128. status: {
  129. validator: val => {
  130. return ['normal', 'success', 'exception', 'active'].includes(val);
  131. },
  132. default: 'normal'
  133. },
  134. /**
  135. * 条线的宽度1-50,与width有关
  136. */
  137. strokeWidth: {
  138. type: Number,
  139. default: 6
  140. },
  141. /**
  142. * 条线的颜色,渐变色仅支持类型line
  143. */
  144. strokeColor: {
  145. type: String,
  146. default: ''
  147. },
  148. /**
  149. * 条线两端的形状 可选:'round', 'square'
  150. */
  151. strokeShape: {
  152. validator: val => {
  153. return ['round', 'square'].includes(val);
  154. },
  155. default: 'round'
  156. },
  157. /**
  158. * 圆形进度条画布宽度,支持类型circle dashboard
  159. */
  160. width: {
  161. type: Number,
  162. default: 80
  163. },
  164. /**
  165. * 圆形进度条缺口角度,可取值 0 ~ 360,支持类型circle dashboard
  166. */
  167. gapDegree: {
  168. type: Number,
  169. default: 0
  170. },
  171. /**
  172. * 圆形进度条缺口位置,可取值'top', 'bottom', 'left', 'right' ,支持类型circle dashboard
  173. */
  174. gapPosition: {
  175. validator: val => {
  176. return ['top', 'bottom', 'left', 'right'].includes(val);
  177. },
  178. default: 'top'
  179. }
  180. },
  181. computed: {
  182. /**
  183. * 如果需要自定义格式就在这改
  184. */
  185. setFormat() {
  186. return `${this.setProgress}%`;
  187. },
  188. /**
  189. * 设置显示进度值,禁止小于0和超过100
  190. */
  191. setProgress() {
  192. let percent = this.percent;
  193. if (!this.percent || this.percent < 0) {
  194. percent = 0;
  195. } else if (this.percent >= 100) {
  196. percent = 100;
  197. }
  198. return percent;
  199. },
  200. /**
  201. * 进度圈svg大小
  202. */
  203. setCircleStyle() {
  204. return `width: ${this.width}px;
  205. height: ${this.width}px;
  206. fontSize: ${this.width * 0.15 + 6}px;`
  207. },
  208. /**
  209. * 圈底色
  210. */
  211. setCircleTrailStyle() {
  212. const radius = 50 - this.strokeWidth / 2;
  213. const len = Math.PI * 2 * radius;
  214. const gapDeg = this.gapDegree || (this.type === 'dashboard' && 75);
  215. return `stroke-dasharray: ${len - (gapDeg||0)}px, ${len}px;
  216. stroke-dashoffset: -${(gapDeg||0) / 2}px;
  217. transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s;`
  218. },
  219. /**
  220. * 圈进度
  221. */
  222. setCirclePathStyle() {
  223. const radius = 50 - this.strokeWidth / 2;
  224. const len = Math.PI * 2 * radius;
  225. const gapDeg = this.gapDegree || (this.type === 'dashboard' && 75);
  226. return `stroke: ${this.strokeColor};
  227. stroke-dasharray: ${(this.setProgress / 100) * (len - (gapDeg||0))}px, ${len}px;
  228. stroke-dashoffset: -${(gapDeg||0) / 2}px;
  229. transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s, stroke-width 0.06s ease 0.3s;`
  230. },
  231. /**
  232. * 绘制圈
  233. */
  234. setCirclePath() {
  235. const radius = 50 - this.strokeWidth / 2;
  236. let beginPositionX = 0;
  237. let beginPositionY = -radius;
  238. let endPositionX = 0;
  239. let endPositionY = -2 * radius;
  240. const gapPos = (this.type === 'dashboard' && 'bottom') || this.gapPosition || 'top';
  241. switch (gapPos) {
  242. case 'left':
  243. beginPositionX = -radius;
  244. beginPositionY = 0;
  245. endPositionX = 2 * radius;
  246. endPositionY = 0;
  247. break;
  248. case 'right':
  249. beginPositionX = radius;
  250. beginPositionY = 0;
  251. endPositionX = -2 * radius;
  252. endPositionY = 0;
  253. break;
  254. case 'bottom':
  255. beginPositionY = radius;
  256. endPositionY = 2 * radius;
  257. break;
  258. default:
  259. break;
  260. }
  261. return `M 50,50 m ${beginPositionX},${beginPositionY} a ${radius},${radius} 0 1 1 ${endPositionX},${-endPositionY} a ${radius},${radius} 0 1 1 ${-endPositionX},${endPositionY}`;
  262. },
  263. // #ifndef H5
  264. /**
  265. * 非H5端,绘制进度圈svg转base URL
  266. */
  267. setCircle() {
  268. const radius = 50 - this.strokeWidth / 2;
  269. const len = Math.PI * 2 * radius;
  270. const gapDeg = this.gapDegree || (this.type === 'dashboard' && 75);
  271. let currentColor = '#108ee9'
  272. // 异常进度
  273. if (this.status == 'exception') {
  274. currentColor = '#f5222d'
  275. }
  276. // 完成进度
  277. if (this.status == 'success' || this.setProgress >= 100 || this.strokeColor) {
  278. currentColor = this.strokeColor || '#52c41a'
  279. }
  280. let svgToBase =
  281. `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' class='cmd-progress-circle'%3E%3Cpath d='${this.setCirclePath}' stroke='%23f3f3f3' stroke-linecap='${this.strokeShape}' stroke-width='${this.strokeWidth}' fill-opacity='0' class='cmd-progress-circle-trail' style='stroke-dasharray: ${len - (gapDeg||0)}px, ${len}px;stroke-dashoffset: -${(gapDeg||0) / 2}px;transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s;'%3E%3C/path%3E%3Cpath d='${this.setCirclePath}' stroke-linecap='${this.strokeShape}' stroke-width='${this.strokeWidth}' fill-opacity='0' class='cmd-progress-circle-path' style='stroke: ${escape(currentColor)};stroke-dasharray: ${(this.setProgress / 100) * (len - (gapDeg||0))}px, ${len}px;stroke-dashoffset: -${(gapDeg||0) / 2}px;transition: stroke-dashoffset 0.3s ease 0s, stroke-dasharray 0.3s ease 0s, stroke 0.3s, stroke-width 0.06s ease 0.3s;'%3E%3C/path%3E%3C/svg%3E`
  282. return `background-image: url("${svgToBase}");
  283. background-size: cover;
  284. display: inline-block;
  285. ${this.setCircleStyle}`;
  286. },
  287. /**
  288. * 设置进度圈状态图标
  289. */
  290. setCircleIcon() {
  291. let currentColor = '#108ee9'
  292. let svgToBase = ''
  293. // 异常进度
  294. if (this.status == 'exception') {
  295. currentColor = '#f5222d'
  296. svgToBase =
  297. `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='close' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z'%3E%3C/path%3E %3C/svg%3E`;
  298. }
  299. // 完成进度
  300. if (this.status == 'success' || this.setProgress >= 100) {
  301. currentColor = this.strokeColor || '#52c41a'
  302. svgToBase =
  303. `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='check' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z'%3E%3C/path%3E %3C/svg%3E`;
  304. }
  305. return `background-image: url("${svgToBase}");
  306. background-size: cover;
  307. display: inline-block;
  308. width: 1em;
  309. height: 1em;`;
  310. },
  311. // #endif
  312. /**
  313. * 设置进度条样式
  314. */
  315. setLineStyle() {
  316. return `width: ${this.setProgress}%;
  317. height: ${this.strokeWidth}px;
  318. background: ${this.strokeColor};
  319. border-radius: ${this.strokeShape === 'square' ? 0 : '100px'};`;
  320. },
  321. /**
  322. * 设置已完成分段进度
  323. */
  324. setLineSuccessStyle() {
  325. let successPercent = this.successPercent;
  326. if (!this.successPercent || this.successPercent < 0 || this.setProgress < this.successPercent) {
  327. successPercent = 0;
  328. } else if (this.successPercent >= 100) {
  329. successPercent = 100;
  330. }
  331. return `width: ${successPercent}%;
  332. height: ${this.strokeWidth}px;
  333. border-radius: ${this.strokeShape === 'square' ? 0 : '100px'};`;
  334. },
  335. // #ifndef H5
  336. /**
  337. * 设置进度条状态图标
  338. */
  339. setLineStatusIcon() {
  340. let currentColor = '#108ee9'
  341. let svgToBase = ''
  342. // 异常进度
  343. if (this.status == 'exception') {
  344. currentColor = '#f5222d'
  345. svgToBase =
  346. `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='close-circle' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z'%3E%3C/path%3E %3C/svg%3E`;
  347. }
  348. // 完成进度
  349. if (this.status == 'success' || this.setProgress >= 100) {
  350. currentColor = this.strokeColor || '#52c41a'
  351. svgToBase =
  352. `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' data-icon='check-circle' width='1em' height='1em' fill='${escape(currentColor)}' aria-hidden='true'%3E %3Cpath d='M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z'%3E%3C/path%3E %3C/svg%3E`;
  353. }
  354. return `background-image: url("${svgToBase}");
  355. background-size: cover;
  356. display: inline-block;
  357. width: 1em;
  358. height: 1em;`;
  359. },
  360. // #endif
  361. /**
  362. * 状态样式
  363. */
  364. setStatusClass() {
  365. let statusClass = [];
  366. // 异常进度
  367. if (this.status == 'exception') {
  368. statusClass.push('cmd-progress-status-exception')
  369. }
  370. // 完成进度
  371. if (this.status == 'success' || this.setProgress >= 100) {
  372. statusClass.push('cmd-progress-status-success')
  373. }
  374. // 活动进度条
  375. if (this.status == 'active') {
  376. statusClass.push('cmd-progress-status-active')
  377. }
  378. // 是否显示信息
  379. if (this.showInfo) {
  380. statusClass.push('cmd-progress-show-info')
  381. }
  382. // 进度条类型
  383. if (this.type === 'line') {
  384. statusClass.push('cmd-progress-line')
  385. }
  386. // 进度圈、仪表盘类型
  387. if (this.type === 'circle' || this.type === 'dashboard') {
  388. statusClass.push('cmd-progress-circle')
  389. }
  390. statusClass.push('cmd-progress-status-normal')
  391. return statusClass;
  392. }
  393. }
  394. }
  395. </script>
  396. <style>
  397. .cmd-progress {
  398. box-sizing: border-box;
  399. margin: 0;
  400. padding: 0;
  401. list-style: none;
  402. display: inline-block;
  403. }
  404. .cmd-progress-line {
  405. width: 100%;
  406. font-size: 28upx;
  407. position: relative;
  408. display: flex;
  409. flex-direction: row;
  410. justify-content: center;
  411. align-items: center;
  412. }
  413. .cmd-progress-outer {
  414. display: inline-block;
  415. width: 100%;
  416. margin-right: 0;
  417. padding-right: 0;
  418. }
  419. .cmd-progress-show-info .cmd-progress-outer {
  420. flex: 1;
  421. }
  422. .cmd-progress-inner {
  423. display: inline-block;
  424. width: 100%;
  425. background-color: #f5f5f5;
  426. border-radius: 200upx;
  427. vertical-align: middle;
  428. position: relative;
  429. }
  430. .cmd-progress-circle-trail {
  431. stroke: #f5f5f5;
  432. }
  433. .cmd-progress-circle-path {
  434. stroke: #1890ff;
  435. animation: appear 0.3s;
  436. }
  437. .cmd-progress-success-bg,
  438. .cmd-progress-bg {
  439. background-color: #1890ff;
  440. transition: all 0.4s cubic-bezier(0.08, 0.82, 0.17, 1) 0s;
  441. position: relative;
  442. }
  443. .cmd-progress-success-bg {
  444. background-color: #52c41a;
  445. position: absolute;
  446. top: 0;
  447. left: 0;
  448. }
  449. .cmd-progress-text {
  450. word-break: normal;
  451. width: 60upx;
  452. text-align: left;
  453. margin-left: 16upx;
  454. vertical-align: middle;
  455. display: inline-block;
  456. white-space: nowrap;
  457. color: rgba(0, 0, 0, 0.45);
  458. line-height: 1;
  459. }
  460. .cmd-progress-status-active .cmd-progress-bg:before {
  461. content: "";
  462. opacity: 0;
  463. position: absolute;
  464. top: 0;
  465. left: 0;
  466. right: 0;
  467. bottom: 0;
  468. background: #fff;
  469. border-radius: 20upx;
  470. -webkit-animation: cmd-progress-active 2.4s cubic-bezier(0.23, 1, 0.32, 1) infinite;
  471. animation: cmd-progress-active 2.4s cubic-bezier(0.23, 1, 0.32, 1) infinite;
  472. }
  473. .cmd-progress-status-exception .cmd-progress-bg {
  474. background-color: #f5222d;
  475. }
  476. .cmd-progress-status-exception .cmd-progress-text {
  477. color: #f5222d;
  478. }
  479. .cmd-progress-status-exception .cmd-progress-circle-path {
  480. stroke: #f5222d;
  481. }
  482. .cmd-progress-status-success .cmd-progress-bg {
  483. background-color: #52c41a;
  484. }
  485. .cmd-progress-status-success .cmd-progress-text {
  486. color: #52c41a;
  487. }
  488. .cmd-progress-status-success .cmd-progress-circle-path {
  489. stroke: #52c41a;
  490. }
  491. .cmd-progress-circle .cmd-progress-inner {
  492. position: relative;
  493. line-height: 1;
  494. background-color: transparent;
  495. }
  496. .cmd-progress-circle .cmd-progress-text {
  497. display: block;
  498. position: absolute;
  499. width: 100%;
  500. text-align: center;
  501. line-height: 1;
  502. top: 50%;
  503. -webkit-transform: translateY(-50%);
  504. transform: translateY(-50%);
  505. left: 0;
  506. margin: 0;
  507. color: rgba(0, 0, 0, 0.65);
  508. white-space: normal;
  509. }
  510. .cmd-progress-circle .cmd-progress-status-exception .cmd-progress-text {
  511. color: #f5222d;
  512. }
  513. .cmd-progress-circle .cmd-progress-status-success .cmd-progress-text {
  514. color: #52c41a;
  515. }
  516. @keyframes cmd-progress-active {
  517. 0% {
  518. opacity: 0.1;
  519. width: 0;
  520. }
  521. 20% {
  522. opacity: 0.5;
  523. width: 0;
  524. }
  525. 100% {
  526. opacity: 0;
  527. width: 100%;
  528. }
  529. }
  530. </style>