diff --git a/mock/community.ts b/mock/community.ts new file mode 100644 index 0000000..10623fe --- /dev/null +++ b/mock/community.ts @@ -0,0 +1,42 @@ +import { defineFakeRoute } from 'vite-plugin-fake-server/client'; + +const randomNumber = (range: number = 100) => { + return parseInt((Math.random() * range).toFixed(0)); +}; + +export default defineFakeRoute([ + { + url: 'community-statistics', + method: 'GET', + response: () => ({ + code: 200, + data: [ + { + name: '统计人口', + total: randomNumber(9999), + subtitle: `${randomNumber()}%`, + subTotal: randomNumber(99999), + }, + { + name: '统计人口', + total: randomNumber(9999), + subtitle: `${randomNumber()}%`, + subTotal: randomNumber(99999), + }, + { + name: '统计人口', + total: randomNumber(9999), + subtitle: `${randomNumber()}%`, + subTotal: randomNumber(99999), + }, + { + name: '统计人口', + total: randomNumber(9999), + subtitle: `${randomNumber()}%`, + subTotal: randomNumber(99999), + }, + ], + message: '操作成功', + }), + }, +]); diff --git a/public/images/community/bg-card-1.png b/public/images/community/bg-card-1.png new file mode 100644 index 0000000..89c3fb3 Binary files /dev/null and b/public/images/community/bg-card-1.png differ diff --git a/public/images/community/bg-card-2.png b/public/images/community/bg-card-2.png new file mode 100644 index 0000000..3b1e187 Binary files /dev/null and b/public/images/community/bg-card-2.png differ diff --git a/public/images/community/bg-card-3.png b/public/images/community/bg-card-3.png new file mode 100644 index 0000000..04d363d Binary files /dev/null and b/public/images/community/bg-card-3.png differ diff --git a/public/images/community/bg-card-4.png b/public/images/community/bg-card-4.png new file mode 100644 index 0000000..b8c5854 Binary files /dev/null and b/public/images/community/bg-card-4.png differ diff --git a/src/api/community.ts b/src/api/community.ts new file mode 100644 index 0000000..174b539 --- /dev/null +++ b/src/api/community.ts @@ -0,0 +1,6 @@ +import request from '@/api/server/request'; + +/* 社区统计 */ +export const getCommunityStatistics = () => { + return request.get('community-statistics'); +}; diff --git a/src/api/server/request.ts b/src/api/server/request.ts index 1da108c..bc7a88c 100644 --- a/src/api/server/request.ts +++ b/src/api/server/request.ts @@ -34,22 +34,22 @@ service.interceptors.response.use( if (response.config.responseType === 'blob' || response.config.responseType === 'arraybuffer') { return response; } - // const { code, data, msg } = response.data; - // if (code === ResultEnum.SUCCESS) { - // return data; - // } + const { code, data, message } = response.data; + if (code === 200) { + return data; + } if (response.status === 200) { return response.data; } // ElMessage.error(msg || '系统出错'); - return Promise.reject(response.data.message || 'Error'); + return Promise.reject(message || 'Error'); }, (error: any) => { // 异常处理 if (error.response.data) { - // const { code, msg } = error.response.data; + // const { code, message } = error.response.data; // if (code === ResultEnum.TOKEN_INVALID) { // ElNotification({ // title: '提示', diff --git a/src/api/server/requestMock.ts b/src/api/server/requestMock.ts index ee02fb6..86d5373 100644 --- a/src/api/server/requestMock.ts +++ b/src/api/server/requestMock.ts @@ -34,10 +34,10 @@ service.interceptors.response.use( if (response.config.responseType === 'blob' || response.config.responseType === 'arraybuffer') { return response; } - // const { code, data, msg } = response.data; - // if (code === ResultEnum.SUCCESS) { - // return data; - // } + const { code, data, msg } = response.data; + if (code === 200) { + return data; + } if (response.status === 200) { return response.data; diff --git a/src/components/PanelItem/Progress/Progress1.vue b/src/components/Progress/Progress1.vue similarity index 100% rename from src/components/PanelItem/Progress/Progress1.vue rename to src/components/Progress/Progress1.vue diff --git a/src/components/PanelItem/TimeSelect/index.vue b/src/components/TimeSelect/index.vue similarity index 88% rename from src/components/PanelItem/TimeSelect/index.vue rename to src/components/TimeSelect/index.vue index 046dbde..5ec0536 100644 --- a/src/components/PanelItem/TimeSelect/index.vue +++ b/src/components/TimeSelect/index.vue @@ -1,5 +1,5 @@ diff --git a/src/views/community/components/community-right.vue b/src/views/community/components/community-right.vue index 35abb14..451e46f 100644 --- a/src/views/community/components/community-right.vue +++ b/src/views/community/components/community-right.vue @@ -1,15 +1,15 @@ diff --git a/src/components/PanelItem/CommunityPanel/bg.png b/src/views/community/images/bg-common-panel.png similarity index 100% rename from src/components/PanelItem/CommunityPanel/bg.png rename to src/views/community/images/bg-common-panel.png diff --git a/src/components/PanelItem/PanelTitle/PanelTitle1.vue b/src/views/data-analyse/components/PanelTitle.vue similarity index 97% rename from src/components/PanelItem/PanelTitle/PanelTitle1.vue rename to src/views/data-analyse/components/PanelTitle.vue index 24e1189..b798b6b 100644 --- a/src/components/PanelItem/PanelTitle/PanelTitle1.vue +++ b/src/views/data-analyse/components/PanelTitle.vue @@ -14,6 +14,7 @@ defineProps({ diff --git a/src/views/smart-park/components/smart-park-content/components/smart-park-content/index.vue b/src/views/smart-park/components/smart-park-content/components/smart-park-content/index.vue deleted file mode 100644 index 815e9de..0000000 --- a/src/views/smart-park/components/smart-park-content/components/smart-park-content/index.vue +++ /dev/null @@ -1,104 +0,0 @@ - - - - - diff --git a/src/views/smart-park/components/smart-park-content/components/smart-park-sidebar-left/index.vue b/src/views/smart-park/components/smart-park-content/components/smart-park-sidebar-left/index.vue deleted file mode 100644 index e9c4c5b..0000000 --- a/src/views/smart-park/components/smart-park-content/components/smart-park-sidebar-left/index.vue +++ /dev/null @@ -1,88 +0,0 @@ - - - - - diff --git a/src/views/smart-park/components/smart-park-content/index.vue b/src/views/smart-park/components/smart-park-content/index.vue deleted file mode 100644 index 6527885..0000000 --- a/src/views/smart-park/components/smart-park-content/index.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - - diff --git a/src/views/smart-park/components/smart-park-footer/index.vue b/src/views/smart-park/components/smart-park-footer.vue similarity index 91% rename from src/views/smart-park/components/smart-park-footer/index.vue rename to src/views/smart-park/components/smart-park-footer.vue index 7b7be4c..73053db 100644 --- a/src/views/smart-park/components/smart-park-footer/index.vue +++ b/src/views/smart-park/components/smart-park-footer.vue @@ -4,7 +4,7 @@