art: 格式化代码
This commit is contained in:
parent
3cb34c8554
commit
526bfa65b5
@ -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()
|
||||||
|
@ -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: [
|
||||||
{
|
{
|
||||||
@ -139,3 +142,6 @@ export default createRouter({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getNewRouter()
|
||||||
|
@ -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() {
|
||||||
|
@ -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
Loading…
x
Reference in New Issue
Block a user