🎉 init:初始化项目

This commit is contained in:
sundongyu 2024-05-26 19:02:12 +08:00
commit 83be95aff8
25 changed files with 5478 additions and 0 deletions

15
.eslintrc.cjs Normal file
View File

@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}

30
.gitignore vendored Normal file
View File

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

8
.prettierrc.json Normal file
View File

@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}

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

@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}

39
README.md Normal file
View File

@ -0,0 +1,39 @@
# vite-subpackage
This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
## Type Support for `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Type-Check, Compile and Minify for Production
```sh
npm run build
```
### Lint with [ESLint](https://eslint.org/)
```sh
npm run lint
```

1
env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

4498
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

40
package.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "vite-subpackage",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"axios": "^1.7.2",
"element-plus": "^2.7.3",
"pinia": "^2.1.7",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.8.0",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.12.5",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"npm-run-all2": "^6.1.2",
"prettier": "^3.2.5",
"sass": "^1.77.2",
"typescript": "~5.4.0",
"vite": "^5.2.8",
"vue-tsc": "^2.0.11"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

5
src/App.vue Normal file
View File

@ -0,0 +1,5 @@
<template>
<RouterView />
</template>
<script setup lang="ts"></script>
<style scoped></style>

8
src/api/index.ts Normal file
View File

@ -0,0 +1,8 @@
import request from '@/utils/require'
//查看所有插件
export function posttListAPI(data: any) {
return request.post('/addon/getAddons', data)
}
export function getListAPI(id: any) {
return request.get(`/addon/getAddonByTenantId?tenantId=${id}`)
}

86
src/assets/base.css Normal file
View File

@ -0,0 +1,86 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition:
color 0.5s,
background-color 0.5s;
line-height: 1.6;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

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

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>

After

Width:  |  Height:  |  Size: 276 B

139
src/assets/main.css Normal file
View File

@ -0,0 +1,139 @@
/* CSS Reset */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
box-sizing: border-box; /* Ensure padding and borders are included in element sizes */
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1;
}
ol,
ul {
list-style: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Custom Styles */
body {
background-color: #f7f8fa;
font-family: 'Open Sans', sans-serif;
color: #333;
}

16
src/main.ts Normal file
View File

@ -0,0 +1,16 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/main.css'
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(createPinia())
app.use(ElementPlus)
app.use(router)
app.mount('#app')

24
src/router/index.ts Normal file
View File

@ -0,0 +1,24 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
//@ts-expect-error
component: () => import('@/views/AboutView.vue')
}
]
})
export default router

12
src/stores/counter.ts Normal file
View File

@ -0,0 +1,12 @@
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, doubleCount, increment }
})

33
src/utils/require.ts Normal file
View File

@ -0,0 +1,33 @@
import axios from 'axios'
const request = axios.create({
baseURL: 'http://192.168.1.14:8001', // 基础路径上会携带/api
timeout: 3000 // 超时的时间的设置
})
request.interceptors.request.use(
(config) => {
// const { token } = useTokenStore()
// if (token) {
// config.headers.Authorization = `Bearer ${token}`
// }
return config
},
function (error) {
// 对请求错误做些什么
return Promise.reject(error)
}
)
// 第三步axios响应拦截器
request.interceptors.response.use(
(response) => {
return response.data
},
(error) => {
return Promise.reject(error)
}
)
// 对外暴露
export default request

222
src/views/AboutView.vue Normal file
View File

@ -0,0 +1,222 @@
<template>
<div class="box">
<el-container>
<el-header>
<div class="color">
<el-row :gutter="20">
<el-col :span="5" :offset="4">
<div>
<span style="font-weight: 700">东印科技门店系统</span>|<span
style="font-size: 1.2rem; font-weight: 700"
>商户管理中心</span
>
</div>
</el-col>
<el-col :span="7" :offset="7">
<div>
<span>欢迎您</span>&nbsp;<span>18345120351</span>&nbsp;&nbsp;<span class="button"
>退出</span
>
</div>
</el-col>
</el-row>
</div>
</el-header>
<el-main>
<div style="margin-top: 2rem; margin-bottom: 1rem">
<el-row :gutter="20">
<el-col :span="10" :offset="2"
><div style="font-size: 1.2rem">
基础应用<span style="font-size: 12px; color: #8a8d99"
>(追求简单的运营逻辑首页选)</span
>
</div></el-col
>
</el-row>
</div>
<el-row :gutter="20">
<el-col :span="10" :offset="2"
><div class="card">
<div class="left">
<img
src=""
style="width: 6rem; height: 6rem; border-radius: 0.5rem; margin-right: 1rem"
/>
</div>
<div class="right">
<div>
<div style="font-size: 1.2rem; margin-bottom: 0.8rem">
通用服务业 <span class="right-box">免费试用7天</span>
</div>
<div style="font-size: 1rem; margin-bottom: 0.5rem">适用场景:</div>
<div style="font-size: 12px; margin-bottom: 0.5rem; color: #8a8d99; width: 80%">
通用服务业的入门含有会员余额积分优惠劵抢购活动,次卡套餐等
</div>
</div>
<div class="right-bottom">免费使用</div>
</div>
</div></el-col
>
<el-col :span="10" :offset="2"><div>2</div></el-col>
</el-row>
<div class="classify">
<el-row :gutter="20">
<el-col :span="3" :offset="2">
<div class="classify-left">行业深度解决方案</div>
</el-col>
<el-col
:span="2"
class="classify-right"
v-for="(item, index) in data"
:key="index"
@click="click(index)"
:class="{ active: index === dataIndex }"
>
<div>{{ item.text }}</div>
</el-col>
</el-row>
</div>
<div>
<el-row :gutter="20">
<el-col :span="4" :offset="2">
<div class="cardone">
<div><img src="" style="width: 5rem; height: 5rem; border-radius: 0.5rem" /></div>
<div class="card-textone">汽车多门店预约</div>
<div class="card-texttow">免费使用7天</div>
<div class="card-textthree">气测行业门店预约系统搭载最新的内部群机器人通知</div>
<div class="card-textfour">免费使用</div>
</div>
</el-col>
</el-row>
</div>
</el-main>
</el-container>
</div>
</template>
<script setup>
import { ref } from 'vue'
const data = ref([
{
text: '全部'
},
{
text: '休闲娱乐'
},
{
text: '商城零售'
},
{
text: '运动健康'
},
{
text: '生活服务'
}
])
const dataIndex = ref(0)
function click (index) {
dataIndex.value = index
}
</script>
<style lang="scss" scoped>
.el-header {
padding: 0;
}
.color {
max-width: 100%;
background-color: #4772ff;
color: #fff;
padding-top: 1rem;
padding-bottom: 1rem;
}
.card {
display: flex;
align-items: center;
padding: 1rem;
border-radius: 0.5rem;
background-color: #fff;
transition: transform 0.3s ease;
.right {
display: flex;
align-items: center;
.right-box {
font-size: 0.8rem;
border: 1px solid #fff;
background-color: #ecf1ff;
color: #4772ff;
height: 20px;
border-radius: 10px;
padding: 2px 10px;
width: 80%;
}
.right-bottom {
padding: 0.3rem 0.5rem;
border: 1px solid #4772ff;
color: #4772ff;
font-size: 0.8rem;
}
}
}
.card:hover {
transform: translateY(-10px); /* 向上平移10px */
}
.classify {
margin: 3rem 0 2rem;
font-size: 1.2rem;
.classify-right {
margin-right: 16px;
padding: 0 20px;
height: 32px;
border-radius: 16px;
text-align: center;
line-height: 32px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
}
.active {
color: #fff;
background-color: #4772ff;
}
}
.cardone {
display: flex;
flex-direction: column;
align-content: center;
align-items: center;
height: 300px;
width: 240px;
padding: 30px;
background-color: #fff;
transition: transform 0.3s ease;
.card-textone {
margin-top: 1rem;
font-size: 1.2rem;
}
.card-texttow {
margin-top: 0.5rem;
font-size: 0.8rem;
padding: 0 0.5rem;
background-color: #ecf1ff;
color: #4772ff;
border-radius: 10px;
height: 20px;
}
.card-textthree {
font-size: 0.8rem;
text-align: center;
margin-top: 1rem;
color: #aca3bb;
}
.card-textfour {
padding: 0.5rem 0.8rem;
margin-top: 2rem;
border: 1px solid #4772ff;
color: #4772ff;
}
}
.cardone:hover {
transform: translateY(-10px); /* 向上平移10px */
}
</style>

212
src/views/HomeView.vue Normal file
View File

@ -0,0 +1,212 @@
<template>
<div class="box">
<el-container>
<el-header>
<div class="color">
<el-row :gutter="20">
<el-col :span="5" :offset="4">
<div>
<span style="font-weight: 700">东印科技门店系统</span>|<span
style="font-size: 1.2rem; font-weight: 700"
>商户管理中心</span
>
</div>
</el-col>
<el-col :span="7" :offset="7">
<div>
<span>欢迎您</span>&nbsp;<span>18345120351</span>&nbsp;&nbsp;<span class="button"
>退出</span
>
</div>
</el-col>
</el-row>
</div>
</el-header>
<el-main>
<div class="up">
<el-row>
<el-col :span="4" :offset="3">
<div>
<div class="block">
<el-avatar :size="60" :src="circleUrl" />
<!-- <div style="margin-left: 1rem;" >手机号</div> -->
</div>
</div>
</el-col>
</el-row>
</div>
<div class="centre">
<el-row>
<el-col :span="12" :offset="3">
<div>
<div class="block">
<div style="font-size: 1.2rem; font-weight: 700">
我的商铺(0/10)
<span style="font-size: 0.8rem; color: #a6aec2"
>每个商铺为独立运营的会员是不通用的每个商铺可以邀请合伙人一起管理</span
>
</div>
</div>
</div>
</el-col>
</el-row>
</div>
<div class="below">
<el-row>
<el-col
v-show="data.length !== 0"
v-for="(item, index) in data"
:key="index"
:span="4"
:offset="3"
>
<div @click="enterInto">
<div class="blockone">
<div class="blockone-textone">
{{ item.title }}<span class="blockone-textone-one">(通用服务业)</span
><span class="blockone-textone-tow">创始人</span>
</div>
<div class="blockone-texttow">
开通时间: &nbsp; <span>2024-05-25 15:57:34</span>
</div>
</div>
</div>
</el-col>
<el-col :span="4" :offset="3">
<div @click="block">
<div class="block">
<div style="display: flex; align-items: baseline">
<span style="font-size: 2rem; color: #4772ff">+</span> &nbsp;<span
style="font-size: 1.2rem; font-weight: 700; color: #4772ff"
>创建商城</span
>
</div>
</div>
</div>
</el-col>
</el-row>
</div>
</el-main>
</el-container>
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, toRefs, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { posttListAPI, getListAPI } from '../api/index'
const router = useRouter()
const tenantId = ref(1)
const data: any = ref([])
const state = reactive({
circleUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
})
const { circleUrl } = toRefs(state)
const getList = async () => {
const arr = await getListAPI(tenantId.value)
data.value = arr.data
console.log(arr.data)
}
//
const enterInto = () => {
router.push('/home')
}
//
const block = () => {
router.push('/about')
}
onMounted(() => {
posttListAPI({ id: '', category: '', name: '', tags: '', status: '' })
getList()
})
</script>
<style lang="scss" scoped>
.box {
background-color: #f7f8fa;
.el-header {
padding: 0;
}
.button {
padding: 0.2rem 0.2rem 0.2rem 0.2rem;
border: 1px solid #fff;
border-radius: 5px;
font-size: 0.8rem;
}
.color {
max-width: 99%;
background-color: #4772ff;
color: #fff;
padding-top: 1rem;
padding-bottom: 1rem;
}
.up {
margin: 1.5rem 0;
}
.centre {
margin: 1.5rem 0;
}
.below {
margin: 2rem 0;
transition: transform 0.3s ease;
.blockone {
width: 380px;
height: 100px;
margin: 1rem;
border-radius: 8px;
border: 1px solid #fff;
background-color: #fff;
display: flex;
flex-direction: column;
transition: transform 0.3s ease;
.blockone-textone {
font-size: 1.1rem;
font-weight: 700;
margin-bottom: 1rem;
margin-top: 1.5rem;
margin-left: 0.8rem;
.blockone-textone-one {
font-size: 1rem;
color: #91919b;
}
.blockone-textone-tow {
font-size: 0.7rem;
font-weight: 500;
padding: 0rem 0.5rem;
border: 1px solid #4772ff;
color: #4772ff;
height: 20px;
border-radius: 10px;
margin-left: 8rem;
}
}
.blockone-texttow {
margin-left: 0.7rem;
font-size: 0.8rem;
color: #91919b;
}
}
.blockone:hover {
transform: translateY(-10px); /* 向上平移10px */
}
.block {
width: 380px;
height: 100px;
border-radius: 8px;
margin: 1rem;
border: 1px dashed #4772ff;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.3s ease;
}
.block:hover {
transform: translateY(-10px); /* 向上平移10px */
}
}
}
</style>

14
tsconfig.app.json Normal file
View File

@ -0,0 +1,14 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}

19
tsconfig.node.json Normal file
View File

@ -0,0 +1,19 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"noEmit": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}

25
vite.config.ts Normal file
View File

@ -0,0 +1,25 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
// server: {
// // 配置代理
// proxy: {
// '/addon': {
// target: 'http://192.168.1.14:8001', // 目标服务器的地址
// changeOrigin: true, // 是否改变源开启后服务器接收到的请求头中的Host字段会被设置为目标URL的Host
// rewrite: (path) => path.replace(/^\/addon/, '') // 重写路径,去除请求路径中的'/api'
// }
// }
// }
})