upload.vue 21 KB

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