Commit 5066c03d4deb517b0340d650b365885cd3a8b176
Merge branch 'fix/camera-add-gbturl' into 'main_dev'
fix :小程序增加国标接口调用 See merge request yunteng/thingskit-app!149
Showing
2 changed files
with
30 additions
and
18 deletions
| 1 | 1 | //获取首页统计数据API |
| 2 | 2 | const getHomeStatisticsApi = () => { |
| 3 | - return uni.$u.http.get("/yt/homepage/app?login=false") | |
| 4 | -}; | |
| 3 | + return uni.$u.http.get('/yt/homepage/app?login=false') | |
| 4 | +} | |
| 5 | 5 | |
| 6 | 6 | //获取视频分页API |
| 7 | 7 | const getCameraApi = (params = {}) => { |
| 8 | - return uni.$u.http | |
| 9 | - .get('/yt/video', params) | |
| 10 | -}; | |
| 8 | + return uni.$u.http.get('/yt/video', params) | |
| 9 | +} | |
| 11 | 10 | |
| 12 | 11 | //获取视频详情API |
| 13 | 12 | const byCameraIdGetDetailApi = (id) => { |
| 14 | - return uni.$u.http.get(`/yt/video/url/${id}`) | |
| 15 | -}; | |
| 13 | + return uni.$u.http.get(`/yt/video/url/${id}`) | |
| 14 | +} | |
| 15 | + | |
| 16 | +const getCameraGBTUrl = (deviceId, channelId) => { | |
| 17 | + return uni.$u.http.get(`/yt/video/control/start/${deviceId}/${channelId}`) | |
| 18 | +} | |
| 16 | 19 | |
| 17 | 20 | //获取组态分页API |
| 18 | 21 | const getConfigurationApi = (params = {}) => { |
| 19 | - return uni.$u.http | |
| 20 | - .get('/yt/configuration/center', params) | |
| 22 | + return uni.$u.http.get('/yt/configuration/center', params) | |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | 25 | // 获取看板分页API |
| 24 | 26 | const getVisualBoardApi = (params) => { |
| 25 | - return uni.$u.http.get('yt/data_board',params) | |
| 27 | + return uni.$u.http.get('yt/data_board', params) | |
| 26 | 28 | } |
| 27 | 29 | |
| 28 | 30 | //获取组织列表 |
| 29 | 31 | const getMeOrgListApi = () => { |
| 30 | - return uni.$u.http | |
| 31 | - .get('/yt/organization/me/list') | |
| 32 | + return uni.$u.http.get('/yt/organization/me/list') | |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | export default { |
| 35 | - getHomeStatisticsApi, | |
| 36 | - getCameraApi, | |
| 37 | - byCameraIdGetDetailApi, | |
| 38 | - getConfigurationApi, | |
| 39 | - getMeOrgListApi, | |
| 40 | - getVisualBoardApi | |
| 36 | + getHomeStatisticsApi, | |
| 37 | + getCameraApi, | |
| 38 | + byCameraIdGetDetailApi, | |
| 39 | + getConfigurationApi, | |
| 40 | + getMeOrgListApi, | |
| 41 | + getVisualBoardApi, | |
| 42 | + getCameraGBTUrl, | |
| 41 | 43 | } | ... | ... |
| ... | ... | @@ -123,6 +123,16 @@ |
| 123 | 123 | if(item.accessMode===1){ |
| 124 | 124 | item.videoUrl = (await api.homeApi.byCameraIdGetDetailApi(item.id)).data.url |
| 125 | 125 | } |
| 126 | + if(item.accessMode === 2){ | |
| 127 | + const {deviceId,channelNo} = item.params || {} | |
| 128 | + try{ | |
| 129 | + const result = await api.homeApi.getCameraGBTUrl(deviceId,channelNo) | |
| 130 | + const {data:{flv}} = result || {} | |
| 131 | + item.videoUrl = flv | |
| 132 | + }catch(err){ | |
| 133 | + console.log(err,'error') | |
| 134 | + } | |
| 135 | + } | |
| 126 | 136 | } |
| 127 | 137 | |
| 128 | 138 | if (pageNo == 1) { | ... | ... |