fix: java后端接口对接,联调测试问题修改。
This commit is contained in:
@@ -102,8 +102,7 @@ const API_PATHS = {
|
||||
},
|
||||
// 夜间防误触
|
||||
KEEP_NIGHT_OPEN: {
|
||||
v1: '/api/pond/keep_night_open',
|
||||
v2: '/fishery/pond/night-protect',
|
||||
v2: '/fishery/pond/keep_night_open',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -143,8 +142,7 @@ const API_PATHS = {
|
||||
},
|
||||
// 扫描设备编码
|
||||
SCAN: {
|
||||
v1: '/api/device/check_device_qrcode',
|
||||
v2: '/fishery/device/scan',
|
||||
v2: '/fishery/device/check_device_qrcode',
|
||||
},
|
||||
// 检测设备是否在线
|
||||
CHECK_STATUS: {
|
||||
@@ -260,23 +258,19 @@ const API_PATHS = {
|
||||
TIME_CTRL: {
|
||||
// 定时开关列表
|
||||
LIST: {
|
||||
v1: '/api/device-switch-time-ctrl/list',
|
||||
v2: '/fishery/time-ctrl/list',
|
||||
v2: '/fishery/timingCtrl/list',
|
||||
},
|
||||
// 添加定时开关
|
||||
ADD: {
|
||||
v1: '/api/device-switch-time-ctrl/add',
|
||||
v2: '/fishery/time-ctrl',
|
||||
v2: '/fishery/timingCtrl/add',
|
||||
},
|
||||
// 删除定时开关
|
||||
DELETE: {
|
||||
v1: '/api/device-switch-time-ctrl/delete',
|
||||
v2: '/fishery/time-ctrl',
|
||||
v2: '/iot/timingCtrl/delete',
|
||||
},
|
||||
// 更新定时开关
|
||||
UPDATE: {
|
||||
v1: '/api/device-switch-time-ctrl/update',
|
||||
v2: '/fishery/time-ctrl',
|
||||
v2: '/iot/timingCtrl/update',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -308,28 +302,24 @@ const API_PATHS = {
|
||||
USER: {
|
||||
// 报警电话列表
|
||||
WARN_PHONE_LIST: {
|
||||
v1: '/api/user-center/list_warn_phone',
|
||||
v2: '/fishery/user/warn-phone/list',
|
||||
v2: '/fishery/aquUser/list_warn_phone',
|
||||
},
|
||||
// 修改报警电话
|
||||
UPDATE_WARN_PHONE: {
|
||||
v1: '/api/user-center/update_warn_phone',
|
||||
v2: '/fishery/user/warn-phone',
|
||||
v2: '/fishery/aquUser/update_warn_phone',
|
||||
},
|
||||
// 修改手机号码
|
||||
UPDATE_PHONE: {
|
||||
v1: '/api/user-center/update_mobile_phone',
|
||||
v2: '/fishery/user/phone',
|
||||
v2: '/fishery/aquUser/update_mobile_phone',
|
||||
},
|
||||
// 验证验证码
|
||||
VERIFY_CODE: {
|
||||
v1: '/sms_code/verify',
|
||||
v2: '/fishery/sms/verify',
|
||||
v2: '/resource/sms/verify',
|
||||
},
|
||||
// 修改昵称
|
||||
UPDATE_NICKNAME: {
|
||||
v1: '/api/user-center/update_user_name',
|
||||
v2: '/fishery/user/nickname',
|
||||
v2: '/fishery/aquUser/update_user_name',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -337,23 +327,19 @@ const API_PATHS = {
|
||||
SUB_ACCOUNT: {
|
||||
// 获取子账号列表
|
||||
LIST: {
|
||||
v1: '/api/user-center/list_user_child',
|
||||
v2: '/fishery/user/child/list',
|
||||
v2: '/fishery/aquUser/list_user_child',
|
||||
},
|
||||
// 添加子账号
|
||||
ADD: {
|
||||
v1: '/api/user-center/add_user_child',
|
||||
v2: '/fishery/user/child',
|
||||
v2: '/fishery/aquUser/add_user_child',
|
||||
},
|
||||
// 删除子账号
|
||||
DELETE: {
|
||||
v1: '/api/user-center/delete_user_child',
|
||||
v2: '/fishery/user/child',
|
||||
v2: '/fishery/aquUser/delete_user_child',
|
||||
},
|
||||
// 获取父级账号
|
||||
PARENT: {
|
||||
v1: '/api/user-center/list_user_parent',
|
||||
v2: '/fishery/user/parent',
|
||||
v2: '/fishery/aquUser/list_user_parent',
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ export function list_user_child() {
|
||||
}
|
||||
|
||||
// 添加
|
||||
export function add_user_child(data) {
|
||||
return httpService.post(`${API.SUB_ACCOUNT.ADD()}?mobilePhone=${data}`)
|
||||
export function add_user_child(mobilePhone) {
|
||||
return httpService.post(API.SUB_ACCOUNT.ADD(), { mobilePhone })
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delete_user_child(data) {
|
||||
return httpService.delete(API.SUB_ACCOUNT.DELETE(), {data})
|
||||
export function delete_user_child(id) {
|
||||
return httpService.delete(`${API.SUB_ACCOUNT.DELETE()}/${id}`)
|
||||
}
|
||||
|
||||
// 获取父级账号
|
||||
|
||||
@@ -512,6 +512,7 @@
|
||||
></nut-tour>
|
||||
<!-- 弹出层提示 -->
|
||||
<nut-toast :msg="state.msg" v-model:visible="state.show" :type="state.type" />
|
||||
<nut-config-provider :theme-vars="themeVarsDialog">
|
||||
<nut-dialog
|
||||
v-model:visible="visControl"
|
||||
class="dialog"
|
||||
@@ -543,32 +544,37 @@
|
||||
</nut-col>
|
||||
<nut-col
|
||||
:span="24"
|
||||
:style="{ marginTop: '40rpx' }"
|
||||
v-for="item in controlInfo.listSwitch"
|
||||
:style="{
|
||||
marginTop: index === 0 ? '20rpx' : '45rpx',
|
||||
paddingBottom: '10rpx'
|
||||
}"
|
||||
v-for="(item, index) in controlInfo.listSwitch"
|
||||
:key="item.id"
|
||||
>
|
||||
<nut-row :style="{ lineHeight: '30px' }">
|
||||
<nut-col span="14">
|
||||
<view class="d_c_title">{{ item.switchName }}</view>
|
||||
<nut-row :style="{ lineHeight: '50rpx', alignItems: 'center' }">
|
||||
<nut-col span="10">
|
||||
<view class="d_c_title" :style="{ whiteSpace: 'nowrap' }">{{ item.switchName }}</view>
|
||||
</nut-col>
|
||||
<nut-col
|
||||
span="10"
|
||||
span="14"
|
||||
:style="{
|
||||
textAlign: 'right',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end'
|
||||
}"
|
||||
>
|
||||
<nut-switch
|
||||
v-model="item.isOpen"
|
||||
:model-value="item.isOpen === 1"
|
||||
active-color="#04D98A"
|
||||
@change="(value, event) => setSwitchOpen({ value, event }, item)"
|
||||
/>
|
||||
<view
|
||||
:style="{
|
||||
color: '#1589E9',
|
||||
fontSize: '32rpx',
|
||||
marginLeft: '10rpx',
|
||||
fontSize: '28rpx',
|
||||
marginLeft: '50rpx',
|
||||
whiteSpace: 'nowrap'
|
||||
}"
|
||||
@click="setSwitch(item.id, item.switchName)"
|
||||
>设置
|
||||
@@ -576,9 +582,6 @@
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
</nut-col>
|
||||
<nut-col :span="24">
|
||||
<nut-divider class="divider" />
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
</view>
|
||||
<view class="d_btn">
|
||||
@@ -597,6 +600,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</nut-dialog>
|
||||
</nut-config-provider>
|
||||
<!-- 防误触开关提醒 -->
|
||||
<nut-dialog v-model:visible="alertShow" text-align="left" pop-class="pop-class">
|
||||
<template #default>
|
||||
@@ -691,6 +695,13 @@ const themeVarsOther = ref({
|
||||
switchInsideWidth: "14px",
|
||||
switchInsideHeight: "14px",
|
||||
});
|
||||
// 弹窗开关样式配置,与主页面开关保持一致
|
||||
const themeVarsDialog = ref({
|
||||
switchWidth: "36px",
|
||||
switchHeight: "21px",
|
||||
switchInsideWidth: "14px",
|
||||
switchInsideHeight: "14px",
|
||||
});
|
||||
// 图表参数
|
||||
const paramsHistory = ref({
|
||||
serialNum: "", // 设备序列号
|
||||
@@ -807,10 +818,7 @@ function getDeviceList() {
|
||||
}
|
||||
// 查询塘口下设备列表
|
||||
pondDeviceInfo({ id }).then((res: any) => {
|
||||
console.log('塘口设备接口返回:', res);
|
||||
if (res.code == 200) {
|
||||
console.log('检测仪列表:', res.data.listDetector);
|
||||
console.log('控制器列表:', res.data.listController);
|
||||
setTimeout(() => {
|
||||
if (
|
||||
res.data &&
|
||||
@@ -864,10 +872,9 @@ function getDeviceList() {
|
||||
}
|
||||
});
|
||||
pondDeviceRes.value = res.data;
|
||||
keepNightOpen.value = res.data.keepNightOpen;
|
||||
keepNightOpen.value = res.data.keepNightOpen === 1;
|
||||
doList.value = res.data.listDetector;
|
||||
controlList.value = res.data.listController;
|
||||
console.log('赋值后 controlList:', controlList.value);
|
||||
if (res.data.listDetector && res.data.listDetector.length > 0) {
|
||||
firstDoId.value = res.data.listDetector[0].id
|
||||
? res.data.listDetector[0].id
|
||||
@@ -935,16 +942,11 @@ function changeShow() {
|
||||
|
||||
// 全屏显示图表 - 跳转到单独页面
|
||||
function fullscreenChart() {
|
||||
console.log('🔍 设备数据结构:', pondDeviceRes.value);
|
||||
console.log('🔍 当前设备ID:', doDev.value);
|
||||
|
||||
// 获取当前设备的 serialNum(注意:数据结构直接在 pondDeviceRes.value 下,没有 data 字段)
|
||||
// 获取当前设备的 serialNum
|
||||
const currentDevice = pondDeviceRes.value?.listDetector?.find(
|
||||
(item: any) => item.id === doDev.value
|
||||
);
|
||||
|
||||
console.log('🔍 找到的设备:', currentDevice);
|
||||
|
||||
if (!currentDevice) {
|
||||
Taro.showToast({
|
||||
title: '设备信息不存在',
|
||||
@@ -953,11 +955,9 @@ function fullscreenChart() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 尝试多种字段名
|
||||
const serialNum = currentDevice.serialNum || currentDevice.serialNumber || currentDevice.deviceSerialNum || currentDevice.sn;
|
||||
|
||||
if (!serialNum) {
|
||||
console.error('❗ 设备没有序列号字段,设备信息:', currentDevice);
|
||||
Taro.showToast({
|
||||
title: '设备序列号不存在',
|
||||
icon: 'none'
|
||||
@@ -965,8 +965,6 @@ function fullscreenChart() {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('✅ 跳转参数:', { serialNum, dataType: prDev.value, dayType: dayDev.value });
|
||||
|
||||
// 跳转到全屏图表页面
|
||||
Taro.navigateTo({
|
||||
url: `/components/other/chartFullscreen?serialNum=${serialNum}&dataType=${prDev.value}&dayType=${dayDev.value}`
|
||||
@@ -1032,7 +1030,7 @@ function selectCharts(e) {
|
||||
}
|
||||
});
|
||||
pondDeviceRes.value = res.data;
|
||||
keepNightOpen.value = res.data.keepNightOpen;
|
||||
keepNightOpen.value = res.data.keepNightOpen === 1; // 将后端的 0/1 转换为布尔值
|
||||
doList.value = res.data.listDetector;
|
||||
if (res.data.listDetector && res.data.listDetector.length > 0) {
|
||||
firstDoId.value = res.data.listDetector[0].id
|
||||
@@ -1729,19 +1727,26 @@ function setSwitchOpen({ value, event }, item: any) {
|
||||
if (event) {
|
||||
const data = {
|
||||
id: item.id,
|
||||
isOpen: value,
|
||||
isOpen: value ? 1 : 0,
|
||||
};
|
||||
turnSwitch(data)
|
||||
.then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "操作成功";
|
||||
state.type = "success";
|
||||
// 立即更新本地状态
|
||||
item.isOpen = value ? 1 : 0;
|
||||
} else {
|
||||
item.isOpen = !value;
|
||||
state.show = true;
|
||||
state.msg = res.msg || "设置失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
getDeviceList();
|
||||
.catch((error) => {
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1754,20 +1759,42 @@ function changeAllSwitch(e) {
|
||||
content: `确认设置控制器 ${msg}?`,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
openStatus.value = e == true ? 1 : 2;
|
||||
const data = {
|
||||
id: props.modelValue,
|
||||
isOpen: e,
|
||||
isOpen: e ? 1 : 0,
|
||||
};
|
||||
|
||||
turnPondSwitch(data)
|
||||
.then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "操作成功";
|
||||
getDeviceList();
|
||||
state.type = "success";
|
||||
|
||||
// 接口成功后,立即更新本地状态
|
||||
openStatus.value = e == true ? 1 : 2;
|
||||
|
||||
// 立即更新所有控制器下的开关状态
|
||||
controlList.value.forEach((controller) => {
|
||||
if (controller.listSwitch && controller.listSwitch.length > 0) {
|
||||
controller.listSwitch.forEach((switchItem) => {
|
||||
switchItem.isOpen = e ? 1 : 0;
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 接口返回失败
|
||||
state.show = true;
|
||||
state.msg = res.msg || "设置失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.finally(() => {});
|
||||
.catch((error) => {
|
||||
// 网络错误
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
}
|
||||
},
|
||||
@@ -1871,14 +1898,23 @@ function submit() {
|
||||
alertShow.value = false;
|
||||
const data = {
|
||||
id: props.modelValue,
|
||||
isOpen: keepNightOpen.value,
|
||||
isOpen: keepNightOpen.value ? 1 : 0,
|
||||
};
|
||||
setNightProtect(data).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
state.show = true;
|
||||
if (res.code == 200) {
|
||||
state.type = "success";
|
||||
state.msg = "操作成功";
|
||||
state.show = true;
|
||||
// getDeviceList();
|
||||
} else {
|
||||
state.type = "fail";
|
||||
state.msg = res.msg || "设置失败,请重试";
|
||||
state.show = true;
|
||||
}
|
||||
}).catch((error) => {
|
||||
state.type = "fail";
|
||||
state.msg = "网络错误,请重试";
|
||||
state.show = true;
|
||||
});
|
||||
}
|
||||
/** -----------------method end------------------- */
|
||||
|
||||
@@ -237,7 +237,21 @@ function save() {
|
||||
PondAdd(requestData).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
saveRes.value = true;
|
||||
} else {
|
||||
// 显示错误提示
|
||||
Taro.showToast({
|
||||
title: res.msg || '添加失败,请重试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}).catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
Taro.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}).finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
|
||||
@@ -206,10 +206,25 @@ function save() {
|
||||
// }
|
||||
addTimeCtrl(data)
|
||||
.then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
saveRes.value = true;
|
||||
} else {
|
||||
// 显示错误提示
|
||||
Taro.showToast({
|
||||
title: res.msg || '添加失败,请重试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
Taro.showToast({
|
||||
title: '网络错误,请重试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
|
||||
@@ -17,13 +17,15 @@
|
||||
<nut-col :span="4">
|
||||
<nut-button type="danger" size="mini" @click="remove(item.id)">删除</nut-button>
|
||||
</nut-col>
|
||||
<nut-col :span="12">
|
||||
<nut-col :span="9">
|
||||
<view class="font_36 c_222"
|
||||
>{{ item.openTime }}~{{ item.closeTime }}</view
|
||||
>
|
||||
</nut-col>
|
||||
<nut-col :span="8" class="view_f font_36 c_222">
|
||||
<view :style="{ marginRight: '10px' }">{{ item.loopType==1 ? "一次" : "每天" }}</view>
|
||||
<nut-col :span="5" class="font_36 c_222">
|
||||
<view>{{ item.loopType==1 ? "一次" : "每天" }}</view>
|
||||
</nut-col>
|
||||
<nut-col :span="6" :style="{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }">
|
||||
<nut-switch
|
||||
v-model="item.isOpen"
|
||||
active-color="#04D98A"
|
||||
@@ -96,13 +98,6 @@ const themeVars = ref({
|
||||
cellBorderRadius: "4px",
|
||||
cellBoxShadow: "0px",
|
||||
cellPadding: "26rpx 0px",
|
||||
SwitchWidth: "112rpx",
|
||||
SwitchHeight: "56rpx",
|
||||
SwitchLineHeight: "56rpx",
|
||||
SwitchInsideHeight: "40rpx",
|
||||
SwitchInsideWidth: "40rpx",
|
||||
SwitchInsideOpenTransform: "translateX(155%)",
|
||||
SwitchInsideCloseTransform: "translateX(20%)",
|
||||
});
|
||||
const themeVars2 = ref({
|
||||
cellBoxShadow: "0px 0px 0px 0px",
|
||||
@@ -131,13 +126,14 @@ Taro.useDidShow(() => {
|
||||
// 查询列表
|
||||
function getTimingList() {
|
||||
timeCtrlList({ id }).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.forEach((item) => {
|
||||
const fmType = "hh:mm";
|
||||
item.openTime = formatDateString(item.openTime, fmType);
|
||||
item.closeTime = formatDateString(item.closeTime, fmType);
|
||||
});
|
||||
timList.value = res.data || [];
|
||||
if (res.code == 200) {
|
||||
// 使用 map 创建新数组,确保 Vue 响应式更新
|
||||
timList.value = res.data.map((item) => ({
|
||||
...item,
|
||||
isOpen: item.isOpen === 1, // 将 0/1 转换为布尔值
|
||||
openTime: item.openTime ? item.openTime.substring(0, 5) : '',
|
||||
closeTime: item.closeTime ? item.closeTime.substring(0, 5) : '',
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -156,7 +152,7 @@ function remove(id) {
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delTimeCtrl({ id }).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "删除成功";
|
||||
getTimingList();
|
||||
@@ -172,10 +168,10 @@ function setOpen({ value, event }, item: any) {
|
||||
if (event) {
|
||||
const data = {
|
||||
id: item.id,
|
||||
isOpen: item.isOpen,
|
||||
isOpen: item.isOpen ? 1 : 0, // 布尔转数字
|
||||
};
|
||||
setTimeCtrlOpen(data).then(res=>{
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "设置成功";
|
||||
}else{
|
||||
|
||||
@@ -370,8 +370,19 @@ function save() {
|
||||
url: "/pages/main/home",
|
||||
});
|
||||
}, 1500);
|
||||
} else {
|
||||
// 显示错误提示
|
||||
state.show = true;
|
||||
state.msg = res.msg || "保存失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
|
||||
@@ -490,8 +490,19 @@ function getCheckDevice() {
|
||||
state.show = true;
|
||||
state.msg = "设备异常";
|
||||
}
|
||||
} else {
|
||||
// 显示错误提示
|
||||
state.show = true;
|
||||
state.msg = res.msg || "检查设备失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
@@ -549,7 +560,17 @@ function next() {
|
||||
Taro.redirectTo({
|
||||
url: "/my/addDevSuccess?name=添加测控一体机&page=" + page,
|
||||
});
|
||||
} else {
|
||||
// 显示错误提示
|
||||
state.show = true;
|
||||
state.msg = res.msg || "添加失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
}).catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
});
|
||||
} else {
|
||||
if (num != 1 && status.value == 1) {
|
||||
|
||||
@@ -370,8 +370,19 @@ function getCheckDevice() {
|
||||
state.show = true;
|
||||
state.msg = "设备异常";
|
||||
}
|
||||
} else {
|
||||
// 显示错误提示
|
||||
state.show = true;
|
||||
state.msg = res.msg || "检查设备失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
@@ -423,8 +434,19 @@ function next() {
|
||||
Taro.redirectTo({
|
||||
url: "/my/addDevSuccess?name=添加水质检测仪&page=" + page,
|
||||
});
|
||||
} else {
|
||||
// 显示错误提示
|
||||
state.show = true;
|
||||
state.msg = res.msg || "添加失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// 处理网络错误等异常情况
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
|
||||
@@ -149,7 +149,7 @@ Taro.useDidShow(() => {
|
||||
// 获取报警电话列表
|
||||
function getWarnPhoneList() {
|
||||
warnPhoneList().then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
phoneList.value = res.data;
|
||||
phone1.value = res.data[0] ? res.data[0] : "";
|
||||
phone2.value = res.data[1] ? res.data[1] : "";
|
||||
@@ -203,9 +203,11 @@ function save() {
|
||||
};
|
||||
isLoading.value = true
|
||||
updateWarnPhone(params).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.type = "success";
|
||||
state.show = true;
|
||||
state.msg = "保存成功";
|
||||
getWarnPhoneList();
|
||||
}
|
||||
}).finally(()=>{
|
||||
isLoading.value = false
|
||||
|
||||
@@ -255,8 +255,9 @@ Taro.useDidShow(() => {
|
||||
});
|
||||
// 设备列表
|
||||
function getDeviceList() {
|
||||
allDeviceList({ type: 1 }).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
const userId = Taro.getStorageSync("UserId");
|
||||
allDeviceList({ type: 1,rootUserId:userId }).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
deviceList.value = res.data;
|
||||
}
|
||||
});
|
||||
@@ -288,7 +289,7 @@ function removeDev(id: number) {
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
deviceUnbind({ id }).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "移除成功";
|
||||
getDeviceList();
|
||||
@@ -323,7 +324,7 @@ function goScan() {
|
||||
success: (res) => {
|
||||
const result = res.result;
|
||||
deviceScan({ qrcode: result }).then((v) => {
|
||||
if (v.statusCode == 200) {
|
||||
if (v.code == 200) {
|
||||
params.devType = String(v.data.deviceType);
|
||||
params.devNum = v.data.serialNum;
|
||||
alertShow.value = false;
|
||||
@@ -372,7 +373,7 @@ function submit() {
|
||||
// 查询塘口列表
|
||||
function getPondList() {
|
||||
getPond2().then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
pondList.value = res.data;
|
||||
if (pondId) {
|
||||
params.pondName = res.data.find((r) => r.id == pondId)?.["pondName"];
|
||||
|
||||
@@ -170,7 +170,7 @@ function del(id) {
|
||||
content: "确认删除该子账号!",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
delete_user_child({ id }).then((res: any) => {
|
||||
delete_user_child(id).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
state.show = true;
|
||||
state.msg = "删除成功";
|
||||
|
||||
@@ -176,7 +176,7 @@ function login() {
|
||||
? formatDate(new Date(res.data.createdTime))
|
||||
: formatDate(new Date())
|
||||
);
|
||||
Taro.setStorageSync("UserName", res.data.userName || loginForm.phonenumber);
|
||||
Taro.setStorageSync("UserName", res.data.nickName || loginForm.phonenumber);
|
||||
Taro.setStorageSync("Phone", loginForm.phonenumber);
|
||||
Taro.setStorageSync("LoginType", "1");
|
||||
Taro.setStorageSync("UserId", res.data.userId || "");
|
||||
@@ -185,7 +185,7 @@ function login() {
|
||||
store.updateUnLogin(2);
|
||||
store.updateRootUserId(res.data.userId || "");
|
||||
store.updateUserId(res.data.userId || "");
|
||||
store.updateRootUserName(res.data.userName || loginForm.phonenumber);
|
||||
store.updateRootUserName(res.data.nickName || loginForm.phonenumber);
|
||||
state.msg = "登录成功";
|
||||
state.show = true;
|
||||
Taro.switchTab({
|
||||
|
||||
@@ -793,7 +793,6 @@ function handleSubscriptionStatus(status, tmplId, message) {
|
||||
} else if (status === "reject") {
|
||||
requestUserSubscription([tmplId], "订阅消息", `请授权开通${message}`);
|
||||
} else if (status === "ban") {
|
||||
console.log(`${message}的订阅已被后台封禁`);
|
||||
} else {
|
||||
requestUserSubscription([tmplId], "订阅消息", `请授权开通${message}`);
|
||||
}
|
||||
@@ -817,32 +816,19 @@ function requestUserSubscription(tmplIds, title, content) {
|
||||
Taro.requestSubscribeMessage({
|
||||
...params,
|
||||
success: function (subscribeRes) {
|
||||
console.log("订阅响应:", subscribeRes);
|
||||
tmplIds.forEach((tmplId) => {
|
||||
if (subscribeRes[tmplId] === "accept") {
|
||||
state.show = true;
|
||||
state.msg = "订阅成功";
|
||||
} else if (subscribeRes[tmplId] === "reject") {
|
||||
console.log(tmplId, "用户拒绝订阅");
|
||||
} else if (subscribeRes[tmplId] === "ban") {
|
||||
console.log(tmplId, "订阅被封禁");
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function (error) {
|
||||
console.log("订阅请求失败:", error);
|
||||
},
|
||||
complete: function (r) {
|
||||
console.log(r);
|
||||
},
|
||||
});
|
||||
// }
|
||||
// });
|
||||
}
|
||||
},
|
||||
fail: function (error) {
|
||||
console.error("弹窗失败:", error);
|
||||
},
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
<nut-col :span="24" class="view_f">
|
||||
<view :style="{ width: '30%' }" class="font_32 c_444">新手机号</view>
|
||||
<view :style="{ width: '70%' }">
|
||||
<nut-input type="number" v-model="newPhone" :border="false" input-align="right" placeholder="请输入新手机号" clearable max-length="11" :cursor="String(phnewPhoneone1).length" />
|
||||
<nut-input type="number" v-model="newPhone" :border="false" input-align="right" placeholder="请输入新手机号" clearable max-length="11" :cursor="String(newPhone).length" />
|
||||
</view>
|
||||
</nut-col>
|
||||
<nut-col :span="24">
|
||||
@@ -336,7 +336,7 @@ function getWarnMsg() {
|
||||
pageNum: 1,
|
||||
})
|
||||
msgWarn(warnParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
const unReadCount = res.data.unReadCount
|
||||
if (unReadCount) {
|
||||
Taro.setTabBarBadge({
|
||||
@@ -496,7 +496,7 @@ function toSetPhone() {
|
||||
smsCode: code.value,
|
||||
}
|
||||
updatePhone(data).then(res => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.msg = "修改成功"
|
||||
state.show = true
|
||||
|
||||
@@ -548,7 +548,7 @@ function toSetName() {
|
||||
newName: newName.value,
|
||||
}
|
||||
updateNickName(data).then(res => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.msg = "修改成功"
|
||||
state.show = true
|
||||
nextTick(() => {
|
||||
|
||||
@@ -8,8 +8,8 @@ const timeOutSeconds = 10000;
|
||||
const getBaseUrl = () => {
|
||||
let BASE_URL = ''
|
||||
if (process.env.TARO_ENV === 'h5') {
|
||||
BASE_URL = 'https://www.qdintc.com/fishery-api' // 线上调试后端
|
||||
// BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
|
||||
// BASE_URL = 'https://www.qdintc.com/fishery-api' // 线上调试后端
|
||||
BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
|
||||
} else {
|
||||
BASE_URL = 'https://api.yuceyun.cn' //填写你的请求域名
|
||||
// BASE_URL = 'https://dev.yuceyun.cn' //测试环境
|
||||
|
||||
Reference in New Issue
Block a user