uploadVNormalTaskPhoto.vue 23 KB

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