uploadVNormalTaskPhoto.vue 23 KB

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