|
|
@@ -1,139 +1,81 @@
|
|
|
<template>
|
|
|
<cl-page>
|
|
|
- <cl-topbar safe-area-top background-color="transparent"></cl-topbar>
|
|
|
-
|
|
|
- <view class="px-10">
|
|
|
- <!-- Logo -->
|
|
|
- <view class="flex flex-col items-center justify-center py-20">
|
|
|
- <view class="p-3 bg-white rounded-2xl">
|
|
|
- <cl-image
|
|
|
- src="/static/logo.png"
|
|
|
- mode="widthFix"
|
|
|
- :width="60"
|
|
|
- :height="60"
|
|
|
- ></cl-image>
|
|
|
- </view>
|
|
|
-
|
|
|
- <cl-text :size="18" :pt="{ className: 'font-bold mt-4' }">{{
|
|
|
- config.name
|
|
|
- }}</cl-text>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- 手机号登录 -->
|
|
|
- <login-phone :form="form" @success="toLogin"></login-phone>
|
|
|
-
|
|
|
- <!-- 微信登录 -->
|
|
|
- <login-wx :ref="refs.set('loginWx')"></login-wx>
|
|
|
-
|
|
|
- <!-- 协议 -->
|
|
|
- <view class="mt-6 flex flex-row flex-wrap items-center justify-center">
|
|
|
- <cl-checkbox
|
|
|
- v-model="agree"
|
|
|
- active-icon="checkbox-circle-fill"
|
|
|
- inactive-icon="checkbox-blank-circle-line"
|
|
|
- :pt="{
|
|
|
- icon: {
|
|
|
- size: 18
|
|
|
- }
|
|
|
- }"
|
|
|
- >
|
|
|
- </cl-checkbox>
|
|
|
- <cl-text color="info" :size="12">{{ t("已阅读并同意") }}</cl-text>
|
|
|
- <cl-text
|
|
|
- :size="12"
|
|
|
- :pt="{
|
|
|
- className: 'font-bold'
|
|
|
- }"
|
|
|
- @tap.stop="toDoc(t('用户协议'), 'userAgreement')"
|
|
|
- >
|
|
|
- 《{{ t("用户协议") }}》
|
|
|
- </cl-text>
|
|
|
- <cl-text color="info" :size="12">、</cl-text>
|
|
|
- <cl-text
|
|
|
- :size="12"
|
|
|
- :pt="{
|
|
|
- className: 'font-bold'
|
|
|
- }"
|
|
|
- @tap.stop="toDoc(t('隐私政策'), 'privacyPolicy')"
|
|
|
- >
|
|
|
- 《{{ t("隐私政策") }}》
|
|
|
- </cl-text>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- 第三方登录 -->
|
|
|
- <view class="flex flex-row justify-center mt-10 px-10">
|
|
|
- <view
|
|
|
- class="login-item"
|
|
|
- :class="{
|
|
|
- 'is-dark': isDark
|
|
|
- }"
|
|
|
- @tap="refs.callMethod('loginWx', 'login')"
|
|
|
- >
|
|
|
- <cl-icon name="wechat-fill" :size="18" color="#00b223"></cl-icon>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="login-item" :class="{ 'is-dark': isDark }">
|
|
|
- <cl-icon name="apple-fill" :size="18"></cl-icon>
|
|
|
- </view>
|
|
|
+ <Back />
|
|
|
+ <img src="/static/home/1.jpg" alt="" class="w-full h-full object-cover">
|
|
|
+ <view class="title">
|
|
|
+ 少儿物理启蒙
|
|
|
+ </view>
|
|
|
+ <view class="group">
|
|
|
+ <cl-image src="/static/home/8.png" width="150px" height="150px" mode="heightFix" />
|
|
|
+ <view class="w-[40vw]">
|
|
|
+ <cl-tabs v-model="val" :list="list" :form="formData"></cl-tabs>
|
|
|
+ <cl-form v-model="formData" :pt="{ className: 'mt-1' }">
|
|
|
+ <view v-if="val === 'quickly_login'">
|
|
|
+ <phone :form="formData" />
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ 密码登录
|
|
|
+ </view>
|
|
|
+ <cl-button :pt="{ className: '!h-[45px] !rounded-full w-[200px] mx-auto' }" :loading="loading" @tap="toLogin">
|
|
|
+ 登录
|
|
|
+ </cl-button>
|
|
|
+ </cl-form>
|
|
|
</view>
|
|
|
</view>
|
|
|
</cl-page>
|
|
|
</template>
|
|
|
|
|
|
-<script setup lang="ts">
|
|
|
-import { config } from "@/config";
|
|
|
-import { isDark, parse, router, useRefs, useStore, type Token, t } from "@/.cool";
|
|
|
-import { provide, reactive, ref } from "vue";
|
|
|
-import type { LoginForm } from "./types";
|
|
|
-import { useUi } from "@/uni_modules/cool-ui";
|
|
|
-import LoginPhone from "./components/login/phone.uvue";
|
|
|
-import LoginWx from "./components/login/wx.uvue";
|
|
|
+<script lang="ts" setup>
|
|
|
+import Back from '@/components/back.uvue'
|
|
|
+import type { LoginForm } from "./components/types";
|
|
|
+import phone from './components/phone.uvue';
|
|
|
+import { ref } from 'vue'
|
|
|
+import type { ClTabsItem } from "@/uni_modules/cool-ui";
|
|
|
+import type { user } from '@/.cool';
|
|
|
+const val = ref('quickly_login')
|
|
|
+const list: ClTabsItem[] = [
|
|
|
+ {
|
|
|
+ label: '验证码登录',
|
|
|
+ value: 'quickly_login'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '密码登录',
|
|
|
+ value: 'password'
|
|
|
+ },
|
|
|
+]
|
|
|
+const formData = ref<LoginForm>({
|
|
|
+ username: '17812345678',
|
|
|
+ password: '',
|
|
|
+ randomStr: 0,
|
|
|
+ grant_type: 'password',
|
|
|
+ scope: 'server',
|
|
|
+ loginType: 1,
|
|
|
+ code: ''
|
|
|
+})
|
|
|
+const loading = ref(false)
|
|
|
+function toLogin() {
|
|
|
+ // loading.value = true
|
|
|
+ console.log(formData.value);
|
|
|
|
|
|
-const { user } = useStore();
|
|
|
-const ui = useUi();
|
|
|
-const refs = useRefs();
|
|
|
-
|
|
|
-// 表单
|
|
|
-const form = reactive<LoginForm>({
|
|
|
- phone: "18000000000",
|
|
|
- smsCode: "6666"
|
|
|
-});
|
|
|
-
|
|
|
-// 是否同意
|
|
|
-const agree = ref(false);
|
|
|
-
|
|
|
-// 登录成功
|
|
|
-async function toLogin(res: any) {
|
|
|
- user.setToken(parse<Token>(res)!);
|
|
|
- user.get();
|
|
|
- router.nextLogin();
|
|
|
-}
|
|
|
-
|
|
|
-// 跳转文档
|
|
|
-function toDoc(name: string, path: string) {}
|
|
|
-
|
|
|
-// 是否同意
|
|
|
-function isAgree() {
|
|
|
- if (!agree.value) {
|
|
|
- ui.showToast({
|
|
|
- message: t("请先阅读并同意《用户协议》和《隐私政策》")
|
|
|
- });
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
}
|
|
|
-
|
|
|
-provide("isAgree", isAgree);
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.login-item {
|
|
|
- @apply mx-2 p-2 flex items-center justify-center rounded-full bg-white border border-solid border-surface-100;
|
|
|
+.title {
|
|
|
+ position: absolute;
|
|
|
+ top: 6%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ //设置字间距
|
|
|
+ letter-spacing: 0.1em;
|
|
|
+ @apply text-white text-5xl font-bold;
|
|
|
+}
|
|
|
|
|
|
- &.is-dark {
|
|
|
- @apply border-surface-600 bg-surface-700;
|
|
|
- }
|
|
|
+.group {
|
|
|
+ @apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white px-4 py-2 rounded-xl;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-direction: row;
|
|
|
+ height: 60vh;
|
|
|
}
|
|
|
</style>
|