expressgy 2 years ago
parent 308578ae62
commit fc5d6cc0c3
  1. 4
      Ying-Drosophila/package.json
  2. 36
      Ying-Drosophila/pnpm-lock.yaml
  3. 23
      Ying-Drosophila/src/App.jsx
  4. 69
      Ying-Drosophila/src/App.module.scss
  5. 21
      Ying-Drosophila/src/assets/default.css
  6. 15
      Ying-Drosophila/src/assets/default.scss
  7. BIN
      Ying-Drosophila/src/assets/index.png
  8. 15
      Ying-Drosophila/src/components/RouterAuth/index.jsx
  9. 10
      Ying-Drosophila/src/main.jsx
  10. 34
      Ying-Drosophila/src/router/index.jsx
  11. 58
      Ying-Drosophila/src/store/default.js
  12. 3
      Ying-Drosophila/src/store/index.js
  13. 23
      Ying-Drosophila/src/view/Home/index.jsx
  14. 59
      Ying-Drosophila/src/view/Home/index.module.scss
  15. 27
      Ying-Drosophila/src/view/Index/index.jsx
  16. 107
      Ying-Drosophila/src/view/Index/index.module.scss

@ -4,13 +4,15 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"start": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"mobx": "^6.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.6.1",
"sass": "^1.57.1"
},
"devDependencies": {

@ -4,14 +4,18 @@ specifiers:
'@types/react': ^18.0.26
'@types/react-dom': ^18.0.9
'@vitejs/plugin-react': ^3.0.0
mobx: ^6.7.0
react: ^18.2.0
react-dom: ^18.2.0
react-router-dom: ^6.6.1
sass: ^1.57.1
vite: ^4.0.0
dependencies:
mobx: 6.7.0
react: registry.npmmirror.com/react/18.2.0
react-dom: registry.npmmirror.com/react-dom/18.2.0_react@18.2.0
react-router-dom: 6.6.1_biqbaboplfbrettd7655fr4n2y
sass: 1.57.1
devDependencies:
@ -220,6 +224,11 @@ packages:
dev: true
optional: true
/@remix-run/router/1.2.1:
resolution: {integrity: sha512-XiY0IsyHR+DXYS5vBxpoBe/8veTeoRpMHP+vDosLZxL5bnpetzI0igkxkLZS235ldLzyfkxF+2divEwWHP3vMQ==}
engines: {node: '>=14'}
dev: false
/anymatch/3.1.3:
resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
engines: {node: '>= 8'}
@ -293,6 +302,10 @@ packages:
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
engines: {node: '>=0.12.0'}
/mobx/6.7.0:
resolution: {integrity: sha512-1kBLBdSNG2bA522HQdbsTvwAwYf9hq9FWxmlhX7wTsJUAI54907J+ozfGW+LoYUo06vjit748g6QH1AAGLNebw==}
dev: false
/normalize-path/3.0.0:
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'}
@ -301,6 +314,29 @@ packages:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'}
/react-router-dom/6.6.1_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-u+8BKUtelStKbZD5UcY0NY90WOzktrkJJhyhNg7L0APn9t1qJNLowzrM9CHdpB6+rcPt6qQrlkIXsTvhuXP68g==}
engines: {node: '>=14'}
peerDependencies:
react: '>=16.8'
react-dom: '>=16.8'
dependencies:
'@remix-run/router': 1.2.1
react: registry.npmmirror.com/react/18.2.0
react-dom: registry.npmmirror.com/react-dom/18.2.0_react@18.2.0
react-router: 6.6.1_react@18.2.0
dev: false
/react-router/6.6.1_react@18.2.0:
resolution: {integrity: sha512-YkvlYRusnI/IN0kDtosUCgxqHeulN5je+ew8W+iA1VvFhf86kA+JEI/X/8NqYcr11hCDDp906S+SGMpBheNeYQ==}
engines: {node: '>=14'}
peerDependencies:
react: '>=16.8'
dependencies:
'@remix-run/router': 1.2.1
react: registry.npmmirror.com/react/18.2.0
dev: false
/readdirp/3.6.0:
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'}

@ -1,23 +1,14 @@
import { useState } from 'react'
import css from './App.module.scss'
import {useState} from 'react'
import { useRoutes } from 'react-router-dom'
import indexRouterList from "./router"
function App() {
const [count, setCount] = useState(0)
export default function App() {
const indexRoute = useRoutes(indexRouterList)
return (
<div className={css.App}>
<div className={css.title_container}>
<div className={css.title}>
<div>Hello </div>
<div className={css.space}></div>
<div className={css.reversal}>
<div className={css.base}>&nbsp;World&nbsp;</div>
<div className={css.face}>&nbsp;World&nbsp;</div>
</div>
</div>
</div>
<div className="App">
{indexRoute}
</div>
)
}
export default App

@ -1,69 +0,0 @@
$sign:sign;
.App {
position: relative;
height: 100vh;
width: 100vw;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
.title_container {
position: relative;
font-size: 4rem;
line-height: 1.5em;
.title {
position: relative;
display: flex;
letter-spacing: 0.3em;
font-weight: bold;
.space {
position: relative;
width: 1em;
}
.reversal {
position: relative;
.base {
position: relative;
}
.face {
position: absolute;
width: 0;
top: 0;
left: 0;
color: #fefefe;
background-color: #333;
overflow: hidden;
// animation: sign linear 600ms forwards;
animation:{
name:sign;
timing-function: linear;
duration: 400ms;
delay:1000ms;
fill-mode: forwards;
// iteration-count: infinite;
}
// animation-name 规定需要绑定到选择器的 keyframe 名称
// animation-duration 规定完成动画所花费的时间以秒或毫秒计
// animation-timing-function 规定动画的速度曲线
// animation-delay 规定在动画开始之前的延迟
// animation-iteration-count 规定动画应该播放的次数
// animation-direction 规定是否应该轮流反向播放动画
}
}
}
}
}
@keyframes sign {
from{
width: 0;
}
to{
width: 100%;
}
}

@ -1,20 +1,3 @@
.widthAuto{
/*div宽度适应文字*/
width:fit-content;
width:-webkit-fit-content;
width:-moz-fit-content;
}
.noselect{
/*无法选中*/
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}
html{
font-size: 62.5%;
}
@ -26,7 +9,7 @@ body {
/* 'Cantarell', */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color:#666;
color:#333;
}
p, h1, h2, h3, h4, h5, h6{
margin: 0;
@ -37,7 +20,7 @@ ul, ol { list-style:none; }
textarea { resize:none; }
img {border:0; vertical-align:middle;}
a{color:#666; text-decoration:none; }
a{color:#333; text-decoration:none; }
a:hover{color:#C81623;}
h1,h2,h3,h4,h5,h6{text-decoration:none;font-weight:normal;}
s,i,em{font-style:normal;text-decoration:none;}

@ -0,0 +1,15 @@
@mixin widthAuto{
/*div宽度适应文字*/
width:fit-content;
width:-webkit-fit-content;
width:-moz-fit-content;
}
@mixin noSelect{
/*无法选中*/
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

@ -0,0 +1,15 @@
import {useNavigate, useLocation} from "react-router-dom";
import {useEffect} from "react";
export default function RouterAuth(props){
const navigate = useNavigate();
const location = useLocation();
useEffect(() => {
const path = window.location.pathname
// console.log(location)
if(path == '/homes'){
navigate('/home')
}
})
return props.children
}

@ -1,10 +1,16 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import {BrowserRouter} from "react-router-dom";
import App from './App'
import './assets/default.css'
import RouterAuth from "./components/RouterAuth";
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
<BrowserRouter>
<RouterAuth>
<App/>
</RouterAuth>
</BrowserRouter>
</React.StrictMode>
)

@ -0,0 +1,34 @@
import { Navigate } from 'react-router-dom'
import Index from '../view/Index'
import Home from '../view/Home'
export default [
//
{
path:'/',
element: <Index />
},
// {
// path:'/signIn',
// element: <SignIn />
// },
// {
// path:'/signUp',
// element: <SignUp />
// },
{
path: '/home',
element: <Home />,
// children:[
// {
// path:'setting',
// element: <Setting />
// }
// ]
},
{
path: "",
element: <Navigate to="/" replace />
}
]

@ -0,0 +1,58 @@
import { observable, action, computed, makeObservable} from "mobx";
class DefaultStore {
// Token
token = null;
// 登陆时的注册名称
signInUsername = null;
// home页跳转状态
homePageGotoStatus = true;
// 用户信息
userInfo = null;
name = 'kangkang000';
sex = '男';
userObj = {
name: 'kangkang000',
age: 23,
token: '12345689'
}
constructor() {
// mobx6 和以前版本这是最大的区别
makeObservable(this, {
token:observable,
signInUsername:observable,
homePageGotoStatus:observable,
userInfo:observable,
name: observable,
sex: observable,
userObj: observable,
setName: action,
titleName: computed
});
}
setName(v) {
console.log('触发action');
this.name = v;
}
setUserObj(obj) {
this.userObj = obj;
}
get titleName(){
return this.name+'___111';
}
get userObject() {
return this.userObj;
}
}
export default DefaultStore

@ -0,0 +1,3 @@
import DefaultStore from './default'
export const defaultStore = new DefaultStore()

@ -0,0 +1,23 @@
import {defaultStore} from "../../store";
import css from './index.module.scss'
export default function Home() {
console.log(defaultStore.titleName)
return (
<div className={css.Home}>
<header>
<div className={css.container}>
<nav>
<div className={css.content}>
<div className={css.sub}></div>
{/* <div className={css.sup}></div> */}
<div className={css.text}>词海</div>
</div>
</nav>
</div>
</header>
</div>
)
}

@ -0,0 +1,59 @@
@import '../../assets/default.scss';
.Home {
position: relative;
height: 100vh;
width: 100vw;
overflow: hidden;
&>header {
position: relative;
width: 100%;
&>.container {
position: relative;
width: 80%;
max-width: 1200px;
margin: 0 auto;
&>nav {
position: relative;
width: 100%;
display: flex;
margin: 1rem;
&>div.content {
@include widthAuto;
position: relative;
border: 1px solid #33333399;
box-sizing: border-box;
padding: 1rem 1.5rem;
cursor: pointer;
letter-spacing: 0.5rem;
&>div.sub {
position: absolute;
left: -0.8rem;
bottom: -0.5rem;
background-color: #99999999;
width: calc(100% + 0.6rem);
height: calc(100% + 0.3rem);
}
&>div.sup {
position: absolute;
right: -0.8rem;
top: -0.4rem;
background-color: #aaaaaa99;
width: calc(100% + 0.5rem);
height: calc(100% + 0.7rem);
}
&>div.text{
position: relative;
font-size: 1.4rem;
}
}
}
}
}
}

@ -0,0 +1,27 @@
import { useState } from 'react'
import css from './index.module.scss';
import {useNavigate} from 'react-router-dom'
function App() {
const [count, setCount] = useState(0)
const navigate = useNavigate()
return (
<div className={css.index} onClick={() => navigate('/home')}>
<div className={css.title_container}>
<div className={css.title}>
<div>HELLO </div>
<div className={css.space}></div>
<div className={css.reversal}>
<div className={css.base}>&nbsp;WORL<span style={{letterSPace:'0'}}>D&nbsp;</span></div>
<div className={css.face}>&nbsp;WORL<span style={{letterSPace:'0'}}>D&nbsp;</span></div>
</div>
</div>
<div className={css.describe}>死生契阔与子成说执子之手与子偕老</div>
</div>
</div>
)
}
export default App

@ -0,0 +1,107 @@
@import '../../assets/default.scss';
$sign: sign;
.index {
@include noSelect;
position: relative;
height: 100vh;
width: 100vw;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: {
image: url('../../assets/index.png');
position: center 100%;
repeat: no-repeat;
size: cover;
}
;
&::before {
content: '';
background-color: #cccccc33;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
backdrop-filter: blur(20px);
}
.title_container {
position: relative;
font-size: 4rem;
line-height: 1.6em;
.title {
position: relative;
display: flex;
letter-spacing: 0.1em;
font-weight: bold;
.space {
position: relative;
width: 1em;
}
.reversal {
position: relative;
.base {
position: relative;
}
.face {
position: absolute;
width: 0;
top: 0;
left: 0;
color: #fefefe;
background-color: #333;
overflow: hidden;
// animation: sign linear 600ms forwards;
animation: {
name: sign;
timing-function: linear;
duration: 400ms;
delay: 1000ms;
fill-mode: forwards;
// iteration-count: infinite;
}
;
// animation-name 规定需要绑定到选择器的 keyframe 名称
// animation-duration 规定完成动画所花费的时间以秒或毫秒计
// animation-timing-function 规定动画的速度曲线
// animation-delay 规定在动画开始之前的延迟
// animation-iteration-count 规定动画应该播放的次数
// animation-direction 规定是否应该轮流反向播放动画
}
}
}
.describe {
position: relative;
font-family: serif;
font-size: 1.3rem;
letter-spacing: 0.5rem;
text-align: center;
text-align-last:justify;
}
}
}
@keyframes sign {
from {
width: 0;
}
to {
width: 100%;
}
}
Loading…
Cancel
Save