index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. if (res.needAuthorization) {
  52. // 需要弹出隐私协议
  53. this.isShow = true
  54. this.agreementName = res.privacyContractName
  55. } else {
  56. this.$emit('onAgree');
  57. // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
  58. }
  59. },
  60. fail: () => {},
  61. complete: () => {}
  62. })
  63. },
  64. methods: {
  65. // 同意
  66. handleAgree() {
  67. this.isShow = false
  68. this.$emit('onAgree');
  69. },
  70. // 拒绝
  71. rejectAgreement() {
  72. this.isShow = false
  73. uni.switchTab({
  74. url: '/pages/index/index'
  75. })
  76. this.$emit('onReject');
  77. },
  78. closeAttr() {
  79. this.$emit('onCloseAgePop');
  80. },
  81. // 跳转协议
  82. privacy(type) {
  83. uni.navigateTo({
  84. url: "/pages/users/privacy/index?type=" + type
  85. })
  86. },
  87. }
  88. }
  89. </script>
  90. <style>
  91. .pl-sty {
  92. color: #999999;
  93. font-size: 30rpx;
  94. }
  95. </style>
  96. <style scoped lang="scss">
  97. .product-window.on {
  98. transform: translate3d(0, 0, 0);
  99. }
  100. .mask {
  101. z-index: 99;
  102. }
  103. .product-window {
  104. position: fixed;
  105. bottom: 0;
  106. width: 100%;
  107. left: 0;
  108. background-color: #fff;
  109. z-index: 1000;
  110. border-radius: 40rpx 40rpx 0 0;
  111. transform: translate3d(0, 100%, 0);
  112. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  113. padding: 64rpx 40rpx;
  114. padding-bottom: 38rpx;
  115. padding-bottom: calc(38rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  116. padding-bottom: calc(38rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  117. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
  118. .icon-guanbi {
  119. position: absolute;
  120. top: 40rpx;
  121. right: 40rpx;
  122. font-size: 24rpx;
  123. font-weight: bold;
  124. color: #999;
  125. }
  126. .mp-data {
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. margin-bottom: 40rpx;
  131. .mp-name {
  132. font-size: 34rpx;
  133. font-weight: 500;
  134. color: #333333;
  135. line-height: 48rpx;
  136. }
  137. }
  138. .trip-msg {
  139. padding-bottom: 32rpx;
  140. .title {
  141. font-size: 30rpx;
  142. font-weight: bold;
  143. color: #000;
  144. margin-bottom: 6rpx;
  145. }
  146. .trip {
  147. color: #333333;
  148. font-size: 28rpx;
  149. font-family: PingFang SC-Regular, PingFang SC;
  150. font-weight: 400;
  151. }
  152. }
  153. .trip-title {
  154. font-size: 28rpx;
  155. font-weight: 500;
  156. color: #333333;
  157. margin-bottom: 8rpx;
  158. }
  159. .main-color {
  160. font-size: 28rpx;
  161. font-weight: 400;
  162. color: var(--view-theme);
  163. margin-bottom: 40rpx;
  164. }
  165. .bottom {
  166. display: flex;
  167. align-items: center;
  168. justify-content: center;
  169. flex-direction: column;
  170. .save,
  171. .reject {
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. width: 670rpx;
  176. height: 80rpx;
  177. border-radius: 80rpx;
  178. background-color: #F5F5F5;
  179. color: #333;
  180. font-size: 30rpx;
  181. font-weight: 500;
  182. }
  183. .save {
  184. background-color: var(--view-theme);
  185. color: #fff;
  186. margin-bottom: 24rpx;
  187. }
  188. }
  189. }
  190. </style>