cthep-ui-vue3
v1.1.1
Published
Vue 3 试题组件库
Readme
cthep-ui-vue3
Vue 3 试题组件库
安装
npm install cthep-ui-vue3使用
import { createApp } from 'vue'
import CthepUI from 'cthep-ui-vue3'
import 'cthep-ui-vue3/dist/cthep-ui-vue3.css'
import 'element-plus/dist/index.css'
const app = createApp(App)
app.use(CthepUI)讯飞语音评测配置
组件通过 xfyunCredentialsProvider 在开始录音时动态获取配置:
<CthepUI :xfyun-credentials-provider="getXfyunCredentials" />import CryptoJS from 'crypto-js'
async function getXfyunCredentials() {
const result = await platform_encryption()
const decrypted = CryptoJS.AES.decrypt(
result.data,
CryptoJS.enc.Utf8.parse('前后端约定的临时解密 Key'),
{
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
}
)
return JSON.parse(decrypted.toString(CryptoJS.enc.Utf8))
}返回值必须包含 APPID、API_SECRET、API_KEY。这是兼容性的临时方案,浏览器仍可读取解密后的凭据,后续应改为后端返回短时签名 URL。
依赖
- Vue 3
- Element Plus
- vue-uuid
