frist commit

main
old易 2024-09-26 22:28:13 +08:00
commit 8487391c9f
13 changed files with 1442 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).

53
index.html Normal file
View File

@ -0,0 +1,53 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>授权登录-上海一草一木教育科技有限公司</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-image: url('https://static-data-ycymedu.oss-cn-shanghai.aliyuncs.com/backgroundImage.png');
background-size: cover;
background-position: center;
position: relative; /* 设置为相对定位,以便绝对定位的元素相对于它 */
overflow: hidden; /* 隐藏滚动条 */
}
#app {
position: relative;
z-index: 1;
}
.copyright {
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin: 0;
padding: 10px 20px;
font-size: 0.8em;
color: #666;
text-align: center;
width: 100%;
background-color: rgba(255, 255, 255, 0.9);
}
</style>
</head>
<body>
<div id="app">
<!-- 主要内容 -->
</div>
<!-- 添加版权信息 -->
<p class="copyright">© 2014-2024 www.ycymedu.com 上海一草一木教育科技有限公司</p>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1018
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "sso-web",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"sso-web": "file:",
"vue": "^3.4.37"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.2",
"vite": "^5.4.1"
}
}

1
public/vite.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

13
src/App.vue Normal file
View File

@ -0,0 +1,13 @@
<script setup>
import LoginComponent from './components/Login.vue';
</script>
<template>
<div>
<LoginComponent />
</div>
</template>
<style scoped>
/* Your global styles here */
</style>

1
src/assets/vue.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

214
src/components/Login.vue Normal file
View File

@ -0,0 +1,214 @@
<template>
<div class="login-container">
<div class="login-box">
<!-- 添加 logo -->
<img class="logo" src="https://static-data-ycymedu.oss-cn-shanghai.aliyuncs.com/logo.png" alt="logo" />
<!-- 选项卡 -->
<div class="tabs">
<div class="tab" :class="{ active: selectedTab === 'wechat' }" @click="switchTab('wechat')"></div>
<div class="tab" :class="{ active: selectedTab === 'phone' }" @click="switchTab('phone')"></div>
<div class="tab" :class="{ active: selectedTab === 'password' }" @click="switchTab('password')"></div>
</div>
<!-- 账号密码登录 -->
<div v-if="selectedTab === 'password'">
<input type="text" placeholder="用户名或邮箱" v-model="username" />
<input type="password" placeholder="密码" v-model="password" />
<button @click="login"></button>
</div>
<!-- 手机号验证码登录 -->
<div v-if="selectedTab === 'phone'">
<input type="text" placeholder="手机号" v-model="phone" />
<div class="verification-row">
<input type="text" placeholder="验证码" v-model="verificationCode" />
<button @click="startCountdown" :disabled="countdown !== null">
{{ countdown !== null ? `${countdown} 秒后重新发送` : '获取验证码' }}
</button>
</div>
<button @click="login"></button>
</div>
<!-- 微信扫码登录 -->
<div v-if="selectedTab === 'wechat'">
<div class="qr-code">
<img src="https://via.placeholder.com/150?text=WeChat+QR+Code" alt="微信扫码登录" />
</div>
<p>使用微信扫码登录</p>
</div>
</div>
</div>
</template>
<script>
import { ref } from 'vue';
export default {
setup() {
const selectedTab = ref('password'); //
const countdown = ref(null); //
const username = ref('');
const password = ref('');
const phone = ref('');
const verificationCode = ref('');
//
const switchTab = (tab) => {
selectedTab.value = tab;
};
//
const startCountdown = () => {
const duration = 60; //
let remainingTime = duration;
countdown.value = remainingTime;
const intervalId = setInterval(() => {
if (remainingTime > 0) {
remainingTime--;
countdown.value = remainingTime;
} else {
clearInterval(intervalId);
countdown.value = null;
}
}, 1000);
};
// ()
const login = () => {
alert('登录功能尚未实现');
};
return {
selectedTab,
countdown,
username,
password,
phone,
verificationCode,
switchTab,
startCountdown,
login,
};
},
};
</script>
<style scoped>
.login-container {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden; /* 隐藏滚动条 */
background-image: url('https://static-data-ycymedu.oss-cn-shanghai.aliyuncs.com/backgroundImage.png');
background-size: cover;
background-position: center;
position: relative; /* 设置为相对定位,以支持绝对定位的子元素 */
padding-bottom: 60px; /* 为底部版权信息预留空间 */
}
.login-box {
background-color: white;
padding: 50px 30px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 90%;
max-width: 400px;
text-align: center;
box-sizing: border-box;
margin-bottom: 30px; /* 增加底部边距 */
margin: 0 auto; /* 居中 */
}
.logo {
max-width: 80%;
height: auto;
margin-bottom: 20px;
}
.tabs {
display: flex;
justify-content: space-around;
margin-bottom: 20px;
}
.tab {
cursor: pointer;
padding: 10px 20px;
border-bottom: 2px solid transparent;
}
.tab.active {
border-bottom: 2px solid #1e88e5;
color: #1e88e5;
}
input {
width: 100%;
padding: 10px 15px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
input:focus {
border-color: #1e88e5;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(30, 136, 229, 0.5);
}
button {
width: 100%;
padding: 10px 15px;
background-color: #1e88e5;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
box-sizing: border-box;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
button:hover {
background-color: #177ddc;
}
button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
.verification-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.verification-row input {
width: calc(100% - 120px); /* 确保输入框宽度 */
margin-right: 10px;
}
.qr-code {
margin-top: 20px;
}
/* 响应式布局 */
@media screen and (min-width: 768px) { /* 平板及更大屏幕 */
.login-container {
padding-bottom: 0; /* 移除底部padding */
}
.login-box {
width: 400px; /* 固定宽度 */
margin: 0 auto; /* 水平居中 */
}
}
</style>

5
src/main.js Normal file
View File

@ -0,0 +1,5 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')

79
src/style.css Normal file
View File

@ -0,0 +1,79 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
.card {
padding: 2em;
}
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

7
vite.config.js Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
})