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 |
|||
{ |
|||
"path": "pages/index/index", |
|||
"style": { |
|||
"navigationBarText": "TALL" |
|||
} |
|||
}, |
|||
{ |
|||
"path": "pages/project/project", |
|||
"style": { |
|||
"navigationStyle": "custom", |
|||
"navigationBarTextStyle": "white" |
|||
} |
|||
} |
|||
], |
|||
"globalStyle": { |
|||
"navigationBarTextStyle": "black", |
|||
"navigationBarTitleText": "TALL", |
|||
"navigationBarBackgroundColor": "#F8F8F8", |
|||
"backgroundColor": "#F8F8F8" |
|||
}, |
|||
"easycom": { |
|||
"autoscan": true, |
|||
"custom": { |
|||
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue", |
|||
"^p-(.*)": "@/plugins/p-$1/p-$1.vue" |
|||
} |
|||
} |
|||
"pages": [ |
|||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages |
|||
{ |
|||
"path": "pages/index/index", |
|||
"style": { |
|||
"navigationBarText": "TALL" |
|||
} |
|||
}, |
|||
{ |
|||
"path": "pages/project/project", |
|||
"style": { |
|||
"navigationStyle": "custom", |
|||
"navigationBarTextStyle": "white" |
|||
} |
|||
} |
|||
], |
|||
"globalStyle": { |
|||
"navigationBarTextStyle": "black", |
|||
"navigationBarTitleText": "TALL", |
|||
"navigationBarBackgroundColor": "#F8F8F8", |
|||
"backgroundColor": "#F8F8F8" |
|||
}, |
|||
"easycom": { |
|||
"autoscan": true, |
|||
"custom": { |
|||
"^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 user from './user/index.js'; |
|||
import socket from './socket/index.js'; |
|||
import project from './project/index.js'; |
|||
import role from './role/index.js'; |
|||
import socket from './socket/index.js'; |
|||
import task from './task/index.js'; |
|||
import user from './user/index.js'; |
|||
|
|||
// 不属于具体模块的 应用级的 store内容
|
|||
const state = { |
|||
networkConnected: true, // 网络是否连接
|
|||
forceUseStorage: true, // 强制启用storage
|
|||
systemInfo: null, // 系统设备信息
|
|||
theme: 'theme-default', |
|||
networkConnected: true, // 网络是否连接
|
|||
forceUseStorage: true, // 强制启用storage
|
|||
systemInfo: null, // 系统设备信息
|
|||
}; |
|||
|
|||
const getters = { |
|||
// 是否启用本地存储
|
|||
// 设置了强制启用本地存储 或者 没有网络连接的时候
|
|||
useStorage({ networkConnected, forceUseStorage }) { |
|||
return forceUseStorage || !networkConnected; |
|||
}, |
|||
// 是否启用本地存储
|
|||
// 设置了强制启用本地存储 或者 没有网络连接的时候
|
|||
useStorage({ networkConnected, forceUseStorage }) { |
|||
return forceUseStorage || !networkConnected; |
|||
}, |
|||
}; |
|||
|
|||
const mutations = { |
|||
/** |
|||
* 设置网络是否连接的变量 |
|||
* @param {*} state |
|||
* @param {boolean} networkConnected |
|||
*/ |
|||
setNetworkConnected(state, networkConnected) { |
|||
state.networkConnected = networkConnected; |
|||
}, |
|||
/** |
|||
* 设置网络是否连接的变量 |
|||
* @param {*} state |
|||
* @param {boolean} networkConnected |
|||
*/ |
|||
setNetworkConnected(state, networkConnected) { |
|||
state.networkConnected = networkConnected; |
|||
}, |
|||
|
|||
/** |
|||
* 设置系统信息的数据 |
|||
* @param {object} state |
|||
* @param {object | null} data 获取到的数据 |
|||
*/ |
|||
setSystemInfo(state, data) { |
|||
state.systemInfo = data; |
|||
}, |
|||
|
|||
/** |
|||
* 设置系统信息的数据 |
|||
* @param {object} state |
|||
* @param {object | null} data 获取到的数据 |
|||
*/ |
|||
setSystemInfo(state, data) { |
|||
state.systemInfo = data; |
|||
}, |
|||
/** |
|||
* 设置主题 |
|||
* @param {object} state |
|||
* @param {string} theme 主题名称 默认theme-default |
|||
*/ |
|||
setTheme(state, theme) { |
|||
state.theme = theme || 'theme-default'; |
|||
}, |
|||
}; |
|||
|
|||
export default createStore({ |
|||
state, |
|||
getters, |
|||
mutations, |
|||
modules: {user, socket, project, role, task} |
|||
state, |
|||
getters, |
|||
mutations, |
|||
modules: { user, socket, project, role, task }, |
|||
}); |
|||
|
Loading…
Reference in new issue