Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(theme): 新增2024毅行主题 #129

Merged
merged 6 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
"pages/setting/changePassword/index",
"pages/connect/index",
"pages/connect/faq/index",
"pages/lab/index",
"pages/theme/index",
"pages/freeroom/index",
"pages/canteenflow/index",
"pages/announcement/index",
Expand Down
Binary file added src/assets/photos/background-walk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion src/components/AppList/AppListItem/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<view class="applist-item" @tap="appTaped">
<view class="icon-wrapper" :style="backgroundColor">
<view :class="['iconfont', `icon-${icon}`]" />
<view :class="['iconfont', iconClass]" />
</view>
<text class="label">
{{ label }}
Expand All @@ -23,6 +23,20 @@ const props = defineProps<{
require: string,
}>();
const { require: requireActive, bg = ref("green"), label, url } = toRefs(props);
// 主题过渡方案
const icon = props.icon;
const themeMode = computed(() => serviceStore.theme.themeMode);
const iconClass = computed(() => {
if (themeMode.value === "walk") {
if (icon !== "lessonstable" && icon !== "exam" && icon !== "score") {
return "icon-15th-" + icon;
} else {
return "icon-" + icon;
}
} else {
return "icon-" + icon;
}
});

const isDisabled = ref(false);
// 之后需要改动,目前zf和oauth的功能是等效的,因此zf和oauth有一个为true即可使用
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
>
<view
class="iconfont icon-add"
style="font-size: 2rem; font-weight: bolder"
style="font-size: 1.3rem; font-weight: bolder"
/>
</view>
</view>
Expand Down
2 changes: 1 addition & 1 deletion src/components/My/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const options = computed(() => {
const data = [
[
{ title: "绑定", url: "/pages/bind/index", badge: notificationState.my.bind },
{ title: "主题", url: "/pages/lab/index" }
{ title: "主题", url: "/pages/theme/index" }
],
[
{ title: "反馈", url: "/pages/connect/index" },
Expand Down
11 changes: 8 additions & 3 deletions src/components/NavBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="nav-bar-icon-wrapper"
@tap="nav('home')"
>
<view class="iconfont icon-home" />
<view class="iconfont " :class="homeClass" />
<view class="description">
首页
</view>
Expand All @@ -18,7 +18,7 @@
class="nav-bar-icon-wrapper"
@tap="plusClick"
>
<view class="iconfont icon-applist" />
<view class="iconfont " :class="applyClass" />
<view class="description">
功能
</view>
Expand All @@ -31,7 +31,7 @@
class="nav-bar-icon-wrapper"
@tap="nav('my')"
>
<view class="iconfont icon-user" />
<view class="iconfont " :class="personClass" />
<view class="description">
我的
</view>
Expand Down Expand Up @@ -76,6 +76,11 @@ const notificationActive = computed(() => {
my: checkNotification("my", store)
};
});
// 主题过渡方案
const themeMode = computed(() => serviceStore.theme.themeMode);
const homeClass = computed(() => themeMode.value === "walk" ? "icon-a-15th-home1" : "icon-home");
const applyClass = computed(() => themeMode.value === "walk" ? "icon-a-15th-apply1" : "icon-applist");
const personClass = computed(() => themeMode.value === "walk" ? "icon-a-15th-person1" : "icon-user");

const { pageName } = toRefs(props);

Expand Down
8 changes: 7 additions & 1 deletion src/components/ThemeConfig/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@

background-image: url('~@/assets/photos/background-purple.svg');
}

// 主题过渡方案
.theme.walk {
--wjh-color-primary-light: var(--wjh-color-red-500);
--wjh-color-primary: var(--wjh-color-red-600);
--wjh-color-primary-dark: var(--wjh-color-red-700);
background-image: url('~@/assets/photos/background-walk.png');
}
.background {
position: fixed;
display: flex;
Expand Down
13 changes: 13 additions & 0 deletions src/components/ThemeConfig/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<view
:class="[themeMode, darkMode]"
class="background theme"
:style="walkStyle"
>
<slot />
</view>
Expand All @@ -14,6 +15,18 @@ import { serviceStore } from "@/store";
import { useDarkMode } from "@/hooks";

const themeMode = computed(() => serviceStore.theme.themeMode);
// 主题过渡方案
const walkStyle = computed(() => {
if (themeMode.value === "walk" && darkMode.value !== "dark") {
return "--wjh-color-background-page: #FAE7D4;background-position: bottom 0 right 120%; background-size: cover;";
} else if (darkMode.value === "dark") {
return "--wjh-color-background-page: #121212";
} else if (darkMode.value === "light") {
return "--wjh-color-background-page: #fefefe; --wjh-color-background-container: #FAFAFAFF";
} else {
return "";
}
});

const { mode: darkMode } = useDarkMode();

Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions src/pages/lab/index.vue → src/pages/theme/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<theme-config class="lab-view background">
<theme-config>
<title-bar title="主题" back-button />
<scroll-view :scroll-y="true">
<view class="flex-column">
Expand Down Expand Up @@ -57,15 +57,15 @@ import Taro from "@tarojs/taro";

let activeTheme = "";
const idMap = {};
// 主题过渡方案
const nameMap = {
green: "绿",
yellow: "黄",
walk: "毅行",
blue: "蓝",
purple: "紫",
pink: "粉"
};
const isEmpty = ref(false);

const emptyText = computed(() => {
return labText.empty;
});
Expand All @@ -74,7 +74,6 @@ const hadThemeList = computed(() => {
});
const themeMode = ref(serviceStore.theme.themeMode);
const currentTab = ref(themeMode);

useRequest(UserService.getUserTheme, {
manual: false,
onSuccess: (res) => {
Expand Down
3 changes: 0 additions & 3 deletions src/style/darkmode/light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,4 @@
--wjh-color-purple-700: #{$purple-700};


--wjh-color-pink-500: #{$pink-500};
--wjh-color-pink-600: #{$pink-600};
--wjh-color-pink-700: #{$pink-700};
xixiIBN5100 marked this conversation as resolved.
Show resolved Hide resolved
}
46 changes: 45 additions & 1 deletion src/style/icons.scss

Large diffs are not rendered by default.

Loading