|  | @@ -1,125 +1,164 @@
 | 
											
												
													
														|  | -<template>
 |  | 
 | 
											
												
													
														|  | -  <view class="container">
 |  | 
 | 
											
												
													
														|  | -    <view class="login-logo">
 |  | 
 | 
											
												
													
														|  | -      <image src="@/static/logo.png" mode="scaleToFill" />
 |  | 
 | 
											
												
													
														|  | -    </view>
 |  | 
 | 
											
												
													
														|  | -    <view class="login-btn-wrap">
 |  | 
 | 
											
												
													
														|  | -      <u-button shape="circle" type="primary" :loading="loading" @tap="login">
 |  | 
 | 
											
												
													
														|  | -        微信用户一键登录
 |  | 
 | 
											
												
													
														|  | -      </u-button>
 |  | 
 | 
											
												
													
														|  | -      <u-button
 |  | 
 | 
											
												
													
														|  | -        shape="circle"
 |  | 
 | 
											
												
													
														|  | -        :customStyle="{ 'margin-top': '20rpx' }"
 |  | 
 | 
											
												
													
														|  | -        @tap="$Router.push('/pages/login/phoneLogin')"
 |  | 
 | 
											
												
													
														|  | -      >
 |  | 
 | 
											
												
													
														|  | -        手机号登录/注册
 |  | 
 | 
											
												
													
														|  | -      </u-button>
 |  | 
 | 
											
												
													
														|  | -    </view>
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -    <view class="agree">
 |  | 
 | 
											
												
													
														|  | -      <u-checkbox-group v-model="checked">
 |  | 
 | 
											
												
													
														|  | -        <u-checkbox shape="circle" name="1" />
 |  | 
 | 
											
												
													
														|  | -      </u-checkbox-group>
 |  | 
 | 
											
												
													
														|  | -      <view>我已阅读并同意</view>
 |  | 
 | 
											
												
													
														|  | -      <view @click="userAgreementClick" style="color: #5992bb">《用户协议》</view>
 |  | 
 | 
											
												
													
														|  | -      <view @click="privacyPolicyClick" style="color: #5992bb">《隐私政策》</view>
 |  | 
 | 
											
												
													
														|  | -    </view>
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -    <u-modal
 |  | 
 | 
											
												
													
														|  | -      :show="show"
 |  | 
 | 
											
												
													
														|  | -      content="请阅读并勾选用户协议"
 |  | 
 | 
											
												
													
														|  | -      @confirm="confirm"
 |  | 
 | 
											
												
													
														|  | -      width="500rpx"
 |  | 
 | 
											
												
													
														|  | -    ></u-modal>
 |  | 
 | 
											
												
													
														|  | -  </view>
 |  | 
 | 
											
												
													
														|  | -</template>
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -<script>
 |  | 
 | 
											
												
													
														|  | -import { getWxLoginCode } from '@/api/login.js';
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -export default {
 |  | 
 | 
											
												
													
														|  | -  data() {
 |  | 
 | 
											
												
													
														|  | -    return {
 |  | 
 | 
											
												
													
														|  | -      loading: false,
 |  | 
 | 
											
												
													
														|  | -      form: {
 |  | 
 | 
											
												
													
														|  | -        client_id: 'chelvc_client',
 |  | 
 | 
											
												
													
														|  | -        client_secret: 'qWBe6jD%GCuPPTkP',
 |  | 
 | 
											
												
													
														|  | -        grant_type: 'wechat',
 |  | 
 | 
											
												
													
														|  | -        token: '',
 |  | 
 | 
											
												
													
														|  | -      },
 |  | 
 | 
											
												
													
														|  | -      checked: [],
 |  | 
 | 
											
												
													
														|  | -      show: false,
 |  | 
 | 
											
												
													
														|  | -    };
 |  | 
 | 
											
												
													
														|  | -  },
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -  methods: {
 |  | 
 | 
											
												
													
														|  | -    //点击微信用户一键登录
 |  | 
 | 
											
												
													
														|  | -    async login() {
 |  | 
 | 
											
												
													
														|  | -      if (this.checked.length !== 0) {
 |  | 
 | 
											
												
													
														|  | -        this.loading = true;
 |  | 
 | 
											
												
													
														|  | -        this.form.token = await getWxLoginCode();
 |  | 
 | 
											
												
													
														|  | -        this.$store
 |  | 
 | 
											
												
													
														|  | -          .dispatch('LoginByWxCode', this.form)
 |  | 
 | 
											
												
													
														|  | -          .then(() => {
 |  | 
 | 
											
												
													
														|  | -            this.loading = false;
 |  | 
 | 
											
												
													
														|  | -            uni.$u.toast('登录成功');
 |  | 
 | 
											
												
													
														|  | -            this.$Router.pushTab('/pages/client/tabBar/home');
 |  | 
 | 
											
												
													
														|  | -            // this.$store.dispatch('GetUserInfo').then(() => {
 |  | 
 | 
											
												
													
														|  | -            //   })
 |  | 
 | 
											
												
													
														|  | -            //   .catch(err => {
 |  | 
 | 
											
												
													
														|  | -            //   });
 |  | 
 | 
											
												
													
														|  | -          })
 |  | 
 | 
											
												
													
														|  | -          .catch(() => {
 |  | 
 | 
											
												
													
														|  | -            this.loading = false;
 |  | 
 | 
											
												
													
														|  | -            uni.$u.toast('登录失败');
 |  | 
 | 
											
												
													
														|  | -          });
 |  | 
 | 
											
												
													
														|  | -      } else {
 |  | 
 | 
											
												
													
														|  | -        this.show = !this.show;
 |  | 
 | 
											
												
													
														|  | -      }
 |  | 
 | 
											
												
													
														|  | -    },
 |  | 
 | 
											
												
													
														|  | -    confirm() {
 |  | 
 | 
											
												
													
														|  | -      this.show = false;
 |  | 
 | 
											
												
													
														|  | -    },
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -    //点击用户协议
 |  | 
 | 
											
												
													
														|  | -    userAgreementClick() {},
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -    //点击隐私政策
 |  | 
 | 
											
												
													
														|  | -    privacyPolicyClick() {},
 |  | 
 | 
											
												
													
														|  | -  },
 |  | 
 | 
											
												
													
														|  | -  mounted() {},
 |  | 
 | 
											
												
													
														|  | -};
 |  | 
 | 
											
												
													
														|  | -</script>
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -<style scoped lang="scss">
 |  | 
 | 
											
												
													
														|  | -.container {
 |  | 
 | 
											
												
													
														|  | -  display: flex;
 |  | 
 | 
											
												
													
														|  | -  justify-content: center;
 |  | 
 | 
											
												
													
														|  | -  align-items: center;
 |  | 
 | 
											
												
													
														|  | -  flex-direction: column;
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -.login-btn-wrap {
 |  | 
 | 
											
												
													
														|  | -  margin-top: 40rpx;
 |  | 
 | 
											
												
													
														|  | -  width: 80%;
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -.login-logo {
 |  | 
 | 
											
												
													
														|  | -  width: 300rpx;
 |  | 
 | 
											
												
													
														|  | -  height: 260rpx;
 |  | 
 | 
											
												
													
														|  | -  background-color: pink;
 |  | 
 | 
											
												
													
														|  | -  margin-top: 100rpx;
 |  | 
 | 
											
												
													
														|  | -  image {
 |  | 
 | 
											
												
													
														|  | -    width: 100%;
 |  | 
 | 
											
												
													
														|  | -    height: 100%;
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -.agree {
 |  | 
 | 
											
												
													
														|  | -  display: flex;
 |  | 
 | 
											
												
													
														|  | -  flex-wrap: wrap;
 |  | 
 | 
											
												
													
														|  | -  margin-top: 20rpx;
 |  | 
 | 
											
												
													
														|  | -  justify-content: center;
 |  | 
 | 
											
												
													
														|  | -  align-items: center;
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -</style>
 |  | 
 | 
											
												
													
														|  | 
 |  | +<template>
 | 
											
												
													
														|  | 
 |  | +  <view class="container">
 | 
											
												
													
														|  | 
 |  | +    <view class="login-logo">
 | 
											
												
													
														|  | 
 |  | +      <image src="@/static/logo.png" mode="scaleToFill" />
 | 
											
												
													
														|  | 
 |  | +    </view>
 | 
											
												
													
														|  | 
 |  | +    <view class="login-btn-wrap">
 | 
											
												
													
														|  | 
 |  | +      <u-button shape="circle" type="primary" :loading="loading" @tap="login">
 | 
											
												
													
														|  | 
 |  | +        微信用户一键登录
 | 
											
												
													
														|  | 
 |  | +      </u-button>
 | 
											
												
													
														|  | 
 |  | +      <u-button
 | 
											
												
													
														|  | 
 |  | +        shape="circle"
 | 
											
												
													
														|  | 
 |  | +        :customStyle="{ 'margin-top': '20rpx' }"
 | 
											
												
													
														|  | 
 |  | +        @tap="$Router.push('/pages/login/phoneLogin')"
 | 
											
												
													
														|  | 
 |  | +      >
 | 
											
												
													
														|  | 
 |  | +        手机号登录/注册
 | 
											
												
													
														|  | 
 |  | +      </u-button>
 | 
											
												
													
														|  | 
 |  | +    </view>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    <view class="agree">
 | 
											
												
													
														|  | 
 |  | +      <u-checkbox-group v-model="checked">
 | 
											
												
													
														|  | 
 |  | +        <u-checkbox shape="circle" name="1" />
 | 
											
												
													
														|  | 
 |  | +      </u-checkbox-group>
 | 
											
												
													
														|  | 
 |  | +      <view>我已阅读并同意</view>
 | 
											
												
													
														|  | 
 |  | +      <view @click="showUserAgreement">《用户协议》</view>
 | 
											
												
													
														|  | 
 |  | +      <view @click="showPrivacyPolicy">《隐私政策》</view>
 | 
											
												
													
														|  | 
 |  | +    </view>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    <u-modal
 | 
											
												
													
														|  | 
 |  | +      :show="show"
 | 
											
												
													
														|  | 
 |  | +      content="请阅读并勾选用户协议"
 | 
											
												
													
														|  | 
 |  | +      @confirm="confirmUserAgreement"
 | 
											
												
													
														|  | 
 |  | +      width="500rpx"
 | 
											
												
													
														|  | 
 |  | +    ></u-modal>
 | 
											
												
													
														|  | 
 |  | +    <u-modal title="用户协议" :show="showUserAgreementDialog" width="500rpx">
 | 
											
												
													
														|  | 
 |  | +      <view>
 | 
											
												
													
														|  | 
 |  | +        用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容用户协议的内容
 | 
											
												
													
														|  | 
 |  | +      </view>
 | 
											
												
													
														|  | 
 |  | +      <u-button shape="circle" @click="closeUserAgreementDialog">X</u-button>
 | 
											
												
													
														|  | 
 |  | +    </u-modal>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    <u-modal title="隐私政策" :show="showPrivacyPolicyDialog" width="500rpx">
 | 
											
												
													
														|  | 
 |  | +      <view>
 | 
											
												
													
														|  | 
 |  | +        隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容隐私政策的内容
 | 
											
												
													
														|  | 
 |  | +      </view>
 | 
											
												
													
														|  | 
 |  | +      <u-button shape="circle" @click="closePrivacyPolicyDialog">X</u-button>
 | 
											
												
													
														|  | 
 |  | +    </u-modal>
 | 
											
												
													
														|  | 
 |  | +  </view>
 | 
											
												
													
														|  | 
 |  | +</template>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +<script>
 | 
											
												
													
														|  | 
 |  | +import { getWxLoginCode } from '@/api/login.js';
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +export default {
 | 
											
												
													
														|  | 
 |  | +  data() {
 | 
											
												
													
														|  | 
 |  | +    return {
 | 
											
												
													
														|  | 
 |  | +      loading: false,
 | 
											
												
													
														|  | 
 |  | +      form: {
 | 
											
												
													
														|  | 
 |  | +        client_id: 'chelvc_client',
 | 
											
												
													
														|  | 
 |  | +        client_secret: 'qWBe6jD%GCuPPTkP',
 | 
											
												
													
														|  | 
 |  | +        grant_type: 'wechat',
 | 
											
												
													
														|  | 
 |  | +        token: '',
 | 
											
												
													
														|  | 
 |  | +      },
 | 
											
												
													
														|  | 
 |  | +      checked: [],
 | 
											
												
													
														|  | 
 |  | +      show: false, // 添加show数据属性,并初始化为false
 | 
											
												
													
														|  | 
 |  | +      showUserAgreementDialog: false,
 | 
											
												
													
														|  | 
 |  | +      showPrivacyPolicyDialog: false,
 | 
											
												
													
														|  | 
 |  | +    };
 | 
											
												
													
														|  | 
 |  | +  },
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  methods: {
 | 
											
												
													
														|  | 
 |  | +    confirmUserAgreement() {
 | 
											
												
													
														|  | 
 |  | +      // 确认按钮点击事件处理
 | 
											
												
													
														|  | 
 |  | +      if (!this.checked.length) {
 | 
											
												
													
														|  | 
 |  | +        this.showUserAgreementDialog = true;
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  | 
 |  | +        this.showPrivacyPolicyDialog = true;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +      // 在确认按钮点击后执行页面跳转的代码
 | 
											
												
													
														|  | 
 |  | +      this.$Router.back();
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    showUserAgreement() {
 | 
											
												
													
														|  | 
 |  | +      this.showUserAgreementDialog = true;
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    showPrivacyPolicy() {
 | 
											
												
													
														|  | 
 |  | +      this.showPrivacyPolicyDialog = true;
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    //点击微信用户一键登录
 | 
											
												
													
														|  | 
 |  | +    async login() {
 | 
											
												
													
														|  | 
 |  | +      this.$Router.pushTab('/pages/client/tabBar/home');
 | 
											
												
													
														|  | 
 |  | +      return;
 | 
											
												
													
														|  | 
 |  | +      if (this.checked.length !== 0) {
 | 
											
												
													
														|  | 
 |  | +        this.loading = true;
 | 
											
												
													
														|  | 
 |  | +        this.form.token = await getWxLoginCode();
 | 
											
												
													
														|  | 
 |  | +        this.$store
 | 
											
												
													
														|  | 
 |  | +          .dispatch('LoginByWxCode', this.form)
 | 
											
												
													
														|  | 
 |  | +          .then(() => {
 | 
											
												
													
														|  | 
 |  | +            this.loading = false;
 | 
											
												
													
														|  | 
 |  | +            uni.$u.toast('登录成功');
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            // this.$store.dispatch('GetUserInfo').then(() => {
 | 
											
												
													
														|  | 
 |  | +            //   })
 | 
											
												
													
														|  | 
 |  | +            //   .catch(err => {
 | 
											
												
													
														|  | 
 |  | +            //   });
 | 
											
												
													
														|  | 
 |  | +          })
 | 
											
												
													
														|  | 
 |  | +          .catch(() => {
 | 
											
												
													
														|  | 
 |  | +            this.loading = false;
 | 
											
												
													
														|  | 
 |  | +            uni.$u.toast('登录失败');
 | 
											
												
													
														|  | 
 |  | +          });
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  | 
 |  | +        this.show = !this.show;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    confirm() {
 | 
											
												
													
														|  | 
 |  | +      if (!this.checked.length) {
 | 
											
												
													
														|  | 
 |  | +        this.showUserAgreementDialog = true;
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  | 
 |  | +        this.showPrivacyPolicyDialog = true;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    closeUserAgreementDialog() {
 | 
											
												
													
														|  | 
 |  | +      this.showUserAgreementDialog = false;
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +    closePrivacyPolicyDialog() {
 | 
											
												
													
														|  | 
 |  | +      this.showPrivacyPolicyDialog = false;
 | 
											
												
													
														|  | 
 |  | +    },
 | 
											
												
													
														|  | 
 |  | +  },
 | 
											
												
													
														|  | 
 |  | +};
 | 
											
												
													
														|  | 
 |  | +</script>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +<style scoped lang="scss">
 | 
											
												
													
														|  | 
 |  | +.container {
 | 
											
												
													
														|  | 
 |  | +  display: flex;
 | 
											
												
													
														|  | 
 |  | +  justify-content: center;
 | 
											
												
													
														|  | 
 |  | +  align-items: center;
 | 
											
												
													
														|  | 
 |  | +  flex-direction: column;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +.login-btn-wrap {
 | 
											
												
													
														|  | 
 |  | +  margin-top: 40rpx;
 | 
											
												
													
														|  | 
 |  | +  width: 80%;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +.login-logo {
 | 
											
												
													
														|  | 
 |  | +  width: 300rpx;
 | 
											
												
													
														|  | 
 |  | +  height: 260rpx;
 | 
											
												
													
														|  | 
 |  | +  background-color: pink;
 | 
											
												
													
														|  | 
 |  | +  margin-top: 100rpx;
 | 
											
												
													
														|  | 
 |  | +  image {
 | 
											
												
													
														|  | 
 |  | +    width: 100%;
 | 
											
												
													
														|  | 
 |  | +    height: 100%;
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +.agree {
 | 
											
												
													
														|  | 
 |  | +  display: flex;
 | 
											
												
													
														|  | 
 |  | +  flex-wrap: wrap;
 | 
											
												
													
														|  | 
 |  | +  margin-top: 20rpx;
 | 
											
												
													
														|  | 
 |  | +  justify-content: center;
 | 
											
												
													
														|  | 
 |  | +  align-items: center;
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +</style>
 |