爱简收旧衣按件回收前端代码仓库
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.

210 lines
4.2 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <uni-popup ref="popup" type="bottom" background-color="#fff" :mask-click="false" class="bottom-popup">
  3. <view class="popup-container">
  4. <!-- 标题 -->
  5. <view class="popup-title">用户隐私保护提示</view>
  6. <!-- 内容 -->
  7. <view class="popup-content">
  8. 在你使用瀚海回收服务之前请仔细阅读
  9. <text class="highlight" @click="openProtocol('service')">用户服务协议</text>
  10. <text class="highlight" @click="openProtocol('privacy')">隐私政策</text>
  11. 如你同意该指引请点击"同意"开始使用本小程序
  12. </view>
  13. <!-- 操作按钮 -->
  14. <view class="popup-buttons">
  15. <button class="popup-btn reject" @click="handleReject">拒绝</button>
  16. <button
  17. v-if="needPhone"
  18. class="popup-btn agree"
  19. open-type="getRealtimePhoneNumber"
  20. @getrealtimephonenumber="getrealtimephonenumber"
  21. @click="handleAgree"
  22. >同意</button>
  23. <button
  24. v-else
  25. class="popup-btn agree"
  26. @click="handleAgree"
  27. >同意</button>
  28. </view>
  29. </view>
  30. </uni-popup>
  31. </template>
  32. <script>
  33. export default {
  34. props: {
  35. needPhone: {
  36. type: Boolean,
  37. default: false
  38. }
  39. },
  40. methods: {
  41. getrealtimephonenumber (e) {
  42. console.log(e.detail.code,'11') // 动态令牌
  43. console.log(e.detail.errMsg,'22') // 回调信息(成功失败都会返回)
  44. console.log(e.detail.errno) // 错误码(失败时返回)
  45. uni.reLaunch({
  46. url:'/pages/wxUserInfo'
  47. })
  48. this.$api('bindPhone', {code:e.detail.code}, res => {
  49. console.log(res,'res-phone',)
  50. if (res.code == 200) {
  51. console.log(JSON.parse(res.result),'phone')
  52. getApp().globalData.phone = JSON.parse(res.result).phone_info.phoneNumber;
  53. }
  54. })
  55. },
  56. // 打开弹窗
  57. open() {
  58. this.$refs.popup.open()
  59. },
  60. // 关闭弹窗
  61. close() {
  62. this.$refs.popup.close()
  63. },
  64. // 同意处理
  65. handleAgree() {
  66. this.$emit('agree')
  67. this.close()
  68. },
  69. // 拒绝处理
  70. handleReject() {
  71. this.$emit('reject')
  72. this.close()
  73. },
  74. // 打开协议
  75. openProtocol(type) {
  76. this.$emit('open-protocol', type)
  77. },
  78. // 允许外部动态设置 needPhone
  79. setNeedPhone(val) {
  80. this.$emit('update:needPhone', val)
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped>
  86. /* 底部弹窗容器 */
  87. .bottom-popup {
  88. border-radius: 24rpx 24rpx 0 0;
  89. }
  90. .popup-container {
  91. padding: 40rpx;
  92. background: #fff;
  93. border-radius: 24rpx 24rpx 0 0;
  94. width: 100%;
  95. box-sizing: border-box;
  96. max-height: 80vh;
  97. overflow-y: auto;
  98. /* padding-bottom: env(safe-area-inset-bottom); */
  99. }
  100. /* 标题样式 */
  101. .popup-title {
  102. font-size: 32rpx;
  103. font-weight: bold;
  104. text-align: left;
  105. margin-bottom: 30rpx;
  106. color: #333;
  107. }
  108. /* 内容样式 */
  109. .popup-content {
  110. font-size: 28rpx;
  111. line-height: 1.6;
  112. color: #666;
  113. margin-bottom: 40rpx;
  114. word-wrap: break-word;
  115. word-break: break-all;
  116. }
  117. .highlight {
  118. color: #4c6eae;
  119. display: inline;
  120. }
  121. /* 按钮容器 */
  122. .popup-buttons {
  123. display: flex;
  124. justify-content: space-between;
  125. padding: 0 20rpx;
  126. margin-top: 20rpx;
  127. }
  128. /* 按钮基础样式 */
  129. .popup-btn {
  130. width: 45%;
  131. height: 88rpx;
  132. line-height: 88rpx;
  133. font-size: 32rpx;
  134. border-radius: 44rpx;
  135. text-align: center;
  136. }
  137. /* 拒绝按钮 */
  138. .popup-btn.reject {
  139. background-color: #f5f5f5;
  140. color: #666;
  141. }
  142. /* 同意按钮 */
  143. .popup-btn.agree {
  144. background-color: #07C160;
  145. color: #fff;
  146. }
  147. /* 去除按钮默认样式 */
  148. .popup-btn::after {
  149. border: none;
  150. }
  151. /* 适配不同屏幕尺寸 */
  152. @media screen and (max-height: 700px) {
  153. .popup-container {
  154. padding: 30rpx;
  155. }
  156. .popup-title {
  157. font-size: 28rpx;
  158. margin-bottom: 20rpx;
  159. }
  160. .popup-content {
  161. font-size: 26rpx;
  162. margin-bottom: 30rpx;
  163. }
  164. .popup-btn {
  165. height: 80rpx;
  166. line-height: 80rpx;
  167. font-size: 28rpx;
  168. }
  169. }
  170. /* 适配小屏幕 */
  171. @media screen and (max-height: 600px) {
  172. .popup-container {
  173. padding: 20rpx;
  174. }
  175. .popup-title {
  176. font-size: 26rpx;
  177. margin-bottom: 15rpx;
  178. }
  179. .popup-content {
  180. font-size: 24rpx;
  181. margin-bottom: 20rpx;
  182. }
  183. .popup-btn {
  184. height: 70rpx;
  185. line-height: 70rpx;
  186. font-size: 26rpx;
  187. }
  188. }
  189. </style>