feat: date picker

This commit is contained in:
archer
2023-06-15 21:44:31 +08:00
parent 4cbe4ebdc3
commit 2463e11cb9
13 changed files with 331 additions and 147 deletions

View File

@@ -13,17 +13,18 @@
"@alicloud/openapi-client": "^0.4.5",
"@alicloud/tea-util": "^1.4.5",
"@chakra-ui/icons": "^2.0.17",
"@chakra-ui/react": "^2.5.1",
"@chakra-ui/system": "^2.5.5",
"@chakra-ui/react": "^2.7.0",
"@chakra-ui/system": "^2.5.8",
"@dqbd/tiktoken": "^1.0.7",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@next/font": "13.1.6",
"@next/font": "13.4.5",
"@tanstack/react-query": "^4.24.10",
"@types/nprogress": "^0.2.0",
"axios": "^1.3.3",
"cookie": "^0.5.0",
"crypto": "^1.0.1",
"date-fns": "^2.30.0",
"dayjs": "^1.11.7",
"eventsource-parser": "^0.1.0",
"formidable": "^2.1.1",
@@ -37,7 +38,7 @@
"mermaid": "^8.13.5",
"mongoose": "^6.10.0",
"nanoid": "^4.0.1",
"next": "13.1.6",
"next": "13.4.5",
"nextjs-cors": "^2.1.2",
"nodemailer": "^6.9.1",
"nprogress": "^0.2.0",
@@ -45,6 +46,7 @@
"papaparse": "^5.4.1",
"pg": "^8.10.0",
"react": "18.2.0",
"react-day-picker": "^8.7.1",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.1",
"react-markdown": "^8.0.5",

245
client/pnpm-lock.yaml generated
View File

@@ -18,10 +18,10 @@ dependencies:
specifier: ^2.0.17
version: registry.npmmirror.com/@chakra-ui/icons@2.0.17(@chakra-ui/system@2.5.8)(react@18.2.0)
'@chakra-ui/react':
specifier: ^2.5.1
specifier: ^2.7.0
version: registry.npmmirror.com/@chakra-ui/react@2.7.0(@emotion/react@11.10.6)(@emotion/styled@11.10.6)(@types/react@18.0.28)(framer-motion@9.0.6)(react-dom@18.2.0)(react@18.2.0)
'@chakra-ui/system':
specifier: ^2.5.5
specifier: ^2.5.8
version: registry.npmmirror.com/@chakra-ui/system@2.5.8(@emotion/react@11.10.6)(@emotion/styled@11.10.6)(react@18.2.0)
'@dqbd/tiktoken':
specifier: ^1.0.7
@@ -33,8 +33,8 @@ dependencies:
specifier: ^11.10.6
version: registry.npmmirror.com/@emotion/styled@11.10.6(@emotion/react@11.10.6)(@types/react@18.0.28)(react@18.2.0)
'@next/font':
specifier: 13.1.6
version: registry.npmmirror.com/@next/font@13.1.6
specifier: 13.4.5
version: registry.npmmirror.com/@next/font@13.4.5
'@tanstack/react-query':
specifier: ^4.24.10
version: registry.npmmirror.com/@tanstack/react-query@4.24.10(react-dom@18.2.0)(react@18.2.0)
@@ -50,6 +50,9 @@ dependencies:
crypto:
specifier: ^1.0.1
version: registry.npmmirror.com/crypto@1.0.1
date-fns:
specifier: ^2.30.0
version: registry.npmmirror.com/date-fns@2.30.0
dayjs:
specifier: ^1.11.7
version: registry.npmmirror.com/dayjs@1.11.7
@@ -90,11 +93,11 @@ dependencies:
specifier: ^4.0.1
version: registry.npmmirror.com/nanoid@4.0.1
next:
specifier: 13.1.6
version: registry.npmmirror.com/next@13.1.6(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3)
specifier: 13.4.5
version: registry.npmmirror.com/next@13.4.5(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3)
nextjs-cors:
specifier: ^2.1.2
version: registry.npmmirror.com/nextjs-cors@2.1.2(next@13.1.6)
version: registry.npmmirror.com/nextjs-cors@2.1.2(next@13.4.5)
nodemailer:
specifier: ^6.9.1
version: registry.npmmirror.com/nodemailer@6.9.1
@@ -113,6 +116,9 @@ dependencies:
react:
specifier: 18.2.0
version: registry.npmmirror.com/react@18.2.0
react-day-picker:
specifier: ^8.7.1
version: registry.npmmirror.com/react-day-picker@8.7.1(date-fns@2.30.0)(react@18.2.0)
react-dom:
specifier: 18.2.0
version: registry.npmmirror.com/react-dom@18.2.0(react@18.2.0)
@@ -4573,10 +4579,10 @@ packages:
tslib: registry.npmmirror.com/tslib@2.5.0
dev: false
registry.npmmirror.com/@next/env@13.1.6:
resolution: {integrity: sha512-s+W9Fdqh5MFk6ECrbnVmmAOwxKQuhGMT7xXHrkYIBMBcTiOqNWhv5KbJIboKR5STXxNXl32hllnvKaffzFaWQg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/env/-/env-13.1.6.tgz}
registry.npmmirror.com/@next/env@13.4.5:
resolution: {integrity: sha512-SG/gKH6eij4vwQy87b/3mbpQ1X3x2vUdnpwq6/qL2IQWjtq58EY/UuNAp9CoEZoC9sI4L9AD1r+73Z9r4d3uug==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/env/-/env-13.4.5.tgz}
name: '@next/env'
version: 13.1.6
version: 13.4.5
dev: false
registry.npmmirror.com/@next/eslint-plugin-next@13.1.6:
@@ -4587,38 +4593,16 @@ packages:
glob: registry.npmmirror.com/glob@7.1.7
dev: true
registry.npmmirror.com/@next/font@13.1.6:
resolution: {integrity: sha512-AITjmeb1RgX1HKMCiA39ztx2mxeAyxl4ljv2UoSBUGAbFFMg8MO7YAvjHCgFhD39hL7YTbFjol04e/BPBH5RzQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/font/-/font-13.1.6.tgz}
registry.npmmirror.com/@next/font@13.4.5:
resolution: {integrity: sha512-pjgtnnyamcFK9rv/WKr9WDmVBcd50VK4zZX9E846jowRm8FadjiumDOV80elXUtYW9GXSpAiqWqNMw/kVXNuQQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/font/-/font-13.4.5.tgz}
name: '@next/font'
version: 13.1.6
version: 13.4.5
dev: false
registry.npmmirror.com/@next/swc-android-arm-eabi@13.1.6:
resolution: {integrity: sha512-F3/6Z8LH/pGlPzR1AcjPFxx35mPqjE5xZcf+IL+KgbW9tMkp7CYi1y7qKrEWU7W4AumxX/8OINnDQWLiwLasLQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.1.6.tgz}
name: '@next/swc-android-arm-eabi'
version: 13.1.6
engines: {node: '>= 10'}
cpu: [arm]
os: [android]
requiresBuild: true
dev: false
optional: true
registry.npmmirror.com/@next/swc-android-arm64@13.1.6:
resolution: {integrity: sha512-cMwQjnB8vrYkWyK/H0Rf2c2pKIH4RGjpKUDvbjVAit6SbwPDpmaijLio0LWFV3/tOnY6kvzbL62lndVA0mkYpw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-android-arm64/-/swc-android-arm64-13.1.6.tgz}
name: '@next/swc-android-arm64'
version: 13.1.6
engines: {node: '>= 10'}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: false
optional: true
registry.npmmirror.com/@next/swc-darwin-arm64@13.1.6:
resolution: {integrity: sha512-KKRQH4DDE4kONXCvFMNBZGDb499Hs+xcFAwvj+rfSUssIDrZOlyfJNy55rH5t2Qxed1e4K80KEJgsxKQN1/fyw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.1.6.tgz}
registry.npmmirror.com/@next/swc-darwin-arm64@13.4.5:
resolution: {integrity: sha512-XvTzi2ASUN5bECFIAAcBiSoDb0xsq+KLj4F0bof4d4rdc+FgOqLvseGQaOXwVi1TIh5bHa7o4b6droSJMO5+2g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.5.tgz}
name: '@next/swc-darwin-arm64'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
@@ -4626,10 +4610,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-darwin-x64@13.1.6:
resolution: {integrity: sha512-/uOky5PaZDoaU99ohjtNcDTJ6ks/gZ5ykTQDvNZDjIoCxFe3+t06bxsTPY6tAO6uEAw5f6vVFX5H5KLwhrkZCA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.1.6.tgz}
registry.npmmirror.com/@next/swc-darwin-x64@13.4.5:
resolution: {integrity: sha512-NQdqal/VKAqlJTuzhjZmNtdo8QSqwmfO7b2xJSAengTEVxQvsH76oGEzQeIv8Ci4NP6DysAFtFrJq++TmIxcUA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.5.tgz}
name: '@next/swc-darwin-x64'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
@@ -4637,32 +4621,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-freebsd-x64@13.1.6:
resolution: {integrity: sha512-qaEALZeV7to6weSXk3Br80wtFQ7cFTpos/q+m9XVRFggu+8Ib895XhMWdJBzew6aaOcMvYR6KQ6JmHA2/eMzWw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.1.6.tgz}
name: '@next/swc-freebsd-x64'
version: 13.1.6
engines: {node: '>= 10'}
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
registry.npmmirror.com/@next/swc-linux-arm-gnueabihf@13.1.6:
resolution: {integrity: sha512-OybkbC58A1wJ+JrJSOjGDvZzrVEQA4sprJejGqMwiZyLqhr9Eo8FXF0y6HL+m1CPCpPhXEHz/2xKoYsl16kNqw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.1.6.tgz}
name: '@next/swc-linux-arm-gnueabihf'
version: 13.1.6
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
registry.npmmirror.com/@next/swc-linux-arm64-gnu@13.1.6:
resolution: {integrity: sha512-yCH+yDr7/4FDuWv6+GiYrPI9kcTAO3y48UmaIbrKy8ZJpi7RehJe3vIBRUmLrLaNDH3rY1rwoHi471NvR5J5NQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.1.6.tgz}
registry.npmmirror.com/@next/swc-linux-arm64-gnu@13.4.5:
resolution: {integrity: sha512-nB8TjtpJCXtzIFjYOMbnQu68ajkA8QK58TreHjTGojSQjsF0StDqo5zFHglVVVHrd8d3N/+EjC18yFNSWnd/ZA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.5.tgz}
name: '@next/swc-linux-arm64-gnu'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -4671,10 +4633,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-linux-arm64-musl@13.1.6:
resolution: {integrity: sha512-ECagB8LGX25P9Mrmlc7Q/TQBb9rGScxHbv/kLqqIWs2fIXy6Y/EiBBiM72NTwuXUFCNrWR4sjUPSooVBJJ3ESQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.1.6.tgz}
registry.npmmirror.com/@next/swc-linux-arm64-musl@13.4.5:
resolution: {integrity: sha512-W126XUW599OV3giSH9Co40VpT8VAOT47xONVHXZaYEpeca0qEevjj6WUr5IJu/8u+XGWm5xI1S0DYWjR6W+olw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.5.tgz}
name: '@next/swc-linux-arm64-musl'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -4683,10 +4645,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-linux-x64-gnu@13.1.6:
resolution: {integrity: sha512-GT5w2mruk90V/I5g6ScuueE7fqj/d8Bui2qxdw6lFxmuTgMeol5rnzAv4uAoVQgClOUO/MULilzlODg9Ib3Y4Q==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.1.6.tgz}
registry.npmmirror.com/@next/swc-linux-x64-gnu@13.4.5:
resolution: {integrity: sha512-ZbPLO/oztQdtjGmWvGhRmtkZ6j9kQqg65kiO7F7Ijj7ojTtu3hh/vY+XRsHa/4Cse6HgyJ8XGZJMGoLb8ecQfQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.5.tgz}
name: '@next/swc-linux-x64-gnu'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -4695,10 +4657,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-linux-x64-musl@13.1.6:
resolution: {integrity: sha512-keFD6KvwOPzmat4TCnlnuxJCQepPN+8j3Nw876FtULxo8005Y9Ghcl7ACcR8GoiKoddAq8gxNBrpjoxjQRHeAQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.1.6.tgz}
registry.npmmirror.com/@next/swc-linux-x64-musl@13.4.5:
resolution: {integrity: sha512-f+/h8KMNixVUoRB+2vza8I+jsthJ4KcvopGUsDIUHe7Q4t+m8nKwGFBeyNu9qNIenYK5g5QYEsSwYFEqZylrTQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.5.tgz}
name: '@next/swc-linux-x64-musl'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -4707,10 +4669,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-win32-arm64-msvc@13.1.6:
resolution: {integrity: sha512-OwertslIiGQluFvHyRDzBCIB07qJjqabAmINlXUYt7/sY7Q7QPE8xVi5beBxX/rxTGPIbtyIe3faBE6Z2KywhQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.1.6.tgz}
registry.npmmirror.com/@next/swc-win32-arm64-msvc@13.4.5:
resolution: {integrity: sha512-dvtPQZ5+J+zUE1uq7gP853Oj63e+n0T1ydZ/yRdVh7d8zW9ZFuC9fFrg3MqP1cv1NPPur8rrTqDKN2mRBkSSBw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.5.tgz}
name: '@next/swc-win32-arm64-msvc'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
@@ -4718,10 +4680,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-win32-ia32-msvc@13.1.6:
resolution: {integrity: sha512-g8zowiuP8FxUR9zslPmlju7qYbs2XBtTLVSxVikPtUDQedhcls39uKYLvOOd1JZg0ehyhopobRoH1q+MHlIN/w==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.1.6.tgz}
registry.npmmirror.com/@next/swc-win32-ia32-msvc@13.4.5:
resolution: {integrity: sha512-gK9zwGe25x31S4AjPy3Bf2niQvHIAbmwgkzmqWG3OmD4K2Z/Dh2ju4vuyzPzIt0pwQe4B520meP9NizTBmVWSg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.5.tgz}
name: '@next/swc-win32-ia32-msvc'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
@@ -4729,10 +4691,10 @@ packages:
dev: false
optional: true
registry.npmmirror.com/@next/swc-win32-x64-msvc@13.1.6:
resolution: {integrity: sha512-Ls2OL9hi3YlJKGNdKv8k3X/lLgc3VmLG3a/DeTkAd+lAituJp8ZHmRmm9f9SL84fT3CotlzcgbdaCDfFwFA6bA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.1.6.tgz}
registry.npmmirror.com/@next/swc-win32-x64-msvc@13.4.5:
resolution: {integrity: sha512-iyNQVc7eGehrik9RJt9xGcnO6b/pi8C7GCfg8RGenx1IlalEKbYRgBJloF7DQzwlrV47E9bQl8swT+JawaNcKA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.5.tgz}
name: '@next/swc-win32-x64-msvc'
version: 13.1.6
version: 13.4.5
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@@ -5141,10 +5103,10 @@ packages:
- supports-color
dev: true
registry.npmmirror.com/@swc/helpers@0.4.14:
resolution: {integrity: sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@swc/helpers/-/helpers-0.4.14.tgz}
registry.npmmirror.com/@swc/helpers@0.5.1:
resolution: {integrity: sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@swc/helpers/-/helpers-0.5.1.tgz}
name: '@swc/helpers'
version: 0.4.14
version: 0.5.1
dependencies:
tslib: registry.npmmirror.com/tslib@2.5.0
dev: false
@@ -5943,6 +5905,15 @@ packages:
run-applescript: registry.npmmirror.com/run-applescript@5.0.0
dev: true
registry.npmmirror.com/busboy@1.6.0:
resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/busboy/-/busboy-1.6.0.tgz}
name: busboy
version: 1.6.0
engines: {node: '>=10.16.0'}
dependencies:
streamsearch: registry.npmmirror.com/streamsearch@1.1.0
dev: false
registry.npmmirror.com/bytes@3.1.2:
resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz}
name: bytes
@@ -6897,6 +6868,15 @@ packages:
engines: {node: '>= 6'}
dev: false
registry.npmmirror.com/date-fns@2.30.0:
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/date-fns/-/date-fns-2.30.0.tgz}
name: date-fns
version: 2.30.0
engines: {node: '>=0.11'}
dependencies:
'@babel/runtime': registry.npmmirror.com/@babel/runtime@7.22.5
dev: false
registry.npmmirror.com/dayjs@1.11.7:
resolution: {integrity: sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/dayjs/-/dayjs-1.11.7.tgz}
name: dayjs
@@ -8141,6 +8121,12 @@ packages:
is-glob: registry.npmmirror.com/is-glob@4.0.3
dev: true
registry.npmmirror.com/glob-to-regexp@0.4.1:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz}
name: glob-to-regexp
version: 0.4.1
dev: false
registry.npmmirror.com/glob@7.1.7:
resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/glob/-/glob-7.1.7.tgz}
name: glob
@@ -10003,55 +9989,54 @@ packages:
engines: {node: '>= 0.4.0'}
dev: false
registry.npmmirror.com/next@13.1.6(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3):
resolution: {integrity: sha512-hHlbhKPj9pW+Cymvfzc15lvhaOZ54l+8sXDXJWm3OBNBzgrVj6hwGPmqqsXg40xO1Leq+kXpllzRPuncpC0Phw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/next/-/next-13.1.6.tgz}
id: registry.npmmirror.com/next/13.1.6
registry.npmmirror.com/next@13.4.5(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3):
resolution: {integrity: sha512-pfNsRLVM9e5Y1/z02VakJRfD6hMQkr24FaN2xc9GbcZDBxoOgiNAViSg5cXwlWCoMhtm4U315D7XYhgOr96Q3Q==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/next/-/next-13.4.5.tgz}
id: registry.npmmirror.com/next/13.4.5
name: next
version: 13.1.6
engines: {node: '>=14.6.0'}
version: 13.4.5
engines: {node: '>=16.8.0'}
hasBin: true
peerDependencies:
'@opentelemetry/api': ^1.1.0
fibers: '>= 3.1.0'
node-sass: ^6.0.0 || ^7.0.0
react: ^18.2.0
react-dom: ^18.2.0
sass: ^1.3.0
peerDependenciesMeta:
fibers:
'@opentelemetry/api':
optional: true
node-sass:
fibers:
optional: true
sass:
optional: true
dependencies:
'@next/env': registry.npmmirror.com/@next/env@13.1.6
'@swc/helpers': registry.npmmirror.com/@swc/helpers@0.4.14
'@next/env': registry.npmmirror.com/@next/env@13.4.5
'@swc/helpers': registry.npmmirror.com/@swc/helpers@0.5.1
busboy: registry.npmmirror.com/busboy@1.6.0
caniuse-lite: registry.npmmirror.com/caniuse-lite@1.0.30001496
postcss: registry.npmmirror.com/postcss@8.4.14
react: registry.npmmirror.com/react@18.2.0
react-dom: registry.npmmirror.com/react-dom@18.2.0(react@18.2.0)
sass: registry.npmmirror.com/sass@1.58.3
styled-jsx: registry.npmmirror.com/styled-jsx@5.1.1(@babel/core@7.22.5)(react@18.2.0)
watchpack: registry.npmmirror.com/watchpack@2.4.0
zod: registry.npmmirror.com/zod@3.21.4
optionalDependencies:
'@next/swc-android-arm-eabi': registry.npmmirror.com/@next/swc-android-arm-eabi@13.1.6
'@next/swc-android-arm64': registry.npmmirror.com/@next/swc-android-arm64@13.1.6
'@next/swc-darwin-arm64': registry.npmmirror.com/@next/swc-darwin-arm64@13.1.6
'@next/swc-darwin-x64': registry.npmmirror.com/@next/swc-darwin-x64@13.1.6
'@next/swc-freebsd-x64': registry.npmmirror.com/@next/swc-freebsd-x64@13.1.6
'@next/swc-linux-arm-gnueabihf': registry.npmmirror.com/@next/swc-linux-arm-gnueabihf@13.1.6
'@next/swc-linux-arm64-gnu': registry.npmmirror.com/@next/swc-linux-arm64-gnu@13.1.6
'@next/swc-linux-arm64-musl': registry.npmmirror.com/@next/swc-linux-arm64-musl@13.1.6
'@next/swc-linux-x64-gnu': registry.npmmirror.com/@next/swc-linux-x64-gnu@13.1.6
'@next/swc-linux-x64-musl': registry.npmmirror.com/@next/swc-linux-x64-musl@13.1.6
'@next/swc-win32-arm64-msvc': registry.npmmirror.com/@next/swc-win32-arm64-msvc@13.1.6
'@next/swc-win32-ia32-msvc': registry.npmmirror.com/@next/swc-win32-ia32-msvc@13.1.6
'@next/swc-win32-x64-msvc': registry.npmmirror.com/@next/swc-win32-x64-msvc@13.1.6
'@next/swc-darwin-arm64': registry.npmmirror.com/@next/swc-darwin-arm64@13.4.5
'@next/swc-darwin-x64': registry.npmmirror.com/@next/swc-darwin-x64@13.4.5
'@next/swc-linux-arm64-gnu': registry.npmmirror.com/@next/swc-linux-arm64-gnu@13.4.5
'@next/swc-linux-arm64-musl': registry.npmmirror.com/@next/swc-linux-arm64-musl@13.4.5
'@next/swc-linux-x64-gnu': registry.npmmirror.com/@next/swc-linux-x64-gnu@13.4.5
'@next/swc-linux-x64-musl': registry.npmmirror.com/@next/swc-linux-x64-musl@13.4.5
'@next/swc-win32-arm64-msvc': registry.npmmirror.com/@next/swc-win32-arm64-msvc@13.4.5
'@next/swc-win32-ia32-msvc': registry.npmmirror.com/@next/swc-win32-ia32-msvc@13.4.5
'@next/swc-win32-x64-msvc': registry.npmmirror.com/@next/swc-win32-x64-msvc@13.4.5
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
dev: false
registry.npmmirror.com/nextjs-cors@2.1.2(next@13.1.6):
registry.npmmirror.com/nextjs-cors@2.1.2(next@13.4.5):
resolution: {integrity: sha512-2yOVivaaf2ILe4f/qY32hnj3oC77VCOsUQJQfhVMGsXE/YMEWUY2zy78sH9FKUCM7eG42/l3pDofIzMD781XGA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/nextjs-cors/-/nextjs-cors-2.1.2.tgz}
id: registry.npmmirror.com/nextjs-cors/2.1.2
name: nextjs-cors
@@ -10060,7 +10045,7 @@ packages:
next: ^8.1.1-canary.54 || ^9.0.0 || ^10.0.0-0 || ^11.0.0 || ^12.0.0 || ^13.0.0
dependencies:
cors: registry.npmmirror.com/cors@2.8.5
next: registry.npmmirror.com/next@13.1.6(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3)
next: registry.npmmirror.com/next@13.4.5(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0)(sass@1.58.3)
dev: false
registry.npmmirror.com/node-releases@2.0.12:
@@ -10715,6 +10700,19 @@ packages:
react: registry.npmmirror.com/react@18.2.0
dev: false
registry.npmmirror.com/react-day-picker@8.7.1(date-fns@2.30.0)(react@18.2.0):
resolution: {integrity: sha512-Gv426AW8b151CZfh3aP5RUGztLwHB/EyJgWZ5iMgtzbFBkjHfG6Y66CIQFMWGLnYjsQ9DYSJRmJ5S0Pg5HWKjA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/react-day-picker/-/react-day-picker-8.7.1.tgz}
id: registry.npmmirror.com/react-day-picker/8.7.1
name: react-day-picker
version: 8.7.1
peerDependencies:
date-fns: ^2.28.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
dependencies:
date-fns: registry.npmmirror.com/date-fns@2.30.0
react: registry.npmmirror.com/react@18.2.0
dev: false
registry.npmmirror.com/react-dom@18.2.0(react@18.2.0):
resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/react-dom/-/react-dom-18.2.0.tgz}
id: registry.npmmirror.com/react-dom/18.2.0
@@ -11456,6 +11454,13 @@ packages:
internal-slot: registry.npmmirror.com/internal-slot@1.0.5
dev: true
registry.npmmirror.com/streamsearch@1.1.0:
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/streamsearch/-/streamsearch-1.1.0.tgz}
name: streamsearch
version: 1.1.0
engines: {node: '>=10.0.0'}
dev: false
registry.npmmirror.com/string.prototype.matchall@4.0.8:
resolution: {integrity: sha512-6zOCOcJ+RJAQshcTvXPHoxoQGONa3e/Lqx90wUA+wEzX78sg5Bo+1tQo4N0pohS0erG9qtCqJDjNCQBjeWVxyg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz}
name: string.prototype.matchall
@@ -12186,6 +12191,16 @@ packages:
acorn-walk: registry.npmmirror.com/acorn-walk@8.2.0
dev: false
registry.npmmirror.com/watchpack@2.4.0:
resolution: {integrity: sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/watchpack/-/watchpack-2.4.0.tgz}
name: watchpack
version: 2.4.0
engines: {node: '>=10.13.0'}
dependencies:
glob-to-regexp: registry.npmmirror.com/glob-to-regexp@0.4.1
graceful-fs: registry.npmmirror.com/graceful-fs@4.2.11
dev: false
registry.npmmirror.com/web-namespaces@2.0.1:
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/web-namespaces/-/web-namespaces-2.0.1.tgz}
name: web-namespaces
@@ -12347,6 +12362,12 @@ packages:
engines: {node: '>=10'}
dev: true
registry.npmmirror.com/zod@3.21.4:
resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/zod/-/zod-3.21.4.tgz}
name: zod
version: 3.21.4
dev: false
registry.npmmirror.com/zustand@4.3.5(immer@9.0.19)(react@18.2.0):
resolution: {integrity: sha512-2iPUzfwx+g3f0PagOMz2vDO9mZzEp2puFpNe7vrAymVPOEIEUjCPkC4/zy84eAscxIWmTU4j9g6upXYkJdzEFQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/zustand/-/zustand-4.3.5.tgz}
id: registry.npmmirror.com/zustand/4.3.5

View File

@@ -66,7 +66,7 @@ export const loginOut = () => GET('/user/loginout');
export const putUserInfo = (data: UserUpdateParams) => PUT('/user/update', data);
export const getUserBills = (data: RequestPaging) =>
GET<PagingData<UserBillType>>(`/user/getBill?${Obj2Query(data)}`);
POST<PagingData<UserBillType>>(`/user/getBill`, data);
export const getPayOrders = () => GET<PaySchema[]>(`/user/getPayOrders`);

View File

@@ -0,0 +1,4 @@
.datePicker {
--rdp-background-color: #d6e8ff;
--rdp-accent-color: #0000ff;
}

View File

@@ -0,0 +1,121 @@
import React, { useState, useMemo, useRef } from 'react';
import { Box, Card, Flex, useTheme, useOutsideClick, Button } from '@chakra-ui/react';
import { addDays, format } from 'date-fns';
import { type DateRange, DayPicker } from 'react-day-picker';
import MyIcon from '../Icon';
import 'react-day-picker/dist/style.css';
import styles from './index.module.scss';
import zhCN from 'date-fns/locale/zh-CN';
const DateRangePicker = ({
onChange,
onSuccess,
position = 'bottom',
defaultDate = {
from: addDays(new Date(), -30),
to: new Date()
}
}: {
onChange?: (date: DateRange) => void;
onSuccess?: (date: DateRange) => void;
position?: 'bottom' | 'top';
defaultDate?: DateRange;
}) => {
const theme = useTheme();
const OutRangeRef = useRef(null);
const [range, setRange] = useState<DateRange | undefined>(defaultDate);
const [showSelected, setShowSelected] = useState(false);
const formatSelected = useMemo(() => {
if (range?.from && range.to) {
return `${format(range.from, 'y-MM-dd')} ~ ${format(range.to, 'y-MM-dd')}`;
}
return `${format(new Date(), 'y-MM-dd')} ~ ${format(new Date(), 'y-MM-dd')}`;
}, [range]);
useOutsideClick({
ref: OutRangeRef,
handler: () => {
setShowSelected(false);
}
});
return (
<Box position={'relative'} ref={OutRangeRef}>
<Flex
border={theme.borders.base}
px={3}
py={1}
borderRadius={'sm'}
cursor={'pointer'}
bg={'myWhite.600'}
fontSize={'sm'}
onClick={() => setShowSelected(true)}
>
<Box>{formatSelected}</Box>
<MyIcon ml={2} name={'date'} w={'16px'} color={'myGray.600'} />
</Flex>
{showSelected && (
<Card
position={'absolute'}
zIndex={1}
{...(position === 'top'
? {
bottom: '40px'
}
: {})}
>
<DayPicker
locale={zhCN}
id="test"
mode="range"
className={styles.datePicker}
defaultMonth={defaultDate.to}
selected={range}
disabled={[
{ from: new Date(2022, 3, 1), to: addDays(new Date(), -90) },
{ from: addDays(new Date(), 1), to: new Date(2099, 1, 1) }
]}
onSelect={(date) => {
if (date?.from === undefined) {
date = {
from: range?.from,
to: range?.from
};
}
if (date?.to === undefined) {
date.to = date.from;
}
setRange(date);
onChange && onChange(date);
}}
footer={
<Flex justifyContent={'flex-end'}>
<Button
variant={'outline'}
size={'sm'}
mr={2}
onClick={() => setShowSelected(false)}
>
</Button>
<Button
size={'sm'}
onClick={() => {
onSuccess && onSuccess(range || defaultDate);
setShowSelected(false);
}}
>
</Button>
</Flex>
}
/>
</Card>
)}
</Box>
);
};
export default DateRangePicker;
export type DateRangeType = DateRange;

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1686832863390" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4120" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M782.84 188.75h-43.15v-60.46c0-16.57-13.43-30-30-30s-30 13.43-30 30v60.46H371.88v-60.46c0-16.57-13.43-30-30-30s-30 13.43-30 30v60.46H250.5c-66.17 0-120 53.83-120 120v494.47c0 66.17 53.83 120 120 120h532.33c66.17 0 120-53.83 120-120V308.75c0.01-66.17-53.82-120-119.99-120z m-532.34 60h61.37v133.63c0 16.57 13.43 30 30 30s30-13.43 30-30V248.75h307.81v133.63c0 16.57 13.43 30 30 30s30-13.43 30-30V248.75h43.15c33.08 0 60 26.92 60 60V649.5H190.5V308.75c0-33.08 26.92-60 60-60z m532.34 614.47H250.5c-33.08 0-60-26.92-60-60V709.5h652.33v93.72c0.01 33.08-26.91 60-59.99 60z" p-id="4121"></path></svg>

After

Width:  |  Height:  |  Size: 924 B

View File

@@ -33,7 +33,8 @@ const map = {
export: require('./icons/export.svg').default,
text: require('./icons/text.svg').default,
history: require('./icons/history.svg').default,
kbTest: require('./icons/kbTest.svg').default
kbTest: require('./icons/kbTest.svg').default,
date: require('./icons/date.svg').default
};
export type IconName = keyof typeof map;

View File

@@ -39,7 +39,7 @@ const Button = defineStyleConfig({
},
sm: {
fontSize: 'sm',
px: 3,
px: 4,
py: 0,
fontWeight: 'normal',
height: '26px',

View File

@@ -76,6 +76,20 @@ export const usePagination = <T = any,>({
mutate(+e.target.value);
}
}}
onKeyDown={(e) => {
// @ts-ignore
const val = +e.target.value;
if (val && e.keyCode === 13) {
if (val === pageNum) return;
if (val >= maxPage) {
mutate(maxPage);
} else if (val < 1) {
mutate(1);
} else {
mutate(val);
}
}
}}
/>
<Box mx={2}>/</Box>
{maxPage}

View File

@@ -4,23 +4,32 @@ import { jsonRes } from '@/service/response';
import { connectToDatabase, Bill } from '@/service/mongo';
import { authUser } from '@/service/utils/auth';
import { adaptBill } from '@/utils/adapt';
import { addDays } from 'date-fns';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
let { pageNum = 1, pageSize = 10 } = req.query as {
pageNum: string;
pageSize: string;
const {
pageNum = 1,
pageSize = 10,
dateStart = addDays(new Date(), -7),
dateEnd = new Date()
} = req.body as {
pageNum: number;
pageSize: number;
dateStart: Date;
dateEnd: Date;
};
pageNum = +pageNum;
pageSize = +pageSize;
const { userId } = await authUser({ req, authToken: true });
await connectToDatabase();
const where = {
userId
userId,
time: {
$gte: new Date(dateStart).setHours(0, 0, 0, 0),
$lte: new Date(dateEnd).setHours(23, 59, 59, 999)
}
};
// get bill record and total by record

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import { Table, Thead, Tbody, Tr, Th, Td, TableContainer, Flex, Box } from '@chakra-ui/react';
import { BillTypeMap } from '@/constants/user';
import { getUserBills } from '@/api/user';
@@ -7,18 +7,29 @@ import { usePagination } from '@/hooks/usePagination';
import { useLoading } from '@/hooks/useLoading';
import dayjs from 'dayjs';
import MyIcon from '@/components/Icon';
import DateRangePicker, { type DateRangeType } from '@/components/DateRangePicker';
import { addDays } from 'date-fns';
const BillTable = () => {
const { Loading } = useLoading();
const [dateRange, setDateRange] = useState<DateRangeType>({
from: addDays(new Date(), -7),
to: new Date()
});
const {
data: bills,
isLoading,
Pagination,
pageSize,
total
total,
getData
} = usePagination<UserBillType>({
api: getUserBills
api: getUserBills,
params: {
dateStart: dateRange.from,
dateEnd: dateRange.to
}
});
return (
@@ -48,8 +59,6 @@ const BillTable = () => {
))}
</Tbody>
</Table>
<Loading loading={isLoading} fixed={false} />
</TableContainer>
{!isLoading && bills.length === 0 && (
@@ -62,9 +71,18 @@ const BillTable = () => {
)}
{total > pageSize && (
<Flex w={'100%'} mt={4} justifyContent={'flex-end'}>
<Pagination />
<DateRangePicker
defaultDate={dateRange}
position="top"
onChange={setDateRange}
onSuccess={() => getData(1)}
/>
<Box ml={2}>
<Pagination />
</Box>
</Flex>
)}
<Loading loading={isLoading} fixed={false} />
</>
);
};

View File

@@ -44,8 +44,6 @@ const OpenApi = () => {
))}
</Tbody>
</Table>
<Loading loading={isLoading} fixed={false} />
</TableContainer>
{!isLoading && promotionRecords.length === 0 && (
@@ -61,6 +59,7 @@ const OpenApi = () => {
<Pagination />
</Flex>
)}
<Loading loading={isLoading} fixed={false} />
</>
);
};

View File

@@ -19,30 +19,24 @@ import Loading from '@/components/Loading';
import Avatar from '@/components/Avatar';
import MyIcon from '@/components/Icon';
import Tabs from '@/components/Tabs';
import BillTable from './components/BillTable';
const PayRecordTable = dynamic(() => import('./components/PayRecordTable'), {
loading: () => <Loading fixed={false} />,
ssr: false
});
const BilTable = dynamic(() => import('./components/BillTable'), {
loading: () => <Loading fixed={false} />,
ssr: false
ssr: true
});
const PromotionTable = dynamic(() => import('./components/PromotionTable'), {
loading: () => <Loading fixed={false} />,
ssr: false
ssr: true
});
const InformTable = dynamic(() => import('./components/InformTable'), {
loading: () => <Loading fixed={false} />,
ssr: false
ssr: true
});
const PayModal = dynamic(() => import('./components/PayModal'), {
loading: () => <Loading fixed={false} />,
ssr: false
ssr: true
});
const WxConcat = dynamic(() => import('@/components/WxConcat'), {
loading: () => <Loading fixed={false} />,
ssr: false
ssr: true
});
enum TableEnum {
@@ -54,7 +48,7 @@ enum TableEnum {
const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
const tableList = useRef([
{ label: '账单', id: TableEnum.bill, Component: <BilTable /> },
{ label: '账单', id: TableEnum.bill, Component: <BillTable /> },
{ label: '充值', id: TableEnum.pay, Component: <PayRecordTable /> },
{ label: '佣金', id: TableEnum.promotion, Component: <PromotionTable /> },
{ label: '通知', id: TableEnum.inform, Component: <InformTable /> }