From 5a6dbb3329b9cc0819ac97394900cff29558b7c7 Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Thu, 16 Jan 2025 10:50:01 +0800 Subject: [PATCH] uu --- common/enum.js | 7 ++++--- common/messageNotice/socket.js | 2 +- components/tpx-date-input/tpx-date-input.vue | 12 +++++++++--- pages/user/bunsStatic.vue | 5 +---- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/common/enum.js b/common/enum.js index 7f54d4f..15f3d96 100644 --- a/common/enum.js +++ b/common/enum.js @@ -1,7 +1,8 @@ import getCdnUrl, { getCdnRoot } from "./getCdnUrl.js" import { authCodeEnum } from "./authCode" import dayjs from "dayjs" -const formatStr = 'YYYY-MM-DD' +const formatStr = 'YYYY-MM-DD' +const formatDateTimeStr = 'YYYY-MM-DD HH:mm:ss' let curMonth = dayjs().month() + 1 let curMYush = curMonth % 3 // 如果被整除,diff就要设置成被除以的数 @@ -12,8 +13,8 @@ if(curMYush == 0) { const dateRangeList = [ { title: '今天', val: 1, range: [ - dayjs().format(formatStr), - dayjs().format(formatStr) + dayjs().startOf('day').format(formatDateTimeStr), + dayjs().endOf('day').format(formatDateTimeStr) ], }, { title: '本周', val: 2, diff --git a/common/messageNotice/socket.js b/common/messageNotice/socket.js index 7b8ad87..ea379f0 100644 --- a/common/messageNotice/socket.js +++ b/common/messageNotice/socket.js @@ -16,7 +16,7 @@ export const createSocketMessage = ({ userInfo })=> { const url = curEnvConf.socketHost let comReqData = getCommonReqData() - const socketTask = uni.connectSocket({ + let socketTask = uni.connectSocket({ url: `${url}/ws/${userInfo?.userId}`, // method: 'GET', header: { diff --git a/components/tpx-date-input/tpx-date-input.vue b/components/tpx-date-input/tpx-date-input.vue index eb55c93..5fea515 100644 --- a/components/tpx-date-input/tpx-date-input.vue +++ b/components/tpx-date-input/tpx-date-input.vue @@ -135,8 +135,13 @@ rangeVal: '' } }, - created() { - + created() { + // 初始化默认选中的效果 + this.toolsRangesList?.map?.(t=> { + if(t?.range?.join?.(",") == this?.value?.join?.(",")) { + this.rangeVal = t.val + } + }) }, onHide() { @@ -186,7 +191,8 @@ }, handleClearVal(){ let emptVal = Array.isArray(this.proxyValue) ? [] : '' - this.handleChange(emptVal) + this.handleChange(emptVal) + this.rangeVal = '' } } } diff --git a/pages/user/bunsStatic.vue b/pages/user/bunsStatic.vue index 147ac9b..3652cfa 100644 --- a/pages/user/bunsStatic.vue +++ b/pages/user/bunsStatic.vue @@ -91,10 +91,7 @@ return { dateRangeList, searchParam: { - _date: [ - `${dayjs().format('YYYY-MM-DD')} 00:00:00`, - `${dayjs().format('YYYY-MM-DD')} 23:59:59` - ], + _date: dateRangeList[0].range, }, queryOption: { },