index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. <template>
  2. <view class="container">
  3. <view class="page-body uni-content-info">
  4. <view class='cropper-content'>
  5. <view v-if="isShowImg" class="uni-corpper" :style="'width:'+cropperInitW+'px;height:'+cropperInitH+'px;background:#000'">
  6. <view class="uni-corpper-content" :style="'width:'+cropperW+'px;height:'+cropperH+'px;left:'+cropperL+'px;top:'+cropperT+'px'">
  7. <image :src="imageSrc" :style="'width:'+cropperW+'px;height:'+cropperH+'px'"></image>
  8. <view class="uni-corpper-crop-box" @touchstart.stop="contentStartMove" @touchmove.stop="contentMoveing" @touchend.stop="contentTouchEnd"
  9. :style="'left:'+cutL+'px;top:'+cutT+'px;right:'+cutR+'px;bottom:'+cutB+'px'">
  10. <view class="uni-cropper-view-box">
  11. <view class="uni-cropper-dashed-h"></view>
  12. <view class="uni-cropper-dashed-v"></view>
  13. <view class="uni-cropper-line-t" data-drag="top" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  14. <view class="uni-cropper-line-r" data-drag="right" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  15. <view class="uni-cropper-line-b" data-drag="bottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  16. <view class="uni-cropper-line-l" data-drag="left" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  17. <view class="uni-cropper-point point-t" data-drag="top" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  18. <view class="uni-cropper-point point-tr" data-drag="topTight"></view>
  19. <view class="uni-cropper-point point-r" data-drag="right" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  20. <view class="uni-cropper-point point-rb" data-drag="rightBottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  21. <view class="uni-cropper-point point-b" data-drag="bottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove" @touchend.stop="dragEnd"></view>
  22. <view class="uni-cropper-point point-bl" data-drag="bottomLeft"></view>
  23. <view class="uni-cropper-point point-l" data-drag="left" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
  24. <view class="uni-cropper-point point-lt" data-drag="leftTop"></view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class='cropper-config'>
  31. <button type="primary reverse" @click="getImage" style='margin-top: 30rpx;'> 选择头像 </button>
  32. <button type="warn" @click="getImageInfo" style='margin-top: 30rpx;'> 提交 </button>
  33. </view>
  34. <canvas canvas-id="myCanvas" :style="'position:absolute;border: 1px solid red; width:'+imageW+'px;height:'+imageH+'px;top:-9999px;left:-9999px;'"></canvas>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import config from '@/config'
  40. import store from "@/store"
  41. import { uploadAvatar } from "@/api/system/user"
  42. const baseUrl = config.baseUrl
  43. let sysInfo = uni.getSystemInfoSync()
  44. let SCREEN_WIDTH = sysInfo.screenWidth
  45. let PAGE_X, // 手按下的x位置
  46. PAGE_Y, // 手按下y的位置
  47. PR = sysInfo.pixelRatio, // dpi
  48. T_PAGE_X, // 手移动的时候x的位置
  49. T_PAGE_Y, // 手移动的时候Y的位置
  50. CUT_L, // 初始化拖拽元素的left值
  51. CUT_T, // 初始化拖拽元素的top值
  52. CUT_R, // 初始化拖拽元素的
  53. CUT_B, // 初始化拖拽元素的
  54. CUT_W, // 初始化拖拽元素的宽度
  55. CUT_H, // 初始化拖拽元素的高度
  56. IMG_RATIO, // 图片比例
  57. IMG_REAL_W, // 图片实际的宽度
  58. IMG_REAL_H, // 图片实际的高度
  59. DRAFG_MOVE_RATIO = 1, //移动时候的比例,
  60. INIT_DRAG_POSITION = 100, // 初始化屏幕宽度和裁剪区域的宽度之差,用于设置初始化裁剪的宽度
  61. DRAW_IMAGE_W = sysInfo.screenWidth // 设置生成的图片宽度
  62. export default {
  63. /**
  64. * 页面的初始数据
  65. */
  66. data() {
  67. return {
  68. imageSrc: store.getters.avatar,
  69. isShowImg: false,
  70. // 初始化的宽高
  71. cropperInitW: SCREEN_WIDTH,
  72. cropperInitH: SCREEN_WIDTH,
  73. // 动态的宽高
  74. cropperW: SCREEN_WIDTH,
  75. cropperH: SCREEN_WIDTH,
  76. // 动态的left top值
  77. cropperL: 0,
  78. cropperT: 0,
  79. transL: 0,
  80. transT: 0,
  81. // 图片缩放值
  82. scaleP: 0,
  83. imageW: 0,
  84. imageH: 0,
  85. // 裁剪框 宽高
  86. cutL: 0,
  87. cutT: 0,
  88. cutB: SCREEN_WIDTH,
  89. cutR: '100%',
  90. qualityWidth: DRAW_IMAGE_W,
  91. innerAspectRadio: DRAFG_MOVE_RATIO
  92. }
  93. },
  94. /**
  95. * 生命周期函数--监听页面初次渲染完成
  96. */
  97. onReady: function () {
  98. this.loadImage()
  99. },
  100. methods: {
  101. setData: function (obj) {
  102. let that = this
  103. Object.keys(obj).forEach(function (key) {
  104. that.$set(that.$data, key, obj[key])
  105. })
  106. },
  107. getImage: function () {
  108. var _this = this
  109. uni.chooseImage({
  110. success: function (res) {
  111. _this.setData({
  112. imageSrc: res.tempFilePaths[0],
  113. })
  114. _this.loadImage()
  115. },
  116. })
  117. },
  118. loadImage: function () {
  119. var _this = this
  120. uni.getImageInfo({
  121. src: _this.imageSrc,
  122. success: function success(res) {
  123. IMG_RATIO = 1 / 1
  124. if (IMG_RATIO >= 1) {
  125. IMG_REAL_W = SCREEN_WIDTH
  126. IMG_REAL_H = SCREEN_WIDTH / IMG_RATIO
  127. } else {
  128. IMG_REAL_W = SCREEN_WIDTH * IMG_RATIO
  129. IMG_REAL_H = SCREEN_WIDTH
  130. }
  131. let minRange = IMG_REAL_W > IMG_REAL_H ? IMG_REAL_W : IMG_REAL_H
  132. INIT_DRAG_POSITION = minRange > INIT_DRAG_POSITION ? INIT_DRAG_POSITION : minRange
  133. // 根据图片的宽高显示不同的效果 保证图片可以正常显示
  134. if (IMG_RATIO >= 1) {
  135. let cutT = Math.ceil((SCREEN_WIDTH / IMG_RATIO - (SCREEN_WIDTH / IMG_RATIO - INIT_DRAG_POSITION)) / 2)
  136. let cutB = cutT
  137. let cutL = Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH + INIT_DRAG_POSITION) / 2)
  138. let cutR = cutL
  139. _this.setData({
  140. cropperW: SCREEN_WIDTH,
  141. cropperH: SCREEN_WIDTH / IMG_RATIO,
  142. // 初始化left right
  143. cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2),
  144. cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2),
  145. cutL: cutL,
  146. cutT: cutT,
  147. cutR: cutR,
  148. cutB: cutB,
  149. // 图片缩放值
  150. imageW: IMG_REAL_W,
  151. imageH: IMG_REAL_H,
  152. scaleP: IMG_REAL_W / SCREEN_WIDTH,
  153. qualityWidth: DRAW_IMAGE_W,
  154. innerAspectRadio: IMG_RATIO
  155. })
  156. } else {
  157. let cutL = Math.ceil((SCREEN_WIDTH * IMG_RATIO - (SCREEN_WIDTH * IMG_RATIO)) / 2)
  158. let cutR = cutL
  159. let cutT = Math.ceil((SCREEN_WIDTH - INIT_DRAG_POSITION) / 2)
  160. let cutB = cutT
  161. _this.setData({
  162. cropperW: SCREEN_WIDTH * IMG_RATIO,
  163. cropperH: SCREEN_WIDTH,
  164. // 初始化left right
  165. cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2),
  166. cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2),
  167. cutL: cutL,
  168. cutT: cutT,
  169. cutR: cutR,
  170. cutB: cutB,
  171. // 图片缩放值
  172. imageW: IMG_REAL_W,
  173. imageH: IMG_REAL_H,
  174. scaleP: IMG_REAL_W / SCREEN_WIDTH,
  175. qualityWidth: DRAW_IMAGE_W,
  176. innerAspectRadio: IMG_RATIO
  177. })
  178. }
  179. _this.setData({
  180. isShowImg: true
  181. })
  182. uni.hideLoading()
  183. }
  184. })
  185. },
  186. // 拖动时候触发的touchStart事件
  187. contentStartMove(e) {
  188. PAGE_X = e.touches[0].pageX
  189. PAGE_Y = e.touches[0].pageY
  190. },
  191. // 拖动时候触发的touchMove事件
  192. contentMoveing(e) {
  193. var _this = this
  194. var dragLengthX = (PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  195. var dragLengthY = (PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  196. // 左移
  197. if (dragLengthX > 0) {
  198. if (this.cutL - dragLengthX < 0) dragLengthX = this.cutL
  199. } else {
  200. if (this.cutR + dragLengthX < 0) dragLengthX = -this.cutR
  201. }
  202. if (dragLengthY > 0) {
  203. if (this.cutT - dragLengthY < 0) dragLengthY = this.cutT
  204. } else {
  205. if (this.cutB + dragLengthY < 0) dragLengthY = -this.cutB
  206. }
  207. this.setData({
  208. cutL: this.cutL - dragLengthX,
  209. cutT: this.cutT - dragLengthY,
  210. cutR: this.cutR + dragLengthX,
  211. cutB: this.cutB + dragLengthY
  212. })
  213. PAGE_X = e.touches[0].pageX
  214. PAGE_Y = e.touches[0].pageY
  215. },
  216. contentTouchEnd() {
  217. },
  218. // 获取图片
  219. getImageInfo() {
  220. var _this = this
  221. uni.showLoading({
  222. title: '图片生成中...',
  223. })
  224. // 将图片写入画布
  225. const ctx = uni.createCanvasContext('myCanvas')
  226. ctx.drawImage(_this.imageSrc, 0, 0, IMG_REAL_W, IMG_REAL_H)
  227. ctx.draw(true, () => {
  228. // 获取画布要裁剪的位置和宽度 均为百分比 * 画布中图片的宽度 保证了在微信小程序中裁剪的图片模糊 位置不对的问题 canvasT = (_this.cutT / _this.cropperH) * (_this.imageH / pixelRatio)
  229. var canvasW = ((_this.cropperW - _this.cutL - _this.cutR) / _this.cropperW) * IMG_REAL_W
  230. var canvasH = ((_this.cropperH - _this.cutT - _this.cutB) / _this.cropperH) * IMG_REAL_H
  231. var canvasL = (_this.cutL / _this.cropperW) * IMG_REAL_W
  232. var canvasT = (_this.cutT / _this.cropperH) * IMG_REAL_H
  233. uni.canvasToTempFilePath({
  234. x: canvasL,
  235. y: canvasT,
  236. width: canvasW,
  237. height: canvasH,
  238. destWidth: canvasW,
  239. destHeight: canvasH,
  240. quality: 0.5,
  241. canvasId: 'myCanvas',
  242. success: function (res) {
  243. uni.hideLoading()
  244. let data = {name: 'avatarFile', filePath: res.tempFilePath}
  245. uploadAvatar(data).then(response => {
  246. store.commit('SET_AVATAR', response.data)
  247. uni.showToast({ title: "修改成功", icon: 'success' })
  248. uni.navigateBack()
  249. })
  250. }
  251. })
  252. })
  253. },
  254. // 设置大小的时候触发的touchStart事件
  255. dragStart(e) {
  256. T_PAGE_X = e.touches[0].pageX
  257. T_PAGE_Y = e.touches[0].pageY
  258. CUT_L = this.cutL
  259. CUT_R = this.cutR
  260. CUT_B = this.cutB
  261. CUT_T = this.cutT
  262. },
  263. // 设置大小的时候触发的touchMove事件
  264. dragMove(e) {
  265. var _this = this
  266. var dragType = e.target.dataset.drag
  267. switch (dragType) {
  268. case 'right':
  269. var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  270. if (CUT_R + dragLength < 0) dragLength = -CUT_R
  271. this.setData({
  272. cutR: CUT_R + dragLength
  273. })
  274. break
  275. case 'left':
  276. var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  277. if (CUT_L - dragLength < 0) dragLength = CUT_L
  278. if ((CUT_L - dragLength) > (this.cropperW - this.cutR)) dragLength = CUT_L - (this.cropperW - this.cutR)
  279. this.setData({
  280. cutL: CUT_L - dragLength
  281. })
  282. break
  283. case 'top':
  284. var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  285. if (CUT_T - dragLength < 0) dragLength = CUT_T
  286. if ((CUT_T - dragLength) > (this.cropperH - this.cutB)) dragLength = CUT_T - (this.cropperH - this.cutB)
  287. this.setData({
  288. cutT: CUT_T - dragLength
  289. })
  290. break
  291. case 'bottom':
  292. var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  293. if (CUT_B + dragLength < 0) dragLength = -CUT_B
  294. this.setData({
  295. cutB: CUT_B + dragLength
  296. })
  297. break
  298. case 'rightBottom':
  299. var dragLengthX = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  300. var dragLengthY = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  301. if (CUT_B + dragLengthY < 0) dragLengthY = -CUT_B
  302. if (CUT_R + dragLengthX < 0) dragLengthX = -CUT_R
  303. let cutB = CUT_B + dragLengthY
  304. let cutR = CUT_R + dragLengthX
  305. this.setData({
  306. cutB: cutB,
  307. cutR: cutR
  308. })
  309. break
  310. default:
  311. break
  312. }
  313. }
  314. }
  315. }
  316. </script>
  317. <style>
  318. /* pages/uni-cropper/index.wxss */
  319. .uni-content-info {
  320. /* position: fixed;
  321. top: 0;
  322. left: 0;
  323. right: 0;
  324. bottom: 0;
  325. display: block;
  326. align-items: center;
  327. flex-direction: column; */
  328. }
  329. .cropper-config {
  330. padding: 20rpx 40rpx;
  331. }
  332. .cropper-content {
  333. min-height: 750rpx;
  334. width: 100%;
  335. }
  336. .uni-corpper {
  337. position: relative;
  338. overflow: hidden;
  339. -webkit-user-select: none;
  340. -moz-user-select: none;
  341. -ms-user-select: none;
  342. user-select: none;
  343. -webkit-tap-highlight-color: transparent;
  344. -webkit-touch-callout: none;
  345. box-sizing: border-box;
  346. }
  347. .uni-corpper-content {
  348. position: relative;
  349. }
  350. .uni-corpper-content image {
  351. display: block;
  352. width: 100%;
  353. min-width: 0 !important;
  354. max-width: none !important;
  355. height: 100%;
  356. min-height: 0 !important;
  357. max-height: none !important;
  358. image-orientation: 0deg !important;
  359. margin: 0 auto;
  360. }
  361. /* 移动图片效果 */
  362. .uni-cropper-drag-box {
  363. position: absolute;
  364. top: 0;
  365. right: 0;
  366. bottom: 0;
  367. left: 0;
  368. cursor: move;
  369. background: rgba(0, 0, 0, 0.6);
  370. z-index: 1;
  371. }
  372. /* 内部的信息 */
  373. .uni-corpper-crop-box {
  374. position: absolute;
  375. background: rgba(255, 255, 255, 0.3);
  376. z-index: 2;
  377. }
  378. .uni-corpper-crop-box .uni-cropper-view-box {
  379. position: relative;
  380. display: block;
  381. width: 100%;
  382. height: 100%;
  383. overflow: visible;
  384. outline: 1rpx solid #69f;
  385. outline-color: rgba(102, 153, 255, .75)
  386. }
  387. /* 横向虚线 */
  388. .uni-cropper-dashed-h {
  389. position: absolute;
  390. top: 33.33333333%;
  391. left: 0;
  392. width: 100%;
  393. height: 33.33333333%;
  394. border-top: 1rpx dashed rgba(255, 255, 255, 0.5);
  395. border-bottom: 1rpx dashed rgba(255, 255, 255, 0.5);
  396. }
  397. /* 纵向虚线 */
  398. .uni-cropper-dashed-v {
  399. position: absolute;
  400. left: 33.33333333%;
  401. top: 0;
  402. width: 33.33333333%;
  403. height: 100%;
  404. border-left: 1rpx dashed rgba(255, 255, 255, 0.5);
  405. border-right: 1rpx dashed rgba(255, 255, 255, 0.5);
  406. }
  407. /* 四个方向的线 为了之后的拖动事件*/
  408. .uni-cropper-line-t {
  409. position: absolute;
  410. display: block;
  411. width: 100%;
  412. background-color: #69f;
  413. top: 0;
  414. left: 0;
  415. height: 1rpx;
  416. opacity: 0.1;
  417. cursor: n-resize;
  418. }
  419. .uni-cropper-line-t::before {
  420. content: '';
  421. position: absolute;
  422. top: 50%;
  423. right: 0rpx;
  424. width: 100%;
  425. -webkit-transform: translate3d(0, -50%, 0);
  426. transform: translate3d(0, -50%, 0);
  427. bottom: 0;
  428. height: 41rpx;
  429. background: transparent;
  430. z-index: 11;
  431. }
  432. .uni-cropper-line-r {
  433. position: absolute;
  434. display: block;
  435. background-color: #69f;
  436. top: 0;
  437. right: 0rpx;
  438. width: 1rpx;
  439. opacity: 0.1;
  440. height: 100%;
  441. cursor: e-resize;
  442. }
  443. .uni-cropper-line-r::before {
  444. content: '';
  445. position: absolute;
  446. top: 0;
  447. left: 50%;
  448. width: 41rpx;
  449. -webkit-transform: translate3d(-50%, 0, 0);
  450. transform: translate3d(-50%, 0, 0);
  451. bottom: 0;
  452. height: 100%;
  453. background: transparent;
  454. z-index: 11;
  455. }
  456. .uni-cropper-line-b {
  457. position: absolute;
  458. display: block;
  459. width: 100%;
  460. background-color: #69f;
  461. bottom: 0;
  462. left: 0;
  463. height: 1rpx;
  464. opacity: 0.1;
  465. cursor: s-resize;
  466. }
  467. .uni-cropper-line-b::before {
  468. content: '';
  469. position: absolute;
  470. top: 50%;
  471. right: 0rpx;
  472. width: 100%;
  473. -webkit-transform: translate3d(0, -50%, 0);
  474. transform: translate3d(0, -50%, 0);
  475. bottom: 0;
  476. height: 41rpx;
  477. background: transparent;
  478. z-index: 11;
  479. }
  480. .uni-cropper-line-l {
  481. position: absolute;
  482. display: block;
  483. background-color: #69f;
  484. top: 0;
  485. left: 0;
  486. width: 1rpx;
  487. opacity: 0.1;
  488. height: 100%;
  489. cursor: w-resize;
  490. }
  491. .uni-cropper-line-l::before {
  492. content: '';
  493. position: absolute;
  494. top: 0;
  495. left: 50%;
  496. width: 41rpx;
  497. -webkit-transform: translate3d(-50%, 0, 0);
  498. transform: translate3d(-50%, 0, 0);
  499. bottom: 0;
  500. height: 100%;
  501. background: transparent;
  502. z-index: 11;
  503. }
  504. .uni-cropper-point {
  505. width: 5rpx;
  506. height: 5rpx;
  507. background-color: #69f;
  508. opacity: .75;
  509. position: absolute;
  510. z-index: 3;
  511. }
  512. .point-t {
  513. top: -3rpx;
  514. left: 50%;
  515. margin-left: -3rpx;
  516. cursor: n-resize;
  517. }
  518. .point-tr {
  519. top: -3rpx;
  520. left: 100%;
  521. margin-left: -3rpx;
  522. cursor: n-resize;
  523. }
  524. .point-r {
  525. top: 50%;
  526. left: 100%;
  527. margin-left: -3rpx;
  528. margin-top: -3rpx;
  529. cursor: n-resize;
  530. }
  531. .point-rb {
  532. left: 100%;
  533. top: 100%;
  534. -webkit-transform: translate3d(-50%, -50%, 0);
  535. transform: translate3d(-50%, -50%, 0);
  536. cursor: n-resize;
  537. width: 36rpx;
  538. height: 36rpx;
  539. background-color: #69f;
  540. position: absolute;
  541. z-index: 1112;
  542. opacity: 1;
  543. }
  544. .point-b {
  545. left: 50%;
  546. top: 100%;
  547. margin-left: -3rpx;
  548. margin-top: -3rpx;
  549. cursor: n-resize;
  550. }
  551. .point-bl {
  552. left: 0%;
  553. top: 100%;
  554. margin-left: -3rpx;
  555. margin-top: -3rpx;
  556. cursor: n-resize;
  557. }
  558. .point-l {
  559. left: 0%;
  560. top: 50%;
  561. margin-left: -3rpx;
  562. margin-top: -3rpx;
  563. cursor: n-resize;
  564. }
  565. .point-lt {
  566. left: 0%;
  567. top: 0%;
  568. margin-left: -3rpx;
  569. margin-top: -3rpx;
  570. cursor: n-resize;
  571. }
  572. /* 裁剪框预览内容 */
  573. .uni-cropper-viewer {
  574. position: relative;
  575. width: 100%;
  576. height: 100%;
  577. overflow: hidden;
  578. }
  579. .uni-cropper-viewer image {
  580. position: absolute;
  581. z-index: 2;
  582. }
  583. </style>