diff --git a/.env.production b/.env.production index 040d999..997a133 100644 --- a/.env.production +++ b/.env.production @@ -15,7 +15,10 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications' VITE_APP_SNAILJOB_ADMIN = '/snail-job' # 生产环境 -VITE_APP_BASE_API = 'http://wuyeadmin.bugtc.com/' +VITE_APP_BASE_API = 'http://wuyeapi.bugtc.com' +# VITE_APP_BASE_API = 'http://192.168.0.222:8080' + + # 是否在打包时开启压缩,支持 gzip 和 brotli VITE_BUILD_COMPRESS = gzip diff --git a/dist.7z b/dist.7z new file mode 100644 index 0000000..ca995f8 Binary files /dev/null and b/dist.7z differ diff --git a/package.json b/package.json index 5b35286..f820836 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,11 @@ "type": "module", "scripts": { "dev": "vite serve --mode development", - "build:prod": "vite build --mode production", "build:dev": "vite build --mode development", + "build:prod": "vite build --mode production", "preview": "vite preview", + "preview:dev": "vite preview --mode development", + "preview:prod": "vite preview --mode production", "lint:eslint": "eslint", "lint:eslint:fix": "eslint --fix", "prettier": "prettier --write ." diff --git a/src/api/login.ts b/src/api/login.ts index 35e6a4e..47f5b99 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -16,6 +16,7 @@ export function login(data: LoginData): AxiosPromise { clientId: data.clientId || clientId, grantType: data.grantType || 'password' }; + console.log(params); return request({ url: '/auth/login', headers: { diff --git a/src/api/system/house/index.ts b/src/api/system/house/index.ts index 0d79577..fb4f578 100644 --- a/src/api/system/house/index.ts +++ b/src/api/system/house/index.ts @@ -1,9 +1,9 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { BuildingUnit, BuildingVo } from './type'; +import { addBuildingType, BuildingUnit, BuildingVo } from './type'; // 楼栋--------------------------------------------------------------------------------------- -// 根据 小区id 和 类型 查询楼栋信息 +// 根据 小区id 和 类型 查询楼栋信息 export function getBuildinglistAPI(villageId: number, buildingUse: number): AxiosPromise { return request({ url: '/building/byVillage', @@ -15,10 +15,34 @@ export function getBuildinglistAPI(villageId: number, buildingUse: number): Axio }); } +/** 添加楼栋 */ +export function addBuildingApi(data: addBuildingType) { + return request({ + url: '/building', + method: 'POST', + data + }); +} + // 房屋---------------------------------------------------------------------------------------------- +// 根据 楼栋id 查询房屋信息 export function getHouselistAPI(buildingId: number): AxiosPromise { return request({ url: `/house/groupByUnitTree/${buildingId}`, method: 'get' }); } +// 添加房屋 +export function addHouseAPI() { + return request({ + url: `/house`, + method: 'POST' + }); +} +// 删除房屋 +export function deleteHouseApi() { + return request({ + url: `/house/{houseIds}`, + method: 'delete' + }); +} diff --git a/src/api/system/house/type.ts b/src/api/system/house/type.ts index a9cee60..3d66078 100644 --- a/src/api/system/house/type.ts +++ b/src/api/system/house/type.ts @@ -63,3 +63,13 @@ export interface HouseType { houseId: string; houseNo: string; } + +export interface addBuildingType { + buildingName: string; + villageId: number; + buildStructure?: string; + buildTall?: string; + buildToward?: string; + floorCount?: number; + unitCount?: number; +} diff --git a/src/assets/images/login-background.png b/src/assets/images/login-background.png new file mode 100644 index 0000000..e1128dd Binary files /dev/null and b/src/assets/images/login-background.png differ diff --git a/src/assets/images/login-background.jpg b/src/assets/images/login-background2.jpg similarity index 100% rename from src/assets/images/login-background.jpg rename to src/assets/images/login-background2.jpg diff --git a/src/components/ContextMenu/index.vue b/src/components/ContextMenu/index.vue index e0efd67..8cc777e 100644 --- a/src/components/ContextMenu/index.vue +++ b/src/components/ContextMenu/index.vue @@ -26,8 +26,9 @@ const x = ref(0); const y = ref(0); const menuRef = ref(); +const openHouseId = ref(null); // 打开菜单 -const open = async (e: MouseEvent, value: any) => { +const open = async (e: MouseEvent, value: string) => { e.preventDefault(); x.value = e.clientX; y.value = e.clientY; @@ -62,6 +63,7 @@ const open = async (e: MouseEvent, value: any) => { show.value = true; document.addEventListener('click', close); document.addEventListener('contextmenu', close); + openHouseId.value = value; }, 10); }; @@ -74,7 +76,10 @@ const close = () => { // 点击选项 const handleClick = (item) => { - emit('select', item.value); + emit('select', { + type: item.value, + value: openHouseId.value + }); close(); }; diff --git a/src/components/Pageheader/index.vue b/src/components/Pageheader/index.vue index ed01728..48c29ad 100644 --- a/src/components/Pageheader/index.vue +++ b/src/components/Pageheader/index.vue @@ -1,15 +1,21 @@ @@ -29,6 +35,7 @@ const props = defineProps({ defineSlots<{ content?: () => void; + operate?: () => void; }>(); @@ -39,6 +46,12 @@ defineSlots<{ background-color: #fff; border-radius: 2px; background-color: rgba(255, 255, 255, 1); + display: flex; + align-items: center; + justify-content: space-between; + .leftbox { + flex: 1; + } .pageTitleBox { .line { width: 5px; diff --git a/src/enums/RespEnum.ts b/src/enums/RespEnum.ts index f6ebd94..ce60a51 100644 --- a/src/enums/RespEnum.ts +++ b/src/enums/RespEnum.ts @@ -56,9 +56,9 @@ export enum HttpStatus { */ UNSUPPORTED_TYPE = 415, /** - * 图片上传-全部失败 + * 系统内部错误 */ - UPLOAD_IMG_ALL_ERROR = 500, + SERVER_ERROR = 500, /** * 接口未实现 */ @@ -84,7 +84,7 @@ export enum HttpStatus { */ DATABASE_ERROR = 522, /** - * 图片上传-部分失败 + * 系统警告消息 */ - UPLOAD_IMG_ERROR = 601 + WARN = 601 } diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 0c50578..8c9ab8b 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -91,7 +91,8 @@ const getLogoTextColor = computed(() => { & .sidebar-title { display: inline-block; margin: 0; - color: v-bind(getLogoTextColor); + // color: v-bind(getLogoTextColor); + color: white; font-weight: 600; line-height: 50px; font-size: 14px; diff --git a/src/store/modules/house.ts b/src/store/modules/house.ts index 9322195..8b1fa6a 100644 --- a/src/store/modules/house.ts +++ b/src/store/modules/house.ts @@ -73,6 +73,12 @@ export const useHouseStore = defineStore('house', () => { currentFloorInfoList.value = (Array.from(floorslist.value) as string[]).sort(sortNumberStr); }; + // 选中房屋 + const checkoutHouses = ref([]); + const checkoutHousesFun = (data: string[]) => { + checkoutHouses.value = data; + }; + // 切换住宅类型 const switchHouseType = (housetype: 0 | 1 | 2 | 3) => { getBuildinglistAPI(currentVilageInfo.value.villageId, housetype) @@ -85,14 +91,26 @@ export const useHouseStore = defineStore('house', () => { getHouselistAPI(buildingId).then(() => ElMessage.success('切换成功')); }; + const deleteHouseFun = (houseId: string | string[]) => { + console.log('删除房屋'); + if (typeof houseId === 'string') { + console.log('单条删除'); + } else if (Array.isArray(houseId)) { + console.log('批量删除'); + } + }; + return { currentVilageInfo, currentBuildingInfoList, currentBuildingInfo, currentHouseInfoList, currentFloorInfoList, + checkoutHouses, + checkoutHousesFun, initHouse, switchHouseType, - switchBuilding + switchBuilding, + deleteHouseFun }; }); diff --git a/src/utils/request.ts b/src/utils/request.ts index e08c114..3f4bda6 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -151,14 +151,14 @@ service.interceptors.response.use( }); } return Promise.reject('无效的会话,或者会话已过期,请重新登录。'); - // 图片上传全部失败 500 - } else if (code === HttpStatus.UPLOAD_IMG_ALL_ERROR) { - ElMessage({ message: '图片全部上传失败', type: 'error' }); + // 500 + } else if (code === HttpStatus.SERVER_ERROR) { + ElMessage({ message: msg, type: 'error' }); + return Promise.reject(new Error(msg)); + // 601 + } else if (code === HttpStatus.WARN) { + ElMessage({ message: msg, type: 'warning' }); return Promise.reject(new Error(msg)); - // 图片上传部分失败 601 - } else if (code === HttpStatus.UPLOAD_IMG_ERROR) { - ElMessage({ message: '部分图片上传失败', type: 'warning' }); - return Promise.reject(res.data); } else if (code !== HttpStatus.SUCCESS) { ElNotification.error({ title: msg }); return Promise.reject('error'); diff --git a/src/views/login.vue b/src/views/login.vue index a4fe37b..57accab 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -9,13 +9,13 @@ - + { loginRef.value?.validate(async (valid: boolean, fields: any) => { if (valid) { loading.value = true; + console.log(loginForm.value); // 勾选了需要记住密码设置在 localStorage 中设置记住用户名和密码 if (loginForm.value.rememberMe) { localStorage.setItem('tenantId', String(loginForm.value.tenantId)); @@ -114,15 +115,12 @@ const handleLogin = () => { // 调用action的登录方法 const [err] = await to(userStore.login(loginForm.value)); if (!err) { + console.log('登录成功'); const redirectUrl = redirect.value || '/'; await router.push(redirectUrl); loading.value = false; } else { loading.value = false; - // 重新获取验证码 - if (captchaEnabled.value) { - await getCode(); - } } } else { } @@ -200,7 +198,7 @@ onMounted(() => { justify-content: center; align-items: center; height: 100%; - background-image: url('../assets/images/login-background.jpg'); + background-image: url('../assets/images/login-background.png'); background-size: cover; background-position: center; } diff --git a/src/views/system/house/AddBuilding.vue b/src/views/system/house/AddBuilding.vue index 3525904..23b7221 100644 --- a/src/views/system/house/AddBuilding.vue +++ b/src/views/system/house/AddBuilding.vue @@ -6,22 +6,22 @@
- + - - + + - - + + - - + + - - + + - - + + 确定 @@ -36,30 +36,52 @@ diff --git a/src/views/system/house/components/building.vue b/src/views/system/house/components/building.vue index b8845d4..f1ee454 100644 --- a/src/views/system/house/components/building.vue +++ b/src/views/system/house/components/building.vue @@ -15,7 +15,7 @@ :key="index" @click="switchBuilding(item.id)" > -
{{ item.villageName ?? '未知' }}
+
{{ item.buildingName ?? '测试数据' }}
@@ -26,13 +26,12 @@ diff --git a/src/views/system/house/components/components/table.vue b/src/views/system/house/components/components/table.vue index e34e39a..6f031c0 100644 --- a/src/views/system/house/components/components/table.vue +++ b/src/views/system/house/components/components/table.vue @@ -15,7 +15,13 @@ :key="index" > @@ -33,6 +39,26 @@ const menutlist = [ { label: '详情', value: 'main' }, { label: '删除', value: 'delete' } ]; +function contextMenuFun(val: { type: string; value: string }) { + switch (val.type) { + case 'edit': + console.log('你选择了:', val); + break; + case 'money': + console.log('你选择了:', val); + break; + case 'main': + console.log('你选择了:', val); + break; + case 'delete': + console.log('你选择了:', val); + houseStore.deleteHouseFun(val.value); + break; + } +} +function handleChange(data: string[]) { + houseStore.checkoutHousesFun(data); +}