鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
3.5 KiB

3 weeks ago
  1. <template>
  2. <uv-popup ref="popup" z-index="99999" :closeOnClickOverlay="false" :customStyle="{ backgroundColor: 'transparent' }">
  3. <view class="privacyPopup">
  4. <view class="icon">
  5. <image src="/static/image/PrivacyAgreementPoup/icon.png"
  6. mode=""></image>
  7. </view>
  8. <view class="title">
  9. <view>协议与隐私政策</view>
  10. </view>
  11. <view class="content_pri">
  12. <view class="text">
  13. 欢迎来到酒店布草!我们根据最新的法律法规监管政策要求更新了用户协议隐私政策,请您认真阅读
  14. </view>
  15. </view>
  16. <view class="config">
  17. <uv-checkbox-group v-model="checkboxValue" shape="circle">
  18. <view class="content">
  19. <view style="display: flex;">
  20. <!-- <uv-checkbox size="30rpx" :name="1"></uv-checkbox> -->
  21. 同意<text @click="goToPrivacy">酒店布草隐私政策</text>
  22. </view>
  23. <view class="">
  24. 以及<text @click="goToPrivacy">用户协议</text>
  25. </view>
  26. </view>
  27. </uv-checkbox-group>
  28. </view>
  29. <view class="pri_btn">
  30. <button class="confuse_btn" @click="confusePrivacy">拒绝</button>
  31. <button
  32. class="confirm_btn" id="agree-btn"
  33. open-type="agreePrivacyAuthorization"
  34. @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  35. </view>
  36. </view>
  37. </uv-popup>
  38. </template>
  39. <script>
  40. export default {
  41. name: 'PrivacyAgreementPoup',
  42. data() {
  43. return {
  44. resolvePrivacyAuthorization: {},
  45. checkboxValue : false
  46. }
  47. },
  48. mounted() {
  49. if(wx.getPrivacySetting){
  50. wx.getPrivacySetting({
  51. success: res => {
  52. if (res.needAuthorization) {
  53. // 需要弹出隐私协议
  54. this.init()
  55. }
  56. },
  57. fail: () => {}
  58. })
  59. }
  60. },
  61. methods: {
  62. //初始化
  63. init(resolve) {
  64. this.$refs.popup.open('center')
  65. this.resolvePrivacyAuthorization = resolve
  66. },
  67. // 打开隐私协议
  68. goToPrivacy() {
  69. wx.openPrivacyContract({
  70. success: () => {
  71. console.log('打开成功');
  72. }, // 打开成功
  73. fail: () => {
  74. uni.showToast({
  75. title: '打开失败,稍后重试',
  76. icon: 'none'
  77. })
  78. } // 打开失败
  79. })
  80. },
  81. // 拒绝
  82. confusePrivacy() {
  83. this.$refs.popup.close()
  84. // this.resolvePrivacyAuthorization({
  85. // event: 'disagree'
  86. // })
  87. },
  88. // 同意
  89. handleAgreePrivacyAuthorization() {
  90. // 告知平台用户已经同意,参数传同意按钮的id
  91. // this.resolvePrivacyAuthorization({
  92. // buttonId: 'agree-btn',
  93. // event: 'agree'
  94. // })
  95. this.$refs.popup.close()
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .privacyPopup {
  102. width: 90%;
  103. margin: 0rpx auto;
  104. background: white;
  105. border-radius: 20rpx;
  106. box-sizing: border-box;
  107. padding: 40rpx 30rpx;
  108. .icon{
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. padding-bottom: 30rpx;
  113. image{
  114. width: 90rpx;
  115. height: 90rpx;
  116. }
  117. }
  118. .title {
  119. text-align: center;
  120. font-size: 36rpx;
  121. }
  122. .content_pri {
  123. padding: 30rpx 0rpx;
  124. font-size: 28rpx;
  125. }
  126. .config {
  127. font-size: 28rpx;
  128. text-align: center;
  129. line-height: 40rpx;
  130. margin-bottom: 30rpx;
  131. text {
  132. color: $uni-color;
  133. }
  134. .content{
  135. display: flex;
  136. }
  137. }
  138. .pri_btn {
  139. display: flex;
  140. .confuse_btn{
  141. background-color: #F2F2F2;
  142. color: #BDBDBD;
  143. }
  144. button {
  145. margin: 10rpx;
  146. flex: 1;
  147. background: $uni-color;
  148. outline: none;
  149. color: white;
  150. font-size: 30rpx;
  151. }
  152. }
  153. }
  154. </style>