@opendesign-plus/components 0.0.1-rc.10 → 0.0.1-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-OElCookieNotice.cjs.js +1 -1
- package/dist/chunk-OElCookieNotice.es.js +47 -41
- package/dist/components/activity/composables/useActivityConfig.d.ts +17 -0
- package/dist/components/activity/config.d.ts +0 -14
- package/dist/components/meeting/composables/useMeetingConfig.d.ts +14 -0
- package/dist/components/meeting/config.d.ts +1 -16
- package/dist/components/meeting/types.d.ts +1 -0
- package/dist/components/meeting/utils.d.ts +1 -15
- package/dist/components.cjs.js +39 -39
- package/dist/components.css +1 -1
- package/dist/components.es.js +10456 -10473
- package/package.json +1 -1
- package/src/components/activity/OActivityApproval.vue +3 -4
- package/src/components/activity/OActivityForm.vue +5 -4
- package/src/components/activity/OMyActivityCalendar.vue +11 -12
- package/src/components/activity/composables/useActivityConfig.ts +141 -0
- package/src/components/activity/config.ts +1 -141
- package/src/components/meeting/OMeetingCalendar.vue +7 -9
- package/src/components/meeting/OMeetingForm.vue +11 -18
- package/src/components/meeting/OMyMeetingCalendar.vue +4 -8
- package/src/components/meeting/OSigMeetingCalendar.vue +3 -5
- package/src/components/meeting/components/OMeetingCalendarList.vue +7 -8
- package/src/components/meeting/components/OMeetingDetail.vue +9 -8
- package/src/components/meeting/components/OSigMeetingAside.vue +3 -1
- package/src/components/meeting/composables/useMeetingConfig.ts +111 -0
- package/src/components/meeting/config.ts +58 -120
- package/src/components/meeting/types.ts +1 -0
- package/src/components/meeting/utils.ts +69 -122
- package/src/i18n/en.ts +18 -15
- package/src/i18n/zh.ts +3 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { OLink } from '@opensig/opendesign';
|
|
3
3
|
import { computed, ref } from 'vue';
|
|
4
|
-
import { CalendarDataType, MeetingItemT } from '
|
|
4
|
+
import { CalendarDataType, MeetingItemT } from '../types.ts';
|
|
5
5
|
import MoreText from '@/components/common/MoreText.vue';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { formatDate } from '@/components/meeting/utils.ts';
|
|
7
|
+
import { useMeetingConfig } from '../composables/useMeetingConfig';
|
|
8
8
|
|
|
9
9
|
const props = defineProps<{
|
|
10
10
|
data: MeetingItemT;
|
|
11
11
|
from?: string;
|
|
12
12
|
show: boolean;
|
|
13
13
|
}>();
|
|
14
|
-
const { t,
|
|
15
|
-
|
|
14
|
+
const { t, getPlatformLabel } = useMeetingConfig();
|
|
15
|
+
|
|
16
16
|
// 会议详情配置
|
|
17
17
|
const infoList = computed(() =>
|
|
18
18
|
[
|
|
@@ -29,8 +29,9 @@ const infoList = computed(() =>
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
const activityInfoList = computed(() => {
|
|
32
|
-
const isLive = props.data.
|
|
32
|
+
const isLive = props.data.live_url?.length > 0;
|
|
33
33
|
return [
|
|
34
|
+
{ label: t('meeting.activityDetail2'), key: 'agenda', ellipsis: true },
|
|
34
35
|
{ label: t('meeting.startDate'), key: 'start_date_time' },
|
|
35
36
|
{ label: t('meeting.endDate'), key: 'end_date_time' },
|
|
36
37
|
{ label: t('meeting.registrationDeadline'), key: 'register_end_date' },
|
|
@@ -38,10 +39,10 @@ const activityInfoList = computed(() => {
|
|
|
38
39
|
{ label: t('meeting.activityDetailUrl'), key: 'content_url', isLink: true },
|
|
39
40
|
{ label: t('meeting.activityApprover'), key: 'approver' },
|
|
40
41
|
{ label: t('meeting.reviewNotesLabel'), key: 'approve_record', isRecord: true },
|
|
41
|
-
].slice(0, props.from === 'home' ?
|
|
42
|
+
].slice(0, props.from === 'home' ? 5 : 8);
|
|
42
43
|
});
|
|
43
44
|
const activityInfoApprovalList = computed(() => {
|
|
44
|
-
const isLive = props.data.
|
|
45
|
+
const isLive = props.data.live_url?.length > 0;
|
|
45
46
|
return [
|
|
46
47
|
{ label: t('meeting.activityType'), key: 'activity_type', isType: true },
|
|
47
48
|
{ label: isLive ? t('meeting.livePlatform') : t('meeting.activityAddress'), key: 'address' },
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { OIcon, OIconArrowLeft, OIconArrowRight } from '@opensig/opendesign';
|
|
3
3
|
import IconMeetinging from '~icons/meeting/icon-meet.svg';
|
|
4
|
-
import {
|
|
4
|
+
import { useMeetingConfig } from '@/components/meeting/composables/useMeetingConfig';
|
|
5
5
|
import { CalendarDataType } from '@/components/meeting';
|
|
6
6
|
|
|
7
|
+
const { getConfig } = useMeetingConfig();
|
|
8
|
+
|
|
7
9
|
const props = defineProps<{
|
|
8
10
|
data: any[];
|
|
9
11
|
current: number;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { useI18n } from '@/i18n';
|
|
4
|
+
import IconAll from '~icons/meeting/icon-all.svg';
|
|
5
|
+
import IconEvent from '~icons/meeting/icon-event.svg';
|
|
6
|
+
import IconMeeting from '~icons/meeting/icon-meet.svg';
|
|
7
|
+
import IconSummit from '~icons/meeting/icon-summit.svg';
|
|
8
|
+
import { CalendarDataType, meetingTabT, OptionItemT } from '../types';
|
|
9
|
+
import { INTERVAL_DAY, INTERVAL_MONTH, INTERVAL_WEEK, TYPE_COLOR_MAP } from '../config';
|
|
10
|
+
|
|
11
|
+
export const useMeetingConfig = () => {
|
|
12
|
+
const { t, locale } = useI18n();
|
|
13
|
+
|
|
14
|
+
const meetingTabs = computed<meetingTabT[]>(() => [
|
|
15
|
+
{ label: t('meeting.meetingTypeAll'), value: CalendarDataType.ALL, icon: IconAll },
|
|
16
|
+
{ label: t('meeting.meetingTypeMeet'), value: CalendarDataType.MEETING, icon: IconMeeting, color: TYPE_COLOR_MAP.meeting, zIndex: 3 },
|
|
17
|
+
{ label: t('meeting.meetingTypeEvents'), value: CalendarDataType.EVENTS, icon: IconEvent, color: TYPE_COLOR_MAP.events, zIndex: 2 },
|
|
18
|
+
{ label: t('meeting.meetingTypeSummit'), value: CalendarDataType.SUMMIT, icon: IconSummit, color: TYPE_COLOR_MAP.summit, zIndex: 1 },
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const cycleTypeOptions0 = computed<OptionItemT[]>(() => [
|
|
22
|
+
{ label: t('meeting.day0'), value: INTERVAL_DAY, max: 7 },
|
|
23
|
+
{ label: t('meeting.week0'), value: INTERVAL_WEEK, max: 2 },
|
|
24
|
+
{ label: t('meeting.month0'), value: INTERVAL_MONTH, max: 1 },
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const cycleTypeOptions = computed<OptionItemT[]>(() => [
|
|
28
|
+
{ label: t('meeting.day'), value: INTERVAL_DAY, max: 7 },
|
|
29
|
+
{ label: t('meeting.week'), value: INTERVAL_WEEK, max: 2 },
|
|
30
|
+
{ label: t('meeting.month'), value: INTERVAL_MONTH, max: 1 },
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
const weekDay = computed(() => [
|
|
34
|
+
t('meeting.sunday'),
|
|
35
|
+
t('meeting.monday'),
|
|
36
|
+
t('meeting.tuesday'),
|
|
37
|
+
t('meeting.wednesday'),
|
|
38
|
+
t('meeting.thursday'),
|
|
39
|
+
t('meeting.friday'),
|
|
40
|
+
t('meeting.saturday'),
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
const intervalWeekOptions = computed(() => {
|
|
44
|
+
const list: OptionItemT[] = [];
|
|
45
|
+
for (let i = 1; i <= 7; i++) {
|
|
46
|
+
const idx = i % 7;
|
|
47
|
+
list.push({ value: idx, label: weekDay.value[idx] });
|
|
48
|
+
}
|
|
49
|
+
return list;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const getPointStr = (cycleType: number, points: number[]) => {
|
|
53
|
+
if (cycleType === INTERVAL_WEEK) {
|
|
54
|
+
return points
|
|
55
|
+
.sort((a, b) => {
|
|
56
|
+
const aIdx = intervalWeekOptions.value.findIndex((v) => v.value === a);
|
|
57
|
+
const bIdx = intervalWeekOptions.value.findIndex((v) => v.value === b);
|
|
58
|
+
return aIdx - bIdx;
|
|
59
|
+
})
|
|
60
|
+
.map((point: number) => {
|
|
61
|
+
const opt = intervalWeekOptions.value.find((v) => v.value === point);
|
|
62
|
+
return opt?.label || String(point);
|
|
63
|
+
})
|
|
64
|
+
.join(t('meeting.cycleSplit'));
|
|
65
|
+
}
|
|
66
|
+
if (cycleType === INTERVAL_MONTH) {
|
|
67
|
+
return points.join(t('meeting.cycleSplit'));
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getConfig = (val: CalendarDataType, key: keyof meetingTabT): string => {
|
|
73
|
+
let value = val;
|
|
74
|
+
if (val === CalendarDataType.ACTIVITY) {
|
|
75
|
+
value = CalendarDataType.EVENTS;
|
|
76
|
+
}
|
|
77
|
+
const find: meetingTabT | undefined = meetingTabs.value.find(v => v.value === value);
|
|
78
|
+
return find?.[key] || '';
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const getPlatformLabel = (platform: string) => {
|
|
82
|
+
switch (platform) {
|
|
83
|
+
case 'WELINK':
|
|
84
|
+
return 'WeLink';
|
|
85
|
+
case 'ZOOM':
|
|
86
|
+
return 'Zoom';
|
|
87
|
+
case 'TENCENT':
|
|
88
|
+
return locale.value === 'zh' ? '腾讯会议' : 'Tencent';
|
|
89
|
+
default:
|
|
90
|
+
return platform;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const getWeekFromDate = (date: string | Date) => {
|
|
95
|
+
return weekDay.value[dayjs(date).day()];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
t,
|
|
100
|
+
locale,
|
|
101
|
+
meetingTabs,
|
|
102
|
+
cycleTypeOptions0,
|
|
103
|
+
cycleTypeOptions,
|
|
104
|
+
weekDay,
|
|
105
|
+
intervalWeekOptions,
|
|
106
|
+
getPointStr,
|
|
107
|
+
getConfig,
|
|
108
|
+
getPlatformLabel,
|
|
109
|
+
getWeekFromDate,
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -1,121 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return 'var(--o-color-primary1)';
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const TYPE_COLOR_MAP = {
|
|
22
|
-
summit: 'rgba(var(--o-orange-6))',
|
|
23
|
-
events: 'rgba(var(--o-cyan-6))',
|
|
24
|
-
meeting: getMeetingColor(),
|
|
1
|
+
import { CalendarDataType, meetingTabT } from './types.ts';
|
|
2
|
+
import IconAll from '~icons/meeting/icon-all.svg';
|
|
3
|
+
import IconEvent from '~icons/meeting/icon-event.svg';
|
|
4
|
+
import IconMeeting from '~icons/meeting/icon-meet.svg';
|
|
5
|
+
import IconSummit from '~icons/meeting/icon-summit.svg';
|
|
6
|
+
|
|
7
|
+
const getMeetingColor = () => {
|
|
8
|
+
if (typeof document !== 'undefined') {
|
|
9
|
+
const deepBlue = getComputedStyle(document.documentElement)
|
|
10
|
+
.getPropertyValue('--o-deep-blue-6')?.trim();
|
|
11
|
+
if (deepBlue) {
|
|
12
|
+
return 'rgba(var(--o-deep-blue-6))';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return 'var(--o-color-primary1)';
|
|
25
16
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
label: t('meeting.
|
|
63
|
-
value:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
max: 2,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: t('meeting.month0'),
|
|
73
|
-
value: INTERVAL_MONTH,
|
|
74
|
-
max: 1,
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
export const CYCLE_TYPE_OPTIONS = [
|
|
78
|
-
{
|
|
79
|
-
label: t('meeting.day'),
|
|
80
|
-
value: INTERVAL_DAY,
|
|
81
|
-
max: 7,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
label: t('meeting.week'),
|
|
85
|
-
value: INTERVAL_WEEK,
|
|
86
|
-
max: 2,
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: t('meeting.month'),
|
|
90
|
-
value: INTERVAL_MONTH,
|
|
91
|
-
max: 1,
|
|
92
|
-
},
|
|
93
|
-
];
|
|
94
|
-
export const WEEKDAY = [
|
|
95
|
-
t('meeting.sunday'),
|
|
96
|
-
t('meeting.monday'),
|
|
97
|
-
t('meeting.tuesday'),
|
|
98
|
-
t('meeting.wednesday'),
|
|
99
|
-
t('meeting.thursday'),
|
|
100
|
-
t('meeting.friday'),
|
|
101
|
-
t('meeting.saturday'),
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
const getWeekOptions = () => {
|
|
105
|
-
const list = [];
|
|
106
|
-
for (let i = 1; i <= 7; i++) {
|
|
107
|
-
const idx = i % 7;
|
|
108
|
-
list.push({
|
|
109
|
-
value: idx,
|
|
110
|
-
label: WEEKDAY[idx],
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return list;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export const INTERVAL_WEEK_OPTIONS = getWeekOptions();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
export const EMAIL_REGEX = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
|
120
|
-
|
|
121
|
-
export const PROGRESS_COLORS = ['var(--o-color-primary1)', 'var(--o-color-warning1)', 'var(--o-color-success1)'];
|
|
17
|
+
|
|
18
|
+
export const TYPE_COLOR_MAP = {
|
|
19
|
+
summit: 'rgba(var(--o-orange-6))',
|
|
20
|
+
events: 'rgba(var(--o-cyan-6))',
|
|
21
|
+
meeting: getMeetingColor(),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const INTERVAL_DAY = 0;
|
|
25
|
+
export const INTERVAL_WEEK = 1;
|
|
26
|
+
export const INTERVAL_MONTH = 2;
|
|
27
|
+
|
|
28
|
+
export const EMAIL_REGEX = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
|
29
|
+
|
|
30
|
+
export const PROGRESS_COLORS = ['var(--o-color-primary1)', 'var(--o-color-warning1)', 'var(--o-color-success1)'];
|
|
31
|
+
|
|
32
|
+
export const getMeetingTabs = (t: (key: string) => string): meetingTabT[] => [
|
|
33
|
+
{
|
|
34
|
+
label: t('meeting.meetingTypeAll'),
|
|
35
|
+
value: CalendarDataType.ALL,
|
|
36
|
+
icon: IconAll,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: t('meeting.meetingTypeMeet'),
|
|
40
|
+
value: CalendarDataType.MEETING,
|
|
41
|
+
icon: IconMeeting,
|
|
42
|
+
color: TYPE_COLOR_MAP.meeting,
|
|
43
|
+
zIndex: 3,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: t('meeting.meetingTypeEvents'),
|
|
47
|
+
value: CalendarDataType.EVENTS,
|
|
48
|
+
icon: IconEvent,
|
|
49
|
+
color: TYPE_COLOR_MAP.events,
|
|
50
|
+
zIndex: 2,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: t('meeting.meetingTypeSummit'),
|
|
54
|
+
value: CalendarDataType.SUMMIT,
|
|
55
|
+
icon: IconSummit,
|
|
56
|
+
color: TYPE_COLOR_MAP.summit,
|
|
57
|
+
zIndex: 1,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
@@ -1,123 +1,70 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export const
|
|
57
|
-
const arr
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const formatNumber = (num: number) => {
|
|
72
|
-
if (num < 0) return 'Invalid number';
|
|
73
|
-
if (num >= 10) return `${ num }`;
|
|
74
|
-
return `0${ num }`;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const formatDateNumber = (num: number) => {
|
|
78
|
-
if (num > 24 * 60 * 60) return 'Invalid date';
|
|
79
|
-
const h = Math.floor(num / 60 / 60);
|
|
80
|
-
const m = Math.floor((num - h * 60 * 60) / 60);
|
|
81
|
-
const s = num % 60;
|
|
82
|
-
return `${ formatNumber(h) }:${ formatNumber(m) }:${ formatNumber(s) }`;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// 时分秒 转换成 以秒为单位的格式 - xx秒
|
|
86
|
-
export const transformTime = (time: string) => {
|
|
87
|
-
const arr = time.split(':');
|
|
88
|
-
const hh = arr[arr.length - 3] ? parseInt(arr[arr.length - 3]) : 0;
|
|
89
|
-
const mm = parseInt(arr[arr.length - 2]);
|
|
90
|
-
const ss = parseFloat(arr[arr.length - 1]);
|
|
91
|
-
|
|
92
|
-
return hh * 60 * 60 + mm * 60 + ss;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// 以秒为单位的格式 转换成 时分秒 - hh:mm:ss
|
|
96
|
-
export const transformSeconds = (seconds: number) => {
|
|
97
|
-
const hh = Math.floor(seconds / 3600);
|
|
98
|
-
const mm = Math.floor((seconds - hh * 3600) / 60);
|
|
99
|
-
const ss = Math.floor(seconds - hh * 3600 - mm * 60);
|
|
100
|
-
return `${ hh ? `${ hh.toString().padStart(2, '0') }:` : '' }${ mm.toString().padStart(2, '0') }:${ ss.toString().padStart(2, '0') }`;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const getConfig = (val: CalendarDataType, key: keyof meetingTabT): string => {
|
|
104
|
-
let value = val;
|
|
105
|
-
if (val === CalendarDataType.ACTIVITY) {
|
|
106
|
-
value = CalendarDataType.EVENTS;
|
|
107
|
-
}
|
|
108
|
-
const find: meetingTabT = MEETING_TABS.find(v => v.value === value)!;
|
|
109
|
-
return find?.[key] || '';
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export const getPlatformLabel = (platform: string) => {
|
|
113
|
-
switch (platform) {
|
|
114
|
-
case 'WELINK':
|
|
115
|
-
return 'WeLink';
|
|
116
|
-
case 'ZOOM':
|
|
117
|
-
return 'Zoom';
|
|
118
|
-
case 'TENCENT':
|
|
119
|
-
return '腾讯会议';
|
|
120
|
-
default:
|
|
121
|
-
return platform;
|
|
122
|
-
}
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { OptionItemT } from './types';
|
|
3
|
+
|
|
4
|
+
export const formatDate = (date: string | Date = new Date(), format: string = 'YYYY-MM-DD'): string => {
|
|
5
|
+
let dateStr = date;
|
|
6
|
+
if (!dateStr) {
|
|
7
|
+
dateStr = new Date();
|
|
8
|
+
}
|
|
9
|
+
if (!dayjs(new Date(dateStr)).isValid()) {
|
|
10
|
+
return dateStr as string;
|
|
11
|
+
}
|
|
12
|
+
return dayjs(new Date(dateStr)).format(format);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const findLabelFromOptions = (value: string | number, options: OptionItemT[], labelKey: keyof OptionItemT = 'label', valueKey: keyof OptionItemT = 'value') => {
|
|
16
|
+
const find = options.find((o) => o[valueKey] === value);
|
|
17
|
+
return find?.[labelKey] || value;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const speakerNum = (val: string) => {
|
|
21
|
+
const regex = /\d+/g;
|
|
22
|
+
const match = val.match(regex) || '';
|
|
23
|
+
|
|
24
|
+
return parseInt(match[0]);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const getDateNumber = (date: string) => {
|
|
28
|
+
const arr: string[] = date.split(':');
|
|
29
|
+
if (arr.length > 3 || !arr.length) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
let res = 0;
|
|
33
|
+
let base = 1;
|
|
34
|
+
while (arr.length > 0) {
|
|
35
|
+
const current = arr.pop();
|
|
36
|
+
res += parseInt(current!) * base;
|
|
37
|
+
base *= 60;
|
|
38
|
+
}
|
|
39
|
+
return res;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const formatNumber = (num: number) => {
|
|
43
|
+
if (num < 0) return 'Invalid number';
|
|
44
|
+
if (num >= 10) return `${ num }`;
|
|
45
|
+
return `0${ num }`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const formatDateNumber = (num: number) => {
|
|
49
|
+
if (num > 24 * 60 * 60) return 'Invalid date';
|
|
50
|
+
const h = Math.floor(num / 60 / 60);
|
|
51
|
+
const m = Math.floor((num - h * 60 * 60) / 60);
|
|
52
|
+
const s = num % 60;
|
|
53
|
+
return `${ formatNumber(h) }:${ formatNumber(m) }:${ formatNumber(s) }`;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const transformTime = (time: string) => {
|
|
57
|
+
const arr = time.split(':');
|
|
58
|
+
const hh = arr[arr.length - 3] ? parseInt(arr[arr.length - 3]) : 0;
|
|
59
|
+
const mm = parseInt(arr[arr.length - 2]);
|
|
60
|
+
const ss = parseFloat(arr[arr.length - 1]);
|
|
61
|
+
|
|
62
|
+
return hh * 60 * 60 + mm * 60 + ss;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const transformSeconds = (seconds: number) => {
|
|
66
|
+
const hh = Math.floor(seconds / 3600);
|
|
67
|
+
const mm = Math.floor((seconds - hh * 3600) / 60);
|
|
68
|
+
const ss = Math.floor(seconds - hh * 3600 - mm * 60);
|
|
69
|
+
return `${ hh ? `${ hh.toString().padStart(2, '0') }:` : '' }${ mm.toString().padStart(2, '0') }:${ ss.toString().padStart(2, '0') }`;
|
|
123
70
|
};
|
package/src/i18n/en.ts
CHANGED
|
@@ -122,7 +122,7 @@ export default {
|
|
|
122
122
|
'meeting.meetingTypeSummit': 'Summit',
|
|
123
123
|
'meeting.allSigs': 'All SIGs',
|
|
124
124
|
'meeting.allGroups': 'All Groups',
|
|
125
|
-
'meeting.meetingCreator': '
|
|
125
|
+
'meeting.meetingCreator': 'Convener',
|
|
126
126
|
'meeting.meetingDate2': 'Time',
|
|
127
127
|
'meeting.meetingId': 'Meeting ID',
|
|
128
128
|
'meeting.meetingLink': 'Meeting Link',
|
|
@@ -175,6 +175,7 @@ export default {
|
|
|
175
175
|
'meeting.enterActivityName': 'Enter a name',
|
|
176
176
|
'meeting.activityOrganizer': 'Organizer',
|
|
177
177
|
'meeting.selectActivityOrganizer': 'Select organizer',
|
|
178
|
+
'meeting.activityDetail2': 'Details',
|
|
178
179
|
'meeting.activityType': 'Event Type',
|
|
179
180
|
'meeting.selectActivityType': 'Select type',
|
|
180
181
|
'meeting.activityTime': 'Event Time',
|
|
@@ -234,28 +235,30 @@ export default {
|
|
|
234
235
|
'meeting.reviewed': 'Reviewed',
|
|
235
236
|
'meeting.activityActionSuccess': '"{0}" {1} successful',
|
|
236
237
|
'meeting.activityActionFail': '"{0}" {1} failed',
|
|
237
|
-
'meeting.activityNameMaxLength': '
|
|
238
|
-
'meeting.selectActivityTime': 'Select
|
|
239
|
-
'meeting.selectActivityDate': 'Select
|
|
238
|
+
'meeting.activityNameMaxLength': 'Event name cannot exceed 50 characters',
|
|
239
|
+
'meeting.selectActivityTime': 'Select event time',
|
|
240
|
+
'meeting.selectActivityDate': 'Select event date',
|
|
240
241
|
'meeting.activityTimeRange': 'Start and end time must be between 8:00-22:00',
|
|
241
242
|
'meeting.endDateAfterStartDate': 'End date must be after start date',
|
|
242
243
|
'meeting.registerDeadlineBeforeEnd': 'Registration deadline must be before end date',
|
|
243
|
-
'meeting.enterActivityAddress': 'Enter
|
|
244
|
-
'meeting.activityAddressMaxLength': '
|
|
244
|
+
'meeting.enterActivityAddress': 'Enter event location',
|
|
245
|
+
'meeting.activityAddressMaxLength': 'Event location cannot exceed 255 characters',
|
|
245
246
|
'meeting.invalidRegistrationUrl': 'Enter a valid registration URL',
|
|
246
|
-
'meeting.invalidActivityDetailUrl': 'Enter a valid
|
|
247
|
-
'meeting.activityContentMaxLength': '
|
|
248
|
-
'meeting.revokeActivitySuccess': '"{0}"
|
|
249
|
-
'meeting.revokeActivityFail': '"{0}"
|
|
250
|
-
'meeting.submitReviewSuccess': '"{0}"
|
|
251
|
-
'meeting.submitReviewFail': '"{0}"
|
|
252
|
-
'meeting.deleteActivitySuccess': '"{0}"
|
|
253
|
-
'meeting.deleteActivityFail': '"{0}"
|
|
247
|
+
'meeting.invalidActivityDetailUrl': 'Enter a valid event detail URL',
|
|
248
|
+
'meeting.activityContentMaxLength': 'Event content cannot exceed 1000 characters',
|
|
249
|
+
'meeting.revokeActivitySuccess': '"{0}" event review withdrawn successfully',
|
|
250
|
+
'meeting.revokeActivityFail': '"{0}" event review withdrawal failed',
|
|
251
|
+
'meeting.submitReviewSuccess': '"{0}" event submitted for review successfully',
|
|
252
|
+
'meeting.submitReviewFail': '"{0}" event submission failed',
|
|
253
|
+
'meeting.deleteActivitySuccess': '"{0}" event deleted successfully',
|
|
254
|
+
'meeting.deleteActivityFail': '"{0}" event deletion failed',
|
|
254
255
|
'meeting.loading': 'Loading...',
|
|
255
|
-
'meeting.confirmRevokeActivity': 'Are you sure you want to withdraw "{0}"
|
|
256
|
+
'meeting.confirmRevokeActivity': 'Are you sure you want to withdraw "{0}" event? After withdrawal, the event will become a draft.',
|
|
256
257
|
'events.status': 'Status',
|
|
257
258
|
'events.statusAll': 'All',
|
|
258
259
|
'events.statusIng': 'Progress',
|
|
259
260
|
'events.statusFinish': 'Finish',
|
|
260
261
|
'events.searchPlaceholder': 'Enter search...',
|
|
262
|
+
'common.collapse': 'Collapse',
|
|
263
|
+
'common.expand': 'Expand',
|
|
261
264
|
};
|
package/src/i18n/zh.ts
CHANGED
|
@@ -165,6 +165,7 @@ export default {
|
|
|
165
165
|
'meeting.activityOrganizer': '活动主办方',
|
|
166
166
|
'meeting.selectActivityOrganizer': '请选择活动主办方',
|
|
167
167
|
'meeting.activityType': '活动类型',
|
|
168
|
+
'meeting.activityDetail2': '活动详情',
|
|
168
169
|
'meeting.selectActivityType': '请选择活动类型',
|
|
169
170
|
'meeting.activityTime': '活动时间',
|
|
170
171
|
'meeting.selectActivityStartDate': '请选择活动起始日期',
|
|
@@ -247,4 +248,6 @@ export default {
|
|
|
247
248
|
'events.statusIng': '进行中',
|
|
248
249
|
'events.statusFinish': '已结束',
|
|
249
250
|
'events.searchPlaceholder': '搜索活动名称、地点',
|
|
251
|
+
'common.collapse': '收起',
|
|
252
|
+
'common.expand': '展开',
|
|
250
253
|
};
|