lyg-popup.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. }
  61. },
  62. fail: function(e) {
  63. that.showPopup = true;
  64. uni.hideTabBar({});
  65. console.log(e)
  66. }
  67. });
  68. },
  69. methods: {
  70. // 禁止滚动
  71. clear() {
  72. return;
  73. },
  74. back() {
  75. this.$emit('popupState', false)
  76. // #ifdef APP-PLUS
  77. plus.runtime.quit();
  78. // #endif
  79. },
  80. // 关闭弹框
  81. confirm() {
  82. this.showPopup = false;
  83. this.$emit('popupState', true);
  84. uni.setStorage({
  85. key: 'policyStorageKey',
  86. data: true
  87. });
  88. uni.showTabBar({});
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .popup_mask {
  95. position: fixed;
  96. bottom: 0;
  97. top: 0;
  98. left: 0;
  99. right: 0;
  100. background-color: rgba(0, 0, 0, 0.4);
  101. transition-property: opacity;
  102. transition-duration: 0.3s;
  103. opacity: 0;
  104. z-index: 98;
  105. }
  106. .button-group{
  107. border-top: 1px solid #f2f2f2;
  108. }
  109. .button-group button{
  110. display: inline-block;
  111. width: 50%;
  112. background: #fff;
  113. border-radius: 0;
  114. }
  115. .button-group button::after {
  116. border: none;
  117. }
  118. .popup_mask {
  119. opacity: 1;
  120. }
  121. .popup_content {
  122. overflow: hidden;
  123. box-sizing: border-box;
  124. padding: 40upx 20upx 0 20upx;
  125. position: fixed;
  126. bottom: 30%;
  127. border-radius: 8px;
  128. left: 50%;
  129. margin-left: -40%;
  130. right: 0;
  131. min-height: 400upx;
  132. background: #ffffff;
  133. width: 80%;
  134. z-index: 99;
  135. .title {
  136. text-align: center;
  137. font-size: 34upx;
  138. padding: 10upx 0 0 0;
  139. }
  140. .explain_text {
  141. font-size: 30upx;
  142. padding: 30upx 30upx 40upx 30upx;
  143. line-height: 38upx;
  144. .line {
  145. display: block;
  146. .path {
  147. color: #007aff;
  148. display: inline-block;
  149. text-align: center;
  150. }
  151. }
  152. }
  153. .button {
  154. display: flex;
  155. padding: 20upx;
  156. align-items: center;
  157. font-size: 34upx;
  158. justify-content: space-around;
  159. border-top: 1upx solid #f2f2f2;
  160. view {
  161. text-align: center;
  162. }
  163. }
  164. }
  165. </style>