14 changed files with 443 additions and 227 deletions
@ -1,11 +1,12 @@ |
|||||
import store from '@/store/index.js'; |
import store from '@/store/index.js'; |
||||
|
import { computed } from 'vue'; |
||||
|
|
||||
const domain = store.state.domain; |
const domain = computed(() => store.state.domain); |
||||
|
|
||||
export function setupRole(app) { |
export function setupRole(app) { |
||||
uni.$u.api = { ...uni.$u.api } || {}; |
uni.$u.api = { ...uni.$u.api } || {}; |
||||
//根据项目id查找角色
|
//根据项目id查找角色
|
||||
uni.$u.api.findShowRole = param => uni.$u.post(`${domain}/role/show`, param); |
uni.$u.api.findShowRole = param => uni.$u.post(`${domain.value}/tall/role/show`, param); |
||||
//根据项目id查找所有成员
|
//根据项目id查找所有成员
|
||||
uni.$u.api.queryChecker = param => uni.$u.post(`${domain}/deliver/queryChecker`, param); |
uni.$u.api.queryChecker = param => uni.$u.post(`${domain.value}/deliver/queryChecker`, param); |
||||
}; |
}; |
||||
|
|||||
@ -1,19 +1,20 @@ |
|||||
import store from '@/store/index.js'; |
import store from '@/store/index.js'; |
||||
|
import { computed } from 'vue'; |
||||
|
|
||||
const domain = store.state.domain; |
const domain = computed(() => store.state.domain); |
||||
|
|
||||
export function setupTask(app) { |
export function setupTask(app) { |
||||
uni.$u.api = { ...uni.$u.api } || {}; |
uni.$u.api = { ...uni.$u.api } || {}; |
||||
uni.$u.api.getGlobal = param => uni.$u.post(`${domain}/task/global`, param); |
uni.$u.api.getGlobal = param => uni.$u.post(`${domain.value}/tall/task/global`, param); |
||||
uni.$u.api.getPermanent = param => uni.$u.post(`${domain}/task/permanent`, param); |
uni.$u.api.getPermanent = param => uni.$u.post(`${domain.value}/tall/task/permanent`, param); |
||||
//根据时间基准点和角色查找定期任务
|
//根据时间基准点和角色查找定期任务
|
||||
uni.$u.api.getRegularTask = param => uni.$u.post(`${domain}/task/regular`, param); |
uni.$u.api.getRegularTask = param => uni.$u.post(`${domain.value}/tall/task/regular`, param); |
||||
//修改任务状态
|
//修改任务状态
|
||||
uni.$u.api.updateTaskType = param => uni.$u.post(`${domain}/task/type`, param); |
uni.$u.api.updateTaskType = param => uni.$u.post(`${domain.value}/task/type`, param); |
||||
//新建任务
|
//新建任务
|
||||
uni.$u.api.saveTask = param => uni.$u.post(`${domain}/task/save`, param); |
uni.$u.api.saveTask = param => uni.$u.post(`${domain.value}/task/save`, param); |
||||
//克隆任务
|
//克隆任务
|
||||
uni.$u.api.cloneTask = param => uni.$u.post(`${domain}/task/clone`, param); |
uni.$u.api.cloneTask = param => uni.$u.post(`${domain.value}/task/clone`, param); |
||||
//模糊查询 查找项目下的任务
|
//模糊查询 查找项目下的任务
|
||||
uni.$u.api.queryTaskOfProject = param => uni.$u.post(`${domain}/task/queryTaskOfProject`, param); |
uni.$u.api.queryTaskOfProject = param => uni.$u.post(`${domain.value}/task/queryTaskOfProject`, param); |
||||
}; |
}; |
||||
|
|||||
|
After Width: | Height: | Size: 515 KiB |
@ -1,163 +1,165 @@ |
|||||
<template> |
<template> |
||||
<!-- 这里是适配的状态栏的代码 --> |
<!-- 这里是适配的状态栏的代码 --> |
||||
<view class="statbar"> |
<view class="statbar"> |
||||
<view class="status_bar"></view> |
<view class="status_bar"></view> |
||||
</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"> --> |
||||
<theme 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"> --> |
||||
<!-- 日历 --> |
<!-- 日历 --> |
||||
<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> |
||||
|
|
||||
<u-button class="mt-4" @click="toLogin">登录</u-button> |
<u-button class="mt-4" @click="toLogin">登录</u-button> |
||||
<!-- 项目列表 --> |
<!-- 项目列表 --> |
||||
<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> |
||||
</theme> |
</theme> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup> |
<script setup> |
||||
import { reactive, computed, watchEffect, ref } from 'vue'; |
import { reactive, computed, watchEffect, ref } from 'vue'; |
||||
import { useStore } from 'vuex'; |
import { useStore } from 'vuex'; |
||||
import dayjs from 'dayjs'; |
import dayjs from 'dayjs'; |
||||
|
|
||||
const store = useStore(); |
const store = useStore(); |
||||
const token = computed(() => store.state.user.token); |
const token = computed(() => store.state.user.token); |
||||
const uTips = ref(null); |
const uTips = ref(null); |
||||
|
|
||||
const data = reactive({ |
const data = reactive({ |
||||
calendar: null, |
calendar: null, |
||||
// days: [], |
// days: [], |
||||
}); |
}); |
||||
|
|
||||
getProjects(); |
getProjects(); |
||||
handleFindPoint(); |
handleFindPoint(); |
||||
|
|
||||
// 监听token |
// 监听token |
||||
// watchEffect(() => { |
// watchEffect(() => { |
||||
// if (!token.value) return; |
// if (!token.value) return; |
||||
// if (token.value) { |
// if (token.value) { |
||||
// getProjects(); |
// getProjects(); |
||||
// handleFindPoint(); |
// handleFindPoint(); |
||||
// } |
// } |
||||
// }); |
// }); |
||||
|
|
||||
// 获取项目列表 |
// 获取项目列表 |
||||
function getProjects(start = dayjs().startOf('day').valueOf(), end = dayjs().endOf('day').valueOf()) { |
function getProjects(start = dayjs().startOf('day').valueOf(), end = dayjs().endOf('day').valueOf()) { |
||||
uni.$catchReq.getProjects(start, end, (err, data) => { |
uni.$catchReq.getProjects(start, end, (err, data) => { |
||||
if (err) { |
if (err) { |
||||
console.error('err: ', err); |
console.error('err: ', err); |
||||
} else { |
} else { |
||||
data.forEach(item => { |
data.forEach(item => { |
||||
item.show = false; |
item.show = false; |
||||
}); |
}); |
||||
store.commit('project/setProjects', data); |
store.commit('project/setProjects', data); |
||||
} |
} |
||||
}); |
}); |
||||
} |
} |
||||
|
|
||||
async function handleFindPoint(start, end) { |
async function handleFindPoint(start, end) { |
||||
try { |
try { |
||||
const startTime = start || dayjs().startOf('month').valueOf(); |
const startTime = start || dayjs().startOf('month').valueOf(); |
||||
const endTime = end || dayjs().endOf('month').valueOf(); |
const endTime = end || dayjs().endOf('month').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); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
// 点击了某个日期 |
// 点击了某个日期 |
||||
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(); |
||||
getProjects(start, end); |
getProjects(start, end); |
||||
}; |
}; |
||||
|
|
||||
// 导入成功 |
// 导入成功 |
||||
const onUploadSuccess = () => { |
const onUploadSuccess = () => { |
||||
uni.$ui.showToast('导入成功,即将打开新项目', 3000); |
uni.$ui.showToast('导入成功,即将打开新项目', 3000); |
||||
// uTips.show({ |
// uTips.show({ |
||||
// title: '导入成功,即将打开新项目', |
// title: '导入成功,即将打开新项目', |
||||
// type: 'success', |
// type: 'success', |
||||
// duration: '3000', |
// duration: '3000', |
||||
// }); |
// }); |
||||
}; |
}; |
||||
|
|
||||
// 导入失败 |
// 导入失败 |
||||
const onUploadError = error => { |
const onUploadError = error => { |
||||
uni.$ui.showToast('导入失败', 6000); |
uni.$ui.showToast('导入失败', 6000); |
||||
// uTips.show({ |
// uTips.show({ |
||||
// title: error || '导入失败', |
// title: error || '导入失败', |
||||
// type: 'error', |
// type: 'error', |
||||
// duration: '6000', |
// duration: '6000', |
||||
// }); |
// }); |
||||
}; |
}; |
||||
|
|
||||
// 监听触摸滑动 切换日历的模式 月/周 |
// 监听触摸滑动 切换日历的模式 月/周 |
||||
// function onMove(event) { |
// function onMove(event) { |
||||
// const y = event.changedTouches[0].pageY; |
// const y = event.changedTouches[0].pageY; |
||||
// const prevY = 0; |
// const prevY = 0; |
||||
// if (y - prevY > 0) { |
// if (y - prevY > 0) { |
||||
// // 向下滑动 如果是周视图weekMode=true 就 变成 月视图weekMode=false |
// // 向下滑动 如果是周视图weekMode=true 就 变成 月视图weekMode=false |
||||
// data.calendar.weekMode && (data.calendar.weekMode = false); |
// data.calendar.weekMode && (data.calendar.weekMode = false); |
||||
// } else if (y - prevY < 0) { |
// } else if (y - prevY < 0) { |
||||
// // 向上滑动 如果是月视图weekMode=false 就变成 周视图weekMode=true |
// // 向上滑动 如果是月视图weekMode=false 就变成 周视图weekMode=true |
||||
// !data.calendar.weekMode && (data.calendar.weekMode = true); |
// !data.calendar.weekMode && (data.calendar.weekMode = true); |
||||
// } |
// } |
||||
// prevY = y; |
// prevY = y; |
||||
// data.calendar.initDate(); |
// data.calendar.initDate(); |
||||
// } |
// } |
||||
|
|
||||
function toLogin() { |
function toLogin() { |
||||
uni.navigateTo({ url: '/pages/user/login' }); |
uni.navigateTo({ |
||||
} |
url: '/pages/user/login' |
||||
</script> |
}); |
||||
|
} |
||||
<style lang="scss" scoped> |
</script> |
||||
.statbar { |
|
||||
width: 750rpx; |
<style lang="scss" scoped> |
||||
height: var(--status-bar-height); |
.statbar { |
||||
|
width: 750rpx; |
||||
.status_bar { |
height: var(--status-bar-height); |
||||
height: var(--status-bar-height); |
|
||||
width: 100%; |
.status_bar { |
||||
position: absolute; |
height: var(--status-bar-height); |
||||
} |
width: 100%; |
||||
} |
position: absolute; |
||||
|
} |
||||
.content { |
} |
||||
display: flex; |
|
||||
flex-direction: column; |
.content { |
||||
align-items: center; |
display: flex; |
||||
justify-content: center; |
flex-direction: column; |
||||
} |
align-items: center; |
||||
|
justify-content: center; |
||||
.logo { |
} |
||||
height: 200rpx; |
|
||||
width: 200rpx; |
.logo { |
||||
margin-top: 200rpx; |
height: 200rpx; |
||||
margin-left: auto; |
width: 200rpx; |
||||
margin-right: auto; |
margin-top: 200rpx; |
||||
margin-bottom: 50rpx; |
margin-left: auto; |
||||
} |
margin-right: auto; |
||||
|
margin-bottom: 50rpx; |
||||
.text-area { |
} |
||||
display: flex; |
|
||||
justify-content: center; |
.text-area { |
||||
} |
display: flex; |
||||
|
justify-content: center; |
||||
.title { |
} |
||||
font-size: 36rpx; |
|
||||
color: #8f8f94; |
.title { |
||||
} |
font-size: 36rpx; |
||||
|
color: #8f8f94; |
||||
|
} |
||||
</style> |
</style> |
||||
|
|||||
Loading…
Reference in new issue