fzzj vor 9 Monaten
Ursprung
Commit
9c0d36214f
6 geänderte Dateien mit 91 neuen und 134 gelöschten Zeilen
  1. 9
    4
      RuoYi-App/App.vue
  2. 3
    3
      RuoYi-App/README.md
  3. 0
    10
      RuoYi-App/package.json
  4. 0
    7
      RuoYi-App/shim.d.ts
  5. 79
    93
      RuoYi-App/store/theme.js
  6. 0
    17
      RuoYi-App/vue.config.js

+ 9
- 4
RuoYi-App/App.vue Datei anzeigen

@@ -8,6 +8,7 @@
8 8
 import config from './config'
9 9
 import { getToken } from '@/utils/auth'
10 10
 import { onLaunch, onShow } from '@dcloudio/uni-app'
11
+import { mapState } from 'pinia'
11 12
 import { useThemeStore } from '@/store/theme'  // 修正路径
12 13
 import { useUserStore } from '@/store/user'    // 修正路径
13 14
 import { useVipStore } from '@/store/vip'      // 修正路径
@@ -17,14 +18,17 @@ import { readingService } from '@/services/readingService'
17 18
 export default {
18 19
   data() {
19 20
     return {
20
-      themeStore: useThemeStore(),
21
-      userStore: useUserStore(),
22
-      vipStore: useVipStore()
23 21
     }
24 22
   },
23
+    computed: {
24
+      ...mapState(useThemeStore, ['currentTheme']),
25
+      ...mapState(useUserStore, ['user']),
26
+      ...mapState(useVipStore, ['vipStatus'])
27
+    },
25 28
   onLaunch() {
26 29
     // 初始化主题
27
-    this.themeStore.initTheme()
30
+    const themeStore = useThemeStore()
31
+    themeStore.initTheme()
28 32
     // 检查登录状态
29 33
     this.checkLogin()
30 34
     // 初始化用户
@@ -57,6 +61,7 @@ export default {
57 61
         this.$tab.reLaunch('/pages/login') 
58 62
       }
59 63
     },
64
+    
60 65
         // 同步阅读进度(需要实现)
61 66
         async syncReadingProgress() {
62 67
           // 实现阅读进度同步逻辑

+ 3
- 3
RuoYi-App/README.md Datei anzeigen

@@ -10,7 +10,7 @@
10 10
 </p>
11 11
 
12 12
 ## 平台简介
13
-
13
+恋爱圈移动端,已开通h5广告。框架uniapp+vue,基于RuoYi App 移动端。
14 14
 RuoYi App 移动解决方案,采用uniapp框架,一份代码多终端适配,同时支持APP、小程序、H5!实现了与[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue)、[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)完美对接的移动解决方案!目前已经实现登录、我的、工作台、编辑资料、头像修改、密码修改、常见问题、关于我们等基础功能。
15 15
 
16 16
 * 配套后端代码仓库地址[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) 或 [RuoYi-Cloud](https://github.com/yangzongzhuan/RuoYi-Cloud) 版本。
@@ -23,8 +23,8 @@ RuoYi App 移动解决方案,采用uniapp框架,一份代码多终端适配
23 23
 
24 24
 - 官网网站:[http://ruoyi.vip](http://ruoyi.vip)
25 25
 - 文档地址:[http://doc.ruoyi.vip](http://doc.ruoyi.vip)
26
-- H5页体验:[http://h5.ruoyi.vip](http://h5.ruoyi.vip)
27
-- QQ交流群: ①133713780(满)、②146013835(满)、③189091635
26
+- H5页体验:[https://h5.aiyadianzi.ltd](http://h5.aiyadianzi.ltd)
27
+- QQ交流群: 643681611
28 28
 - 小程序体验
29 29
 
30 30
 <img src="https://oscimg.oschina.net/oscnet/up-26c76dc90b92acdbd9ac8cd5252f07c8ad9.jpg" alt="小程序演示"/>

+ 0
- 10
RuoYi-App/package.json Datei anzeigen

@@ -1,10 +0,0 @@
1
-{
2
-  "dependencies": {
3
-    "@vue/composition-api": "^1.7.2",
4
-    "pinia": "^2.1.1",
5
-    "vue": "^2.6.14",
6
-    "vue-demi": "^0.14.10",
7
-    "vue-router": "^3.5.4",
8
-    "vuex": "^3.6.2"
9
-  }
10
-}

+ 0
- 7
RuoYi-App/shim.d.ts Datei anzeigen

@@ -1,7 +0,0 @@
1
-// src/shim.d.ts
2
-declare module 'pinia' {
3
-  export interface PiniaCustomProperties {
4
-    $router: import('vue-router').default;
5
-    $route: import('vue-router').Route;
6
-  }
7
-}

+ 79
- 93
RuoYi-App/store/theme.js Datei anzeigen

@@ -1,97 +1,83 @@
1 1
 import { defineStore } from 'pinia'
2 2
 import { ref, computed } from 'vue'
3 3
 
4
-export const useThemeStore = defineStore('theme', () => {
5
-  // 可用主题列表
6
-  const themes = ref({
7
-    default: {
8
-      '--primary-color': '#1890ff',
9
-      '--bg-color': '#f8f9fa',
10
-      '--text-color': '#333',
11
-      '--card-bg': '#ffffff'
4
+export const useThemeStore = defineStore('theme', {
5
+  state: () => ({
6
+    themes: {
7
+      default: {
8
+        '--primary-color': '#1890ff',
9
+        '--bg-color': '#f8f9fa',
10
+        '--text-color': '#333',
11
+        '--card-bg': '#ffffff'
12
+      },
13
+      aydzBlue: {
14
+        '--primary-color': '#2a5caa',
15
+        '--bg-color': '#e6f7ff',
16
+        '--text-color': '#1a3353',
17
+        '--card-bg': '#d0e8ff'
18
+      },
19
+      darkMode: {
20
+        '--primary-color': '#52c41a',
21
+        '--bg-color': '#1a1a1a',
22
+        '--text-color': '#e6e6e6',
23
+        '--card-bg': '#2a2a2a'
24
+      }
12 25
     },
13
-    aydzBlue: {
14
-      '--primary-color': '#2a5caa',
15
-      '--bg-color': '#e6f7ff',
16
-      '--text-color': '#1a3353',
17
-      '--card-bg': '#d0e8ff'
18
-    },
19
-    darkMode: {
20
-      '--primary-color': '#52c41a',
21
-      '--bg-color': '#1a1a1a',
22
-      '--text-color': '#e6e6e6',
23
-      '--card-bg': '#2a2a2a'
24
-    }
25
-  })
26
-  
27
-  // 当前主题
28
-  const currentTheme = ref('aydzBlue')
29
-  
30
-  // 初始化主题
31
-  const initTheme = () => {
32
-    const savedTheme = uni.getStorageSync('selectedTheme') || 'aydzBlue'
33
-    setTheme(savedTheme)
34
-  }
35
-  
36
-  // 设置主题
37
-  const setTheme = (themeName) => {
38
-    if (!themes.value[themeName]) return
39
-    
40
-    currentTheme.value = themeName
41
-    uni.setStorageSync('selectedTheme', themeName)
42
-    
43
-    // 应用CSS变量
44
-    const root = document.documentElement
45
-    const themeVars = themes.value[themeName]
46
-    
47
-    Object.keys(themeVars).forEach(key => {
48
-      root.style.setProperty(key, themeVars[key])
49
-    })
50
-    
51
-    // 动态设置导航栏颜色
52
-    if (themeName === 'darkMode') {
53
-      uni.setNavigationBarColor({
54
-        frontColor: '#ffffff',
55
-        backgroundColor: '#1a1a1a'
56
-      })
57
-    } else if (themeName === 'aydzBlue') {
58
-      uni.setNavigationBarColor({
59
-        frontColor: '#ffffff',
60
-        backgroundColor: '#2a5caa'
61
-      })
62
-    } else {
63
-      uni.setNavigationBarColor({
64
-        frontColor: '#000000',
65
-        backgroundColor: '#f8f9fa'
66
-      })
67
-    }
68
-  }
69
-  
70
-  // 主题配置(用于UI显示)
71
-  const themeOptions = computed(() => {
72
-    return Object.keys(themes.value).map(key => ({
73
-      name: key,
74
-      label: getThemeLabel(key),
75
-      colors: themes.value[key]
76
-    }))
77
-  })
78
-  
79
-  // 获取主题显示名称
80
-  const getThemeLabel = (themeKey) => {
81
-    const labels = {
82
-      default: '默认主题',
83
-      aydzBlue: '哎呀科技蓝',
84
-      darkMode: '深色模式'
85
-    }
86
-    return labels[themeKey] || themeKey
87
-  }
88
-
89
-  return { 
90
-    themes,
91
-    currentTheme,
92
-    themeOptions,
93
-    initTheme,
94
-    setTheme,
95
-    getThemeLabel
96
-  }
97
-})
26
+    currentTheme: 'aydzBlue'
27
+  }),
28
+   actions: {
29
+     initTheme() {
30
+       const savedTheme = uni.getStorageSync('selectedTheme') || 'aydzBlue'
31
+       this.setTheme(savedTheme)
32
+     },
33
+     setTheme(themeName) {
34
+       if (!this.themes[themeName]) return
35
+       
36
+       this.currentTheme = themeName
37
+       uni.setStorageSync('selectedTheme', themeName)
38
+       
39
+       // 应用CSS变量
40
+       const root = document.documentElement
41
+       const themeVars = this.themes[themeName]
42
+       
43
+       Object.keys(themeVars).forEach(key => {
44
+         root.style.setProperty(key, themeVars[key])
45
+       })
46
+       
47
+       // 动态设置导航栏颜色
48
+       if (themeName === 'darkMode') {
49
+         uni.setNavigationBarColor({
50
+           frontColor: '#ffffff',
51
+           backgroundColor: '#1a1a1a'
52
+         })
53
+       } else if (themeName === 'aydzBlue') {
54
+         uni.setNavigationBarColor({
55
+           frontColor: '#ffffff',
56
+           backgroundColor: '#2a5caa'
57
+         })
58
+       } else {
59
+         uni.setNavigationBarColor({
60
+           frontColor: '#000000',
61
+           backgroundColor: '#f8f9fa'
62
+         })
63
+       }
64
+     },
65
+     getThemeLabel(themeKey) {
66
+       const labels = {
67
+         default: '默认主题',
68
+         aydzBlue: '哎呀科技蓝',
69
+         darkMode: '深色模式'
70
+       }
71
+       return labels[themeKey] || themeKey
72
+     }
73
+   },
74
+   getters: {
75
+     themeOptions: (state) => {
76
+       return Object.keys(state.themes).map(key => ({
77
+         name: key,
78
+         label: state.getThemeLabel(key),
79
+         colors: state.themes[key]
80
+       }))
81
+     }
82
+   }
83
+ })

+ 0
- 17
RuoYi-App/vue.config.js Datei anzeigen

@@ -1,17 +0,0 @@
1
-// vue.config.js
2
-const path = require('path');
3
-
4
-module.exports = {
5
-  transpileDependencies: [
6
-    '@vue/composition-api',
7
-    'pinia'
8
-  ],
9
-  configureWebpack: {
10
-    resolve: {
11
-      alias: {
12
-        // 删除这行 ↓
13
-        // 'vue-demi': path.resolve(__dirname, 'src') 
14
-      }
15
-    }
16
-  }
17
-}

Laden…
Abbrechen
Speichern