SsDisclaimer.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <!-- 透明遮罩层,点击后弹出免责声明 -->
  3. <view v-if="showOverlay" class="disclaimer-overlay" @tap="handleOverlayTap"></view>
  4. <!-- 免责声明弹窗 -->
  5. <view v-if="visible" class="disclaimer-modal">
  6. <view class="disclaimer-mask"></view>
  7. <view class="disclaimer-content">
  8. <view class="disclaimer-title">免责声明</view>
  9. <scroll-view class="disclaimer-body" scroll-y :show-scrollbar="false">
  10. <view class="disclaimer-text">
  11. <view class="disclaimer-item">1、四川商务智能体(商小川)运行期间,若回答与事实有所出入,最终解释权归四川省商务厅(以下简称商务厅)所有。智能体回复内容不代表商务厅官方立场,任何截屏、转发不具备法律效力,商务厅不对此承担任何责任。</view>
  12. <view class="disclaimer-item">2、当智能体以链接形式推荐其他网站内容时,任何因使用从此类网站或资源上获取的内容、服务而造成的任何损失,商务厅网站不对此承担任何责任。</view>
  13. <view class="disclaimer-item">3、用户上传、发表、转载于智能体上的信息仅代表用户或作者个人观点,若侵犯了第三方的知识产权或其他合法权利,责任由用户本人承担,商务厅不对此承担任何责任。</view>
  14. </view>
  15. </scroll-view>
  16. <view class="disclaimer-footer">
  17. <button class="btn-cancel" @tap="handleCancel">不同意</button>
  18. <button class="btn-confirm" @tap="handleConfirm">同意并继续</button>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. const DISCLAIMER_KEY = 'ss_disclaimer_accepted'
  25. export default {
  26. name: 'SsDisclaimer',
  27. data() {
  28. return {
  29. visible: false,
  30. showOverlay: false,
  31. hasAccepted: false
  32. }
  33. },
  34. mounted() {
  35. this.checkAccepted()
  36. },
  37. methods: {
  38. checkAccepted() {
  39. const accepted = uni.getStorageSync(DISCLAIMER_KEY)
  40. if (accepted === 'true') {
  41. this.hasAccepted = true
  42. this.showOverlay = false
  43. } else {
  44. this.showOverlay = true
  45. }
  46. },
  47. handleOverlayTap() {
  48. this.visible = true
  49. },
  50. handleConfirm() {
  51. uni.setStorageSync(DISCLAIMER_KEY, 'true')
  52. this.hasAccepted = true
  53. this.showOverlay = false
  54. this.visible = false
  55. },
  56. handleCancel() {
  57. // 小程序无法直接跳转外部链接,显示提示并关闭小程序
  58. uni.showModal({
  59. title: '提示',
  60. content: '您需要同意免责声明才能使用本服务,点击确定将退出小程序',
  61. showCancel: false,
  62. success: () => {
  63. // 退出小程序
  64. uni.exitMiniProgram({
  65. fail: () => {
  66. // 如果退出失败,返回上一页或关闭当前页面
  67. uni.navigateBack({
  68. fail: () => {
  69. // 都失败则重新显示弹窗
  70. this.visible = true
  71. }
  72. })
  73. }
  74. })
  75. }
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. .disclaimer-overlay {
  83. position: fixed;
  84. top: 0;
  85. left: 0;
  86. right: 0;
  87. bottom: 0;
  88. z-index: 9998;
  89. background: transparent;
  90. }
  91. .disclaimer-modal {
  92. position: fixed;
  93. top: 0;
  94. left: 0;
  95. right: 0;
  96. bottom: 0;
  97. z-index: 9999;
  98. display: flex;
  99. align-items: center;
  100. justify-content: center;
  101. .disclaimer-mask {
  102. position: absolute;
  103. top: 0;
  104. left: 0;
  105. right: 0;
  106. bottom: 0;
  107. background: rgba(0, 0, 0, 0.5);
  108. }
  109. .disclaimer-content {
  110. position: relative;
  111. width: 600rpx;
  112. max-height: 80vh;
  113. margin: 0 auto;
  114. background: #ffffff;
  115. border-radius: 24rpx;
  116. overflow: hidden;
  117. box-sizing: border-box;
  118. display: flex;
  119. flex-direction: column;
  120. .disclaimer-title {
  121. flex-shrink: 0;
  122. padding: 32rpx;
  123. text-align: center;
  124. font-size: 36rpx;
  125. font-weight: bold;
  126. color: #333;
  127. border-bottom: 1rpx solid #eee;
  128. box-sizing: border-box;
  129. }
  130. .disclaimer-body {
  131. flex: 1;
  132. min-height: 0;
  133. height: 500rpx;
  134. box-sizing: border-box;
  135. overflow: hidden;
  136. .disclaimer-text {
  137. padding: 32rpx;
  138. .disclaimer-item {
  139. font-size: 28rpx;
  140. color: #333;
  141. line-height: 1.8;
  142. margin-bottom: 24rpx;
  143. text-align: justify;
  144. word-break: break-all;
  145. &:last-child {
  146. margin-bottom: 0;
  147. }
  148. }
  149. }
  150. // 隐藏滚动条
  151. ::-webkit-scrollbar {
  152. display: none;
  153. width: 0;
  154. height: 0;
  155. background: transparent;
  156. }
  157. }
  158. .disclaimer-footer {
  159. flex-shrink: 0;
  160. display: flex;
  161. padding: 24rpx 20rpx 32rpx;
  162. box-sizing: border-box;
  163. background: #ffffff;
  164. border-top: 1rpx solid #eee;
  165. button {
  166. flex: 1;
  167. height: 80rpx !important;
  168. min-height: 80rpx !important;
  169. max-height: 80rpx !important;
  170. line-height: 80rpx !important;
  171. font-size: 28rpx;
  172. border-radius: 40rpx;
  173. margin: 0 12rpx;
  174. padding: 0 !important;
  175. overflow: hidden;
  176. &::after {
  177. display: none;
  178. }
  179. }
  180. .btn-cancel {
  181. background: #f5f5f5;
  182. color: #666;
  183. }
  184. .btn-confirm {
  185. background: #2943d6;
  186. color: #ffffff;
  187. }
  188. }
  189. }
  190. }
  191. </style>