Browse Source

init

master
wxc 2 years ago
commit
b7b9dd950c
  1. 26
      .gitignore
  2. 3
      .vscode/extensions.json
  3. 5
      README.md
  4. 13
      index.html
  5. 23
      package.json
  6. BIN
      public/imgs/bg.png
  7. 1
      public/vite.svg
  8. 11
      src/App.vue
  9. 11
      src/assets/icons/search.svg
  10. 11
      src/assets/icons/write.svg
  11. 1
      src/assets/vue.svg
  12. 29
      src/components/Icon.vue
  13. 16
      src/main.js
  14. 32
      src/router/index.js
  15. 136
      src/style.scss
  16. 43
      src/views/Home.vue
  17. 9
      src/views/error/404.vue
  18. 11
      src/views/mail/Index.vue
  19. 29
      vite.config.js

26
.gitignore vendored

@ -0,0 +1,26 @@
# 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?
.history

3
.vscode/extensions.json vendored

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

5
README.md

@ -0,0 +1,5 @@
# 局长信箱
## 技术栈
- Vue 3 + Vite + vant
- sass

13
index.html

@ -0,0 +1,13 @@
<!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>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

23
package.json

@ -0,0 +1,23 @@
{
"name": "mailbox-outer-h5",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vant": "^4.8.2",
"vue": "^3.3.11",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.5.2",
"sass": "^1.69.7",
"unplugin-auto-import": "^0.17.3",
"vite": "^5.0.8",
"vite-svg-loader": "^5.1.0"
}
}

BIN
public/imgs/bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

1
public/vite.svg

@ -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

11
src/App.vue

@ -0,0 +1,11 @@
<script setup>
</script>
<template>
<router-view />
</template>
<style scoped>
</style>

11
src/assets/icons/search.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

11
src/assets/icons/write.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

1
src/assets/vue.svg

@ -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

29
src/components/Icon.vue

@ -0,0 +1,29 @@
<template>
<div :style="{ fontSize: size ? `${size}px` : '' }">
<IconSvg />
</div>
</template>
<script setup>
const props = defineProps({
name: {
type: String,
require: true,
},
size: {
type: Number,
},
});
let IconSvg = ref(h("template"));
import(`@/assets/icons/${props.name}.svg`).then((data) => {
IconSvg.value = data.render();
});
</script>
<style lang="scss" scoped>
:deep() {
svg {
display: block;
}
}
</style>

16
src/main.js

@ -0,0 +1,16 @@
import { createApp } from 'vue'
import router from './router/index'
import './style.scss'
import 'vant/lib/index.css';
import App from './App.vue'
import { Button, Tab, Tabs } from 'vant';
import Icon from '@/components/Icon.vue'
createApp(App)
.use(router)
.use(Button)
.use(Tab)
.use(Tabs)
.component('Icon', Icon)
.mount('#app')

32
src/router/index.js

@ -0,0 +1,32 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import Mail from '@/views/mail/Index.vue'
import NotFound from '@/views/error/404.vue'
const constantRoutes = [
{
path: '/',
component: Home
},
{
path: '/mail',
component: Mail
},
{
path: '/:catchAll(.*)',
name: 'not-found',
component: NotFound,
meta: {
title: '404'
}
}
];
const router = createRouter({
history: createWebHashHistory(),
routes: constantRoutes
});
export default router;

136
src/style.scss

@ -0,0 +1,136 @@
:root:root {
--primary-color: #184DCF;
--van-blue: var(--primary-color);
}
body {
font-size: 14px;
font-family: PingFang-SC-Heavy;
margin: 0;
--header-height: 8.377vh;
}
#app {
max-width: 1200px;
margin: auto;
}
p {
margin: 0.5em 0;
}
svg {
width: 1em;
}
svg+span {
margin-left: .5em;
}
.none {
display: none;
}
.flex {
display: flex;
}
.flex-inline {
display: inline-flex;
}
.flex.v-center, .flex-inline.v-center {
align-items: center;
}
.flex.center, .flex-inline.center {
justify-content: center;
}
.flex.between, .flex-inline.between {
justify-content: space-between;
}
.flex.end, .flex-inline.end {
justify-content: flex-end;
}
.flex.wrap, .flex-inline.wrap {
flex-wrap: wrap;
}
.flex.max-content, .flex-inline.max-content {
width: max-content;
}
.flex.gap, .flex-inline.gap {
gap: 0 8px;
}
.flex.gap-10 {
gap: 0 10px;
}
.flex.gap-16 {
gap: 0 16px;
}
.text-center {
text-align: center;
}
.text-nowrap {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.text-wrap {
white-space: pre-wrap;
}
.container {
padding: 18px 36px;
}
.pointer:hover {
cursor: pointer;
}
.relative {
position: relative;
}
.ml-4 {
margin-left: 4px;
}
.ml-8 {
margin-left: 8px;
}
.ml-10 {
margin-left: 10px;
}
.mr-4 {
margin-right: 4px;
}
.mr-8 {
margin-right: 8px;
}
.mr-10 {
margin-right: 10px;
}
.mr-20 {
margin-right: 20px;
}
.mt-8 {
margin-top: 8px;
}
.mt-10 {
margin-top: 10px;
}
.mt-20 {
margin-top: 20px;
}
.mb-8 {
margin-bottom: 8px;
}
.mb-10 {
margin-bottom: 10px;
}
.mb-20 {
margin-bottom: 20px;
}
.mb-40 {
margin-bottom: 40px;
}

43
src/views/Home.vue

@ -0,0 +1,43 @@
<template>
<header>
<img src="/imgs/bg.png" alt="">
</header>
<main>
<div class="flex gap-10 center mt-20">
<a class="flex v-center center gap-16" @click="router.push('/mail')">
<Icon name="write" :size="48" />
<span>我要写信</span>
</a>
<a class="flex v-center center gap-16">
<Icon name="search" :size="48" />
<span>回复查询</span>
</a>
</div>
<p class="text-center mt-20">局长信箱只接受实名举报投诉不受理报警业务</p>
<p class="text-center">如遇紧急情况请拨打110</p>
</main>
</template>
<script setup>
import { useRouter } from 'vue-router'
const router = useRouter()
</script>
<style lang="scss" scoped>
header {
img {
width: 100%;
}
}
a {
width: 45.2%;
height: 84px;
text-decoration: none;
border: 1px solid var(--primary-color);
color: var(--primary-color);
font-weight: bold;
font-size: 18px;
&:hover {
cursor: pointer;
}
}
</style>

9
src/views/error/404.vue

@ -0,0 +1,9 @@
<template>
<h1>404</h1>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

11
src/views/mail/Index.vue

@ -0,0 +1,11 @@
<template>
<van-tabs v-model:active="active">
<van-tab title="我要写信">我要写信</van-tab>
<van-tab title="我的信件">我的信件</van-tab>
<van-tab title="草稿箱">草稿箱</van-tab>
</van-tabs>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

29
vite.config.js

@ -0,0 +1,29 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import svgLoader from 'vite-svg-loader'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
svgLoader(),
AutoImport({
imports: [
'vue'
]
}),
],
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
// 设置路径
'~': path.resolve(__dirname, './'),
// 设置别名
'@': path.resolve(__dirname, './src/')
},
// https://cn.vitejs.dev/config/#resolve-extensions
extensions: ['.js']
},
})
Loading…
Cancel
Save