liujie
2026-08-21 77649c76ec1c3afcb93e9963243d637665b3a307
mingdaojingjiang_guide_app/pages/workbench/index.vue
@@ -65,7 +65,13 @@
            </view>
          </view>
          <button v-if="isServing" class="lecture-button" @tap="finishLecture">结束讲解</button>
          <button v-else class="lecture-button" @tap="startLecture">开始讲解</button>
          <button
            v-else
            class="lecture-button"
            :loading="startingLecture"
            :disabled="startingLecture"
            @tap="startLecture"
          >开始讲解</button>
        </template>
        <template v-else>
          <view class="empty-order">暂无订单请耐心等待</view>
@@ -136,7 +142,7 @@
  updateGuideOnlineStatus
} from '../../services/guide'
import { openMeetingPointPage } from '../../services/map'
import { getGuideOrders } from '../../services/order'
import { getGuideOrders, startGuideLecture } from '../../services/order'
import { playNotificationAlert } from '../../services/message'
import { getWorkbenchData } from '../../services/workbench'
import { formatDuration, maskPhone } from '../../utils/format'
@@ -196,6 +202,7 @@
      countdownTimer: null,
      refreshTimer: null,
      refreshing: false,
      startingLecture: false,
      dialog: {
        visible: false,
        title: '提示',
@@ -480,9 +487,27 @@
      })
    },
    startLecture() {
      updateGuideOnlineStatus('serving', this.guide.receivingConfig || {}).then(() => {
        this.loadData()
      const orderId = this.activeReceivingOrder.id
      if (this.startingLecture) {
        return
      }
      if (!orderId) {
        uni.showToast({ title: '当前没有可开始的订单', icon: 'none' })
        return
      }
      this.startingLecture = true
      startGuideLecture(orderId).then((startedOrder) => {
        this.updateGuide({ ...this.guide, onlineStatus: 'serving' })
        this.updateOrders(this.orders.map((order) => (
          order.id === startedOrder.id ? { ...order, ...startedOrder } : order
        )))
        this.setupCountdown()
        uni.showToast({ title: '已开始讲解', icon: 'none' })
        return this.loadData({ silent: true })
      }).catch((error) => {
        uni.showToast({ title: error.message || '开始讲解失败', icon: 'none' })
      }).finally(() => {
        this.startingLecture = false
      })
    },
    finishLecture() {