index.vue 17 KB

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