|
@@ -3,7 +3,7 @@
|
|
|
<ie-navbar title="" :hide-back="hideBack" :placeholder="false" bgColor="transparent" />
|
|
<ie-navbar title="" :hide-back="hideBack" :placeholder="false" bgColor="transparent" />
|
|
|
<ie-image :is-oss="true" src="/login-bg.png" custom-class="w-full min-h-350 absolute top-0 left-0 z-1" />
|
|
<ie-image :is-oss="true" src="/login-bg.png" custom-class="w-full min-h-350 absolute top-0 left-0 z-1" />
|
|
|
<ie-image :is-oss="true" src="/login-title.png" custom-class="w-full h-96 mx-auto mt-240" mode="heightFix" />
|
|
<ie-image :is-oss="true" src="/login-title.png" custom-class="w-full h-96 mx-auto mt-240" mode="heightFix" />
|
|
|
- <view class="relative z-2 mx-46 mt-178">
|
|
|
|
|
|
|
+ <view class="relative z-2 mx-46 mt-150">
|
|
|
<view class="ml-18 flex items-center">
|
|
<view class="ml-18 flex items-center">
|
|
|
<view class="text-32" :class="{ 'is-active': loginType === 'card' }" @click="changeLoginType('card')">
|
|
<view class="text-32" :class="{ 'is-active': loginType === 'card' }" @click="changeLoginType('card')">
|
|
|
会员卡登录
|
|
会员卡登录
|
|
@@ -40,6 +40,25 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="mt-84">
|
|
<view class="mt-84">
|
|
|
<ie-button @click="handleLogin">登录</ie-button>
|
|
<ie-button @click="handleLogin">登录</ie-button>
|
|
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
|
|
+ <view class="flex items-center justify-center">
|
|
|
|
|
+ <uv-button v-if="!isAgree" :custom-style="customBtnStyle" :hover-effect="false" type="primary" @click="handleCheckAgree">
|
|
|
|
|
+ <view class="mt-40 flex items-center justify-center gap-10">
|
|
|
|
|
+ <uv-icon name="weixin-circle-fill" color="#66dc79" size="26" />
|
|
|
|
|
+ <text class="text-28 text-primary">一键登录</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </uv-button>
|
|
|
|
|
+ <uv-button v-else :custom-style="customBtnStyle" :hover-effect="false" :disabled="!isAgree" type="primary" text="手机号快捷登录"
|
|
|
|
|
+ icon-color="white" open-type="getPhoneNumber|agreePrivacyAuthorization"
|
|
|
|
|
+ @getphonenumber="handleGetPhoneNumber" @agreeprivacyauthorization="handleAgreePrivacyAuthorization"
|
|
|
|
|
+ @click="handleWxLogin">
|
|
|
|
|
+ <view class="mt-40 flex items-center justify-center gap-10">
|
|
|
|
|
+ <uv-icon name="weixin-circle-fill" color="#66dc79" size="26" />
|
|
|
|
|
+ <text class="text-28 text-primary">一键登录</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </uv-button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <!-- #endif -->
|
|
|
</view>
|
|
</view>
|
|
|
<view class="mt-42 ml-26">
|
|
<view class="mt-42 ml-26">
|
|
|
<uv-checkbox-group v-model="agreePrivacy">
|
|
<uv-checkbox-group v-model="agreePrivacy">
|
|
@@ -63,8 +82,8 @@ import { validatePhone } from '@/hooks/useValidation';
|
|
|
import { useAppConfig } from '@/hooks/useAppConfig';
|
|
import { useAppConfig } from '@/hooks/useAppConfig';
|
|
|
import { verifyCard } from '@/api/modules/user';
|
|
import { verifyCard } from '@/api/modules/user';
|
|
|
import { EnumBindScene, EnumSmsApiType, EnumUserType } from '@/common/enum';
|
|
import { EnumBindScene, EnumSmsApiType, EnumUserType } from '@/common/enum';
|
|
|
-import { login } from '@/api/modules/login';
|
|
|
|
|
-import { LoginRequestDTO, MobileLoginResponseDTO, UserInfo } from '@/types/user';
|
|
|
|
|
|
|
+import { login, wxLogin } from '@/api/modules/login';
|
|
|
|
|
+import { LoginRequestDTO, UserInfo } from '@/types/user';
|
|
|
|
|
|
|
|
const { transferBack, transferTo, routes } = useTransferPage();
|
|
const { transferBack, transferTo, routes } = useTransferPage();
|
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
@@ -80,7 +99,17 @@ const uuid = ref('');
|
|
|
const showPassword = ref(false);
|
|
const showPassword = ref(false);
|
|
|
const rememberPassword = ref([false]);
|
|
const rememberPassword = ref([false]);
|
|
|
const agreePrivacy = ref([false]);
|
|
const agreePrivacy = ref([false]);
|
|
|
|
|
+const loading = ref(false);
|
|
|
|
|
+const isAgree = computed(() => {
|
|
|
|
|
+ return agreePrivacy.value[0];
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
|
|
+const customBtnStyle = {
|
|
|
|
|
+ background: 'none !important',
|
|
|
|
|
+ border: 'none !important',
|
|
|
|
|
+ padding: '0 !important',
|
|
|
|
|
+ width: 'fit-content'
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const changeLoginType = (type: string) => {
|
|
const changeLoginType = (type: string) => {
|
|
|
loginType.value = type;
|
|
loginType.value = type;
|
|
@@ -124,8 +153,7 @@ const loginValidate = () => {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (!agreePrivacy.value[0]) {
|
|
|
|
|
- uni.$ie.showToast('请先阅读并同意用户协议和隐私政策');
|
|
|
|
|
|
|
+ if (!handleCheckAgree()) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
@@ -165,6 +193,50 @@ const submitLogin = async () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const handleCheckAgree = () => {
|
|
|
|
|
+ console.log(isAgree.value, 111)
|
|
|
|
|
+ if (!isAgree.value) {
|
|
|
|
|
+ uni.$ie.showToast('请先阅读并同意用户协议和隐私政策');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function getWxCode() {
|
|
|
|
|
+ const { code, errMsg } = await uni.login();
|
|
|
|
|
+ if (errMsg === 'login:ok' && code) {
|
|
|
|
|
+ return code;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleWxLogin = () => {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ uni.$ie.showLoading();
|
|
|
|
|
+}
|
|
|
|
|
+const handleGetPhoneNumber = async (e: any) => {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ uni.$ie.hideLoading();
|
|
|
|
|
+ if (e.errMsg === 'getPhoneNumber:ok') {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ uni.$ie.showLoading();
|
|
|
|
|
+ const code = await getWxCode();
|
|
|
|
|
+ if (code) {
|
|
|
|
|
+ wxLogin({
|
|
|
|
|
+ phoneCode: e.code,
|
|
|
|
|
+ loginCode: code,
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ console.log('微信登录结果:', res)
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ uni.$ie.hideLoading();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleAgreePrivacyAuthorization = (e: any) => { }
|
|
|
|
|
+
|
|
|
const handleMobileLogin = async (params: LoginRequestDTO) => {
|
|
const handleMobileLogin = async (params: LoginRequestDTO) => {
|
|
|
uni.$ie.showLoading();
|
|
uni.$ie.showLoading();
|
|
|
login(params).then((res) => {
|
|
login(params).then((res) => {
|
|
@@ -203,6 +275,11 @@ const handleMobileLogin = async (params: LoginRequestDTO) => {
|
|
|
console.log('登录失败', err)
|
|
console.log('登录失败', err)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+const handleLoginResponse = () => {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const handleCardLogin = (params: LoginRequestDTO) => {
|
|
const handleCardLogin = (params: LoginRequestDTO) => {
|
|
|
uni.$ie.showLoading();
|
|
uni.$ie.showLoading();
|
|
|
login(params).then(res => {
|
|
login(params).then(res => {
|
|
@@ -266,7 +343,7 @@ onShow(() => {
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
|
rememberPassword.value[0] = userStore.rememberPwd;
|
|
rememberPassword.value[0] = userStore.rememberPwd;
|
|
|
if (import.meta.env.DEV) {
|
|
if (import.meta.env.DEV) {
|
|
|
- agreePrivacy.value = [true];
|
|
|
|
|
|
|
+ // agreePrivacy.value = [true];
|
|
|
phone.value = '17363958504';
|
|
phone.value = '17363958504';
|
|
|
password.value = '1234';
|
|
password.value = '1234';
|
|
|
}
|
|
}
|