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

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