index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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?config.baseUrl+store.getters.avatar:require('@/static/images/profile.jpg'),
  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. console.log(res)
  245. let data = {name: 'avatarfile', filePath: res.tempFilePath}
  246. uploadAvatar(data).then(response => {
  247. // store.commit('SET_AVATAR', baseUrl + response.imgUrl)
  248. store.commit('SET_AVATAR', response.imgUrl)
  249. uni.showToast({ title: "修改成功", icon: 'success' })
  250. uni.navigateBack()
  251. })
  252. }
  253. })
  254. })
  255. },
  256. // 设置大小的时候触发的touchStart事件
  257. dragStart(e) {
  258. T_PAGE_X = e.touches[0].pageX
  259. T_PAGE_Y = e.touches[0].pageY
  260. CUT_L = this.cutL
  261. CUT_R = this.cutR
  262. CUT_B = this.cutB
  263. CUT_T = this.cutT
  264. },
  265. // 设置大小的时候触发的touchMove事件
  266. dragMove(e) {
  267. var _this = this
  268. var dragType = e.target.dataset.drag
  269. switch (dragType) {
  270. case 'right':
  271. var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  272. if (CUT_R + dragLength < 0) dragLength = -CUT_R
  273. this.setData({
  274. cutR: CUT_R + dragLength
  275. })
  276. break
  277. case 'left':
  278. var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  279. if (CUT_L - dragLength < 0) dragLength = CUT_L
  280. if ((CUT_L - dragLength) > (this.cropperW - this.cutR)) dragLength = CUT_L - (this.cropperW - this.cutR)
  281. this.setData({
  282. cutL: CUT_L - dragLength
  283. })
  284. break
  285. case 'top':
  286. var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  287. if (CUT_T - dragLength < 0) dragLength = CUT_T
  288. if ((CUT_T - dragLength) > (this.cropperH - this.cutB)) dragLength = CUT_T - (this.cropperH - this.cutB)
  289. this.setData({
  290. cutT: CUT_T - dragLength
  291. })
  292. break
  293. case 'bottom':
  294. var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  295. if (CUT_B + dragLength < 0) dragLength = -CUT_B
  296. this.setData({
  297. cutB: CUT_B + dragLength
  298. })
  299. break
  300. case 'rightBottom':
  301. var dragLengthX = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
  302. var dragLengthY = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
  303. if (CUT_B + dragLengthY < 0) dragLengthY = -CUT_B
  304. if (CUT_R + dragLengthX < 0) dragLengthX = -CUT_R
  305. let cutB = CUT_B + dragLengthY
  306. let cutR = CUT_R + dragLengthX
  307. this.setData({
  308. cutB: cutB,
  309. cutR: cutR
  310. })
  311. break
  312. default:
  313. break
  314. }
  315. }
  316. }
  317. }
  318. </script>
  319. <style>
  320. /* pages/uni-cropper/index.wxss */
  321. .uni-content-info {
  322. /* position: fixed;
  323. top: 0;
  324. left: 0;
  325. right: 0;
  326. bottom: 0;
  327. display: block;
  328. align-items: center;
  329. flex-direction: column; */
  330. }
  331. .cropper-config {
  332. padding: 20rpx 40rpx;
  333. }
  334. .cropper-content {
  335. min-height: 750rpx;
  336. width: 100%;
  337. }
  338. .uni-corpper {
  339. position: relative;
  340. overflow: hidden;
  341. -webkit-user-select: none;
  342. -moz-user-select: none;
  343. -ms-user-select: none;
  344. user-select: none;
  345. -webkit-tap-highlight-color: transparent;
  346. -webkit-touch-callout: none;
  347. box-sizing: border-box;
  348. }
  349. .uni-corpper-content {
  350. position: relative;
  351. }
  352. .uni-corpper-content image {
  353. display: block;
  354. width: 100%;
  355. min-width: 0 !important;
  356. max-width: none !important;
  357. height: 100%;
  358. min-height: 0 !important;
  359. max-height: none !important;
  360. image-orientation: 0deg !important;
  361. margin: 0 auto;
  362. }
  363. /* 移动图片效果 */
  364. .uni-cropper-drag-box {
  365. position: absolute;
  366. top: 0;
  367. right: 0;
  368. bottom: 0;
  369. left: 0;
  370. cursor: move;
  371. background: rgba(0, 0, 0, 0.6);
  372. z-index: 1;
  373. }
  374. /* 内部的信息 */
  375. .uni-corpper-crop-box {
  376. position: absolute;
  377. background: rgba(255, 255, 255, 0.3);
  378. z-index: 2;
  379. }
  380. .uni-corpper-crop-box .uni-cropper-view-box {
  381. position: relative;
  382. display: block;
  383. width: 100%;
  384. height: 100%;
  385. overflow: visible;
  386. outline: 1rpx solid #69f;
  387. outline-color: rgba(102, 153, 255, .75)
  388. }
  389. /* 横向虚线 */
  390. .uni-cropper-dashed-h {
  391. position: absolute;
  392. top: 33.33333333%;
  393. left: 0;
  394. width: 100%;
  395. height: 33.33333333%;
  396. border-top: 1rpx dashed rgba(255, 255, 255, 0.5);
  397. border-bottom: 1rpx dashed rgba(255, 255, 255, 0.5);
  398. }
  399. /* 纵向虚线 */
  400. .uni-cropper-dashed-v {
  401. position: absolute;
  402. left: 33.33333333%;
  403. top: 0;
  404. width: 33.33333333%;
  405. height: 100%;
  406. border-left: 1rpx dashed rgba(255, 255, 255, 0.5);
  407. border-right: 1rpx dashed rgba(255, 255, 255, 0.5);
  408. }
  409. /* 四个方向的线 为了之后的拖动事件*/
  410. .uni-cropper-line-t {
  411. position: absolute;
  412. display: block;
  413. width: 100%;
  414. background-color: #69f;
  415. top: 0;
  416. left: 0;
  417. height: 1rpx;
  418. opacity: 0.1;
  419. cursor: n-resize;
  420. }
  421. .uni-cropper-line-t::before {
  422. content: '';
  423. position: absolute;
  424. top: 50%;
  425. right: 0rpx;
  426. width: 100%;
  427. -webkit-transform: translate3d(0, -50%, 0);
  428. transform: translate3d(0, -50%, 0);
  429. bottom: 0;
  430. height: 41rpx;
  431. background: transparent;
  432. z-index: 11;
  433. }
  434. .uni-cropper-line-r {
  435. position: absolute;
  436. display: block;
  437. background-color: #69f;
  438. top: 0;
  439. right: 0rpx;
  440. width: 1rpx;
  441. opacity: 0.1;
  442. height: 100%;
  443. cursor: e-resize;
  444. }
  445. .uni-cropper-line-r::before {
  446. content: '';
  447. position: absolute;
  448. top: 0;
  449. left: 50%;
  450. width: 41rpx;
  451. -webkit-transform: translate3d(-50%, 0, 0);
  452. transform: translate3d(-50%, 0, 0);
  453. bottom: 0;
  454. height: 100%;
  455. background: transparent;
  456. z-index: 11;
  457. }
  458. .uni-cropper-line-b {
  459. position: absolute;
  460. display: block;
  461. width: 100%;
  462. background-color: #69f;
  463. bottom: 0;
  464. left: 0;
  465. height: 1rpx;
  466. opacity: 0.1;
  467. cursor: s-resize;
  468. }
  469. .uni-cropper-line-b::before {
  470. content: '';
  471. position: absolute;
  472. top: 50%;
  473. right: 0rpx;
  474. width: 100%;
  475. -webkit-transform: translate3d(0, -50%, 0);
  476. transform: translate3d(0, -50%, 0);
  477. bottom: 0;
  478. height: 41rpx;
  479. background: transparent;
  480. z-index: 11;
  481. }
  482. .uni-cropper-line-l {
  483. position: absolute;
  484. display: block;
  485. background-color: #69f;
  486. top: 0;
  487. left: 0;
  488. width: 1rpx;
  489. opacity: 0.1;
  490. height: 100%;
  491. cursor: w-resize;
  492. }
  493. .uni-cropper-line-l::before {
  494. content: '';
  495. position: absolute;
  496. top: 0;
  497. left: 50%;
  498. width: 41rpx;
  499. -webkit-transform: translate3d(-50%, 0, 0);
  500. transform: translate3d(-50%, 0, 0);
  501. bottom: 0;
  502. height: 100%;
  503. background: transparent;
  504. z-index: 11;
  505. }
  506. .uni-cropper-point {
  507. width: 5rpx;
  508. height: 5rpx;
  509. background-color: #69f;
  510. opacity: .75;
  511. position: absolute;
  512. z-index: 3;
  513. }
  514. .point-t {
  515. top: -3rpx;
  516. left: 50%;
  517. margin-left: -3rpx;
  518. cursor: n-resize;
  519. }
  520. .point-tr {
  521. top: -3rpx;
  522. left: 100%;
  523. margin-left: -3rpx;
  524. cursor: n-resize;
  525. }
  526. .point-r {
  527. top: 50%;
  528. left: 100%;
  529. margin-left: -3rpx;
  530. margin-top: -3rpx;
  531. cursor: n-resize;
  532. }
  533. .point-rb {
  534. left: 100%;
  535. top: 100%;
  536. -webkit-transform: translate3d(-50%, -50%, 0);
  537. transform: translate3d(-50%, -50%, 0);
  538. cursor: n-resize;
  539. width: 36rpx;
  540. height: 36rpx;
  541. background-color: #69f;
  542. position: absolute;
  543. z-index: 1112;
  544. opacity: 1;
  545. }
  546. .point-b {
  547. left: 50%;
  548. top: 100%;
  549. margin-left: -3rpx;
  550. margin-top: -3rpx;
  551. cursor: n-resize;
  552. }
  553. .point-bl {
  554. left: 0%;
  555. top: 100%;
  556. margin-left: -3rpx;
  557. margin-top: -3rpx;
  558. cursor: n-resize;
  559. }
  560. .point-l {
  561. left: 0%;
  562. top: 50%;
  563. margin-left: -3rpx;
  564. margin-top: -3rpx;
  565. cursor: n-resize;
  566. }
  567. .point-lt {
  568. left: 0%;
  569. top: 0%;
  570. margin-left: -3rpx;
  571. margin-top: -3rpx;
  572. cursor: n-resize;
  573. }
  574. /* 裁剪框预览内容 */
  575. .uni-cropper-viewer {
  576. position: relative;
  577. width: 100%;
  578. height: 100%;
  579. overflow: hidden;
  580. }
  581. .uni-cropper-viewer image {
  582. position: absolute;
  583. z-index: 2;
  584. }
  585. </style>