From 14223e89c57592e9d030a962bba9e9ca85b2a75c Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Mon, 15 Feb 2021 02:58:35 +0800 Subject: [PATCH] init --- .gitignore | 8 +++ Dockerfile | 12 ++++ index.html | 13 ++++ mock/test.ts | 29 ++++++++ package.json | 30 ++++++++ public/favicon.ico | Bin 0 -> 4286 bytes src/App.vue | 51 ++++++++++++++ src/assets/logo.png | Bin 0 -> 6849 bytes src/assets/scss/style.scss | 11 +++ src/components/AsyncComponent.vue | 28 ++++++++ src/components/Email.vue | 110 ++++++++++++++++++++++++++++++ src/components/Home.vue | 13 ++++ src/components/Vue3.vue | 49 +++++++++++++ src/interface.ts | 1 + src/main.ts | 11 +++ src/request.ts | 13 ++++ src/router.ts | 22 ++++++ src/store.ts | 16 +++++ tsconfig.json | 14 ++++ vite.config.ts | 9 +++ vue.app.conf | 9 +++ 21 files changed, 449 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 index.html create mode 100644 mock/test.ts create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 src/App.vue create mode 100644 src/assets/logo.png create mode 100644 src/assets/scss/style.scss create mode 100644 src/components/AsyncComponent.vue create mode 100644 src/components/Email.vue create mode 100644 src/components/Home.vue create mode 100644 src/components/Vue3.vue create mode 100644 src/interface.ts create mode 100644 src/main.ts create mode 100644 src/request.ts create mode 100644 src/router.ts create mode 100644 src/store.ts create mode 100644 tsconfig.json create mode 100644 vite.config.ts create mode 100644 vue.app.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e05420f --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +node_modules +.DS_Store +dist +dist-ssr +*.local +/yarn.lock +*.log +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..729764b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM nginx:alpine + +ADD vue.app.conf /etc/nginx/conf.d/ + +ADD dist /app + +RUN mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.bak \ +&& dos2unix /etc/nginx/conf.d/vue.app.conf + +EXPOSE 9000 + +ENTRYPOINT ["nginx","-g","daemon off;"] \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..11603f8 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + +
+ + + +Rz$KlnO_H2c< z(XX#lPuW_%H#Q+c&(nRyX1-Ia dKR-%$4FYC0fsCmL9ky3 zKpxyjd^JFR+vg2!=HWf}2Z?@Td`0EG`kU?{8zKrvtsm)|7>pPk9nu@2^z96aU2<#` z2QhvH5w&V;wER?mopu+nqu*n8p~(%Q kwSs&*0eJwa zMXR05`OSFpfyRb! Y_+H@O%Y z0=K^y6B8Gcbl?SA)qMP3Z+=C(?8zL@=74R=EVnE?vY!1BQy2@q*RUgRx4yJ$k}MnL zs!?74QciNb-LcG*&o<9=DSL>1n}ZNd)w1z3-0Pd^4ED1{qd=9|!!N?xnXjM!EuylY z5=!H>&hSofh8V?Jofyd!h`xDI1fYAuV(sZwwN~{$a}MX^=+0TH*SFp$vyxmUv7C*W zv^3Gl0+eTFgBi3FVD;$nhcp)ka*4gSskYIqQ&+M}xP9yLAkWzBI^I%zR^l1e?bW_6 zIn{mo{dD=)9@V?s^fa55jh78rP*Ze<3`tRCN4*mpO$@7a^*2B*7N_|A(Ve2VB|)_o z$=#_=aBkhe(ifX}MLT()@5? OV+~7cXC3r!%{QJxriXo9I%*3q4KT4Xxzyd{ z9;_%=W%q!Vw$Z7F3lUnY+1HZ*lO;4;VR2+i4+D(m#01OYq|L_fbnT;KN<^dkkCwtd zF7n+O7KvAw8c`JUh6LmeIrk4`F3o|AagKSMK3))_5Cv~y2Bb2!Ibg9BO7Vkz?pAYX zoI=B}+$R22&IL`NCYUYjrdhwjnM x_v=-Qcx-jmtN>!Zqf|n1^SWrHy zK|MwJ?Z#^>)rfT5YSY{qjZ&`Fjd;^vv&gF-Yj6$9-Dy$<6zeP4s+78gS2|t%Z309b z0^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cwQuFIs7ZDOqO_fGf8Q`8MwL}eUp>q?4eqCmOTcwQuXtQckPy|4F1on8l zP*h>d+cH#XQf|+6c|S{7SF(Lg>bR~l(0uY?O{OEVlaxa5@e%T&xju=o1`=OD#qc16 zSvyH*my(dcp6~VqR;o(#@m44Lug@~_qw+HA=mS#Z^ 4reBy8iV?H~I;{LQWk3aKK8$bLRyt$g?- + 一个异步组件
+ + + + + \ No newline at end of file diff --git a/src/components/Email.vue b/src/components/Email.vue new file mode 100644 index 0000000..7411bc6 --- /dev/null +++ b/src/components/Email.vue @@ -0,0 +1,110 @@ + ++ ++ ++ 当前邮箱 + ++ ++ ++ 新邮箱 + ++ ++ ++ 验证码 + ++ +{{ sendCodeTip }} ++ + + + + + \ No newline at end of file diff --git a/src/components/Home.vue b/src/components/Home.vue new file mode 100644 index 0000000..fc68eea --- /dev/null +++ b/src/components/Home.vue @@ -0,0 +1,13 @@ + ++ +更换邮箱 ++ + +返回 +主页
+ + + + + \ No newline at end of file diff --git a/src/components/Vue3.vue b/src/components/Vue3.vue new file mode 100644 index 0000000..72a9f9d --- /dev/null +++ b/src/components/Vue3.vue @@ -0,0 +1,49 @@ + +{{num}}*2={{double}}
+{{num2.count}}*3={{triple}}
+ + + + + + + + \ No newline at end of file diff --git a/src/interface.ts b/src/interface.ts new file mode 100644 index 0000000..bfcc396 --- /dev/null +++ b/src/interface.ts @@ -0,0 +1 @@ +export const sendCodeApi='/api/change/email' \ No newline at end of file diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..f708889 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,11 @@ +import {createApp} from 'vue' +// TypeScript error? Run VSCode command +// TypeScript: Select TypeScript version - > Use Workspace Version +import App from './App.vue' +import Element3 from 'element3' +import 'element3/lib/theme-chalk/index.css' +import './assets/scss/style.scss' +import {store} from "./store"; +import {router} from "./router"; + +createApp(App).use(router).use(store).use(Element3).mount('#app') diff --git a/src/request.ts b/src/request.ts new file mode 100644 index 0000000..51c4881 --- /dev/null +++ b/src/request.ts @@ -0,0 +1,13 @@ +import {sendCodeApi} from "./interface"; + +/** + * 发送验证码 + * @param userEmail + */ +export function sendCode(userEmail:string){ + return fetch(new Request(sendCodeApi,{method:'POST',body:JSON.stringify({userEmail})})) +} + +export function changeEmail(oldEmail:string,newEmail:string,code:string){ + +} \ No newline at end of file diff --git a/src/router.ts b/src/router.ts new file mode 100644 index 0000000..2a8f67f --- /dev/null +++ b/src/router.ts @@ -0,0 +1,22 @@ +// 1. 定义路由组件. +// 也可以从其他文件导入 +import {createRouter, createWebHashHistory} from "vue-router"; +import Email from "./components/Email.vue"; +import Home from "./components/Home.vue"; + +// 2. 定义一些路由 +// 每个路由都需要映射到一个组件。 +// 我们后面再讨论嵌套路由。 +const routes = [ + {path:'/',component: Home}, + { path: '/email', component: Email }, +] + +// 3. 创建路由实例并传递 `routes` 配置 +// 你可以在这里输入更多的配置,但我们在这里 +// 暂时保持简单 +export const router = createRouter({ + // 4. 内部提供了 history 模式的实现。为了简单起见,我们在这里使用 hash 模式。 + history: createWebHashHistory(), + routes, // `routes: routes` 的缩写 +}) diff --git a/src/store.ts b/src/store.ts new file mode 100644 index 0000000..6e58590 --- /dev/null +++ b/src/store.ts @@ -0,0 +1,16 @@ +import {createStore} from "vuex"; + +export const store = createStore({ + state: () => ({ + user: { + email: '1029559041@qq.com' + } + }), + mutations: { + setUser(state, user) { + // @ts-ignore + state.user = user + } + } + +}) \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..8c7115f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "lib": ["esnext", "dom"], + "types": ["vite/client"], + "plugins": [{ "name": "@vuedx/typescript-plugin-vue" }] + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..fc5c6fb --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,9 @@ +import {defineConfig} from 'vite' +import vue from '@vitejs/plugin-vue' +import {viteMockServe} from "vite-plugin-mock"; + + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue(),viteMockServe({})] +}) diff --git a/vue.app.conf b/vue.app.conf new file mode 100644 index 0000000..5f1feff --- /dev/null +++ b/vue.app.conf @@ -0,0 +1,9 @@ +server { + listen 9000; + + location / { + root /app; + index index.html; + try_files $uri $uri/ /index.html last; + } +} \ No newline at end of file