upload.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  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. <u-icon v-if="custom&&!customBtn" name="camera-fill" class="" size="100" color="#617E8B"></u-icon>
  37. <image v-if="custom&&customBtn" :style="{
  38. width: customBtnWidth + 'px',
  39. height: customBtnHeight + 'px'
  40. }" :src="customBtnImage" mode=""></image>
  41. <image v-if="!custom" style='width:23px;height:23px;' src="../static/img/liangmai/xiangji-2.png" mode=""></image>
  42. <view v-if="!custom" class="u-add-tips">{{ uploadText }}</view>
  43. <view v-if="custom" :style="{
  44. color: customBtnColor,
  45. 'font-size':customBtnFontSize+'px',
  46. }" class="u-add-tips">{{ options.text }}</view>
  47. </view>
  48. </view>
  49. <view @click='imgShow=false' v-if="imgShow" class="shade">
  50. <image style='position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;' :src="url" mode=""></image>
  51. </view>
  52. <!-- <view class="custom-style" v-if="custom"
  53. :style="{backgroundImage: 'url(' + options.bgc + ')', backgroundSize:'100% 100%'}">
  54. </view> -->
  55. </view>
  56. </template>
  57. <script>
  58. /**
  59. * upload 图片上传
  60. * @description 该组件用于上传图片场景
  61. * @tutorial https://www.uviewui.com/components/upload.html
  62. * @property {String} action 服务器上传地址
  63. * @property {String Number} max-count 最大选择图片的数量(默认99)
  64. * @property {Boolean} custom-btn 如果需要自定义选择图片的按钮,设置为true(默认false)
  65. * @property {Boolean} show-progress 是否显示进度条(默认true)
  66. * @property {Boolean} disabled 是否启用(显示/移仓)组件(默认false)
  67. * @property {String} image-mode 预览图片等显示模式,可选值为uni的image的mode属性值(默认aspectFill)
  68. * @property {String} del-icon 右上角删除图标名称,只能为uView内置图标
  69. * @property {String} del-bg-color 右上角关闭按钮的背景颜色
  70. * @property {String} del-color 右上角关闭按钮图标的颜色
  71. * @property {Object} header 上传携带的头信息,对象形式
  72. * @property {Object} form-data 上传额外携带的参数
  73. * @property {String} name 上传文件的字段名,供后端获取使用(默认file)
  74. * @property {Array<String>} size-type original 原图,compressed 压缩图,默认二者都有(默认['original', 'compressed'])
  75. * @property {Array<String>} source-type 选择图片的来源,album-从相册选图,camera-使用相机,默认二者都有(默认['album', 'camera'])
  76. * @property {Boolean} preview-full-image 是否可以通过uni.previewImage预览已选择的图片(默认true)
  77. * @property {Boolean} multiple 是否开启图片多选,部分安卓机型不支持(默认true)
  78. * @property {Boolean} deletable 是否显示删除图片的按钮(默认true)
  79. * @property {String Number} max-size 选择单个文件的最大大小,单位B(byte),默认不限制(默认Number.MAX_VALUE)
  80. * @property {Array<Object>} file-list 默认显示的图片列表,数组元素为对象,必须提供url属性
  81. * @property {Boolean} upload-text 选择图片按钮的提示文字(默认“选择图片”)
  82. * @property {Boolean} auto-upload 选择完图片是否自动上传,见上方说明(默认true)
  83. * @property {Boolean} show-tips 特殊情况下是否自动提示toast,见上方说明(默认true)
  84. * @property {Boolean} show-upload-list 是否显示组件内部的图片预览(默认true)
  85. * @event {Function} on-oversize 图片大小超出最大允许大小
  86. * @event {Function} on-preview 全屏预览图片时触发
  87. * @event {Function} on-remove 移除图片时触发
  88. * @event {Function} on-success 图片上传成功时触发
  89. * @event {Function} on-change 图片上传后,无论成功或者失败都会触发
  90. * @event {Function} on-error 图片上传失败时触发
  91. * @event {Function} on-progress 图片上传过程中的进度变化过程触发
  92. * @event {Function} on-uploaded 所有图片上传完毕触发
  93. * @event {Function} on-choose-complete 每次选择图片后触发,只是让外部可以得知每次选择后,内部的文件列表
  94. * @example <u-upload :action="action" :file-list="fileList" ></u-upload>
  95. */
  96. import uploadImage from '@/components/ossutil/uploadFile.js';
  97. export default {
  98. name: 'upload',
  99. props: {
  100. //是否显示组件自带的图片预览功能
  101. showUploadList: {
  102. type: Boolean,
  103. default: true
  104. },
  105. // 后端地址
  106. action: {
  107. type: String,
  108. default: ''
  109. },
  110. // 最大上传数量
  111. maxCount: {
  112. type: [String, Number],
  113. default: 52,
  114. },
  115. // 删除图标大小
  116. delIconSize:{
  117. type: String,
  118. default: '20'
  119. },
  120. // 是否显示进度条
  121. showProgress: {
  122. type: Boolean,
  123. default: true
  124. },
  125. // 是否启用
  126. disabled: {
  127. type: Boolean,
  128. default: false
  129. },
  130. // 预览上传的图片时的裁剪模式,和image组件mode属性一致
  131. imageMode: {
  132. type: String,
  133. default: 'aspectFill'
  134. },
  135. // 头部信息
  136. header: {
  137. type: Object,
  138. default () {
  139. return {};
  140. }
  141. },
  142. // 额外携带的参数
  143. formData: {
  144. type: Object,
  145. default () {
  146. return {};
  147. }
  148. },
  149. // 上传的文件字段名
  150. name: {
  151. type: String,
  152. default: 'file'
  153. },
  154. // 所选的图片的尺寸, 可选值为original compressed
  155. sizeType: {
  156. type: Array,
  157. default () {
  158. return ['original', 'compressed'];
  159. }
  160. },
  161. sourceType: {
  162. type: Array,
  163. default () {
  164. return ['album', 'camera'];
  165. }
  166. },
  167. // 成功背景颜色
  168. checkBgColor:{
  169. type: String,
  170. default: '#22C572'
  171. },
  172. // 成功icon颜色
  173. checkColor:{
  174. type: String,
  175. default: '#fff'
  176. },
  177. // 成功icon颜色
  178. checkIcon:{
  179. type: String,
  180. default: 'checkbox-mark'
  181. },
  182. // 成功icon颜色
  183. checkIconSize:{
  184. type: String,
  185. default: '20'
  186. },
  187. // 是否在点击预览图后展示全屏图片预览
  188. previewFullImage: {
  189. type: Boolean,
  190. default: true
  191. },
  192. // 是否开启图片多选,部分安卓机型不支持
  193. multiple: {
  194. type: Boolean,
  195. default: true
  196. },
  197. // 是否展示删除按钮
  198. deletable: {
  199. type: Boolean,
  200. default: true
  201. },
  202. // 文件大小限制,单位为byte
  203. maxSize: {
  204. type: [String, Number],
  205. default: Number.MAX_VALUE
  206. },
  207. // 显示已上传的文件列表
  208. fileList: {
  209. type: Array,
  210. default () {
  211. return [];
  212. }
  213. },
  214. // 上传区域的提示文字
  215. uploadText: {
  216. type: String,
  217. default: '选择图片'
  218. },
  219. // 是否自动上传
  220. autoUpload: {
  221. type: Boolean,
  222. default: true
  223. },
  224. // 是否显示toast消息提示
  225. showTips: {
  226. type: Boolean,
  227. default: true
  228. },
  229. // 是否通过slot自定义传入选择图标的按钮
  230. customBtn: {
  231. type: Boolean,
  232. default: false
  233. },
  234. customBtnImage: {
  235. type: String,
  236. default: ''
  237. },
  238. customBtnWidth: {
  239. type: Number,
  240. default: 0
  241. },
  242. customBtnHeight: {
  243. type: Number,
  244. default: 0
  245. },
  246. customBtnColor: {
  247. type: String,
  248. default: '#617E8B'
  249. },
  250. customBack:{
  251. type: String,
  252. default: '#F5F6FA'
  253. },
  254. customBorder:{
  255. type: String,
  256. // default: '2px dashed #C6CBCE'
  257. },
  258. customBtnFontSize:{
  259. type: String,
  260. default: '18'
  261. },
  262. // 内部预览图片区域和选择图片按钮的区域宽度,高等于宽
  263. width: {
  264. type: [String, Number],
  265. default: 200
  266. },
  267. // 右上角关闭按钮的背景颜色
  268. delBgColor: {
  269. type: String,
  270. default: '#fa3534'
  271. },
  272. // 右上角关闭按钮的叉号图标的颜色
  273. delColor: {
  274. type: String,
  275. default: '#ffffff'
  276. },
  277. // 右上角删除图标名称,只能为uView内置图标
  278. delIcon: {
  279. type: String,
  280. default: 'close'
  281. },
  282. // 如果上传后的返回值为json字符串,是否自动转json
  283. toJson: {
  284. type: Boolean,
  285. default: true
  286. },
  287. // 上传前的钩子,每个文件上传前都会执行
  288. beforeUpload: {
  289. type: Function,
  290. default: null
  291. },
  292. options: {
  293. type: Object,
  294. default: null
  295. },
  296. custom: {
  297. type: Boolean,
  298. default: false
  299. },
  300. imgIndex:{
  301. type: Number,
  302. default: 0
  303. }
  304. },
  305. mounted() {},
  306. data() {
  307. return {
  308. lists: [],
  309. isInCount: true,
  310. uploading: false,
  311. isSelectFile: false,
  312. imgShow:false,
  313. url:''
  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-color: $u-type-error;
  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-type-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. // .custom-style {
  691. // background: #F5F6FA;
  692. // width: 100%;
  693. // height: 480rpx;
  694. // display: flex;
  695. // justify-content: center;
  696. // align-items: center;
  697. // background: #F2F5FA;
  698. // border-radius: 20rpx;
  699. // border: 2px dashed #C6CBCE;
  700. // }
  701. // .custom-img {
  702. // width: 120rpx;
  703. // height: 100rpx;
  704. // }
  705. // .text {
  706. // font-size: 18px;
  707. // font-weight: 600;
  708. // color: #617E8B;
  709. // }
  710. // .content {
  711. // display: flex;
  712. // justify-content: center;
  713. // flex-direction: column;
  714. // align-items: center;
  715. // }
  716. // .u-preview {
  717. // width: 100%;
  718. // height: 100%;
  719. // // position: absolute;
  720. // background: #F5F6FA;
  721. // }
  722. // .u-list-item-custom {
  723. // margin: 0 !important;
  724. // width: 100% !important;
  725. // height: 100% !important;
  726. // }
  727. .customStyleBgc {
  728. width: 100% !important;
  729. height: 440rpx !important;
  730. display: flex !important;
  731. justify-content: center;
  732. align-items: center;
  733. position: relative;
  734. .u-add-wrap {
  735. width: 100% !important;
  736. height: 100% !important;
  737. background: transparent;
  738. }
  739. .u-add-tips {
  740. font-size: 18px;
  741. font-weight: 600;
  742. color: #617E8B;
  743. }
  744. }
  745. .customStyle {
  746. width: 712rpx !important;
  747. height: 440rpx !important;
  748. background: #F5F6FA;
  749. border-radius: 20rpx;
  750. // border: 2px dashed #C6CBCE;
  751. display: flex !important;
  752. justify-content: center;
  753. align-items: center;
  754. position: relative;
  755. .u-add-wrap {
  756. width: 100% !important;
  757. height: 100% !important;
  758. background: transparent;
  759. }
  760. .u-add-tips {
  761. font-size: 18px;
  762. font-weight: 600;
  763. color: #617E8B;
  764. }
  765. }
  766. .customPreviewStyle {
  767. width: 100% !important;
  768. height: 440rpx !important;
  769. }
  770. .imgstyle {
  771. width: 100% !important;
  772. height: 440rpx !important;
  773. position: absolute;
  774. }
  775. .default{
  776. .u-list-item.u-add-wrap{
  777. background:#fff;
  778. border:1px dashed #AFB3BF;
  779. }
  780. }
  781. .shade{
  782. background:#000;
  783. position:fixed;
  784. top:0;left:0;
  785. width:100%;height:100%;
  786. z-index:10000;
  787. }
  788. .u-check-icon{
  789. position: absolute;
  790. bottom: 0rpx;
  791. left: 0rpx;
  792. z-index: 10;
  793. background-color: $u-type-error;
  794. border-radius:0 0 0 10rpx;
  795. width: 44rpx;
  796. height: 44rpx;
  797. display: flex;
  798. align-items: center;
  799. justify-content: center;
  800. }
  801. </style>