index.vue 16 KB

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