14 changed files with 160 additions and 73 deletions
@ -0,0 +1,8 @@ |
|||||
|
// 默认主题文件 |
||||
|
.theme-default { |
||||
|
background-color: #333; |
||||
|
.u-card { |
||||
|
font-size: 24px !important; |
||||
|
color: #0f0; |
||||
|
} |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
// 整合所有主题 |
||||
|
|
||||
|
// 默认主题 |
||||
|
@import './default.scss'; |
||||
|
@import './test.scss'; |
@ -0,0 +1,8 @@ |
|||||
|
// TODO: 测试用的scss主题样式 |
||||
|
.theme-test { |
||||
|
background-color: #fff; |
||||
|
.u-card { |
||||
|
font-size: 24px !important; |
||||
|
background-color: #ff0 !important; |
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
<template> |
||||
|
<view :class="[theme]"> |
||||
|
<slot></slot> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { computed } from 'vue'; |
||||
|
import { useStore } from 'vuex'; |
||||
|
|
||||
|
const store = useStore(); |
||||
|
const theme = computed(() => store.state.theme); |
||||
|
</script> |
@ -1,7 +0,0 @@ |
|||||
<!-- |
|
||||
* @Author: aBin |
|
||||
* @email: binbin0314@126.com |
|
||||
* @Date: 2021-07-19 15:40:02 |
|
||||
* @LastEditors: aBin |
|
||||
* @LastEditTime: 2021-07-19 15:40:03 |
|
||||
--> |
|
@ -0,0 +1,7 @@ |
|||||
|
import { computed } from 'vue'; |
||||
|
import { useStore } from 'vuex'; |
||||
|
export default function useTheme() { |
||||
|
const store = useStore(); |
||||
|
const theme = computed(() => store.state.theme); |
||||
|
return theme; |
||||
|
} |
@ -1,30 +1,32 @@ |
|||||
{ |
{ |
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
"pages": [ |
||||
{ |
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
||||
"path": "pages/index/index", |
{ |
||||
"style": { |
"path": "pages/index/index", |
||||
"navigationBarText": "TALL" |
"style": { |
||||
} |
"navigationBarText": "TALL" |
||||
}, |
} |
||||
{ |
}, |
||||
"path": "pages/project/project", |
{ |
||||
"style": { |
"path": "pages/project/project", |
||||
"navigationStyle": "custom", |
"style": { |
||||
"navigationBarTextStyle": "white" |
"navigationStyle": "custom", |
||||
} |
"navigationBarTextStyle": "white" |
||||
} |
} |
||||
], |
} |
||||
"globalStyle": { |
], |
||||
"navigationBarTextStyle": "black", |
"globalStyle": { |
||||
"navigationBarTitleText": "TALL", |
"navigationBarTextStyle": "black", |
||||
"navigationBarBackgroundColor": "#F8F8F8", |
"navigationBarTitleText": "TALL", |
||||
"backgroundColor": "#F8F8F8" |
"navigationBarBackgroundColor": "#F8F8F8", |
||||
}, |
"backgroundColor": "#F8F8F8" |
||||
"easycom": { |
}, |
||||
"autoscan": true, |
"easycom": { |
||||
"custom": { |
"autoscan": true, |
||||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue", |
"custom": { |
||||
"^p-(.*)": "@/plugins/p-$1/p-$1.vue" |
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue", |
||||
} |
"^p-(.*)": "@/plugins/p-$1/p-$1.vue", |
||||
} |
"theme": "@/components/Theme/Theme.vue" |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
|
@ -0,0 +1,9 @@ |
|||||
|
<template> |
||||
|
<view class="deliver-container">p-deliver</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"></style> |
@ -1,48 +1,58 @@ |
|||||
import { createStore } from 'vuex'; |
import { createStore } from 'vuex'; |
||||
import user from './user/index.js'; |
|
||||
import socket from './socket/index.js'; |
|
||||
import project from './project/index.js'; |
import project from './project/index.js'; |
||||
import role from './role/index.js'; |
import role from './role/index.js'; |
||||
|
import socket from './socket/index.js'; |
||||
import task from './task/index.js'; |
import task from './task/index.js'; |
||||
|
import user from './user/index.js'; |
||||
|
|
||||
// 不属于具体模块的 应用级的 store内容
|
// 不属于具体模块的 应用级的 store内容
|
||||
const state = { |
const state = { |
||||
networkConnected: true, // 网络是否连接
|
theme: 'theme-default', |
||||
forceUseStorage: true, // 强制启用storage
|
networkConnected: true, // 网络是否连接
|
||||
systemInfo: null, // 系统设备信息
|
forceUseStorage: true, // 强制启用storage
|
||||
|
systemInfo: null, // 系统设备信息
|
||||
}; |
}; |
||||
|
|
||||
const getters = { |
const getters = { |
||||
// 是否启用本地存储
|
// 是否启用本地存储
|
||||
// 设置了强制启用本地存储 或者 没有网络连接的时候
|
// 设置了强制启用本地存储 或者 没有网络连接的时候
|
||||
useStorage({ networkConnected, forceUseStorage }) { |
useStorage({ networkConnected, forceUseStorage }) { |
||||
return forceUseStorage || !networkConnected; |
return forceUseStorage || !networkConnected; |
||||
}, |
}, |
||||
}; |
}; |
||||
|
|
||||
const mutations = { |
const mutations = { |
||||
/** |
/** |
||||
* 设置网络是否连接的变量 |
* 设置网络是否连接的变量 |
||||
* @param {*} state |
* @param {*} state |
||||
* @param {boolean} networkConnected |
* @param {boolean} networkConnected |
||||
*/ |
*/ |
||||
setNetworkConnected(state, networkConnected) { |
setNetworkConnected(state, networkConnected) { |
||||
state.networkConnected = networkConnected; |
state.networkConnected = networkConnected; |
||||
}, |
}, |
||||
|
|
||||
|
/** |
||||
|
* 设置系统信息的数据 |
||||
|
* @param {object} state |
||||
|
* @param {object | null} data 获取到的数据 |
||||
|
*/ |
||||
|
setSystemInfo(state, data) { |
||||
|
state.systemInfo = data; |
||||
|
}, |
||||
|
|
||||
/** |
/** |
||||
* 设置系统信息的数据 |
* 设置主题 |
||||
* @param {object} state |
* @param {object} state |
||||
* @param {object | null} data 获取到的数据 |
* @param {string} theme 主题名称 默认theme-default |
||||
*/ |
*/ |
||||
setSystemInfo(state, data) { |
setTheme(state, theme) { |
||||
state.systemInfo = data; |
state.theme = theme || 'theme-default'; |
||||
}, |
}, |
||||
}; |
}; |
||||
|
|
||||
export default createStore({ |
export default createStore({ |
||||
state, |
state, |
||||
getters, |
getters, |
||||
mutations, |
mutations, |
||||
modules: {user, socket, project, role, task} |
modules: { user, socket, project, role, task }, |
||||
}); |
}); |
||||
|
Loading…
Reference in new issue