diff --git a/src/api/system/unitConverter/sysUnitConverter.js b/src/api/system/unitConverter/sysUnitConverter.js
index b5187f2..de425f6 100644
--- a/src/api/system/unitConverter/sysUnitConverter.js
+++ b/src/api/system/unitConverter/sysUnitConverter.js
@@ -4,6 +4,9 @@ import request from '@/utils/request'
export function listConvert(query) {
return request({
url: '/system/convert/list',
+ headers: {
+ isToken: false
+ },
method: 'get',
params: query
})
@@ -13,6 +16,9 @@ export function listConvert(query) {
export function getConvert(id) {
return request({
url: '/system/convert/' + id,
+ headers: {
+ isToken: false
+ },
method: 'get'
})
}
@@ -21,6 +27,9 @@ export function getConvert(id) {
export function addConvert(data) {
return request({
url: '/system/convert',
+ headers: {
+ isToken: false
+ },
method: 'post',
data: data
})
@@ -30,6 +39,9 @@ export function addConvert(data) {
export function updateConvert(data) {
return request({
url: '/system/convert',
+ headers: {
+ isToken: false
+ },
method: 'put',
data: data
})
@@ -39,6 +51,9 @@ export function updateConvert(data) {
export function delConvert(id) {
return request({
url: '/system/convert/' + id,
+ headers: {
+ isToken: false
+ },
method: 'delete'
})
}
diff --git a/src/config.js b/src/config.js
index ef7d21f..699f306 100644
--- a/src/config.js
+++ b/src/config.js
@@ -11,7 +11,7 @@ const config = {
// 应用版本
version: "1.1.0",
// 应用logo
- logo: "/static/logo.png",
+ logo: "https://ngtools.cn:3000/static/logo.png",
// 官方网站
site_url: "http://ruoyi.vip",
// 政策协议
diff --git a/src/pages.json b/src/pages.json
index 5b68fe7..7626a63 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -284,20 +284,20 @@
"list": [
{
"pagePath": "pages/index",
- "iconPath": "static/images/tabbar/work.png",
- "selectedIconPath": "static/images/tabbar/work_.png",
+ "iconPath": "/static/images/tabbar/work.png",
+ "selectedIconPath": "/static/images/tabbar/work_.png",
"text": "首页"
},
{
"pagePath": "pages/template",
- "iconPath": "static/images/tabbar/work.png",
- "selectedIconPath": "static/images/tabbar/work_.png",
+ "iconPath": "/static/images/tabbar/work.png",
+ "selectedIconPath": "/static/images/tabbar/work_.png",
"text": "资料"
},
{
"pagePath": "pages/mine",
- "iconPath": "static/images/tabbar/mine.png",
- "selectedIconPath": "static/images/tabbar/mine_.png",
+ "iconPath": "/static/images/tabbar/mine.png",
+ "selectedIconPath": "/static/images/tabbar/mine_.png",
"text": "我的"
}
]
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 9fa4683..98c8b30 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -33,97 +33,38 @@
ref,
onMounted
} from "vue";
- import modal from "@/plugins/modal"
- import {
- listConvert
- } from '@/api/system/unitConverter/sysUnitConverter.js';
+ import modal from "@/plugins/modal"
import {
storage
} from '@/utils/storageUnit.ts';
import {
extractModuleData
} from '@/utils/moudlesData.ts';
+ import useUnitStore from '@/store/modules/unitData.ts';
+ const unitStore = useUnitStore();
const current = ref(0);
const swiperDotIndex = ref(0);
const data = ref([{
- image: '/static/images/banner/banner01.jpg'
+ image: 'https://ngtools.cn:3000/static/images/banner/banner01.jpg'
},
{
- image: '/static/images/banner/banner02.jpg'
+ image: 'https://ngtools.cn:3000/static/images/banner/banner02.jpg'
},
{
- image: '/static/images/banner/banner03.jpg'
+ image: 'https://ngtools.cn:3000/static/images/banner/banner03.jpg'
}
]);
// 核心数据:计算分组和功能项定义
const moudlesGroups = ref([]);
- const queryParams = ref({
- pageNum: 1,
- pageSize: 1000,
- unitType: null,
- unitName: null,
- baseUnit: null,
- conversionFactor: null,
- unitTypeName: null,
- status: null,
- unitOrder: null
- });
-
- // 保留原有单位换算方法
- const groupByUnitType = (data) => {
- if (!data || !Array.isArray(data)) {
- console.warn('groupByUnitType: 数据为空或不是数组');
- return {};
- }
-
- return data.reduce((acc, unit) => {
- const type = unit.unitType;
- if (!acc[type]) acc[type] = [];
- acc[type].push({
- id: unit.id,
- unitType: unit.unitType,
- unitName: unit.unitName,
- conversionFactor: unit.conversionFactor,
- unitOrder: unit.unitOrder,
- baseUnit: unit.baseUnit,
- status: unit.status,
- unitTypeName: unit.unitTypeName
- });
- return acc;
- }, {});
- };
-
- const getList = () => {
- try {
- console.log('开始请求单位数据...');
- const response = listConvert(queryParams.value);
- console.log('API响应:', JSON.stringify(response));
-
- if (!response || !response.rows) {
- console.error('API响应格式错误');
- return;
- }
-
- if (response.rows.length === 0) {
- console.warn('单位数据为空数组');
- return;
- }
-
- const unitDataGrouped = groupByUnitType(response.rows);
- console.log('分组后的单位数据:', unitDataGrouped);
- // 使用统一的存储方法
- storage.setItem('unitData', unitDataGrouped);
- console.log('数据存储成功');
-
- } catch (error) {
- console.error('获取单位数据失败:', error);
- }
- };
- onMounted(() => {
+
+ onMounted(async() => {
moudlesGroups.value = extractModuleData(['流量计算', '参数计算'], false)
- getList();
+ // 优先从本地缓存恢复,再请求最新数据
+ unitStore.restoreUnitDataFromLocal();
+ await unitStore.getList();
+
})
function navigateToMoudles(item) {
diff --git a/src/pages_geek/pages/index/index.vue b/src/pages_geek/pages/index/index.vue
index 7dfb832..9e33f42 100644
--- a/src/pages_geek/pages/index/index.vue
+++ b/src/pages_geek/pages/index/index.vue
@@ -67,28 +67,28 @@ function getcolor(color: { hex: string, rgba: { r: number, g: number, b: number,
}
const menus: Array