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

166 lines
5.3 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
6 months ago
6 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
6 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
6 months ago
10 months ago
10 months ago
10 months ago
10 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. <view @click="onJump()"
  16. style="margin-top: 30rpx;color: #666;"
  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. </view>
  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. onJump(){
  78. uni.switchTab({
  79. url:"/pages/home/index"
  80. })
  81. },
  82. open(){
  83. this.$refs.popup.open();
  84. },
  85. checkboxChange(n) {
  86. console.log('change', n);
  87. },
  88. onCancel(){
  89. this.$refs.popup.close();
  90. this.checked=[];
  91. },
  92. onAgree(){
  93. this.$refs.popup.close();
  94. this.checked=['1'];
  95. },
  96. onLogin(event){
  97. console.info(event)
  98. let that = this
  99. if(that.checked.length==0){
  100. return uni.showToast({
  101. icon: "none",
  102. title: "请勾选隐私协议"
  103. })
  104. }
  105. uni.showLoading({
  106. title: '登录中...'
  107. })
  108. uni.login({
  109. success : res => {
  110. console.info(res.code)
  111. if(res.errMsg != "login:ok"){
  112. return
  113. }
  114. let params={
  115. code : res.code,
  116. encryptedData: event.detail.encryptedData,
  117. headimgurl:event.detail.userInfo.avatarUrl,
  118. iv:event.detail.iv,
  119. nickName:event.detail.userInfo.nickName,
  120. session_key:"",
  121. shareId:uni.getStorageSync('userId'),
  122. vid:""
  123. }
  124. appletLogin(params).then((response) => {
  125. console.info(`response`,response)
  126. uni.hideLoading()
  127. uni.setStorageSync('token', response.result.token)
  128. uni.setStorageSync('sessionKey', response.result.userInfo.sessionKey)
  129. uni.setStorageSync('userInfo', response.result.userInfo)
  130. let userInfo =response.result.userInfo
  131. if(!userInfo.nickName
  132. || !userInfo.phone || !userInfo.headImage){
  133. uni.navigateTo({
  134. url:"/pages/login/index"
  135. })
  136. }else{
  137. uni.switchTab({
  138. url:"/pages/home/index"
  139. })
  140. }
  141. }).catch((error) =>{
  142. })
  143. }
  144. })
  145. },
  146. handleOpenPrivacyContract() {
  147. // 打开隐私协议页面
  148. wx.openPrivacyContract({
  149. success: () => {}, // 打开成功
  150. fail: () => {}, // 打开失败
  151. complete: () => {}
  152. })
  153. }
  154. }
  155. }
  156. </script>
  157. <style scoped lang="scss">
  158. </style>