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 = {
|
export type UserLoginType = {
|
||||||
username: string
|
username: string
|
||||||
|
password?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserType = {
|
export type UserType = {
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ export const useUserStore = defineStore('user', {
|
|||||||
this.setToken('')
|
this.setToken('')
|
||||||
this.setUserInfo(undefined)
|
this.setUserInfo(undefined)
|
||||||
this.setRoleRouters([])
|
this.setRoleRouters([])
|
||||||
this.setLoginInfo(undefined)
|
// 注意:不能清 loginInfo / rememberMe —— 那是「记住我」存的账号密码,
|
||||||
this.setRememberMe(false)
|
// 退出登录后回到登录页还要靠它来回填,清了就等于「记住我」没生效。
|
||||||
tagsViewStore.delAllViews()
|
tagsViewStore.delAllViews()
|
||||||
// 菜单/路由一起清:否则换账号后 permissionStore 里还是上一个账号的路由表
|
// 菜单/路由一起清:否则换账号后 permissionStore 里还是上一个账号的路由表
|
||||||
permissionStore.clearRoutes()
|
permissionStore.clearRoutes()
|
||||||
@@ -104,17 +104,7 @@ export const useUserStore = defineStore('user', {
|
|||||||
this.loginInfo = loginInfo
|
this.loginInfo = loginInfo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
persist: {
|
persist: true
|
||||||
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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export const useUserStoreWithOut = () => {
|
export const useUserStoreWithOut = () => {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ const remember = ref(userStore.getRememberMe)
|
|||||||
const initLoginInfo = () => {
|
const initLoginInfo = () => {
|
||||||
const loginInfo = userStore.getLoginInfo
|
const loginInfo = userStore.getLoginInfo
|
||||||
if (loginInfo) {
|
if (loginInfo) {
|
||||||
setValues({ username: loginInfo.username })
|
setValues({ username: loginInfo.username, password: loginInfo.password })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -169,10 +169,12 @@ const signIn = async () => {
|
|||||||
const res = await loginApi(formData)
|
const res = await loginApi(formData)
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
// 是否记住我
|
// 是否记住我:勾选时把账号密码一起持久化到 localStorage,
|
||||||
|
// 下次打开登录页自动回填,免重复输入。
|
||||||
if (unref(remember)) {
|
if (unref(remember)) {
|
||||||
userStore.setLoginInfo({
|
userStore.setLoginInfo({
|
||||||
username: formData.username
|
username: formData.username,
|
||||||
|
password: formData.password
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
userStore.setLoginInfo(undefined)
|
userStore.setLoginInfo(undefined)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const DEFAULT_TAG_COLOR = '#E5484D'
|
|||||||
const emptyForm = () => ({
|
const emptyForm = () => ({
|
||||||
locales: { zh: '' },
|
locales: { zh: '' },
|
||||||
bgColor: DEFAULT_TAG_COLOR,
|
bgColor: DEFAULT_TAG_COLOR,
|
||||||
|
code: '',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
status: 1
|
status: 1
|
||||||
})
|
})
|
||||||
@@ -66,6 +67,7 @@ function openEdit(row) {
|
|||||||
Object.assign(form, {
|
Object.assign(form, {
|
||||||
locales,
|
locales,
|
||||||
bgColor: row.bgColor || DEFAULT_TAG_COLOR,
|
bgColor: row.bgColor || DEFAULT_TAG_COLOR,
|
||||||
|
code: row.code || '',
|
||||||
sort: row.sort ?? 0,
|
sort: row.sort ?? 0,
|
||||||
status: row.status ?? 1
|
status: row.status ?? 1
|
||||||
})
|
})
|
||||||
@@ -83,12 +85,18 @@ async function save() {
|
|||||||
ElMessage.warning(`请填写${languageLabel(missing)}名称`)
|
ElMessage.warning(`请填写${languageLabel(missing)}名称`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const code = (form.code || '').trim().toUpperCase()
|
||||||
|
if (code && !/^[A-Z][A-Z0-9_]{0,31}$/.test(code)) {
|
||||||
|
ElMessage.warning('语义码需为大写字母、数字或下划线,且以字母开头')
|
||||||
|
return
|
||||||
|
}
|
||||||
saving.value = true
|
saving.value = true
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
name: locales.zh,
|
name: locales.zh,
|
||||||
locales,
|
locales,
|
||||||
bgColor: form.bgColor || DEFAULT_TAG_COLOR,
|
bgColor: form.bgColor || DEFAULT_TAG_COLOR,
|
||||||
|
code,
|
||||||
sort: form.sort,
|
sort: form.sort,
|
||||||
status: form.status
|
status: form.status
|
||||||
}
|
}
|
||||||
@@ -209,6 +217,16 @@ onMounted(load)
|
|||||||
<el-form-item label="背景色">
|
<el-form-item label="背景色">
|
||||||
<el-color-picker v-model="form.bgColor" color-format="hex" />
|
<el-color-picker v-model="form.bgColor" color-format="hex" />
|
||||||
</el-form-item>
|
</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">
|
<div class="form-row">
|
||||||
<el-form-item label="排序">
|
<el-form-item label="排序">
|
||||||
<el-input-number v-model="form.sort" :min="0" :max="999" />
|
<el-input-number v-model="form.sort" :min="0" :max="999" />
|
||||||
@@ -236,4 +254,11 @@ onMounted(load)
|
|||||||
height: 16px;
|
height: 16px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-hint {
|
||||||
|
margin-top: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user