Skip to content

Commit

Permalink
feat:增加mock数据 && 图片优化
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghang committed Sep 15, 2023
1 parent eb4bb51 commit c298d37
Show file tree
Hide file tree
Showing 44 changed files with 236 additions and 1,638 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docs/** -linguist-documentation
crypto.ts filter=crypto
beforeEach.ts filter=beforeEach
64 changes: 45 additions & 19 deletions mock/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {MockMethod} from "vite-plugin-mock"

import {Random} from "mockjs"
function creataDataItem(data = {}) {
const item = {
"id": "", "title": "首页", "icon": "", "shows": true, "path": "", "order": 1,
Expand All @@ -13,8 +13,35 @@ function creataDataItem(data = {}) {
}
return item
}

export default [
{
url: "/login",
method: "post",
response: () => {
return {
code: 1,
data: {
username: "管理员",
id: Random.id(),
accessToken:Random.id(),
expiresTime: Random.now(),
}
}
}
},
{
url: "/userInfo",
method: "post",
response: () => {
return {
code: 1,
data: {
username: "管理员",
permission:["sys:permission:admin","sys:permission:web"]
}
}
}
},
{
url: "/menus",
method: "post",
Expand Down Expand Up @@ -174,15 +201,14 @@ export default [
"file": "/view/system/log/index.vue",
"icon": "CloudSyncOutlined"
}),
creataDataItem({
id: 207,
"title": "用户中心",
"pid": 200,
"path": "/system/user/center",
"file": "/view/system/user/center/index.vue",
"icon": "PlanetOutline"
}),

// creataDataItem({
// id: 207,
// "title": "用户中心",
// "pid": 200,
// "path": "/system/user/center",
// "file": "/view/system/user/center/index.vue",
// "icon": "PlanetOutline"
// }),
creataDataItem({
id: 301,
"title": "清新图标",
Expand Down Expand Up @@ -223,14 +249,14 @@ export default [
"file": "/view/module/gradient/index.vue",
"icon": "ColorPaletteOutline"
}),
creataDataItem({
id: 307,
"title": "图像裁剪",
"pid": 300,
"path": "/module/cropping",
"file": "/view/module/cropping/index.vue",
"icon": "ImageOutline"
}),
// creataDataItem({
// id: 307,
// "title": "图像裁剪",
// "pid": 300,
// "path": "/module/cropping",
// "file": "/view/module/cropping/index.vue",
// "icon": "ImageOutline"
// }),
creataDataItem({
id: 308,
"title": "卡片描述",
Expand Down
32 changes: 0 additions & 32 deletions mock/login.ts

This file was deleted.

8 changes: 8 additions & 0 deletions mock/mockProdServer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createProdMockServer } from "vite-plugin-mock/es/createProdMockServer"

import app from "./app"
import system from "./system"

export function setupProdMockServer() {
createProdMockServer([...app,...system])
}
6 changes: 3 additions & 3 deletions mock/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ export default [
"createTime": "2022/01/04 15:23:27",
"updateTime": "2022/05/09 16:48:54",
"id": "1",
"name": "品茗科技",
"name": "阿里巴巴",
"order": "",
"pid": ""
},
{
"createTime": "2022/01/04 15:23:27",
"updateTime": "2022/05/09 16:48:54",
"id": "10",
"name": "品茗信息",
"name": "网易科技",
"order": "",
"pid": "1"
},
Expand Down Expand Up @@ -182,7 +182,7 @@ export default [
url: "/dictionary",
method: "post",
response: () => {
const data = []
const data:any = []
for (let i = 0; i < 8; i++) {
data.push({
"createTime": Random.datetime(),
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"pinyin-pro": "^3.16.3",
"qrcode": "^1.5.3",
"solarlunar": "^2.0.7",
"store": "^2.0.12",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"vue-waterfall-plugin-next": "^2.2.3",
Expand Down Expand Up @@ -79,6 +80,7 @@
"unplugin-vue-components": "^0.25.1",
"vfonts": "^0.0.3",
"vite": "^4.4.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-css-injected-by-js": "^3.3.0",
"vite-plugin-mock": "^2.9.6",
"vitepress": "1.0.0-rc.10",
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=0" name="viewport" />
<link rel="icon" type="image/png" href="/web/assets/logo-min.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>bag-admin响应式中后台管理系统</title>
</head>
<body>
Expand Down
5 changes: 5 additions & 0 deletions src/app/admin/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import App from "./App.vue"
import install from "@/packages/install.ts"
import router from "@/app/admin/router"

import {setupProdMockServer} from "__ROOT__/mock/mockProdServer.ts"
if (process.env.NODE_ENV === "production") {
setupProdMockServer()
}

createApp(App).use(install, {
menus: [
// {
Expand Down
27 changes: 11 additions & 16 deletions src/app/admin/view/home/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>
<div class="home-head">
<n-image width="80" style="border-radius: 50%"
src="https://vite.itnavs.com/assets/static/yanghang-c3d6d50c.jpg"></n-image>
:src="headImg"></n-image>
<div style="margin-left: 20px">
<h1 class="title">嗨,{{ tleData.pam }} 今天是{{ tleData.date }} {{ tleData.week }} {{
tleData.time
Expand Down Expand Up @@ -125,7 +125,7 @@ import {menus, timeline} from "@/app/admin/view/home/data.ts"
import * as echarts from "echarts"
import dayjs from "dayjs"
import {useRouter} from "vue-router"
import headImg from "@/packages/assets/yanghang.jpg"
function echartInit() {
const chartDom = document.getElementById("main")
const myChart = echarts.init(chartDom)
Expand All @@ -142,9 +142,7 @@ function echartInit() {
axisTick: {show: false},
axisLabel: {
show: true,
textStyle: {
color: "#a4a4a4",
},
color: "#a4a4a4",
},
axisLine: {
show: true,
Expand All @@ -160,9 +158,7 @@ function echartInit() {
axisTick: {show: false},
axisLabel: {
show: true,
textStyle: {
color: "#a4a4a4",
},
color: "#a4a4a4",
},
axisLine: {
show: true,
Expand Down Expand Up @@ -192,14 +188,12 @@ function echartInit() {
borderRadius: [5, 5, 0, 0],
},
itemStyle: {
normal: {
// 这里就可以实现,配置柱状图的颜色
color: function (params) {
let colorList = ["#1ec4c5", "#1ec4c5", "#FCCE10", "#E87C25", "#fe5558", "#fe5558", "#fe5558"]
return colorList[params.dataIndex]
},
borderRadius: [5, 5, 0, 0],
// 这里就可以实现,配置柱状图的颜色
color: function (params) {
let colorList = ["#1ec4c5", "#1ec4c5", "#FCCE10", "#E87C25", "#fe5558", "#fe5558", "#fe5558"]
return colorList[params.dataIndex]
},
borderRadius: [5, 5, 0, 0],
},
},
]
Expand Down Expand Up @@ -258,7 +252,8 @@ export default defineComponent({
})
return {
tleData,
compData
compData,
headImg
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/view/module/icon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<n-card :segmented="{content: true,footer:true}" header-style="padding:10px" footer-style="padding:10px"
content-style="">
<template #header>
<n-grid y-gap="20" x-gap="20" cols="24" item-responsive responsive="screen">
<n-grid y-gap="20" x-gap="10" cols="24" item-responsive responsive="screen">
<n-grid-item span="24 m:12 l:6">
<n-input-group>
<n-button>搜索</n-button>
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/view/system/branch/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const createColumns = ({compHandle}): DataTableColumns => {

const treeData = [
{
label: "品茗科技",
label: "阿里巴巴",
key: "1",
children: [{label: "数字政务", key: "10"}, {label: "Ai事业部", key: "11"}, {
label: "住建事业部",
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/view/system/dictionary/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const createColumns = ({compHandle}): DataTableColumns => {

const treeData = [
{
label: "品茗科技",
label: "阿里巴巴",
key: "1",
children: [{label: "数字政务", key: "10"}, {label: "Ai事业部", key: "11"}, {
label: "住建事业部",
Expand Down
8 changes: 2 additions & 6 deletions src/app/admin/view/system/member/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@ const createColumns = ({compHandle}): DataTableColumns => {
title: "用户名",
key: "username",
align: "center",
maxWidth: 120,
maxWidth: 100,
ellipsis: true,
},
{
title: "年龄",
key: "age",
align: "center",
ellipsis: true,
maxWidth: 120,
},
{
title: "邮箱",
key: "email",
align: "center",
ellipsis: true,
maxWidth: 120,
},
{
title: "描述",
Expand All @@ -44,14 +42,12 @@ const createColumns = ({compHandle}): DataTableColumns => {
key: "company",
align: "center",
ellipsis: true,
maxWidth: 150,
},
{
title: "坐标",
key: "address",
align: "center",
ellipsis: true,
width: 150,
},
{
title: "操作",
Expand Down Expand Up @@ -105,7 +101,7 @@ const createColumns = ({compHandle}): DataTableColumns => {

const treeData = [
{
label: "品茗科技",
label: "阿里巴巴",
key: "1",
children: [{label: "数字政务", key: "10"}, {label: "Ai事业部", key: "11"}, {
label: "住建事业部",
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/view/system/menu/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const createColumns = ({compHandle}): DataTableColumns => {

const treeData = [
{
label: "品茗科技",
label: "阿里巴巴",
key: "1",
children: [{label: "数字政务", key: "10"}, {label: "Ai事业部", key: "11"}, {
label: "住建事业部",
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/view/system/role/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const createColumns = ({compHandle}): DataTableColumns => {

const treeData = [
{
label: "品茗科技",
label: "阿里巴巴",
key: "1",
children: [{label: "数字政务", key: "10"}, {label: "Ai事业部", key: "11"}, {
label: "住建事业部",
Expand Down
2 changes: 0 additions & 2 deletions src/app/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ declare module 'vue' {
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
NCol: typeof import('naive-ui')['NCol']
NColorPicker: typeof import('naive-ui')['NColorPicker']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDataTable: typeof import('naive-ui')['NDataTable']
Expand Down Expand Up @@ -62,7 +61,6 @@ declare module 'vue' {
NRadioButton: typeof import('naive-ui')['NRadioButton']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NResult: typeof import('naive-ui')['NResult']
NRow: typeof import('naive-ui')['NRow']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
NSpace: typeof import('naive-ui')['NSpace']
Expand Down
2 changes: 1 addition & 1 deletion src/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/web/assets/logo-min.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<title>bag-admin响应式中后台管理系统</title>
<script>
window.AES_KEY = ""
Expand Down
Loading

0 comments on commit c298d37

Please sign in to comment.