Compare commits
4
Commits
main
..
dea414739e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dea414739e | ||
|
|
d13bdd5dc8 | ||
|
|
040ec3f382 | ||
|
|
9a58b98f12 |
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# Author: fruit.com.cn
|
||||
# ReelShortWeb 后台 CI:lint + 构建门禁
|
||||
name: web-ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop, main]
|
||||
pull_request:
|
||||
branches: [develop, main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: pnpm
|
||||
- name: 依赖
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: 类型检查
|
||||
run: pnpm ts:check
|
||||
- name: 构建
|
||||
run: pnpm build:pro
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
export type UserLoginType = {
|
||||
username: string
|
||||
password?: string
|
||||
}
|
||||
|
||||
export type UserType = {
|
||||
|
||||
@@ -87,8 +87,8 @@ export const useUserStore = defineStore('user', {
|
||||
this.setToken('')
|
||||
this.setUserInfo(undefined)
|
||||
this.setRoleRouters([])
|
||||
this.setLoginInfo(undefined)
|
||||
this.setRememberMe(false)
|
||||
// 注意:不能清 loginInfo / rememberMe —— 那是「记住我」存的账号密码,
|
||||
// 退出登录后回到登录页还要靠它来回填,清了就等于「记住我」没生效。
|
||||
tagsViewStore.delAllViews()
|
||||
// 菜单/路由一起清:否则换账号后 permissionStore 里还是上一个账号的路由表
|
||||
permissionStore.clearRoutes()
|
||||
@@ -104,17 +104,7 @@ export const useUserStore = defineStore('user', {
|
||||
this.loginInfo = loginInfo
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
afterRestore: (context) => {
|
||||
const loginInfo = context.store.loginInfo as
|
||||
(UserLoginType & { password?: string }) | undefined
|
||||
if (loginInfo?.password !== undefined) {
|
||||
context.store.setLoginInfo(
|
||||
loginInfo.username ? { username: loginInfo.username } : undefined
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
persist: true
|
||||
})
|
||||
|
||||
export const useUserStoreWithOut = () => {
|
||||
|
||||
@@ -132,7 +132,7 @@ const remember = ref(userStore.getRememberMe)
|
||||
const initLoginInfo = () => {
|
||||
const loginInfo = userStore.getLoginInfo
|
||||
if (loginInfo) {
|
||||
setValues({ username: loginInfo.username })
|
||||
setValues({ username: loginInfo.username, password: loginInfo.password })
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
@@ -169,10 +169,12 @@ const signIn = async () => {
|
||||
const res = await loginApi(formData)
|
||||
|
||||
if (res) {
|
||||
// 是否记住我
|
||||
// 是否记住我:勾选时把账号密码一起持久化到 localStorage,
|
||||
// 下次打开登录页自动回填,免重复输入。
|
||||
if (unref(remember)) {
|
||||
userStore.setLoginInfo({
|
||||
username: formData.username
|
||||
username: formData.username,
|
||||
password: formData.password
|
||||
})
|
||||
} else {
|
||||
userStore.setLoginInfo(undefined)
|
||||
|
||||
@@ -33,6 +33,7 @@ const DEFAULT_TAG_COLOR = '#E5484D'
|
||||
const emptyForm = () => ({
|
||||
locales: { zh: '' },
|
||||
bgColor: DEFAULT_TAG_COLOR,
|
||||
code: '',
|
||||
sort: 1,
|
||||
status: 1
|
||||
})
|
||||
@@ -66,6 +67,7 @@ function openEdit(row) {
|
||||
Object.assign(form, {
|
||||
locales,
|
||||
bgColor: row.bgColor || DEFAULT_TAG_COLOR,
|
||||
code: row.code || '',
|
||||
sort: row.sort ?? 0,
|
||||
status: row.status ?? 1
|
||||
})
|
||||
@@ -83,12 +85,18 @@ async function save() {
|
||||
ElMessage.warning(`请填写${languageLabel(missing)}名称`)
|
||||
return
|
||||
}
|
||||
const code = (form.code || '').trim().toUpperCase()
|
||||
if (code && !/^[A-Z][A-Z0-9_]{0,31}$/.test(code)) {
|
||||
ElMessage.warning('语义码需为大写字母、数字或下划线,且以字母开头')
|
||||
return
|
||||
}
|
||||
saving.value = true
|
||||
try {
|
||||
const payload = {
|
||||
name: locales.zh,
|
||||
locales,
|
||||
bgColor: form.bgColor || DEFAULT_TAG_COLOR,
|
||||
code,
|
||||
sort: form.sort,
|
||||
status: form.status
|
||||
}
|
||||
@@ -209,6 +217,16 @@ onMounted(load)
|
||||
<el-form-item label="背景色">
|
||||
<el-color-picker v-model="form.bgColor" color-format="hex" />
|
||||
</el-form-item>
|
||||
<el-form-item label="语义码">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
maxlength="32"
|
||||
placeholder="如 NEW_ARRIVAL,留空则按名称匹配"
|
||||
/>
|
||||
<div class="form-hint">
|
||||
客户端按语义码判断板块(如「上新」横滑),改名或换语言都不受影响。
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div class="form-row">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" :min="0" :max="999" />
|
||||
@@ -236,4 +254,11 @@ onMounted(load)
|
||||
height: 16px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.form-hint {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user