Browse Source

Merge branch 'zhangtao' of gitadmin/tuoheng_lc_web into develop

tags/v1.0.0^2
zhangtao 2 years ago
parent
commit
45cfee22c9
3 changed files with 26 additions and 10 deletions
  1. +1
    -1
      src/layout/components/Header/index.vue
  2. +4
    -3
      src/router/guard/permission-guard.js
  3. +21
    -6
      src/views/task-manage/all-task/tools/form.js

+ 1
- 1
src/layout/components/Header/index.vue View File

}) })


const getUserInfo = computed(() => { const getUserInfo = computed(() => {
return userStore.userInfo
return userStore.userInfoMsg
}) })


const getLogoWidth = computed(() => { const getLogoWidth = computed(() => {

+ 4
- 3
src/router/guard/permission-guard.js View File

import { useUserStore } from '@/store/modules/user'
import { usePermissionStore } from '@/store/modules/permission'
import { useUserStore } from '@/store/modules/user.js'
import { usePermissionStore } from '@/store/modules/permission.js'
import { NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '@/router/routes' import { NOT_FOUND_ROUTE, REDIRECT_ROUTE } from '@/router/routes'
import { getToken } from '@/utils/token' import { getToken } from '@/utils/token'


if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' }) next({ path: '/' })
} else { } else {
const hasUsers = !!Object.keys(userStore.userInfoMsg).length
const hasRoutes = !!permissionStore.permissionRoutes.length const hasRoutes = !!permissionStore.permissionRoutes.length
if (!hasUsers) { await userStore.getUserInfo() }
if (hasRoutes) { if (hasRoutes) {
next() next()
} else { } else {
try { try {
// await userStore.getUserInfo()
const routes = await permissionStore.generateRoutes() const routes = await permissionStore.generateRoutes()
routes.forEach((item) => { routes.forEach((item) => {
router.addRoute(item) router.addRoute(item)

+ 21
- 6
src/views/task-manage/all-task/tools/form.js View File

const lineOptions = ref([]) const lineOptions = ref([])


function disableTime(ts) { function disableTime(ts) {
/* 当前日期 */
const DATE = new Date().getDate() const DATE = new Date().getDate()
/* 当前小时 */
const HOURS = new Date().getHours() const HOURS = new Date().getHours()
/* 当前分钟 */
const MINUTES = new Date().getMinutes() const MINUTES = new Date().getMinutes()
/* 当前秒 */
const SECONDS = new Date().getSeconds() const SECONDS = new Date().getSeconds()
/* 选择日期 */
const tDate = new Date(ts).getDate() const tDate = new Date(ts).getDate()
/* 选择小时 */
const tHours = new Date(ts).getHours() const tHours = new Date(ts).getHours()
/* 选择分钟 */
const tMinutes = new Date(ts).getMinutes() const tMinutes = new Date(ts).getMinutes()
return { return {
/* 小时禁用 */
isHourDisabled: (hour) => { isHourDisabled: (hour) => {
/* 选择的日期与当前日期相同,且小于当前时间 */
return tDate === DATE && hour < HOURS return tDate === DATE && hour < HOURS
}, },
/* 分钟禁用 */
isMinuteDisabled: (minute) => { isMinuteDisabled: (minute) => {
/* 日期相同 */
if (tDate === DATE) { if (tDate === DATE) {
if (tHours < HOURS) {
return true
/* 选择小时大于当前小时,则可以全选 */
if (tHours > HOURS) {
return false
} else { } else {
return minute < MINUTES return minute < MINUTES
} }
} }
}, },
isSecondDisabled: (second) => { isSecondDisabled: (second) => {
/* 日期相同 */
if (tDate === DATE) { if (tDate === DATE) {
if (tHours < HOURS) {
return true
} else if (tMinutes < MINUTES) {
return true
/* 选择小时大于当前小时,则可以全选 */
if (tHours > HOURS) {
return false
/* 选择分钟大于当前分钟,则可以全选 */
} else if (tMinutes > MINUTES) {
return false
} else { } else {
return second < SECONDS return second < SECONDS
} }

Loading…
Cancel
Save