|
@@ -1,113 +1,94 @@
|
|
|
-html
|
|
|
-<template>
|
|
|
- <view class="container">
|
|
|
- <u-image
|
|
|
- src="@/static/logo.png"
|
|
|
- mode="widthFix"
|
|
|
- class="logo-image"
|
|
|
- ></u-image>
|
|
|
- <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>
|
|
|
- <br />
|
|
|
- <view style="display: flex">
|
|
|
- <u-icon name="gift-fill" color="#2979ff" size="28"></u-icon>
|
|
|
- <text @click="userAgreementClick" style="font-weight: bold"
|
|
|
- >随便看看</text
|
|
|
- >
|
|
|
- <u-icon name="gift-fill" color="#2979ff" size="28"></u-icon>
|
|
|
- <text @click="userAgreementClick" style="font-weight: bold"
|
|
|
- >联系客服</text
|
|
|
- >
|
|
|
- </view>
|
|
|
- <br />
|
|
|
- <br />
|
|
|
- <view style="font-size: 12px">
|
|
|
- 温馨提示:登录前请详细阅读
|
|
|
- <text @click="userAgreementClick" style="font-weight: bold"
|
|
|
- >《用户协议》</text
|
|
|
- ><text @click="privacyPolicyClick" style="font-weight: bold"
|
|
|
- >《隐私政策》</text
|
|
|
- >
|
|
|
- </view>
|
|
|
- </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: '',
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- onShow(){
|
|
|
- },
|
|
|
- methods: {
|
|
|
- //点击微信用户一键登录
|
|
|
- async login() {
|
|
|
- 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(() => {
|
|
|
- this.$Router.pushTab('/pages/tabbar/home/index');
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.loading = false;
|
|
|
- uni.$u.toast('登录失败');
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- //点击用户协议
|
|
|
- userAgreementClick() {},
|
|
|
-
|
|
|
- //点击忘记密码
|
|
|
- forgetPassword() {},
|
|
|
-
|
|
|
- //点击隐私政策
|
|
|
- privacyPolicyClick() {},
|
|
|
- },
|
|
|
-};
|
|
|
-</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-.container {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- flex-direction: column;
|
|
|
-}
|
|
|
-
|
|
|
-.login-btn-wrap {
|
|
|
- margin-top: 40rpx;
|
|
|
- width: 80%;
|
|
|
-}
|
|
|
-.logo-image {
|
|
|
- margin: auto;
|
|
|
-}
|
|
|
-</style>
|
|
|
+html
|
|
|
+<template>
|
|
|
+ <view class="container">
|
|
|
+ <u-image src="@/static/logo.png" mode="widthFix" class="logo-image"></u-image>
|
|
|
+ <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>
|
|
|
+ <br />
|
|
|
+ <view style="display: flex">
|
|
|
+ <u-icon name="gift-fill" color="#2979ff" size="28"></u-icon>
|
|
|
+ <text @click="userAgreementClick" style="font-weight: bold">随便看看</text>
|
|
|
+ <u-icon name="gift-fill" color="#2979ff" size="28"></u-icon>
|
|
|
+ <text @click="userAgreementClick" style="font-weight: bold">联系客服</text>
|
|
|
+ </view>
|
|
|
+ <br />
|
|
|
+ <br />
|
|
|
+ <view style="font-size: 12px">
|
|
|
+ 温馨提示:登录前请详细阅读
|
|
|
+ <text @click="userAgreementClick" style="font-weight: bold">《用户协议》</text><text @click="privacyPolicyClick"
|
|
|
+ style="font-weight: bold">《隐私政策》</text>
|
|
|
+ </view>
|
|
|
+ </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: '',
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onShow() {},
|
|
|
+ methods: {
|
|
|
+ //点击微信用户一键登录
|
|
|
+ async login() {
|
|
|
+ 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/tabbar/home/index');
|
|
|
+ // this.$store.dispatch('GetUserInfo').then(() => {
|
|
|
+ // })
|
|
|
+ // .catch(err => {
|
|
|
+ // console.log(err);
|
|
|
+ // });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ uni.$u.toast('登录失败');
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //点击用户协议
|
|
|
+ userAgreementClick() {},
|
|
|
+
|
|
|
+ //点击忘记密码
|
|
|
+ forgetPassword() {},
|
|
|
+
|
|
|
+ //点击隐私政策
|
|
|
+ privacyPolicyClick() {},
|
|
|
+ },
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .container {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ .login-btn-wrap {
|
|
|
+ margin-top: 40rpx;
|
|
|
+ width: 80%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .logo-image {
|
|
|
+ margin: auto;
|
|
|
+ }
|
|
|
+</style>
|