mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-04-04 03:30:19 +00:00
同步admin
This commit is contained in:
parent
3433dd6cdb
commit
691f4804f1
1
admin/components.d.ts
vendored
1
admin/components.d.ts
vendored
@ -81,6 +81,7 @@ declare module '@vue/runtime-core' {
|
|||||||
ExportSure: typeof import('./src/components/export-sure/index.vue')['default']
|
ExportSure: typeof import('./src/components/export-sure/index.vue')['default']
|
||||||
HeatMap: typeof import('./src/components/heat-map/index.vue')['default']
|
HeatMap: typeof import('./src/components/heat-map/index.vue')['default']
|
||||||
Icon: typeof import('./src/components/icon/index.vue')['default']
|
Icon: typeof import('./src/components/icon/index.vue')['default']
|
||||||
|
MapSelector: typeof import('./src/components/map-selector/index.vue')['default']
|
||||||
Markdown: typeof import('./src/components/markdown/index.vue')['default']
|
Markdown: typeof import('./src/components/markdown/index.vue')['default']
|
||||||
PopoverInput: typeof import('./src/components/popover-input/index.vue')['default']
|
PopoverInput: typeof import('./src/components/popover-input/index.vue')['default']
|
||||||
RangeInput: typeof import('./src/components/range-input/index.vue')['default']
|
RangeInput: typeof import('./src/components/range-input/index.vue')['default']
|
||||||
|
|||||||
26
admin/package-lock.json
generated
26
admin/package-lock.json
generated
@ -174,7 +174,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@babel/core/-/core-7.23.6.tgz",
|
"resolved": "https://registry.npmmirror.com/@babel/core/-/core-7.23.6.tgz",
|
||||||
"integrity": "sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==",
|
"integrity": "sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ampproject/remapping": "^2.2.0",
|
"@ampproject/remapping": "^2.2.0",
|
||||||
"@babel/code-frame": "^7.23.5",
|
"@babel/code-frame": "^7.23.5",
|
||||||
@ -975,7 +974,6 @@
|
|||||||
"version": "6.1.19",
|
"version": "6.1.19",
|
||||||
"resolved": "https://registry.npmmirror.com/@fullcalendar/core/-/core-6.1.19.tgz",
|
"resolved": "https://registry.npmmirror.com/@fullcalendar/core/-/core-6.1.19.tgz",
|
||||||
"integrity": "sha512-z0aVlO5e4Wah6p6mouM0UEqtRf1MZZPt4mwzEyU6kusaNL+dlWQgAasF2cK23hwT4cmxkEmr4inULXgpyeExdQ==",
|
"integrity": "sha512-z0aVlO5e4Wah6p6mouM0UEqtRf1MZZPt4mwzEyU6kusaNL+dlWQgAasF2cK23hwT4cmxkEmr4inULXgpyeExdQ==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"preact": "~10.12.1"
|
"preact": "~10.12.1"
|
||||||
}
|
}
|
||||||
@ -1461,7 +1459,6 @@
|
|||||||
"version": "4.17.6",
|
"version": "4.17.6",
|
||||||
"resolved": "https://registry.npmmirror.com/@types/lodash-es/-/lodash-es-4.17.6.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/lodash-es/-/lodash-es-4.17.6.tgz",
|
||||||
"integrity": "sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg==",
|
"integrity": "sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/lodash": "*"
|
"@types/lodash": "*"
|
||||||
}
|
}
|
||||||
@ -1506,7 +1503,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
|
||||||
"integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
|
"integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.53.0",
|
"@typescript-eslint/scope-manager": "5.53.0",
|
||||||
"@typescript-eslint/type-utils": "5.53.0",
|
"@typescript-eslint/type-utils": "5.53.0",
|
||||||
@ -1537,7 +1533,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-5.62.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-5.62.0.tgz",
|
||||||
"integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==",
|
"integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.62.0",
|
"@typescript-eslint/scope-manager": "5.62.0",
|
||||||
"@typescript-eslint/types": "5.62.0",
|
"@typescript-eslint/types": "5.62.0",
|
||||||
@ -2071,7 +2066,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.11.2.tgz",
|
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.11.2.tgz",
|
||||||
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
|
"integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@ -2389,7 +2383,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/browserslist/-/browserslist-4.24.2.tgz",
|
"resolved": "https://registry.npmmirror.com/browserslist/-/browserslist-4.24.2.tgz",
|
||||||
"integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==",
|
"integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caniuse-lite": "^1.0.30001669",
|
"caniuse-lite": "^1.0.30001669",
|
||||||
"electron-to-chromium": "^1.5.41",
|
"electron-to-chromium": "^1.5.41",
|
||||||
@ -3097,7 +3090,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/eslint/-/eslint-8.34.0.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint/-/eslint-8.34.0.tgz",
|
||||||
"integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==",
|
"integrity": "sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint/eslintrc": "^1.4.1",
|
"@eslint/eslintrc": "^1.4.1",
|
||||||
"@humanwhocodes/config-array": "^0.11.8",
|
"@humanwhocodes/config-array": "^0.11.8",
|
||||||
@ -3264,7 +3256,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
|
||||||
"integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==",
|
"integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array-includes": "^3.1.6",
|
"array-includes": "^3.1.6",
|
||||||
"array.prototype.flat": "^1.3.1",
|
"array.prototype.flat": "^1.3.1",
|
||||||
@ -3324,7 +3315,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-n/-/eslint-plugin-n-15.6.1.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint-plugin-n/-/eslint-plugin-n-15.6.1.tgz",
|
||||||
"integrity": "sha512-R9xw9OtCRxxaxaszTQmQAlPgM+RdGjaL1akWuY/Fv9fRAi8Wj4CUKc6iYVG8QNRjRuo8/BqVYIpfqberJUEacA==",
|
"integrity": "sha512-R9xw9OtCRxxaxaszTQmQAlPgM+RdGjaL1akWuY/Fv9fRAi8Wj4CUKc6iYVG8QNRjRuo8/BqVYIpfqberJUEacA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"builtins": "^5.0.1",
|
"builtins": "^5.0.1",
|
||||||
"eslint-plugin-es": "^4.1.0",
|
"eslint-plugin-es": "^4.1.0",
|
||||||
@ -3347,7 +3337,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz",
|
||||||
"integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==",
|
"integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
},
|
},
|
||||||
@ -4004,7 +3993,6 @@
|
|||||||
"version": "11.0.1",
|
"version": "11.0.1",
|
||||||
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.0.1.tgz",
|
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.0.1.tgz",
|
||||||
"integrity": "sha512-EqYpWyTF2s8nMfttfBA2yLKPNoZCO33pLS4MnbXQ4hECf1TKujCt1Kq7QAdrio7roL4+CqsfjqwYj4tYgq0pJQ==",
|
"integrity": "sha512-EqYpWyTF2s8nMfttfBA2yLKPNoZCO33pLS4MnbXQ4hECf1TKujCt1Kq7QAdrio7roL4+CqsfjqwYj4tYgq0pJQ==",
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.0.0"
|
"node": ">=12.0.0"
|
||||||
}
|
}
|
||||||
@ -4459,14 +4447,12 @@
|
|||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
|
||||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/lodash-es": {
|
"node_modules/lodash-es": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz",
|
"resolved": "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
|
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/lodash-unified": {
|
"node_modules/lodash-unified": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
@ -4992,7 +4978,6 @@
|
|||||||
"version": "8.4.21",
|
"version": "8.4.21",
|
||||||
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.21.tgz",
|
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.21.tgz",
|
||||||
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
|
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.4",
|
"nanoid": "^3.3.4",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
@ -5287,7 +5272,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/rollup/-/rollup-3.29.4.tgz",
|
"resolved": "https://registry.npmmirror.com/rollup/-/rollup-3.29.4.tgz",
|
||||||
"integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==",
|
"integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"rollup": "dist/bin/rollup"
|
"rollup": "dist/bin/rollup"
|
||||||
},
|
},
|
||||||
@ -5338,7 +5322,6 @@
|
|||||||
"version": "1.58.0",
|
"version": "1.58.0",
|
||||||
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.58.0.tgz",
|
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.58.0.tgz",
|
||||||
"integrity": "sha512-PiMJcP33DdKtZ/1jSjjqVIKihoDc6yWmYr9K/4r3fVVIEDAluD0q7XZiRKrNJcPK3qkLRF/79DND1H5q1LBjgg==",
|
"integrity": "sha512-PiMJcP33DdKtZ/1jSjjqVIKihoDc6yWmYr9K/4r3fVVIEDAluD0q7XZiRKrNJcPK3qkLRF/79DND1H5q1LBjgg==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": ">=3.0.0 <4.0.0",
|
"chokidar": ">=3.0.0 <4.0.0",
|
||||||
"immutable": "^4.0.0",
|
"immutable": "^4.0.0",
|
||||||
@ -5598,7 +5581,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.2.4.tgz",
|
"resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.2.4.tgz",
|
||||||
"integrity": "sha512-AhwtHCKMtR71JgeYDaswmZXhPcW9iuI9Sp2LvZPo9upDZ7231ZJ7eA9RaURbhpXGVlrjX4cFNlB4ieTetEb7hQ==",
|
"integrity": "sha512-AhwtHCKMtR71JgeYDaswmZXhPcW9iuI9Sp2LvZPo9upDZ7231ZJ7eA9RaURbhpXGVlrjX4cFNlB4ieTetEb7hQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arg": "^5.0.2",
|
"arg": "^5.0.2",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
@ -5817,7 +5799,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.9.5.tgz",
|
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.9.5.tgz",
|
||||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@ -6080,7 +6061,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-4.1.0.tgz",
|
"resolved": "https://registry.npmmirror.com/vite/-/vite-4.1.0.tgz",
|
||||||
"integrity": "sha512-YoUKE/9bbK4C8ZeSYMDDEF8H5aypmWUq4WisftDhntR1gkI2zt2SGT/5Wd2xu6ZoVXkCyO3U4844KWG9e4nFoQ==",
|
"integrity": "sha512-YoUKE/9bbK4C8ZeSYMDDEF8H5aypmWUq4WisftDhntR1gkI2zt2SGT/5Wd2xu6ZoVXkCyO3U4844KWG9e4nFoQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.16.14",
|
"esbuild": "^0.16.14",
|
||||||
"postcss": "^8.4.21",
|
"postcss": "^8.4.21",
|
||||||
@ -6129,7 +6109,6 @@
|
|||||||
"version": "3.2.45",
|
"version": "3.2.45",
|
||||||
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz",
|
||||||
"integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==",
|
"integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.2.45",
|
"@vue/compiler-dom": "3.2.45",
|
||||||
"@vue/compiler-sfc": "3.2.45",
|
"@vue/compiler-sfc": "3.2.45",
|
||||||
@ -6406,7 +6385,6 @@
|
|||||||
"version": "3.3.13",
|
"version": "3.3.13",
|
||||||
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.3.13.tgz",
|
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.3.13.tgz",
|
||||||
"integrity": "sha512-LDnUpQvDgsfc0u/YgtAgTMXJlJQqjkxW1PVcOnJA5cshPleULDjHi7U45pl2VJYazSSvLH8UKcid/kzH8I0a0Q==",
|
"integrity": "sha512-LDnUpQvDgsfc0u/YgtAgTMXJlJQqjkxW1PVcOnJA5cshPleULDjHi7U45pl2VJYazSSvLH8UKcid/kzH8I0a0Q==",
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.3.13",
|
"@vue/compiler-dom": "3.3.13",
|
||||||
"@vue/compiler-sfc": "3.3.13",
|
"@vue/compiler-sfc": "3.3.13",
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 && vite build && node publish.cjs",
|
"build": "vite build && node publish.cjs",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export function getNoticeList(params: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息发送记录
|
* 消发送记录
|
||||||
* @param params
|
* @param params
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
@ -19,6 +19,58 @@ export function getNoticeLog(params: any) {
|
|||||||
return request.get(`notice/log`, { params })
|
return request.get(`notice/log`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取消息发送记录
|
||||||
|
* @param params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getBindInfo() {
|
||||||
|
return request.get(`notice/bind/info`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消绑定
|
||||||
|
* @param params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function cancelBind(params: any) {
|
||||||
|
return request.post(`notice/bind/cancel`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信配置
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getWechatAuthUrl() {
|
||||||
|
return request.get('notice/bind/wechat')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信配置
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getWeappAuthUrl() {
|
||||||
|
return request.get('notice/bind/weapp')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信配置
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function sendSms(params: Record<string, any>) {
|
||||||
|
return request.post('notice/bind/sms/send',params, { showSuccessMessage: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信配置
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function bindSms(params: Record<string, any>) {
|
||||||
|
return request.post('notice/bind/sms/bind',params, { showSuccessMessage: true })
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息详情
|
* 消息详情
|
||||||
* @param key
|
* @param key
|
||||||
@ -186,6 +238,12 @@ export function getSmsCaptcha() {
|
|||||||
return request.get(`notice/niusms/captcha`)
|
return request.get(`notice/niusms/captcha`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取图像验证码
|
||||||
|
*/
|
||||||
|
export function getsiteCaptcha() {
|
||||||
|
return request.get(`site/captcha/create`)
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 发送验证码
|
* 发送验证码
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
@ -611,8 +611,8 @@ export function setMap(params: Record<string, any>) {
|
|||||||
/**
|
/**
|
||||||
* 获取地图配置
|
* 获取地图配置
|
||||||
*/
|
*/
|
||||||
export function getMap() {
|
export function getMap(params: Record<string, any>) {
|
||||||
return request.get(`sys/config/map`)
|
return request.get(`sys/config/map`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -8,6 +8,14 @@ export function getWeappConfig() {
|
|||||||
return request.get('weapp/config')
|
return request.get('weapp/config')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小程序配置
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getWeappAuthUrl() {
|
||||||
|
return request.get('weapp/auth_url')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑微信小程序配置
|
* 编辑微信小程序配置
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
@ -33,6 +33,12 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column :label="t('消息类型')" min-width="100" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span class="text-[#fff] rounded-[3px] px-[8px] py-[2px]" :class="{'bg-[#008000]': row.receiver_type == 1, 'bg-[#0000ff]': row.receiver_type == 0}">{{ row.receiver_type == 1 ? t('buyerNews') : t('sellerMessage') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column :label="t('response')" min-width="180">
|
<el-table-column :label="t('response')" min-width="180">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div v-for="(item, index) in row.weapp.content" :key="'a' + index" class="text-left">{{ item.join(":") }}</div>
|
<div v-for="(item, index) in row.weapp.content" :key="'a' + index" class="text-left">{{ item.join(":") }}</div>
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
<el-tab-pane :label="t('reply')" name="/channel/wechat/reply" />
|
<el-tab-pane :label="t('reply')" name="/channel/wechat/reply" />
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
|
<el-alert :title="t('微信平台最多支持25个消息模板获取时请注意微信平台剩余模板数量是否充足')" type="info" show-icon />
|
||||||
|
<div class="mt-[20px]">
|
||||||
<el-table :data="cronTableData.data" :span-method="templateSpan" size="large" v-loading="cronTableData.loading">
|
<el-table :data="cronTableData.data" :span-method="templateSpan" size="large" v-loading="cronTableData.loading">
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<span>{{ !cronTableData.loading ? t('emptyData') : '' }}</span>
|
<span>{{ !cronTableData.loading ? t('emptyData') : '' }}</span>
|
||||||
@ -34,7 +36,7 @@
|
|||||||
|
|
||||||
<el-table-column :label="t('messageType')" min-width="100" align="center">
|
<el-table-column :label="t('messageType')" min-width="100" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span>{{ row.message_type == 1 ? t('buyerNews') : t('sellerMessage') }}</span>
|
<span class="text-[#fff] rounded-[3px] px-[8px] py-[2px]" :class="{'bg-[#008000]': row.receiver_type == 1, 'bg-[#0000ff]': row.receiver_type == 0}">{{ row.receiver_type == 1 ? t('buyerNews') : t('sellerMessage') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@ -59,6 +61,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -220,9 +220,9 @@
|
|||||||
<el-table-column :label="t('appName')" align="left" width="300">
|
<el-table-column :label="t('appName')" align="left" width="300">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="flex items-center cursor-pointer relative left-[-10px]" @click="openDetail(row)">
|
<div class="flex items-center cursor-pointer relative left-[-10px]" @click="openDetail(row)">
|
||||||
<el-image class="w-[54px] h-[54px]" :src="row.icon" fit="contain">
|
<el-image class="w-[54px] h-[54px] rounded-[5px]" :src="row.icon" fit="contain">
|
||||||
<template #error>
|
<template #error>
|
||||||
<div class="flex items-center w-full h-full">
|
<div class="flex items-center w-full h-full rounded-[5px]">
|
||||||
<img class="max-w-full max-h-full" src="@/app/assets/images/icon-addon-one.png" alt="" />
|
<img class="max-w-full max-h-full" src="@/app/assets/images/icon-addon-one.png" alt="" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -1,6 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="showDialog" :title="t('noticeSetting')" width="550px" :destroy-on-close="true">
|
<el-dialog
|
||||||
<el-form :model="formData" label-width="110px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
|
v-model="showDialog"
|
||||||
|
:title="t('noticeSetting')"
|
||||||
|
width="550px"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
>
|
||||||
|
<el-alert
|
||||||
|
v-if="!formData.bind_sms && formData.is_need_bind_merchant"
|
||||||
|
title="未绑定接收者手机号"
|
||||||
|
type="error"
|
||||||
|
:closable="false"
|
||||||
|
/>
|
||||||
|
<el-form
|
||||||
|
:model="formData"
|
||||||
|
label-width="110px"
|
||||||
|
ref="formRef"
|
||||||
|
:rules="formRules"
|
||||||
|
class="page-form"
|
||||||
|
v-loading="loading"
|
||||||
|
>
|
||||||
<el-form-item :label="t('status')">
|
<el-form-item :label="t('status')">
|
||||||
<el-radio-group v-model="formData.is_sms">
|
<el-radio-group v-model="formData.is_sms">
|
||||||
<el-radio :label="1">{{ t('startUsing') }}</el-radio>
|
<el-radio :label="1">{{ t('startUsing') }}</el-radio>
|
||||||
@ -9,27 +27,39 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('name')">
|
<el-form-item :label="t('name')">
|
||||||
<div class="input-width"> {{ formData.name }} </div>
|
<div class="input-width">{{ formData.name }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('title')">
|
<el-form-item :label="t('title')">
|
||||||
<div class="input-width"> {{ formData.title }} </div>
|
<div class="input-width">{{ formData.title }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('smsId')" prop="sms_id">
|
<el-form-item :label="t('smsId')" prop="sms_id">
|
||||||
<el-input v-model.trim="formData.sms_id" :placeholder="t('smsIdPlaceholder')" class="input-width" show-word-limit clearable />
|
<el-input
|
||||||
|
v-model.trim="formData.sms_id"
|
||||||
|
:placeholder="t('smsIdPlaceholder')"
|
||||||
|
class="input-width"
|
||||||
|
show-word-limit
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('smsContent')">
|
<el-form-item :label="t('smsContent')">
|
||||||
<div class="input-width"> {{ formData.content }} </div>
|
<div class="input-width">{{ formData.content }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
|
<el-button @click="showDialog = false">{{
|
||||||
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{t('confirm')}}</el-button>
|
t('cancel')
|
||||||
|
}}</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
|
@click="confirm(formRef)"
|
||||||
|
>{{ t('confirm') }}</el-button
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -55,7 +85,9 @@ const initialFormData = {
|
|||||||
title: '',
|
title: '',
|
||||||
type: '',
|
type: '',
|
||||||
sms_id: '',
|
sms_id: '',
|
||||||
content: ''
|
content: '',
|
||||||
|
bind_sms: '',
|
||||||
|
is_need_bind_merchant: '',
|
||||||
}
|
}
|
||||||
const formData: Record<string, any> = reactive({ ...initialFormData })
|
const formData: Record<string, any> = reactive({ ...initialFormData })
|
||||||
|
|
||||||
@ -65,8 +97,8 @@ const formRef = ref<FormInstance>()
|
|||||||
const formRules = computed(() => {
|
const formRules = computed(() => {
|
||||||
return {
|
return {
|
||||||
sms_id: [
|
sms_id: [
|
||||||
{ required: true, message: t('smsIdPlaceholder'), trigger: 'blur' }
|
{ required: true, message: t('smsIdPlaceholder'), trigger: 'blur' },
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -86,11 +118,13 @@ const confirm = async (formEl: FormInstance | undefined) => {
|
|||||||
const data = formData
|
const data = formData
|
||||||
data.status = data.is_sms
|
data.status = data.is_sms
|
||||||
|
|
||||||
editNotice(data).then(res => {
|
editNotice(data)
|
||||||
|
.then((res) => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
showDialog.value = false
|
showDialog.value = false
|
||||||
emit('complete')
|
emit('complete')
|
||||||
}).catch(() => {
|
})
|
||||||
|
.catch(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
// showDialog.value = false
|
// showDialog.value = false
|
||||||
})
|
})
|
||||||
@ -105,7 +139,8 @@ const setFormData = async (row: any = null) => {
|
|||||||
if (row) {
|
if (row) {
|
||||||
Object.keys(formData).forEach((key: string) => {
|
Object.keys(formData).forEach((key: string) => {
|
||||||
if (row[key] != undefined) formData[key] = row[key]
|
if (row[key] != undefined) formData[key] = row[key]
|
||||||
if (row.sms && row.sms[key] != undefined) formData[key] = row.sms[key]
|
if (row.sms && row.sms[key] != undefined)
|
||||||
|
formData[key] = row.sms[key]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +149,7 @@ const setFormData = async (row: any = null) => {
|
|||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
showDialog,
|
showDialog,
|
||||||
setFormData
|
setFormData,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="showDialog" :title="t('noticeSetting')" width="550px" :destroy-on-close="true">
|
<el-dialog
|
||||||
<el-form :model="formData" label-width="110px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
|
v-model="showDialog"
|
||||||
|
:title="t('noticeSetting')"
|
||||||
|
width="550px"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
>
|
||||||
|
<el-alert
|
||||||
|
v-if="!formData.bind_weapp && formData.is_need_bind_merchant"
|
||||||
|
title="未绑定接收者小程序"
|
||||||
|
type="error"
|
||||||
|
:closable="false"
|
||||||
|
/>
|
||||||
|
<el-form
|
||||||
|
:model="formData"
|
||||||
|
label-width="110px"
|
||||||
|
ref="formRef"
|
||||||
|
:rules="formRules"
|
||||||
|
class="page-form"
|
||||||
|
v-loading="loading"
|
||||||
|
>
|
||||||
<el-form-item :label="t('status')">
|
<el-form-item :label="t('status')">
|
||||||
<el-radio-group v-model="formData.is_weapp">
|
<el-radio-group v-model="formData.is_weapp">
|
||||||
<el-radio :label="1">{{ t('startUsing') }}</el-radio>
|
<el-radio :label="1">{{ t('startUsing') }}</el-radio>
|
||||||
@ -9,25 +27,33 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('name')">
|
<el-form-item :label="t('name')">
|
||||||
<div class="input-width"> {{ formData.name }} </div>
|
<div class="input-width">{{ formData.name }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('weappTempKey')">
|
<el-form-item :label="t('weappTempKey')">
|
||||||
<div class="input-width"> {{ formData.tid }} </div>
|
<div class="input-width">{{ formData.tid }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('content')">
|
<el-form-item :label="t('content')">
|
||||||
<div class="input-width">
|
<div class="input-width">
|
||||||
<div v-for="(item, index) in formData.content" :key="index">{{ item[0] }}:{{ item[1] }} </div>
|
<div v-for="(item, index) in formData.content" :key="index">
|
||||||
|
{{ item[0] }}:{{ item[1] }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
|
<el-button @click="showDialog = false">{{
|
||||||
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{t('confirm')}}</el-button>
|
t('cancel')
|
||||||
|
}}</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
|
@click="confirm(formRef)"
|
||||||
|
>{{ t('confirm') }}</el-button
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -54,7 +80,9 @@ const initialFormData = {
|
|||||||
content: [],
|
content: [],
|
||||||
first: '',
|
first: '',
|
||||||
remark: '',
|
remark: '',
|
||||||
tid: ''
|
tid: '',
|
||||||
|
bind_weapp: '',
|
||||||
|
is_need_bind_merchant: '',
|
||||||
}
|
}
|
||||||
const formData: Record<string, any> = reactive({ ...initialFormData })
|
const formData: Record<string, any> = reactive({ ...initialFormData })
|
||||||
|
|
||||||
@ -62,9 +90,7 @@ const formRef = ref<FormInstance>()
|
|||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const formRules = computed(() => {
|
const formRules = computed(() => {
|
||||||
return {
|
return {}
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['complete'])
|
const emit = defineEmits(['complete'])
|
||||||
@ -83,11 +109,13 @@ const confirm = async (formEl: FormInstance | undefined) => {
|
|||||||
const data = formData
|
const data = formData
|
||||||
data.status = data.is_weapp
|
data.status = data.is_weapp
|
||||||
|
|
||||||
editNoticeStatus(data).then(res => {
|
editNoticeStatus(data)
|
||||||
|
.then((res) => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
showDialog.value = false
|
showDialog.value = false
|
||||||
emit('complete')
|
emit('complete')
|
||||||
}).catch(() => {
|
})
|
||||||
|
.catch(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -101,16 +129,16 @@ const setFormData = async (row: any = null) => {
|
|||||||
if (row) {
|
if (row) {
|
||||||
Object.keys(formData).forEach((key: string) => {
|
Object.keys(formData).forEach((key: string) => {
|
||||||
if (row[key] != undefined) formData[key] = row[key]
|
if (row[key] != undefined) formData[key] = row[key]
|
||||||
if (row.weapp && row.weapp[key] != undefined) formData[key] = row.weapp[key]
|
if (row.weapp && row.weapp[key] != undefined)
|
||||||
|
formData[key] = row.weapp[key]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
showDialog,
|
showDialog,
|
||||||
setFormData
|
setFormData,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="showDialog" :title="t('noticeSetting')" width="550px" :destroy-on-close="true">
|
<el-dialog
|
||||||
<el-form :model="formData" label-width="110px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
|
v-model="showDialog"
|
||||||
|
:title="t('noticeSetting')"
|
||||||
|
width="550px"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
>
|
||||||
|
<el-alert
|
||||||
|
v-if="!formData.bind_wechat && formData.is_need_bind_merchant"
|
||||||
|
title="未绑定接收者微信"
|
||||||
|
type="error"
|
||||||
|
:closable="false"
|
||||||
|
/>
|
||||||
|
<el-form
|
||||||
|
:model="formData"
|
||||||
|
label-width="110px"
|
||||||
|
ref="formRef"
|
||||||
|
:rules="formRules"
|
||||||
|
class="page-form"
|
||||||
|
v-loading="loading"
|
||||||
|
>
|
||||||
<el-form-item :label="t('status')">
|
<el-form-item :label="t('status')">
|
||||||
<el-radio-group v-model="formData.is_wechat">
|
<el-radio-group v-model="formData.is_wechat">
|
||||||
<el-radio :label="1">{{ t('startUsing') }}</el-radio>
|
<el-radio :label="1">{{ t('startUsing') }}</el-radio>
|
||||||
@ -9,37 +27,51 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('name')">
|
<el-form-item :label="t('name')">
|
||||||
<div class="input-width">{{ formData.name }} </div>
|
<div class="input-width">{{ formData.name }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('tempKey')">
|
<el-form-item :label="t('tempKey')">
|
||||||
<div class="input-width">{{ formData.temp_key }} </div>
|
<div class="input-width">{{ formData.temp_key }}</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item :label="t('keywordNameList')">
|
<el-form-item :label="t('keywordNameList')">
|
||||||
<div class="input-width">{{ formData.keyword_name_list ? formData.keyword_name_list.join(',') : '' }} </div>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<!-- <el-form-item :label="t('first')" prop="first">-->
|
|
||||||
<!-- <el-input v-model.trim="formData.wechat_first" :placeholder="t('firstPlaceholder')" class="input-width" show-word-limit clearable />-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
|
|
||||||
<el-form-item :label="t('content')">
|
|
||||||
<div class="input-width">
|
<div class="input-width">
|
||||||
<div v-for="(item, index) in formData.content" :key="index">{{ item[0] }}:{{ item[1] }} </div>
|
{{
|
||||||
|
formData.keyword_name_list
|
||||||
|
? formData.keyword_name_list.join(',')
|
||||||
|
: ''
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- <el-form-item :label="t('remark')" prop="remark">-->
|
<!-- <el-form-item :label="t('first')" prop="first">-->
|
||||||
<!-- <el-input v-model.trim="formData.wechat_remark" :placeholder="t('remarkPlaceholder')" class="input-width" show-word-limit clearable />-->
|
<!-- <el-input v-model.trim="formData.wechat_first" :placeholder="t('firstPlaceholder')" class="input-width" show-word-limit clearable />-->
|
||||||
<!-- </el-form-item>-->
|
<!-- </el-form-item>-->
|
||||||
|
|
||||||
|
<el-form-item :label="t('content')">
|
||||||
|
<div class="input-width">
|
||||||
|
<div v-for="(item, index) in formData.content" :key="index">
|
||||||
|
{{ item[0] }}:{{ item[1] }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- <el-form-item :label="t('remark')" prop="remark">-->
|
||||||
|
<!-- <el-input v-model.trim="formData.wechat_remark" :placeholder="t('remarkPlaceholder')" class="input-width" show-word-limit clearable />-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
|
<el-button @click="showDialog = false">{{
|
||||||
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{t('confirm')}}</el-button>
|
t('cancel')
|
||||||
|
}}</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
|
@click="confirm(formRef)"
|
||||||
|
>{{ t('confirm') }}</el-button
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -67,9 +99,11 @@ const initialFormData = {
|
|||||||
// first: '',
|
// first: '',
|
||||||
// remark: '',
|
// remark: '',
|
||||||
temp_key: '',
|
temp_key: '',
|
||||||
keyword_name_list: ''
|
keyword_name_list: '',
|
||||||
// wechat_first: '',
|
// wechat_first: '',
|
||||||
// wechat_remark: ''
|
// wechat_remark: ''
|
||||||
|
bind_wechat: '',
|
||||||
|
is_need_bind_merchant: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData: Record<string, any> = reactive({ ...initialFormData })
|
const formData: Record<string, any> = reactive({ ...initialFormData })
|
||||||
@ -78,9 +112,7 @@ const formRef = ref<FormInstance>()
|
|||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const formRules = computed(() => {
|
const formRules = computed(() => {
|
||||||
return {
|
return {}
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['complete'])
|
const emit = defineEmits(['complete'])
|
||||||
@ -98,11 +130,13 @@ const confirm = async (formEl: FormInstance | undefined) => {
|
|||||||
|
|
||||||
const data = formData
|
const data = formData
|
||||||
data.status = data.is_wechat
|
data.status = data.is_wechat
|
||||||
editNotice(data).then(res => {
|
editNotice(data)
|
||||||
|
.then((res) => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
showDialog.value = false
|
showDialog.value = false
|
||||||
emit('complete')
|
emit('complete')
|
||||||
}).catch(() => {
|
})
|
||||||
|
.catch(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -115,7 +149,8 @@ const setFormData = async (row: any = null) => {
|
|||||||
if (row) {
|
if (row) {
|
||||||
Object.keys(formData).forEach((key: string) => {
|
Object.keys(formData).forEach((key: string) => {
|
||||||
if (row[key] != undefined) formData[key] = row[key]
|
if (row[key] != undefined) formData[key] = row[key]
|
||||||
if (row.wechat && row.wechat[key] != undefined) formData[key] = row.wechat[key]
|
if (row.wechat && row.wechat[key] != undefined)
|
||||||
|
formData[key] = row.wechat[key]
|
||||||
})
|
})
|
||||||
// if (!row.wechat_first) formData['wechat_first'] = row['first']
|
// if (!row.wechat_first) formData['wechat_first'] = row['first']
|
||||||
// if (!row.wechat_remark) formData['wechat_remark'] = row['remark']
|
// if (!row.wechat_remark) formData['wechat_remark'] = row['remark']
|
||||||
@ -125,7 +160,7 @@ const setFormData = async (row: any = null) => {
|
|||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
showDialog,
|
showDialog,
|
||||||
setFormData
|
setFormData,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -7,15 +7,50 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-form class="page-form mt-[20px]" :model="formData" :rules="formRules" label-width="150px" ref="formRef" v-loading="loading">
|
<el-form class="page-form mt-[20px]" :model="formData" :rules="formRules" label-width="150px" ref="formRef" v-loading="loading">
|
||||||
|
<el-form-item label="地图类型" prop="map_type">
|
||||||
|
<div>
|
||||||
|
<el-radio-group v-model="formData.map_type">
|
||||||
|
<el-radio label="tianditu">天地图</el-radio>
|
||||||
|
<el-radio label="tencent">腾讯地图</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<div class="text-sm text-gray-400 mt-[10px] leading-none">选择地图服务提供商</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<template v-if="formData.map_type === 'tencent'">
|
||||||
<el-form-item :label="t('mapKey')" prop="key">
|
<el-form-item :label="t('mapKey')" prop="key">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center">
|
||||||
<el-input v-model.trim="formData.key" class="input-width" clearable />
|
<el-input v-model.trim="formData.key" class="input-width" clearable />
|
||||||
<span class="ml-2 cursor-pointer tutorial-btn" @click="tutorialFn">{{ t('clickTutorial') }}</span>
|
<span class="ml-2 cursor-pointer tutorial-btn" @click="tutorialFn">{{ t('clickTutorial') }}</span>
|
||||||
<span class="ml-2 cursor-pointer secret-btn" @click="secretFn('https://lbs.qq.com/dev/console/key/manage')">{{ t('clickSecretKey') }}</span>
|
<span class="ml-2 cursor-pointer secret-btn" @click="secretFn('https://lbs.qq.com/dev/console/key/manage')">{{ t('clickSecretKey') }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="t('aMapKey')" prop="key">
|
</template>
|
||||||
<el-input v-model.trim="formData.amap_key" class="input-width" clearable />
|
|
||||||
<span class="ml-2 cursor-pointer secret-btn" @click="secretFn('https://lbs.amap.com/')">{{ t('clickSecretKey') }}</span>
|
<template v-if="formData.map_type === 'tianditu'">
|
||||||
|
<el-form-item label="天地图服务端KEY" prop="tianditu_map_key">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<el-input v-model.trim="formData.tianditu_map_key" class="input-width" clearable />
|
||||||
|
<span class="ml-2 cursor-pointer secret-btn" @click="secretFn('https://cloudcenter.tianditu.gov.cn/center/development/myApp')">获取密钥</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-400 mt-[10px] leading-none">天地图服务器端API密钥,用于后端地理编码等服务,请求从业务服务器发起,不支持前端地图瓦片加载与 JS API 渲染。</div>
|
||||||
|
<div class="text-sm text-gray-400 mt-[10px] leading-none">使用场景:如地理编码、逆地理编码、坐标转换、批量 POI 查询等。</div>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="天地图浏览器端KEY" prop="tianditu_map_web_key">
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<el-input v-model.trim="formData.tianditu_map_web_key" class="input-width" clearable />
|
||||||
|
<span class="ml-2 cursor-pointer secret-btn" @click="secretFn('https://cloudcenter.tianditu.gov.cn/center/development/myApp')">获取密钥</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-gray-400 mt-[10px] leading-none">天地图浏览器端API密钥,用于前端加载地图,不可用于后端接口鉴权。</div>
|
||||||
|
<div class="text-sm text-gray-400 mt-[10px] leading-none">使用场景:展示地图瓦片、实现地图交互(缩放、拖拽、图层切换、标注、可视化展示、地图选位置等)。</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
<el-form-item :label="t('isOpen')" prop="is_open">
|
<el-form-item :label="t('isOpen')" prop="is_open">
|
||||||
<el-switch v-model="formData.is_open" :active-value="1" :inactive-value="0" />
|
<el-switch v-model="formData.is_open" :active-value="1" :inactive-value="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -45,8 +80,10 @@ import { FormInstance } from 'element-plus'
|
|||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const formRef = ref<FormInstance>()
|
const formRef = ref<FormInstance>()
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
|
map_type: 'tencent',
|
||||||
key: '',
|
key: '',
|
||||||
amap_key: '',
|
tianditu_map_key: '',
|
||||||
|
tianditu_map_web_key: '',
|
||||||
is_open: 0,
|
is_open: 0,
|
||||||
valid_time: 0
|
valid_time: 0
|
||||||
})
|
})
|
||||||
|
|||||||
@ -3,28 +3,71 @@
|
|||||||
<div class="main-container" v-loading="noticeTableData.loading">
|
<div class="main-container" v-loading="noticeTableData.loading">
|
||||||
<el-card class="box-card !border-none" shadow="never">
|
<el-card class="box-card !border-none" shadow="never">
|
||||||
<h3 class="panel-title !text-sm">{{ t('buyerNotice') }}</h3>
|
<h3 class="panel-title !text-sm">{{ t('buyerNotice') }}</h3>
|
||||||
|
|
||||||
<div class="flex flex-row flex-wrap">
|
<div class="flex flex-row flex-wrap">
|
||||||
<el-table :data="noticeTableData.buyer" size="large" :span-method="buyerSpan">
|
<el-table
|
||||||
<el-table-column prop="addon_name" :label="t('addon')" min-width="120" />
|
:data="noticeTableData.buyer"
|
||||||
<el-table-column prop="name" :label="t('noticeType')" min-width="120" />
|
size="large"
|
||||||
<el-table-column :label="t('operation')" align="right" fixed="right" min-width="300">
|
:span-method="buyerSpan"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="addon_name"
|
||||||
|
:label="t('addon')"
|
||||||
|
min-width="120"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
:label="t('noticeType')"
|
||||||
|
min-width="120"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
:label="t('operation')"
|
||||||
|
align="right"
|
||||||
|
fixed="right"
|
||||||
|
min-width="300"
|
||||||
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="text-sm mr-1 flex items-center cursor-pointer" v-if="row.support_type.indexOf('sms') != -1" @click="setNotice(row, 'sms')">
|
<div
|
||||||
<el-icon class="text-[15px] mr-[3px]" :class="row.is_sms ? 'open' : ''">
|
class="text-sm mr-1 flex items-center cursor-pointer"
|
||||||
|
v-if="row.support_type.indexOf('sms') != -1"
|
||||||
|
@click="setNotice(row, 'sms')"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="text-[15px] mr-[3px]"
|
||||||
|
:class="row.is_sms ? 'open' : ''"
|
||||||
|
>
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="ml-0.5">{{ t('sms') }}</span>
|
<span class="ml-0.5">{{ t('sms') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm flex items-center cursor-pointer ml-[20px]" v-if="row.support_type.indexOf('wechat') != -1" @click="setNotice(row, 'wechat')">
|
<div
|
||||||
<el-icon class="text-[15px] mr-[3px]" :class="row.is_wechat ? 'open' : ''">
|
class="text-sm flex items-center cursor-pointer ml-[20px]"
|
||||||
|
v-if="
|
||||||
|
row.support_type.indexOf('wechat') != -1
|
||||||
|
"
|
||||||
|
@click="setNotice(row, 'wechat')"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="text-[15px] mr-[3px]"
|
||||||
|
:class="row.is_wechat ? 'open' : ''"
|
||||||
|
>
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="ml-0.5">{{ t('wechat') }}</span>
|
<span class="ml-0.5">{{
|
||||||
|
t('wechat')
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm flex items-center cursor-pointer ml-[20px]" v-if="row.support_type.indexOf('weapp') != -1" @click="setNotice(row, 'weapp')">
|
<div
|
||||||
<el-icon class="text-[15px] mr-[3px]" :class="row.is_weapp ? 'open' : ''">
|
class="text-sm flex items-center cursor-pointer ml-[20px]"
|
||||||
|
v-if="
|
||||||
|
row.support_type.indexOf('weapp') != -1
|
||||||
|
"
|
||||||
|
@click="setNotice(row, 'weapp')"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="text-[15px] mr-[3px]"
|
||||||
|
:class="row.is_weapp ? 'open' : ''"
|
||||||
|
>
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="ml-0.5">{{ t('weapp') }}</span>
|
<span class="ml-0.5">{{ t('weapp') }}</span>
|
||||||
@ -37,29 +80,83 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="box-card mt-[15px] !border-none" shadow="never">
|
<el-card class="box-card mt-[15px] !border-none" shadow="never">
|
||||||
<h3 class="panel-title !text-sm">{{ t('sellerNotice') }}</h3>
|
<div class="flex items-center mb-[20px] gap-[10px]">
|
||||||
|
<h3 class="panel-title !text-sm !mb-[0]">
|
||||||
|
{{ t('sellerNotice') }}
|
||||||
|
</h3>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="openBindAccountDialog"
|
||||||
|
class="!text-[12px]"
|
||||||
|
>绑定接收信息账号</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row flex-wrap">
|
<div class="flex flex-row flex-wrap">
|
||||||
<el-table :data="noticeTableData.seller" size="large" :span-method="buyerSpan">
|
<el-table
|
||||||
<el-table-column prop="addon_name" :label="t('addon')" min-width="120" />
|
:data="noticeTableData.seller"
|
||||||
<el-table-column prop="name" :label="t('noticeType')" min-width="120" />
|
size="large"
|
||||||
<el-table-column :label="t('operation')" align="right" fixed="right" min-width="300">
|
:span-method="buyerSpan"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
prop="addon_name"
|
||||||
|
:label="t('addon')"
|
||||||
|
min-width="120"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
:label="t('noticeType')"
|
||||||
|
min-width="120"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
:label="t('operation')"
|
||||||
|
align="right"
|
||||||
|
fixed="right"
|
||||||
|
min-width="300"
|
||||||
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="text-sm mr-1 flex items-center cursor-pointer" v-if="row.support_type.indexOf('sms') != -1" @click="setNotice(row, 'sms')">
|
<div
|
||||||
<el-icon class="text-[15px] mr-[3px]" :class="row.is_sms ? 'open' : ''">
|
class="text-sm mr-1 flex items-center cursor-pointer"
|
||||||
|
v-if="row.support_type.indexOf('sms') != -1"
|
||||||
|
@click="setNotice(row, 'sms')"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="text-[15px] mr-[3px]"
|
||||||
|
:class="row.is_sms ? 'open' : ''"
|
||||||
|
>
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="ml-0.5">{{ t('sms') }}</span>
|
<span class="ml-0.5">{{ t('sms') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm flex items-center cursor-pointer ml-[20px]" v-if="row.support_type.indexOf('wechat') != -1" @click="setNotice(row, 'wechat')">
|
<div
|
||||||
<el-icon class="text-[15px] mr-[3px]" :class="row.is_wechat ? 'open' : ''">
|
class="text-sm flex items-center cursor-pointer ml-[20px]"
|
||||||
|
v-if="
|
||||||
|
row.support_type.indexOf('wechat') != -1
|
||||||
|
"
|
||||||
|
@click="setNotice(row, 'wechat')"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="text-[15px] mr-[3px]"
|
||||||
|
:class="row.is_wechat ? 'open' : ''"
|
||||||
|
>
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="ml-0.5">{{ t('wechat') }}</span>
|
<span class="ml-0.5">{{
|
||||||
|
t('wechat')
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm flex items-center cursor-pointer ml-[20px]" v-if="row.support_type.indexOf('weapp') != -1" @click="setNotice(row, 'weapp')">
|
<div
|
||||||
<el-icon class="text-[15px] mr-[3px]" :class="row.is_weapp ? 'open' : ''">
|
class="text-sm flex items-center cursor-pointer ml-[20px]"
|
||||||
|
v-if="
|
||||||
|
row.support_type.indexOf('weapp') != -1
|
||||||
|
"
|
||||||
|
@click="setNotice(row, 'weapp')"
|
||||||
|
>
|
||||||
|
<el-icon
|
||||||
|
class="text-[15px] mr-[3px]"
|
||||||
|
:class="row.is_weapp ? 'open' : ''"
|
||||||
|
>
|
||||||
<SuccessFilled />
|
<SuccessFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span class="ml-0.5">{{ t('weapp') }}</span>
|
<span class="ml-0.5">{{ t('weapp') }}</span>
|
||||||
@ -74,89 +171,510 @@
|
|||||||
<sms ref="smsDialog" @complete="loadNoticeList()" />
|
<sms ref="smsDialog" @complete="loadNoticeList()" />
|
||||||
<wechat ref="wechatDialog" @complete="loadNoticeList()" />
|
<wechat ref="wechatDialog" @complete="loadNoticeList()" />
|
||||||
<weapp ref="weappDialog" @complete="loadNoticeList()" />
|
<weapp ref="weappDialog" @complete="loadNoticeList()" />
|
||||||
|
<el-dialog
|
||||||
|
v-model="bindDialogVisible"
|
||||||
|
@close="bindDialogClose"
|
||||||
|
width="300"
|
||||||
|
>
|
||||||
|
<view class="flex flex-col justify-center items-center">
|
||||||
|
<span class="mb-[15px]">{{ isBind.title }}</span>
|
||||||
|
<el-image
|
||||||
|
v-if="isBind.key == 'weapp'"
|
||||||
|
class="w-[120px] h-[120px]"
|
||||||
|
:src="isBind.weapp_qrcode"
|
||||||
|
:fit="contain"
|
||||||
|
/>
|
||||||
|
<el-image
|
||||||
|
v-else
|
||||||
|
class="w-[120px] h-[120px]"
|
||||||
|
:src="isBind.wechat_qrcode"
|
||||||
|
:fit="contain"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 绑定接收信息账号弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="bindAccountDialogVisible"
|
||||||
|
title="绑定接收信息账号"
|
||||||
|
width="500px"
|
||||||
|
@close="bindAccountDialogClose"
|
||||||
|
>
|
||||||
|
<div class="account-bind-options">
|
||||||
|
<div class="option-item">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="title" v-if="!isBind.bind_sms_info"
|
||||||
|
>手机号</span
|
||||||
|
>
|
||||||
|
<span class="info" v-else
|
||||||
|
>手机号:{{ isBind.bind_sms_info }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<template v-if="!Number(isBind.bind_sms)">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="bindSmsFn"
|
||||||
|
class="!text-[12px]"
|
||||||
|
>绑定</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
@click="cancelBindFn('sms')"
|
||||||
|
class="!text-[12px]"
|
||||||
|
>解绑</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div class="option-item">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="title" v-if="!isBind.bind_wechat_info"
|
||||||
|
>微信账号</span
|
||||||
|
>
|
||||||
|
<span class="info" v-else
|
||||||
|
>微信openId:{{ isBind.bind_wechat_info }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<template v-if="!Number(isBind.bind_wechat)">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="bindWeChatFn"
|
||||||
|
class="!text-[12px]"
|
||||||
|
>绑定</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
@click="cancelBindFn('wechat')"
|
||||||
|
class="!text-[12px]"
|
||||||
|
>解绑</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="option-item">-->
|
||||||
|
<!-- <div class="flex flex-col">-->
|
||||||
|
<!-- <span class="title" v-if="!isBind.bind_weapp_info"-->
|
||||||
|
<!-- >小程序账号</span-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <span class="info" v-else-->
|
||||||
|
<!-- >小程序openId:{{ isBind.bind_weapp_info }}</span-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <template v-if="!Number(isBind.bind_weapp)">-->
|
||||||
|
<!-- <el-button-->
|
||||||
|
<!-- type="primary"-->
|
||||||
|
<!-- @click="bindWeappFn"-->
|
||||||
|
<!-- class="!text-[12px]"-->
|
||||||
|
<!-- >绑定</el-button-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- <template v-else>-->
|
||||||
|
<!-- <el-button-->
|
||||||
|
<!-- type="danger"-->
|
||||||
|
<!-- @click="cancelBindFn('weapp')"-->
|
||||||
|
<!-- class="!text-[12px]"-->
|
||||||
|
<!-- >解绑</el-button-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 新增:短信绑定弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="smsBindDialogVisible"
|
||||||
|
title="绑定接收信息手机号"
|
||||||
|
width="400px"
|
||||||
|
@close="resetSmsBindForm"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
:model="smsBindForm"
|
||||||
|
:rules="smsBindRules"
|
||||||
|
ref="smsBindFormRef"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
|
<el-form-item label="手机号" prop="mobile">
|
||||||
|
<el-input
|
||||||
|
v-model="smsBindForm.mobile"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
maxlength="11"
|
||||||
|
@input="handleMobileInput"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="验证码" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="smsBindForm.code"
|
||||||
|
placeholder="请输入验证码"
|
||||||
|
maxlength="6"
|
||||||
|
style="width: 50%"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
class="ml-2"
|
||||||
|
type="primary"
|
||||||
|
:disabled="
|
||||||
|
!canSendCode ||
|
||||||
|
sendingCode ||
|
||||||
|
smsBindForm.mobile.length !== 11
|
||||||
|
"
|
||||||
|
@click="sendSmsCode"
|
||||||
|
>
|
||||||
|
{{ codeBtnText }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="smsBindDialogVisible = false"
|
||||||
|
>取消</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:loading="bindingSms"
|
||||||
|
@click="submitSmsBind"
|
||||||
|
>
|
||||||
|
确认绑定
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
import { t } from '@/lang'
|
import { t } from '@/lang'
|
||||||
import { getNoticeList } from '@/app/api/notice'
|
import {
|
||||||
|
getNoticeList,
|
||||||
|
cancelBind,
|
||||||
|
getBindInfo,
|
||||||
|
getWechatAuthUrl,
|
||||||
|
getWeappAuthUrl,
|
||||||
|
sendSms,
|
||||||
|
bindSms
|
||||||
|
} from '@/app/api/notice'
|
||||||
import Sms from '@/app/views/setting/components/notice-sms.vue'
|
import Sms from '@/app/views/setting/components/notice-sms.vue'
|
||||||
import Wechat from '@/app/views/setting/components/notice-wechat.vue'
|
import Wechat from '@/app/views/setting/components/notice-wechat.vue'
|
||||||
import Weapp from '@/app/views/setting/components/notice-weapp.vue'
|
import Weapp from '@/app/views/setting/components/notice-weapp.vue'
|
||||||
|
import QRCode from 'qrcode'
|
||||||
|
import { img } from '@/utils/common'
|
||||||
|
import { SuccessFilled } from '@element-plus/icons-vue'
|
||||||
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
|
||||||
const smsDialog : Record<string, any> | null = ref(null)
|
const smsDialog: Record<string, any> | null = ref(null)
|
||||||
const wechatDialog : Record<string, any> | null = ref(null)
|
const wechatDialog: Record<string, any> | null = ref(null)
|
||||||
const weappDialog : Record<string, any> | null = ref(null)
|
const weappDialog: Record<string, any> | null = ref(null)
|
||||||
|
|
||||||
const noticeTableData = reactive({
|
// 新增:绑定接收信息账号弹窗显示状态
|
||||||
loading: true,
|
const bindAccountDialogVisible = ref(false)
|
||||||
buyer: [],
|
|
||||||
seller: []
|
// 打开绑定接收信息账号弹窗
|
||||||
})
|
const openBindAccountDialog = () => {
|
||||||
|
bindAccountDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭绑定接收信息账号弹窗
|
||||||
|
const bindAccountDialogClose = () => {
|
||||||
|
bindAccountDialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const noticeTableData = reactive({ loading: true, buyer: [], seller: [] })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配置信息
|
* 获取配置信息
|
||||||
*/
|
*/
|
||||||
const loadNoticeList = () => {
|
const loadNoticeList = () => {
|
||||||
noticeTableData.loading = true
|
noticeTableData.loading = true
|
||||||
|
getNoticeList({})
|
||||||
getNoticeList({}).then(res => {
|
.then((res) => {
|
||||||
noticeTableData.buyer = []
|
noticeTableData.buyer = []
|
||||||
noticeTableData.seller = []
|
noticeTableData.seller = []
|
||||||
res.data.forEach(item => {
|
res.data.forEach((item) => {
|
||||||
if (item.notice.length) {
|
if (item.notice.length) {
|
||||||
const buyer = []; const seller = []
|
const buyer = []
|
||||||
|
const seller = []
|
||||||
Object.keys(item.notice).forEach((key, index) => {
|
Object.keys(item.notice).forEach((key, index) => {
|
||||||
const notice = item.notice[key]
|
const notice = item.notice[key]
|
||||||
notice.addon_name = item.title
|
notice.addon_name = item.title
|
||||||
notice.receiver_type == 1 ? buyer.push(notice) : seller.push(notice)
|
notice.receiver_type == 1
|
||||||
|
? buyer.push(notice)
|
||||||
|
: seller.push(notice)
|
||||||
})
|
})
|
||||||
if (buyer.length) {
|
if (buyer.length) {
|
||||||
buyer[0].rowspan = buyer.length
|
buyer[0].rowspan = buyer.length
|
||||||
noticeTableData.buyer = noticeTableData.buyer.concat(buyer)
|
noticeTableData.buyer =
|
||||||
|
noticeTableData.buyer.concat(buyer)
|
||||||
}
|
}
|
||||||
if (seller.length) {
|
if (seller.length) {
|
||||||
seller[0].rowspan = seller.length
|
seller[0].rowspan = seller.length
|
||||||
noticeTableData.seller = noticeTableData.seller.concat(seller)
|
noticeTableData.seller =
|
||||||
|
noticeTableData.seller.concat(seller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
noticeTableData.loading = false
|
noticeTableData.loading = false
|
||||||
}).catch((e) => {
|
})
|
||||||
|
.catch((e) => {
|
||||||
noticeTableData.loading = false
|
noticeTableData.loading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const buyerSpan = (row : any) => {
|
const isBind = ref({
|
||||||
|
bind_sms: 0, // 新增:短信绑定状态
|
||||||
|
bind_wechat: 0,
|
||||||
|
bind_weapp: 0,
|
||||||
|
bind_sms_info: '',
|
||||||
|
bind_wechat_info: '',
|
||||||
|
bind_weapp_info: '',
|
||||||
|
wechat_qrcode: '',
|
||||||
|
weapp_qrcode: '',
|
||||||
|
title: '',
|
||||||
|
key: 'wechat',
|
||||||
|
})
|
||||||
|
// 查看是否绑定
|
||||||
|
const getBindInfoFn = (isFirstQuery = false) => {
|
||||||
|
getBindInfo().then((res) => {
|
||||||
|
if (Object.keys(res.data).length > 0) {
|
||||||
|
isBind.value.bind_sms = res.data.mobile ? 1 : 0 // 新增:更新短信绑定状态
|
||||||
|
isBind.value.bind_wechat = res.data.wechat_openid ? 1 : 0 // 新增:更新微信绑定状态
|
||||||
|
isBind.value.bind_weapp = res.data.weapp_openid ? 1 : 0 // 新增:更新小程序绑定状态
|
||||||
|
|
||||||
|
isBind.value.bind_sms_info = res.data.mobile
|
||||||
|
isBind.value.bind_wechat_info = res.data.wechat_openid
|
||||||
|
isBind.value.bind_weapp_info = res.data.weapp_openid
|
||||||
|
if (!isFirstQuery && isBind.value[`bind_${isBind.value.key}`]) {
|
||||||
|
bindDialogClose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getBindInfoFn(true)
|
||||||
|
// --------------------- 绑定微信 ---------------------
|
||||||
|
let isBindRepeat = false
|
||||||
|
const bindDialogVisible = ref(false)
|
||||||
|
const requestTimer = ref()
|
||||||
|
const bindWeChatFn = () => {
|
||||||
|
if (isBindRepeat) return
|
||||||
|
isBindRepeat = true
|
||||||
|
getWechatAuthUrl()
|
||||||
|
.then((res) => {
|
||||||
|
isBindRepeat = false
|
||||||
|
if (res?.data?.url) generateQRCode(res.data.url, 'wechat_qrcode')
|
||||||
|
bindDialogVisible.value = true
|
||||||
|
isBind.value.title = '微信扫一扫,绑定接收信息微信'
|
||||||
|
isBind.value.key = 'wechat'
|
||||||
|
requestTimer.value = setInterval(getBindInfoFn, 1000)
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
isBindRepeat = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const bindWeappFn = () => {
|
||||||
|
if (isBindRepeat) return
|
||||||
|
isBindRepeat = true
|
||||||
|
getWeappAuthUrl()
|
||||||
|
.then((res) => {
|
||||||
|
isBindRepeat = false
|
||||||
|
if (res?.data?.url) isBind.value.weapp_qrcode = img(res.data.url)
|
||||||
|
bindDialogVisible.value = true
|
||||||
|
isBind.value.title = '微信扫一扫,绑定接收信息小程序'
|
||||||
|
isBind.value.key = 'weapp'
|
||||||
|
requestTimer.value = setInterval(getBindInfoFn, 1000)
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
isBindRepeat = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateQRCode = async (url, type) => {
|
||||||
|
try {
|
||||||
|
// 生成二维码
|
||||||
|
isBind.value[type] = await QRCode.toDataURL(url, {
|
||||||
|
errorCorrectionLevel: 'L',
|
||||||
|
margin: 0,
|
||||||
|
width: 120,
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
isBind.value[type] = ''
|
||||||
|
console.error('生成二维码失败', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------- 取消绑定 ---------------------
|
||||||
|
const isUnbindRepeat = ref(false)
|
||||||
|
const cancelBindFn = (key: any) => {
|
||||||
|
ElMessageBox.confirm('确定取消绑定吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
}).then(() => {
|
||||||
|
if (isUnbindRepeat.value) return
|
||||||
|
isUnbindRepeat.value = true
|
||||||
|
|
||||||
|
cancelBind({ unbind_type: [key] })
|
||||||
|
.then((res) => {
|
||||||
|
ElMessage({ message: '取消绑定成功', type: 'success' })
|
||||||
|
getBindInfoFn()
|
||||||
|
isUnbindRepeat.value = false
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
isUnbindRepeat.value = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const bindDialogClose = () => {
|
||||||
|
clearInterval(requestTimer.value)
|
||||||
|
bindDialogVisible.value = false
|
||||||
|
}
|
||||||
|
// --------------------- 新增:短信绑定相关逻辑 ---------------------
|
||||||
|
// 短信绑定弹窗显示状态
|
||||||
|
const smsBindDialogVisible = ref(false)
|
||||||
|
// 表单ref
|
||||||
|
const smsBindFormRef = ref<FormInstance>()
|
||||||
|
// 绑定中状态
|
||||||
|
const bindingSms = ref(false)
|
||||||
|
// 是否可以发送验证码
|
||||||
|
const canSendCode = ref(true)
|
||||||
|
// 发送验证码中
|
||||||
|
const sendingCode = ref(false)
|
||||||
|
// 验证码按钮文字
|
||||||
|
const codeBtnText = ref('发送验证码')
|
||||||
|
// 倒计时秒数
|
||||||
|
const countdown = ref(60)
|
||||||
|
|
||||||
|
// 短信绑定表单
|
||||||
|
const smsBindForm = reactive({
|
||||||
|
mobile: '', // 手机号
|
||||||
|
code: '', // 验证码
|
||||||
|
mobile_key: '', // 发送验证码返回的key
|
||||||
|
})
|
||||||
|
|
||||||
|
// 短信绑定表单验证规则
|
||||||
|
const smsBindRules = reactive<FormRules>({
|
||||||
|
mobile: [
|
||||||
|
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||||
|
{
|
||||||
|
pattern: /^1[3-9]\d{9}$/,
|
||||||
|
message: '请输入正确的手机号',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
code: [
|
||||||
|
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
||||||
|
{ pattern: /^\d{4}$/, message: '请输入6位数字验证码', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
// 手机号输入处理(只保留数字)
|
||||||
|
const handleMobileInput = (val: string) => {
|
||||||
|
smsBindForm.mobile = val.replace(/\D/g, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送验证码
|
||||||
|
const sendSmsCode = async () => {
|
||||||
|
try {
|
||||||
|
sendingCode.value = true
|
||||||
|
// 发送验证码请求
|
||||||
|
const res = await sendSms({ mobile: smsBindForm.mobile })
|
||||||
|
if (res.data) {
|
||||||
|
// 保存返回的mobile_key
|
||||||
|
smsBindForm.mobile_key = res.data.key || ''
|
||||||
|
|
||||||
|
// 开始倒计时
|
||||||
|
canSendCode.value = false
|
||||||
|
codeBtnText.value = `${countdown.value}秒后重新发送`
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
countdown.value--
|
||||||
|
codeBtnText.value = `${countdown.value}秒后重新发送`
|
||||||
|
if (countdown.value <= 0) {
|
||||||
|
clearInterval(timer)
|
||||||
|
canSendCode.value = true
|
||||||
|
codeBtnText.value = '发送验证码'
|
||||||
|
countdown.value = 60
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
sendingCode.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交短信绑定
|
||||||
|
const submitSmsBind = async () => {
|
||||||
|
if (!smsBindFormRef.value) return
|
||||||
|
|
||||||
|
// 表单验证
|
||||||
|
try {
|
||||||
|
await smsBindFormRef.value.validate()
|
||||||
|
bindingSms.value = true
|
||||||
|
|
||||||
|
// 调用绑定接口
|
||||||
|
const res = await bindSms({
|
||||||
|
mobile: smsBindForm.mobile,
|
||||||
|
mobile_key: smsBindForm.mobile_key,
|
||||||
|
mobile_code: smsBindForm.code,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
smsBindDialogVisible.value = false
|
||||||
|
getBindInfoFn() // 更新绑定状态
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
} finally {
|
||||||
|
bindingSms.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置短信绑定表单
|
||||||
|
const resetSmsBindForm = () => {
|
||||||
|
smsBindForm.mobile = ''
|
||||||
|
smsBindForm.code = ''
|
||||||
|
smsBindForm.mobile_key = ''
|
||||||
|
canSendCode.value = true
|
||||||
|
codeBtnText.value = '发送验证码'
|
||||||
|
countdown.value = 60
|
||||||
|
if (smsBindFormRef.value) {
|
||||||
|
smsBindFormRef.value.clearValidate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实现bindSmsFn方法
|
||||||
|
const bindSmsFn = () => {
|
||||||
|
// 打开短信绑定弹窗
|
||||||
|
smsBindDialogVisible.value = true
|
||||||
|
// 重置表单
|
||||||
|
resetSmsBindForm()
|
||||||
|
}
|
||||||
|
// --------------------- 短信绑定逻辑结束 ---------------------
|
||||||
|
|
||||||
|
const buyerSpan = (row: any) => {
|
||||||
if (row.columnIndex === 0) {
|
if (row.columnIndex === 0) {
|
||||||
if (row.row.rowspan) {
|
if (row.row.rowspan) {
|
||||||
return {
|
return { rowspan: row.row.rowspan, colspan: 1 }
|
||||||
rowspan: row.row.rowspan,
|
|
||||||
colspan: 1
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return {
|
return { rowspan: 0, colspan: 0 }
|
||||||
rowspan: 0,
|
|
||||||
colspan: 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadNoticeList()
|
loadNoticeList()
|
||||||
|
|
||||||
const setNotice = (data : any, type : string) => {
|
const setNotice = (data: any, type: string) => {
|
||||||
data.type = type
|
data.type = type
|
||||||
data.status = data['is_' + type]
|
data.status = data['is_' + type]
|
||||||
if (type === 'sms') {
|
if (type === 'sms') {
|
||||||
|
data.bind_sms = isBind.value.bind_sms
|
||||||
smsDialog.value.setFormData(data)
|
smsDialog.value.setFormData(data)
|
||||||
smsDialog.value.showDialog = true
|
smsDialog.value.showDialog = true
|
||||||
} else if (type === 'wechat') {
|
} else if (type === 'wechat') {
|
||||||
|
data.bind_wechat = isBind.value.bind_wechat
|
||||||
wechatDialog.value.setFormData(data)
|
wechatDialog.value.setFormData(data)
|
||||||
wechatDialog.value.showDialog = true
|
wechatDialog.value.showDialog = true
|
||||||
} else if (type === 'weapp') {
|
} else if (type === 'weapp') {
|
||||||
|
data.bind_weapp = isBind.value.bind_weapp
|
||||||
weappDialog.value.setFormData(data)
|
weappDialog.value.setFormData(data)
|
||||||
weappDialog.value.showDialog = true
|
weappDialog.value.showDialog = true
|
||||||
}
|
}
|
||||||
@ -164,13 +682,35 @@ const setNotice = (data : any, type : string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.open {
|
.open {
|
||||||
color: var(--el-color-primary);
|
color: var(--el-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice-type {
|
.notice-type {
|
||||||
>div:nth-last-child(1):first-child {
|
> div:nth-last-child(1):first-child {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-bind-options {
|
||||||
|
.option-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<span class="text-[14px] mr-[10px]">{{ t('transferSceneId') }}:</span>
|
<span class="text-[14px] mr-[10px]">{{ t('transferSceneId') }}:</span>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<el-input v-model.trim="item.scene_id" maxlength="5" class="!w-[60px]" :disabled="item.disabled" @blur="handleInput($event,key,item)" :ref="(el: any) =>{ if(el) inputRefs[key] = el }" v-show="!item.disabled"/>
|
<el-input v-model.trim="item.scene_id" maxlength="5" minlength="4" class="!w-[60px]" :disabled="item.disabled" @blur="handleInput($event,key,item)" :ref="(el: any) =>{ if(el) inputRefs[key] = el }" v-show="!item.disabled"/>
|
||||||
<div v-show="item.disabled">{{item.scene_id ? item.scene_id : '--'}}</div>
|
<div v-show="item.disabled">{{item.scene_id ? item.scene_id : '--'}}</div>
|
||||||
<div @click="handleDisabled(item, key)" class="w-[40xp] flex items-center ml-[8px]"><el-icon size="20" color="var(--el-color-primary)"><Edit /></el-icon></div>
|
<div @click="handleDisabled(item, key)" class="w-[40xp] flex items-center ml-[8px]"><el-icon size="20" color="var(--el-color-primary)"><Edit /></el-icon></div>
|
||||||
</div>
|
</div>
|
||||||
@ -80,7 +80,8 @@ getTransferSceneFn()
|
|||||||
|
|
||||||
// 更改场景值
|
// 更改场景值
|
||||||
const handleInput = (e: any, key: any, data: any) => {
|
const handleInput = (e: any, key: any, data: any) => {
|
||||||
if (e.target.value) {
|
const originalValue = originalValues.value[key]
|
||||||
|
if (e.target.value && e.target.value.length >= 4) {
|
||||||
setSceneId({
|
setSceneId({
|
||||||
scene: key,
|
scene: key,
|
||||||
scene_id: e.target.value
|
scene_id: e.target.value
|
||||||
@ -89,11 +90,15 @@ const handleInput = (e: any, key: any, data: any) => {
|
|||||||
getTransferSceneFn()
|
getTransferSceneFn()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
data.scene_id = originalValue
|
||||||
data.disabled = true
|
data.disabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const inputRefs = ref<any>({})
|
const inputRefs = ref<any>({})
|
||||||
|
const originalValues = ref<any>({})
|
||||||
const handleDisabled = (data: any, key: any) => {
|
const handleDisabled = (data: any, key: any) => {
|
||||||
|
// 保存原始值
|
||||||
|
originalValues.value[key] = data.scene_id
|
||||||
data.disabled = false
|
data.disabled = false
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
inputRefs.value[key].focus()
|
inputRefs.value[key].focus()
|
||||||
|
|||||||
512
admin/src/components/map-selector/index.vue
Normal file
512
admin/src/components/map-selector/index.vue
Normal file
@ -0,0 +1,512 @@
|
|||||||
|
<template>
|
||||||
|
<div :id="containerId" :class="containerClass" :style="containerStyle" v-loading="loading"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, onMounted, watch, nextTick, onBeforeUnmount } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { t } from '@/lang'
|
||||||
|
import { getMap } from '@/app/api/sys'
|
||||||
|
|
||||||
|
import {
|
||||||
|
createMarker,
|
||||||
|
createCircle,
|
||||||
|
createPolygon,
|
||||||
|
deleteGeometry,
|
||||||
|
selectGeometry,
|
||||||
|
latLngToAddress
|
||||||
|
} from '@/utils/qqmap'
|
||||||
|
|
||||||
|
// 天地图工具
|
||||||
|
import {
|
||||||
|
createCircle as tdCreateCircle,
|
||||||
|
createPolygon as tdCreatePolygon,
|
||||||
|
deleteGeometry as tdDeleteGeometry,
|
||||||
|
selectGeometry as tdSelectGeometry,
|
||||||
|
clearAllGeometry,
|
||||||
|
latLngToAddress as tiandituLatLngToAddress
|
||||||
|
} from '@/utils/tianditu'
|
||||||
|
|
||||||
|
const MAP_INIT_DELAY = 500
|
||||||
|
const MAP_SEARCH_TIMEOUT = 5000
|
||||||
|
const MAP_SEARCH_INTERVAL = 100
|
||||||
|
const MAP_SEARCH_MAX_ATTEMPTS = 50
|
||||||
|
|
||||||
|
interface MapInstance {
|
||||||
|
destroy?: () => void
|
||||||
|
clearOverLays?: () => void
|
||||||
|
on?: (event: string, callback: Function) => void
|
||||||
|
addControl?: (control: any) => void
|
||||||
|
addOverLay?: (overlay: any) => void
|
||||||
|
removeOverLay?: (overlay: any) => void
|
||||||
|
centerAndZoom?: (center: any, zoom: number) => void
|
||||||
|
setZoom?: (zoom: number) => void
|
||||||
|
setCenter?: (center: any) => void
|
||||||
|
addEventListener?: (event: string, callback: Function) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
containerId?: string
|
||||||
|
containerClass?: string
|
||||||
|
containerStyle?: string
|
||||||
|
longitude?: string | number
|
||||||
|
latitude?: string | number
|
||||||
|
zoom?: number
|
||||||
|
selectedKey?: string
|
||||||
|
disabledClickMarker?: any // 是否禁止点击事件添加标注
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'update:longitude', value: string): void
|
||||||
|
(e: 'update:latitude', value: string): void
|
||||||
|
(e: 'locationChange', data: { lat: number, lng: number, address: any }): void
|
||||||
|
(e: 'areaChange', data: { key: string, type: 'circle' | 'polygon', path: any }): void
|
||||||
|
(e: 'selectChange', key: string): void
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
containerId: 'map-container',
|
||||||
|
containerClass: 'w-[800px] h-[500px] relative border border-gray-300',
|
||||||
|
containerStyle: '',
|
||||||
|
longitude: 116.397463,
|
||||||
|
latitude: 39.909187,
|
||||||
|
zoom: 14,
|
||||||
|
selectedKey: '',
|
||||||
|
disabledClickMarker: false
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<Emits>()
|
||||||
|
|
||||||
|
const loading = ref(true)
|
||||||
|
const mapKey = ref('')
|
||||||
|
const mapType = ref<'tencent' | 'tianditu'>('tianditu')
|
||||||
|
let map: MapInstance | null = null
|
||||||
|
let marker: any = null
|
||||||
|
const overlays = ref<any[]>([])
|
||||||
|
|
||||||
|
// 获取地图配置
|
||||||
|
const getMapConfigData = () => {
|
||||||
|
return getMap({
|
||||||
|
need_encrypt: false
|
||||||
|
}).then((res: any) => {
|
||||||
|
mapType.value = res.data.map_type || 'tianditu'
|
||||||
|
mapKey.value = mapType.value === 'tianditu' ? res.data.tianditu_map_web_key : res.data.key
|
||||||
|
}).catch((error) => {
|
||||||
|
loading.value = false
|
||||||
|
ElMessage.error(t('获取地图配置失败'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化腾讯地图
|
||||||
|
const initTencentMap = () => {
|
||||||
|
const mapScript = document.createElement('script')
|
||||||
|
mapScript.src = 'https://map.qq.com/api/gljs?libraries=tools,service&v=1.exp&key=' + mapKey.value
|
||||||
|
document.body.appendChild(mapScript)
|
||||||
|
|
||||||
|
mapScript.onload = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const TMap = (window as any).TMap
|
||||||
|
if (TMap) {
|
||||||
|
const lng = props.longitude ? Number(props.longitude) : 116.397463
|
||||||
|
const lat = props.latitude ? Number(props.latitude) : 39.909187
|
||||||
|
const center = new TMap.LatLng(lat, lng)
|
||||||
|
map = new TMap.Map(props.containerId, { center, zoom: props.zoom })
|
||||||
|
map.on('tilesloaded', () => loading.value = false)
|
||||||
|
|
||||||
|
marker = createMarker(map)
|
||||||
|
if(!props.disabledClickMarker) {
|
||||||
|
map.on('click', (evt: any) => {
|
||||||
|
const ll = evt?.latLng
|
||||||
|
if (!ll) return
|
||||||
|
const lat = typeof ll.getLat === 'function' ? ll.getLat() : ll.lat
|
||||||
|
const lng = typeof ll.getLng === 'function' ? ll.getLng() : ll.lng
|
||||||
|
if (lat == null || lng == null || Number.isNaN(lat) || Number.isNaN(lng)) return
|
||||||
|
|
||||||
|
const newCenter = new TMap.LatLng(lat, lng)
|
||||||
|
map.setZoom(16)
|
||||||
|
map.setCenter(newCenter)
|
||||||
|
marker.updateGeometries({ id: 'center', position: newCenter })
|
||||||
|
nextTick(() => {
|
||||||
|
handleLocationChange(lat, lng)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.latitude && props.longitude) {
|
||||||
|
handleLocationChange(lat, lng)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loading.value = false
|
||||||
|
ElMessage.error(t('腾讯地图加载失败'))
|
||||||
|
}
|
||||||
|
}, MAP_INIT_DELAY)
|
||||||
|
}
|
||||||
|
|
||||||
|
mapScript.onerror = () => {
|
||||||
|
loading.value = false
|
||||||
|
ElMessage.error(t('腾讯地图脚本加载失败'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化天地图
|
||||||
|
const initTiandituMap = () => {
|
||||||
|
const mapScript = document.createElement('script')
|
||||||
|
mapScript.src = 'https://api.tianditu.gov.cn/api?v=4.0&tk=' + mapKey.value
|
||||||
|
document.body.appendChild(mapScript)
|
||||||
|
|
||||||
|
mapScript.onload = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (T) {
|
||||||
|
const lng = props.longitude ? Number(props.longitude) : 116.397463
|
||||||
|
const lat = props.latitude ? Number(props.latitude) : 39.909187
|
||||||
|
map = new T.Map(props.containerId)
|
||||||
|
map.centerAndZoom(new T.LngLat(lng, lat), props.zoom)
|
||||||
|
|
||||||
|
const ctrl = new T.Control.Zoom()
|
||||||
|
map.addControl(ctrl)
|
||||||
|
|
||||||
|
marker = new T.Marker(new T.LngLat(lng, lat))
|
||||||
|
map.addOverLay(marker)
|
||||||
|
|
||||||
|
loading.value = false
|
||||||
|
|
||||||
|
if(!props.disabledClickMarker) {
|
||||||
|
map.addEventListener('click', (evt: any) => {
|
||||||
|
const lngLat = evt.lnglat
|
||||||
|
if (!lngLat) return
|
||||||
|
const lat = lngLat.lat
|
||||||
|
const lng = lngLat.lng
|
||||||
|
if (lat == null || lng == null || Number.isNaN(lat) || Number.isNaN(lng)) return
|
||||||
|
|
||||||
|
map.removeOverLay(marker)
|
||||||
|
|
||||||
|
marker = new T.Marker(new T.LngLat(lng, lat))
|
||||||
|
map.addOverLay(marker)
|
||||||
|
|
||||||
|
map.centerAndZoom(new T.LngLat(lng, lat), 16)
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
handleLocationChange(lat, lng)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.latitude && props.longitude) {
|
||||||
|
handleLocationChange(lat, lng)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loading.value = false
|
||||||
|
ElMessage.error(t('天地图加载失败'))
|
||||||
|
}
|
||||||
|
}, MAP_INIT_DELAY)
|
||||||
|
}
|
||||||
|
|
||||||
|
mapScript.onerror = () => {
|
||||||
|
loading.value = false
|
||||||
|
ElMessage.error(t('天地图加载失败,请检查密钥配置'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化地图
|
||||||
|
const initMap = () => {
|
||||||
|
if (!mapKey.value) {
|
||||||
|
loading.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 防止重复初始化
|
||||||
|
if (map) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
initTencentMap()
|
||||||
|
} else if (mapType.value === 'tianditu') {
|
||||||
|
initTiandituMap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理位置变化
|
||||||
|
const handleLocationChange = (lat: number, lng: number) => {
|
||||||
|
emit('update:longitude', String(lng))
|
||||||
|
emit('update:latitude', String(lat))
|
||||||
|
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
latLngToAddress({ mapKey: mapKey.value, lat, lng }).then(({ message, result }) => {
|
||||||
|
if (message == 'query ok' || message == 'Success') {
|
||||||
|
emit('locationChange', { lat, lng, address: result })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (mapType.value === 'tianditu') {
|
||||||
|
tiandituLatLngToAddress({ mapKey: mapKey.value, lat, lng }).then((addressData: any) => {
|
||||||
|
emit('locationChange', { lat, lng, address: addressData })
|
||||||
|
}).catch((error: any) => {
|
||||||
|
ElMessage.error(error.message || t('地址解析失败'))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新地图位置(供外部调用)
|
||||||
|
const updateLocation = (lat: number, lng: number) => {
|
||||||
|
if (!map || !marker) return
|
||||||
|
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
const TMap = (window as any).TMap
|
||||||
|
if (!TMap) return
|
||||||
|
const newCenter = new TMap.LatLng(lat, lng)
|
||||||
|
map.setZoom(16)
|
||||||
|
map.setCenter(newCenter)
|
||||||
|
marker.updateGeometries({ id: 'center', position: newCenter })
|
||||||
|
} else if (mapType.value === 'tianditu') {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) return
|
||||||
|
const newCenter = new T.LngLat(lng, lat)
|
||||||
|
|
||||||
|
// 移除旧标记
|
||||||
|
map.removeOverLay(marker)
|
||||||
|
|
||||||
|
// 创建新标记
|
||||||
|
marker = new T.Marker(newCenter)
|
||||||
|
map.addOverLay(marker)
|
||||||
|
|
||||||
|
map.centerAndZoom(newCenter, 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 地址搜索(供外部调用)
|
||||||
|
const searchAddress = (address: string): Promise<{ lat: number, lng: number }> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!mapKey.value) {
|
||||||
|
reject(new Error(t('地图配置未加载')))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const waitForMap = () => {
|
||||||
|
return new Promise<void>((resolveWait, rejectWait) => {
|
||||||
|
if (map) {
|
||||||
|
resolveWait()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let attempts = 0
|
||||||
|
const checkInterval = setInterval(() => {
|
||||||
|
attempts++
|
||||||
|
if (map) {
|
||||||
|
clearInterval(checkInterval)
|
||||||
|
resolveWait()
|
||||||
|
} else if (attempts > MAP_SEARCH_MAX_ATTEMPTS) {
|
||||||
|
clearInterval(checkInterval)
|
||||||
|
rejectWait(new Error(t('地图初始化超时')))
|
||||||
|
}
|
||||||
|
}, MAP_SEARCH_INTERVAL)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForMap().then(() => {
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
const TMap = (window as any).TMap
|
||||||
|
if (!TMap?.service) {
|
||||||
|
reject(new Error(t('腾讯地图服务未加载')))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const geocoder = new TMap.service.Geocoder({ key: mapKey.value })
|
||||||
|
geocoder.getLocation({ address }).then((result: any) => {
|
||||||
|
if (result.status === 0 && result.result?.location) {
|
||||||
|
const location = result.result.location
|
||||||
|
const lat = Number(location.lat)
|
||||||
|
const lng = Number(location.lng)
|
||||||
|
updateLocation(lat, lng)
|
||||||
|
resolve({ lat, lng })
|
||||||
|
} else {
|
||||||
|
reject(new Error(result.message || t('未找到该地址')))
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
} else if (mapType.value === 'tianditu') {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) {
|
||||||
|
reject(new Error(t('天地图服务未加载')))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const geocoder = new T.Geocoder()
|
||||||
|
geocoder.getPoint(address, (result: any) => {
|
||||||
|
if (result && result.status === '0' && result.location) {
|
||||||
|
const lat = result.location.lat
|
||||||
|
const lng = result.location.lon || result.location.lng
|
||||||
|
if (lat && lng) {
|
||||||
|
updateLocation(lat, lng)
|
||||||
|
resolve({ lat, lng })
|
||||||
|
} else {
|
||||||
|
reject(new Error(t('坐标解析失败')))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(new Error(result?.msg || t('未找到该地址')))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(reject)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 添加圆
|
||||||
|
const addCircle = (center?: { lat: number; lng: number }, radius = 1000, options?: any) => {
|
||||||
|
if (!map) return null
|
||||||
|
const key = options?.key || `circle_${Date.now()}`
|
||||||
|
let circle = null
|
||||||
|
|
||||||
|
// 创建geometriesData对象
|
||||||
|
const geometriesData = { key, center, radius, ...options }
|
||||||
|
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
createCircle(map, geometriesData, (selectedKey) => {
|
||||||
|
// 触发selectChange事件
|
||||||
|
emit('selectChange', selectedKey)
|
||||||
|
})
|
||||||
|
// 腾讯地图的createCircle不返回值,创建一个包含key的对象添加到overlays
|
||||||
|
circle = { key, geometriesData }
|
||||||
|
} else {
|
||||||
|
circle = tdCreateCircle(map, geometriesData, (data) => {
|
||||||
|
// 触发areaChange事件,确保path数据干净,不包含循环引用
|
||||||
|
emit('areaChange', {
|
||||||
|
key: data.key,
|
||||||
|
type: 'circle',
|
||||||
|
path: {
|
||||||
|
key: data.key,
|
||||||
|
center: data.center,
|
||||||
|
radius: data.radius
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, (selectedKey) => {
|
||||||
|
// 触发selectChange事件
|
||||||
|
emit('selectChange', selectedKey)
|
||||||
|
})
|
||||||
|
// 为天地图添加geometriesData引用
|
||||||
|
if (circle) {
|
||||||
|
circle.geometriesData = geometriesData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (circle) overlays.value.push(circle)
|
||||||
|
return circle
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加多边形
|
||||||
|
const addPolygon = (paths: any[], options?: any) => {
|
||||||
|
if (!map) return null
|
||||||
|
const key = options?.key || `poly_${Date.now()}`
|
||||||
|
let poly = null
|
||||||
|
|
||||||
|
// 创建geometriesData对象
|
||||||
|
const geometriesData = { key, paths, ...options }
|
||||||
|
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
createPolygon(map, geometriesData, (selectedKey) => {
|
||||||
|
// 触发selectChange事件
|
||||||
|
emit('selectChange', selectedKey)
|
||||||
|
})
|
||||||
|
// 腾讯地图的createPolygon不返回值,创建一个包含key的对象添加到overlays
|
||||||
|
poly = { key, geometriesData }
|
||||||
|
} else {
|
||||||
|
poly = tdCreatePolygon(map, geometriesData, (data) => {
|
||||||
|
// 触发areaChange事件,确保path数据干净,不包含循环引用
|
||||||
|
emit('areaChange', {
|
||||||
|
key: data.key,
|
||||||
|
type: 'polygon',
|
||||||
|
path: {
|
||||||
|
key: data.key,
|
||||||
|
paths: data.paths.map((point: any) => ({
|
||||||
|
lat: point.lat,
|
||||||
|
lng: point.lng
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, (selectedKey) => {
|
||||||
|
// 触发selectChange事件
|
||||||
|
emit('selectChange', selectedKey)
|
||||||
|
})
|
||||||
|
// 为天地图添加geometriesData引用
|
||||||
|
if (poly) {
|
||||||
|
poly.geometriesData = geometriesData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (poly) overlays.value.push(poly)
|
||||||
|
return poly
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除覆盖物
|
||||||
|
const removeOverlay = (overlay: any) => {
|
||||||
|
if (!map || !overlay) return
|
||||||
|
const key = overlay.key || ''
|
||||||
|
mapType.value === 'tencent' ? deleteGeometry(key) : tdDeleteGeometry(map, key)
|
||||||
|
|
||||||
|
// 通过key查找并删除覆盖物
|
||||||
|
const idx = overlays.value.findIndex(item => item.key === key)
|
||||||
|
if (idx > -1) overlays.value.splice(idx, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空所有覆盖物
|
||||||
|
const clearOverlays = () => {
|
||||||
|
if (!map) return
|
||||||
|
mapType.value === 'tencent'
|
||||||
|
? overlays.value.forEach(o => deleteGeometry(o.key))
|
||||||
|
: clearAllGeometry(map)
|
||||||
|
overlays.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectGeo = (key: string) => {
|
||||||
|
mapType.value === 'tencent' ? selectGeometry(key) : tdSelectGeometry(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听选中key变化
|
||||||
|
watch(() => props.selectedKey, (newKey) => {
|
||||||
|
if (newKey) {
|
||||||
|
selectGeo(newKey)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听地图key和类型变化
|
||||||
|
watch([mapKey, mapType], ([newKey, newType]) => {
|
||||||
|
if (newKey && newType) {
|
||||||
|
initMap()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getMapConfigData()
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (map) {
|
||||||
|
try {
|
||||||
|
if (mapType.value === 'tencent') {
|
||||||
|
map.destroy && map.destroy()
|
||||||
|
} else if (mapType.value === 'tianditu') {
|
||||||
|
clearOverlays()
|
||||||
|
map.clearOverLays && map.clearOverLays()
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
map = null
|
||||||
|
marker = null
|
||||||
|
overlays.value = []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
updateLocation,
|
||||||
|
searchAddress,
|
||||||
|
addCircle,
|
||||||
|
addPolygon,
|
||||||
|
removeOverlay,
|
||||||
|
clearOverlays,
|
||||||
|
selectGeometry: selectGeo,
|
||||||
|
getMap: () => map,
|
||||||
|
getMarker: () => marker,
|
||||||
|
handleLocationChange
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
@ -54,8 +54,8 @@ const useUserStore = defineStore('user', {
|
|||||||
// 清除tabbar
|
// 清除tabbar
|
||||||
useTabbarStore().clearTab()
|
useTabbarStore().clearTab()
|
||||||
const login = '/login'
|
const login = '/login'
|
||||||
// router.push(login)
|
router.push(login)
|
||||||
location.href = `${location.origin}${login}`
|
// location.href = `${location.origin}${login}`
|
||||||
},
|
},
|
||||||
getAuthMenusFn() {
|
getAuthMenusFn() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
@ -1,2 +1 @@
|
|||||||
@import "addon/o2o/iconfont.css";
|
/* addon-iconfont.css */
|
||||||
@import "addon/tourism/iconfont.css";
|
|
||||||
|
|||||||
0
admin/src/styles/icon/addon/.gitignore
vendored
0
admin/src/styles/icon/addon/.gitignore
vendored
@ -1,38 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: "o2o"; /* Project id 4412516 */
|
|
||||||
src: url('//at.alicdn.com/t/c/font_4412516_cacqsbew46.woff2?t=1705720131974') format('woff2'),
|
|
||||||
url('//at.alicdn.com/t/c/font_4412516_cacqsbew46.woff?t=1705720131974') format('woff'),
|
|
||||||
url('//at.alicdn.com/t/c/font_4412516_cacqsbew46.ttf?t=1705720131974') format('truetype');
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o {
|
|
||||||
font-family: "o2o" !important;
|
|
||||||
font-size: 16px;
|
|
||||||
font-style: normal;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o-icon-danhanghuadong:before {
|
|
||||||
content: "\e66f";
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o-icon-yuanjiao:before {
|
|
||||||
content: "\e6c0";
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o-icon-gl-square:before {
|
|
||||||
content: "\ea92";
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o-icon-sousuo12:before {
|
|
||||||
content: "\e699";
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o-icon-sousuo11:before {
|
|
||||||
content: "\e6d4";
|
|
||||||
}
|
|
||||||
|
|
||||||
.o2o-icon-jishi:before {
|
|
||||||
content: "\e600";
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "4412516",
|
|
||||||
"name": "上门服务",
|
|
||||||
"font_family": "o2o",
|
|
||||||
"css_prefix_text": "o2o-icon-",
|
|
||||||
"description": "",
|
|
||||||
"glyphs": [
|
|
||||||
{
|
|
||||||
"icon_id": "30621139",
|
|
||||||
"name": "单行滑动",
|
|
||||||
"font_class": "danhanghuadong",
|
|
||||||
"unicode": "e66f",
|
|
||||||
"unicode_decimal": 58991
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "7149037",
|
|
||||||
"name": "圆角",
|
|
||||||
"font_class": "yuanjiao",
|
|
||||||
"unicode": "e6c0",
|
|
||||||
"unicode_decimal": 59072
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "7594344",
|
|
||||||
"name": "20gl-square",
|
|
||||||
"font_class": "gl-square",
|
|
||||||
"unicode": "ea92",
|
|
||||||
"unicode_decimal": 60050
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "10133070",
|
|
||||||
"name": "搜索",
|
|
||||||
"font_class": "sousuo12",
|
|
||||||
"unicode": "e699",
|
|
||||||
"unicode_decimal": 59033
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "14652583",
|
|
||||||
"name": "搜索",
|
|
||||||
"font_class": "sousuo11",
|
|
||||||
"unicode": "e6d4",
|
|
||||||
"unicode_decimal": 59092
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "6818781",
|
|
||||||
"name": "技师",
|
|
||||||
"font_class": "jishi",
|
|
||||||
"unicode": "e600",
|
|
||||||
"unicode_decimal": 58880
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: "tourism"; /* Project id 4137250 */
|
|
||||||
src: url('//at.alicdn.com/t/c/font_4137250_st1ha9l0k1e.woff2?t=1687685028672') format('woff2'),
|
|
||||||
url('//at.alicdn.com/t/c/font_4137250_st1ha9l0k1e.woff?t=1687685028672') format('woff'),
|
|
||||||
url('//at.alicdn.com/t/c/font_4137250_st1ha9l0k1e.ttf?t=1687685028672') format('truetype');
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism {
|
|
||||||
font-family: "tourism" !important;
|
|
||||||
font-size: 16px;
|
|
||||||
font-style: normal;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-feiji:before {
|
|
||||||
content: "\e600";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou:before {
|
|
||||||
content: "\e6a9";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyouchanpin:before {
|
|
||||||
content: "\e63b";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou1:before {
|
|
||||||
content: "\e623";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou2:before {
|
|
||||||
content: "\e601";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou3:before {
|
|
||||||
content: "\e60c";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyoubaochedingdan:before {
|
|
||||||
content: "\e612";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou4:before {
|
|
||||||
content: "\e653";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou5:before {
|
|
||||||
content: "\e610";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyouguanguang:before {
|
|
||||||
content: "\e87e";
|
|
||||||
}
|
|
||||||
|
|
||||||
.tourism-icon-lvyou6:before {
|
|
||||||
content: "\e642";
|
|
||||||
}
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "4137250",
|
|
||||||
"name": "旅游业",
|
|
||||||
"font_family": "tourism",
|
|
||||||
"css_prefix_text": "tourism-icon-",
|
|
||||||
"description": "",
|
|
||||||
"glyphs": [
|
|
||||||
{
|
|
||||||
"icon_id": "1443",
|
|
||||||
"name": "飞机",
|
|
||||||
"font_class": "feiji",
|
|
||||||
"unicode": "e600",
|
|
||||||
"unicode_decimal": 58880
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "446824",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou",
|
|
||||||
"unicode": "e6a9",
|
|
||||||
"unicode_decimal": 59049
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "1167173",
|
|
||||||
"name": "旅游产品",
|
|
||||||
"font_class": "lvyouchanpin",
|
|
||||||
"unicode": "e63b",
|
|
||||||
"unicode_decimal": 58939
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "1354920",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou1",
|
|
||||||
"unicode": "e623",
|
|
||||||
"unicode_decimal": 58915
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "1505555",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou2",
|
|
||||||
"unicode": "e601",
|
|
||||||
"unicode_decimal": 58881
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "2121726",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou3",
|
|
||||||
"unicode": "e60c",
|
|
||||||
"unicode_decimal": 58892
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "2357494",
|
|
||||||
"name": "旅游包车订单",
|
|
||||||
"font_class": "lvyoubaochedingdan",
|
|
||||||
"unicode": "e612",
|
|
||||||
"unicode_decimal": 58898
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "3944019",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou4",
|
|
||||||
"unicode": "e653",
|
|
||||||
"unicode_decimal": 58963
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "4838220",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou5",
|
|
||||||
"unicode": "e610",
|
|
||||||
"unicode_decimal": 58896
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "7444178",
|
|
||||||
"name": "旅游观光",
|
|
||||||
"font_class": "lvyouguanguang",
|
|
||||||
"unicode": "e87e",
|
|
||||||
"unicode_decimal": 59518
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"icon_id": "9748082",
|
|
||||||
"name": "旅游",
|
|
||||||
"font_class": "lvyou6",
|
|
||||||
"unicode": "e642",
|
|
||||||
"unicode_decimal": 58946
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -4,8 +4,11 @@ const geometry: any = {}
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 在地图上创建一个圆形
|
* 在地图上创建一个圆形
|
||||||
|
* @param map 地图实例
|
||||||
|
* @param geometriesData 圆形数据
|
||||||
|
* @param onSelect 图形被选中时的回调函数
|
||||||
*/
|
*/
|
||||||
export const createCircle = (map: any, geometriesData: any) => {
|
export const createCircle = (map: any, geometriesData: any, onSelect?: (key: string) => void) => {
|
||||||
const TMap = (window as any).TMap
|
const TMap = (window as any).TMap
|
||||||
const LatLng = TMap.LatLng
|
const LatLng = TMap.LatLng
|
||||||
|
|
||||||
@ -27,7 +30,11 @@ export const createCircle = (map: any, geometriesData: any) => {
|
|||||||
showBorder: true,
|
showBorder: true,
|
||||||
borderColor: `rgb(${color.toString()})`,
|
borderColor: `rgb(${color.toString()})`,
|
||||||
borderWidth: 2
|
borderWidth: 2
|
||||||
|
}),
|
||||||
|
highlight: new TMap.PolygonStyle({
|
||||||
|
color: 'rgba(255, 255, 0, 0.6)'
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
geometries: [
|
geometries: [
|
||||||
{
|
{
|
||||||
@ -38,25 +45,84 @@ export const createCircle = (map: any, geometriesData: any) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
geometry[geometriesData.key] = { graphical: multiCircle }
|
|
||||||
|
|
||||||
// 创建图形编辑器
|
// 如果已存在该图形,先删除
|
||||||
const editor = new TMap.tools.GeometryEditor({
|
if (geometry[geometriesData.key]) {
|
||||||
|
try {
|
||||||
|
geometry[geometriesData.key].graphical.remove(geometriesData.key)
|
||||||
|
geometry[geometriesData.key].editor?.delete()
|
||||||
|
} catch (e) {
|
||||||
|
// 删除旧图形失败
|
||||||
|
// console.warn('删除旧图形失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let editor = null
|
||||||
|
// 检查 TMap.tools 是否存在
|
||||||
|
if (TMap.tools) {
|
||||||
|
// 创建图形编辑器 - 支持拖动中心点和调整半径
|
||||||
|
try {
|
||||||
|
editor = new TMap.tools.GeometryEditor({
|
||||||
map: map,
|
map: map,
|
||||||
overlayList: [
|
overlayList: [
|
||||||
{
|
{
|
||||||
overlay: multiCircle,
|
overlay: multiCircle,
|
||||||
id: geometriesData.key,
|
id: geometriesData.key,
|
||||||
|
selectedStyleId: 'highlight'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
actionMode: TMap.tools.constants.EDITOR_ACTION.INTERACT,
|
actionMode: TMap.tools.constants?.EDITOR_ACTION?.INTERACT || 0, // 交互模式,支持拖动中心点和调整半径
|
||||||
activeOverlayId: geometriesData.key, // 激活图层
|
activeOverlayId: null, // 初始不激活,等待用户选择
|
||||||
selectable: true // 开启点选功能
|
selectable: true ,// 开启点选功能
|
||||||
|
snappable: true // 开启吸附
|
||||||
|
})
|
||||||
|
editor.setKeyboardDeleteEnable(false);
|
||||||
|
|
||||||
|
// 监听调整开始事件 - 禁用地图拖拽
|
||||||
|
editor.on('adjust_start', () => {
|
||||||
|
currentMap?.setDraggable(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 监听调整完成事件
|
||||||
editor.on('adjust_complete', (data: any) => {
|
editor.on('adjust_complete', (data: any) => {
|
||||||
|
if (data?.center && data.radius !== undefined) {
|
||||||
geometriesData.center = { lat: data.center.lat, lng: data.center.lng }
|
geometriesData.center = { lat: data.center.lat, lng: data.center.lng }
|
||||||
geometriesData.radius = parseInt(data.radius)
|
geometriesData.radius = parseInt(data.radius)
|
||||||
|
}
|
||||||
|
setTimeout(() => currentMap?.setDraggable(true), 100)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听调整中事件(实时更新)
|
||||||
|
editor.on('adjust', (data: any) => {
|
||||||
|
if (data?.center && data.radius !== undefined) {
|
||||||
|
geometriesData.center = { lat: data.center.lat, lng: data.center.lng }
|
||||||
|
geometriesData.radius = parseInt(data.radius)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听选中事件
|
||||||
|
editor.on('select', () => {
|
||||||
|
// 只有在用户点击地图上的图形时才触发,而不是在切换页面时
|
||||||
|
if (onSelect) {
|
||||||
|
onSelect(geometriesData.key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('创建编辑器失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为圆形添加点击事件监听器
|
||||||
|
multiCircle.on('click', () => {
|
||||||
|
// 先选中当前图形,使其高亮显示
|
||||||
|
if (editor) {
|
||||||
|
editor.select([geometriesData.key])
|
||||||
|
editor.setActiveOverlay?.(geometriesData.key)
|
||||||
|
}
|
||||||
|
// 然后触发选中回调
|
||||||
|
if (onSelect) {
|
||||||
|
onSelect(geometriesData.key)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
geometry[geometriesData.key] = { graphical: multiCircle, editor }
|
geometry[geometriesData.key] = { graphical: multiCircle, editor }
|
||||||
@ -64,10 +130,11 @@ export const createCircle = (map: any, geometriesData: any) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 在地图上创建一个多边形
|
* 在地图上创建一个多边形
|
||||||
* @param map
|
* @param map 地图实例
|
||||||
* @param geometriesData
|
* @param geometriesData 多边形数据
|
||||||
|
* @param onSelect 图形被选中时的回调函数
|
||||||
*/
|
*/
|
||||||
export const createPolygon = (map: any, geometriesData: any) => {
|
export const createPolygon = (map: any, geometriesData: any, onSelect?: (key: string) => void) => {
|
||||||
const TMap = (window as any).TMap
|
const TMap = (window as any).TMap
|
||||||
const LatLng = TMap.LatLng
|
const LatLng = TMap.LatLng
|
||||||
|
|
||||||
@ -86,6 +153,17 @@ export const createPolygon = (map: any, geometriesData: any) => {
|
|||||||
Math.floor(Math.random() * 255)
|
Math.floor(Math.random() * 255)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// 如果已存在该图形,先删除
|
||||||
|
if (geometry[geometriesData.key]) {
|
||||||
|
try {
|
||||||
|
geometry[geometriesData.key].graphical.remove(geometriesData.key)
|
||||||
|
geometry[geometriesData.key].editor?.delete()
|
||||||
|
} catch (e) {
|
||||||
|
// 删除旧多边形失败
|
||||||
|
// console.warn('删除旧多边形失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const multiPolygon = new TMap.MultiPolygon({
|
const multiPolygon = new TMap.MultiPolygon({
|
||||||
map: map,
|
map: map,
|
||||||
styles: {
|
styles: {
|
||||||
@ -94,6 +172,9 @@ export const createPolygon = (map: any, geometriesData: any) => {
|
|||||||
showBorder: true,
|
showBorder: true,
|
||||||
borderColor: `rgb(${color.toString()})`,
|
borderColor: `rgb(${color.toString()})`,
|
||||||
borderWidth: 2
|
borderWidth: 2
|
||||||
|
}),
|
||||||
|
highlight: new TMap.PolygonStyle({
|
||||||
|
color: 'rgba(255, 255, 0, 0.6)'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
geometries: [
|
geometries: [
|
||||||
@ -107,23 +188,70 @@ export const createPolygon = (map: any, geometriesData: any) => {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const editor = new TMap.tools.GeometryEditor({
|
let editor = null
|
||||||
|
// 检查 TMap.tools 是否存在
|
||||||
|
if (TMap.tools) {
|
||||||
|
// 创建图形编辑器 - 支持拖动边框和调整形状
|
||||||
|
try {
|
||||||
|
editor = new TMap.tools.GeometryEditor({
|
||||||
map: map,
|
map: map,
|
||||||
overlayList: [
|
overlayList: [
|
||||||
{
|
{
|
||||||
overlay: multiPolygon,
|
overlay: multiPolygon,
|
||||||
id: geometriesData.key,
|
id: geometriesData.key,
|
||||||
|
selectedStyleId: 'highlight'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
actionMode: TMap.tools.constants.EDITOR_ACTION.INTERACT,
|
actionMode: TMap.tools.constants?.EDITOR_ACTION?.INTERACT || 0, // 交互模式,支持拖动边框和调整形状
|
||||||
activeOverlayId: geometriesData.key, // 激活图层
|
activeOverlayId: null, // 初始不激活,等待用户选择
|
||||||
selectable: true, // 开启点选功能
|
selectable: true, // 开启点选功能
|
||||||
|
snappable: true // 开启吸附
|
||||||
})
|
})
|
||||||
|
|
||||||
editor.on('adjust_complete', (data: any) => {
|
editor.setKeyboardDeleteEnable(false);
|
||||||
geometriesData.paths = data.paths.map(item => {
|
// 监听调整开始事件 - 禁用地图拖拽
|
||||||
return { lat: item.lat, lng: item.lng}
|
editor.on('adjust_start', () => {
|
||||||
|
currentMap?.setDraggable(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 监听调整完成事件
|
||||||
|
editor.on('adjust_complete', (data: any) => {
|
||||||
|
if (data?.paths) {
|
||||||
|
geometriesData.paths = data.paths.map((item: any) => ({ lat: item.lat, lng: item.lng }))
|
||||||
|
}
|
||||||
|
setTimeout(() => currentMap?.setDraggable(true), 100)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听调整中事件(实时更新)
|
||||||
|
editor.on('adjust', (data: any) => {
|
||||||
|
if (data?.paths) {
|
||||||
|
geometriesData.paths = data.paths.map((item: any) => ({ lat: item.lat, lng: item.lng }))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听选中事件
|
||||||
|
editor.on('select', () => {
|
||||||
|
// 只有在用户点击地图上的图形时才触发,而不是在切换页面时
|
||||||
|
if (onSelect) {
|
||||||
|
onSelect(geometriesData.key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('创建编辑器失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为多边形添加点击事件监听器
|
||||||
|
multiPolygon.on('click', () => {
|
||||||
|
// 先选中当前图形,使其高亮显示
|
||||||
|
if (editor) {
|
||||||
|
editor.select([geometriesData.key])
|
||||||
|
editor.setActiveOverlay?.(geometriesData.key)
|
||||||
|
}
|
||||||
|
// 然后触发选中回调
|
||||||
|
if (onSelect) {
|
||||||
|
onSelect(geometriesData.key)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
geometry[geometriesData.key] = { graphical: multiPolygon, editor }
|
geometry[geometriesData.key] = { graphical: multiPolygon, editor }
|
||||||
@ -131,25 +259,68 @@ export const createPolygon = (map: any, geometriesData: any) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除图形
|
* 删除图形
|
||||||
* @param key
|
|
||||||
*/
|
*/
|
||||||
export const deleteGeometry = (key: string) => {
|
export const deleteGeometry = (key: string) => {
|
||||||
if (!geometry[key]) {
|
if (!geometry[key]) return
|
||||||
return
|
try {
|
||||||
|
geometry[key].graphical?.remove(key)
|
||||||
|
geometry[key].editor?.delete()
|
||||||
|
delete geometry[key]
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('删除图形失败:', e)
|
||||||
}
|
}
|
||||||
geometry[key].graphical.remove(key)
|
}
|
||||||
geometry[key].editor.delete()
|
|
||||||
|
/**
|
||||||
|
* 清空所有图形
|
||||||
|
*/
|
||||||
|
export const clearAllGeometry = () => {
|
||||||
|
Object.keys(geometry).forEach(deleteGeometry)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存地图引用,用于控制地图拖拽
|
||||||
|
let currentMap: any = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置地图引用
|
||||||
|
* @param map 地图实例
|
||||||
|
*/
|
||||||
|
export const setMapInstance = (map: any) => {
|
||||||
|
currentMap = map
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选中图形
|
* 选中图形
|
||||||
* @param key
|
|
||||||
*/
|
*/
|
||||||
export const selectGeometry = (key: string) => {
|
export const selectGeometry = (key: string) => {
|
||||||
if (!geometry[key] || !geometry[key].editor) {
|
if (!geometry[key]?.editor) return
|
||||||
return
|
|
||||||
|
try {
|
||||||
|
// 取消其他图形的选中状态
|
||||||
|
Object.keys(geometry).forEach(k => {
|
||||||
|
if (k !== key && geometry[k]?.editor) {
|
||||||
|
geometry[k].editor.deselect?.()
|
||||||
|
geometry[k].editor.setActiveOverlay?.(null)
|
||||||
}
|
}
|
||||||
geometry[key].editor.select([key])
|
})
|
||||||
|
// 选中当前图形
|
||||||
|
geometry[key].editor.select?.([key])
|
||||||
|
geometry[key].editor.setActiveOverlay?.(key)
|
||||||
|
} catch (e) {
|
||||||
|
// 删除图形失败
|
||||||
|
// console.error('选中图形失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消选中所有图形
|
||||||
|
*/
|
||||||
|
export const deselectAllGeometry = () => {
|
||||||
|
Object.keys(geometry).forEach(k => {
|
||||||
|
geometry[k]?.editor?.deselect?.()
|
||||||
|
geometry[k]?.editor?.setActiveOverlay?.(null)
|
||||||
|
})
|
||||||
|
currentMap?.setDraggable(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
511
admin/src/utils/tianditu.ts
Normal file
511
admin/src/utils/tianditu.ts
Normal file
@ -0,0 +1,511 @@
|
|||||||
|
const geometry: any = {}
|
||||||
|
|
||||||
|
// 保存地图引用,用于控制地图拖拽
|
||||||
|
let currentMap: any = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置地图引用
|
||||||
|
* @param map 地图实例
|
||||||
|
*/
|
||||||
|
export const setMapInstance = (map: any) => {
|
||||||
|
currentMap = map
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在天地图上创建一个圆形
|
||||||
|
* @param map 天地图实例
|
||||||
|
* @param geometriesData 圆形数据
|
||||||
|
* @param onChange 图形变化时的回调函数
|
||||||
|
* @param onSelect 图形被选中时的回调函数
|
||||||
|
*/
|
||||||
|
export const createCircle = (map: any, geometriesData: any, onChange?: (data: any) => void, onSelect?: (key: string) => void) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) return null
|
||||||
|
|
||||||
|
geometriesData.radius = geometriesData.radius ?? 1000
|
||||||
|
geometriesData.center = geometriesData.center ?? { lat: map.getCenter().lat, lng: map.getCenter().lng }
|
||||||
|
|
||||||
|
const color = [
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255)
|
||||||
|
]
|
||||||
|
// 保存原始样式
|
||||||
|
const originalStyle = {
|
||||||
|
color: geometriesData.color || `rgba(${color.toString()}, .4)`,
|
||||||
|
weight: geometriesData.weight || 3,
|
||||||
|
opacity: geometriesData.opacity || 0.8,
|
||||||
|
fillColor: geometriesData.fillColor || `rgba(${color.toString()}, .4)`,
|
||||||
|
fillOpacity: geometriesData.fillOpacity || 0.3
|
||||||
|
}
|
||||||
|
const circle = new T.Circle(new T.LngLat(geometriesData.center.lng, geometriesData.center.lat), geometriesData.radius, originalStyle)
|
||||||
|
|
||||||
|
// 如果已存在该图形,先删除
|
||||||
|
if (geometry[geometriesData.key]) {
|
||||||
|
try {
|
||||||
|
if (geometry[geometriesData.key].editTimer) {
|
||||||
|
clearTimeout(geometry[geometriesData.key].editTimer)
|
||||||
|
}
|
||||||
|
map.removeOverLay(geometry[geometriesData.key].graphical)
|
||||||
|
} catch (e) {
|
||||||
|
// 删除旧图形失败
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map.addOverLay(circle)
|
||||||
|
|
||||||
|
// 保存几何数据的引用,确保在事件监听器中可用
|
||||||
|
const circleData = { ...geometriesData }
|
||||||
|
|
||||||
|
// 保存上一次的中心点和半径
|
||||||
|
let preCenter = { ...circleData.center }
|
||||||
|
let preRadius = circleData.radius
|
||||||
|
|
||||||
|
// 监听地图触摸结束事件,检测圆形变化
|
||||||
|
const handleTouchEnd = () => {
|
||||||
|
if (!circle.isEditable()) return
|
||||||
|
|
||||||
|
if (geometry[circleData.key]?.editTimer) {
|
||||||
|
clearTimeout(geometry[circleData.key].editTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
geometry[circleData.key].editTimer = setTimeout(() => {
|
||||||
|
const curCenter = circle.getCenter()
|
||||||
|
const curRadius = circle.getRadius()
|
||||||
|
|
||||||
|
// 中心点改变了
|
||||||
|
if (curCenter.lng !== preCenter.lng || curCenter.lat !== preCenter.lat) {
|
||||||
|
circleData.center = { lat: curCenter.lat, lng: curCenter.lng }
|
||||||
|
preCenter = { ...circleData.center }
|
||||||
|
// console.log('圆形中心点改变了', circleData.center)
|
||||||
|
// 调用回调函数
|
||||||
|
if (onChange) {
|
||||||
|
onChange(circleData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 半径改变了
|
||||||
|
if (curRadius !== preRadius) {
|
||||||
|
circleData.radius = curRadius
|
||||||
|
preRadius = curRadius
|
||||||
|
// console.log('圆形半径改变了', curRadius)
|
||||||
|
// 调用回调函数
|
||||||
|
if (onChange) {
|
||||||
|
onChange(circleData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听圆形点击事件
|
||||||
|
const handleClick = () => {
|
||||||
|
// 调用选择回调函数
|
||||||
|
if (onSelect) {
|
||||||
|
onSelect(circleData.key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始时不启用编辑功能,只有在选中时才启用
|
||||||
|
// circle.enableEdit()
|
||||||
|
|
||||||
|
// 添加事件监听
|
||||||
|
map.addEventListener('touchend', handleTouchEnd)
|
||||||
|
map.addEventListener('mouseup', handleTouchEnd)
|
||||||
|
circle.addEventListener('click', handleClick)
|
||||||
|
|
||||||
|
geometry[circleData.key] = { graphical: circle, handleTouchEnd, handleClick, originalStyle }
|
||||||
|
return circle
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在天地图上创建一个矩形
|
||||||
|
* @param map 天地图实例
|
||||||
|
* @param geometriesData 矩形数据
|
||||||
|
*/
|
||||||
|
export const createRectangle = (map: any, geometriesData: any) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) return null
|
||||||
|
|
||||||
|
const { lat, lng } = map.getCenter()
|
||||||
|
|
||||||
|
geometriesData.bounds = geometriesData.bounds ?? {
|
||||||
|
southwest: { lat: lat - 0.005, lng: lng - 0.005 },
|
||||||
|
northeast: { lat: lat + 0.005, lng: lng + 0.005 }
|
||||||
|
}
|
||||||
|
|
||||||
|
const lngLats = [
|
||||||
|
new T.LngLat(geometriesData.bounds.southwest.lng, geometriesData.bounds.southwest.lat),
|
||||||
|
new T.LngLat(geometriesData.bounds.northeast.lng, geometriesData.bounds.southwest.lat),
|
||||||
|
new T.LngLat(geometriesData.bounds.northeast.lng, geometriesData.bounds.northeast.lat),
|
||||||
|
new T.LngLat(geometriesData.bounds.southwest.lng, geometriesData.bounds.northeast.lat)
|
||||||
|
]
|
||||||
|
const color = [
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255)
|
||||||
|
]
|
||||||
|
|
||||||
|
const rectangle = new T.Polygon(lngLats, {
|
||||||
|
color: geometriesData.color || `rgba(${color.toString()}, .4)`,
|
||||||
|
weight: geometriesData.weight || 3,
|
||||||
|
opacity: geometriesData.opacity || 0.8,
|
||||||
|
fillColor: geometriesData.fillColor || `rgba(${color.toString()}, .4)`,
|
||||||
|
fillOpacity: geometriesData.fillOpacity || 0.3
|
||||||
|
})
|
||||||
|
|
||||||
|
map.addOverLay(rectangle)
|
||||||
|
geometry[geometriesData.key] = { graphical: rectangle }
|
||||||
|
return rectangle
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在天地图上创建一个多边形
|
||||||
|
* @param map 天地图实例
|
||||||
|
* @param geometriesData 多边形数据
|
||||||
|
* @param onChange 图形变化时的回调函数
|
||||||
|
* @param onSelect 图形被选中时的回调函数
|
||||||
|
*/
|
||||||
|
export const createPolygon = (map: any, geometriesData: any, onChange?: (data: any) => void, onSelect?: (key: string) => void) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) return null
|
||||||
|
|
||||||
|
const { lat, lng } = map.getCenter()
|
||||||
|
|
||||||
|
geometriesData.paths = geometriesData.paths ?? [
|
||||||
|
{ lat: lat + 0.01, lng: lng + 0.01 },
|
||||||
|
{ lat: lat - 0.01, lng: lng + 0.01 },
|
||||||
|
{ lat: lat - 0.01, lng: lng - 0.01 },
|
||||||
|
{ lat: lat + 0.01, lng: lng - 0.01 }
|
||||||
|
]
|
||||||
|
|
||||||
|
const lngLats = geometriesData.paths.map((item: any) => new T.LngLat(item.lng, item.lat))
|
||||||
|
const color = [
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255)
|
||||||
|
]
|
||||||
|
// 保存原始样式
|
||||||
|
const originalStyle = {
|
||||||
|
color: geometriesData.color || `rgba(${color.toString()}, .4)`,
|
||||||
|
weight: geometriesData.weight || 3,
|
||||||
|
opacity: geometriesData.opacity || 0.8,
|
||||||
|
fillColor: geometriesData.fillColor || `rgba(${color.toString()}, .4)`,
|
||||||
|
fillOpacity: geometriesData.fillOpacity || 0.3
|
||||||
|
}
|
||||||
|
const polygon = new T.Polygon(lngLats, originalStyle)
|
||||||
|
|
||||||
|
// 如果已存在该图形,先删除
|
||||||
|
if (geometry[geometriesData.key]) {
|
||||||
|
try {
|
||||||
|
if (geometry[geometriesData.key].editTimer) {
|
||||||
|
clearTimeout(geometry[geometriesData.key].editTimer)
|
||||||
|
}
|
||||||
|
map.removeOverLay(geometry[geometriesData.key].graphical)
|
||||||
|
} catch (e) {
|
||||||
|
// 删除旧图形失败
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map.addOverLay(polygon)
|
||||||
|
|
||||||
|
// 保存上一次的路径
|
||||||
|
let prePaths = JSON.parse(JSON.stringify(geometriesData.paths))
|
||||||
|
|
||||||
|
// 保存几何数据的引用,确保在事件监听器中可用
|
||||||
|
const polygonData = { ...geometriesData }
|
||||||
|
|
||||||
|
// 监听地图触摸结束事件,检测多边形变化
|
||||||
|
const handleTouchEnd = () => {
|
||||||
|
if (!polygon.isEditable()) return
|
||||||
|
|
||||||
|
if (geometry[polygonData.key]?.editTimer) {
|
||||||
|
clearTimeout(geometry[polygonData.key].editTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
geometry[polygonData.key].editTimer = setTimeout(() => {
|
||||||
|
try {
|
||||||
|
const curLngLats = polygon.getLngLats()
|
||||||
|
|
||||||
|
// 确保 curLngLats 是数组
|
||||||
|
if (Array.isArray(curLngLats)) {
|
||||||
|
// 检查 curLngLats[0] 是否是数组(多边形可能返回嵌套数组)
|
||||||
|
let pathsArray = curLngLats
|
||||||
|
if (Array.isArray(curLngLats[0])) {
|
||||||
|
pathsArray = curLngLats[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
const curPaths = pathsArray.map((lngLat: any) => {
|
||||||
|
// 检查 lngLat 是否是数组 [lng, lat]
|
||||||
|
if (Array.isArray(lngLat)) {
|
||||||
|
return {
|
||||||
|
lat: lngLat[1],
|
||||||
|
lng: lngLat[0]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 否则,假设是对象 { lat, lng }
|
||||||
|
return {
|
||||||
|
lat: lngLat.lat,
|
||||||
|
lng: lngLat.lng
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 检查路径是否改变
|
||||||
|
const pathsChanged = JSON.stringify(curPaths) !== JSON.stringify(prePaths)
|
||||||
|
|
||||||
|
if (pathsChanged) {
|
||||||
|
polygonData.paths = curPaths
|
||||||
|
prePaths = JSON.parse(JSON.stringify(polygonData.paths))
|
||||||
|
// 调用回调函数
|
||||||
|
if (onChange) {
|
||||||
|
onChange(polygonData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('curLngLats 不是数组:', curLngLats)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取多边形路径失败:', error)
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听多边形点击事件
|
||||||
|
const handleClick = () => {
|
||||||
|
// 调用选择回调函数
|
||||||
|
if (onSelect) {
|
||||||
|
onSelect(polygonData.key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始时不启用编辑功能,只有在选中时才启用
|
||||||
|
// polygon.enableEdit()
|
||||||
|
|
||||||
|
// 添加事件监听
|
||||||
|
map.addEventListener('touchend', handleTouchEnd)
|
||||||
|
map.addEventListener('mouseup', handleTouchEnd)
|
||||||
|
polygon.addEventListener('click', handleClick)
|
||||||
|
|
||||||
|
geometry[polygonData.key] = { graphical: polygon, handleTouchEnd, handleClick, originalStyle }
|
||||||
|
return polygon
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除图形
|
||||||
|
* @param map 地图实例
|
||||||
|
* @param key 图形key
|
||||||
|
*/
|
||||||
|
export const deleteGeometry = (map: any, key: string) => {
|
||||||
|
if (!geometry[key]) return
|
||||||
|
try {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (T && geometry[key].graphical) {
|
||||||
|
// 清除定时器
|
||||||
|
if (geometry[key].editTimer) {
|
||||||
|
clearTimeout(geometry[key].editTimer)
|
||||||
|
}
|
||||||
|
// 移除事件监听器
|
||||||
|
if (geometry[key].handleTouchEnd) {
|
||||||
|
map.removeEventListener('touchend', geometry[key].handleTouchEnd)
|
||||||
|
map.removeEventListener('mouseup', geometry[key].handleTouchEnd)
|
||||||
|
}
|
||||||
|
// 移除点击事件监听器
|
||||||
|
if (geometry[key].handleClick) {
|
||||||
|
geometry[key].graphical.removeEventListener('click', geometry[key].handleClick)
|
||||||
|
}
|
||||||
|
// 移除覆盖物
|
||||||
|
map.removeOverLay(geometry[key].graphical)
|
||||||
|
}
|
||||||
|
delete geometry[key]
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('删除图形失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空所有图形
|
||||||
|
* @param map 地图实例
|
||||||
|
*/
|
||||||
|
export const clearAllGeometry = (map: any) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (T) {
|
||||||
|
// 先清除所有图形的事件监听器和定时器
|
||||||
|
Object.keys(geometry).forEach(key => {
|
||||||
|
if (geometry[key].editTimer) {
|
||||||
|
clearTimeout(geometry[key].editTimer)
|
||||||
|
}
|
||||||
|
if (geometry[key].handleTouchEnd) {
|
||||||
|
map.removeEventListener('touchend', geometry[key].handleTouchEnd)
|
||||||
|
map.removeEventListener('mouseup', geometry[key].handleTouchEnd)
|
||||||
|
}
|
||||||
|
if (geometry[key].handleClick) {
|
||||||
|
geometry[key].graphical.removeEventListener('click', geometry[key].handleClick)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 一次性清空地图上的所有覆盖物
|
||||||
|
map.clearOverLays()
|
||||||
|
}
|
||||||
|
// 清空几何对象存储
|
||||||
|
Object.keys(geometry).forEach(key => delete geometry[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选中图形
|
||||||
|
* @param key 图形key
|
||||||
|
*/
|
||||||
|
export const selectGeometry = (key: string) => {
|
||||||
|
if (!geometry[key]?.graphical) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 先取消所有图形的选中状态
|
||||||
|
deselectAllGeometry()
|
||||||
|
|
||||||
|
// 设置选中状态
|
||||||
|
geometry[key].graphical.setSelected?.(true)
|
||||||
|
|
||||||
|
// 启用当前图形的编辑功能
|
||||||
|
geometry[key].graphical.enableEdit()
|
||||||
|
|
||||||
|
const color = [
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255),
|
||||||
|
Math.floor(Math.random() * 255)
|
||||||
|
]
|
||||||
|
|
||||||
|
// 修改样式,使其显示为选中状态
|
||||||
|
geometry[key].graphical.setStyle({
|
||||||
|
color: '#1890ff', // 选中时的边框颜色
|
||||||
|
weight: 2, // 选中时的边框宽度
|
||||||
|
opacity: 1, // 选中时的边框透明度
|
||||||
|
fillColor: `rgba(${color.toString()}, .6)`, // 选中时的填充颜色
|
||||||
|
fillOpacity: 1// 选中时的填充透明度
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.error('选中图形失败:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消选中所有图形
|
||||||
|
*/
|
||||||
|
export const deselectAllGeometry = () => {
|
||||||
|
Object.keys(geometry).forEach(key => {
|
||||||
|
try {
|
||||||
|
// 取消选中状态
|
||||||
|
geometry[key]?.graphical?.setSelected?.(false)
|
||||||
|
|
||||||
|
// 禁用编辑功能
|
||||||
|
geometry[key]?.graphical?.disableEdit?.()
|
||||||
|
|
||||||
|
// 恢复原始样式
|
||||||
|
if (geometry[key]?.originalStyle) {
|
||||||
|
geometry[key].graphical.setStyle(geometry[key].originalStyle)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('取消选中图形失败:', e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建点标记
|
||||||
|
* @param map 天地图实例
|
||||||
|
* @returns 标记实例
|
||||||
|
*/
|
||||||
|
export const createMarker = (map: any) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) return null
|
||||||
|
|
||||||
|
const { lat, lng } = map.getCenter()
|
||||||
|
const marker = new T.Marker(new T.LngLat(lng, lat))
|
||||||
|
map.addOverLay(marker)
|
||||||
|
return marker
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逆地址解析
|
||||||
|
* @param params 参数 { mapKey, lat, lng }
|
||||||
|
* @returns Promise
|
||||||
|
*/
|
||||||
|
export const latLngToAddress = (params: any) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) {
|
||||||
|
reject(new Error('天地图服务未加载'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const geocoder = new T.Geocoder()
|
||||||
|
const lngLat = new T.LngLat(params.lng, params.lat)
|
||||||
|
|
||||||
|
geocoder.getLocation(lngLat, (result: any) => {
|
||||||
|
if (result && result.status === '0') {
|
||||||
|
const addrComp = result.addressComponent || {}
|
||||||
|
let detailAddress = ''
|
||||||
|
|
||||||
|
if (result.formattedAddress) {
|
||||||
|
detailAddress = result.formattedAddress
|
||||||
|
} else if (result.address) {
|
||||||
|
detailAddress = result.address
|
||||||
|
} else {
|
||||||
|
const parts = []
|
||||||
|
if (addrComp.road) parts.push(addrComp.road)
|
||||||
|
if (addrComp.address) parts.push(addrComp.address)
|
||||||
|
if (addrComp.poi) parts.push(addrComp.poi)
|
||||||
|
detailAddress = parts.join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
const addressData = {
|
||||||
|
location: { lat: params.lat, lng: params.lng },
|
||||||
|
address: addrComp ?
|
||||||
|
`${ addrComp.province || '' }${ addrComp.city || '' }${ addrComp.county || '' }` : '',
|
||||||
|
formatted_addresses: {
|
||||||
|
recommend: detailAddress
|
||||||
|
},
|
||||||
|
address_component: {
|
||||||
|
province: addrComp.province || '',
|
||||||
|
city: addrComp.city || '',
|
||||||
|
district: addrComp.county || '',
|
||||||
|
street: addrComp.road || '',
|
||||||
|
street_number: addrComp.address || ''
|
||||||
|
},
|
||||||
|
addressComponent: addrComp,
|
||||||
|
formatted_address: detailAddress
|
||||||
|
}
|
||||||
|
resolve(addressData)
|
||||||
|
} else {
|
||||||
|
reject(new Error(result?.msg || '地址解析失败'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地址解析
|
||||||
|
* @param params 参数 { mapKey, address }
|
||||||
|
* @returns Promise
|
||||||
|
*/
|
||||||
|
export const addressToLatLng = (params: any) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const T = (window as any).T
|
||||||
|
if (!T) {
|
||||||
|
reject(new Error('天地图服务未加载'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const geocoder = new T.Geocoder()
|
||||||
|
geocoder.getPoint(params.address, (result: any) => {
|
||||||
|
if (result && result.status === '0' && result.location) {
|
||||||
|
const lat = result.location.lat
|
||||||
|
const lng = result.location.lon || result.location.lng
|
||||||
|
if (lat && lng) {
|
||||||
|
resolve({ lat, lng })
|
||||||
|
} else {
|
||||||
|
reject(new Error('坐标解析失败'))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(new Error(result?.msg || '未找到该地址'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user