diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/views/home/well/index.vue b/src/views/home/well/index.vue index 439816e..cc2059b 100644 --- a/src/views/home/well/index.vue +++ b/src/views/home/well/index.vue @@ -1,3 +1,230 @@ + + + - 闸井监测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 切换地图模式 + + + + + + + + 导出 + + + + + + + + + + {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} + + + + + + + + 布防 {{ scope.$index }} + + + + + + + 查看 {{ scope.$index }} + + + 编辑 {{ scope.$index }} + + + + + + + + + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/views/home/well/index.vue b/src/views/home/well/index.vue index 439816e..cc2059b 100644 --- a/src/views/home/well/index.vue +++ b/src/views/home/well/index.vue @@ -1,3 +1,230 @@ + + + - 闸井监测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 切换地图模式 + + + + + + + + 导出 + + + + + + + + + + {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} + + + + + + + + 布防 {{ scope.$index }} + + + + + + + 查看 {{ scope.$index }} + + + 编辑 {{ scope.$index }} + + + + + + + + + diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue new file mode 100644 index 0000000..b2eef7e --- /dev/null +++ b/src/views/login-mobile.vue @@ -0,0 +1,19 @@ + + + + + + 移动端登陆页面 + + + + 基础测试 + + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/views/home/well/index.vue b/src/views/home/well/index.vue index 439816e..cc2059b 100644 --- a/src/views/home/well/index.vue +++ b/src/views/home/well/index.vue @@ -1,3 +1,230 @@ + + + - 闸井监测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 切换地图模式 + + + + + + + + 导出 + + + + + + + + + + {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} + + + + + + + + 布防 {{ scope.$index }} + + + + + + + 查看 {{ scope.$index }} + + + 编辑 {{ scope.$index }} + + + + + + + + + diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue new file mode 100644 index 0000000..b2eef7e --- /dev/null +++ b/src/views/login-mobile.vue @@ -0,0 +1,19 @@ + + + + + + 移动端登陆页面 + + + + 基础测试 + + diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue new file mode 100644 index 0000000..4cb3c1a --- /dev/null +++ b/src/views/login-pc.vue @@ -0,0 +1,459 @@ + +meta: + title: 登录 + constant: true + layout: false + + + + + + + + 燃气物联感知平台 + + + + + + + 用户登录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 记住我 + + + + 登录 + + + 演示账号一键登录 + + admin + + + test + + + + + + + + + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/views/home/well/index.vue b/src/views/home/well/index.vue index 439816e..cc2059b 100644 --- a/src/views/home/well/index.vue +++ b/src/views/home/well/index.vue @@ -1,3 +1,230 @@ + + + - 闸井监测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 切换地图模式 + + + + + + + + 导出 + + + + + + + + + + {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} + + + + + + + + 布防 {{ scope.$index }} + + + + + + + 查看 {{ scope.$index }} + + + 编辑 {{ scope.$index }} + + + + + + + + + diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue new file mode 100644 index 0000000..b2eef7e --- /dev/null +++ b/src/views/login-mobile.vue @@ -0,0 +1,19 @@ + + + + + + 移动端登陆页面 + + + + 基础测试 + + diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue new file mode 100644 index 0000000..4cb3c1a --- /dev/null +++ b/src/views/login-pc.vue @@ -0,0 +1,459 @@ + +meta: + title: 登录 + constant: true + layout: false + + + + + + + + 燃气物联感知平台 + + + + + + + 用户登录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 记住我 + + + + 登录 + + + 演示账号一键登录 + + admin + + + test + + + + + + + + + diff --git a/src/views/login.vue b/src/views/login.vue index cdc09f6..2334631 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,456 +1,13 @@ - - meta: - title: 登录 - constant: true - layout: false - - + - - - 燃气物联感知平台 - - - - - - - 用户登录 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 记住我 - - - - 登录 - - - 演示账号一键登录 - - admin - - - test - - - - - - + + + + - - diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/views/home/well/index.vue b/src/views/home/well/index.vue index 439816e..cc2059b 100644 --- a/src/views/home/well/index.vue +++ b/src/views/home/well/index.vue @@ -1,3 +1,230 @@ + + + - 闸井监测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 切换地图模式 + + + + + + + + 导出 + + + + + + + + + + {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} + + + + + + + + 布防 {{ scope.$index }} + + + + + + + 查看 {{ scope.$index }} + + + 编辑 {{ scope.$index }} + + + + + + + + + diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue new file mode 100644 index 0000000..b2eef7e --- /dev/null +++ b/src/views/login-mobile.vue @@ -0,0 +1,19 @@ + + + + + + 移动端登陆页面 + + + + 基础测试 + + diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue new file mode 100644 index 0000000..4cb3c1a --- /dev/null +++ b/src/views/login-pc.vue @@ -0,0 +1,459 @@ + +meta: + title: 登录 + constant: true + layout: false + + + + + + + + 燃气物联感知平台 + + + + + + + 用户登录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 记住我 + + + + 登录 + + + 演示账号一键登录 + + admin + + + test + + + + + + + + + diff --git a/src/views/login.vue b/src/views/login.vue index cdc09f6..2334631 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,456 +1,13 @@ - - meta: - title: 登录 - constant: true - layout: false - - + - - - 燃气物联感知平台 - - - - - - - 用户登录 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 记住我 - - - - 登录 - - - 演示账号一键登录 - - admin - - - test - - - - - - + + + + - - diff --git a/src/views/mobile/example1/index.vue b/src/views/mobile/example1/index.vue new file mode 100644 index 0000000..e3254f6 --- /dev/null +++ b/src/views/mobile/example1/index.vue @@ -0,0 +1,33 @@ + + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + diff --git a/src/App.vue b/src/App.vue index 52ccd6e..a9268fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,7 @@ import useMenuStore from '@/store/modules/menu' const settingsStore = useSettingsStore() - +const $router = useRouter() const buttonConfig = ref({ autoInsertSpace: true, }) @@ -81,14 +81,40 @@ }) onMounted(() => { + // // 浏览器访问当前位置 + // if ('geolocation' in navigator) { + // navigator.geolocation.getCurrentPosition(function (position) { + // // 允许 + // console.log('纬度: ', position.coords.latitude) + // console.log('经度: ', position.coords.longitude) + // }, function (error) { + // // 拒绝 + // console.error("Error Code = " + error.code + " - " + error.message); + // }) + // } else { + // console.error("Geolocation is not supported by this browser.") + // } settingsStore.setMode(document.documentElement.clientWidth) window.onresize = () => { settingsStore.setMode(document.documentElement.clientWidth) + // 监听浏览器类型变化 刷新浏览器 + const userAgent = navigator.userAgent || navigator.vendor || window.opera + const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) + if (`${isMobile ? 'mobile' : 'pc'}` !== window.localStorage.getItem('browser-type-bj-well')) { + // if (!window.localStorage.getItem('browser-type-bj-well')) { return } + console.log(`浏览器类型发生变化,由${window.localStorage.getItem('browser-type-bj-well')}变为${isMobile ? 'mobile' : 'pc'}`) + window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) + $router.push('/') + setTimeout(() => { + window.location.reload() + }, 1000) + } } hotkeys('alt+i', () => { eventBus.emit('global-system-info-toggle') }) }) +const browserType = window.localStorage.getItem('browser-type-bj-well') // mobile || pc @@ -99,6 +125,6 @@ '--g-sub-sidebar-actual-width': subSidebarActualWidth, }" /> - + diff --git a/src/components/NormalTable/index.vue b/src/components/NormalTable/index.vue index e247e28..de24f71 100644 --- a/src/components/NormalTable/index.vue +++ b/src/components/NormalTable/index.vue @@ -1,6 +1,6 @@ @@ -243,45 +309,48 @@ - + - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ scope.row[column.value] }} + {{ column.filter(scope.row) }} - + {{ item }} - {{ scope.row[column.value] }} - {{ column.filter(scope.row) }} + {{ + scope.row[column.value] }} + {{ column.filter(scope.row) + }} @@ -290,19 +359,67 @@ + + + + 当前行前方插入 + + + 当前行后方插入 + + + 列表头行插入 + + + 列表尾行插入 + + + 选中行前方插入 + + + + 选中行后方插入 + + diff --git a/src/layouts/mobile.vue b/src/layouts/mobile.vue new file mode 100644 index 0000000..c6235a4 --- /dev/null +++ b/src/layouts/mobile.vue @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index 07c50a2..cb80c5d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,35 +19,35 @@ import { downloadAndInstall } from '@/iconify-ep' import { hasPermission } from '@/utils/composables/permission' import buttonPerm from '@/utils/buttonPerm' -// 引入打印插件 if (useSettingsStore().app.iconifyOfflineUse) { downloadAndInstall() } -const app = createApp(App) -app.config.globalProperties.hasPerm = hasPermission -app.config.globalProperties.buttonPerm = buttonPerm -app.config.globalProperties.dayjs = dayjs -app.use(print) -app.use(ElementPlus) -app.use(pinia) -app.use(router) -for (const [key, component] of Object.entries(ElementPlusIconsVue)) { - app.component(key, component) -} -directive(app) axios.get('./config/config.json', { headers: { 'Cache-Control': 'no-cache', }, }).then((result) => { + const app = createApp(App) console.log('get config') + console.log(window.localStorage.getItem('browser-type-bj-well'), 'mian中获取浏览器类型') console.log(result) window.localStorage.setItem('url-bj-well', result.data.baseUrl) window.localStorage.setItem('securityJsCode', result.data.securityJsCode) window.localStorage.setItem('JsKey', result.data.JsKey) request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data + app.config.globalProperties.hasPerm = hasPermission + app.config.globalProperties.buttonPerm = buttonPerm + app.config.globalProperties.dayjs = dayjs + app.use(print) + app.use(ElementPlus) + app.use(pinia) + app.use(router) + for (const [key, component] of Object.entries(ElementPlusIconsVue)) { + app.component(key, component) + } + directive(app) app.mount('#app') }).catch((error) => { console.error(`get baseConfig error...${error}`) diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts new file mode 100644 index 0000000..77618c1 --- /dev/null +++ b/src/router/modules/mobile.ts @@ -0,0 +1,31 @@ +// 移动端路由 +import type { Route } from '@/global' + +const Layout = () => import('@/layouts/mobile.vue') + +const routes: Route.recordRaw[] = [ + { + path: '/home', + component: Layout, + redirect: '/home/index', + name: 'Home', + meta: { + title: '首页', + }, + children: [ + { + path: 'index', + component: () => import('@/views/mobile/example1/index.vue'), + name: 'HomeIndex', + meta: { + title: '首页', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + }, + }, + ], + }, +] + +export default routes diff --git a/src/router/routes.ts b/src/router/routes.ts index ae91d6e..b1fdc27 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,6 +2,7 @@ import generatedRoutes from 'virtual:generated-pages' // import commonRoute from './modules/system' import homeRoute from './modules/home' +import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' @@ -31,12 +32,15 @@ }, }, ] - +const userAgent = navigator.userAgent || navigator.vendor || window.opera +const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { path: '/dashboard', - component: () => import('@/layouts/index.vue'), + component: isMobile ? null : () => import('@/layouts/index.vue'), meta: { title: () => useSettingsStore().dashboard.title, breadcrumb: false, @@ -101,19 +105,27 @@ ], }, ] - // 动态路由(异步路由、导航栏路由) -const asyncRoutes: Route.recordMainRaw[] = [ - { - meta: { - title: '', - icon: '', +const asyncRoutes: Route.recordMainRaw[] = isMobile + ? [{ // 移动端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...mobileRoute, + ], + }] + : [{ // pc端路由 + meta: { + title: '', + icon: '', + }, + children: [ + ...homeRoute, + ], }, - children: [ - ...homeRoute, - ], - }, -] + ] const constantRoutesByFilesystem = generatedRoutes.filter((item) => { return item.meta?.enabled !== false && item.meta?.constant === true diff --git "a/src/views/\133...all\135.vue" "b/src/views/\133...all\135.vue" index 91af7e1..98ca1f9 100644 --- "a/src/views/\133...all\135.vue" +++ "b/src/views/\133...all\135.vue" @@ -51,30 +51,65 @@ diff --git a/src/views/home/well/index.vue b/src/views/home/well/index.vue index 439816e..cc2059b 100644 --- a/src/views/home/well/index.vue +++ b/src/views/home/well/index.vue @@ -1,3 +1,230 @@ + + + - 闸井监测 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 切换地图模式 + + + + + + + + 导出 + + + + + + + + + + {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} + + + + + + + + 布防 {{ scope.$index }} + + + + + + + 查看 {{ scope.$index }} + + + 编辑 {{ scope.$index }} + + + + + + + + + diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue new file mode 100644 index 0000000..b2eef7e --- /dev/null +++ b/src/views/login-mobile.vue @@ -0,0 +1,19 @@ + + + + + + 移动端登陆页面 + + + + 基础测试 + + diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue new file mode 100644 index 0000000..4cb3c1a --- /dev/null +++ b/src/views/login-pc.vue @@ -0,0 +1,459 @@ + +meta: + title: 登录 + constant: true + layout: false + + + + + + + + 燃气物联感知平台 + + + + + + + 用户登录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 记住我 + + + + 登录 + + + 演示账号一键登录 + + admin + + + test + + + + + + + + + diff --git a/src/views/login.vue b/src/views/login.vue index cdc09f6..2334631 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,456 +1,13 @@ - - meta: - title: 登录 - constant: true - layout: false - - + - - - 燃气物联感知平台 - - - - - - - 用户登录 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 记住我 - - - - 登录 - - - 演示账号一键登录 - - admin - - - test - - - - - - + + + + - - diff --git a/src/views/mobile/example1/index.vue b/src/views/mobile/example1/index.vue new file mode 100644 index 0000000..e3254f6 --- /dev/null +++ b/src/views/mobile/example1/index.vue @@ -0,0 +1,33 @@ + + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + 路由跳转测试1页面 + diff --git a/src/views/mobile/example2/index.vue b/src/views/mobile/example2/index.vue new file mode 100644 index 0000000..2b97b29 --- /dev/null +++ b/src/views/mobile/example2/index.vue @@ -0,0 +1,3 @@ + + 路由跳转测试2页面 +
+ 当前行前方插入 +
+ 当前行后方插入 +
+ 列表头行插入 +
+ 列表尾行插入 +
+ 选中行前方插入 +
+ 选中行后方插入 +