学生窗体的密码框不再被浏览器自动填上平台的用户名和密码:设了 PasswordChar / UseSystemPasswordChar 的文本框改成普通文本框加 -webkit-text-security 遮成圆点,浏览器不把它当登录表单(不支持该属性的浏览器才退回密码框并标 new-password);文本框、下拉框、表格单元格编辑框都加 autocomplete="off",不弹以前输入过的内容。所有任务共用这个控件,项目 1 任务 1 的登录、添加用户窗体都覆盖到
CI/CD / test (push) Canceled after 0s
CI/CD / deploy (push) Canceled after 0s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-28 12:57:28 +08:00
1 parent 50dced4d37
commit ab933d1896
3 files changed
+13 -1

No files matched your search

+7 -1
View File
@@ -51,6 +51,9 @@ const passwordChar = computed(() => {
const ch = p.value.PasswordChar as string | undefined
return ch && ch !== '\0' ? ch : ''
})
// 不用 type="password":浏览器见到密码框会把平台登录时保存的用户名、密码自动填进学生窗体,autocomplete="off" 也拦不住。
// 改用普通文本框加 -webkit-text-security 遮住字符,浏览器不认它是登录表单;不支持这个属性的浏览器才退回密码框,并标成 new-password 不让填
const textSecurity = typeof CSS !== 'undefined' && CSS.supports('-webkit-text-security', 'disc')
// ComboBox:下拉列表挂到页面最外层(和真实 WinForms 一样可以伸出窗体),按控件在屏幕上的位置和缩放摆放
const dropDownOpen = ref(false)
@@ -159,7 +162,9 @@ const itemHeight = computed(() => `${(p.value.ItemHeight as number | undefined)
/>
<input
v-else
:type="passwordChar ? 'password' : 'text'"
:type="passwordChar && !textSecurity ? 'password' : 'text'"
:class="{ 'wf-masked': passwordChar && textSecurity }"
:autocomplete="passwordChar ? 'new-password' : 'off'"
:value="String(p.Text ?? '')"
:readonly="p.ReadOnly === true"
:disabled="!enabled"
@@ -171,6 +176,7 @@ const itemHeight = computed(() => `${(p.value.ItemHeight as number | undefined)
<div v-else-if="node.type === 'ComboBox'" ref="combo" class="wf-control wf-combobox" :style="style">
<input
:value="String(p.Text ?? '')"
autocomplete="off"
:readonly="!editable"
:disabled="!enabled"
@mousedown="!editable && openDropDown()"
+1
View File
@@ -159,6 +159,7 @@ function columnStyle(column: Column): CSSProperties {
ref="editor"
v-model="editing.value"
class="wf-dgv-editor"
autocomplete="off"
@keydown.enter.stop.prevent="commit"
@keydown.esc.stop.prevent="cancel"
@keydown.stop
+5
View File
@@ -128,6 +128,11 @@
border-color: #0078d7;
}
/* 密码字符:用普通文本框遮住字符(见 ControlView.vue 里的 textSecurity) */
.wf-textbox input.wf-masked {
-webkit-text-security: disc;
}
/* 文本框、下拉框的背景色画在外层(控件的 BackColor 写在外层的 style 上),输入框本身透明 */
.wf-textbox,
.wf-combobox {