kindergarten_java/reading-platform-frontend/src/api/imm.api.ts
En ce7ee34666 feat: 集成阿里云 IMM (即时媒体服务) 与 OSS 跨域配置优化
主要变更:
- 新增阿里云 IMM SDK 依赖 (imm20200930 v1.28.3)
- 新增 IMM 配置类 (ImmConfig, ImmUtil, ImmController, ImmTokenVo)
- 新增前端 API 生成文件 (imm.api.ts)
- 更新 WebOffice.vue 使用新的 imm.api 导入

配置优化:
- 三环境 (dev/test/prod) 均开启 OSS CORS 跨域支持
- 添加 IMM 服务配置 (endpoint, region, project, 密钥)
- 测试/开发环境跨域域名设置为通配符

技术栈:
- 后端:Spring Boot + 阿里云 IMM SDK
- 前端:Vue 3 + TypeScript API 生成

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 19:35:31 +08:00

37 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 阿里云 IMM WebOffice API
* 用于文档在线预览和编辑
*/
import { http } from '@/api';
/**
* 生成只读 WebOffice Token
* @param url OSS 文件路径oss://bucket-name/path/to/file.pptx 或完整 HTTPS URL
* @param name 文件名
* @returns Token 信息
*/
export function generateWebofficeTokenReadOnly(params: { url: string; name: string }) {
return http.get('/v1/imm/token/readonly', { params });
}
/**
* 生成编辑 WebOffice Token
* @param url OSS 文件路径oss://bucket-name/path/to/file.pptx 或完整 HTTPS URL
* @param name 文件名
* @returns Token 信息
*/
export function generateWebofficeToken(params: { url: string; name: string }) {
return http.get('/v1/imm/token', { params });
}
/**
* 刷新 WebOffice Token
* @param accessToken 当前访问凭证
* @param refreshToken 刷新凭证
* @returns 刷新后的 Token 信息
*/
export function refreshWebofficeToken(data: { accessToken: string; refreshToken: string }) {
return http.post('/v1/imm/token/refresh', data);
}