jisti-meet服务开启

This commit is contained in:
2025-12-26 18:55:54 +08:00
parent c2b37503fc
commit 0658b82f39
43 changed files with 3979 additions and 1208 deletions

View File

@@ -15,31 +15,29 @@
padding: 0 16px;
background: rgba(0, 0, 0, 0.8);
z-index: 1000;
}
.nav-back {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
.meeting-nav .nav-back {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.back-icon {
color: #fff;
font-size: 24px;
}
}
.meeting-nav .nav-back .back-icon {
color: #fff;
font-size: 24px;
}
.nav-title {
color: #fff;
font-size: 16px;
font-weight: 500;
}
.meeting-nav .nav-title {
color: #fff;
font-size: 16px;
font-weight: 500;
}
.nav-right {
.end-btn {
color: #ff4444;
font-size: 14px;
font-weight: 500;
}
}
.meeting-nav .nav-right .end-btn {
color: #ff4444;
font-size: 14px;
font-weight: 500;
}

View File

@@ -0,0 +1,447 @@
<template>
<view class="meeting-create-page">
<view class="page-header">
<text class="page-title">创建视频会议</text>
</view>
<view class="form-container">
<!-- 会议名称 -->
<view class="form-item">
<view class="form-label">
<text class="label-text">会议名称</text>
</view>
<input
v-model="formData.meetingName"
class="form-input"
placeholder="请输入会议名称"
maxlength="50"
/>
</view>
<!-- 开始时间 -->
<view class="form-item required">
<view class="form-label">
<text class="label-text">开始时间</text>
<text class="required-star">*</text>
</view>
<picker
mode="multiSelector"
:value="startTimePickerValue"
:range="timePickerRange"
@change="handleStartTimeChange"
>
<view class="picker-display">
<text :class="formData.startTime ? '' : 'placeholder'">
{{ formData.startTime || '请选择开始时间' }}
</text>
</view>
</picker>
</view>
<!-- 结束时间 -->
<view class="form-item required">
<view class="form-label">
<text class="label-text">结束时间</text>
<text class="required-star">*</text>
</view>
<picker
mode="multiSelector"
:value="endTimePickerValue"
:range="timePickerRange"
@change="handleEndTimeChange"
>
<view class="picker-display">
<text :class="formData.endTime ? '' : 'placeholder'">
{{ formData.endTime || '请选择结束时间' }}
</text>
</view>
</picker>
</view>
<!-- 提前入会 -->
<view class="form-item">
<view class="form-label">
<text class="label-text">提前入会(分钟)</text>
</view>
<input
v-model.number="formData.advance"
class="form-input"
type="number"
placeholder="提前入会时间"
/>
<view class="form-tip">
<text>用户可在会议开始前N分钟加入</text>
</view>
</view>
<!-- 会议密码 -->
<view class="form-item">
<view class="form-label">
<text class="label-text">会议密码</text>
</view>
<input
v-model="formData.meetingPassword"
class="form-input"
type="text"
password
placeholder="可选,留空则无密码"
maxlength="20"
/>
</view>
<!-- 最大人数 -->
<view class="form-item">
<view class="form-label">
<text class="label-text">最大人数</text>
</view>
<input
v-model.number="formData.maxParticipants"
class="form-input"
type="number"
placeholder="最大参与人数"
/>
</view>
</view>
<!-- 底部按钮 -->
<view class="form-footer">
<button class="btn btn-cancel" @click="handleCancel">取消</button>
<button class="btn btn-submit" :loading="submitting" @click="handleSubmit">创建会议</button>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, reactive, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { workcaseChatAPI } from '../../api/workcase/workcaseChat'
import type { CreateMeetingParam } from '../../types/workcase/chatRoom'
// 路由参数
const roomId = ref('')
const workcaseId = ref('')
// 表单数据
const formData = reactive<CreateMeetingParam>({
roomId: '',
workcaseId: '',
meetingName: '',
startTime: '',
endTime: '',
advance: 5,
meetingPassword: '',
maxParticipants: 10
})
const submitting = ref(false)
// 时间选择器数据
const startTimePickerValue = ref([0, 0, 0, 0])
const endTimePickerValue = ref([0, 0, 0, 0])
// 生成时间选择器范围
const timePickerRange = computed(() => {
const now = new Date()
const currentYear = now.getFullYear()
const currentMonth = now.getMonth()
const currentDay = now.getDate()
// 日期范围今天到未来30天
const dates: string[] = []
for (let i = 0; i < 30; i++) {
const date = new Date(currentYear, currentMonth, currentDay + i)
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
dates.push(`${month}-${day}`)
}
// 小时00-23
const hours: string[] = []
for (let i = 0; i < 24; i++) {
hours.push(String(i).padStart(2, '0'))
}
// 分钟00、15、30、45
const minutes = ['00', '15', '30', '45']
return [dates, hours, minutes]
})
// 页面加载时获取参数
onLoad((options: any) => {
if (options.roomId) {
roomId.value = options.roomId
formData.roomId = options.roomId
}
if (options.workcaseId) {
workcaseId.value = options.workcaseId
formData.workcaseId = options.workcaseId
}
})
// 处理开始时间选择
function handleStartTimeChange(e: any) {
const val = e.detail.value
startTimePickerValue.value = val
const now = new Date()
const selectedDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + val[0])
const year = selectedDate.getFullYear()
const month = String(selectedDate.getMonth() + 1).padStart(2, '0')
const day = String(selectedDate.getDate()).padStart(2, '0')
const hour = timePickerRange.value[1][val[1]]
const minute = timePickerRange.value[2][val[2]]
formData.startTime = `${year}-${month}-${day} ${hour}:${minute}:00`
}
// 处理结束时间选择
function handleEndTimeChange(e: any) {
const val = e.detail.value
endTimePickerValue.value = val
const now = new Date()
const selectedDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + val[0])
const year = selectedDate.getFullYear()
const month = String(selectedDate.getMonth() + 1).padStart(2, '0')
const day = String(selectedDate.getDate()).padStart(2, '0')
const hour = timePickerRange.value[1][val[1]]
const minute = timePickerRange.value[2][val[2]]
formData.endTime = `${year}-${month}-${day} ${hour}:${minute}:00`
}
// 验证表单
function validateForm(): boolean {
if (!formData.startTime) {
uni.showToast({
title: '请选择开始时间',
icon: 'none'
})
return false
}
if (!formData.endTime) {
uni.showToast({
title: '请选择结束时间',
icon: 'none'
})
return false
}
const start = new Date(formData.startTime).getTime()
const end = new Date(formData.endTime).getTime()
if (start < Date.now()) {
uni.showToast({
title: '开始时间不能早于当前时间',
icon: 'none'
})
return false
}
if (end <= start) {
uni.showToast({
title: '结束时间必须晚于开始时间',
icon: 'none'
})
return false
}
if (end - start < 5 * 60 * 1000) {
uni.showToast({
title: '会议时长不能少于5分钟',
icon: 'none'
})
return false
}
if (end - start > 24 * 60 * 60 * 1000) {
uni.showToast({
title: '会议时长不能超过24小时',
icon: 'none'
})
return false
}
if (formData.advance !== undefined && (formData.advance < 0 || formData.advance > 60)) {
uni.showToast({
title: '提前入会时间范围为0-60分钟',
icon: 'none'
})
return false
}
if (formData.maxParticipants !== undefined && (formData.maxParticipants < 2 || formData.maxParticipants > 100)) {
uni.showToast({
title: '参与人数范围为2-100人',
icon: 'none'
})
return false
}
return true
}
// 提交表单
async function handleSubmit() {
if (!validateForm()) {
return
}
try {
submitting.value = true
const result = await workcaseChatAPI.createVideoMeeting(formData)
if (result.success && result.data) {
uni.showToast({
title: '会议创建成功',
icon: 'success'
})
// 延迟返回,让用户看到成功提示
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.showToast({
title: result.message || '创建会议失败',
icon: 'none'
})
}
} catch (error) {
console.error('创建会议失败:', error)
uni.showToast({
title: '创建会议失败,请重试',
icon: 'none'
})
} finally {
submitting.value = false
}
}
// 取消
function handleCancel() {
uni.navigateBack()
}
</script>
<style scoped lang="scss">
.meeting-create-page {
min-height: 100vh;
background-color: #f5f7fa;
padding-bottom: 120rpx;
}
.page-header {
background-color: #fff;
padding: 32rpx;
border-bottom: 1px solid #ebeef5;
}
.page-title {
font-size: 36rpx;
font-weight: 600;
color: #303133;
}
.form-container {
background-color: #fff;
margin-top: 16rpx;
}
.form-item {
padding: 24rpx 32rpx;
border-bottom: 1px solid #ebeef5;
}
.form-item.required .label-text::after {
content: ' *';
color: #f56c6c;
}
.form-label {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.label-text {
font-size: 28rpx;
color: #606266;
font-weight: 500;
}
.required-star {
color: #f56c6c;
margin-left: 8rpx;
}
.form-input {
width: 100%;
padding: 16rpx 24rpx;
border: 1px solid #dcdfe6;
border-radius: 8rpx;
font-size: 28rpx;
color: #303133;
}
.picker-display {
padding: 16rpx 24rpx;
border: 1px solid #dcdfe6;
border-radius: 8rpx;
font-size: 28rpx;
color: #303133;
}
.picker-display .placeholder {
color: #c0c4cc;
}
.form-tip {
margin-top: 8rpx;
}
.form-tip text {
font-size: 24rpx;
color: #909399;
}
.form-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: space-between;
padding: 24rpx 32rpx;
background-color: #fff;
border-top: 1px solid #ebeef5;
box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.btn {
flex: 1;
padding: 24rpx 0;
border-radius: 8rpx;
font-size: 32rpx;
text-align: center;
border: none;
}
.btn-cancel {
background-color: #f5f7fa;
color: #606266;
margin-right: 16rpx;
}
.btn-submit {
background-color: #409eff;
color: #fff;
}
.btn-submit[loading] {
opacity: 0.7;
}
</style>

View File

@@ -0,0 +1,119 @@
/* UniApp
/SCSSLW (Us7 */
.meeting-card {
padding: 24rpx 32rpx;
border: 2rpx solid #e4e7ed;
border-radius: 16rpx;
background-color: #fff;
width: 100%;
box-sizing: border-box;
}
.meeting-card--scheduled {
border-left: 8rpx solid #409eff;
}
.meeting-card--ongoing {
border-left: 8rpx solid #67c23a;
}
.meeting-card--ended {
border-left: 8rpx solid #909399;
background-color: #f5f7fa;
}
.meeting-card-header {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
}
.meeting-card-title {
font-size: 32rpx;
font-weight: 600;
color: #303133;
flex: 1;
}
.meeting-card-status {
margin-left: 16rpx;
}
.status-badge {
display: inline-block;
padding: 4rpx 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
font-weight: 500;
}
.status-scheduled {
background-color: #ecf5ff;
color: #409eff;
}
.status-ongoing {
background-color: #f0f9ff;
color: #67c23a;
}
.status-ended {
background-color: #f4f4f5;
color: #909399;
}
.meeting-card-time {
display: flex;
flex-direction: column;
margin-bottom: 24rpx;
font-size: 28rpx;
color: #606266;
}
.meeting-card-time text {
line-height: 1.5;
margin-bottom: 8rpx;
}
.meeting-card-content {
margin-bottom: 24rpx;
}
.meeting-card-desc {
font-size: 28rpx;
color: #909399;
line-height: 1.5;
}
.meeting-card-action {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding-top: 24rpx;
border-top: 2rpx solid #ebeef5;
}
.meeting-card-countdown {
font-size: 28rpx;
color: #409eff;
font-weight: 500;
}
.meeting-card-action button {
padding: 8rpx 24rpx;
font-size: 28rpx;
min-width: 160rpx;
border-radius: 8rpx;
}
.meeting-card-action button[disabled] {
opacity: 0.6;
}
.meeting-card-action button text {
font-size: 28rpx;
}

View File

@@ -0,0 +1,214 @@
<template>
<!-- 消息会议卡片 -->
<view :class="['meeting-card', meeting.status ? `meeting-card--${meeting.status}` : '']">
<view class="meeting-card-header">
<view class="meeting-card-title">{{ meeting.meetingName || '未命名会议' }}</view>
<view class="meeting-card-status">
<text v-if="meeting.status === 'scheduled'" class="status-badge status-scheduled">预定</text>
<text v-else-if="meeting.status === 'ongoing'" class="status-badge status-ongoing">进行中</text>
<text v-else-if="meeting.status === 'ended'" class="status-badge status-ended">已结束</text>
</view>
</view>
<view class="meeting-card-time">
<text>开始时间:{{ formatDateTime(meeting.startTime) }}</text>
<text>结束时间:{{ formatDateTime(meeting.endTime) }}</text>
<text v-if="meeting.advance">提前入会:{{ meeting.advance }}分钟</text>
</view>
<view v-if="meeting.description" class="meeting-card-content">
<text class="meeting-card-desc">{{ meeting.description }}</text>
</view>
<view class="meeting-card-action">
<text class="meeting-card-countdown">{{ countdownText }}</text>
<button
type="primary"
:disabled="!canJoinMeeting"
@click="handleJoinMeeting"
size="mini"
>
<text>{{ buttonText }}</text>
</button>
</view>
</view>
</template>
<script setup lang="ts">
import type { VideoMeetingVO } from '../../../types/workcase/chatRoom'
import { ref, computed, onMounted, onUnmounted } from 'vue'
interface Props {
meeting: VideoMeetingVO
}
const props = defineProps<Props>()
console.log("meeting", JSON.stringify(props.meeting))
const emit = defineEmits<{
join: [meetingId: string]
}>()
// 当前时间,每秒更新
const currentTime = ref(Date.now())
let timer: ReturnType<typeof setInterval> | null = null
onMounted(() => {
// 每秒更新当前时间
timer = setInterval(() => {
currentTime.value = Date.now()
}, 1000)
})
onUnmounted(() => {
if (timer !== null) {
clearInterval(timer)
timer = null
}
})
/**
* 格式化日期时间
*/
function formatDateTime(dateStr?: string): string {
if (!dateStr) return ''
// iOS和小程序兼容性处理将空格替换为T
const iosCompatibleTime = dateStr.replace(' ', 'T')
const date = new Date(iosCompatibleTime)
if (isNaN(date.getTime())) return dateStr // 如果解析失败,返回原字符串
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hour = String(date.getHours()).padStart(2, '0')
const minute = String(date.getMinutes()).padStart(2, '0')
return `${month}-${day} ${hour}:${minute}`
}
/**
* 计算倒计时文本
*/
const countdownText = computed((): string => {
const meeting = props.meeting
if (!meeting) {
return ''
}
// 检查必要字段
if (!meeting.startTime || !meeting.endTime) {
return ''
}
// advance 默认为 0
const advanceMinutes = meeting.advance || 0
const now = currentTime.value
// iOS和小程序兼容性处理
const startTime = new Date(meeting.startTime.replace(' ', 'T')).getTime()
const endTime = new Date(meeting.endTime.replace(' ', 'T')).getTime()
// 检查时间解析是否有效
if (isNaN(startTime) || isNaN(endTime)) {
return ''
}
const advanceTime = startTime - advanceMinutes * 60 * 1000
if (meeting.status === 'ended') {
return '会议已结束'
}
if (now < advanceTime) {
// 未到提前入会时间
const leftMs = advanceTime - now
const leftMinutes = Math.floor(leftMs / 60000)
const leftSeconds = Math.floor((leftMs % 60000) / 1000)
if (leftMinutes >= 60) {
const hours = Math.floor(leftMinutes / 60)
const mins = leftMinutes % 60
return `距离入会:${hours}小时${mins}分钟`
} else if (leftMinutes > 0) {
return `距离入会:${leftMinutes}分${leftSeconds}秒`
} else {
return `距离入会:${leftSeconds}秒`
}
} else if (now < startTime) {
// 在提前入会时间窗口内,但未到开始时间
return '可以入会'
} else if (now < endTime) {
// 会议进行中
if (meeting.status === 'ongoing') {
return '会议进行中'
} else {
return '可以入会'
}
} else {
// 已超过结束时间
return '会议已超时'
}
})
/**
* 是否可以加入会议
*/
const canJoinMeeting = computed((): boolean => {
const meeting = props.meeting
if (!meeting) {
return false
}
if (!meeting.startTime || !meeting.endTime) {
return false
}
if (meeting.status === 'ended') {
return false
}
const advanceMinutes = meeting.advance || 0
const now = currentTime.value
// iOS和小程序兼容性处理
const startTime = new Date(meeting.startTime.replace(' ', 'T')).getTime()
const endTime = new Date(meeting.endTime.replace(' ', 'T')).getTime()
// 检查时间解析是否有效
if (isNaN(startTime) || isNaN(endTime)) {
return false
}
const advanceTime = startTime - advanceMinutes * 60 * 1000
// 在允许入会的时间窗口内(提前入会时间 ~ 结束时间)
return now >= advanceTime && now <= endTime
})
/**
* 按钮文本
*/
const buttonText = computed((): string => {
const meeting = props.meeting
if (meeting.status === 'ended') {
return '会议已结束'
}
if (!canJoinMeeting.value) {
return '未到入会时间'
}
return '加入会议'
})
/**
* 加入会议
*/
function handleJoinMeeting() {
if (!props.meeting.meetingId) {
uni.showToast({
title: '会议ID不存在',
icon: 'none'
})
return
}
if (!canJoinMeeting.value) {
return
}
emit('join', props.meeting.meetingId)
}
</script>
<style scoped lang="scss">
@import './MeetingCard.scss';
</style>