upload.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  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/images/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: '#2772FB'
  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. };
  314. },
  315. watch: {
  316. fileList: {
  317. immediate: true,
  318. handler(val) {
  319. val.map(value => {
  320. this.lists.push({
  321. url: value.url,
  322. error: false,
  323. progress: 100
  324. });
  325. });
  326. }
  327. }
  328. },
  329. methods: {
  330. // 清除列表
  331. clear() {
  332. this.lists = [];
  333. // 如果是清空形式的话,发出"on-list-change"事件
  334. this.$emit('on-list-change', this.lists);
  335. },
  336. // 重新上传队列中上传失败的所有文件
  337. reUpload() {
  338. this.uploadFile();
  339. },
  340. // 选择图片
  341. selectFile() {
  342. if (this.disabled) return;
  343. const {
  344. name = '', maxCount, multiple, maxSize, sizeType, lists, camera, compressed, maxDuration, sourceType
  345. } = this;
  346. let chooseFile = null;
  347. const newMaxCount = maxCount - lists.length;
  348. // 设置为只选择图片的时候使用 chooseImage 来实现
  349. chooseFile = new Promise((resolve, reject) => {
  350. uni.chooseImage({
  351. count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
  352. sourceType: sourceType,
  353. sizeType,
  354. success: resolve,
  355. fail: reject
  356. });
  357. });
  358. chooseFile
  359. .then(res => {
  360. let file = null;
  361. let listOldLength = this.lists.length;
  362. res.tempFiles.map((val, index) => {
  363. // 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
  364. if (!multiple && index >= 1) return;
  365. if (val.size > maxSize) {
  366. this.$emit('on-oversize', val, this.lists);
  367. this.showToast('超出允许的文件大小');
  368. } else {
  369. if (maxCount <= lists.length) {
  370. this.$emit('on-exceed', val, this.lists);
  371. this.showToast('超出最大允许的文件个数');
  372. return;
  373. }
  374. let fileName = '';
  375. let fileNameLength = '';
  376. let fileFormat = '';
  377. //#ifdef H5
  378. fileName = val.name.lastIndexOf(".");
  379. fileNameLength = val.name.length;
  380. fileFormat = val.name.substring(fileName + 1, fileNameLength).toLowerCase();
  381. //#endif
  382. //#ifndef H5
  383. fileName = val.path.lastIndexOf(".");
  384. fileNameLength = val.path.length;
  385. fileFormat = val.path.substring(fileName + 1, fileNameLength).toLowerCase();
  386. //#endif
  387. lists.push({
  388. url: val.path,
  389. fileType: fileFormat,
  390. progress: 0,
  391. error: false
  392. });
  393. // 列表发生改变,发出事件,第二个参数为当前发生变化的项的索引
  394. this.$emit('on-list-change', this.lists);
  395. }
  396. });
  397. // 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
  398. this.$emit('on-choose-complete', this.lists);
  399. if (this.autoUpload) this.uploadFile(listOldLength);
  400. })
  401. .catch(error => {
  402. this.$emit('on-error', error);
  403. });
  404. },
  405. // 提示用户消息
  406. showToast(message, force = false) {
  407. if (this.showTips || force) {
  408. uni.showToast({
  409. title: message,
  410. icon: 'none'
  411. });
  412. }
  413. },
  414. // 该方法供用户通过ref调用,手动上传
  415. upload() {
  416. this.uploadFile();
  417. },
  418. // 对失败的图片重新上传
  419. retry(index) {
  420. this.lists[index].progress = 0;
  421. this.lists[index].error = false;
  422. this.lists[index].response = null;
  423. uni.showLoading({
  424. title: '重新上传'
  425. });
  426. this.uploadFile(index);
  427. },
  428. // 上传图片
  429. async uploadFile(index = 0) {
  430. if (this.disabled) return;
  431. if (this.uploading) return;
  432. // 全部上传完成
  433. if (index >= this.lists.length) {
  434. this.isSelectFile = true
  435. this.$emit('on-uploaded', this.lists);
  436. return;
  437. }
  438. // 检查上传地址
  439. if (!this.action) {
  440. this.showToast('请配置上传地址', true);
  441. return;
  442. }
  443. // 检查是否是已上传或者正在上传中
  444. if (this.lists[index].progress == 100) {
  445. if (this.autoUpload == false) this.uploadFile(index + 1);
  446. return;
  447. }
  448. // 执行before-upload钩子
  449. if (this.beforeUpload && typeof(this.beforeUpload) === 'function') {
  450. // 执行回调,同时传入索引和文件列表当作参数
  451. let beforeResponse = this.beforeUpload(index, this.lists);
  452. // 判断是否返回了promise
  453. if (!!beforeResponse && typeof beforeResponse.then === 'function') {
  454. await beforeResponse.then(res => {
  455. // promise返回成功,不进行动作,继续上传
  456. }).catch(err => {
  457. // 进入catch回调的话,继续下一张
  458. return this.uploadFile(index + 1);
  459. })
  460. } else if (beforeResponse === false) {
  461. // 如果返回false,继续下一张图片的上传
  462. return this.uploadFile(index + 1);
  463. }
  464. }
  465. this.lists[index].error = false;
  466. this.uploading = true;
  467. uploadImage(this.lists[index].url, 'appData/',
  468. result => {
  469. console.log
  470. // 上传成功
  471. this.lists[index].response = result;
  472. this.lists[index].progress = 100;
  473. this.lists[index].error = false;
  474. let data = result
  475. this.$emit('on-success', data, index, this.lists,this.imgIndex);
  476. uni.hideLoading();
  477. this.uploading = false;
  478. this.uploadFile(index + 1);
  479. this.$emit('on-change', data, index, this.lists,this.imgIndex);
  480. }
  481. )
  482. // 创建上传对象
  483. // const task = uni.uploadFile({
  484. // url: this.action,
  485. // filePath: this.lists[index].url,
  486. // name: this.name,
  487. // formData: this.formData,
  488. // header: this.header,
  489. // success: res => {
  490. // // 判断是否json字符串,将其转为json格式
  491. // let data = this.toJson && this.checkIsJSON(res.data) ? JSON.parse(res.data) : res
  492. // .data;
  493. // if (![200, 201].includes(res.statusCode)) {
  494. // this.uploadError(index, data);
  495. // } else {
  496. // // 上传成功
  497. // this.lists[index].response = data;
  498. // this.lists[index].progress = 100;
  499. // this.lists[index].error = false;
  500. // // this.$emit('on-success', data, index, this.lists);
  501. // }
  502. // },
  503. // fail: e => {
  504. // this.uploadError(index, e);
  505. // },
  506. // complete: res => {
  507. // uni.hideLoading();
  508. // this.uploading = false;
  509. // this.uploadFile(index + 1);
  510. // this.$emit('on-change', res, index, this.lists);
  511. // }
  512. // });
  513. // task.onProgressUpdate(res => {
  514. // if (res.progress > 0) {
  515. // this.lists[index].progress = res.progress;
  516. // this.$emit('on-progress', res, index, this.lists);
  517. // }
  518. // });
  519. },
  520. // 上传失败
  521. uploadError(index, err) {
  522. this.lists[index].progress = 0;
  523. this.lists[index].error = true;
  524. this.lists[index].response = null;
  525. this.$emit('on-error', err, index, this.lists);
  526. this.showToast('上传失败,请重试');
  527. },
  528. // 删除一个图片
  529. deleteItem(index) {
  530. uni.showModal({
  531. title: '提示',
  532. content: '您确定要删除此项吗?',
  533. success: res => {
  534. if (res.confirm) {
  535. this.isSelectFile = false
  536. if (this.lists[index].process < 100 && this.lists[index].process > 0) {
  537. typeof this.lists[index].uploadTask != 'undefined' && this.lists[index]
  538. .uploadTask.abort();
  539. }
  540. this.lists.splice(index, 1);
  541. this.$forceUpdate();
  542. this.$emit('on-remove', index, this.lists);
  543. this.showToast('移除成功');
  544. // 列表发生改变,发出事件
  545. this.$emit('on-list-change', this.lists);
  546. }
  547. }
  548. });
  549. },
  550. // 用户通过ref手动的形式,移除一张图片
  551. remove(index) {
  552. // 判断索引的合法范围
  553. if (index >= 0 && index < this.lists.length) {
  554. this.lists.splice(index, 1);
  555. this.$emit('on-list-change', this.lists);
  556. }
  557. },
  558. // 预览图片
  559. doPreviewImage(url, index) {
  560. console.log(this.lists,url,index)
  561. if (!this.previewFullImage) return;
  562. const images = this.lists.map(item => item.url || item.path);
  563. this.url=url
  564. this.imgShow=true
  565. // 图片预览调用onShow清空数据
  566. // uni.previewImage({
  567. // urls: images,
  568. // current: url,
  569. // success: () => {
  570. // this.$emit('on-preview', url, this.lists);
  571. // },
  572. // fail: () => {
  573. // uni.showToast({
  574. // title: '预览图片失败',
  575. // icon: 'none'
  576. // });
  577. // }
  578. // });
  579. },
  580. // 判断是否json字符串
  581. checkIsJSON(str) {
  582. if (typeof str == 'string') {
  583. try {
  584. var obj = JSON.parse(str);
  585. if (typeof obj == 'object' && obj) {
  586. return true;
  587. } else {
  588. return false;
  589. }
  590. } catch (e) {
  591. return false;
  592. }
  593. }
  594. return false;
  595. }
  596. }
  597. };
  598. </script>
  599. <style lang="scss" scoped>
  600. // nvue不能用标签命名样式
  601. /* #ifndef APP-NVUE */
  602. image {
  603. display: inline-block;
  604. // 解决图片加载时可能会瞬间变形的问题
  605. will-change: transform;
  606. }
  607. view,
  608. text {
  609. box-sizing: border-box;
  610. flex-direction: row;
  611. }
  612. /* #endif */
  613. .u-upload {
  614. display: flex;
  615. flex-wrap: wrap;
  616. align-items: center;
  617. }
  618. .u-list-item {
  619. width: 200rpx;
  620. height: 200rpx;
  621. overflow: hidden;
  622. // margin: 10rpx;
  623. background: rgb(244, 245, 246);
  624. position: relative;
  625. border-radius: 10rpx;
  626. display: inline-flex;
  627. align-items: center;
  628. justify-content: center;
  629. }
  630. .u-preview-wrap {
  631. border: 1px solid rgb(235, 236, 238);
  632. }
  633. .u-add-wrap {
  634. flex-direction: column;
  635. color: $u-content-color;
  636. font-size: 28rpx;
  637. }
  638. .u-add-tips {
  639. margin-top: 20rpx;
  640. }
  641. .u-add-wrap__hover {
  642. background-color: rgb(235, 236, 238);
  643. }
  644. .u-preview-image {
  645. display: block;
  646. width: 100%;
  647. height: 100%;
  648. border-radius: 10rpx;
  649. }
  650. .u-delete-icon {
  651. position: absolute;
  652. top: 0rpx;
  653. right: 0rpx;
  654. z-index: 10;
  655. background: rgba(17, 26, 52, 0.5);
  656. border-radius:0 0 0 10rpx;
  657. width: 44rpx;
  658. height: 44rpx;
  659. display: flex;
  660. align-items: center;
  661. justify-content: center;
  662. }
  663. .u-icon {
  664. display: flex;
  665. align-items: center;
  666. justify-content: center;
  667. }
  668. .u-progress {
  669. position: absolute;
  670. bottom: 10rpx;
  671. left: 8rpx;
  672. right: 8rpx;
  673. z-index: 9;
  674. width: auto;
  675. }
  676. .u-error-btn {
  677. color: #ffffff;
  678. background-color: $u-error;
  679. font-size: 20rpx;
  680. padding: 4px 0;
  681. text-align: center;
  682. position: absolute;
  683. bottom: 0;
  684. left: 0;
  685. right: 0;
  686. z-index: 9;
  687. line-height: 1;
  688. }
  689. .customStyleBgc {
  690. width: 100% !important;
  691. height: 440rpx !important;
  692. display: flex !important;
  693. justify-content: center;
  694. align-items: center;
  695. position: relative;
  696. .u-add-wrap {
  697. width: 100% !important;
  698. height: 100% !important;
  699. background: transparent;
  700. }
  701. .u-add-tips {
  702. font-size: 18px;
  703. font-weight: 600;
  704. color: #617E8B;
  705. }
  706. }
  707. .customStyle {
  708. width: 712rpx !important;
  709. height: 440rpx !important;
  710. background: #F5F6FA;
  711. border-radius: 20rpx;
  712. // border: 2px dashed #C6CBCE;
  713. display: flex !important;
  714. justify-content: center;
  715. align-items: center;
  716. position: relative;
  717. .u-add-wrap {
  718. width: 100% !important;
  719. height: 100% !important;
  720. background: transparent;
  721. }
  722. .u-add-tips {
  723. font-size: 18px;
  724. font-weight: 600;
  725. color: #617E8B;
  726. }
  727. }
  728. .customPreviewStyle {
  729. width: 100% !important;
  730. height: 440rpx !important;
  731. }
  732. .imgstyle {
  733. width: 100% !important;
  734. height: 440rpx !important;
  735. position: absolute;
  736. }
  737. .default{
  738. .u-list-item.u-add-wrap{
  739. background:#fff;
  740. border:1px dashed #AFB3BF;
  741. }
  742. }
  743. .shade{
  744. background:#000;
  745. position:fixed;
  746. top:0;left:0;
  747. width:100%;height:100%;
  748. z-index:10000;
  749. }
  750. .u-check-icon{
  751. position: absolute;
  752. bottom: 0rpx;
  753. left: 0rpx;
  754. z-index: 10;
  755. background-color: $u-error;
  756. border-radius:0 0 0 10rpx;
  757. width: 44rpx;
  758. height: 44rpx;
  759. display: flex;
  760. align-items: center;
  761. justify-content: center;
  762. }
  763. </style>