index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template name="protocol-popup">
  2. <view @touchmove.stop.prevent="clear" v-show="showPopup">
  3. <view class="popup_mask" @touchmove.stop.prevent="clear"></view>
  4. <view class="popup_content">
  5. <view class="title">{{title}}</view>
  6. <view class="explain_text">
  7. 请你务必认真阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了向你提供数据、分享等服务所要获取的权限信息。
  8. <view class="line">
  9. 你可以阅读
  10. <navigator :url="'/pages/public/webview/webview?title=服务协议&url='+protocolPath" class="path" hover-class="navigator-hover">《服务协议》</navigator>和<navigator :url="'/pages/public/webview/webview?title=隐私政策&url='+policyPath"
  11. class="path" hover-class="navigator-hover">《隐私政策》</navigator>了解详细信息。如您同意,请点击"同意"开始接受我们的服务。
  12. </view>
  13. </view>
  14. <view class="button">
  15. <view @click="back">暂不使用</view>
  16. <view @click="confirm">同意</view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import __config from '@/config/env';// 配置文件
  23. export default {
  24. name: "privacy-policy",
  25. props: {
  26. title: {
  27. type: String,
  28. default: "服务协议和隐私政策"
  29. },
  30. policyStorageKey: {
  31. type: String,
  32. default: "has_read_privacy"
  33. }
  34. },
  35. data() {
  36. return {
  37. showPrivacyPolicy: __config.showPrivacyPolicy,
  38. policyPath: __config.privacyPolicyUrl,// 政策路径
  39. protocolPath: __config.protocolUrl,// 协议路径
  40. showPopup: false
  41. };
  42. },
  43. created: function() {
  44. var that = this;
  45. if(this.showPrivacyPolicy){
  46. uni.getStorage({
  47. key: this.policyStorageKey,
  48. success: (res) => {
  49. if (res.data) {
  50. that.showPopup = false;
  51. }
  52. },
  53. fail: function(e) {
  54. that.showPopup = true;
  55. }
  56. });
  57. }
  58. },
  59. methods: {
  60. // 禁止滚动
  61. clear() {
  62. return;
  63. },
  64. back() {
  65. this.$emit('popupState', false)
  66. // <navigator target="miniProgram" open-type="exit">退出小程序</navigator>
  67. // #ifdef MP
  68. that.showPopup = false;
  69. // #endif
  70. // #ifdef APP-PLUS
  71. let that = this;
  72. uni.getSystemInfo({
  73. success: function(e) {
  74. if (e.platform == 'android') {
  75. plus.runtime.quit()
  76. }else if(e.platform == 'ios'){
  77. that.showPopup = false;
  78. }
  79. }
  80. })
  81. // #endif
  82. },
  83. // 关闭弹框
  84. confirm() {
  85. this.showPopup = false;
  86. this.$emit('popupState', true);
  87. uni.setStorage({
  88. key: this.policyStorageKey,
  89. data: true
  90. });
  91. }
  92. }
  93. };
  94. </script>
  95. <style lang="scss">
  96. .popup_mask {
  97. position: fixed;
  98. bottom: 0;
  99. top: 0;
  100. left: 0;
  101. right: 0;
  102. background-color: rgba(0, 0, 0, 0.4);
  103. transition-property: opacity;
  104. transition-duration: 0.3s;
  105. opacity: 0;
  106. z-index: 99998;
  107. }
  108. .popup_mask {
  109. opacity: 1;
  110. }
  111. .popup_content {
  112. overflow: hidden;
  113. box-sizing: border-box;
  114. padding: 40upx 20upx 0 20upx;
  115. position: fixed;
  116. bottom: 30%;
  117. border-radius: 8px;
  118. left: 50%;
  119. margin-left: -40%;
  120. right: 0;
  121. min-height: 400upx;
  122. background: #ffffff;
  123. width: 80%;
  124. z-index: 99999;
  125. .title {
  126. text-align: center;
  127. font-size: 34upx;
  128. padding: 10upx 0 0 0;
  129. }
  130. .explain_text {
  131. font-size: 30upx;
  132. padding: 30upx 30upx 40upx 30upx;
  133. line-height: 38upx;
  134. .line {
  135. display: block;
  136. .path {
  137. color: #007aff;
  138. display: inline-block;
  139. text-align: center;
  140. }
  141. }
  142. }
  143. .button {
  144. display: flex;
  145. padding: 20upx;
  146. align-items: center;
  147. font-size: 34upx;
  148. justify-content: space-around;
  149. border-top: 1upx solid #f2f2f2;
  150. view {
  151. text-align: center;
  152. }
  153. }
  154. }
  155. </style>