学习页面接口联调
This commit is contained in:
@@ -13,4 +13,6 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
|
||||
|
||||
app入口
|
||||
# VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
|
||||
# VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001'
|
||||
# VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
|
||||
|
||||
|
||||
+1
-9
@@ -79,15 +79,7 @@ export function previewFile(id, responseType = 'arraybuffer') {
|
||||
header,
|
||||
responseType,
|
||||
success(result) {
|
||||
//#ifdef APP-PLUS
|
||||
let _header = result.header['Content-Type'].split(';')[0]
|
||||
// #endif
|
||||
//#ifndef APP-PLUS
|
||||
let _header = result.header['content-type'].split(';')[0]
|
||||
// #endif
|
||||
// let base64 = new Blob([result.data],{type:result.header['content-type'].split(';')[0]})
|
||||
let base64 = `data:${_header};base64,` + uni.arrayBufferToBase64(result.data)
|
||||
resolve(base64)
|
||||
resolve(result)
|
||||
},
|
||||
fail(error) {
|
||||
reject(new Error(error));
|
||||
|
||||
+7
-5
@@ -1,6 +1,8 @@
|
||||
import request from '@/api/request'
|
||||
|
||||
const base_url = '/traapp'
|
||||
const course_base_url = '/trastudy'
|
||||
|
||||
|
||||
// 获取课程分类树接口
|
||||
export const getCourseTypeListApi = (data) => {
|
||||
@@ -29,7 +31,7 @@ export const getTraTagListApi = (data) => {
|
||||
// 全部模块
|
||||
export const queryCrsInfoByCatalogApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/crsInfo/queryCrsInfoByCatalog',
|
||||
url: course_base_url + '/crsInfo/queryCrsInfoByCatalog',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
@@ -37,7 +39,7 @@ export const queryCrsInfoByCatalogApi = (data) => {
|
||||
// 生产线模块-
|
||||
export const queryCrsInfoByPrdLineApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/crsInfo/queryCrsInfoByPrdLine',
|
||||
url: course_base_url + '/crsInfo/queryCrsInfoByPrdLine',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
@@ -45,7 +47,7 @@ export const queryCrsInfoByPrdLineApi = (data) => {
|
||||
// 最新
|
||||
export const queryCrsInfoByLastnewApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/crsInfo/queryCrsInfoByLastnew',
|
||||
url: course_base_url + '/crsInfo/queryCrsInfoByLastnew',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
@@ -53,7 +55,7 @@ export const queryCrsInfoByLastnewApi = (data) => {
|
||||
// 最热
|
||||
export const queryCrsInfoByPopularApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/crsInfo/queryCrsInfoByPopular',
|
||||
url: course_base_url + '/crsInfo/queryCrsInfoByPopular',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
@@ -61,7 +63,7 @@ export const queryCrsInfoByPopularApi = (data) => {
|
||||
// 推荐
|
||||
export const queryCrsInfoByRecmdApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/crsInfo/queryCrsInfoByRecmd',
|
||||
url: course_base_url + '/crsInfo/queryCrsInfoByRecmd',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import request from '@/api/request'
|
||||
|
||||
const base_url = '/trastudy'
|
||||
|
||||
// 获取课程分类树接口
|
||||
export const getCourseStudyInfoApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/traStdyInfo/queryTraStdyProgressAndTeacher',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
@@ -53,7 +53,12 @@
|
||||
});
|
||||
}else{
|
||||
previewFile(id).then((result) => {
|
||||
//#ifdef APP-PLUS
|
||||
let _header = result.header['Content-Type'].split(';')[0]
|
||||
// #endif
|
||||
//#ifndef APP-PLUS
|
||||
let _header = result.header['content-type'].split(';')[0]
|
||||
// #endif
|
||||
let base64 = `data:${_header};base64,` + uni.arrayBufferToBase64(result.data)
|
||||
this.imgUrlShow = base64;
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
.talking-info{
|
||||
padding: 20rpx;
|
||||
border-radius: 15rpx;
|
||||
background-color: #aaa;
|
||||
background-color: #fff;
|
||||
.talking-gif{
|
||||
width: 140rpx;
|
||||
height: 38rpx;
|
||||
|
||||
+99
-25
@@ -9,27 +9,27 @@
|
||||
</view>
|
||||
<!-- <video v-if="videoUrlShow" :src="videoUrlShow" controls></video> -->
|
||||
<view class="voice-list">
|
||||
<uv-radio-group v-model="chooseVoiceId">
|
||||
<view class="voice-item" v-for="item in 5" >
|
||||
<uv-radio-group v-model="choiceTeacher">
|
||||
<view class="voice-item" v-for="item in teacherList" :key="item.teacherNo" @click="choiceTeacher = item.teacherNo">
|
||||
<view class="avatar-box">
|
||||
<ImagePreview class="img-box" :imgId="item+''" :isCache="true"></ImagePreview>
|
||||
<ImagePreview class="img-box" :imgId="item.imgAddr" :isCache="true" :width="480" :height="660"></ImagePreview>
|
||||
</view>
|
||||
<view class="right-cont">
|
||||
<view class="right-name">李想</view>
|
||||
<view class="right-desc">描述:产品</view>
|
||||
<view class="right-name">{{item.teacherName}}</view>
|
||||
<view class="right-desc">描述:{{item.teacheDesc || '--'}}</view>
|
||||
<view class="audio-box">
|
||||
<view class="talking-gif"></view>
|
||||
<view class="play-btn">
|
||||
<image class="icon" v-if="false" src="@/static/images/course/play.png" style="width: 100%;height: 100%;"></image>
|
||||
<image class="icon" src="@/static/images/course/pause-focus.png" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
<view class="talking-time">00:26</view>
|
||||
<!-- <view class="talking-time">00:26</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<uv-radio :name="item" class="radio-box"/>
|
||||
<uv-radio :name="item.teacherNo" class="radio-box" @click.stop/>
|
||||
</view>
|
||||
</uv-radio-group>
|
||||
<view class="start-btns" @click="step+=1">
|
||||
<view class="start-btns" @click="nextStep">
|
||||
开启学习之旅
|
||||
<!-- <view class="touch-btn">开启学习之旅</view> -->
|
||||
</view>
|
||||
@@ -42,7 +42,6 @@
|
||||
</view>
|
||||
<view class="talking-list">
|
||||
<view class="study-num">1/20</view>
|
||||
{{audioPath}}
|
||||
<TalkingItem class="talking-item" v-for="item in 8" :type="item%2"></TalkingItem>
|
||||
</view>
|
||||
<view class="talk-btns">
|
||||
@@ -83,14 +82,30 @@
|
||||
import { reactive, ref, computed, unref, onMounted } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { previewFile, downloadFile } from "@/api/common.js"
|
||||
import { getToken } from '@/common/common.js'
|
||||
import { get_base_url } from '@/api/request'
|
||||
import { getCourseStudyInfoApi } from "@/api/study.js"
|
||||
import common from '@/common/common';
|
||||
import TalkingItem from '@/pages/course/components/talkingItem.vue'
|
||||
import ImagePreview from '@/components/image-preview/image-preview.vue'
|
||||
const crsNum = ref('');
|
||||
const step = ref(2)
|
||||
const chooseVoiceId = ref('')
|
||||
const crsId = ref('');
|
||||
const step = ref(0)
|
||||
const teacherList = ref([])
|
||||
const choiceTeacher = ref('')
|
||||
const videoUrlShow = ref('')
|
||||
const getData = async () => {
|
||||
try{
|
||||
const { body } = await getCourseStudyInfoApi({crsId: crsId.value})
|
||||
if(body.stdyProgressFlag === 'N'){
|
||||
step.value = 1
|
||||
teacherList.value = body.teacheList
|
||||
}else{
|
||||
choiceTeacher.value = body.choiceTeacher
|
||||
}
|
||||
}catch{
|
||||
|
||||
}
|
||||
// downloadFile('S3F0250181220722025062409312400000331622').then(res=>{
|
||||
// console.log(res)
|
||||
// audioObj.value = uni.createInnerAudioContext()
|
||||
@@ -100,15 +115,59 @@ const getData = async () => {
|
||||
// videoUrlShow.value = res.tempFilePath
|
||||
// })
|
||||
};
|
||||
let WS = {}
|
||||
const nextStep = () => {
|
||||
console.log(choiceTeacher.value)
|
||||
if(choiceTeacher.value){
|
||||
initWS()
|
||||
}
|
||||
}
|
||||
const initWS = async () => {
|
||||
let _params = {
|
||||
url: get_base_url() + '/trastudy/trasoket/open',
|
||||
header:{
|
||||
Summary: getToken(),
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
},
|
||||
}
|
||||
console.log(_params)
|
||||
WS = uni.connectSocket({
|
||||
..._params,
|
||||
success(res){
|
||||
console.log(res)
|
||||
},
|
||||
file(err){
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
console.log(WS)
|
||||
WS.onOpen = () =>{
|
||||
console.log('建立链接')
|
||||
step.value = 2
|
||||
}
|
||||
// WS.onmessage = (event) => {
|
||||
// console.log(event)
|
||||
// }
|
||||
// WS.onerror = (event) => {
|
||||
// console.log(event)
|
||||
// }
|
||||
// WS.onclose = () => {
|
||||
// // 重连
|
||||
// // initWS()
|
||||
// }
|
||||
}
|
||||
onLoad((params) => {
|
||||
crsNum.value = params.crsNum;
|
||||
crsId.value = params.crsId||'';
|
||||
crsNum.value = params.crsNum||'';
|
||||
getData();
|
||||
});
|
||||
const showTalkingModel = ref(false)
|
||||
// 录音
|
||||
const audioPath = ref('')
|
||||
const audioObj = uni.createInnerAudioContext()
|
||||
const recordObj = uni.getRecorderManager()
|
||||
//#ifdef APP-PLUS
|
||||
// app端
|
||||
const recordObj = uni.getRecorderManager()
|
||||
const initRecord = () => {
|
||||
unref(recordObj)?.onStop((res)=>{
|
||||
audioPath.value = res.tempFilePath
|
||||
@@ -120,6 +179,13 @@ const startRecord = () => {
|
||||
const stopRecord = () => {
|
||||
unref(recordObj).stop()
|
||||
}
|
||||
onMounted(()=>{
|
||||
initRecord()
|
||||
})
|
||||
// #endif
|
||||
//#ifndef APP-PLUS
|
||||
const recordObj = {}
|
||||
// #endif
|
||||
const playRecord = () => {
|
||||
audioObj.src = audioPath.value
|
||||
unref(audioObj).play()
|
||||
@@ -134,7 +200,7 @@ const systemInfo = uni.getSystemInfoSync()
|
||||
const widowHeight = systemInfo.windowHeight
|
||||
// 计算是否超出按下盒子位置
|
||||
const isOut = computed(() => {
|
||||
let moveVal = (widowHeight - baseY.value)/165 * 234
|
||||
let moveVal = (widowHeight - baseY.value)/140 * 234
|
||||
return (widowHeight - moveVal) > touchY.value
|
||||
})
|
||||
const showOverlayTalking = (obj) => {
|
||||
@@ -146,21 +212,21 @@ const showOverlayTalking = (obj) => {
|
||||
}
|
||||
const hideOverlayTalking = (obj) => {
|
||||
showTalkingModel.value = false
|
||||
if(isOut.value){
|
||||
console.log('取消发送')
|
||||
}else{
|
||||
//#ifdef APP-PLUS
|
||||
stopRecord()
|
||||
// #endif
|
||||
if(!isOut.value){
|
||||
console.log('发送')
|
||||
stopRecord()
|
||||
}
|
||||
// else{
|
||||
// console.log('取消发送')
|
||||
// }
|
||||
}
|
||||
|
||||
const handleMove = (obj) => {
|
||||
touchX.value = obj.changedTouches[0].pageX
|
||||
touchY.value = obj.changedTouches[0].pageY
|
||||
}
|
||||
onMounted(()=>{
|
||||
initRecord()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -212,7 +278,8 @@ onMounted(()=>{
|
||||
flex:1;
|
||||
overflow-y: auto;
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
background: url(@/static/images/course/study-bg.png) no-repeat;
|
||||
background-size: cover;
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
.study-num{
|
||||
height: 36rpx;
|
||||
@@ -225,7 +292,7 @@ onMounted(()=>{
|
||||
}
|
||||
}
|
||||
.talk-btns{
|
||||
height: 180rpx;
|
||||
height: 150rpx;
|
||||
background-color: #fff;
|
||||
padding: 25rpx 30rpx 0;
|
||||
.touch-btn{
|
||||
@@ -257,6 +324,8 @@ onMounted(()=>{
|
||||
width: 160rpx;
|
||||
height: 207rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
background-color: #ccc;
|
||||
.img-box{
|
||||
width: 100%;
|
||||
@@ -266,10 +335,15 @@ onMounted(()=>{
|
||||
.right-cont{
|
||||
flex:1;
|
||||
.right-name{
|
||||
width: 380rpx;
|
||||
line-height: 40rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
margin-bottom: 25rpx;
|
||||
word-break: break-all;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.right-desc{
|
||||
line-height: 38rpx;
|
||||
@@ -310,8 +384,8 @@ onMounted(()=>{
|
||||
}
|
||||
.radio-box{
|
||||
position: absolute;
|
||||
right: 40rpx;
|
||||
top: 40rpx;
|
||||
right: 20rpx;
|
||||
top: 20rpx;
|
||||
}
|
||||
}
|
||||
.start-btns{
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 778 KiB |
Reference in New Issue
Block a user