租房小程序前端代码
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.

161 lines
5.3 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="se-pos se-h-vh-100">
  3. <view class="se-flex se-pt-200 se-flex-h-c se-flex-ff-cw">
  4. <image class="se-w-150 se-h-150" :src="logo" mode=""></image>
  5. <view class="se-flex se-flex-h-c se-fs-34 se-fw-6 se-c-black se-mt-40">
  6. <!-- 租房小程序 -->
  7. {{name}}
  8. </view>
  9. </view>
  10. <view class="se-pb-200 se-pos-cb se-w-p-100">
  11. <button @getuserinfo="onLogin" open-type="getUserInfo" class="se-mx-80 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-white se-bgc-green">
  12. <image class="se-w-45 se-h-35" src="@/static/image/wechat.png" mode=""></image>
  13. <text class="se-ml-10">微信登录</text>
  14. </button>
  15. <button @getuserinfo="onLogin"
  16. style="margin-top: 30rpx;background-color: rgba(#0f0, 0.4);color: #0f0;"
  17. class="se-mx-80 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32">
  18. <text class="se-ml-10">取消登录</text>
  19. </button>
  20. <!-- <view class="se-mx-80 se-br-40 se-mt-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-66 se-bgc-f5">
  21. <text>手机验证码登录</text>
  22. </view> -->
  23. <view class="se-mx-80 se-br-40 se-mt-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-24 se-c-33">
  24. <uv-checkbox-group @change="checkboxChange" v-model="checked">
  25. <uv-checkbox name="1" activeColor="#07C160" label-size="12" shape="circle" label="阅读并同意"></uv-checkbox>
  26. <text class="se-c-green" @click="open()">隐私政策</text>
  27. <text class="se-c-green" @click="open()">服务条款</text>
  28. </uv-checkbox-group>
  29. </view>
  30. </view>
  31. <uv-popup ref="popup" :round="20" mode="center" bg-color="transparent" :close-on-click-overlay="false">
  32. <view class="se-w-600 se-bgc-white se-br-40 se-p-40">
  33. <view class="se-flex se-flex-h-c">
  34. <image class="se-a-80" src="@/static/image/6588.png" mode=""></image>
  35. </view>
  36. <view class="se-flex se-flex-h-c se-fs-34 se-fw-6 se-c-black se-mt-40">
  37. 服务协议和隐私权政策
  38. </view>
  39. <view class="se-lh-40 se-mt-40 se-fs-24 se-c-99">
  40. <text>请您务必审慎阅读充分理解用户协议和隐私政策各条款包括但不限于用户注意事项用户行为规范以及为了向你提供服务而收集使用存储你个人信息的情况等你可阅读</text>
  41. <text class="se-c-black se-fw-6" @click="handleOpenPrivacyContract()">{{userXyObj.keyValue}}</text>
  42. <text></text>
  43. <text class="se-c-black se-fw-6" @click="handleOpenPrivacyContract()">{{userYsObj.keyValue}}</text>
  44. <text>了解详细信息如你同意请点击下方按钮开始接受我们的服务</text>
  45. </view>
  46. <view class="se-flex se-flex-h-sb se-mt-40">
  47. <view @click="onCancel" class="se-br-20 se-flex-1 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-66 se-bgc-f5">
  48. <text>不同意</text>
  49. </view>
  50. <view @click="onAgree" class="se-br-20 se-ml-20 se-flex-1 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-32 se-c-white se-bgc-green">
  51. <text class="se-ml-10">同意</text>
  52. </view>
  53. </view>
  54. </view>
  55. </uv-popup>
  56. </view>
  57. </template>
  58. <script>
  59. import { fetchMenu,wxLogin,appletLogin,getInfo } from "@/common/api.js"
  60. export default {
  61. name : 'Auth',
  62. data() {
  63. return {
  64. logo:"../../static/image/logo.png",
  65. name:"租房小程序",
  66. checked:[],
  67. show:false,
  68. userXyObj:{},
  69. userYsObj:{}
  70. }
  71. },
  72. mounted() {
  73. this.userXyObj = this.$utils.getkeyContent('user_xy')
  74. this.userYsObj = this.$utils.getkeyContent('user_ys')
  75. },
  76. methods: {
  77. open(){
  78. this.$refs.popup.open();
  79. },
  80. checkboxChange(n) {
  81. console.log('change', n);
  82. },
  83. onCancel(){
  84. this.$refs.popup.close();
  85. this.checked=[];
  86. },
  87. onAgree(){
  88. this.$refs.popup.close();
  89. this.checked=['1'];
  90. },
  91. onLogin(event){
  92. console.info(event)
  93. let that = this
  94. if(that.checked.length==0){
  95. return uni.showToast({
  96. icon: "none",
  97. title: "请勾选隐私协议"
  98. })
  99. }
  100. uni.showLoading({
  101. title: '登录中...'
  102. })
  103. uni.login({
  104. success : res => {
  105. console.info(res.code)
  106. if(res.errMsg != "login:ok"){
  107. return
  108. }
  109. let params={
  110. code : res.code,
  111. encryptedData: event.detail.encryptedData,
  112. headimgurl:event.detail.userInfo.avatarUrl,
  113. iv:event.detail.iv,
  114. nickName:event.detail.userInfo.nickName,
  115. session_key:"",
  116. shareId:uni.getStorageSync('userId'),
  117. vid:""
  118. }
  119. appletLogin(params).then((response) => {
  120. console.info(`response`,response)
  121. uni.hideLoading()
  122. uni.setStorageSync('token', response.result.token)
  123. uni.setStorageSync('sessionKey', response.result.userInfo.sessionKey)
  124. uni.setStorageSync('userInfo', response.result.userInfo)
  125. let userInfo =response.result.userInfo
  126. if(!userInfo.nickName
  127. || !userInfo.phone){
  128. uni.navigateTo({
  129. url:"/pages/login/index"
  130. })
  131. }else{
  132. uni.switchTab({
  133. url:"/pages/home/index"
  134. })
  135. }
  136. }).catch((error) =>{
  137. })
  138. }
  139. })
  140. },
  141. handleOpenPrivacyContract() {
  142. // 打开隐私协议页面
  143. wx.openPrivacyContract({
  144. success: () => {}, // 打开成功
  145. fail: () => {}, // 打开失败
  146. complete: () => {}
  147. })
  148. }
  149. }
  150. }
  151. </script>
  152. <style scoped lang="scss">
  153. </style>