index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="mask" @touchmove.prevent :hidden="isShow === false"></view>
  4. <view class="product-window" :class="{'on':isShow}">
  5. <view class="mp-data">
  6. <text class="mp-name">服务与隐私协议</text>
  7. </view>
  8. <view class="trip-msg">
  9. <view class="trip">
  10. {{`请仔细阅读以下内容,并作出适当的选择:`}}
  11. </view>
  12. </view>
  13. <view class="trip-title">
  14. 隐私政策概要
  15. </view>
  16. <view class="trip-msg">
  17. <view class="trip">
  18. 当您点击同意并继续使用产品服务时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法继续下一步操作。
  19. </view>
  20. </view>
  21. <view class="main-color" @click.stop="privacy('privacy')">点击阅读{{agreementName}}</view>
  22. <view class="bottom">
  23. <button class="save open" type="default" id="agree-btn" open-type="agreePrivacyAuthorization"
  24. @agreeprivacyauthorization="handleAgree">同意并继续</button>
  25. <button class="reject" @click="rejectAgreement">取消</button>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import colors from "@/mixins/color";
  32. export default {
  33. mixins: [colors],
  34. data() {
  35. return {
  36. isShow: false,
  37. agreementName: '',
  38. configData: this.$Cache.get('BASIC_CONFIG'),
  39. };
  40. },
  41. mounted() {
  42. wx.getPrivacySetting({
  43. success: res => {
  44. if (res.needAuthorization) {
  45. // 需要弹出隐私协议
  46. this.isShow = true
  47. this.agreementName = res.privacyContractName
  48. } else {
  49. this.$emit('onAgree');
  50. // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
  51. // wx.getUserProfile()
  52. // wx.chooseMedia()
  53. // wx.getClipboardData()
  54. // wx.startRecord()
  55. }
  56. },
  57. fail: () => {},
  58. complete: () => {}
  59. })
  60. },
  61. methods: {
  62. // 同意
  63. handleAgree() {
  64. this.isShow = false
  65. this.$emit('onAgree');
  66. },
  67. // 拒绝
  68. rejectAgreement() {
  69. this.isShow = false
  70. uni.switchTab({
  71. url: '/pages/index/index'
  72. })
  73. this.$emit('onReject');
  74. },
  75. // 跳转协议
  76. privacy(type) {
  77. uni.navigateTo({
  78. url: "/pages/users/privacy/index?type=" + type
  79. })
  80. },
  81. }
  82. }
  83. </script>
  84. <style>
  85. .pl-sty {
  86. color: #999999;
  87. font-size: 30rpx;
  88. }
  89. </style>
  90. <style scoped lang="scss">
  91. .product-window.on {
  92. transform: translate3d(0, 0, 0);
  93. }
  94. .mask {
  95. z-index: 99;
  96. }
  97. .product-window {
  98. position: fixed;
  99. bottom: 0;
  100. width: 100%;
  101. left: 0;
  102. background-color: #fff;
  103. z-index: 1000;
  104. border-radius: 40rpx 40rpx 0 0;
  105. transform: translate3d(0, 100%, 0);
  106. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  107. padding: 64rpx 40rpx;
  108. padding-bottom: 38rpx;
  109. padding-bottom: calc(38rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  110. padding-bottom: calc(38rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  111. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
  112. .icon-guanbi {
  113. position: absolute;
  114. top: 40rpx;
  115. right: 40rpx;
  116. font-size: 24rpx;
  117. font-weight: bold;
  118. color: #999;
  119. }
  120. .mp-data {
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. margin-bottom: 40rpx;
  125. .mp-name {
  126. font-size: 34rpx;
  127. font-weight: 500;
  128. color: #333333;
  129. line-height: 48rpx;
  130. }
  131. }
  132. .trip-msg {
  133. padding-bottom: 32rpx;
  134. .title {
  135. font-size: 30rpx;
  136. font-weight: bold;
  137. color: #000;
  138. margin-bottom: 6rpx;
  139. }
  140. .trip {
  141. color: #333333;
  142. font-size: 28rpx;
  143. font-family: PingFang SC-Regular, PingFang SC;
  144. font-weight: 400;
  145. }
  146. }
  147. .trip-title {
  148. font-size: 28rpx;
  149. font-weight: 500;
  150. color: #333333;
  151. margin-bottom: 8rpx;
  152. }
  153. .main-color {
  154. font-size: 28rpx;
  155. font-weight: 400;
  156. color: var(--view-theme);
  157. margin-bottom: 40rpx;
  158. }
  159. .bottom {
  160. display: flex;
  161. align-items: center;
  162. justify-content: center;
  163. flex-direction: column;
  164. .save,
  165. .reject {
  166. display: flex;
  167. align-items: center;
  168. justify-content: center;
  169. width: 670rpx;
  170. height: 80rpx;
  171. border-radius: 80rpx;
  172. background-color: #F5F5F5;
  173. color: #333;
  174. font-size: 30rpx;
  175. font-weight: 500;
  176. }
  177. .save {
  178. background-color: var(--view-theme);
  179. color: #fff;
  180. margin-bottom: 24rpx;
  181. }
  182. }
  183. }
  184. </style>