1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // 语音转文字 获取token
- import config from '@/config'
- const baseUrl = config.baseUrl
- export function turnWordLogin(data) {
- console.log(7)
- return new Promise((resolve, reject) => {
- // var url='https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=Va5yQRHlA4Fq5eR3LT0vuXV4&client_secret=0rDSjzQ20XUj5itV6WRtznPQSzr5pVw2&'
- uni.request({
- url: 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=MuVtMTc6EHaLbrr38WEhqjml&client_secret=rPGCiA3L41VwuTCBHkwkmcOt0IPTsi8z', //仅为示例,并非真实接口地址。
- data:data,
- method: 'POST',
- header: {'content-type': 'application/json;charset=utf-8' },
- success: (res) => {
- resolve(res.data)
- },
- fail:(erroe)=>{
- reject(error)
- }
- });
- })
- }
- export function uploadOffline(data){
- return new Promise((resolve, reject) => {
- uni.request({
- url: ' http://vop.baidu.com/server_api', //仅为示例,并非真实接口地址。
- data:data,
- header: {
- 'content-type': 'Content-Type: audio/pcm;rate=16000',
- },
- method: 'POST',
- success: (res) => {
- console.log(res,88)
- resolve(res.data)
- },
- fail:(erroe)=>{
- reject(error)
- }
- });
- })
- }
|