Skip to content

Commit

Permalink
feat: remove deprecated platform
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Apr 21, 2024
1 parent eb9a1dc commit 2277eb3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 43 deletions.
8 changes: 3 additions & 5 deletions packages/components/config/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,25 @@ export const getFooterConfig = () => {
title: isEnglish ? 'Resource' : '资源',
links: [
{ name: isEnglish ? 'Design Resource' : '设计资源', url: jumpLocation('/source'), target: '_self' },
{ name: 'TDesign Starter', url: jumpLocation('https://tdesign.tencent.com/starter/'), target: '_self' }
{ name: 'TDesign Starter', url: jumpLocation('https://tdesign.tencent.com/starter/'), target: '_self' },
],
},
{
title: isEnglish ? 'Tencent Design' : '腾讯设计',
links: [
{ name: 'CoDesign', url: 'https://codesign.qq.com/', target: '_blank' },
{ name: 'ProWork', url: 'https://prowork.qq.com/', target: '_blank' },
{ name: 'TDesign', url: `https://tdesign.${isIntranet() ? 'woa' : 'tencent'}.com`, target: '_self' },
isIntranet() ? { name: 'TVision', url: 'https://tvision.oa.com/', target: '_blank' } : null,
].filter(item => item),
].filter((item) => item),
},
{
title: isEnglish ? 'About' : '关于',
links: [
{ name: isEnglish ? 'About us' : '关于我们', url: jumpLocation('/about/introduce'), target: '_self' },
{ name: isEnglish ? 'Contact us' : '联系我们', url: jumpLocation('/about/contact'), target: '_self' },
{ name: isEnglish ? 'Feedback' : '意见反馈', url: '//support.qq.com/products/293854', target: '_blank' }
],
},
];

return footerLinks;
}
};
2 changes: 0 additions & 2 deletions packages/components/config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
// logo 设置
export const logoMenuConfigCdn = 'https://cdc.cdn-go.cn/tdc/latest/menu.json';
export const logoMenuConfigWoaCdn = 'https://cdc.cdn-go.cn/tdc/latest/menu.woa.json';
export const logoMenuSvgPrefix = 'https://cdc.cdn-go.cn/tdc/latest/images';
77 changes: 41 additions & 36 deletions packages/components/src/components/td-logo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,50 @@
import { html, define } from 'hybrids';
import logoIcon from '@images/logo.svg?raw';
import menuApplicationIcon from '@images/menu-application.svg?raw';
import chevronRightIcon from '@images/chevron-right.svg?raw';
import { isIntranet } from '@utils/index';
import { logoMenuConfigCdn, logoMenuConfigWoaCdn, logoMenuSvgPrefix } from '@config';
import { logoMenuSvgPrefix } from '@config';
import { getLang } from '@utils';

import style from './style.less';
import portalStyle from './portal.less';

const isEnglish = getLang() === 'en';

const navList = [
{
title: '腾讯设计',
children: [
{
key: 'tdesign',
title: 'TDesign',
url: 'https://tdesign.tencent.com/?utm_source=tdc&utm_medium=tdc.nav',
desc: '企业级设计体系',
},
{
key: 'codesign',
title: 'CoDesign',
url: 'https://codesign.qq.com/?utm_source=tdc&utm_medium=tdc.nav',
desc: '一站式设计协作平台',
},
],
},
{
title: '腾讯调研',
children: [
{
key: 'wj',
title: '腾讯问卷',
url: 'https://wj.qq.com/?utm_source=tdc&utm_medium=tdc.nav',
desc: '免费的问卷调查系统',
},
{
key: 'txc',
title: '兔小巢',
url: 'https://txc.qq.com/?utm_source=tdc&utm_medium=tdc.nav',
desc: '用户反馈服务平台',
},
],
},
];
function renderList(list = []) {
return html` <div class="list">
${list.map(
Expand All @@ -27,17 +61,11 @@ function renderList(list = []) {
</div>`;
}

function renderMenu(list) {
const len = list.length;
return list.map(
function renderMenu() {
const len = navList.length;
return navList.map(
(item, index) => html`
${item.category_url
? html`
<a href="${item.category_url}" class="title" target="${item.target}">
${item.category_title} <i innerHTML="${chevronRightIcon}"></i>
</a>
`
: html` <span class="title"> ${item.category_title} </span> `}
<span class="title"> ${item.title} </span>
${renderList(item.children)} ${index < len - 1 ? html`<div class="line"></div>` : html``}
`,
);
Expand All @@ -49,29 +77,6 @@ export default define({
get: (host, lastValue) => lastValue || [],
set: (host, value) => value,
},
isIntranet: {
get: () => isIntranet(),
set: (value) => value,
connect: (host) => {
const menuCdn = isIntranet() ? logoMenuConfigWoaCdn : logoMenuConfigCdn;
fetch(menuCdn)
.then((res) => res.json())
.then((menuList) => {
// 整理 menu 字段
menuList.forEach((menu) => {
menu.target = '_blank';
menu.children.forEach((child) => {
if (child.url.includes('tdesign')) {
child.target = '_self';
} else {
child.target = '_blank';
}
});
});
Object.assign(host, { menuList });
});
},
},
render: ({ menuList }) => html`
<style>
${style}
Expand Down

0 comments on commit 2277eb3

Please sign in to comment.