read.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="container" v-if="info">
  3. <view class="img_bg"></view>
  4. <image class="img_logo" src="/static/13.png" mode="aspectFill"></image>
  5. <image class="img_right" src="/static/14.png" mode="aspectFill"></image>
  6. <view class="name">{{ info.name }}同学</view>
  7. <view class="welcome">南昌交通学院欢迎您!</view>
  8. <!-- 内容区域 -->
  9. <scroll-view class="body" scroll-y>
  10. <uv-parse :content="safetyNotice"></uv-parse>
  11. <view class="check">
  12. <checkbox :checked="isCheck" @click="handleCheck" />
  13. 我已阅读并理解以上安全须知
  14. </view>
  15. </scroll-view>
  16. <!-- 下一步按钮区域 -->
  17. <view class="btn" :class="{ active: isCheck }" @click="handleNext">下一步</view>
  18. <view class="btn margin" @click="logout">退出登录</view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import { onLoad } from '@dcloudio/uni-app'
  23. import { ref } from 'vue'
  24. import { getInfoByTokenReq, getSettingsInfoReq } from '@/api/index.js'
  25. // 是否勾选安全须知
  26. const isCheck = ref(false)
  27. // 安全须知内容
  28. const safetyNotice = ref()
  29. // 学生信息
  30. const info = ref()
  31. onLoad(() => {
  32. // 获取用户信息
  33. getInfoByToken()
  34. // 获取设置数据
  35. getSettingsInfo()
  36. })
  37. // 获取用户信息
  38. const getInfoByToken = async () => {
  39. const res = await getInfoByTokenReq()
  40. // console.log(res)
  41. if (res.code == 200) {
  42. uni.setStorageSync('studentInfo', res.data)
  43. info.value = res.data
  44. }
  45. }
  46. // 获取设置数据
  47. const getSettingsInfo = async () => {
  48. const res = await getSettingsInfoReq()
  49. // console.log(res)
  50. if (res.code == 200) {
  51. safetyNotice.value = res.data.safetyNotice
  52. }
  53. }
  54. // 勾选框切换回调
  55. const handleCheck = () => {
  56. isCheck.value = !isCheck.value
  57. }
  58. // 点击下一步按钮回调
  59. const handleNext = () => {
  60. if (isCheck.value) {
  61. uni.navigateTo({
  62. url: '/pages/info/info'
  63. })
  64. } else {
  65. uni.showToast({
  66. title: '请先阅读并勾选安全须知',
  67. icon: 'none',
  68. mask: true
  69. })
  70. }
  71. }
  72. // 退出登录回调
  73. const logout = () => {
  74. uni.showModal({
  75. title: '提示',
  76. content: '确定退出登录吗?',
  77. success: (res) => {
  78. if (res.confirm) {
  79. let urlstr = uni.getStorageSync('urlstr')
  80. uni.clearStorageSync()
  81. window.location.href = `https://chtech.ncjti.edu.cn/welcome/welcomeH5/#/?urlstr=${urlstr}`
  82. }
  83. }
  84. })
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .container {
  89. padding-bottom: 50rpx;
  90. box-sizing: border-box;
  91. width: 100%;
  92. overflow: hidden;
  93. .img_bg {
  94. width: 100%;
  95. height: 1110rpx;
  96. background-image: url(@/static/12.png);
  97. background-size: cover;
  98. }
  99. .img_logo {
  100. position: absolute;
  101. top: 29rpx;
  102. left: 35rpx;
  103. width: 309rpx;
  104. height: 84rpx;
  105. }
  106. .img_right {
  107. position: absolute;
  108. top: -90rpx;
  109. right: -120rpx;
  110. width: 408rpx;
  111. height: 408rpx;
  112. }
  113. .name {
  114. position: absolute;
  115. top: 180rpx;
  116. width: 100%;
  117. font-size: 70rpx;
  118. font-weight: bold;
  119. color: #0061ff;
  120. text-align: center;
  121. }
  122. .welcome {
  123. position: absolute;
  124. top: 289rpx;
  125. width: 100%;
  126. font-size: 70rpx;
  127. font-weight: bold;
  128. color: #0061ff;
  129. text-align: center;
  130. }
  131. .body {
  132. position: absolute;
  133. top: 829rpx;
  134. left: 20rpx;
  135. box-sizing: border-box;
  136. padding: 20rpx;
  137. width: 711rpx;
  138. height: 356rpx;
  139. border: 2rpx solid #808080;
  140. overflow-y: auto;
  141. .check {
  142. margin: 32rpx auto 0;
  143. font-size: 28rpx;
  144. }
  145. }
  146. .btn {
  147. display: flex;
  148. justify-content: center;
  149. align-items: center;
  150. margin: 125rpx auto 0;
  151. width: 711rpx;
  152. height: 100rpx;
  153. color: #fff;
  154. border-radius: 8rpx;
  155. background-color: #ccc;
  156. }
  157. .active {
  158. background-color: #0061ff;
  159. }
  160. .margin {
  161. margin-top: 35rpx;
  162. background-color: #0061ff;
  163. }
  164. }
  165. </style>