Browse Source

feat: 主体颜色

test2
xuesinan 4 years ago
parent
commit
bb5c0e36ed
  1. 12
      App.vue
  2. 1
      CHANGELOG.md
  3. 8
      apis/tall.js
  4. 4
      pages/index/index.vue
  5. 304
      pages/project/project.vue

12
App.vue

@ -18,10 +18,10 @@ export default {
this.checkNetwork(); // this.checkNetwork(); //
this.getSystemInfo(); // this.getSystemInfo(); //
const token = this.$store.state.user.token || this.$storage.getStorageSync('anyringToken') || ''; // const token = this.$store.state.user.token || this.$storage.getStorageSync('anyringToken') || '';
if (token) { // if (token) {
this.$store.commit('user/setToken', token); // this.$store.commit('user/setToken', token);
} // }
// if (!token) { // if (!token) {
// this.$ui.showToast(', '); // this.$ui.showToast(', ');
@ -29,8 +29,8 @@ export default {
// return; // return;
// } // }
// await this.syncLocalDataToStore(options.query.u); // localStoragestore await this.syncLocalDataToStore('1217647686598135808'); // localStoragestore
// token = await this.getToken(); const token = await this.getToken();
// this.noPhone(this.$store.state.user.phone); // this.noPhone(this.$store.state.user.phone);
this.$store.dispatch('socket/initSocket'); this.$store.dispatch('socket/initSocket');

1
CHANGELOG.md

@ -13,6 +13,7 @@
- | 将时间轴改成swiper滑动 | [12384f9](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12384f9) - | 将时间轴改成swiper滑动 | [12384f9](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12384f9)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6) - | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91) - | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91)
- | 设置状态栏 | [9871356](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9871356)
- | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005) - | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005)
- | 时间轴页面 | [e926b75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e926b75) - | 时间轴页面 | [e926b75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e926b75)
- | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8b1b380) - | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8b1b380)

8
apis/tall.js

@ -1,9 +1,9 @@
import Config from '@/common/js/config.js' import Config from '@/common/js/config.js'
// const apiUrl = Config.apiUrl; const apiUrl = Config.apiUrl;
const apiUrl = Config.apiUrlNew; // const apiUrl = Config.apiUrlNew;
// const tall = `${apiUrl}/tall3/v3.0`; const tall = `${apiUrl}/tall3/v3.0`;
const tall = `${apiUrl}/ptostall`; // const tall = `${apiUrl}/ptostall`;
export function setupTall(app) { export function setupTall(app) {
uni.$u.api = { ...uni.$u.api } || {}; uni.$u.api = { ...uni.$u.api } || {};

4
pages/index/index.vue

@ -5,7 +5,7 @@
</view> </view>
<!-- <view class="flex flex-col h-full bg-gray-50" @click="openAuth"> --> <!-- <view class="flex flex-col h-full bg-gray-50" @click="openAuth"> -->
<view class="flex flex-col h-full bg-gray-50"> <theme class="flex flex-col h-full bg-gray-50">
<view class="relative"> <view class="relative">
<!-- <view class="relative" @touchmove="onMove"> --> <!-- <view class="relative" @touchmove="onMove"> -->
<!-- 日历 --> <!-- 日历 -->
@ -26,7 +26,7 @@
<!-- 全局提示框 --> <!-- 全局提示框 -->
<u-top-tips ref="uTips"></u-top-tips> <u-top-tips ref="uTips"></u-top-tips>
</view> </theme>
</template> </template>
<script setup> <script setup>

304
pages/project/project.vue

@ -24,166 +24,172 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, watch, onMounted } from 'vue'; import { ref, computed, watch, onMounted } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import useInit from '@/hooks/project/useInit'; import useInit from '@/hooks/project/useInit';
import useGetTasks from '@/hooks/project/useGetTasks'; import useGetTasks from '@/hooks/project/useGetTasks';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
const initHook = useInit(); const initHook = useInit();
const getTasksHook = useGetTasks(); const getTasksHook = useGetTasks();
const store = useStore(); const store = useStore();
const roleId = computed(() => store.state.role.roleId); const projectId = computed(() => store.getters['project/projectId']);
const timeNode = computed(() => store.state.task.timeNode); const userId = computed(() => store.getters['user/userId']);
const timeUnit = computed(() => store.state.task.timeUnit); const roleId = computed(() => store.state.role.roleId); // id
const projectId = computed(() => store.getters['project/projectId']); const roleIndex = computed(() => store.state.role.roleIndex); //
const userId = computed(() => store.getters['user/userId']); const visibleRoles = computed(() => store.state.role.visibleRoles); //
const newProjectInfo = computed(() => store.state.task.newProjectInfo); const timeNode = computed(() => store.state.task.timeNode); //
const showScrollTo = computed(() => store.state.task.showScrollTo); const timeUnit = computed(() => store.state.task.timeUnit); //
const visibleRoles = computed(() => store.state.role.visibleRoles); const newProjectInfo = computed(() => store.state.task.newProjectInfo);
const allTasks = computed(() => store.state.task.allTasks); const showScrollTo = computed(() => store.state.task.showScrollTo); //
const roleIndex = computed(() => store.state.role.roleIndex); const allTasks = computed(() => store.state.task.allTasks); //
const globals = computed(() => store.getters['task/globals']); const globals = computed(() => store.getters['task/globals']); // +
const timeGranularity = computed(() => store.getters['task/timeGranularity']); const timeGranularity = computed(() => store.getters['task/timeGranularity']); // dayjs add
const height = ref(null); const height = ref(null); //
onMounted(() => { onMounted(() => {
const system = uni.getSystemInfoSync(); const system = uni.getSystemInfoSync();
height.value = `${system.windowHeight}px`; height.value = `${system.windowHeight}px`;
}); });
// /**
function getGlobalData() { * 当角色发生变化时
if(!allTasks.value[roleIndex]) { * 重新查询永久日常任务和普通日常任务
const param = { * 注意: 切换角色后 重新设置了时间基准点 时间基准点一定会变
roleId: roleId.value, * 所以监听时间基准点获取 可变日常任务即可 这里不用获取 避免重复获取
timeNode: timeNode.value, */
timeUnit: timeUnit.value, watch(roleId, newValue => {
projectId: projectId.value, if (newValue) {
}; // allTasks
store.dispatch('task/getGlobal', param); if (allTasks.value.length && allTasks.value[roleIndex.value].global && allTasks.value[roleIndex.value].task)
} return;
// allTasks
console.log('当角色发生变化时', newValue);
store.commit('task/setTimeNode', Date.now());
//
const params = {
roleId: newValue,
projectId: projectId.value,
};
store.dispatch('task/getPermanent', params);
}
});
/**
* 当时间基准点发生变化时
* 重新根据时间和角色查询普通日常任务
* 永久日常任务不发生 改变
*/
watch(timeNode, newValue => {
if (newValue && roleId.value) {
console.log('当时间基准点发生变化时');
clearTasksData();
//
getGlobalData(); //
getTasksHook.initPlanTasks(); //
//
let timer = null;
timer = setInterval(() => {
if (showScrollTo.value) {
clearInterval(timer);
setScrollPosition();
}
}, 300);
}
});
/**
* 当收到打开新项目消息状态时
* 重新根据时间和角色查询普通日常任务
* 永久日常任务不发生改变
*/
watch(newProjectInfo, newValue => {
console.log('当收到打开新项目消息状态时');
if (newValue && newValue.value.projectId && newValue.value.url) {
uni.$u.route('/', {
u: userId.value,
p: newValue.value.projectId,
url: newValue.value.url,
});
clearTasksData();
store.commit('role/setRoleId', '');
const options = uni.$route.query;
initHook.init(options);
}
});
//
function getGlobalData() {
if (!allTasks.value[roleIndex]) {
const param = {
roleId: roleId.value,
timeNode: timeNode.value,
timeUnit: timeUnit.value,
projectId: projectId.value,
};
store.dispatch('task/getGlobal', param);
}
// allTasks
const index = visibleRoles.value.findIndex(role => role.id === roleId.value); const index = visibleRoles.value.findIndex(role => role.id === roleId.value);
const arr = [...allTasks.value]; const arr = [...allTasks.value];
arr[index].global = [...globals.value]; arr[index].global = [...globals.value];
store.commit('task/setAllTasks', arr); store.commit('task/setAllTasks', arr);
}
//
function clearTasksData() {
//
store.commit('task/setPermanents', []);
store.commit('task/setDailyTasks', []);
//
store.commit('task/clearTasks');
//
//
store.commit('task/clearEndFlag');
}
/**
* 当角色发生变化时
* 重新查询永久日常任务和普通日常任务
* 注意: 切换角色后 重新设置了时间基准点 时间基准点一定会变
* 所以监听时间基准点获取 可变日常任务即可 这里不用获取 避免重复获取
*/
watch(roleId, newValue => {
if (newValue) {
// allTasks
if (allTasks.value.length && allTasks.value[roleIndex.value].global && allTasks.value[roleIndex.value].task) return;
console.log('当角色发生变化时', newValue);
store.commit('task/setTimeNode', Date.now());
//
const params = {
roleId: newValue,
projectId: projectId.value,
};
store.dispatch('task/getPermanent', params);
} }
});
//
/** function clearTasksData() {
* 当时间基准点发生变化时 //
* 重新根据时间和角色查询普通日常任务 store.commit('task/setPermanents', []);
* 永久日常任务不发生 改变 store.commit('task/setDailyTasks', []);
*/ //
watch(timeNode, newValue => { store.commit('task/clearTasks');
if (newValue && roleId.value) { //
console.log('当时间基准点发生变化时'); //
clearTasksData(); store.commit('task/clearEndFlag');
// }
getGlobalData(); //
getTasksHook.initPlanTasks(); //
// function getTasks(params) {
let timer = null; getTasksHook.initPlanTasks(params); //
timer = setInterval(() => {
if (showScrollTo.value) {
clearInterval(timer);
setScrollPosition();
}
}, 300);
} }
});
// tabsswiper
/** function tabsChange(e) {
* 当收到打开新项目消息状态时 const {
* 重新根据时间和角色查询普通日常任务 id
* 永久日常任务不发生改变 } = visibleRoles.value[e.detail.current];
*/ store.commit('role/setRoleIndex', e.detail.current);
watch(newProjectInfo, newValue => { store.commit('role/setRoleId', id);
console.log('当收到打开新项目消息状态时');
if (newValue && newValue.value.projectId && newValue.value.url) {
uni.$u.route('/', {
u: userId.value,
p: newValue.value.projectId,
url: newValue.value.url,
});
clearTasksData();
store.commit('role/setRoleId', '');
const options = uni.$route.query;
initHook.init(options);
} }
});
//
function getTasks(params) { function setScrollPosition() {
getTasksHook.initPlanTasks(params); // // storagetaskId id
} const taskId = uni.$storage.getStorageSync('taskId');
if (taskId) {
// tabsswiper store.commit('task/setScrollToTaskId', `a${taskId}`);
function tabsChange(e) { uni.$storage.setStorageSync('taskId', ''); //
const { id } = visibleRoles.value[e.detail.current];
store.commit('role/setRoleIndex', e.detail.current);
store.commit('role/setRoleId', id);
}
//
function setScrollPosition() {
// storagetaskId id
const taskId = uni.$storage.getStorageSync('taskId');
if (taskId) {
store.commit('task/setScrollToTaskId', `a${taskId}`);
uni.$storage.setStorageSync('taskId', ''); //
} else {
const item = allTasks.value[roleIndex.value].task.find(task => task.detailId);
if (item) {
store.commit('task/setScrollToTaskId', `a${item.id}`);
} else { } else {
// taskId const item = allTasks.value[roleIndex.value].task.find(task => task.detailId);
// 线id 线 if (item) {
const task = allTasks.value[roleIndex.value].task.find(item => dayjs(+item.planStart).isSame(timeNode.value, timeGranularity.value)); store.commit('task/setScrollToTaskId', `a${item.id}`);
task && store.commit('task/setScrollToTaskId', `a${task.id}`); // task id } else {
// taskId
// 线id 线
const task = allTasks.value[roleIndex.value].task.find(item => dayjs(+item.planStart).isSame(timeNode.value,
timeGranularity.value));
task && store.commit('task/setScrollToTaskId', `a${task.id}`); // task id
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.border-b { .border-b {
border-bottom: 1px solid #e4e7ed; border-bottom: 1px solid #e4e7ed;
} }
</style> </style>

Loading…
Cancel
Save