fix: 后端接口改为java,联调接口修改。
This commit is contained in:
@@ -4,7 +4,12 @@ module.exports = {
|
||||
presets: [
|
||||
['taro', {
|
||||
framework: 'vue3',
|
||||
ts: true
|
||||
ts: true,
|
||||
targets: {
|
||||
chrome: '60',
|
||||
ios: '10',
|
||||
android: '5'
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ const config = {
|
||||
outputRoot: 'dist',
|
||||
plugins: ['@tarojs/plugin-html'],
|
||||
defineConstants: {
|
||||
// Vue 3 特性标志
|
||||
__VUE_OPTIONS_API__: JSON.stringify(true),
|
||||
__VUE_PROD_DEVTOOLS__: JSON.stringify(false),
|
||||
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(false)
|
||||
},
|
||||
copy: {
|
||||
patterns: [
|
||||
@@ -142,6 +146,39 @@ const config = {
|
||||
chain.plugin('unplugin-vue-components').use(Components({
|
||||
resolvers: [NutUIResolver()]
|
||||
}))
|
||||
chain.plugin('unplugin-auto-import').use(
|
||||
AutoImport({
|
||||
imports: ['vue'],
|
||||
dts: 'types/auto-imports.d.ts',
|
||||
dirs: ['src/utils', 'src/store'],
|
||||
vueTemplate: true
|
||||
})
|
||||
)
|
||||
},
|
||||
devServer: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://api.yuceyun.cn',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/api': ''
|
||||
}
|
||||
},
|
||||
'/auth': {
|
||||
target: 'https://api.yuceyun.cn',
|
||||
changeOrigin: true
|
||||
},
|
||||
'/resource': {
|
||||
target: 'https://api.yuceyun.cn',
|
||||
changeOrigin: true
|
||||
}
|
||||
},
|
||||
client: {
|
||||
overlay: {
|
||||
errors: true,
|
||||
warnings: false
|
||||
}
|
||||
}
|
||||
},
|
||||
publicPath: '/',
|
||||
staticDirectory: 'static',
|
||||
|
||||
@@ -1,176 +1,167 @@
|
||||
import httpService from '@/utils/request'
|
||||
import {useRootUserStore} from '@/store/index';
|
||||
import API from './config'
|
||||
/** 设备相关接口---------------------------------------- */
|
||||
const store:any = useRootUserStore();
|
||||
|
||||
// 设备列表
|
||||
export function allDeviceList(params) {
|
||||
if(params){
|
||||
params.rootuserid = store.getRootUserId
|
||||
}
|
||||
return httpService.get(`/api/device/list_all_device`,{params})
|
||||
return httpService.get(API.DEVICE.LIST_ALL(), {params})
|
||||
}
|
||||
// 设备详情
|
||||
export function deviceInfo(data){
|
||||
return httpService.post(`/api/device/one_device_info?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.INFO(), {data})
|
||||
}
|
||||
// 解除绑定
|
||||
export function deviceUnbind(data){
|
||||
return httpService.post(`/api/device/break_pond?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.UNBIND(), {data})
|
||||
}
|
||||
// 将设备及开关绑定到塘口
|
||||
export function bandDeviceToPond(data){
|
||||
return httpService.put(`/api/pond/select_device_switch?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.POND.BIND_DEVICE(), {data})
|
||||
}
|
||||
// 设备图表数据
|
||||
export function deviceHistory(data){
|
||||
return httpService.post(`/api/device/data_history?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.HISTORY(), {data})
|
||||
}
|
||||
// 修改设备名称
|
||||
export function deviceUpdateName(data){
|
||||
return httpService.put(`/api/device/update_name?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.UPDATE_NAME(), {data})
|
||||
}
|
||||
// 修改设备关联塘口
|
||||
export function deviceUpdatePond(data){
|
||||
return httpService.put(`/api/device/update_pond?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.UPDATE_POND(), {data})
|
||||
}
|
||||
// 修改设备接电方式
|
||||
export function deviceUpdateV(data){
|
||||
return httpService.put(`/api/device/update_voltage_type?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.UPDATE_VOLTAGE(), {data})
|
||||
}
|
||||
// 删除设备
|
||||
export function deviceDel(data){
|
||||
return httpService.delete(`/api/device/delete?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.delete(API.DEVICE.DELETE(), {data})
|
||||
}
|
||||
// 扫描设备编码
|
||||
export function deviceScan(params){
|
||||
if(params){
|
||||
params.rootuserid = store.getRootUserId
|
||||
}
|
||||
return httpService.get(`/api/device/check_device_qrcode`,{params})
|
||||
return httpService.get(API.DEVICE.SCAN(), {params})
|
||||
}
|
||||
// 检测设备是否在线
|
||||
export function checkDeviceStatus(params){
|
||||
if(params){
|
||||
params.rootuserid = store.getRootUserId
|
||||
}
|
||||
return httpService.get(`/api/device/check_device_status`,{params})
|
||||
return httpService.get(API.DEVICE.CHECK_STATUS(), {params})
|
||||
}
|
||||
// 盐度设置
|
||||
export function setSal(data){
|
||||
return httpService.post(`/api/device/detector_salinitycompensation?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.SET_SALINITY(), {data})
|
||||
}
|
||||
// 设备校准
|
||||
export function deviceCalibration(data){
|
||||
return httpService.post(`/api/device/detector_calibrate?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.CALIBRATE(), {data})
|
||||
}
|
||||
/** 水质检测仪------------------------------------------------ */
|
||||
// 添加-水质检测仪
|
||||
export function addDeviceDetector(data) {
|
||||
return httpService.post(`/api/device/add_device_detector?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.ADD_DETECTOR(), {data})
|
||||
}
|
||||
// 设置溶解氧/水温告警
|
||||
export function setWarnCall(data){
|
||||
return httpService.post(`/api/device/set_oxy_warn_call?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.SET_WARN_CALL(), {data})
|
||||
}
|
||||
// 设置溶解氧上下限
|
||||
export function setOxyWarn(data){
|
||||
return httpService.put(`/api/device/set_oxy_warn_value?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.SET_OXY_WARN(), {data})
|
||||
}
|
||||
// 设置温度上下限
|
||||
export function setTempWarn(data){
|
||||
return httpService.put(`/api/device/set_temp_warn_value?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.SET_TEMP_WARN(), {data})
|
||||
}
|
||||
// 溶解氧饱和度
|
||||
export function getSaturability(data){
|
||||
return httpService.post(`/api/device/get_saturability?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.GET_SATURABILITY(), {data})
|
||||
}
|
||||
/** 控制一体机------------------------------------------------ */
|
||||
// 添加-控制一体机
|
||||
export function addDeviceController(data) {
|
||||
return httpService.post(`/api/device/add_device_controller?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.DEVICE.ADD_CONTROLLER(), {data})
|
||||
}
|
||||
// 启停溶解氧
|
||||
export function setOxyOpen(data){
|
||||
return httpService.put(`/api/device/set_controller_oxy_open?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.SET_OXY_OPEN(), {data})
|
||||
}
|
||||
/** 联动控制------------------------------------- */
|
||||
// 设备控制器列表
|
||||
export function linkerCtrlList(data){
|
||||
return httpService.post(`/api/linked-ctrl/fetch?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.LINKED_CTRL.LIST(), {data})
|
||||
}
|
||||
// 添加联动控制
|
||||
export function addLinkerCtrl(data){
|
||||
return httpService.post(`/api/linked-ctrl/add?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.LINKED_CTRL.ADD(), {data})
|
||||
}
|
||||
// 修改联动控制
|
||||
export function updateLinkerCtrl(data){
|
||||
return httpService.put(`/api/linked-ctrl/update?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.LINKED_CTRL.UPDATE(), {data})
|
||||
}
|
||||
// 删除联动控制
|
||||
export function delLinkerCtrl(data){
|
||||
return httpService.delete(`/api/linked-ctrl/delete?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.delete(API.LINKED_CTRL.DELETE(), {data})
|
||||
}
|
||||
// 设置联动控制上下限开关
|
||||
export function setLinkOpen(data){
|
||||
return httpService.put(`/api/linked-ctrl/set_open?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.LINKED_CTRL.SET_OPEN(), {data})
|
||||
}
|
||||
/** 开关------------------------------------------------ */
|
||||
// 开关列表
|
||||
export function pondSwitchList(data){
|
||||
return httpService.post(`/api/device-switch/get_pond_switch?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.SWITCH.POND_LIST(), {data})
|
||||
}
|
||||
// 开关详情
|
||||
export function switchInfo(data){
|
||||
return httpService.post(`/api/device-switch/one_switch_info?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.SWITCH.INFO(), {data})
|
||||
}
|
||||
// 修改开关名称
|
||||
export function updateSwitchName(data){
|
||||
return httpService.put(`/api/device-switch/update_name?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.UPDATE_NAME(), {data})
|
||||
}
|
||||
// 修改关联塘口
|
||||
export function updateSwitchPond(data){
|
||||
return httpService.put(`/api/device-switch/update_pond?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.UPDATE_POND(), {data})
|
||||
}
|
||||
// 修改接线方式
|
||||
export function updateSwitchType(data){
|
||||
return httpService.put(`/api/device-switch/update_voltage_type?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.UPDATE_VOLTAGE(), {data})
|
||||
}
|
||||
// 单个开关 启停
|
||||
export function turnSwitch(data){
|
||||
return httpService.put(`/api/device-switch/turn_switch?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.TURN(), {data})
|
||||
}
|
||||
// 所有开关 启停
|
||||
export function turnPondSwitch(data){
|
||||
return httpService.put(`/api/device-switch/turn_pond_switch?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.TURN_POND(), {data})
|
||||
}
|
||||
|
||||
// 电压告警开关 开启或关闭
|
||||
export function voltageCheckOpen(data){
|
||||
return httpService.put(`/api/device/voltage_check_open?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.DEVICE.VOLTAGE_CHECK(), {data})
|
||||
}
|
||||
// 电流告警开关 开启或关闭
|
||||
export function electricCheckOpen(data){
|
||||
return httpService.put(`/api/device-switch/electric_check_open?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.ELECTRIC_CHECK(), {data})
|
||||
}
|
||||
// 电流告警开关 开启或关闭
|
||||
export function electricSet(data){
|
||||
return httpService.put(`/api/device-switch/electric_set?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.SWITCH.ELECTRIC_SET(), {data})
|
||||
}
|
||||
|
||||
// 定时开关列表
|
||||
export function timeCtrlList(data){
|
||||
return httpService.put(`/api/device-switch-time-ctrl/list?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.TIME_CTRL.LIST(), {data})
|
||||
}
|
||||
export function addTimeCtrl(data){
|
||||
return httpService.post(`/api/device-switch-time-ctrl/add?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.TIME_CTRL.ADD(), {data})
|
||||
}
|
||||
export function delTimeCtrl(data){
|
||||
return httpService.delete(`/api/device-switch-time-ctrl/delete?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.delete(API.TIME_CTRL.DELETE(), {data})
|
||||
}
|
||||
export function setTimeCtrlOpen(data){
|
||||
return httpService.post(`/api/device-switch-time-ctrl/update?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.TIME_CTRL.UPDATE(), {data})
|
||||
}
|
||||
// 夜间防误触
|
||||
export function setNightProtect(data){
|
||||
return httpService.put(`/api/pond/keep_night_open?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.POND.KEEP_NIGHT_OPEN(), {data})
|
||||
}
|
||||
@@ -1,23 +1,35 @@
|
||||
import httpService from '@/utils/request'
|
||||
import {useRootUserStore} from '@/store/index';
|
||||
const store:any = useRootUserStore();
|
||||
import API from './config'
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
// 塘口模式1
|
||||
export function getPond1() {
|
||||
return httpService.get(`/api/pond/list_mode1?rootuserid=${store.getRootUserId}`)
|
||||
// 从本地存储获取手机号
|
||||
const userKeyword = Taro.getStorageSync('Phone');
|
||||
const queryParams = {
|
||||
params: {
|
||||
userKeyword: userKeyword || undefined
|
||||
}
|
||||
};
|
||||
return httpService.get(API.HOME.POND_LIST(), { params: queryParams });
|
||||
}
|
||||
|
||||
// 塘口模式2
|
||||
export function getPond2(){
|
||||
return httpService.get(`/api/pond/list_mode2?rootuserid=${store.getRootUserId}`)
|
||||
return httpService.get(API.HOME.POND_LIST_MODE2())
|
||||
}
|
||||
|
||||
// 公告列表
|
||||
export function noticeList(){
|
||||
return httpService.get(`/api/sys-notice/notice_list?rootuserid=${store.getRootUserId}`)
|
||||
return httpService.get(API.HOME.NOTICE_LIST())
|
||||
}
|
||||
|
||||
// 即将到期设备列表
|
||||
export function deviceDead(){
|
||||
return httpService.get(`/api/device/list_device_dead?rootuserid=${store.getRootUserId}`)
|
||||
return httpService.get(API.HOME.DEVICE_DEAD())
|
||||
}
|
||||
|
||||
// 获取设备票据
|
||||
export function getDeviceTicket(){
|
||||
return httpService.get(`/api/user-center/getsnticket`)
|
||||
return httpService.get(API.HOME.DEVICE_TICKET())
|
||||
}
|
||||
@@ -1,23 +1,29 @@
|
||||
import httpService from '@/utils/request'
|
||||
import API from './config'
|
||||
|
||||
// 短信登录
|
||||
export function loginSms(phonenumber, code) {
|
||||
const data = {
|
||||
mobilePhone:phonenumber,
|
||||
phonenumber:phonenumber,
|
||||
smsCode:code,
|
||||
grantType:"sms",
|
||||
clientId:"428a8310cd442757ae699df5d894f051",
|
||||
tenantId:"111111",
|
||||
}
|
||||
return httpService.post(`/api/login/use_sms_code`, {
|
||||
data
|
||||
})
|
||||
return httpService.post(API.AUTH.LOGIN_SMS(), {data})
|
||||
}
|
||||
|
||||
// 获取短信验证码
|
||||
export function smsCode(phonenumber) {
|
||||
return httpService.get(`/sms_code/request?mobilePhone=` + phonenumber)
|
||||
return httpService.get(`${API.AUTH.SMS_CODE()}?phonenumber=${phonenumber}`)
|
||||
}
|
||||
|
||||
// 微信手机号登录
|
||||
export function loginWxToPhone(data) {
|
||||
return httpService.post(`/api/login/use_wechat` , {data})
|
||||
return httpService.post(API.AUTH.LOGIN_WECHAT(), {data})
|
||||
}
|
||||
|
||||
// 登出
|
||||
export function logoutFun() {
|
||||
return httpService.get(`/api/user-center/logout`)
|
||||
return httpService.get(API.AUTH.LOGOUT())
|
||||
}
|
||||
@@ -1,23 +1,28 @@
|
||||
import httpService from '@/utils/request'
|
||||
import {useRootUserStore} from '@/store/index';
|
||||
const store:any = useRootUserStore();
|
||||
import API from './config'
|
||||
|
||||
// 查询充值记录
|
||||
export function msgPay(data) {
|
||||
return httpService.post(`/api/message/page_pay?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.get(API.MESSAGE.PAY(), { params: data })
|
||||
}
|
||||
|
||||
// 查询报警记录
|
||||
export function msgWarn(data) {
|
||||
return httpService.post(`/api/message/page_warn?rootuserid=${store.getRootUserId}`,{data})
|
||||
// 后端接口:GET /fishery/messageWarn/list,使用查询参数传递分页信息
|
||||
return httpService.get(API.MESSAGE.WARN(), { params: data })
|
||||
}
|
||||
|
||||
// 查询开关记录
|
||||
export function msgSwitch(data) {
|
||||
return httpService.post(`/api/message/page_op_record?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.get(API.MESSAGE.SWITCH(), { params: data })
|
||||
}
|
||||
|
||||
// 已读一条消息
|
||||
export function msgRead(data) {
|
||||
return httpService.put(`/api/message/read_one_warn?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.MESSAGE.READ_ONE(), {data})
|
||||
}
|
||||
|
||||
// 已读全部
|
||||
export function msgReadAll(data) {
|
||||
return httpService.put(`/api/message/read_all_warn?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.MESSAGE.READ_ALL(), {data})
|
||||
}
|
||||
@@ -1,33 +1,42 @@
|
||||
import httpService from '@/utils/request'
|
||||
import API from './config'
|
||||
|
||||
// 报警电话列表
|
||||
export function warnPhoneList() {
|
||||
return httpService.get(`/api/user-center/list_warn_phone`)
|
||||
return httpService.get(API.USER.WARN_PHONE_LIST())
|
||||
}
|
||||
|
||||
// 修改报警电话
|
||||
export function updateWarnPhone(data) {
|
||||
return httpService.put(`/api/user-center/update_warn_phone`,{data})
|
||||
return httpService.put(API.USER.UPDATE_WARN_PHONE(), {data})
|
||||
}
|
||||
|
||||
// 修改手机号码
|
||||
export function updatePhone(data) {
|
||||
return httpService.put(`/api/user-center/update_mobile_phone`,{data})
|
||||
return httpService.put(API.USER.UPDATE_PHONE(), {data})
|
||||
}
|
||||
|
||||
// 验证验证码
|
||||
export function verifyCode(params) {
|
||||
return httpService.post(`/sms_code/verify`,{params})
|
||||
return httpService.post(API.USER.VERIFY_CODE(), {params})
|
||||
}
|
||||
|
||||
// 修改昵称
|
||||
export function updateNickName(data) {
|
||||
return httpService.put(`/api/user-center/update_user_name`,{data})
|
||||
return httpService.put(API.USER.UPDATE_NICKNAME(), {data})
|
||||
}
|
||||
|
||||
// 支付选项页面
|
||||
export function payOption() {
|
||||
return httpService.post(`/api/tenpay/get_pay_item`)
|
||||
return httpService.post(API.PAY.OPTIONS())
|
||||
}
|
||||
|
||||
// 创建支付订单
|
||||
export function createOrder(data) {
|
||||
return httpService.post(`/api/tenpay/create_order`,{data})
|
||||
return httpService.post(API.PAY.CREATE_ORDER(), {data})
|
||||
}
|
||||
|
||||
// 微信支付
|
||||
export function wxPayOrder(data) {
|
||||
return httpService.post(`https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi`,{data})
|
||||
return httpService.post(API.PAY.WECHAT_PAY(), {data})
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
import httpService from '@/utils/request'
|
||||
import {useRootUserStore} from '@/store/index';
|
||||
const store:any = useRootUserStore();
|
||||
import API from './config'
|
||||
// 新增塘口
|
||||
export function PondAdd(data) {
|
||||
return httpService.post(`/api/pond/add?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.POND.ADD(), {data})
|
||||
}
|
||||
// 修改塘口
|
||||
export function PondUpdate(data){
|
||||
return httpService.put(`/api/pond/update?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.put(API.POND.UPDATE(), {data})
|
||||
}
|
||||
// 删除塘口
|
||||
export function PondDel(data){
|
||||
return httpService.delete(`/api/pond/delete?rootuserid=${store.getRootUserId}`,{data})
|
||||
// 后端接口:DELETE /{ids},参数拼接到URL路径
|
||||
return httpService.delete(API.POND.DELETE() + '/' + data.id)
|
||||
}
|
||||
// 鱼类列表
|
||||
export function fishList(){
|
||||
return httpService.post(`/api/fish/get`)
|
||||
return httpService.get(API.POND.FISH_LIST())
|
||||
}
|
||||
// 塘口基本数据
|
||||
export function pondBaseInfo(data){
|
||||
return httpService.post(`/api/pond/base_info?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.get(API.POND.BASE_INFO() + '/' + data.id)
|
||||
}
|
||||
// 塘口下设备信息
|
||||
export function pondDeviceInfo(data){
|
||||
return httpService.post(`/api/pond/pond_device_info?rootuserid=${store.getRootUserId}`,{data})
|
||||
return httpService.post(API.POND.DEVICE_INFO(), {data})
|
||||
}
|
||||
@@ -1,17 +1,22 @@
|
||||
import httpService from '@/utils/request'
|
||||
import API from './config'
|
||||
|
||||
// 获取子账号列表
|
||||
export function list_user_child() {
|
||||
return httpService.get(`/api/user-center/list_user_child`)
|
||||
return httpService.get(API.SUB_ACCOUNT.LIST())
|
||||
}
|
||||
|
||||
// 添加
|
||||
export function add_user_child(data) {
|
||||
return httpService.post(`/api/user-center/add_user_child?mobilePhone=${data}`)
|
||||
return httpService.post(`${API.SUB_ACCOUNT.ADD()}?mobilePhone=${data}`)
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delete_user_child(data) {
|
||||
return httpService.delete(`/api/user-center/delete_user_child`,{data})
|
||||
return httpService.delete(API.SUB_ACCOUNT.DELETE(), {data})
|
||||
}
|
||||
|
||||
// 获取父级账号
|
||||
export function list_user_parent() {
|
||||
return httpService.get(`/api/user-center/list_user_parent`)
|
||||
return httpService.get(API.SUB_ACCOUNT.PARENT())
|
||||
}
|
||||
@@ -9,6 +9,9 @@ const App = createApp({
|
||||
})
|
||||
App.use(createPinia())
|
||||
App.provide('store', useRootUserStore());
|
||||
|
||||
// 只在小程序环境执行更新检查
|
||||
if (process.env.TARO_ENV !== 'h5') {
|
||||
//判断目前微信版本是否支持自动更新
|
||||
if (Taro.canIUse("getUpdateManager")) {
|
||||
const update = Taro.getUpdateManager();
|
||||
@@ -46,4 +49,5 @@ if (Taro.canIUse("getUpdateManager")) {
|
||||
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
|
||||
})
|
||||
}
|
||||
}
|
||||
export default App
|
||||
|
||||
@@ -102,8 +102,8 @@ onMounted(() => {
|
||||
// 鱼类列表
|
||||
function getFishList() {
|
||||
fishList().then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
fishArray.value = res.data;
|
||||
if (res.code == 200) {
|
||||
fishArray.value = res.rows || [];
|
||||
resTypeList();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -214,14 +214,33 @@ function cancelDate() {
|
||||
function save() {
|
||||
addRef.value?.validate().then(({ valid, errors }) => {
|
||||
if (valid) {
|
||||
isLoading.value = true
|
||||
PondAdd(formData).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
isLoading.value = true;
|
||||
|
||||
// 将fishKindIds数组转换为字符串格式 "[1,2]"
|
||||
let fishKindIdsStr = '';
|
||||
if (Array.isArray(formData.fishKindIds) && formData.fishKindIds.length > 0) {
|
||||
// 转换为数字数组,然后转JSON字符串
|
||||
const fishIds = formData.fishKindIds.map(id => Number(id));
|
||||
fishKindIdsStr = JSON.stringify(fishIds);
|
||||
}
|
||||
|
||||
// 转换数据格式以符合后端要求
|
||||
const requestData = {
|
||||
pondName: formData.pondName,
|
||||
fishKindIds: fishKindIdsStr, // 使用JSON字符串格式 "[1,2]"
|
||||
area: Number(formData.area) || 0,
|
||||
density: Number(formData.density) || 0,
|
||||
placeTime: formData.placeTime || null,
|
||||
};
|
||||
|
||||
console.log('添加塘口数据', requestData);
|
||||
PondAdd(requestData).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
saveRes.value = true;
|
||||
}
|
||||
}).finally(() => {
|
||||
isLoading.value = false
|
||||
})
|
||||
isLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
console.warn("error:", errors);
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
<script setup lang="ts" name="UpdatePond">
|
||||
import { UpdateFormType } from "./types";
|
||||
import Fish from "@/components/other/fish";
|
||||
import { PondUpdate, pondBaseInfo, pondDeviceInfo, PondDel } from "@/api/pond";
|
||||
import { PondUpdate, pondBaseInfo, pondDeviceInfo, PondDel, fishList } from "@/api/pond";
|
||||
import { allDeviceList, bandDeviceToPond } from "@/api/device";
|
||||
import { formatDate, sortByField } from "@/utils/tools";
|
||||
import Taro from "@tarojs/taro";
|
||||
@@ -285,6 +285,7 @@ const showFish = ref<boolean>(false);
|
||||
const isLoading = ref<boolean>(false);
|
||||
const d_isLoading = ref<boolean>(false);
|
||||
const fishListInfo = ref("");
|
||||
const allFishList = ref<any[]>([]);
|
||||
const detectorList = ref([]);
|
||||
const controlList = ref([]);
|
||||
const bandDevShow = ref(false);
|
||||
@@ -301,7 +302,10 @@ const Uid = Taro.getStorageSync("UserId");
|
||||
const rootuserid = ref(store.getRootUserId);
|
||||
/** -----------------method start----------------- */
|
||||
Taro.useDidShow(() => {
|
||||
// 先加载鱼类列表,然后再加载塔口信息
|
||||
getAllFishList().then(() => {
|
||||
info();
|
||||
});
|
||||
getDeviceList();
|
||||
getDevicesList();
|
||||
});
|
||||
@@ -337,20 +341,35 @@ function save() {
|
||||
updateRef.value?.validate().then(({ valid, errors }) => {
|
||||
if (valid) {
|
||||
if (formData.id) {
|
||||
// 将fishKindIds数组转换为字符串格式 "[1,2]"
|
||||
let fishKindIdsStr = '';
|
||||
if (Array.isArray(formData.fishKindIds) && formData.fishKindIds.length > 0) {
|
||||
// 转换为数字数组,然后转JSON字符串
|
||||
const fishIds = formData.fishKindIds.map(id => Number(id));
|
||||
fishKindIdsStr = JSON.stringify(fishIds);
|
||||
}
|
||||
|
||||
const data = {
|
||||
id: formData.id,
|
||||
pondName: formData.pondName,
|
||||
fishKindIds: formData.fishKindIds,
|
||||
fishKindIds: fishKindIdsStr, // 使用字符串格式
|
||||
area: formData.area,
|
||||
density: formData.density,
|
||||
placeTime: formData.placeTime ? formData.placeTime : null,
|
||||
};
|
||||
console.log('保存数据', data);
|
||||
isLoading.value = true;
|
||||
PondUpdate(data)
|
||||
.then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "保存成功";
|
||||
// 延迟返回首页,让用户看到成功提示
|
||||
setTimeout(() => {
|
||||
Taro.switchTab({
|
||||
url: "/pages/main/home",
|
||||
});
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -362,6 +381,39 @@ function save() {
|
||||
}
|
||||
});
|
||||
}
|
||||
// 获取所有鱼类列表
|
||||
function getAllFishList() {
|
||||
return fishList().then((res: any) => {
|
||||
console.log('鱼类列表接口返回', res);
|
||||
// 处理不同的返回格式
|
||||
if (res.rows) {
|
||||
// 直接返回 {total, rows} 格式
|
||||
allFishList.value = res.rows || [];
|
||||
console.log('鱼类列表加载完成(rows)', allFishList.value);
|
||||
} else if (res.code == 200 && res.data) {
|
||||
allFishList.value = res.data || [];
|
||||
console.log('鱼类列表加载完成(code)', allFishList.value);
|
||||
} else if (res.statusCode == 200 && res.data) {
|
||||
allFishList.value = res.data || [];
|
||||
console.log('鱼类列表加载完成(statusCode)', allFishList.value);
|
||||
} else {
|
||||
console.error('鱼类列表加载失败', res);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 根据鱼类ID获取鱼类名称
|
||||
function getFishNames(fishIds: any[]) {
|
||||
const names: string[] = [];
|
||||
console.log('查找鱼类名称', { fishIds, allFishList: allFishList.value });
|
||||
fishIds.forEach((id: any) => {
|
||||
const fish = allFishList.value.find((f: any) => f.id == id || f.id == String(id));
|
||||
if (fish) {
|
||||
names.push(fish.fishName);
|
||||
}
|
||||
});
|
||||
console.log('鱼类名称结果', names.join(","));
|
||||
return names.join(",");
|
||||
}
|
||||
// 查看鱼塘详情
|
||||
function info() {
|
||||
if (!id) {
|
||||
@@ -371,25 +423,33 @@ function info() {
|
||||
return;
|
||||
}
|
||||
pondBaseInfo({ id }).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
formData.id = res.data.id;
|
||||
formData.pondName = res.data.pondName;
|
||||
formData.fishKindIds = res.data.fishKindIds;
|
||||
formData.area = res.data.area;
|
||||
formData.density = res.data.density;
|
||||
|
||||
// 鱼类列表格式化
|
||||
const fishArray: any = [];
|
||||
const fishNames: any = [];
|
||||
res.data.listFish.forEach((item: any) => {
|
||||
fishArray.push(String(item.id));
|
||||
fishNames.push(String(item.fishName));
|
||||
});
|
||||
formData.fishKindIds = fishArray;
|
||||
fishListInfo.value = fishNames.length > 0 ? fishNames.join(",") : "";
|
||||
// 解析fishKindIds(后端返回的是字符串)
|
||||
let fishIds = [];
|
||||
try {
|
||||
if (typeof res.data.fishKindIds === 'string') {
|
||||
fishIds = JSON.parse(res.data.fishKindIds);
|
||||
} else if (Array.isArray(res.data.fishKindIds)) {
|
||||
fishIds = res.data.fishKindIds;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析fishKindIds失败', e);
|
||||
}
|
||||
formData.fishKindIds = fishIds.map(id => String(id));
|
||||
|
||||
// 根据ID查找鱼类名称
|
||||
fishListInfo.value = getFishNames(fishIds);
|
||||
|
||||
// 时间日期格式化
|
||||
if (res.data.placeTime) {
|
||||
val.value = new Date(res.data.placeTime);
|
||||
formData.placeTime = res.data.placeTime ? formatDate(val.value) : "";
|
||||
formData.placeTime = formatDate(val.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -412,7 +472,7 @@ function bandDevice() {
|
||||
function getDeviceList() {
|
||||
// 查询塘口下设备列表
|
||||
pondDeviceInfo({ id }).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
detectorList.value = res.data.listDetector;
|
||||
controlList.value = res.data.listController;
|
||||
}
|
||||
@@ -421,7 +481,7 @@ function getDeviceList() {
|
||||
// 设备列表
|
||||
function getDevicesList() {
|
||||
allDeviceList({ type: 1 }).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
res.data.forEach((r: any) => {
|
||||
r.open = true;
|
||||
r.disabled = false;
|
||||
@@ -516,7 +576,7 @@ function onconfirm(list) {
|
||||
};
|
||||
bandDeviceToPond(data)
|
||||
.then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "绑定成功";
|
||||
getDeviceList();
|
||||
@@ -549,7 +609,7 @@ function delPond() {
|
||||
d_isLoading.value = true;
|
||||
PondDel({ id })
|
||||
.then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "删除成功";
|
||||
// 返回首页
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -141,12 +141,27 @@ function wxLoginCheck() {
|
||||
/** 微信登录 */
|
||||
function wxLogin(e) {
|
||||
isLoading.value = true;
|
||||
console.log('获取手机号返回:', e.detail);
|
||||
|
||||
// 用户拒绝授权
|
||||
if (!e.detail.code) {
|
||||
state.msg = "获取手机号失败,请允许授权";
|
||||
state.show = true;
|
||||
isLoading.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.detail.code) {
|
||||
Taro.login({
|
||||
success: function (res) {
|
||||
console.log('微信登录返回:', res);
|
||||
if (res.code) {
|
||||
loginWxToPhone({ code: e.detail.code, js_code: res.code })
|
||||
const params = { code: e.detail.code, js_code: res.code };
|
||||
console.log('调用登录接口参数:', params);
|
||||
|
||||
loginWxToPhone(params)
|
||||
.then((res) => {
|
||||
console.log('登录接口返回:', res);
|
||||
if (res.statusCode == 200) {
|
||||
Taro.setStorageSync(
|
||||
"ReTime",
|
||||
@@ -169,27 +184,32 @@ function wxLogin(e) {
|
||||
url: "/pages/main/home",
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
state.msg = `登录失败:${res.data?.msg || '服务器返回异常'}`;
|
||||
state.show = true;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('登录接口错误:', err);
|
||||
state.msg = `登录失败:${err.data?.msg || err.errMsg || '网络错误'}`;
|
||||
state.show = true;
|
||||
})
|
||||
.finally(() => {
|
||||
isLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
state.msg = "登录失败";
|
||||
state.msg = "微信登录失败,请重试";
|
||||
state.show = true;
|
||||
isLoading.value = false;
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
state.msg = "登录失败";
|
||||
fail: function (err) {
|
||||
console.error('微信登录失败:', err);
|
||||
state.msg = `微信登录失败:${err.errMsg || '未知错误'}`;
|
||||
state.show = true;
|
||||
isLoading.value = false;
|
||||
},
|
||||
});
|
||||
} else {
|
||||
state.msg = "登录失败";
|
||||
state.show = true;
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
/** 查看用户协议 */
|
||||
|
||||
@@ -163,29 +163,38 @@ function login() {
|
||||
}
|
||||
isLoading.value = true
|
||||
loginSms(loginForm.phonenumber, loginForm.code).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
// 存储 token
|
||||
if (res.data.access_token) {
|
||||
Taro.setStorageSync("Access-Token", res.data.access_token);
|
||||
Taro.setStorageSync("X-Access-Token", res.data.access_token);
|
||||
}
|
||||
|
||||
Taro.setStorageSync(
|
||||
"ReTime",
|
||||
res.data.createdTime
|
||||
? formatDate(new Date(res.data.createdTime))
|
||||
: formatDate(new Date())
|
||||
);
|
||||
Taro.setStorageSync("UserName", res.data.userName);
|
||||
Taro.setStorageSync("Phone", res.data.mobilePhone);
|
||||
Taro.setStorageSync("UserName", res.data.userName || loginForm.phonenumber);
|
||||
Taro.setStorageSync("Phone", loginForm.phonenumber);
|
||||
Taro.setStorageSync("LoginType", "1");
|
||||
Taro.setStorageSync("UserId", res.data.id);
|
||||
Taro.setStorageSync("UserId", res.data.userId || "");
|
||||
Taro.setStorageSync("UnLogin", 2);
|
||||
store.updateLoginStatus(0);
|
||||
store.updateUnLogin(2);
|
||||
store.updateRootUserId(res.data.id);
|
||||
store.updateUserId(res.data.id);
|
||||
store.updateRootUserName(res.data.userName);
|
||||
store.updateRootUserId(res.data.userId || "");
|
||||
store.updateUserId(res.data.userId || "");
|
||||
store.updateRootUserName(res.data.userName || loginForm.phonenumber);
|
||||
state.msg = "登录成功";
|
||||
state.show = true;
|
||||
Taro.switchTab({
|
||||
url: "/pages/main/home",
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
state.msg = res.msg || "登录失败";
|
||||
state.show = true;
|
||||
}
|
||||
}).finally(()=>{
|
||||
isLoading.value = false
|
||||
|
||||
@@ -858,7 +858,7 @@ function resUsetInfo() {
|
||||
function getWarnMsg() {
|
||||
const warnParams = ref({
|
||||
pageSize: 10,
|
||||
curPage: 1,
|
||||
pageNum: 1,
|
||||
});
|
||||
msgWarn(warnParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
@@ -922,14 +922,15 @@ function changeMode() {
|
||||
// 塘口模式1
|
||||
function pond1() {
|
||||
getPond1().then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
const pondIds = [];
|
||||
res.data.forEach((item: any) => {
|
||||
const rows = res.rows || [];
|
||||
rows.forEach((item: any) => {
|
||||
pondIds.push(item.id);
|
||||
let num = 3;
|
||||
const msg = item.warnCodeInfo.warnDescription;
|
||||
const showPh = !alarmJudgeCode(item.warnCodeInfo.warnCode, 1);
|
||||
const showSa = !alarmJudgeCode(item.warnCodeInfo.warnCode, 2);
|
||||
const msg = item.warnCodeInfo?.warnDescription || '';
|
||||
const showPh = !alarmJudgeCode(item.warnCodeInfo?.warnCode, 1);
|
||||
const showSa = !alarmJudgeCode(item.warnCodeInfo?.warnCode, 2);
|
||||
if (msg) {
|
||||
item.isPh = showPh;
|
||||
item.isSa = showSa;
|
||||
@@ -950,18 +951,18 @@ function pond1() {
|
||||
item.up = true;
|
||||
|
||||
});
|
||||
pondList.value = res.data;
|
||||
pondList.value = rows;
|
||||
setTimeout(() => {
|
||||
showTour.value = res.data.length == 0 ? true : false;
|
||||
showTour.value = rows.length == 0 ? true : false;
|
||||
}, 500);
|
||||
selPond.value = selPond.value
|
||||
? selPond.value
|
||||
: res.data.length > 0
|
||||
? Number(res.data[0]["id"])
|
||||
: rows.length > 0
|
||||
? Number(rows[0]["id"])
|
||||
: undefined;
|
||||
if (selPond.value) {
|
||||
if (!pondIds.includes(selPond.value)) {
|
||||
selPond.value = res.data.length > 0 ? Number(res.data[0]["id"]) : undefined;
|
||||
selPond.value = rows.length > 0 ? Number(rows[0]["id"]) : undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ Taro.useUnload(() => {
|
||||
function getWarnMsg() {
|
||||
const warnParams = ref({
|
||||
pageSize: 10,
|
||||
curPage: 1,
|
||||
pageNum: 1,
|
||||
})
|
||||
msgWarn(warnParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
>
|
||||
<view class="title">{{ item.title }}</view>
|
||||
<view class="time">{{
|
||||
item.createdTime ? formatDateMin(item.createdTime) : ""
|
||||
item.createTime ? formatDateMin(item.createTime) : ""
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="view_f_between_2">
|
||||
@@ -146,10 +146,10 @@
|
||||
<view class="title">{{ item.title }}</view>
|
||||
|
||||
<view class="time">{{
|
||||
item.createdTime ? formatDateMin(item.createdTime) : ""
|
||||
item.createTime ? formatDateMin(item.createTime) : ""
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="content" v-show="item.opName">{{ '控制模式:'+item.opName }}</view>
|
||||
<view class="content" v-if="item.opUserName">操作人:{{ item.opUserName }}</view>
|
||||
<view class="content">{{ item.message }}</view>
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
@@ -176,25 +176,24 @@
|
||||
</nut-col>
|
||||
<nut-col :span="14">
|
||||
<view :style="{ display: 'flex', alignItems: 'center' }">
|
||||
<view class="title">{{
|
||||
item.deviceType == 2 ? "测控一体机" : "水质检测仪"
|
||||
}}</view>
|
||||
<view class="title">充值订单</view>
|
||||
</view>
|
||||
<view :style="{ display: 'flex', alignItems: 'center',marginTop:'10rpx' }">
|
||||
<nut-tag class="tag" :style="{marginLeft:'0px !important'}"> {{ item.addMonth }}个月 </nut-tag>
|
||||
<nut-tag class="tag"> {{ item.payType==1?'用户充值':'后台续期' }} </nut-tag>
|
||||
<nut-tag class="tag" v-if="item.orderStatus == 2"> 已支付 </nut-tag>
|
||||
<nut-tag class="tag" v-else-if="item.orderStatus == 1"> 待支付 </nut-tag>
|
||||
</view>
|
||||
<view class="content" v-if="item.serialNum ">
|
||||
设备:{{ item.serialNum }}
|
||||
<view class="content">
|
||||
设备数量:{{ item.deviceCount }}台
|
||||
</view>
|
||||
<view class="time mt">
|
||||
续费日期:{{
|
||||
item.createdTime ? formatDateMin(item.createdTime) : ""
|
||||
下单时间:{{
|
||||
item.createTime ? formatDateMin(item.createTime) : ""
|
||||
}}
|
||||
</view>
|
||||
<view class="time mt">
|
||||
到期日期:{{
|
||||
item.deadTime ? formatDate_(item.deadTime) : ""
|
||||
<view class="time mt" v-if="item.successTime">
|
||||
支付时间:{{
|
||||
item.successTime ? formatDateMin(item.successTime) : ""
|
||||
}}
|
||||
</view>
|
||||
</nut-col>
|
||||
@@ -209,7 +208,7 @@
|
||||
}"
|
||||
>
|
||||
<text class="price" style="line-height: 1"
|
||||
>¥{{ Number(item.payAmount)/100 }}</text
|
||||
>¥{{ item.totalAmountYuan }}</text
|
||||
>
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
@@ -251,7 +250,7 @@ const selectVal = ref(0);
|
||||
const warnList = ref([]);
|
||||
const warnParams = ref({
|
||||
pageSize: 10,
|
||||
curPage: 1
|
||||
pageNum: 1
|
||||
});
|
||||
const warnTotal = ref(0);
|
||||
const warnTotalPages = ref(1);
|
||||
@@ -259,7 +258,7 @@ const warnTotalPages = ref(1);
|
||||
const switchList = ref([]);
|
||||
const switchParams = ref({
|
||||
pageSize: 10,
|
||||
curPage: 1
|
||||
pageNum: 1
|
||||
});
|
||||
const switchTotal = ref(0);
|
||||
const switchTotalPages = ref(1);
|
||||
@@ -267,7 +266,7 @@ const switchTotalPages = ref(1);
|
||||
const payList = ref([]);
|
||||
const payParams = ref({
|
||||
pageSize: 10,
|
||||
curPage: 1
|
||||
pageNum: 1
|
||||
});
|
||||
const payTotal = ref(0);
|
||||
const payTotalPages = ref(1);
|
||||
@@ -293,25 +292,34 @@ function changeVal(e) {
|
||||
|
||||
selectVal.value = e;
|
||||
if (e == 0) {
|
||||
warnParams.value.curPage = 1;
|
||||
warnParams.value.pageNum = 1;
|
||||
getWarnMsg();
|
||||
} else if (e == 1) {
|
||||
switchParams.value.curPage = 1;
|
||||
switchParams.value.pageNum = 1;
|
||||
getSwitchMsg();
|
||||
} else if (e == 2) {
|
||||
payParams.value.curPage = 1;
|
||||
payParams.value.pageNum = 1;
|
||||
getPayMsg();
|
||||
}
|
||||
}
|
||||
// 查询告警消息
|
||||
function getWarnMsg() {
|
||||
msgWarn(warnParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
warnList.value = res.data.items;
|
||||
warnTotal.value = res.data.totalCount;
|
||||
warnTotalPages.value = res.data.totalPages;
|
||||
unReadCount.value = res.data.unReadCount;
|
||||
msgCount.value = res.data.totalCount;
|
||||
const userId = Taro.getStorageSync("UserId");
|
||||
const params = {
|
||||
...warnParams.value,
|
||||
userId
|
||||
};
|
||||
msgWarn(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
// 数据直接在 res 上,不是 res.data
|
||||
warnList.value = res.rows || [];
|
||||
warnTotal.value = res.total || 0;
|
||||
// 计算总页数
|
||||
warnTotalPages.value = Math.ceil(warnTotal.value / warnParams.value.pageSize);
|
||||
// 统计未读数量
|
||||
unReadCount.value = warnList.value.filter(item => !item.isRead).length;
|
||||
msgCount.value = warnTotal.value;
|
||||
|
||||
if (unReadCount.value) {
|
||||
Taro.setTabBarBadge({
|
||||
index: 1, // tabBar的位置,从0开始计数
|
||||
@@ -327,55 +335,81 @@ function getWarnMsg() {
|
||||
}
|
||||
// 查询开关消息
|
||||
function getSwitchMsg() {
|
||||
msgSwitch(switchParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
switchList.value = res.data.items;
|
||||
switchTotal.value = res.data.totalCount;
|
||||
switchTotalPages.value = res.data.totalPages;
|
||||
msgCount.value = res.data.totalCount;
|
||||
const userId = Taro.getStorageSync("UserId");
|
||||
const params = {
|
||||
...switchParams.value,
|
||||
userId
|
||||
};
|
||||
msgSwitch(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
switchList.value = res.rows || [];
|
||||
switchTotal.value = res.total || 0;
|
||||
switchTotalPages.value = Math.ceil(switchTotal.value / switchParams.value.pageSize);
|
||||
msgCount.value = switchTotal.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 查询充值消息
|
||||
function getPayMsg() {
|
||||
msgPay(payParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
payList.value = res.data.items;
|
||||
payTotal.value = res.data.totalCount;
|
||||
payTotalPages.value = res.data.totalPages;
|
||||
msgCount.value = res.data.totalCount;
|
||||
const userId = Taro.getStorageSync("UserId");
|
||||
const params = {
|
||||
...payParams.value,
|
||||
userId
|
||||
};
|
||||
msgPay(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
payList.value = res.rows || [];
|
||||
payTotal.value = res.total || 0;
|
||||
payTotalPages.value = Math.ceil(payTotal.value / payParams.value.pageSize);
|
||||
msgCount.value = payTotal.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
function lower() {
|
||||
const userId = Taro.getStorageSync("UserId");
|
||||
if (selectVal.value == 0) {
|
||||
if (warnParams.value.curPage < warnTotalPages.value) {
|
||||
warnParams.value.curPage = warnParams.value.curPage + 1;
|
||||
msgWarn(warnParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.items.forEach((r) => {
|
||||
if (warnParams.value.pageNum < warnTotalPages.value) {
|
||||
warnParams.value.pageNum = warnParams.value.pageNum + 1;
|
||||
const params = {
|
||||
...warnParams.value,
|
||||
userId
|
||||
};
|
||||
msgWarn(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
const newRows = res.rows || [];
|
||||
newRows.forEach((r) => {
|
||||
warnList.value.push(r);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (selectVal.value == 1) {
|
||||
if (switchParams.value.curPage < switchTotalPages.value) {
|
||||
switchParams.value.curPage = switchParams.value.curPage + 1;
|
||||
msgSwitch(switchParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.items.forEach((r) => {
|
||||
if (switchParams.value.pageNum < switchTotalPages.value) {
|
||||
switchParams.value.pageNum = switchParams.value.pageNum + 1;
|
||||
const params = {
|
||||
...switchParams.value,
|
||||
userId
|
||||
};
|
||||
msgSwitch(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
const newRows = res.rows || [];
|
||||
newRows.forEach((r) => {
|
||||
switchList.value.push(r);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (selectVal.value == 2) {
|
||||
if (payParams.value.curPage < payTotalPages.value) {
|
||||
payParams.value.curPage = payParams.value.curPage + 1;
|
||||
msgPay(payParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.items.forEach((r) => {
|
||||
if (payParams.value.pageNum < payTotalPages.value) {
|
||||
payParams.value.pageNum = payParams.value.pageNum + 1;
|
||||
const params = {
|
||||
...payParams.value,
|
||||
userId
|
||||
};
|
||||
msgPay(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
const newRows = res.rows || [];
|
||||
newRows.forEach((r) => {
|
||||
payList.value.push(r);
|
||||
});
|
||||
}
|
||||
@@ -385,34 +419,50 @@ function lower() {
|
||||
}
|
||||
/** 上拉触底分页 */
|
||||
Taro.useReachBottom(() => {
|
||||
const userId = Taro.getStorageSync("UserId");
|
||||
if (selectVal.value == 0) {
|
||||
if (warnParams.value.curPage < warnTotalPages.value) {
|
||||
warnParams.value.curPage = warnParams.value.curPage + 1;
|
||||
msgWarn(warnParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.items.forEach((r) => {
|
||||
if (warnParams.value.pageNum < warnTotalPages.value) {
|
||||
warnParams.value.pageNum = warnParams.value.pageNum + 1;
|
||||
const params = {
|
||||
...warnParams.value,
|
||||
userId
|
||||
};
|
||||
msgWarn(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
const newRows = res.rows || [];
|
||||
newRows.forEach((r) => {
|
||||
warnList.value.push(r);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (selectVal.value == 1) {
|
||||
if (switchParams.value.curPage < switchTotalPages.value) {
|
||||
switchParams.value.curPage = switchParams.value.curPage + 1;
|
||||
msgSwitch(switchParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.items.forEach((r) => {
|
||||
if (switchParams.value.pageNum < switchTotalPages.value) {
|
||||
switchParams.value.pageNum = switchParams.value.pageNum + 1;
|
||||
const params = {
|
||||
...switchParams.value,
|
||||
userId
|
||||
};
|
||||
msgSwitch(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
const newRows = res.rows || [];
|
||||
newRows.forEach((r) => {
|
||||
switchList.value.push(r);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (selectVal.value == 2) {
|
||||
if (payParams.value.curPage < payTotalPages.value) {
|
||||
payParams.value.curPage = payParams.value.curPage + 1;
|
||||
msgPay(payParams.value).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
res.data.items.forEach((r) => {
|
||||
if (payParams.value.pageNum < payTotalPages.value) {
|
||||
payParams.value.pageNum = payParams.value.pageNum + 1;
|
||||
const params = {
|
||||
...payParams.value,
|
||||
userId
|
||||
};
|
||||
msgPay(params).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
const newRows = res.rows || [];
|
||||
newRows.forEach((r) => {
|
||||
payList.value.push(r);
|
||||
});
|
||||
}
|
||||
@@ -423,7 +473,7 @@ Taro.useReachBottom(() => {
|
||||
// 已读
|
||||
function read(id) {
|
||||
msgRead({ id }).then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
getWarnMsg();
|
||||
}
|
||||
});
|
||||
@@ -434,7 +484,7 @@ function readAll() {
|
||||
id:0
|
||||
}
|
||||
msgReadAll().then((res: any) => {
|
||||
if (res.statusCode == 200) {
|
||||
if (res.code == 200) {
|
||||
getWarnMsg();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ const timeOutSeconds = 10000;
|
||||
const getBaseUrl = () => {
|
||||
let BASE_URL = ''
|
||||
if (process.env.TARO_ENV === 'h5') {
|
||||
BASE_URL = '/api' //填写你的请求域名
|
||||
BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
|
||||
} else {
|
||||
BASE_URL = 'https://api.yuceyun.cn' //填写你的请求域名
|
||||
// BASE_URL = 'https://dev.yuceyun.cn' //测试环境
|
||||
@@ -75,6 +75,10 @@ const request = async (method, url, params) => {
|
||||
timeout: timeOutSeconds,
|
||||
header: {
|
||||
'content-type': contentType,
|
||||
'Authorization': Taro.getStorageSync('Access-Token') || '',
|
||||
'clientid': '428a8310cd442757ae699df5d894f051',
|
||||
'access-token': Taro.getStorageSync('Access-Token'),
|
||||
'x-access-token': Taro.getStorageSync('X-Access-Token'),
|
||||
},
|
||||
success(res) {
|
||||
if (res.header["access-token"] && res.header["x-access-token"]) {
|
||||
|
||||
15
types/auto-imports.d.ts
vendored
15
types/auto-imports.d.ts
vendored
@@ -7,9 +7,14 @@ export {}
|
||||
declare global {
|
||||
const BASE_URL: typeof import('../src/utils/request')['BASE_URL']
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const ParamsBuilder: typeof import('../src/utils/api-helper')['ParamsBuilder']
|
||||
const PathBuilder: typeof import('../src/utils/api-helper')['PathBuilder']
|
||||
const ResponseAdapter: typeof import('../src/utils/api-helper')['ResponseAdapter']
|
||||
const alarmJudge: typeof import('../src/utils/tools')['alarmJudge']
|
||||
const alarmJudgeCode: typeof import('../src/utils/tools')['alarmJudgeCode']
|
||||
const apiHelper: typeof import('../src/utils/api-helper')['default']
|
||||
const asd: typeof import('../src/utils/tools')['asd']
|
||||
const buildUrl: typeof import('../src/utils/api-helper')['buildUrl']
|
||||
const computed: typeof import('vue')['computed']
|
||||
const createApp: typeof import('vue')['createApp']
|
||||
const customRef: typeof import('vue')['customRef']
|
||||
@@ -103,7 +108,12 @@ declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
readonly BASE_URL: UnwrapRef<typeof import('../src/utils/request')['BASE_URL']>
|
||||
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||
readonly ParamsBuilder: UnwrapRef<typeof import('../src/utils/api-helper')['ParamsBuilder']>
|
||||
readonly PathBuilder: UnwrapRef<typeof import('../src/utils/api-helper')['PathBuilder']>
|
||||
readonly ResponseAdapter: UnwrapRef<typeof import('../src/utils/api-helper')['ResponseAdapter']>
|
||||
readonly alarmJudgeCode: UnwrapRef<typeof import('../src/utils/tools')['alarmJudgeCode']>
|
||||
readonly apiHelper: UnwrapRef<typeof import('../src/utils/api-helper')['default']>
|
||||
readonly buildUrl: UnwrapRef<typeof import('../src/utils/api-helper')['buildUrl']>
|
||||
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||
@@ -189,7 +199,12 @@ declare module '@vue/runtime-core' {
|
||||
interface ComponentCustomProperties {
|
||||
readonly BASE_URL: UnwrapRef<typeof import('../src/utils/request')['BASE_URL']>
|
||||
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
|
||||
readonly ParamsBuilder: UnwrapRef<typeof import('../src/utils/api-helper')['ParamsBuilder']>
|
||||
readonly PathBuilder: UnwrapRef<typeof import('../src/utils/api-helper')['PathBuilder']>
|
||||
readonly ResponseAdapter: UnwrapRef<typeof import('../src/utils/api-helper')['ResponseAdapter']>
|
||||
readonly alarmJudgeCode: UnwrapRef<typeof import('../src/utils/tools')['alarmJudgeCode']>
|
||||
readonly apiHelper: UnwrapRef<typeof import('../src/utils/api-helper')['default']>
|
||||
readonly buildUrl: UnwrapRef<typeof import('../src/utils/api-helper')['buildUrl']>
|
||||
readonly computed: UnwrapRef<typeof import('vue')['computed']>
|
||||
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
|
||||
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
|
||||
|
||||
Reference in New Issue
Block a user