lyg-popup.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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="protocolPath" class="path" hover-class="navigator-hover">《服务协议》</navigator>和<navigator :url="policyPath"
  11. class="path" hover-class="navigator-hover">《隐私政策》</navigator>了解详细信息。如您同意,请点击"同意"开始接受我们的服务。
  12. </view>
  13. </view>
  14. <!-- <view class="button">
  15. <view @tap="back">暂不使用</view>
  16. <view @tap="confirm">同意</view>
  17. </view> -->
  18. <view class="button-group">
  19. <button @tap="back" style='border-right:1px solid #f2f2f2;'>暂不使用</button>
  20. <button @tap="confirm">同意</button>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: "lyg-popup",
  28. props: {
  29. title: {
  30. type: String,
  31. default: "服务协议和隐私政策"
  32. },
  33. // 协议路径
  34. protocolPath: {
  35. type: String
  36. },
  37. // 政策路径
  38. policyPath: {
  39. type: String
  40. },
  41. policyStorageKey: {
  42. type: String,
  43. default:"has_read_privacy"
  44. }
  45. },
  46. data() {
  47. return {
  48. showPopup: false
  49. };
  50. },
  51. created: function() {
  52. var that = this;
  53. console.log("lyg-popup created");
  54. uni.getStorage({
  55. key: 'policyStorageKey',
  56. success: (res) => {
  57. if (res.data) {
  58. that.showPopup = false;
  59. uni.showTabBar({});
  60. this.$emit('popupState', true);
  61. }
  62. },
  63. fail: function(e) {
  64. that.showPopup = true;
  65. uni.hideTabBar({});
  66. console.log(e)
  67. }
  68. });
  69. },
  70. methods: {
  71. // 禁止滚动
  72. clear() {
  73. return;
  74. },
  75. back() {
  76. this.$emit('popupState', false)
  77. // #ifdef APP-PLUS
  78. plus.runtime.quit();
  79. // #endif
  80. },
  81. // 关闭弹框
  82. confirm() {
  83. this.showPopup = false;
  84. this.$emit('popupState', true);
  85. uni.setStorage({
  86. key: 'policyStorageKey',
  87. data: true
  88. });
  89. uni.showTabBar({});
  90. }
  91. }
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. .popup_mask {
  96. position: fixed;
  97. bottom: 0;
  98. top: 0;
  99. left: 0;
  100. right: 0;
  101. background-color: rgba(0, 0, 0, 0.4);
  102. transition-property: opacity;
  103. transition-duration: 0.3s;
  104. opacity: 0;
  105. z-index: 98;
  106. }
  107. .button-group{
  108. border-top: 1px solid #f2f2f2;
  109. }
  110. .button-group button{
  111. display: inline-block;
  112. width: 50%;
  113. background: #fff;
  114. border-radius: 0;
  115. }
  116. .button-group button::after {
  117. border: none;
  118. }
  119. .popup_mask {
  120. opacity: 1;
  121. }
  122. .popup_content {
  123. overflow: hidden;
  124. box-sizing: border-box;
  125. padding: 40upx 20upx 0 20upx;
  126. position: fixed;
  127. bottom: 30%;
  128. border-radius: 8px;
  129. left: 50%;
  130. margin-left: -40%;
  131. right: 0;
  132. min-height: 400upx;
  133. background: #ffffff;
  134. width: 80%;
  135. z-index: 99;
  136. .title {
  137. text-align: center;
  138. font-size: 34upx;
  139. padding: 10upx 0 0 0;
  140. }
  141. .explain_text {
  142. font-size: 30upx;
  143. padding: 30upx 30upx 40upx 30upx;
  144. line-height: 38upx;
  145. .line {
  146. display: block;
  147. .path {
  148. color: #007aff;
  149. display: inline-block;
  150. text-align: center;
  151. }
  152. }
  153. }
  154. .button {
  155. display: flex;
  156. padding: 20upx;
  157. align-items: center;
  158. font-size: 34upx;
  159. justify-content: space-around;
  160. border-top: 1upx solid #f2f2f2;
  161. view {
  162. text-align: center;
  163. }
  164. }
  165. }
  166. </style>