uploadVNormalTaskPhoto.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. <template>
  2. <div class="questionNamep">
  3. <!-- 0=企业微信,1=H5相机 -->
  4. <!-- 企业微信拍照 -->
  5. <div class="cameraDiv" @click="uploadImg" v-if="userInfo.photoMethod == '0'">
  6. <van-icon class="photo photos" name="plus" size="22px" color="#969696" />
  7. <span style="font-size: 10px">添加图片</span>
  8. </div>
  9. <!-- 原生自带拍照 -->
  10. <H5Camera
  11. @getImg="getImg"
  12. ref="H5Camera"
  13. :objectType="objectType"
  14. :capture="pictureSource == '1' ? '' : 'camera'"
  15. v-else />
  16. <div id="allmap"></div>
  17. <imageAIVerifyErr
  18. v-if="imageAIVerifyFlag"
  19. :imageAIVerifyFlag="imageAIVerifyFlag"
  20. :imageAIVerifyData="imageAIVerifyData"
  21. @confirmUpload="confirmUpload"
  22. @uploadImgFun="uploadImgFun"
  23. :source="'visit'"
  24. @normalFlow="normalFlow"
  25. @close="close"></imageAIVerifyErr>
  26. <!-- 图像识别白名单弹框提示 -->
  27. <imageWhiteStore
  28. v-if="imageWhiteStoreFlag"
  29. :imageWhiteStoreFlag="imageWhiteStoreFlag"
  30. :imageWhiteStoreData="imageWhiteStoreData"
  31. @normalFlow="normalFlow"
  32. @close="close">
  33. </imageWhiteStore>
  34. <!-- 上传动画 -->
  35. <div class="uploadImgDemoMask" v-show="uploadImgFlag">
  36. <div class="uploadImgDemo">
  37. <div class="ring-area" id="d2area" style="display: flex">
  38. <div class="ring-wrap">
  39. <svg width="90" height="90" viewBox="0 0 90 90">
  40. <circle class="ring-bg" cx="45" cy="45" r="40" />
  41. <circle class="ring-progress" id="d2ring" cx="45" cy="45" r="40" />
  42. </svg>
  43. <div class="ring-text">
  44. <span class="ring-pct" id="d2pct">0%</span>
  45. <span class="ring-sub" id="d2sub">上传中</span>
  46. </div>
  47. </div>
  48. <div class="ring-info">
  49. <div class="ring-filename" id="d2name"></div>
  50. <div class="ring-list" id="d2dots">
  51. <div
  52. v-for="(value, index) in uploadImgTotal"
  53. class="ring-dot"
  54. :id="`dot${index}`"></div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <script>
  63. import { addPhotoBatch, addVisitsPosition, addPhotoToDB } from '@/api/index';
  64. import imageAIVerifyErr from './imageAIVerifyErr';
  65. import imageWhiteStore from './imageWhiteStore';
  66. import H5Camera from '@/components/H5Camera';
  67. import axios from 'axios';
  68. import uploadAliOss from '@/utils/uploadAliOss';
  69. import { addH5Photo } from '@/api/H5Camera';
  70. import { mapState } from 'vuex';
  71. export default {
  72. name: 'uploadImg',
  73. components: { imageAIVerifyErr, H5Camera, imageWhiteStore },
  74. props: {
  75. storeGroupId: {
  76. type: String,
  77. default: '',
  78. },
  79. visitsId: {
  80. type: String,
  81. default: '',
  82. },
  83. taskList: {
  84. type: Array,
  85. default() {
  86. return [];
  87. },
  88. },
  89. objectType: {
  90. type: String,
  91. default: '',
  92. },
  93. putInCode: {
  94. type: String,
  95. default: '',
  96. },
  97. photoIdentifyType: {
  98. // 图匠识别目的(1:店招内容识别(不能连拍和多选),3:调色机识别(不能连拍和多选),6:陈列SKU图片识别(不需要图匠实时识别))
  99. type: String,
  100. default: '',
  101. },
  102. pictureSource: {
  103. // 是否允许从相册选择图片 1:允许;0:不允许
  104. type: String,
  105. default: '0',
  106. },
  107. continuousShoot: {
  108. // 是否允许连拍/相册多选 1:允许;0:不允许
  109. type: String,
  110. default: '0',
  111. },
  112. collectionItemId: {
  113. type: [String, Number],
  114. default: '',
  115. },
  116. formData: {
  117. type: Object,
  118. default() {
  119. return {};
  120. },
  121. },
  122. },
  123. computed: {
  124. ...mapState({
  125. userInfo: (state) => state.user.userInfo,
  126. }),
  127. },
  128. data() {
  129. return {
  130. shows: false,
  131. url: '',
  132. imageAIVerifyFlag: false,
  133. imageAIVerifyData: null, //图匠校验返回的数据
  134. mediaId: '', //当前上传图片id
  135. addressesRemark: '', //当前位置信息
  136. controller: null, //取消请求状态
  137. fileUrl: '',
  138. imageWhiteStoreData: null,
  139. imageWhiteStoreFlag: false,
  140. localIdsArr: [],
  141. uploadImgFlag: false, //上传图片中
  142. uploadImgTotal: 0, // 上传图片总数
  143. d2running: false,
  144. d2count: 0,
  145. d2timer: null,
  146. };
  147. },
  148. methods: {
  149. // 原生H5拍照图片
  150. // url: base64
  151. getImg(base64) {
  152. // 图片名称:用户名-时间戳
  153. let username = localStorage.getItem('loginName');
  154. let imgName = username + '-' + new Date().getTime();
  155. uploadAliOss(base64, imgName)
  156. .then((res) => {
  157. if (res.url && res.url.indexOf('http') != -1) {
  158. this.fileUrl = res.url;
  159. this.uploadImagev();
  160. }
  161. })
  162. .catch((err) => {
  163. console.log('err:' + err);
  164. });
  165. },
  166. uploadImgFun() {
  167. // 0=企业微信,1=H5相机
  168. if (this.userInfo.photoMethod == '0') {
  169. this.uploadImg();
  170. } else {
  171. this.$refs.H5Camera.camera();
  172. }
  173. },
  174. uploadImg() {
  175. var map = new TMap.Map('allmap', {
  176. zoom: 14,
  177. center: new TMap.LatLng(39.986785, 116.301012),
  178. });
  179. var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
  180. var markers = new TMap.MultiMarker({
  181. map: map,
  182. geometries: [],
  183. });
  184. markers.setGeometries([]);
  185. let url = window.location.href;
  186. let that = this;
  187. let wx = this.wx;
  188. let qiyeData;
  189. this.addressesRemark = '';
  190. const instance = axios.create();
  191. instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
  192. instance
  193. .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
  194. params: {
  195. url: url,
  196. },
  197. })
  198. .then((response) => {
  199. if (response.status == 200) {
  200. qiyeData = response.data.data;
  201. wx.config({
  202. beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
  203. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  204. appId: qiyeData.appId, // 必填,企业微信的corpID
  205. timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
  206. nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
  207. signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
  208. jsApiList: ['ready', 'chooseImage', 'uploadImage', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
  209. });
  210. wx.ready(function () {
  211. wx.getLocation({
  212. type: 'gcj02',
  213. success: function (res) {
  214. var location = new TMap.LatLng(res.latitude, res.longitude);
  215. map.setCenter(location);
  216. markers.updateGeometries([
  217. {
  218. id: 'main', // 点标注数据数组
  219. position: location,
  220. },
  221. ]);
  222. geocoder.getAddress({ location: location }).then(
  223. function (result) {
  224. var addresses = result.result.formatted_addresses;
  225. that.addressesRemark = addresses.recommend;
  226. },
  227. function (err) {
  228. that.addressesRemark = '';
  229. },
  230. );
  231. },
  232. fail: function () {
  233. that.$dialog.alert({
  234. message: 'GPS未开启',
  235. });
  236. },
  237. });
  238. console.log(that.pictureSource);
  239. let sourceType = that.pictureSource == '1' ? ['album', 'camera'] : ['camera'];
  240. let count = 1;
  241. // 1:店招内容识别(不能连拍和多选),3:调色机识别(不能连拍和多选) 需要实时识别的不支持连拍和多选
  242. if (that.photoIdentifyType != 1 && that.photoIdentifyType != 3) {
  243. count = that.continuousShoot == '1' ? 20 : 1; //是否允许连拍/相册多选 最多5张
  244. }
  245. wx.chooseImage({
  246. count: count,
  247. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  248. sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
  249. defaultCameraMode: count == 1 ? 'normal' : 'batch', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
  250. // defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
  251. isSaveToAlbum: 0, //整型值,0表示拍照时不保存到系统相册,1表示自动保存,默认值是1
  252. success: function (res) {
  253. let localIds = res.localIds;
  254. that.localIdsArr = [];
  255. // that.$emit('newimgarr', {
  256. // localIds: localIds,
  257. // locationRemark: that.addressesRemark,
  258. // collectionItemId: that.collectionItemId,
  259. // source: 'weixin',
  260. // });
  261. that.uploadImgFlag = true;
  262. that.uploadImgTotal = localIds.length;
  263. that.startDemo2();
  264. that.syncUpload(localIds);
  265. },
  266. });
  267. });
  268. }
  269. });
  270. },
  271. syncUpload(localIds) {
  272. if (!localIds.length) {
  273. this.uploadImagev();
  274. } else {
  275. var localId = localIds.pop();
  276. wx.uploadImage({
  277. localId: localId,
  278. isShowProgressTips: 1, // 默认为1,显示进度提示
  279. success: (res) => {
  280. this.localIdsArr.push(res.serverId);
  281. this.syncUpload(localIds);
  282. },
  283. });
  284. }
  285. },
  286. uploadImagev() {
  287. this.close();
  288. var that = this;
  289. var form = {
  290. mediaIds: [], // 是 List<String> 图片素材id集合
  291. visitSource: '1', // 是 Long 拜访模式
  292. storeGroupId: that.storeGroupId, // 是 string 门店任务组,多个用逗号隔开
  293. visitsId: that.visitsId, // 是 string 拜访id
  294. taskList: that.taskList, // 是 List 任务id数组
  295. collectionItemId: that.collectionItemId, // 是 string 采集项id
  296. objectType: that.objectType, // 是 string 照片类型,取任务上的照片类型,如果没有则取手动选择的照片类型
  297. locationRemark: that.addressesRemark, // 是 String 当前地址信息
  298. firstCollectionId: '', // 否 Long 第一级采集项id,取当前采集项的字段就行
  299. secondCollectionId: '', // 否 Long 第二级采集项id,取当前采集项的字段就行
  300. putInCode: that.putInCode, //投放编号
  301. deviceCode: '', // 否 String 当前任务对应的设备编号
  302. photoIdentifyType: that.photoIdentifyType, // 否 String 图片识别类型:字典-photo_identify_type
  303. equipmentCode: '', // 否 String 当前任务对应的资产编号
  304. inStore: '否', // 否 String 机器是否在店:传选项中文内容,是、否
  305. };
  306. // 0=企业微信,1=H5相机
  307. if (this.userInfo.photoMethod == '0') {
  308. form.mediaIds = this.localIdsArr; // string 图片素材id
  309. } else {
  310. form.fileUrl = this.fileUrl; // string 图片素材id
  311. }
  312. this.controller = null;
  313. // 需要图匠校验的添加参数和loading
  314. if (
  315. this.photoIdentifyType &&
  316. (this.photoIdentifyType == '1' || this.photoIdentifyType == '3')
  317. ) {
  318. form.photoIdentifyType = this.photoIdentifyType;
  319. this.controller = new AbortController(); //取消请求
  320. } else {
  321. this.toastLoading(0, '上传中...', true);
  322. }
  323. addPhotoBatch(form, this.controller ? this.controller.signal : null)
  324. .then((res) => {
  325. this.requestThen(res);
  326. })
  327. .catch((error) => {
  328. this.resetDemo2();
  329. this.requestCatch(error);
  330. });
  331. },
  332. // 公用请求then
  333. requestThen(res) {
  334. this.toastLoading().clear();
  335. if (res.code == -1) {
  336. // 图匠图片校验接口超时
  337. this.requestTimeOut(res);
  338. } else if (res.code == 200) {
  339. // 图匠校验结果返回
  340. if (
  341. this.photoIdentifyType &&
  342. (this.photoIdentifyType == '1' || this.photoIdentifyType == '3')
  343. ) {
  344. this.imageAIVerifyFlag = true;
  345. this.imageAIVerifyData = res.data[0];
  346. } else {
  347. // 正常流程
  348. // 图像识别白名单用户弹出框提示
  349. if (res.data[0].whiteStore) {
  350. this.imageWhiteStoreFlag = true;
  351. this.imageWhiteStoreData = res.data[0];
  352. } else {
  353. this.normalFlow(res);
  354. }
  355. }
  356. } else {
  357. this.resetDemo2();
  358. that.$toast('上传失败!');
  359. }
  360. },
  361. // 公用请求catch
  362. requestCatch(error) {
  363. if (error.message === 'canceled') {
  364. this.$toast('取消上传');
  365. console.log('请求被取消:', error.message);
  366. }
  367. },
  368. // 正常流程
  369. normalFlow(res) {
  370. if (this.d2timer) {
  371. clearTimeout(this.d2timer);
  372. }
  373. try {
  374. this.runD2(500, false, () => {
  375. this.resetDemo2();
  376. this.$toast('上传成功!');
  377. let fileInfoList = [];
  378. res.data.forEach((val) => {
  379. fileInfoList.push({
  380. fileUrl: val.url,
  381. id: val.fileId,
  382. type: 2,
  383. });
  384. });
  385. this.$emit('newimgarr', {
  386. fileInfoList: fileInfoList,
  387. photoIdentifyType: this.photoIdentifyType,
  388. source: 'H5',
  389. });
  390. });
  391. } catch (error) {
  392. this.resetDemo2();
  393. }
  394. },
  395. resetDemo2() {
  396. if (this.d2timer) {
  397. clearTimeout(this.d2timer);
  398. }
  399. this.d2running = false;
  400. this.d2count = 0;
  401. this.uploadImgTotal = 0;
  402. document.getElementById('d2ring').style.strokeDashoffset = 251.2;
  403. document.getElementById('d2pct').textContent = '0%';
  404. document.getElementById('d2sub').textContent = '上传中';
  405. this.uploadImgFlag = false;
  406. },
  407. // 照片是否入库,1.照片识别三次不通过仍要上传,2.照片识别通过
  408. // isUpdate:是否更新店招照片,只有门店店招需要更新
  409. confirmUpload(res) {
  410. if (
  411. this.photoIdentifyType &&
  412. (this.photoIdentifyType != '6' || this.photoIdentifyType != '7')
  413. ) {
  414. var form = {
  415. mediaIds: [], // 是 List<String> 图片素材id集合
  416. visitSource: '1', // 是 Long 拜访模式
  417. storeGroupId: this.storeGroupId, // 是 string 门店任务组,多个用逗号隔开
  418. visitsId: that.visitsId, // 是 string 拜访id
  419. taskList: this.taskList, // 是 List 任务id数组
  420. collectionItemId: that.collectionItemId, // 是 string 采集项id
  421. objectType: that.objectType, // 是 string 照片类型,取任务上的照片类型,如果没有则取手动选择的照片类型
  422. locationRemark: this.addressesRemark, // 是 String 当前地址信息
  423. firstCollectionId: '', // 否 Long 第一级采集项id,取当前采集项的字段就行
  424. secondCollectionId: '', // 否 Long 第二级采集项id,取当前采集项的字段就行
  425. putInCode: that.putInCode, //投放编号
  426. deviceCode: '', // 否 String 当前任务对应的设备编号
  427. photoIdentifyType: that.photoIdentifyType, // 否 String 图片识别类型:字典-photo_identify_type
  428. equipmentCode: '', // 否 String 当前任务对应的资产编号
  429. inStore: '否', // 否 String 机器是否在店:传选项中文内容,是、否
  430. };
  431. // 0=企业微信,1=H5相机
  432. if (this.userInfo.photoMethod == '0') {
  433. form.mediaIds = this.localIdsArr; // string 图片素材id
  434. } else {
  435. form.fileUrl = this.fileUrl; // string 图片素材id
  436. }
  437. if (res.isUpdate) {
  438. form.isUpdate = 'true';
  439. }
  440. addPhotoToDB(form).then((resData) => {
  441. if (resData.code == 200) {
  442. console.log(resData);
  443. res.data.fileId = resData.data[0].fileId;
  444. res.data = [res.data];
  445. this.normalFlow(res);
  446. }
  447. });
  448. }
  449. },
  450. close() {
  451. this.imageAIVerifyFlag = false;
  452. this.imageWhiteStoreFlag = false;
  453. },
  454. requestTimeOut(res) {
  455. this.close();
  456. this.$dialog
  457. .confirm({
  458. title: '系统提示',
  459. message: res.msg,
  460. showCancelButton: false,
  461. })
  462. .then(() => {
  463. this.confirmUpload(res);
  464. });
  465. },
  466. // ===== Demo 2 =====
  467. startDemo2() {
  468. if (this.d2running) return;
  469. this.d2running = true;
  470. this.d2count = 0;
  471. this.runD2(1100, true);
  472. },
  473. runD2(delay, isFirst, callback) {
  474. // this.NAMES = Array.from(
  475. // { length: this.uploadImgTotal },
  476. // (_, i) => `IMG_${String(2001 + i).padStart(4, '0')}.jpg`,
  477. // );
  478. if (this.d2count >= this.uploadImgTotal) {
  479. document.getElementById('d2sub').textContent = '完成';
  480. document.getElementById('d2name').textContent = '全部上传成功 ✅';
  481. callback && callback();
  482. return;
  483. }
  484. if (this.uploadImgTotal >= 2) {
  485. this.d2timer = setTimeout(() => {
  486. if (this.d2count > 0) {
  487. document.getElementById(`dot${this.d2count - 1}`).className = 'ring-dot done';
  488. }
  489. document.getElementById(`dot${this.d2count}`).className = 'ring-dot active';
  490. document.getElementById('d2name').textContent = '正在上传。。。';
  491. this.d2count++;
  492. const pct = Math.round((this.d2count / this.uploadImgTotal) * 100);
  493. document.getElementById('d2pct').textContent = pct + '%';
  494. const offset = 251.2 * (1 - this.d2count / this.uploadImgTotal);
  495. document.getElementById('d2ring').style.strokeDashoffset = offset;
  496. document.getElementById('d2sub').textContent = `${this.d2count}/${this.uploadImgTotal}`;
  497. // this.d2count >= Math.floor(this.uploadImgTotal * (0.4 + Math.random() * 0.5))
  498. if (this.d2count >= Math.floor(this.uploadImgTotal * 0.9) && isFirst) {
  499. clearTimeout(this.d2timer);
  500. return;
  501. }
  502. this.runD2(delay, isFirst, callback);
  503. }, delay);
  504. } else {
  505. this.$nextTick(() => {
  506. document.getElementById(`dot0`).className = 'ring-dot active';
  507. document.getElementById('d2name').textContent = '正在上传。。。';
  508. this.d2count++;
  509. document.getElementById('d2pct').textContent = '50%';
  510. document.getElementById('d2ring').style.strokeDashoffset = 50;
  511. document.getElementById('d2sub').textContent = `0/${this.uploadImgTotal}`;
  512. });
  513. }
  514. },
  515. },
  516. };
  517. </script>
  518. <style lang="scss" scoped>
  519. .questionNamep {
  520. font-size: 16px;
  521. color: #484848;
  522. box-sizing: border-box;
  523. position: relative;
  524. .cameraDiv {
  525. flex: 1;
  526. display: flex;
  527. flex-direction: column;
  528. align-items: center;
  529. justify-content: center;
  530. .photo {
  531. /*margin-top: 9px;*/
  532. float: right;
  533. }
  534. .camera {
  535. width: 60px;
  536. height: 100%;
  537. position: absolute;
  538. right: 0;
  539. top: 0;
  540. opacity: 0;
  541. z-index: 89;
  542. }
  543. }
  544. }
  545. #allmap {
  546. width: 10px;
  547. height: 10px;
  548. left: -1000px;
  549. position: absolute;
  550. }
  551. </style>
  552. <style lang="scss">
  553. /* ===== 样例2:圆形进度环 ===== */
  554. .uploadImgDemoMask {
  555. position: fixed;
  556. inset: 0;
  557. background: rgba(0, 0, 0, 0.5);
  558. z-index: 9998;
  559. }
  560. .uploadImgDemo {
  561. width: 95%;
  562. position: fixed;
  563. top: 50%;
  564. left: 50%;
  565. transform: translate(-50%, -50%);
  566. z-index: 9999;
  567. background: #fff;
  568. padding: 10px 5px;
  569. border-radius: 8px;
  570. }
  571. .uploadImgDemo .ring-area {
  572. display: none;
  573. // margin-top: 16px;
  574. align-items: center;
  575. gap: 20px;
  576. }
  577. .uploadImgDemo .ring-wrap {
  578. position: relative;
  579. width: 90px;
  580. height: 90px;
  581. flex-shrink: 0;
  582. }
  583. .uploadImgDemo .ring-wrap svg {
  584. transform: rotate(-90deg);
  585. }
  586. .uploadImgDemo .ring-bg {
  587. fill: none;
  588. stroke: #e0f7f4;
  589. stroke-width: 8;
  590. }
  591. .uploadImgDemo .ring-progress {
  592. fill: none;
  593. stroke: url(#greenGrad);
  594. stroke-width: 8;
  595. stroke-linecap: round;
  596. stroke-dasharray: 251.2;
  597. stroke-dashoffset: 251.2;
  598. transition: stroke-dashoffset 0.35s ease;
  599. }
  600. .uploadImgDemo .ring-text {
  601. position: absolute;
  602. inset: 0;
  603. display: flex;
  604. flex-direction: column;
  605. align-items: center;
  606. justify-content: center;
  607. }
  608. .uploadImgDemo .ring-pct {
  609. font-size: 18px;
  610. font-weight: 700;
  611. color: #11998e;
  612. }
  613. .uploadImgDemo .ring-sub {
  614. font-size: 10px;
  615. color: #aaa;
  616. }
  617. .uploadImgDemo .ring-info {
  618. flex: 1;
  619. }
  620. .uploadImgDemo .ring-filename {
  621. font-size: 13px;
  622. font-weight: 500;
  623. color: #333;
  624. margin-bottom: 6px;
  625. white-space: nowrap;
  626. overflow: hidden;
  627. text-overflow: ellipsis;
  628. max-width: 160px;
  629. }
  630. .uploadImgDemo .ring-list {
  631. display: flex;
  632. flex-wrap: wrap;
  633. gap: 4px;
  634. margin-top: 8px;
  635. }
  636. .uploadImgDemo .ring-dot {
  637. width: 10px;
  638. height: 10px;
  639. border-radius: 50%;
  640. background: #e0e0e0;
  641. transition: background 0.3s;
  642. }
  643. .uploadImgDemo .ring-dot.done {
  644. background: #11998e;
  645. }
  646. .uploadImgDemo .ring-dot.active {
  647. background: #38ef7d;
  648. animation: pulse2 0.8s infinite;
  649. }
  650. @keyframes pulse2 {
  651. 0%,
  652. 100% {
  653. transform: scale(1);
  654. }
  655. 50% {
  656. transform: scale(1.4);
  657. }
  658. }
  659. </style>