This commit is contained in:
2025-09-15 20:15:18 +08:00
6 changed files with 56 additions and 38 deletions

View File

@ -7,11 +7,11 @@ VITE_APP_ENV = 'development'
# 开发环境 # 开发环境
# VITE_APP_BASE_API = 'http://192.168.110.180:8899' # VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 李陈杰 209 # 李陈杰 209
VITE_APP_BASE_API = 'http://192.168.110.180:8899' # VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 李陈杰 209 # 李陈杰 209
# VITE_APP_BASE_API = 'http://192.168.110.209:8899' # VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 曾涛 # 曾涛
# VITE_APP_BASE_API = 'http://192.168.110.149:8899' VITE_APP_BASE_API = 'http://192.168.110.149:8899'
# 罗成 # 罗成
# VITE_APP_BASE_API = 'http://192.168.110.188:8899' # VITE_APP_BASE_API = 'http://192.168.110.188:8899'
# 朱银 # 朱银

View File

@ -74,6 +74,11 @@ export const formatPrice = (price, show = true) => {
const fixedNum = num.toFixed(4); const fixedNum = num.toFixed(4);
const [integer, decimal] = fixedNum.split('.'); const [integer, decimal] = fixedNum.split('.');
// 检查小数部分是否为0
if (decimal === '0000') {
return `${integer}.00`;
}
// 千分位处理 // 千分位处理
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ','); const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');

View File

@ -23,7 +23,7 @@
v-for="(item, i) in weatherList" v-for="(item, i) in weatherList"
:key="i" :key="i"
class="weather-item" class="weather-item"
:style="{ transform: `translateY(-${offsetY}px)`, transition: transition }" :style="{ transform: `translateY(-${offsetY}vw)`, transition: transition }"
> >
<img :src="`/assets/demo/${item.icon}.png`" alt="" /> <img :src="`/assets/demo/${item.icon}.png`" alt="" />
<div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div> <div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div>
@ -39,7 +39,7 @@
<!-- 右侧管理系统图标 + 文字 --> <!-- 右侧管理系统图标 + 文字 -->
<div class="right-section"> <div class="right-section">
<img src="@/assets/large/setting.png" alt="设置图标" /> <img src="@/assets/large/setting.png" alt="设置图标" />
<span>管理系统</span> <span style="width: 5vw">管理系统</span>
</div> </div>
<!-- 分割线 --> <!-- 分割线 -->
<div class="divider"> <div class="divider">
@ -89,7 +89,7 @@ const emit = defineEmits(['changePage']);
const safetyDay = ref<number>(0); const safetyDay = ref<number>(0);
const weatherList = ref<Weather[]>([]); const weatherList = ref<Weather[]>([]);
const timer = ref<number | null>(0); const timer = ref<number | null>(0);
const offsetY = ref<number>(0); const offsetY = ref<any>(0);
const curIndex = ref(0); const curIndex = ref(0);
const transition = ref('transform 0.5s ease'); const transition = ref('transform 0.5s ease');
const pendingPause = ref(false); const pendingPause = ref(false);
@ -119,7 +119,7 @@ function judgeDayOrNight(sunRise: string, sunSet: string) {
const setWeatherScroll = () => { const setWeatherScroll = () => {
curIndex.value += 1; curIndex.value += 1;
transition.value = 'transform 0.3s ease'; transition.value = 'transform 0.3s ease';
offsetY.value = curIndex.value * 60; offsetY.value = curIndex.value * 2;
if (curIndex.value === weatherList.value.length - 1) { if (curIndex.value === weatherList.value.length - 1) {
setTimeout(() => { setTimeout(() => {
@ -232,13 +232,13 @@ onUnmounted(() => {
.title > div:first-child { .title > div:first-child {
/* 第一个子元素的样式 */ /* 第一个子元素的样式 */
font-size: 38px; font-size: 2vw;
letter-spacing: 0.1em; letter-spacing: 0.1em;
} }
.title > div:last-child { .title > div:last-child {
/* 最后一个子元素的样式 */ /* 最后一个子元素的样式 */
font-size: 14px; font-size: 1vw;
} }
/* 顶部栏容器Flex 水平布局 + 垂直居中 */ /* 顶部栏容器Flex 水平布局 + 垂直居中 */
@ -260,22 +260,25 @@ onUnmounted(() => {
align-items: center; align-items: center;
.weather-list { .weather-list {
height: 60px; height: 2vw;
overflow: hidden; overflow: hidden;
.weather-item { .weather-item {
height: 60px; height: 2vw;
line-height: 60px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
// padding: 10px 0;
// box-sizing: border-box;
font-size: 0.8vw;
& > div:last-child { & > div:last-child {
margin-left: 10px; margin-left: 10px;
} }
img { img {
width: 50px; width: 3vw;
height: 50px; height: 3vw;
} }
} }
} }
@ -305,10 +308,12 @@ onUnmounted(() => {
/* 右侧区域(管理系统):图标 + 文字水平排列 */ /* 右侧区域(管理系统):图标 + 文字水平排列 */
.right-section { .right-section {
width: 5.5vw;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
font-family: 'AlimamaShuHeiTi', sans-serif; font-family: 'AlimamaShuHeiTi', sans-serif;
font-size: 20px; font-size: 1vw;
cursor: pointer; cursor: pointer;
} }

View File

@ -23,7 +23,7 @@
v-for="(item, i) in weatherList" v-for="(item, i) in weatherList"
:key="i" :key="i"
class="weather-item" class="weather-item"
:style="{ transform: `translateY(-${offsetY}px)`, transition: transition }" :style="{ transform: `translateY(-${offsetY}vw)`, transition: transition }"
> >
<img :src="`/assets/demo/${item.icon}.png`" alt="" /> <img :src="`/assets/demo/${item.icon}.png`" alt="" />
<div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div> <div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div>
@ -79,7 +79,7 @@ const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject); const currentProject = computed(() => userStore.selectedProject);
// 天气轮播相关变量 // 天气轮播相关变量
const weatherList = ref<WeatherData[]>([]); const weatherList = ref<any[]>([]);
const offsetY = ref<number>(0); const offsetY = ref<number>(0);
const curIndex = ref(0); const curIndex = ref(0);
const transition = ref('transform 0.5s ease'); const transition = ref('transform 0.5s ease');
@ -103,7 +103,7 @@ function judgeDayOrNight(sunRise: string, sunSet: string) {
const setWeatherScroll = () => { const setWeatherScroll = () => {
curIndex.value += 1; curIndex.value += 1;
transition.value = 'transform 0.3s ease'; transition.value = 'transform 0.3s ease';
offsetY.value = curIndex.value * 60; // 每个天气项高度60px需和样式一致 offsetY.value = curIndex.value * 2; // 每个天气项高度60px需和样式一致
// 轮播到最后一项时,无缝衔接回第一项 // 轮播到最后一项时,无缝衔接回第一项
if (curIndex.value === weatherList.value.length - 1) { if (curIndex.value === weatherList.value.length - 1) {
@ -160,7 +160,7 @@ const getWeatherData = async () => {
weatherList.value = res.data; weatherList.value = res.data;
// 处理每一天的天气(白天/夜晚切换图标和状态) // 处理每一天的天气(白天/夜晚切换图标和状态)
weatherList.value.forEach((item) => { weatherList.value.forEach((item: any) => {
const isDay = judgeDayOrNight(item.sunRise, item.sunSet); const isDay = judgeDayOrNight(item.sunRise, item.sunSet);
item.status = isDay ? item.dayStatus : item.nightStatus; item.status = isDay ? item.dayStatus : item.nightStatus;
item.icon = isDay ? item.dayIcon : item.nightIcon; item.icon = isDay ? item.dayIcon : item.nightIcon;
@ -250,13 +250,13 @@ onUnmounted(() => {
.title > div:first-child { .title > div:first-child {
/* 第一个子元素的样式 */ /* 第一个子元素的样式 */
font-size: 38px; font-size: 2vw;
letter-spacing: 0.1em; letter-spacing: 0.1em;
} }
.title > div:last-child { .title > div:last-child {
/* 最后一个子元素的样式 */ /* 最后一个子元素的样式 */
font-size: 14px; font-size: 1vw;
} }
/* 顶部栏容器Flex 水平布局 + 垂直居中 */ /* 顶部栏容器Flex 水平布局 + 垂直居中 */
@ -278,22 +278,25 @@ onUnmounted(() => {
align-items: center; align-items: center;
.weather-list { .weather-list {
height: 60px; height: 2vw;
overflow: hidden; overflow: hidden;
.weather-item { .weather-item {
height: 60px; height: 2vw;
line-height: 60px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
// padding: 10px 0;
// box-sizing: border-box;
font-size: 0.8vw;
& > div:last-child { & > div:last-child {
margin-left: 10px; margin-left: 10px;
} }
img { img {
width: 50px; width: 3vw;
height: 50px; height: 3vw;
} }
} }
} }
@ -323,10 +326,12 @@ onUnmounted(() => {
/* 右侧区域(管理系统):图标 + 文字水平排列 */ /* 右侧区域(管理系统):图标 + 文字水平排列 */
.right-section { .right-section {
width: 5.5vw;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
font-family: 'AlimamaShuHeiTi', sans-serif; font-family: 'AlimamaShuHeiTi', sans-serif;
font-size: 20px; font-size: 1vw;
cursor: pointer; cursor: pointer;
} }

View File

@ -58,7 +58,7 @@
<el-table-column label="操作" align="center" fixed="right" min-width="200" fixed-width> <el-table-column label="操作" align="center" fixed="right" min-width="200" fixed-width>
<template #default="scope"> <template #default="scope">
<el-tooltip content="修改" placement="top"> <el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="View" @click="handleDetails(scope.row)" v-hasPermi="['mechanical:mechanicalrewriting:edit']" <el-button link type="primary" icon="View" @click="handleDetails(scope.row)" v-hasPermi="['mechanical:mechanicalrewriting:query']"
>详情</el-button >详情</el-button
> >
</el-tooltip> </el-tooltip>

View File

@ -23,7 +23,7 @@
v-for="(item, i) in weatherList" v-for="(item, i) in weatherList"
:key="i" :key="i"
class="weather-item" class="weather-item"
:style="{ transform: `translateY(-${offsetY}px)`, transition: transition }" :style="{ transform: `translateY(-${offsetY}vw)`, transition: transition }"
> >
<img :src="`/assets/demo/${item.icon}.png`" alt="" /> <img :src="`/assets/demo/${item.icon}.png`" alt="" />
<div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div> <div>{{ item.weather }}{{ item.tempMin }}°/{{ item.tempMax }}°</div>
@ -39,7 +39,7 @@
<!-- 右侧管理系统图标 + 文字 --> <!-- 右侧管理系统图标 + 文字 -->
<div class="right-section"> <div class="right-section">
<img src="@/assets/large/setting.png" alt="设置图标" /> <img src="@/assets/large/setting.png" alt="设置图标" />
<span>管理系统</span> <span style="width: 5vw">管理系统</span>
</div> </div>
<!-- 分割线 --> <!-- 分割线 -->
<div class="divider"> <div class="divider">
@ -129,7 +129,7 @@ function judgeDayOrNight(sunRise: string, sunSet: string) {
const setWeatherScroll = () => { const setWeatherScroll = () => {
curIndex.value += 1; curIndex.value += 1;
transition.value = 'transform 0.3s ease'; transition.value = 'transform 0.3s ease';
offsetY.value = curIndex.value * 60; offsetY.value = curIndex.value * 2;
if (curIndex.value === weatherList.value.length - 1) { if (curIndex.value === weatherList.value.length - 1) {
setTimeout(() => { setTimeout(() => {
@ -242,13 +242,13 @@ onUnmounted(() => {
.title > div:first-child { .title > div:first-child {
/* 第一个子元素的样式 */ /* 第一个子元素的样式 */
font-size: 38px; font-size: 2vw;
letter-spacing: 0.1em; letter-spacing: 0.1em;
} }
.title > div:last-child { .title > div:last-child {
/* 最后一个子元素的样式 */ /* 最后一个子元素的样式 */
font-size: 26px; font-size: 1.5vw;
} }
/* 顶部栏容器Flex 水平布局 + 垂直居中 */ /* 顶部栏容器Flex 水平布局 + 垂直居中 */
@ -270,22 +270,23 @@ onUnmounted(() => {
align-items: center; align-items: center;
.weather-list { .weather-list {
height: 60px; height: 2vw;
overflow: hidden; overflow: hidden;
.weather-item { .weather-item {
height: 60px; height: 2vw;
line-height: 60px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
font-size: 0.8vw;
& > div:last-child { & > div:last-child {
margin-left: 10px; margin-left: 10px;
} }
img { img {
width: 50px; width: 3vw;
height: 50px; height: 3vw;
} }
} }
} }
@ -315,10 +316,12 @@ onUnmounted(() => {
/* 右侧区域(管理系统):图标 + 文字水平排列 */ /* 右侧区域(管理系统):图标 + 文字水平排列 */
.right-section { .right-section {
width: 5.5vw;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
font-family: 'AlimamaShuHeiTi', sans-serif; font-family: 'AlimamaShuHeiTi', sans-serif;
font-size: 20px; font-size: 1vw;
cursor: pointer; cursor: pointer;
} }