upload.vue 21 KB

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