index.vue 4.5 KB

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