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

214 lines
4.3 KiB

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