dialogPanel.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <uni-popup ref="main" type="center">
  3. <view class="pop">
  4. <view class="title"><text>识别下方二维码即可购买</text></view>
  5. <view style="margin-left:30rpx;width: 580rpx;height: 2rpx;background: #F0F0F0;"></view>
  6. <view class="img">
  7. <image :src="imgUrl" mode="aspectFit"/>
  8. </view>
  9. <view class="btn">
  10. <view class="cancel" @click="$refs.main.close()"><text>取消</text></view>
  11. <view style="width: 2rpx;height: 100%;background: rgba(0,0,0,0.1);"></view>
  12. <view class="download" @click="saveImg"><text>保存图片</text></view>
  13. </view>
  14. </view>
  15. </uni-popup>
  16. </template>
  17. <script>
  18. export default{
  19. name: "dialog-panel",
  20. data(){
  21. return {
  22. imgUrl:""
  23. }
  24. },
  25. methods:{
  26. show(arg){
  27. this.imgUrl = arg
  28. this.$refs.main.open()
  29. },
  30. saveImg(){
  31. uni.getImageInfo({
  32. src: this.imgUrl,
  33. success:(res)=>{
  34. uni.saveImageToPhotosAlbum({
  35. filePath: res.path,
  36. success(_) {
  37. uni.showToast({
  38. title: '已保存到相册',
  39. icon: 'success',
  40. duration: 2000
  41. })
  42. },
  43. fail(err){
  44. console.log(err)
  45. }
  46. })
  47. }
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. $pageColor:#F9F9F9;
  55. $bgColor:#FFFFFF;
  56. @mixin flexlayout {
  57. display: flex;
  58. align-items: center;
  59. justify-content: center;
  60. }
  61. .pop {
  62. width: 640rpx;
  63. height: 740rpx;
  64. background: #FFFFFF;
  65. border-radius: 20rpx;
  66. padding-top: 32rpx;
  67. box-sizing: border-box;
  68. .title {
  69. @include flexlayout();
  70. margin-bottom: 32rpx;
  71. text {
  72. font-size: 34rpx;
  73. font-family: PingFangSC-Medium, PingFang SC;
  74. font-weight: 500;
  75. color: #000;
  76. }
  77. }
  78. .img {
  79. margin-left: 48rpx;
  80. width: 544rpx;
  81. height: 484rpx;
  82. background: $bgColor;
  83. border-radius: 12rpx;
  84. @include flexlayout();
  85. margin-bottom: 32rpx;
  86. image {
  87. width: 420rpx;
  88. height: 440rpx;
  89. border-radius: 12rpx;
  90. }
  91. }
  92. .textfont {
  93. margin-left: 30rpx;
  94. margin-bottom: 40rpx;
  95. @include flexlayout();
  96. width: 572rpx;
  97. height: 106rpx;
  98. text {
  99. text-align: center;
  100. font-size: 34rpx;
  101. font-weight: 400;
  102. color: #828282;
  103. }
  104. }
  105. .btn {
  106. width: 100%;
  107. height: 114rpx;
  108. display: flex;
  109. align-items: center;
  110. .cancel {
  111. @include flexlayout();
  112. width: 50%;
  113. height: 100%;
  114. border-top: #E5E5E5 solid 1rpx;
  115. // border-right: #E5E5E5 solid 1rpx;
  116. text {
  117. font-size: 32rpx;
  118. font-family: PingFangSC-Medium, PingFang SC;
  119. font-weight: 500;
  120. color: #666666;
  121. }
  122. }
  123. .download {
  124. border-top: #E5E5E5 solid 1rpx;
  125. // border-left:#E5E5E5 solid 0.3rpx;
  126. @include flexlayout();
  127. height: 100%;
  128. width: 50%;
  129. text {
  130. font-size: 32rpx;
  131. font-family: PingFangSC-Medium, PingFang SC;
  132. font-weight: 500;
  133. color: #FF7119;
  134. }
  135. }
  136. }
  137. }
  138. </style>