feat: diy模式区分入口

This commit is contained in:
streakingman
2022-10-08 22:51:41 +08:00
parent e6449f9d8c
commit 34e89fe232
28 changed files with 210 additions and 21 deletions
+28 -19
View File
@@ -41,6 +41,7 @@ const App: FC<{ theme: Theme<any> }> = ({ theme: initTheme }) => {
// 生产环境才统计
useEffect(() => {
if (__DIY__) return;
console.log(import.meta.env.MODE);
if (import.meta.env.PROD) {
const busuanziScript = document.createElement('script');
@@ -71,31 +72,39 @@ const App: FC<{ theme: Theme<any> }> = ({ theme: initTheme }) => {
/>
<PersonalInfo />
<div className={'flex-spacer'} />
<p style={{ textAlign: 'center', fontSize: 10, opacity: 0.5 }}>
<span id="busuanzi_container_site_pv">
访
<span id="busuanzi_value_site_pv" />
</span>
<br />
<BeiAn />
</p>
<Suspense fallback={<span>Loading</span>}>
{!theme.pure && (
<>
<Info />
<ThemeChanger
changeTheme={changeTheme}
onDiyClick={() => setDiyDialogShow(true)}
/>
{!__DIY__ && (
<p
style={{
textAlign: 'center',
fontSize: 10,
opacity: 0.5,
}}
>
<span id="busuanzi_container_site_pv">
访
<span id="busuanzi_value_site_pv" />
</span>
<br />
<BeiAn />
</p>
)}
{!__DIY__ && !theme.pure && (
<>
<Info />
<ThemeChanger
changeTheme={changeTheme}
onDiyClick={() => setDiyDialogShow(true)}
/>
<Suspense fallback={<span>Loading</span>}>
{diyDialogShow && (
<ConfigDialog
closeMethod={() => setDiyDialogShow(false)}
previewMethod={previewTheme}
/>
)}
</>
)}
</Suspense>
</Suspense>
</>
)}
</>
);
};
+3 -2
View File
@@ -142,8 +142,9 @@ const Symbol: FC<SymbolProps> = ({ x, y, icon, isCover, status, onClick }) => {
style={{ opacity: isCover ? 0.4 : 1 }}
>
{typeof icon.content === 'string' ? (
icon.content.startsWith('http') ? (
/*图片外链*/
icon.content.startsWith('http') ||
icon.content.startsWith('/') ? (
/*图片地址*/
<img src={icon.content} alt="" />
) : (
/*字符表情*/
+2
View File
@@ -57,6 +57,8 @@ Bmob.initialize(
import.meta.env.VITE_BMOB_SECCODE
);
console.log(import.meta.env);
const loadTheme = () => {
// 请求主题
if (customThemeIdFromPath) {
+1
View File
@@ -1 +1,2 @@
/// <reference types="vite/client" />
declare const __DIY__: boolean;