2025-09-28
This commit is contained in:
10
api/auth.js
10
api/auth.js
@@ -2,19 +2,21 @@ import {
|
||||
http
|
||||
} from "../util/api"
|
||||
|
||||
const baseURL = "http://192.168.0.4:3005"
|
||||
|
||||
// 认证相关API
|
||||
export const authAPI = {
|
||||
// 登录
|
||||
login: (data) => http.post('/auth/login', data),
|
||||
login: (data) => http.post(baseURL + '/auth/login', data),
|
||||
|
||||
// 注册
|
||||
register: (data) => http.post('/auth/register', data),
|
||||
register: (data) => http.post(baseURL + '/auth/register', data),
|
||||
|
||||
// 获取当前用户信息
|
||||
me: () => http.get('/auth/me'),
|
||||
me: () => http.get(baseURL + '/auth/me'),
|
||||
|
||||
// 修改密码
|
||||
changePassword: (data) => http.put('/auth/change-password', data)
|
||||
changePassword: (data) => http.put(baseURL + '/auth/change-password', data)
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -2,16 +2,18 @@ import {
|
||||
http
|
||||
} from "../util/api"
|
||||
|
||||
const baseURL = "http://192.168.0.4:3005"
|
||||
|
||||
// 验证码相关API
|
||||
export const captchaAPI = {
|
||||
// 生成验证码
|
||||
generate: () => http.get('/captcha/generate'),
|
||||
generate: () => http.get(baseURL + '/captcha/generate'),
|
||||
|
||||
// 验证验证码
|
||||
verify: (data) => http.post('/captcha/verify', data),
|
||||
verify: (data) => http.post(baseURL + '/captcha/verify', data),
|
||||
|
||||
// 发送手机验证码
|
||||
smsSend: (phone) => http.post('/sms/send', {
|
||||
smsSend: (phone) => http.post(baseURL + '/sms/send', {
|
||||
phone
|
||||
})
|
||||
}
|
||||
|
||||
7
api/group.js
Normal file
7
api/group.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import {
|
||||
http
|
||||
} from "../util/api";
|
||||
|
||||
export const groupAPI = {
|
||||
getList: (params) => http.get('/group/list', params)
|
||||
}
|
||||
17
api/program.js
Normal file
17
api/program.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
http
|
||||
} from "../util/api"
|
||||
|
||||
const baseURL = "http://192.168.0.15:3006"
|
||||
|
||||
// 项目相关API
|
||||
export const programAPI = {
|
||||
// 列表
|
||||
getList: (params) => http.get(baseURL + '/program/list', params),
|
||||
isChat: (params) => http.get(baseURL + "/program/isChat", params),
|
||||
getProgram: (id) => http.get(baseURL + "/program/" + id)
|
||||
}
|
||||
|
||||
export default {
|
||||
programAPI
|
||||
}
|
||||
17
js_sdk/hyoga-uni-socket_io/package.json
Normal file
17
js_sdk/hyoga-uni-socket_io/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"id": "hyoga-uni-socket_io",
|
||||
"name": "socket.io ui-app版",
|
||||
"displayName": "socket.io ui-app版",
|
||||
"version": "3.0.4",
|
||||
"description": "适用于uni-app的socket.io封装,可用于uni-app、微信小程序",
|
||||
"keywords": [
|
||||
"socket.io",
|
||||
"微信小程序"
|
||||
],
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"JS SDK",
|
||||
"通用 SDK"
|
||||
]
|
||||
}
|
||||
}
|
||||
10
js_sdk/hyoga-uni-socket_io/uni-socket.io.js
Normal file
10
js_sdk/hyoga-uni-socket_io/uni-socket.io.js
Normal file
File diff suppressed because one or more lines are too long
437
package-lock.json
generated
437
package-lock.json
generated
@@ -5,60 +5,20 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"vk-uview-ui": "^1.5.2",
|
||||
"vue": "^3.5.21"
|
||||
"@hyoga/uni-socket.io": "^3.0.4",
|
||||
"socket.io": "^4.8.1",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"vk-uview-ui": "^1.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sass": "^1.92.1",
|
||||
"sass-loader": "^16.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.27.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
|
||||
"integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.27.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
|
||||
"integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.4.tgz",
|
||||
"integrity": "sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg==",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.28.4"
|
||||
},
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.4.tgz",
|
||||
"integrity": "sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.27.1",
|
||||
"@babel/helper-validator-identifier": "^7.27.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
||||
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="
|
||||
"node_modules/@hyoga/uni-socket.io": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@hyoga/uni-socket.io/-/uni-socket.io-3.0.4.tgz",
|
||||
"integrity": "sha512-m04M/ALXpTWcKoJGPDMzJosmzuopyAXF51DFN/qxLyXnbCFeQwsWOXT/XNLl4aWoBVGwQ7IptECFFRCA6z5C8A=="
|
||||
},
|
||||
"node_modules/@parcel/watcher": {
|
||||
"version": "2.5.1",
|
||||
@@ -356,96 +316,46 @@
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-core": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.21.tgz",
|
||||
"integrity": "sha512-8i+LZ0vf6ZgII5Z9XmUvrCyEzocvWT+TeR2VBUVlzIH6Tyv57E20mPZ1bCS+tbejgUgmjrEh7q/0F0bibskAmw==",
|
||||
"node_modules/@socket.io/component-emitter": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
|
||||
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA=="
|
||||
},
|
||||
"node_modules/@types/cors": {
|
||||
"version": "2.8.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz",
|
||||
"integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.28.3",
|
||||
"@vue/shared": "3.5.21",
|
||||
"entities": "^4.5.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map-js": "^1.2.1"
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-dom": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.21.tgz",
|
||||
"integrity": "sha512-jNtbu/u97wiyEBJlJ9kmdw7tAr5Vy0Aj5CgQmo+6pxWNQhXZDPsRr1UWPN4v3Zf82s2H3kF51IbzZ4jMWAgPlQ==",
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz",
|
||||
"integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-core": "3.5.21",
|
||||
"@vue/shared": "3.5.21"
|
||||
"undici-types": "~7.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-sfc": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.21.tgz",
|
||||
"integrity": "sha512-SXlyk6I5eUGBd2v8Ie7tF6ADHE9kCR6mBEuPyH1nUZ0h6Xx6nZI29i12sJKQmzbDyr2tUHMhhTt51Z6blbkTTQ==",
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.28.3",
|
||||
"@vue/compiler-core": "3.5.21",
|
||||
"@vue/compiler-dom": "3.5.21",
|
||||
"@vue/compiler-ssr": "3.5.21",
|
||||
"@vue/shared": "3.5.21",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.30.18",
|
||||
"postcss": "^8.5.6",
|
||||
"source-map-js": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/compiler-ssr": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.21.tgz",
|
||||
"integrity": "sha512-vKQ5olH5edFZdf5ZrlEgSO1j1DMA4u23TVK5XR1uMhvwnYvVdDF0nHXJUblL/GvzlShQbjhZZ2uvYmDlAbgo9w==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.5.21",
|
||||
"@vue/shared": "3.5.21"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/reactivity": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.21.tgz",
|
||||
"integrity": "sha512-3ah7sa+Cwr9iiYEERt9JfZKPw4A2UlbY8RbbnH2mGCE8NwHkhmlZt2VsH0oDA3P08X3jJd29ohBDtX+TbD9AsA==",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.21"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/runtime-core": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.21.tgz",
|
||||
"integrity": "sha512-+DplQlRS4MXfIf9gfD1BOJpk5RSyGgGXD/R+cumhe8jdjUcq/qlxDawQlSI8hCKupBlvM+3eS1se5xW+SuNAwA==",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "3.5.21",
|
||||
"@vue/shared": "3.5.21"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/runtime-dom": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.21.tgz",
|
||||
"integrity": "sha512-3M2DZsOFwM5qI15wrMmNF5RJe1+ARijt2HM3TbzBbPSuBHOQpoidE+Pa+XEaVN+czbHf81ETRoG1ltztP2em8w==",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "3.5.21",
|
||||
"@vue/runtime-core": "3.5.21",
|
||||
"@vue/shared": "3.5.21",
|
||||
"csstype": "^3.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/server-renderer": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.21.tgz",
|
||||
"integrity": "sha512-qr8AqgD3DJPJcGvLcJKQo2tAc8OnXRcfxhOJCPF+fcfn5bBGz7VCcO7t+qETOPxpWK1mgysXvVT/j+xWaHeMWA==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-ssr": "3.5.21",
|
||||
"@vue/shared": "3.5.21"
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "3.5.21"
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/shared": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.21.tgz",
|
||||
"integrity": "sha512-+2k1EQpnYuVuu3N7atWyG3/xoFWIVJZq4Mz8XNOdScFI0etES75fbny/oU4lKWk/577P1zmg0ioYvpGEDZ3DLw=="
|
||||
"node_modules/base64id": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
|
||||
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
|
||||
"engines": {
|
||||
"node": "^4.5.0 || >= 5.9"
|
||||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
"version": "3.0.3",
|
||||
@@ -475,10 +385,41 @@
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
||||
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "1.0.3",
|
||||
@@ -493,21 +434,44 @@
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
"node_modules/engine.io": {
|
||||
"version": "6.6.4",
|
||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.4.tgz",
|
||||
"integrity": "sha512-ZCkIjSYNDyGn0R6ewHDtXgns/Zre/NT6Agvq1/WobF7JXgFff4SeDroKiCO3fNJreU9YG429Sc81o4w5ok/W5g==",
|
||||
"dependencies": {
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/node": ">=10.0.0",
|
||||
"accepts": "~1.3.4",
|
||||
"base64id": "2.0.0",
|
||||
"cookie": "~0.7.2",
|
||||
"cors": "~2.8.5",
|
||||
"debug": "~4.3.1",
|
||||
"engine.io-parser": "~5.2.1",
|
||||
"ws": "~8.17.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
"engines": {
|
||||
"node": ">=10.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/estree-walker": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
|
||||
"node_modules/engine.io-client": {
|
||||
"version": "6.6.3",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.3.tgz",
|
||||
"integrity": "sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1",
|
||||
"engine.io-parser": "~5.2.1",
|
||||
"ws": "~8.17.1",
|
||||
"xmlhttprequest-ssl": "~2.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-parser": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
|
||||
"integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fill-range": {
|
||||
"version": "7.1.1",
|
||||
@@ -561,14 +525,6 @@
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.19",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.19.tgz",
|
||||
"integrity": "sha512-2N21sPY9Ws53PZvsEpVtNuSW+ScYbQdp4b9qUaL+9QkHUrGFKo56Lg9Emg5s9V/qrtNBmiR01sYhUOwu3H+VOw==",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||
}
|
||||
},
|
||||
"node_modules/micromatch": {
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||
@@ -583,21 +539,36 @@
|
||||
"node": ">=8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.11",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
|
||||
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/neo-async": {
|
||||
@@ -613,10 +584,13 @@
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "2.3.1",
|
||||
@@ -631,33 +605,6 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.6",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
|
||||
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||
@@ -731,10 +678,63 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io": {
|
||||
"version": "4.8.1",
|
||||
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.1.tgz",
|
||||
"integrity": "sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.4",
|
||||
"base64id": "~2.0.0",
|
||||
"cors": "~2.8.5",
|
||||
"debug": "~4.3.2",
|
||||
"engine.io": "~6.6.0",
|
||||
"socket.io-adapter": "~2.5.2",
|
||||
"socket.io-parser": "~4.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-adapter": {
|
||||
"version": "2.5.5",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz",
|
||||
"integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==",
|
||||
"dependencies": {
|
||||
"debug": "~4.3.4",
|
||||
"ws": "~8.17.1"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-client": {
|
||||
"version": "4.8.1",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.1.tgz",
|
||||
"integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.2",
|
||||
"engine.io-client": "~6.6.1",
|
||||
"socket.io-parser": "~4.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-parser": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
|
||||
"integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==",
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -752,6 +752,19 @@
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.12.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz",
|
||||
"integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ=="
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vk-uview-ui": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/vk-uview-ui/-/vk-uview-ui-1.5.2.tgz",
|
||||
@@ -760,25 +773,33 @@
|
||||
"HBuilderX": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vue": {
|
||||
"version": "3.5.21",
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.21.tgz",
|
||||
"integrity": "sha512-xxf9rum9KtOdwdRkiApWL+9hZEMWE90FHh8yS1+KJAiWYh+iGWV1FquPjoO9VUHQ+VIhsCXNNyZ5Sf4++RVZBA==",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.5.21",
|
||||
"@vue/compiler-sfc": "3.5.21",
|
||||
"@vue/runtime-dom": "3.5.21",
|
||||
"@vue/server-renderer": "3.5.21",
|
||||
"@vue/shared": "3.5.21"
|
||||
"node_modules/ws": {
|
||||
"version": "8.17.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "*"
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xmlhttprequest-ssl": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
|
||||
"integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
"sass-loader": "^16.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hyoga/uni-socket.io": "^3.0.4",
|
||||
"socket.io": "^4.8.1",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"vk-uview-ui": "^1.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
11
pages.json
11
pages.json
@@ -32,7 +32,8 @@
|
||||
"path": "pages/program/program",
|
||||
"style": {
|
||||
"navigationBarTitleText": "项目",
|
||||
"navigationStyle": "custom"
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -62,6 +63,14 @@
|
||||
"navigationBarTitleText" : "商城",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/program/chat",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "聊天页面",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<Tabbar id="tabbarId"></Tabbar>
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
password: userLogin.userForm.password,
|
||||
})
|
||||
}
|
||||
uni.setStorageSync("user", response.user)
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success',
|
||||
@@ -186,6 +187,7 @@
|
||||
password: userLogin.userForm.password,
|
||||
})
|
||||
}
|
||||
uni.setStorageSync("user", response.user)
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success',
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<u-waterfall v-model="mallList" ref="mallListRef">
|
||||
<template v-slot:left="{leftList}">
|
||||
<view class="mall-item u-m-r-10" v-for="(item, index) in leftList" :key="index">
|
||||
<u-lazy-load threshold="-450" border-radius="10" :image="item.image"
|
||||
<u-lazy-load threshold="-450" border-radius="10" :image="getImageUrl(item.image_url)"
|
||||
:index="index"></u-lazy-load>
|
||||
<view class="mall-title u-m-l-5 u-m-r-5">
|
||||
{{item.name}}
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
<template>
|
||||
<view class="message-container">
|
||||
<!-- 固定背景的容器 -->
|
||||
<view class="background-container"></view>
|
||||
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<view class="content-container" :style="'height:'+height+'px'">
|
||||
<view class="message-title">
|
||||
容讯聊天室
|
||||
</view>
|
||||
<u-row class="message-search">
|
||||
<u-col span="9">
|
||||
<u-search placeholder="点击查询项目" v-model="keyword" :show-action="false"></u-search>
|
||||
</u-col>
|
||||
<u-col class="collection" span="3">
|
||||
<image class="collection-icon" src="/static/icon/Bookmark.png" mode=""></image>
|
||||
<view class="collection-text">
|
||||
我的收藏
|
||||
<view class="content-container">
|
||||
<view style="padding: 32rpx;">
|
||||
<view id="fixedHeadId">
|
||||
<view class="message-title">
|
||||
容讯聊天室
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<view class="menu-list">
|
||||
<view class="menu-item" v-for="(item,index) in menuList" @click="handleMenuChange(index)">
|
||||
<view class="menu-title">{{item.name + '(' + item.count +')'}}
|
||||
<u-row class="message-search">
|
||||
<u-col span="9">
|
||||
<u-search placeholder="点击查询项目" v-model="keyword" :show-action="false"></u-search>
|
||||
</u-col>
|
||||
<u-col class="collection" span="3">
|
||||
<image class="collection-icon" src="/static/icon/Bookmark.png" mode=""></image>
|
||||
<view class="collection-text">
|
||||
我的收藏
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<view class="menu-list">
|
||||
<view class="menu-item" v-for="(item,index) in menuList" @click="handleMenuChange(index)">
|
||||
<view class="menu-title">{{item.name + '(' + item.count +')'}}
|
||||
</view>
|
||||
<image class="menu-icon"
|
||||
:src="currentMenu==index?'/static/icon/Chevron down.png':'/static/icon/Chevron right Menu.png'"
|
||||
mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<image class="menu-icon"
|
||||
:src="currentMenu==index?'/static/icon/Chevron down.png':'/static/icon/Chevron right Menu.png'"
|
||||
mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="message-list">
|
||||
<view class="message-item" v-for="item in messageList">
|
||||
{{item.messageName}}
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="message-list" :style="'height:'+height+'px'">
|
||||
<view class="message-item" v-for="item in messageList" @click="handleChat(item)">
|
||||
{{item.program.name}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -45,6 +47,7 @@
|
||||
onReady, onPullDownRefresh
|
||||
} from '@dcloudio/uni-app';
|
||||
import { onReady as onUniReady } from '@dcloudio/uni-app';
|
||||
import { groupAPI } from '../../api/group';
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const height = ref(0)
|
||||
@@ -54,7 +57,10 @@
|
||||
success(res) {
|
||||
let screenHeight = res.screenHeight
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
|
||||
height.value = screenHeight - data.height
|
||||
height.value = screenHeight - data.height - 50
|
||||
}).exec()
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#fixedHeadId").boundingClientRect((data : any) => {
|
||||
height.value = height.value - data.height
|
||||
}).exec()
|
||||
}
|
||||
})
|
||||
@@ -94,18 +100,28 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
|
||||
const handleChat = (item) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/program/chat?groupId=' + item.groupId
|
||||
})
|
||||
}
|
||||
|
||||
const loadData = () => {
|
||||
groupAPI.getList().then((res) => {
|
||||
messageList.value = res.data.list
|
||||
})
|
||||
}
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
await loadData()
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
|
||||
|
||||
onUniReady(() => {
|
||||
loadHeight()
|
||||
|
||||
// 模拟数据
|
||||
mockData()
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -117,29 +133,12 @@
|
||||
left: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
/* 防止容器本身滚动 */
|
||||
|
||||
/* 固定背景 */
|
||||
.background-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(180deg, #2F75F9 0%, #F0F3FF 34.13%);
|
||||
z-index: 1;
|
||||
/* 确保背景在内容下方 */
|
||||
}
|
||||
|
||||
/* 内容滚动区域 */
|
||||
.content-container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
/* 确保内容在背景上方 */
|
||||
background: linear-gradient(180deg, #2F75F9 0%, #F0F3FF 34.13%);
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
height: 100%;
|
||||
padding: 32rpx;
|
||||
|
||||
.message-title {
|
||||
margin-top: 40rpx;
|
||||
|
||||
@@ -1,26 +1,32 @@
|
||||
<template>
|
||||
<view class="my-container">
|
||||
|
||||
|
||||
{{user.real_name}}
|
||||
|
||||
<u-button @click="loginOut">退出登录</u-button>
|
||||
|
||||
|
||||
</view>
|
||||
<Tabbar></Tabbar>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
const user = ref()
|
||||
|
||||
onMounted(() => {
|
||||
user.value = uni.getStorageSync("user")
|
||||
|
||||
const loginOut = () => {
|
||||
uni.removeStorageSync("token")
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
|
||||
const loginOut = () => {
|
||||
uni.removeStorageSync("token")
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.my-container {
|
||||
|
||||
}
|
||||
.my-container {}
|
||||
</style>
|
||||
171
pages/program/chat.vue
Normal file
171
pages/program/chat.vue
Normal file
@@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<view class="chat-container">
|
||||
<u-navbar title="聊天" id="navBarId" :background="{background: 'transparent' }" :border-bottom="false"
|
||||
back-icon-color="#000" title-color="#000">
|
||||
<template v-slot:right>
|
||||
<image class="collection" src="/static/icon/Bookmark.png" mode=""></image>
|
||||
</template>
|
||||
</u-navbar>
|
||||
|
||||
<view class="bottom-view" id="bottomId">
|
||||
<view class="icon u-m-r-10">
|
||||
<image src="/static/icon/Mic.png" mode="" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
<textarea name="" v-model="text" class="text" maxlength="3000"></textarea>
|
||||
<view v-if="text==null || text==''" class="icon u-m-r-10 u-m-l-10">
|
||||
<image src="/static/icon/expression.png" mode="" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
<view v-else class="icon u-m-r-10 u-m-l-10">
|
||||
<image src="/static/icon/big.png" mode="" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
<view v-if="text==null || text==''" class="icon">
|
||||
<image src="/static/icon/Camera.png" mode="" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
<view v-else class="icon u-m-r-10 u-m-l-10" @click="handleSend">
|
||||
<image src="/static/icon/send.png" mode="" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view :style="'height:'+scrollHeight+'px'" scroll-y="true" class="scroll-main">
|
||||
<view v-for="(item, index) in dataList">
|
||||
<view v-if="item.createId==userId" class="my-message">
|
||||
{{item.content}}
|
||||
</view>
|
||||
<view v-else class="other-message">
|
||||
{{item.content}}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, getCurrentInstance, onBeforeMount } from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
} from "@dcloudio/uni-app";
|
||||
import io from '@hyoga/uni-socket.io';
|
||||
|
||||
const text = ref('')
|
||||
|
||||
const socket = ref()
|
||||
|
||||
const navBarRef = ref()
|
||||
const dataList = ref([])
|
||||
|
||||
const mockData = () => {
|
||||
for (var i = 0; i < 40; i++) {
|
||||
dataList.value.push("测试" + (i + 1))
|
||||
}
|
||||
}
|
||||
|
||||
const handleSend = () => {
|
||||
socket.value.emit('clientMsg', {
|
||||
createId: userId.value,
|
||||
groupId: groupId.value,
|
||||
content: text.value,
|
||||
type: "text"
|
||||
})
|
||||
}
|
||||
|
||||
const groupId = ref()
|
||||
const userId = ref()
|
||||
|
||||
onLoad((val) => {
|
||||
groupId.value = val.groupId
|
||||
});
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
const scrollHeight = ref(0)
|
||||
const loadHeight = () => {
|
||||
uni.getSystemInfo({
|
||||
success(res) {
|
||||
let screenHeight = res.screenHeight
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#navBarId").boundingClientRect((data : any) => {
|
||||
scrollHeight.value = screenHeight - data.height
|
||||
}).exec()
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#bottomId").boundingClientRect((data : any) => {
|
||||
scrollHeight.value = scrollHeight.value - data.height
|
||||
}).exec()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const connection = () => {
|
||||
socket.value = io('http://192.168.0.15:3007', {
|
||||
query: {},
|
||||
transports: ['websocket', 'polling'],
|
||||
timeout: 5000,
|
||||
});
|
||||
socket.value.on('connect', async () => {
|
||||
console.log("连接成功");
|
||||
})
|
||||
socket.value.emit('addGroup', {
|
||||
groupId: groupId.value,
|
||||
})
|
||||
socket.value.on('serverMsg', async (message) => {
|
||||
console.log(message);
|
||||
dataList.value.push(message)
|
||||
})
|
||||
}
|
||||
|
||||
const loadData = () => {
|
||||
userId.value = uni.getStorageSync("user").id
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// mockData()
|
||||
loadData()
|
||||
|
||||
loadHeight()
|
||||
connection()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.chat-container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: linear-gradient(180deg, #E3E8FF 0%, #FFFFFF 100%);
|
||||
background-blend-mode: lighten;
|
||||
|
||||
|
||||
.collection {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.bottom-view {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
// background-color: #aaffff;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx;
|
||||
|
||||
.icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 2rpx solid #DEEFFF;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-main {
|
||||
.my-message {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.other-message {}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,16 +1,13 @@
|
||||
<template>
|
||||
<view class="message-container">
|
||||
<!-- 固定背景的容器 -->
|
||||
<view class="background-container"></view>
|
||||
|
||||
<!-- 可滚动的内容区域 -->
|
||||
<view class="content-container" :style="'height:'+height+'px'">
|
||||
|
||||
<view class="searchFilter">
|
||||
<view class="searchFilter" id="searchFilterId">
|
||||
<view class="search">
|
||||
<u-search :show-action="false" placeholder="输入项目名称、企业名称" v-model="keyword"></u-search>
|
||||
<u-search :show-action="false" placeholder="输入项目名称、企业名称" v-model="params.keyword" bgColor="#CADBFF"
|
||||
@search="handleSearch"></u-search>
|
||||
</view>
|
||||
<u-dropdown :duration="0">
|
||||
<u-dropdown :duration="0" class="dropdown">
|
||||
<u-dropdown-item class="u-dropdown" v-model="areaFilter" title="区域筛选"
|
||||
:options="areaOptions"></u-dropdown-item>
|
||||
<u-dropdown-item class="u-dropdown" v-model="timeFilter" title="时间筛选"
|
||||
@@ -20,33 +17,39 @@
|
||||
</u-dropdown>
|
||||
</view>
|
||||
|
||||
<view class="program-list">
|
||||
<view class="program-item" v-for="item in programList" @click="handleDetail(item)">
|
||||
<view class="program-avatar">
|
||||
<image style="width: 100%;height: 100%;border-radius: 50%;" src="/static/ceshi_avatar.jpg"
|
||||
mode=""></image>
|
||||
</view>
|
||||
<view class="program-info">
|
||||
<view class="program-name">
|
||||
{{item.programName}}
|
||||
<view class="program-list" :style="'height:'+scrollHeight+'px'">
|
||||
<scroll-view scroll-y="true" style="height: 100%;" v-if="programList.length!=0" @scrolltolower="loadData">
|
||||
<view class="program-item" v-for="item in programList" @click="handleDetail(item)">
|
||||
<view class="program-avatar">
|
||||
<image style="width: 100%;height: 100%;border-radius: 50%;"
|
||||
:src="getImageUrl(item.user.avatar)" mode=""></image>
|
||||
</view>
|
||||
<view class="company-name">
|
||||
{{item.companyName}}
|
||||
</view>
|
||||
<view class="program-address">
|
||||
项目地点:{{item.programAddress}}
|
||||
</view>
|
||||
<view class="program-contact">
|
||||
项目联系人:{{item.contact}}
|
||||
</view>
|
||||
<view class="program-introduction">
|
||||
项目简介:{{item.introduction}}
|
||||
<view class="program-info">
|
||||
<view class="program-name">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="company-name">
|
||||
{{item.company}}
|
||||
</view>
|
||||
<view class="program-address">
|
||||
项目地点:{{item.address}}
|
||||
</view>
|
||||
<view class="program-contact">
|
||||
项目联系人:{{maskPhoneNumber(item.user.username)}}
|
||||
</view>
|
||||
<view class="program-introduction">
|
||||
项目简介:{{item.introduction}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-loadmore :status="status" />
|
||||
<view class="box-div"></view>
|
||||
</scroll-view>
|
||||
|
||||
<view style="height: 100%;" v-else>
|
||||
<u-empty></u-empty>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<Tabbar id="tabbarId"></Tabbar>
|
||||
@@ -54,14 +57,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, getCurrentInstance } from 'vue';
|
||||
import { ref, computed, getCurrentInstance, onMounted } from 'vue';
|
||||
import {
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import { onReady as onUniReady } from '@dcloudio/uni-app';
|
||||
import { onReady as onUniReady, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import { programAPI } from '../../api/program';
|
||||
import { getImageUrl, maskPhoneNumber } from '../../util/common';
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const height = ref(0)
|
||||
const scrollHeight = ref(0)
|
||||
|
||||
const loadHeight = () => {
|
||||
uni.getSystemInfo({
|
||||
@@ -70,6 +76,9 @@
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
|
||||
height.value = screenHeight - data.height
|
||||
}).exec()
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#searchFilterId").boundingClientRect((data : any) => {
|
||||
scrollHeight.value = height.value - data.height
|
||||
}).exec()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -122,74 +131,99 @@
|
||||
|
||||
// 列表
|
||||
const programList = ref([])
|
||||
const defaultSize = 5
|
||||
const params = ref({
|
||||
page: 1,
|
||||
size: defaultSize,
|
||||
keyword: ''
|
||||
})
|
||||
const status = ref('loadmore')
|
||||
const maxPage = ref()
|
||||
|
||||
const mockData = () => {
|
||||
for (var i = 0; i < 20; i++) {
|
||||
programList.value.push({
|
||||
programName: "项目名称" + (i + 1),
|
||||
companyName: "公司名称" + (i + 1),
|
||||
programAddress: "xx省xx市xxx区",
|
||||
contact: "联系人" + (i + 1),
|
||||
introduction: "在 Vue 3 + TypeScript 中使用 v-for=item in Range(1,20)报错,是因为 JavaScript/TypeScript 中没有内置 Range 函数(这是 Python 中的语法)。需要自己实现一个范围生成函数,并在模板中使用。"
|
||||
})
|
||||
}
|
||||
}
|
||||
const handleDetail = (item) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/program/programDetail'
|
||||
// 加载数据
|
||||
const loadData = () => {
|
||||
if (status.value == 'nomore') return
|
||||
programAPI.getList(params.value).then(res => {
|
||||
programList.value = programList.value.concat(res.data.list)
|
||||
maxPage.value = res.data.pages
|
||||
params.value.page++
|
||||
if (params.value.page > maxPage.value) {
|
||||
status.value = 'nomore'
|
||||
}
|
||||
}).finally(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleDetail = (item) => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/program/programDetail?programId=' + item.id
|
||||
})
|
||||
}
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
params.value = {
|
||||
page: 1,
|
||||
size: defaultSize,
|
||||
keyword: params.value.keyword
|
||||
}
|
||||
programList.value = []
|
||||
loadData()
|
||||
}
|
||||
|
||||
// 刷新
|
||||
onPullDownRefresh(async () => {
|
||||
// 全局刷新
|
||||
params.value = {
|
||||
page: 1,
|
||||
size: defaultSize,
|
||||
keyword: ''
|
||||
}
|
||||
programList.value = []
|
||||
loadData()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
|
||||
onUniReady(() => {
|
||||
loadHeight()
|
||||
mockData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.message-container {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
/* 防止容器本身滚动 */
|
||||
|
||||
/* 固定背景 */
|
||||
.background-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #F0F3FF;
|
||||
z-index: 1;
|
||||
/* 确保背景在内容下方 */
|
||||
}
|
||||
height: 100vh;
|
||||
background: linear-gradient(270deg, #65A7FF 0%, #458CF9 23.08%, #3F82FF 50%, #458CF9 71.15%, #65A7FF 100%);
|
||||
|
||||
/* 内容滚动区域 */
|
||||
.content-container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
/* 确保内容在背景上方 */
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
height: 100%;
|
||||
|
||||
.searchFilter {
|
||||
background-color: #fff;
|
||||
background-color: transparent;
|
||||
|
||||
.search {
|
||||
padding: 60rpx 42rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .dropdown {
|
||||
.u-dropdown__menu__item__text {
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.program-list {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.program-item {
|
||||
background-color: #fff;
|
||||
background-color: #F0F3FF;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx 42rpx;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
@@ -270,6 +304,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.box-div {
|
||||
padding: 30rpx 0rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="detail-contrainer">
|
||||
<u-navbar :is-fixed="false" title="项目详情" :background="{background: 'transparent' }" :border-bottom="false" back-icon-color="#fff"
|
||||
title-color="#fff">
|
||||
<u-navbar :is-fixed="false" title="项目详情" :background="{background: 'transparent' }" :border-bottom="false"
|
||||
back-icon-color="#fff" title-color="#fff">
|
||||
<template v-slot:right>
|
||||
<image class="collection" src="/static/icon/Bookmark.png" mode=""></image>
|
||||
</template>
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
<view class="head-text">
|
||||
<view class="text-name">
|
||||
xxxx工程
|
||||
{{program.name}}
|
||||
</view>
|
||||
<view class="text-date">
|
||||
起止时间:2025/09/13-202512/12
|
||||
起止时间:{{program.startDate}}至{{program.endDate}}
|
||||
</view>
|
||||
<view class="text-progress">
|
||||
项目进度
|
||||
@@ -29,19 +29,19 @@
|
||||
</u-row>
|
||||
<u-row class="u-m-b-20">
|
||||
<u-col span="6" class="card-name">详细地址</u-col>
|
||||
<u-col span="6" class="card-value">xx区xx路xxx号</u-col>
|
||||
<u-col span="6" class="card-value">{{program.address}}</u-col>
|
||||
</u-row>
|
||||
<u-row class="u-m-b-20">
|
||||
<u-col span="6" class="card-name">联系人</u-col>
|
||||
<u-col span="6" class="card-value">xxx</u-col>
|
||||
<u-col span="6" class="card-value">{{program.user.username}}</u-col>
|
||||
</u-row>
|
||||
<u-row class="u-m-b-20">
|
||||
<u-col span="6" class="card-name">结算方式</u-col>
|
||||
<u-col span="6" class="card-value">按月结算 次月支付60%</u-col>
|
||||
<u-col span="6" class="card-value">{{program.paymentMethod}}</u-col>
|
||||
</u-row>
|
||||
<u-row>
|
||||
<u-col span="6" class="card-name">项目企业</u-col>
|
||||
<u-col span="6" class="card-value">xxxx公司</u-col>
|
||||
<u-col span="6" class="card-value">{{program.company}}</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
</view>
|
||||
|
||||
<u-row justify="flex-end" class="u-m-r-40 btn-group">
|
||||
<u-col span="3"><u-button class="btn" type="primary">聊一聊</u-button></u-col>
|
||||
<u-col span="3"><u-button class="btn" type="primary">{{isChat?"继续聊":"聊一聊"}}</u-button></u-col>
|
||||
<u-col span="3"><u-button class="btn" type="success" @click="handleOpen">立刻融</u-button></u-col>
|
||||
</u-row>
|
||||
|
||||
@@ -167,7 +167,52 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { getUserInfo } from '../../util/common';
|
||||
import { programAPI } from '../../api/program';
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
const userId = ref()
|
||||
const programId = ref()
|
||||
const isChat = ref(false)
|
||||
const program = ref({
|
||||
name: '',
|
||||
linkmanId: '',
|
||||
company: '',
|
||||
introduction: '',
|
||||
address: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
paymentMethod: '',
|
||||
remark: '',
|
||||
createDate: '',
|
||||
user: {}
|
||||
})
|
||||
|
||||
const loadData = () => {
|
||||
programAPI.isChat({
|
||||
userId: userId.value,
|
||||
programId: programId.value
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
isChat.value = res.data.isChat
|
||||
}
|
||||
})
|
||||
programAPI.getProgram(programId.value).then(res => {
|
||||
program.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
onLoad((val) => {
|
||||
programId.value = val.programId
|
||||
let user = getUserInfo()
|
||||
userId.value = user.id
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
|
||||
|
||||
// 立刻融 弹窗
|
||||
const showWarning = ref(false)
|
||||
|
||||
BIN
static/icon/Camera.png
Normal file
BIN
static/icon/Camera.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 982 B |
BIN
static/icon/Mic.png
Normal file
BIN
static/icon/Mic.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
static/icon/big.png
Normal file
BIN
static/icon/big.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
static/icon/expression.png
Normal file
BIN
static/icon/expression.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
static/icon/send.png
Normal file
BIN
static/icon/send.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
10
util/api.js
10
util/api.js
@@ -1,7 +1,6 @@
|
||||
// api.js - 适配uView3+uni-app版本
|
||||
|
||||
// 基础配置
|
||||
const BASE_URL = 'http://192.168.1.55:5001/api'
|
||||
const TIMEOUT = 10000
|
||||
|
||||
// 初始化时设置token
|
||||
@@ -62,7 +61,14 @@ const request = (config) => {
|
||||
} = config
|
||||
|
||||
// 处理请求参数
|
||||
let requestUrl = BASE_URL + url
|
||||
// const BASE_URL = 'http://192.168.0.4:3005'
|
||||
// let requestUrl = BASE_URL + url
|
||||
// if (url.includes('/group')) {
|
||||
// requestUrl = "http://192.168.0.15:3007" + url
|
||||
// }
|
||||
let requestUrl = url
|
||||
|
||||
|
||||
let queryString = ''
|
||||
|
||||
if (Object.keys(params).length > 0) {
|
||||
|
||||
104
util/common.js
104
util/common.js
@@ -6,15 +6,115 @@ export const validatePhone = (phone) => {
|
||||
|
||||
|
||||
export const getImageUrl = (imagePath) => {
|
||||
if (!imagePath ) return ''
|
||||
if (!imagePath) return ''
|
||||
if (imagePath.startsWith('http')) return imagePath
|
||||
|
||||
// const baseURL = "http://192.168.1.43:3000"
|
||||
// const baseURL = "https://www.zrbjr.com"
|
||||
const baseURL = "https://minio.zrbjr.com"
|
||||
|
||||
// 如果图片路径以/uploads开头,直接返回原路径
|
||||
if (imagePath.startsWith('/uploads')) {
|
||||
return `${imagePath}`
|
||||
return `${baseURL}/jurongquan${imagePath}`
|
||||
}
|
||||
|
||||
return fullUrl
|
||||
}
|
||||
|
||||
export const getUserInfo = () => {
|
||||
return uni.getStorageSync("user")
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证并脱敏电话号码
|
||||
* @param {string} phone - 需要验证和脱敏的电话号码
|
||||
* @returns {string|boolean} - 脱敏后的电话号码,无效则返回false
|
||||
*/
|
||||
export function maskPhoneNumber(phone) {
|
||||
// 检查是否为字符串
|
||||
if (typeof phone !== 'string') {
|
||||
return phone;
|
||||
}
|
||||
|
||||
// 移除所有非数字字符
|
||||
const cleaned = phone.replace(/\D/g, '');
|
||||
|
||||
// 验证常见的电话号码格式
|
||||
// 支持: 11位手机号(中国大陆)、带区号的固定电话
|
||||
const phoneRegex = /^(1[3-9]\d{9})$|^(\d{3,4}-\d{7,8})$|^(\d{3,4}\d{7,8})$/;
|
||||
|
||||
if (!phoneRegex.test(cleaned) && !phoneRegex.test(phone)) {
|
||||
return phone; // 不是有效的电话号码
|
||||
}
|
||||
|
||||
// 根据不同格式进行脱敏
|
||||
if (cleaned.length === 11) {
|
||||
// 手机号: 保留前3位和后4位,中间4位用*代替
|
||||
return cleaned.replace(/^(\d{3})(\d{4})(\d{4})$/, '$1****$3');
|
||||
} else if (phone.includes('-')) {
|
||||
// 带区号的固定电话: 区号不变,号码中间用*代替
|
||||
const [areaCode, number] = phone.split('-');
|
||||
if (number.length <= 4) {
|
||||
return `${areaCode}-****`;
|
||||
}
|
||||
return `${areaCode}-${number.substr(0, 2)}****${number.substr(-2)}`;
|
||||
} else {
|
||||
// 不带区号的固定电话
|
||||
if (cleaned.length <= 4) {
|
||||
return '****';
|
||||
}
|
||||
return `${cleaned.substr(0, 2)}****${cleaned.substr(-2)}`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 姓名脱敏处理
|
||||
* @param {string} name - 需要脱敏的姓名
|
||||
* @returns {string} - 脱敏后的姓名
|
||||
*/
|
||||
export function maskName(name) {
|
||||
// 检查输入是否为有效字符串
|
||||
if (!name || typeof name !== 'string') {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 去除前后空格
|
||||
const trimmedName = name.trim();
|
||||
|
||||
// 检查是否为英文姓名(包含空格)
|
||||
if (trimmedName.includes(' ')) {
|
||||
const parts = trimmedName.split(' ').filter(part => part);
|
||||
|
||||
// 处理英文名:名全显,姓只显首字母
|
||||
if (parts.length >= 2) {
|
||||
const firstName = parts.slice(0, -1).join(' ');
|
||||
const lastName = parts[parts.length - 1];
|
||||
return `${firstName} ${lastName.charAt(0)}*`;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理中文姓名
|
||||
const length = trimmedName.length;
|
||||
|
||||
switch (length) {
|
||||
case 1:
|
||||
// 单字名,不脱敏
|
||||
return trimmedName;
|
||||
case 2:
|
||||
// 双字名,隐藏第二个字
|
||||
return `${trimmedName[0]}*`;
|
||||
case 3:
|
||||
// 三字名,隐藏中间字
|
||||
return `${trimmedName[0]}*${trimmedName[2]}`;
|
||||
case 4:
|
||||
// 四字名(如复姓),隐藏中间两个字
|
||||
return `${trimmedName[0]}**${trimmedName[3]}`;
|
||||
default:
|
||||
// 更长的姓名,显示首尾各两个字,中间用*代替
|
||||
if (length > 4) {
|
||||
return `${trimmedName.substr(0, 2)}${'*'.repeat(length - 4)}${trimmedName.substr(-2)}`;
|
||||
}
|
||||
}
|
||||
|
||||
return trimmedName;
|
||||
}
|
||||
Reference in New Issue
Block a user