租房小程序前端代码
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.2 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
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()">{{userXyObj.keyValue}}</text>
  37. <text></text>
  38. <text class="se-c-black se-fw-6" @click="handleOpenPrivacyContract()">{{userYsObj.keyValue}}</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. userXyObj:{},
  64. userYsObj:{}
  65. }
  66. },
  67. mounted() {
  68. this.userXyObj = this.$utils.getkeyContent('user_xy')
  69. this.userYsObj = this.$utils.getkeyContent('user_ys')
  70. },
  71. methods: {
  72. open(){
  73. this.$refs.popup.open();
  74. },
  75. checkboxChange(n) {
  76. console.log('change', n);
  77. },
  78. onCancel(){
  79. this.$refs.popup.close();
  80. this.checked=[];
  81. },
  82. onAgree(){
  83. this.$refs.popup.close();
  84. this.checked=['1'];
  85. },
  86. onLogin(event){
  87. console.info(event)
  88. let that = this
  89. if(that.checked.length==0){
  90. return uni.showToast({
  91. icon: "none",
  92. title: "请勾选隐私协议"
  93. })
  94. }
  95. uni.showLoading({
  96. title: '登录中...'
  97. })
  98. uni.login({
  99. success(res) {
  100. console.info(res.code)
  101. if(res.errMsg != "login:ok"){
  102. return
  103. }
  104. let params={
  105. code : res.code,
  106. encryptedData: event.detail.encryptedData,
  107. headimgurl:event.detail.userInfo.avatarUrl,
  108. iv:event.detail.iv,
  109. nickName:event.detail.userInfo.nickName,
  110. session_key:"",
  111. shareId:uni.getStorageSync('userId'),
  112. vid:""
  113. }
  114. appletLogin(params).then((response) => {
  115. console.info(`response`,response)
  116. uni.hideLoading()
  117. uni.setStorageSync('token', response.result.token)
  118. uni.setStorageSync('sessionKey', response.result.userInfo.sessionKey)
  119. uni.setStorageSync('userInfo', response.result.userInfo)
  120. // that.commit('setUserInfo',{userInfo:response.result.userInfo,token:response.result.token})
  121. getInfo({}).then(result=>{
  122. // console.info('resultresult',result)
  123. uni.navigateTo({
  124. url:"/pages/login/index"
  125. })
  126. // if(result.result.nickName){
  127. // uni.switchTab({
  128. // url:"/pages/home/index"
  129. // })
  130. // }else{
  131. // }
  132. }).catch(err=>{
  133. })
  134. }).catch((error) =>{
  135. })
  136. }
  137. })
  138. },
  139. handleOpenPrivacyContract() {
  140. // 打开隐私协议页面
  141. wx.openPrivacyContract({
  142. success: () => {}, // 打开成功
  143. fail: () => {}, // 打开失败
  144. complete: () => {}
  145. })
  146. }
  147. }
  148. }
  149. </script>
  150. <style scoped lang="scss">
  151. </style>