art: 格式化代码
All checks were successful
Release / lint (push) Successful in 29s
Release / Release (push) Successful in 1m22s

This commit is contained in:
my_ong 2024-12-14 11:22:41 +08:00
parent 3cb34c8554
commit 526bfa65b5
5 changed files with 170 additions and 148 deletions

View File

@ -29,13 +29,18 @@
import SubMenu from './sub-menu.vue' import SubMenu from './sub-menu.vue'
import XEUtils from 'xe-utils' import XEUtils from 'xe-utils'
import { fliteredMenuTree } from './menu' import { fliteredMenuTree } from './menu'
import { useRoute } from 'vue-router'
const app = useAppStore() const app = useAppStore()
// const router = useRouter()
const theme = computed(() => { const theme = computed(() => {
return app.layout.navTheme === 'light' ? 'light' : 'dark' return app.layout.navTheme === 'light' ? 'light' : 'dark'
}) })
const menuTree = computed(() => { const menuTree = computed(() => {
//
// router.currentRoute();
return fliteredMenuTree() return fliteredMenuTree()
}) })
const route = useRoute() const route = useRoute()

View File

@ -1,9 +1,9 @@
import { createRouter, createWebHashHistory } from 'vue-router' import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import UserLayout from '@/layout/user-layout.vue' import UserLayout from '@/layout/user-layout.vue'
import AdminLayout from '@/layout/admin-layout.vue' import AdminLayout from '@/layout/admin-layout.vue'
import BlankLayout from '@/layout/blank-layout.vue' import BlankLayout from '@/layout/blank-layout.vue'
export const routes = [ export const routes: Array<RouteRecordRaw> = [
{ {
path: '/admin/acl', // 系统管理 path: '/admin/acl', // 系统管理
name: 'ACL', name: 'ACL',
@ -99,7 +99,10 @@ export const routes = [
}, },
] ]
export default createRouter({ const getNewRouter = () => {
// TODO 用户store判断是否登录,登录就返回过滤的,没有登录就返回全量
return createRouter({
history: createWebHashHistory(), history: createWebHashHistory(),
routes: [ routes: [
{ {
@ -138,4 +141,7 @@ export default createRouter({
component: () => import('@/views/message/message-page.vue'), component: () => import('@/views/message/message-page.vue'),
}, },
], ],
}) })
}
export default getNewRouter()

View File

@ -25,6 +25,9 @@ export const useUserStore = defineStore('user', {
}, },
userLogin(user: auth.AuthUser) { userLogin(user: auth.AuthUser) {
Object.assign(this, user) Object.assign(this, user)
// 过了路由的地址
// router.addRoute
router.push({ path: '/admin/acl/users' }) // 登录后跳转到用户列表页面 router.push({ path: '/admin/acl/users' }) // 登录后跳转到用户列表页面
}, },
logout() { logout() {

View File

@ -3,7 +3,7 @@
<a-flex gap="middle" horizontal> <a-flex gap="middle" horizontal>
<span class="ant-form-text">请输入打印的条码数量:</span> <span class="ant-form-text">请输入打印的条码数量:</span>
<a-form-item name="input-number" no-style> <a-form-item name="input-number" no-style>
<a-input-number v-model:value="inputRef" :min="1" :max="30" @change="fetchAndPrintBarcodes(inputRef)" /> <a-input-number v-model:value="inputRef" :min="1" :max="30" />
</a-form-item> </a-form-item>
<button @click="printCode">打印条形码</button> <button @click="printCode">打印条形码</button>
@ -30,6 +30,10 @@
const inputRef = ref(1) const inputRef = ref(1)
watch(inputRef, (newVal) => {
fetchAndPrintBarcodes(newVal)
})
const printCode = () => { const printCode = () => {
const container = document.getElementById('barcodes-container') const container = document.getElementById('barcodes-container')
if (!container) { if (!container) {
@ -75,7 +79,7 @@
} }
// //
const fetchAndPrintBarcodes = async (count: number) => { const fetchAndPrintBarcodes = (count: number) => {
// //
const container = document.getElementById('barcodes-container') const container = document.getElementById('barcodes-container')
if (!container) throw new Error('条形码容器未找到') if (!container) throw new Error('条形码容器未找到')

File diff suppressed because one or more lines are too long