upload.vue 21 KB

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