invitation.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="container">
  3. <!-- 二维码区域 -->
  4. <view class="box">
  5. <view class="box_top">
  6. <view class="top_text">尊敬的家长:您好!{{ currentClass }}现诚邀您扫描下方二维码,填写相关信息加入班级,感谢您的配合,让我们携手为孩子的成长保驾护航!</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">填写相关信息</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 { onLoad, onShareAppMessage } from '@dcloudio/uni-app'
  30. import { ref } from 'vue'
  31. const gradeId = ref('')
  32. const classId = ref('')
  33. const departmentId = ref('')
  34. const departmentId_list = ref('')
  35. const currentClass = ref('')
  36. onLoad(() => {
  37. gradeId.value = uni.getStorageSync('grade_student')
  38. classId.value = uni.getStorageSync('classes_student')
  39. departmentId.value = uni.getStorageSync('departmentId')
  40. departmentId_list.value = uni.getStorageSync('departmentId_list')
  41. currentClass.value = uni.getStorageSync('currentClass')
  42. QRCodeUrl.value = `https://chtech.ncjti.edu.cn/testingServer/repairManage/pages/register/register?gradeId=${gradeId.value}&classId=${classId.value}&departmentId=${departmentId.value}&departmentId_list=${departmentId_list.value}&currentClass=${currentClass.value}`
  43. })
  44. onShareAppMessage(() => {
  45. return {
  46. title: '邀请家长',
  47. path: `/pages/register/register?gradeId=${gradeId.value}&classId=${classId.value}&departmentId=${departmentId.value}&departmentId_list=${departmentId_list.value}&currentClass=${currentClass.value}`
  48. }
  49. })
  50. // 二维码元素引用标记
  51. const qrcodeRef = ref(null)
  52. // 二维码信息
  53. const QRCodeUrl = ref('')
  54. // 保存图片按钮回调
  55. const handleSave = () => {
  56. qrcodeRef.value.save({
  57. success: (res) => {
  58. uni.showToast({
  59. title: '保存成功',
  60. icon: 'success'
  61. })
  62. },
  63. fail: (err) => {
  64. console.log(err)
  65. uni.showToast({
  66. title: '保存失败',
  67. icon: 'none'
  68. })
  69. }
  70. })
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .container {
  75. box-sizing: border-box;
  76. padding: 38rpx 0;
  77. min-height: 100vh;
  78. background: linear-gradient(180deg, rgba(242, 247, 255, 1) 0%, rgba(242, 247, 255, 0) 100%);
  79. .box {
  80. margin: auto;
  81. width: 670rpx;
  82. height: 910rpx;
  83. .box_top {
  84. display: flex;
  85. flex-direction: column;
  86. justify-content: space-between;
  87. align-items: center;
  88. box-sizing: border-box;
  89. padding: 45rpx 50rpx;
  90. height: 795rpx;
  91. border-radius: 18rpx 18rpx 0 0;
  92. background-color: #0061ff;
  93. .top_text {
  94. font-size: 28rpx;
  95. line-height: 40rpx;
  96. color: #fff;
  97. }
  98. .top_qrcode {
  99. display: flex;
  100. flex-direction: column;
  101. justify-content: space-evenly;
  102. align-items: center;
  103. width: 456rpx;
  104. height: 506rpx;
  105. background-color: #fff;
  106. border-radius: 0 30rpx 0 30rpx;
  107. .qrcode_box {
  108. width: 350rpx;
  109. height: 350rpx;
  110. }
  111. .qrcode_info {
  112. display: flex;
  113. align-items: center;
  114. font-size: 28rpx;
  115. .info_img {
  116. margin-right: 18rpx;
  117. width: 40rpx;
  118. height: 40rpx;
  119. }
  120. }
  121. }
  122. }
  123. .box_bottom {
  124. display: flex;
  125. justify-content: center;
  126. align-items: center;
  127. height: 115rpx;
  128. font-size: 38rpx;
  129. font-weight: bold;
  130. border-radius: 0 0 18rpx 18rpx;
  131. border: 2rpx solid #0061ff;
  132. background-color: #fff;
  133. }
  134. }
  135. .btns {
  136. display: flex;
  137. justify-content: center;
  138. margin-top: 90rpx;
  139. .btn {
  140. display: flex;
  141. justify-content: center;
  142. align-items: center;
  143. width: 300rpx;
  144. height: 100rpx;
  145. font-size: 32rpx;
  146. border-radius: 8rpx;
  147. }
  148. .save {
  149. color: #fff;
  150. background-color: #0061ff;
  151. }
  152. .send {
  153. margin-left: 20rpx;
  154. color: #0061ff;
  155. border: 2rpx solid #0061ff;
  156. }
  157. .share {
  158. position: absolute;
  159. width: 300rpx;
  160. height: 100rpx;
  161. border-radius: 8rpx;
  162. opacity: 0;
  163. }
  164. }
  165. }
  166. </style>