Browse Source

DIIA

master
科技小王子 8 months ago
parent
commit
fb18eb807b
  1. 4
      .env.development
  2. 2
      src/api/cms/website/model/index.ts
  3. 156
      src/layout/index.vue
  4. 7
      src/store/modules/tenant.ts
  5. 1
      src/views/about/components/detail.vue
  6. 14
      src/views/index/index.vue

4
.env.development

@ -1,7 +1,7 @@
VITE_SOCKET_URL=wss://server.gxwebsoft.com VITE_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://server.gxwebsoft.com/api VITE_SERVER_URL=https://server.gxwebsoft.com/api
VITE_API_URL=https://modules.gxwebsoft.com/api
#VITE_API_URL=https://modules.gxwebsoft.com/api
#VITE_API_URL=http://127.0.0.1:9001/api
VITE_API_URL=http://127.0.0.1:9001/api
#VITE_SOCKET_URL=ws://localhost:9191 #VITE_SOCKET_URL=ws://localhost:9191
#VITE_API_URL=http://103.233.255.195:9300/api #VITE_API_URL=http://103.233.255.195:9300/api

2
src/api/cms/website/model/index.ts

@ -53,6 +53,8 @@ export interface Website {
tenantId?: number; tenantId?: number;
tenantName?: string; tenantName?: string;
navigations?: Navigation[]; navigations?: Navigation[];
topNavs?: Navigation[];
bottomNavs?: Navigation[];
categoryList?: ArrangeCategory[]; categoryList?: ArrangeCategory[];
links?: Link[]; links?: Link[];
// 配置信息 // 配置信息

156
src/layout/index.vue

@ -4,164 +4,8 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia';
import { useI18n } from 'vue-i18n';
import { message } from 'ant-design-vue';
import {toggleFullscreen, isFullscreen} from 'ele-admin-pro';
import { useTenantStore } from '@/store/modules/tenant';
import { useThemeStore } from '@/store/modules/theme';
import RouterLayout from '@/components/RouterLayout/index.vue'; import RouterLayout from '@/components/RouterLayout/index.vue';
import {
HIDE_SIDEBARS,
HIDE_FOOTERS,
REPEATABLE_TABS,
HOME_TITLE,
HOME_PATH,
LAYOUT_PATH,
REDIRECT_PATH,
I18N_ENABLE
} from '@/config/setting';
import {
addPageTab,
removePageTab,
removeAllPageTab,
removeLeftPageTab,
removeRightPageTab,
removeOtherPageTab,
reloadPageTab,
setHomeComponents
} from '@/utils/page-tab-util';
import type { TabCtxMenuOption } from 'ele-admin-pro/es/ele-pro-layout/types';
import {useUserStore} from "@/store/modules/user";
const { push } = useRouter();
const { t, locale } = useI18n();
const tenantStore = useTenantStore();
const themeStore = useThemeStore();
const userStore = useUserStore();
//
const { menus } = storeToRefs(userStore);
const { siteInfo } = storeToRefs(tenantStore);
console.log(siteInfo.value.websiteName,'siteInfo.')
//
const projectName = siteInfo.value?.websiteName || '网站名称';
// LOGO
const logoPath =
siteInfo.value?.websiteLogo || 'https://www.gxwebsoft.com/ws-logo.svg';
//
const fullscreen = ref(false);
//
const {
tabs,
collapse,
sideNavCollapse,
bodyFullscreen,
showTabs,
showFooter,
headStyle,
sideStyle,
layoutStyle,
sideMenuStyle,
tabStyle,
fixedHeader,
fixedSidebar,
fixedBody,
bodyFull,
logoAutoSize,
colorfulIcon,
sideUniqueOpen,
styleResponsive
} = storeToRefs(themeStore);
/* 侧栏折叠切换 */
const updateCollapse = (value: boolean) => {
themeStore.setCollapse(value);
};
/* 双侧栏一级折叠切换 */
const updateSideNavCollapse = (value: boolean) => {
themeStore.setSideNavCollapse(value);
};
/* 内容区域全屏切换 */
const updateBodyFullscreen = (value: boolean) => {
themeStore.setBodyFullscreen(value);
};
/* logo 点击事件 */
const onLogoClick = (isHome: boolean) => {
isHome || push(LAYOUT_PATH);
};
/* 监听屏幕尺寸改变 */
const screenSizeChange = () => {
themeStore.updateScreenSize();
fullscreen.value = isFullscreen();
};
/* 全屏切换 */
const onFullscreen = () => {
try {
fullscreen.value = toggleFullscreen();
} catch (e) {
message.error('您的浏览器不支持全屏模式');
}
};
/* 页签右键菜单点击事件 */
const onTabContextMenu = ({
key,
tabKey,
item,
active
}: TabCtxMenuOption) => {
switch (key) {
case 'reload': //
reloadPageTab({
isHome: !item,
fullPath: item?.fullPath ?? tabKey
});
break;
case 'close': //
removePageTab({
key: item?.fullPath ?? tabKey,
active
});
break;
case 'left': //
removeLeftPageTab({
key: tabKey,
active
});
break;
case 'right': //
removeRightPageTab({
key: tabKey,
active
});
break;
case 'other': //
removeOtherPageTab({
key: tabKey,
active
});
break;
}
};
/* 菜单标题国际化 */
const i18n = (_path: string, key?: string) => {
if (!I18N_ENABLE || !key) {
return;
}
const k = 'route.' + key + '._name';
const title = t(k);
if (title !== k) {
return title;
}
};
</script> </script>
<script lang="ts"> <script lang="ts">

7
src/store/modules/tenant.ts

@ -43,8 +43,8 @@ export const useTenantStore = defineStore({
if (!siteInfo) { if (!siteInfo) {
return {}; return {};
} }
const { navigations,config } = siteInfo;
this.siteInfo = siteInfo; this.siteInfo = siteInfo;
const { topNavs,config } = siteInfo;
localStorage.setItem('tenantId', String(siteInfo.tenantId)); localStorage.setItem('tenantId', String(siteInfo.tenantId));
localStorage.setItem('tenantName', String(siteInfo.websiteName)); localStorage.setItem('tenantName', String(siteInfo.websiteName));
// 缓存配置 // 缓存配置
@ -55,7 +55,7 @@ export const useTenantStore = defineStore({
// 用户菜单, 过滤掉按钮类型并转为 children 形式 // 用户菜单, 过滤掉按钮类型并转为 children 形式
const { menus, homePath } = formatMenus( const { menus, homePath } = formatMenus(
toTreeData({ toTreeData({
data: navigations?.filter(d => d.position != 2).map((d) => {
data: topNavs?.filter(d => d.position != 2).map((d) => {
if(d.parentId == 0 && d.type == 0 && d.path != '/'){ if(d.parentId == 0 && d.type == 0 && d.path != '/'){
d.path = '/' + d.navigationId; d.path = '/' + d.navigationId;
} }
@ -71,9 +71,10 @@ export const useTenantStore = defineStore({
}) })
); );
this.menus = menus; this.menus = menus;
console.log(menus)
// 处理底部链接 // 处理底部链接
this.subMenu = toTreeData({ this.subMenu = toTreeData({
data: navigations?.filter(d => d.position != 1).map((d) => {
data: topNavs?.filter(d => d.position != 1).map((d) => {
return { ...d, key: d.navigationId, value: d.navigationId }; return { ...d, key: d.navigationId, value: d.navigationId };
}), }),
idField: 'navigationId', idField: 'navigationId',

1
src/views/about/components/detail.vue

@ -46,7 +46,6 @@ const { form,assignFields } = useFormData<Design>({
const reload = () => { const reload = () => {
getNavigationByPath({path: pagePath.value}).then(data => { getNavigationByPath({path: pagePath.value}).then(data => {
console.log(data)
if (data.design) { if (data.design) {
assignFields((data.design)); assignFields((data.design));
} }

14
src/views/index/index.vue

@ -246,8 +246,8 @@
</template> </template>
<div class="ele-cell" style=" <div class="ele-cell" style="
display: flex; display: flex;
justify-content: space-between;" :class="screenWidth > 567 ? 'hidden-sm-and-down' : 'hidden-sm-and-up'" v-if="siteInfo">
<div class="item-img" v-for="(item,index) in siteInfo.links" :key="index">
justify-content: space-between;" :class="screenWidth > 567 ? 'hidden-sm-and-down' : 'hidden-sm-and-up'" v-if="links">
<div class="item-img" v-for="(item,index) in links" :key="index">
<a-image v-if="item.name == 'IEEE'" :src="item.icon" :preview="false" style="width: 240px;"></a-image> <a-image v-if="item.name == 'IEEE'" :src="item.icon" :preview="false" style="width: 240px;"></a-image>
<a-image v-else :src="item.icon" :preview="false" style="width: 150px;"></a-image> <a-image v-else :src="item.icon" :preview="false" style="width: 150px;"></a-image>
</div> </div>
@ -269,11 +269,13 @@
import {listArticle} from "@/api/cms/article"; import {listArticle} from "@/api/cms/article";
import {Article} from "@/api/cms/article/model"; import {Article} from "@/api/cms/article/model";
import {ref} from "vue"; import {ref} from "vue";
import * as url from "url";
import {listLink} from "@/api/link";
import {Link} from "@/api/link/model";
const links = ref<Link[]>()
const themeStore = useThemeStore(); const themeStore = useThemeStore();
const { screenWidth, styleResponsive } = storeToRefs(themeStore);
const { screenWidth } = storeToRefs(themeStore);
const tenantStore = useTenantStore(); const tenantStore = useTenantStore();
const { siteInfo } = storeToRefs(tenantStore); const { siteInfo } = storeToRefs(tenantStore);
@ -284,6 +286,10 @@
article159.value = data article159.value = data
}) })
listLink().then(data => {
links.value = data;
})
const openUrl = (url: string) => { const openUrl = (url: string) => {
window.open(url); window.open(url);
} }

Loading…
Cancel
Save