6 changed files with 195 additions and 165 deletions
@ -1,102 +1,120 @@ |
|||||
<template> |
<template> |
||||
<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="relative" @touchmove="onMove"> |
<view class="relative" @touchmove="onMove"> |
||||
<!-- 日历 --> |
<!-- 日历 --> |
||||
<Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" /> |
<Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" /> |
||||
<!-- 上传 导入wbs --> |
<!-- 上传 导入wbs --> |
||||
<!-- <Upload @success="onUploadSuccess" @error="onUploadError" /> --> |
<Upload @success="onUploadSuccess" @error="onUploadError" /> |
||||
</view> |
</view> |
||||
|
|
||||
<!-- 项目列表 --> |
<!-- 项目列表 --> |
||||
<Projects @getProjects="getProjects" class="flex-1 overflow-y-auto" /> |
<Projects @getProjects="getProjects" class="flex-1 overflow-y-auto" /> |
||||
|
|
||||
<!-- 全局提示框 --> |
<!-- 全局提示框 --> |
||||
<u-top-tips ref="uTips"></u-top-tips> |
<u-top-tips ref="uTips"></u-top-tips> |
||||
</view> |
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup> |
<script setup> |
||||
import { reactive, ref, onMounted, computed, watch } from 'vue'; |
import { reactive, ref, onMounted, computed, watch } from 'vue'; |
||||
import { useStore } from 'vuex'; |
import { useStore } from 'vuex'; |
||||
import dayjs from 'dayjs'; |
import dayjs from 'dayjs'; |
||||
|
|
||||
const data = reactive({ |
const data = reactive({ |
||||
calendar: null, |
calendar: null, |
||||
days: [], |
days: [], |
||||
}); |
}); |
||||
|
|
||||
const height = ref(null); |
const height = ref(null); |
||||
const store = useStore(); |
const store = useStore(); |
||||
const token = computed(() => store.state.user.token); |
const token = computed(() => store.state.user.token); |
||||
|
|
||||
onMounted(() => { |
onMounted(() => { |
||||
const system = uni.getSystemInfoSync(); |
const system = uni.getSystemInfoSync(); |
||||
height.value = `${system.windowHeight}px`; |
height.value = `${system.windowHeight}px`; |
||||
}); |
}); |
||||
|
|
||||
const handleFindPoint = async (start, end) => { |
const handleFindPoint = async (start, end) => { |
||||
try { |
try { |
||||
const startTime = start |
const startTime = start |
||||
|| dayjs() |
|| dayjs() |
||||
.startOf('month') |
.startOf('month') |
||||
.valueOf(); |
.valueOf(); |
||||
const endTime = end |
const endTime = end |
||||
|| dayjs() |
|| dayjs() |
||||
.endOf('month') |
.endOf('month') |
||||
.valueOf(); |
.valueOf(); |
||||
const res = await uni.$u.api.findRedPoint(startTime, endTime); |
const res = await uni.$u.api.findRedPoint(startTime, endTime); |
||||
store.commit('project/setDotList', res); |
store.commit('project/setDotList', res); |
||||
} catch (error) { |
} catch (error) { |
||||
console.log('error: ', error); |
console.log('error: ', error); |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
// 监听token |
// 监听token |
||||
watch( |
watch( |
||||
() => token.value, |
() => token.value, |
||||
newValue => { |
newValue => { |
||||
if (!newValue) return; |
if (!newValue) return; |
||||
if (newValue) { |
if (newValue) { |
||||
handleFindPoint(); |
handleFindPoint(); |
||||
} |
} |
||||
}, |
}, |
||||
{ immediate: true }, |
{ immediate: true }, |
||||
); |
); |
||||
|
|
||||
// 点击了某个日期 |
// 点击了某个日期 |
||||
const onDateChange = event => { |
const onDateChange = event => { |
||||
// const day = dayjs(event.fullDate); |
// const day = dayjs(event.fullDate); |
||||
// const start = day.startOf('date').valueOf(); |
// const start = day.startOf('date').valueOf(); |
||||
// const end = day.endOf('date').valueOf(); |
// const end = day.endOf('date').valueOf(); |
||||
// this.getProjects(start, end); |
// this.getProjects(start, end); |
||||
}; |
}; |
||||
|
|
||||
</script> |
// 导入成功 |
||||
|
const onUploadSuccess = () => { |
||||
<style> |
uni.$refs.uTips.show({ |
||||
.content { |
title: '导入成功,即将打开新项目', |
||||
display: flex; |
type: 'success', |
||||
flex-direction: column; |
duration: '3000', |
||||
align-items: center; |
}); |
||||
justify-content: center; |
}; |
||||
} |
|
||||
|
// 导入失败 |
||||
.logo { |
const onUploadError = error => { |
||||
height: 200rpx; |
uni.$refs.uTips.show({ |
||||
width: 200rpx; |
title: error || '导入失败', |
||||
margin-top: 200rpx; |
type: 'error', |
||||
margin-left: auto; |
duration: '6000', |
||||
margin-right: auto; |
}); |
||||
margin-bottom: 50rpx; |
}; |
||||
} |
|
||||
|
</script> |
||||
.text-area { |
|
||||
display: flex; |
<style> |
||||
justify-content: center; |
.content { |
||||
} |
display: flex; |
||||
|
flex-direction: column; |
||||
.title { |
align-items: center; |
||||
font-size: 36rpx; |
justify-content: center; |
||||
color: #8f8f94; |
} |
||||
} |
|
||||
|
.logo { |
||||
|
height: 200rpx; |
||||
|
width: 200rpx; |
||||
|
margin-top: 200rpx; |
||||
|
margin-left: auto; |
||||
|
margin-right: auto; |
||||
|
margin-bottom: 50rpx; |
||||
|
} |
||||
|
|
||||
|
.text-area { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.title { |
||||
|
font-size: 36rpx; |
||||
|
color: #8f8f94; |
||||
|
} |
||||
</style> |
</style> |
||||
|
|||||
Loading…
Reference in new issue