-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(platform): 支持扫码创建时自定义机器人ID #9067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,17 @@ | |
| v-if="larkCreationMode === 'scan'" | ||
| class="registration-inline mt-3" | ||
| > | ||
| <v-text-field | ||
| :model-value="selectedPlatformConfig.id || ''" | ||
| :label="tm('registrationAction.platformIdLabel')" | ||
| :error="Boolean(scanPlatformIdError)" | ||
| :error-messages="scanPlatformIdError" | ||
| variant="outlined" | ||
| density="compact" | ||
| hide-details="auto" | ||
| class="registration-platform-id-field" | ||
| @update:model-value="setScanPlatformId" | ||
| /> | ||
| <PlatformRegistrationAction | ||
| :platform-config="selectedPlatformConfig" | ||
| :active="larkCreationMode === 'scan'" | ||
|
|
@@ -139,6 +150,17 @@ | |
| v-if="dingtalkCreationMode === 'scan'" | ||
| class="registration-inline mt-3" | ||
| > | ||
| <v-text-field | ||
| :model-value="selectedPlatformConfig.id || ''" | ||
| :label="tm('registrationAction.platformIdLabel')" | ||
| :error="Boolean(scanPlatformIdError)" | ||
| :error-messages="scanPlatformIdError" | ||
| variant="outlined" | ||
| density="compact" | ||
| hide-details="auto" | ||
| class="registration-platform-id-field" | ||
| @update:model-value="setScanPlatformId" | ||
| /> | ||
| <PlatformRegistrationAction | ||
| :platform-config="selectedPlatformConfig" | ||
| :active="dingtalkCreationMode === 'scan'" | ||
|
|
@@ -194,6 +216,17 @@ | |
| v-if="qqOfficialCreationMode === 'scan'" | ||
| class="registration-inline mt-3" | ||
| > | ||
| <v-text-field | ||
| :model-value="selectedPlatformConfig.id || ''" | ||
| :label="tm('registrationAction.platformIdLabel')" | ||
| :error="Boolean(scanPlatformIdError)" | ||
| :error-messages="scanPlatformIdError" | ||
| variant="outlined" | ||
| density="compact" | ||
| hide-details="auto" | ||
| class="registration-platform-id-field" | ||
| @update:model-value="setScanPlatformId" | ||
| /> | ||
| <PlatformRegistrationAction | ||
| :platform-config="selectedPlatformConfig" | ||
| :active="qqOfficialCreationMode === 'scan'" | ||
|
|
@@ -230,6 +263,17 @@ | |
| v-else-if="isWeixinOcPlatform" | ||
| class="weixin-oc-registration-inline mt-4" | ||
| > | ||
| <v-text-field | ||
| :model-value="selectedPlatformConfig.id || ''" | ||
| :label="tm('registrationAction.platformIdLabel')" | ||
| :error="Boolean(scanPlatformIdError)" | ||
| :error-messages="scanPlatformIdError" | ||
| variant="outlined" | ||
| density="compact" | ||
| hide-details="auto" | ||
| class="registration-platform-id-field" | ||
| @update:model-value="setScanPlatformId" | ||
| /> | ||
| <PlatformRegistrationAction | ||
| :platform-config="selectedPlatformConfig" | ||
| :active="isWeixinOcPlatform" | ||
|
|
@@ -834,6 +878,7 @@ export default { | |
| larkCreationMode: "", | ||
| dingtalkCreationMode: "", | ||
| qqOfficialCreationMode: "", | ||
| scanPlatformIdCustomized: false, | ||
|
|
||
| aBConfigRadioVal: "0", | ||
| selectedAbConfId: "default", | ||
|
|
@@ -1049,6 +1094,16 @@ export default { | |
| this.selectedPlatformConfig?.type, | ||
| ); | ||
| }, | ||
| scanPlatformIdError() { | ||
| const platformId = String(this.selectedPlatformConfig?.id || ""); | ||
| if (!platformId) { | ||
| return this.tm("registrationAction.platformIdRequired"); | ||
| } | ||
| if (/[!:\s]/.test(platformId)) { | ||
| return this.tm("registrationAction.platformIdInvalid"); | ||
| } | ||
| return ""; | ||
| }, | ||
|
Comment on lines
+1097
to
+1106
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 建议复用已有的 |
||
| }, | ||
| watch: { | ||
| selectedPlatformType(newType) { | ||
|
|
@@ -1059,11 +1114,13 @@ export default { | |
| this.larkCreationMode = ""; | ||
| this.dingtalkCreationMode = ""; | ||
| this.qqOfficialCreationMode = ""; | ||
| this.scanPlatformIdCustomized = false; | ||
| } else { | ||
| this.selectedPlatformConfig = null; | ||
| this.larkCreationMode = ""; | ||
| this.dingtalkCreationMode = ""; | ||
| this.qqOfficialCreationMode = ""; | ||
| this.scanPlatformIdCustomized = false; | ||
| } | ||
| }, | ||
| selectedAbConfId(newConfigId) { | ||
|
|
@@ -1151,6 +1208,7 @@ export default { | |
| this.larkCreationMode = ""; | ||
| this.dingtalkCreationMode = ""; | ||
| this.qqOfficialCreationMode = ""; | ||
| this.scanPlatformIdCustomized = false; | ||
|
|
||
| this.aBConfigRadioVal = "0"; | ||
| this.selectedAbConfId = "default"; | ||
|
|
@@ -1467,6 +1525,14 @@ export default { | |
| this.$emit("show-toast", { message: message, type: "error" }); | ||
| }, | ||
|
|
||
| setScanPlatformId(value) { | ||
| if (!this.selectedPlatformConfig) { | ||
| return; | ||
| } | ||
| this.scanPlatformIdCustomized = true; | ||
| this.selectedPlatformConfig.id = String(value || "").trim(); | ||
| }, | ||
|
Comment on lines
+1528
to
+1534
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在用户输入过程中,使用 |
||
|
|
||
| buildRandomPlatformIdSuffix() { | ||
| const letters = "abcdefghijklmnopqrstuvwxyz"; | ||
| let suffix = "_"; | ||
|
|
@@ -1487,6 +1553,9 @@ export default { | |
| if (!this.selectedPlatformConfig || !data) { | ||
| return; | ||
| } | ||
| if (this.scanPlatformIdCustomized) { | ||
| return; | ||
| } | ||
| const currentId = String(this.selectedPlatformConfig.id || "").trim(); | ||
| const platformType = this.selectedPlatformConfig.type; | ||
| if (!currentId) { | ||
|
|
@@ -1963,8 +2032,22 @@ export default { | |
|
|
||
| .registration-inline { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| justify-content: flex-start; | ||
| width: 320px; | ||
| gap: 8px; | ||
| } | ||
|
|
||
| .weixin-oc-registration-inline { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| width: 320px; | ||
| gap: 8px; | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| .registration-platform-id-field { | ||
| width: 300px; | ||
| } | ||
| </style> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
由于
.weixin-oc-registration-inline和.registration-inline的样式完全相同,建议直接复用.registration-inline,以减少冗余的 CSS 定义。