fix: 后端接口改为java,联调接口修改。

This commit is contained in:
tianyongbao
2026-01-12 00:36:05 +08:00
parent 7e10c62cf9
commit b2f7f5fe1e
21 changed files with 550 additions and 259 deletions

View File

@@ -284,7 +284,31 @@ const check_a = `https://www.yuceyun.cn/wechat/check_a.png`;
const instance = Taro.getCurrentInstance();
const r = instance.router.params.params;
const page = instance.router.params.page;
const params = r ? JSON.parse(r) : undefined;
console.log('URL参数原始值', r);
let params: any = undefined;
try {
if (r) {
// URL解码后再解析JSON
const decodedParams = decodeURIComponent(r);
console.log('URL解码后', decodedParams);
params = JSON.parse(decodedParams);
console.log('解析后的参数', params);
} else {
console.error('未获取到params参数');
}
} catch (e) {
console.error('参数解析失败', e, '原始参数:', r);
// 参数解析失败,显示提示后返回
Taro.showModal({
title: '提示',
content: '参数错误,请重新进入',
showCancel: false,
success: () => {
Taro.navigateBack();
}
});
}
// 步骤
const current = ref<number>(1);
const themeVars = ref({
@@ -314,14 +338,22 @@ const isLoading = ref<boolean>(false);
/** ----------------metod start------------------ */
// 监测设备在线状态
function getCheckDevice() {
if (!params) {
console.error('params参数为空');
state.show = true;
state.msg = '参数错误';
return;
}
const data = {
devicetype: params.devType,
serialnum: params.devNum,
};
console.log('检查设备状态', data);
isLoading.value = true;
checkDeviceStatus(data)
.then((res: any) => {
if (res.statusCode == 200) {
if (res.code == 200) {
status.value = res.data;
if (status.value == 0) {
state.show = true;
@@ -345,6 +377,12 @@ function getCheckDevice() {
});
}
function next() {
if (!params) {
state.show = true;
state.msg = '参数错误';
return;
}
const num = current.value;
if (num == 3) {
isLoading.value = true;
@@ -378,9 +416,10 @@ function next() {
salinityCompensation: waterType.value == 1 ? 0 : Number(salt.value),
oxyWarnLower: Number(alarm.value),
};
console.log('添加设备数据', data);
addDeviceDetector(data)
.then((res) => {
if (res.statusCode == 200) {
if (res.code == 200) {
Taro.redirectTo({
url: "/my/addDevSuccess?name=添加水质检测仪&page=" + page,
});