upload.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. <template>
  2. <view class="u-upload" v-if="!disabled">
  3. <view v-if="showUploadList" class="u-list-item u-preview-wrap" :class="{'customPreviewStyle':custom}"
  4. v-for="(item, index) in lists" :key="index" :style="{
  5. width: width + 'rpx',
  6. height: width + 'rpx'
  7. }">
  8. <view v-if="deletable" class="u-delete-icon" @tap.stop="deleteItem(index)" :style="{
  9. background: delBgColor,
  10. }">
  11. <u-icon class="u-icon" :name="delIcon" :size="delIconSize" :color="delColor"></u-icon>
  12. </view>
  13. <view v-if="showProgress && item.progress > 0 && !item.error" class="u-check-icon"
  14. @tap.stop="deleteItem(index)" :style="{
  15. background: checkBgColor,
  16. }">
  17. <u-icon class="u-icon" :name="checkIcon" :size="checkIconSize" :color="checkColor"></u-icon>
  18. </view>
  19. <!-- <u-line-progress v-if="showProgress && item.progress > 0 && !item.error" :show-percent="false" height="16"
  20. class="u-progress" :percent="item.progress"></u-line-progress> -->
  21. <view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn">点击重试</view>
  22. <image @tap.stop="doPreviewImage(item.url || item.path, index)" class="u-preview-image" v-if="!item.isImage"
  23. :src="item.url || item.path" :mode="imageMode"></image>
  24. </view>
  25. <slot name="file" :file="lists"></slot>
  26. <view style="display: inline-block;" :style="{
  27. background:custom?customBack:'transparent',
  28. border:custom?customBorder:'1px solid transparent'
  29. }" :class="custom?'customStyle':'default'" @tap="selectFile" v-if="maxCount > lists.length">
  30. <slot name="addBtn"></slot>
  31. <img v-if="custom&&options.bgc!=''" :src="options.bgc" alt="" class="imgstyle">
  32. <view class="u-list-item u-add-wrap" hover-class="u-add-wrap__hover" hover-stay-time="150" :style="{
  33. width: width + 'rpx',
  34. height: width + 'rpx'
  35. }">
  36. <image style='width:23px;height:23px;' v-if="custom&&!customBtn"
  37. src="../static/images/tianjiazhaopian.png" mode=""></image>
  38. <!-- <u-icon v-if="custom&&!customBtn" name="camera-fill" class="" size="100" color="#617E8B"></u-icon> -->
  39. <image v-if="custom&&customBtn" :style="{
  40. width: customBtnWidth + 'px',
  41. height: customBtnHeight + 'px'
  42. }" :src="customBtnImage" mode=""></image>
  43. <image v-if="!custom" style='width:23px;height:23px;' src="../static/images/xiangji-2.png" mode="">
  44. </image>
  45. <view v-if="!custom" class="u-add-tips">{{ uploadText }}</view>
  46. <view v-if="custom" :style="{
  47. color: customBtnColor,
  48. 'font-size':customBtnFontSize+'px',
  49. }" class="u-add-tips">{{ options.text }}</view>
  50. </view>
  51. </view>
  52. <view @click='imgShow=false' v-if="imgShow" class="shade">
  53. <image style='position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;' :src="url" mode=""></image>
  54. </view>
  55. <!-- <view class="custom-style" v-if="custom"
  56. :style="{backgroundImage: 'url(' + options.bgc + ')', backgroundSize:'100% 100%'}">
  57. </view> -->
  58. </view>
  59. </template>
  60. <script>
  61. /**
  62. * upload 图片上传
  63. * @description 该组件用于上传图片场景
  64. * @tutorial https://www.uviewui.com/components/upload.html
  65. * @property {String} action 服务器上传地址
  66. * @property {String Number} max-count 最大选择图片的数量(默认99)
  67. * @property {Boolean} custom-btn 如果需要自定义选择图片的按钮,设置为true(默认false)
  68. * @property {Boolean} show-progress 是否显示进度条(默认true)
  69. * @property {Boolean} disabled 是否启用(显示/移仓)组件(默认false)
  70. * @property {String} image-mode 预览图片等显示模式,可选值为uni的image的mode属性值(默认aspectFill)
  71. * @property {String} del-icon 右上角删除图标名称,只能为uView内置图标
  72. * @property {String} del-bg-color 右上角关闭按钮的背景颜色
  73. * @property {String} del-color 右上角关闭按钮图标的颜色
  74. * @property {Object} header 上传携带的头信息,对象形式
  75. * @property {Object} form-data 上传额外携带的参数
  76. * @property {String} name 上传文件的字段名,供后端获取使用(默认file)
  77. * @property {Array<String>} size-type original 原图,compressed 压缩图,默认二者都有(默认['original', 'compressed'])
  78. * @property {Array<String>} source-type 选择图片的来源,album-从相册选图,camera-使用相机,默认二者都有(默认['album', 'camera'])
  79. * @property {Boolean} preview-full-image 是否可以通过uni.previewImage预览已选择的图片(默认true)
  80. * @property {Boolean} multiple 是否开启图片多选,部分安卓机型不支持(默认true)
  81. * @property {Boolean} deletable 是否显示删除图片的按钮(默认true)
  82. * @property {String Number} max-size 选择单个文件的最大大小,单位B(byte),默认不限制(默认Number.MAX_VALUE)
  83. * @property {Array<Object>} file-list 默认显示的图片列表,数组元素为对象,必须提供url属性
  84. * @property {Boolean} upload-text 选择图片按钮的提示文字(默认“选择图片”)
  85. * @property {Boolean} auto-upload 选择完图片是否自动上传,见上方说明(默认true)
  86. * @property {Boolean} show-tips 特殊情况下是否自动提示toast,见上方说明(默认true)
  87. * @property {Boolean} show-upload-list 是否显示组件内部的图片预览(默认true)
  88. * @event {Function} on-oversize 图片大小超出最大允许大小
  89. * @event {Function} on-preview 全屏预览图片时触发
  90. * @event {Function} on-remove 移除图片时触发
  91. * @event {Function} on-success 图片上传成功时触发
  92. * @event {Function} on-change 图片上传后,无论成功或者失败都会触发
  93. * @event {Function} on-error 图片上传失败时触发
  94. * @event {Function} on-progress 图片上传过程中的进度变化过程触发
  95. * @event {Function} on-uploaded 所有图片上传完毕触发
  96. * @event {Function} on-choose-complete 每次选择图片后触发,只是让外部可以得知每次选择后,内部的文件列表
  97. * @example <u-upload :action="action" :file-list="fileList" ></u-upload>
  98. */
  99. import uploadImage from '@/components/ossutil/uploadFile.js';
  100. export default {
  101. name: 'upload',
  102. props: {
  103. //是否显示组件自带的图片预览功能
  104. showUploadList: {
  105. type: Boolean,
  106. default: true
  107. },
  108. // 后端地址
  109. action: {
  110. type: String,
  111. default: ''
  112. },
  113. // 最大上传数量
  114. maxCount: {
  115. type: [String, Number],
  116. default: 52,
  117. },
  118. // 删除图标大小
  119. delIconSize: {
  120. type: String,
  121. default: '20'
  122. },
  123. // 是否显示进度条
  124. showProgress: {
  125. type: Boolean,
  126. default: true
  127. },
  128. // 是否启用
  129. disabled: {
  130. type: Boolean,
  131. default: false
  132. },
  133. // 预览上传的图片时的裁剪模式,和image组件mode属性一致
  134. imageMode: {
  135. type: String,
  136. default: 'aspectFill'
  137. },
  138. // 头部信息
  139. header: {
  140. type: Object,
  141. default () {
  142. return {};
  143. }
  144. },
  145. // 额外携带的参数
  146. formData: {
  147. type: Object,
  148. default () {
  149. return {};
  150. }
  151. },
  152. // 上传的文件字段名
  153. name: {
  154. type: String,
  155. default: 'file'
  156. },
  157. // 所选的图片的尺寸, 可选值为original compressed
  158. sizeType: {
  159. type: Array,
  160. default () {
  161. return ['compressed'];
  162. }
  163. },
  164. sourceType: {
  165. type: Array,
  166. default () {
  167. return ['album', 'camera'];
  168. }
  169. },
  170. // 成功背景颜色
  171. checkBgColor: {
  172. type: String,
  173. default: '#F5BA3C'
  174. },
  175. // 成功icon颜色
  176. checkColor: {
  177. type: String,
  178. default: '#fff'
  179. },
  180. // 成功icon
  181. checkIcon: {
  182. type: String,
  183. default: 'checkbox-mark'
  184. },
  185. // 成功icon颜色
  186. checkIconSize: {
  187. type: String,
  188. default: '20'
  189. },
  190. // 是否在点击预览图后展示全屏图片预览
  191. previewFullImage: {
  192. type: Boolean,
  193. default: true
  194. },
  195. // 是否开启图片多选,部分安卓机型不支持
  196. multiple: {
  197. type: Boolean,
  198. default: true
  199. },
  200. // 是否展示删除按钮
  201. deletable: {
  202. type: Boolean,
  203. default: true
  204. },
  205. // 文件大小限制,单位为byte
  206. maxSize: {
  207. type: [String, Number],
  208. default: Number.MAX_VALUE
  209. },
  210. // 显示已上传的文件列表
  211. fileList: {
  212. type: Array,
  213. default () {
  214. return [];
  215. }
  216. },
  217. // 上传区域的提示文字
  218. uploadText: {
  219. type: String,
  220. default: '选择图片'
  221. },
  222. // 是否自动上传
  223. autoUpload: {
  224. type: Boolean,
  225. default: true
  226. },
  227. // 是否显示toast消息提示
  228. showTips: {
  229. type: Boolean,
  230. default: true
  231. },
  232. // 是否通过slot自定义传入选择图标的按钮
  233. customBtn: {
  234. type: Boolean,
  235. default: false
  236. },
  237. customBtnImage: {
  238. type: String,
  239. default: ''
  240. },
  241. customBtnWidth: {
  242. type: Number,
  243. default: 0
  244. },
  245. customBtnHeight: {
  246. type: Number,
  247. default: 0
  248. },
  249. customBtnColor: {
  250. type: String,
  251. default: '#617E8B'
  252. },
  253. customBack: {
  254. type: String,
  255. default: '#F5F6FA'
  256. },
  257. customBorder: {
  258. type: String,
  259. // default: '2px dashed #C6CBCE'
  260. },
  261. customBtnFontSize: {
  262. type: String,
  263. default: '18'
  264. },
  265. // 内部预览图片区域和选择图片按钮的区域宽度,高等于宽
  266. width: {
  267. type: [String, Number],
  268. default: 200
  269. },
  270. // 右上角关闭按钮的背景颜色
  271. delBgColor: {
  272. type: String,
  273. default: '#fa3534'
  274. },
  275. // 右上角关闭按钮的叉号图标的颜色
  276. delColor: {
  277. type: String,
  278. default: '#ffffff'
  279. },
  280. // 右上角删除图标名称,只能为uView内置图标
  281. delIcon: {
  282. type: String,
  283. default: 'close'
  284. },
  285. // 如果上传后的返回值为json字符串,是否自动转json
  286. toJson: {
  287. type: Boolean,
  288. default: true
  289. },
  290. // 上传前的钩子,每个文件上传前都会执行
  291. beforeUpload: {
  292. type: Function,
  293. default: null
  294. },
  295. options: {
  296. type: Object,
  297. default: null
  298. },
  299. custom: {
  300. type: Boolean,
  301. default: false
  302. },
  303. imgIndex: {
  304. type: Number,
  305. default: 0
  306. }
  307. },
  308. mounted() {},
  309. data() {
  310. return {
  311. lists: [],
  312. isInCount: true,
  313. uploading: false,
  314. isSelectFile: false,
  315. imgShow: false,
  316. };
  317. },
  318. watch: {
  319. fileList: {
  320. immediate: true,
  321. handler(val) {
  322. val.map(value => {
  323. this.lists.push({
  324. url: value.url,
  325. error: false,
  326. progress: 100
  327. });
  328. });
  329. }
  330. }
  331. },
  332. methods: {
  333. // 清除列表
  334. clear() {
  335. this.lists = [];
  336. // 如果是清空形式的话,发出"on-list-change"事件
  337. this.$emit('on-list-change', this.lists);
  338. },
  339. // 重新上传队列中上传失败的所有文件
  340. reUpload() {
  341. this.uploadFile();
  342. },
  343. // 选择图片
  344. selectFile() {
  345. if (this.disabled) return;
  346. const {
  347. name = '', maxCount, multiple, maxSize, sizeType, lists, camera, compressed, maxDuration, sourceType
  348. } = this;
  349. let chooseFile = null;
  350. const newMaxCount = maxCount - lists.length;
  351. // 设置为只选择图片的时候使用 chooseImage 来实现
  352. chooseFile = new Promise((resolve, reject) => {
  353. uni.chooseImage({
  354. count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
  355. sourceType: sourceType,
  356. sizeType,
  357. success: resolve,
  358. fail: reject
  359. });
  360. });
  361. chooseFile
  362. .then(res => {
  363. let file = null;
  364. let listOldLength = this.lists.length;
  365. res.tempFiles.map((val, index) => {
  366. // 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
  367. if (!multiple && index >= 1) return;
  368. if (val.size > maxSize) {
  369. this.$emit('on-oversize', val, this.lists);
  370. this.showToast('超出允许的文件大小');
  371. } else {
  372. if (maxCount <= lists.length) {
  373. this.$emit('on-exceed', val, this.lists);
  374. this.showToast('超出最大允许的文件个数');
  375. return;
  376. }
  377. let fileName = '';
  378. let fileNameLength = '';
  379. let fileFormat = '';
  380. //#ifdef H5
  381. fileName = val.name.lastIndexOf(".");
  382. fileNameLength = val.name.length;
  383. fileFormat = val.name.substring(fileName + 1, fileNameLength).toLowerCase();
  384. //#endif
  385. //#ifndef H5
  386. fileName = val.path.lastIndexOf(".");
  387. fileNameLength = val.path.length;
  388. fileFormat = val.path.substring(fileName + 1, fileNameLength).toLowerCase();
  389. //#endif
  390. lists.push({
  391. url: val.path,
  392. fileType: fileFormat,
  393. progress: 0,
  394. error: false
  395. });
  396. // 列表发生改变,发出事件,第二个参数为当前发生变化的项的索引
  397. this.$emit('on-list-change', this.lists);
  398. }
  399. });
  400. // 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
  401. this.$emit('on-choose-complete', this.lists);
  402. if (this.autoUpload) this.uploadFile(listOldLength);
  403. })
  404. .catch(error => {
  405. this.$emit('on-error', error);
  406. });
  407. },
  408. // 提示用户消息
  409. showToast(message, force = false) {
  410. if (this.showTips || force) {
  411. uni.showToast({
  412. title: message,
  413. icon: 'none'
  414. });
  415. }
  416. },
  417. // 该方法供用户通过ref调用,手动上传
  418. upload() {
  419. this.uploadFile();
  420. },
  421. // 对失败的图片重新上传
  422. retry(index) {
  423. this.lists[index].progress = 0;
  424. this.lists[index].error = false;
  425. this.lists[index].response = null;
  426. uni.showLoading({
  427. title: '重新上传'
  428. });
  429. this.uploadFile(index);
  430. },
  431. // 上传图片
  432. async uploadFile(index = 0) {
  433. if (this.disabled) return;
  434. if (this.uploading) return;
  435. // 全部上传完成
  436. if (index >= this.lists.length) {
  437. this.isSelectFile = true
  438. this.$emit('on-uploaded', this.lists);
  439. return;
  440. }
  441. // 检查上传地址
  442. if (!this.action) {
  443. this.showToast('请配置上传地址', true);
  444. return;
  445. }
  446. // 检查是否是已上传或者正在上传中
  447. if (this.lists[index].progress == 100) {
  448. if (this.autoUpload == false) this.uploadFile(index + 1);
  449. return;
  450. }
  451. // 执行before-upload钩子
  452. if (this.beforeUpload && typeof(this.beforeUpload) === 'function') {
  453. // 执行回调,同时传入索引和文件列表当作参数
  454. let beforeResponse = this.beforeUpload(index, this.lists);
  455. // 判断是否返回了promise
  456. if (!!beforeResponse && typeof beforeResponse.then === 'function') {
  457. await beforeResponse.then(res => {
  458. // promise返回成功,不进行动作,继续上传
  459. }).catch(err => {
  460. // 进入catch回调的话,继续下一张
  461. return this.uploadFile(index + 1);
  462. })
  463. } else if (beforeResponse === false) {
  464. // 如果返回false,继续下一张图片的上传
  465. return this.uploadFile(index + 1);
  466. }
  467. }
  468. this.lists[index].error = false;
  469. this.uploading = true;
  470. uploadImage(this.lists[index].url, 'appData/',
  471. result => {
  472. console.log
  473. // 上传成功
  474. this.lists[index].response = result;
  475. this.lists[index].progress = 100;
  476. this.lists[index].error = false;
  477. let data = result
  478. this.$emit('on-success', data, index, this.lists, this.imgIndex);
  479. uni.hideLoading();
  480. this.uploading = false;
  481. this.uploadFile(index + 1);
  482. this.$emit('on-change', data, index, this.lists, this.imgIndex);
  483. }
  484. )
  485. // 创建上传对象
  486. // const task = uni.uploadFile({
  487. // url: this.action,
  488. // filePath: this.lists[index].url,
  489. // name: this.name,
  490. // formData: this.formData,
  491. // header: this.header,
  492. // success: res => {
  493. // // 判断是否json字符串,将其转为json格式
  494. // let data = this.toJson && this.checkIsJSON(res.data) ? JSON.parse(res.data) : res
  495. // .data;
  496. // if (![200, 201].includes(res.statusCode)) {
  497. // this.uploadError(index, data);
  498. // } else {
  499. // // 上传成功
  500. // this.lists[index].response = data;
  501. // this.lists[index].progress = 100;
  502. // this.lists[index].error = false;
  503. // // this.$emit('on-success', data, index, this.lists);
  504. // }
  505. // },
  506. // fail: e => {
  507. // this.uploadError(index, e);
  508. // },
  509. // complete: res => {
  510. // uni.hideLoading();
  511. // this.uploading = false;
  512. // this.uploadFile(index + 1);
  513. // this.$emit('on-change', res, index, this.lists);
  514. // }
  515. // });
  516. // task.onProgressUpdate(res => {
  517. // if (res.progress > 0) {
  518. // this.lists[index].progress = res.progress;
  519. // this.$emit('on-progress', res, index, this.lists);
  520. // }
  521. // });
  522. },
  523. // 上传失败
  524. uploadError(index, err) {
  525. this.lists[index].progress = 0;
  526. this.lists[index].error = true;
  527. this.lists[index].response = null;
  528. this.$emit('on-error', err, index, this.lists);
  529. this.showToast('上传失败,请重试');
  530. },
  531. // 删除一个图片
  532. deleteItem(index) {
  533. uni.showModal({
  534. title: '提示',
  535. content: '您确定要删除此项吗?',
  536. success: res => {
  537. if (res.confirm) {
  538. this.isSelectFile = false
  539. if (this.lists[index].process < 100 && this.lists[index].process > 0) {
  540. typeof this.lists[index].uploadTask != 'undefined' && this.lists[index]
  541. .uploadTask.abort();
  542. }
  543. this.lists.splice(index, 1);
  544. this.$forceUpdate();
  545. this.$emit('on-remove', index, this.lists);
  546. this.showToast('移除成功');
  547. // 列表发生改变,发出事件
  548. this.$emit('on-list-change', this.lists);
  549. }
  550. }
  551. });
  552. },
  553. // 用户通过ref手动的形式,移除一张图片
  554. remove(index) {
  555. // 判断索引的合法范围
  556. if (index >= 0 && index < this.lists.length) {
  557. this.lists.splice(index, 1);
  558. this.$emit('on-list-change', this.lists);
  559. }
  560. },
  561. // 预览图片
  562. doPreviewImage(url, index) {
  563. console.log(this.lists, url, index)
  564. if (!this.previewFullImage) return;
  565. const images = this.lists.map(item => item.url || item.path);
  566. this.url = url
  567. this.imgShow = true
  568. // 图片预览调用onShow清空数据
  569. // uni.previewImage({
  570. // urls: images,
  571. // current: url,
  572. // success: () => {
  573. // this.$emit('on-preview', url, this.lists);
  574. // },
  575. // fail: () => {
  576. // uni.showToast({
  577. // title: '预览图片失败',
  578. // icon: 'none'
  579. // });
  580. // }
  581. // });
  582. },
  583. // 判断是否json字符串
  584. checkIsJSON(str) {
  585. if (typeof str == 'string') {
  586. try {
  587. var obj = JSON.parse(str);
  588. if (typeof obj == 'object' && obj) {
  589. return true;
  590. } else {
  591. return false;
  592. }
  593. } catch (e) {
  594. return false;
  595. }
  596. }
  597. return false;
  598. }
  599. }
  600. };
  601. </script>
  602. <style lang="scss" scoped>
  603. // nvue不能用标签命名样式
  604. /* #ifndef APP-NVUE */
  605. image {
  606. display: inline-block;
  607. // 解决图片加载时可能会瞬间变形的问题
  608. will-change: transform;
  609. }
  610. view,
  611. text {
  612. box-sizing: border-box;
  613. flex-direction: row;
  614. }
  615. /* #endif */
  616. .u-upload {
  617. display: flex;
  618. flex-wrap: wrap;
  619. align-items: center;
  620. }
  621. .u-list-item {
  622. width: 200rpx;
  623. height: 200rpx;
  624. overflow: hidden;
  625. // margin: 10rpx;
  626. background: rgb(244, 245, 246);
  627. position: relative;
  628. border-radius: 10rpx;
  629. display: inline-flex;
  630. align-items: center;
  631. justify-content: center;
  632. }
  633. .u-preview-wrap {
  634. border: 1px solid rgb(235, 236, 238);
  635. }
  636. .u-add-wrap {
  637. flex-direction: column;
  638. color: $u-content-color;
  639. font-size: 28rpx;
  640. }
  641. .u-add-tips {
  642. margin-top: 20rpx;
  643. }
  644. .u-add-wrap__hover {
  645. background-color: rgb(235, 236, 238);
  646. }
  647. .u-preview-image {
  648. display: block;
  649. width: 100%;
  650. height: 100%;
  651. border-radius: 10rpx;
  652. }
  653. .u-delete-icon {
  654. position: absolute;
  655. top: 0rpx;
  656. right: 0rpx;
  657. z-index: 10;
  658. background: rgba(17, 26, 52, 0.5);
  659. border-radius: 0 0 0 10rpx;
  660. width: 44rpx;
  661. height: 44rpx;
  662. display: flex;
  663. align-items: center;
  664. justify-content: center;
  665. }
  666. .u-icon {
  667. display: flex;
  668. align-items: center;
  669. justify-content: center;
  670. }
  671. .u-progress {
  672. position: absolute;
  673. bottom: 10rpx;
  674. left: 8rpx;
  675. right: 8rpx;
  676. z-index: 9;
  677. width: auto;
  678. }
  679. .u-error-btn {
  680. color: #ffffff;
  681. background-color: $u-error;
  682. font-size: 20rpx;
  683. padding: 4px 0;
  684. text-align: center;
  685. position: absolute;
  686. bottom: 0;
  687. left: 0;
  688. right: 0;
  689. z-index: 9;
  690. line-height: 1;
  691. }
  692. .customStyleBgc {
  693. width: 100% !important;
  694. height: 440rpx !important;
  695. display: flex !important;
  696. justify-content: center;
  697. align-items: center;
  698. position: relative;
  699. .u-add-wrap {
  700. width: 100% !important;
  701. height: 100% !important;
  702. background: transparent;
  703. }
  704. .u-add-tips {
  705. font-size: 18px;
  706. font-weight: 600;
  707. color: #617E8B;
  708. }
  709. }
  710. .customStyle {
  711. width: 712rpx !important;
  712. height: 440rpx !important;
  713. background: #F5F6FA;
  714. border-radius: 20rpx;
  715. // border: 2px dashed #C6CBCE;
  716. display: flex !important;
  717. justify-content: center;
  718. align-items: center;
  719. position: relative;
  720. .u-add-wrap {
  721. width: 100% !important;
  722. height: 100% !important;
  723. background: transparent;
  724. }
  725. .u-add-tips {
  726. font-size: 18px;
  727. font-weight: 600;
  728. color: #617E8B;
  729. }
  730. }
  731. .customPreviewStyle {
  732. width: 100% !important;
  733. height: 440rpx !important;
  734. }
  735. .imgstyle {
  736. width: 100% !important;
  737. height: 440rpx !important;
  738. position: absolute;
  739. }
  740. .default {
  741. .u-list-item.u-add-wrap {
  742. background: #fff;
  743. border: 1px dashed #AFB3BF;
  744. }
  745. }
  746. .shade {
  747. background: #000;
  748. position: fixed;
  749. top: 0;
  750. left: 0;
  751. width: 100%;
  752. height: 100%;
  753. z-index: 10000;
  754. }
  755. .u-check-icon {
  756. position: absolute;
  757. bottom: 0rpx;
  758. left: 0rpx;
  759. z-index: 10;
  760. background-color: $u-error;
  761. border-radius: 0 0 0 10rpx;
  762. width: 44rpx;
  763. height: 44rpx;
  764. display: flex;
  765. align-items: center;
  766. justify-content: center;
  767. }
  768. </style>