invitation.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="container">
  3. <!-- 二维码区域 -->
  4. <view class="box">
  5. <view class="box_top">
  6. <view class="top_text">尊敬的家长:您好!七年级一班现诚邀您扫描下方二维码,填写相关信息加入班级,感谢您的配合,让我们携手为孩子的成长保驾护航!</view>
  7. <view class="top_qrcode">
  8. <view class="qrcode_box">
  9. <uv-qrcode ref="qrcodeRef" size="350rpx" :value="QRCodeUrl"></uv-qrcode>
  10. </view>
  11. <view class="qrcode_info">
  12. <image class="info_img" src="/static/images/school-logo.jpg" mode=""></image>
  13. 万载三中
  14. </view>
  15. </view>
  16. </view>
  17. <view class="box_bottom" @click="test">填写相关信息</view>
  18. </view>
  19. <view class="btns">
  20. <view class="btn save" @click="handleSave">保存图片</view>
  21. <view class="btn send">
  22. 发送到微信
  23. <button class="share" open-type="share">发送到微信</button>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script setup>
  29. import { onShareAppMessage } from '@dcloudio/uni-app'
  30. import { ref } from 'vue'
  31. onShareAppMessage(() => {
  32. if (res.from === 'button') {
  33. // 来自页面内分享按钮
  34. console.log(res.target)
  35. }
  36. return {
  37. title: '自定义分享标题',
  38. path: '/pages/test/test?id=123'
  39. }
  40. })
  41. // 二维码元素引用标记
  42. const qrcodeRef = ref(null)
  43. // 二维码信息
  44. const QRCodeUrl = ref('https://chtech.ncjti.edu.cn/testingServer/repairManage/')
  45. // 保存图片按钮回调
  46. const handleSave = () => {
  47. qrcodeRef.value.save({
  48. success: (res) => {
  49. console.log(res)
  50. // uni.getImageInfo({
  51. // url: res.tempFilePath,
  52. // success: (res) => {
  53. // console.log(res)
  54. // uni.saveImageToPhotosAlbum({
  55. // filePath: res.tempFilePath,
  56. // success: function () {
  57. // console.log('save success')
  58. // }
  59. // })
  60. // }
  61. // })
  62. },
  63. fail: (err) => {
  64. console.log(err)
  65. }
  66. })
  67. }
  68. const test = () => {
  69. uni.navigateTo({
  70. url: '/pages/register/register'
  71. })
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .container {
  76. box-sizing: border-box;
  77. padding: 38rpx 0;
  78. min-height: 100vh;
  79. background: linear-gradient(180deg, rgba(242, 247, 255, 1) 0%, rgba(242, 247, 255, 0) 100%);
  80. .box {
  81. margin: auto;
  82. width: 670rpx;
  83. height: 910rpx;
  84. .box_top {
  85. display: flex;
  86. flex-direction: column;
  87. justify-content: space-between;
  88. align-items: center;
  89. box-sizing: border-box;
  90. padding: 45rpx 50rpx;
  91. height: 795rpx;
  92. border-radius: 18rpx 18rpx 0 0;
  93. background-color: #0061ff;
  94. .top_text {
  95. font-size: 28rpx;
  96. line-height: 40rpx;
  97. color: #fff;
  98. }
  99. .top_qrcode {
  100. display: flex;
  101. flex-direction: column;
  102. justify-content: space-evenly;
  103. align-items: center;
  104. width: 456rpx;
  105. height: 506rpx;
  106. background-color: #fff;
  107. border-radius: 0 30rpx 0 30rpx;
  108. .qrcode_box {
  109. width: 350rpx;
  110. height: 350rpx;
  111. }
  112. .qrcode_info {
  113. display: flex;
  114. align-items: center;
  115. font-size: 28rpx;
  116. .info_img {
  117. margin-right: 18rpx;
  118. width: 40rpx;
  119. height: 40rpx;
  120. }
  121. }
  122. }
  123. }
  124. .box_bottom {
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. height: 115rpx;
  129. font-size: 38rpx;
  130. font-weight: bold;
  131. border-radius: 0 0 18rpx 18rpx;
  132. border: 2rpx solid #0061ff;
  133. background-color: #fff;
  134. }
  135. }
  136. .btns {
  137. display: flex;
  138. justify-content: center;
  139. margin-top: 90rpx;
  140. .btn {
  141. display: flex;
  142. justify-content: center;
  143. align-items: center;
  144. width: 300rpx;
  145. height: 100rpx;
  146. font-size: 32rpx;
  147. border-radius: 8rpx;
  148. }
  149. .save {
  150. color: #fff;
  151. background-color: #0061ff;
  152. }
  153. .send {
  154. margin-left: 20rpx;
  155. color: #0061ff;
  156. border: 2rpx solid #0061ff;
  157. }
  158. .share {
  159. position: absolute;
  160. width: 300rpx;
  161. height: 100rpx;
  162. border-radius: 8rpx;
  163. opacity: 0;
  164. }
  165. }
  166. }
  167. </style>