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