Browse Source

增加 训练营模块 接口对接

feat
chenJinxu 9 months ago
parent
commit
927880e20a
8 changed files with 98 additions and 31 deletions
  1. +13
    -3
      src/api/optimize.js
  2. BIN
      src/assets/optimize/images/3_88.png
  3. +6
    -6
      src/views/insight/index.vue
  4. +44
    -1
      src/views/optimize/expertChat.vue
  5. +12
    -12
      src/views/optimize/index.vue
  6. +4
    -4
      src/views/optimize/scss/index.scss
  7. +7
    -1
      src/views/optimize/scss/trainingcamp.scss
  8. +12
    -4
      src/views/optimize/trainingcamp.vue

+ 13
- 3
src/api/optimize.js View File

@@ -4,7 +4,8 @@ export const APIOptimize = {
getCampList, // 获取训练营列表
getTrainingCampDetail, //获取训练营-详情-简介+内容
getTrainingCampDetailComment, //获取训练营-详情-评论
comment //评论课程
comment, //评论课程
getBanner //轮播图
};
export default APIOptimize;

@@ -25,11 +26,11 @@ function getTrainingCampDetail(data) {
});
}
// 获取训练营-详情-评论
function getTrainingCampDetailComment(params) {
function getTrainingCampDetailComment(data) {
return request({
url: `/api/HealthyCMS/GetTrainingCampDetailComment`,
method: 'post',
data: params
params: data
});
}

@@ -41,3 +42,12 @@ function comment(params) {
data: params
});
}
// 轮播图

function getBanner(data) {
return request({
url: `/api/HealthyCMS/GetBanner`,
method: 'post',
params: data
});
}

BIN
src/assets/optimize/images/3_88.png View File

Before After
Width: 54  |  Height: 79  |  Size: 4.5KB

+ 6
- 6
src/views/insight/index.vue View File

@@ -284,17 +284,17 @@ export default {
};
},
created() {
this.getAuth();

this.emoName = this.psyList[this.emotionActive].name;
this.initEchartText();

/* this.getPsychologiclData('', '2023-11-21', '2023-12-21'); */
},
mounted() {
this.initData();
this.getPsychologiclData();

async mounted() {
const isExistToken = await this.getAuth();
if (isExistToken) {
this.initData();
this.getPsychologiclData();
}
},
watch: {
active(val) {


+ 44
- 1
src/views/optimize/expertChat.vue View File

@@ -59,7 +59,7 @@
<div class="send">
<div class="left">
<van-cell-group>
<van-field v-model="chat" placeholder="说点什么" />
<van-field v-model="chat" placeholder="说点什么" maxlength="50" />
</van-cell-group>
</div>
<div class="right" @click="onSend">
@@ -71,6 +71,8 @@

<script>
import NavBar from '@/components/NavBar';
import { isNull } from '@/services/utils-service';
import APIOptimize from '@/api/optimize';
export default {
components: {
NavBar,
@@ -217,6 +219,12 @@ export default {
this.chat = item.name;
},
onSend() {
if (isNull(this.chat)) {
return this.$toast.fail({
message: '评论不能为空'
})
}
this.onComment();
/* let message = {
time: '2024-02-24',
text: this.chat,
@@ -226,6 +234,41 @@ export default {
};
this.chatList.push(message); */
// TODO,调取接口
},
// 发送评论
onComment() {
this.$toast.loading();
let reqBody = {
lessonId: Number(this.$route.query.lessonId),
content: this.chat,
shortcutCode: ""
};
APIOptimize.comment(reqBody).then(res => {
console.log("评论详情", res);
const data = res.data;
if (data.stateCode === 1) {
this.$toast.success({
message: '评论成功'
});
setTimeout(() => {
this.$router.push({
name: 'trainingcamp',

});
})
} else {
this.$dialog.confirm({
message: `${data.message}`,
showCancelButton: false
})
}
}).catch((e) => {
this.$dialog.confirm({
message: `${e.message}`
})
}).finally(() => {
/* this.$toast.clear() */
})
}
},
}


+ 12
- 12
src/views/optimize/index.vue View File

@@ -4,9 +4,8 @@
<!-- 专家介绍 -->
<div class="expert-box">
<van-swipe indicator-color="white">
<van-swipe-item v-for="(item, index) in expertImages" :key="index" @click="goExperts(item.id)">
<img v-lazy="item.image" />
<!-- <p>了解详情</p> -->
<van-swipe-item v-for="(item, index) in expertImages" :key="index">
<img v-lazy="item.cover" />
</van-swipe-item>
</van-swipe>
</div>
@@ -128,7 +127,6 @@
<script>
import Vue from 'vue';
import TabBar from '@/components/TabBar';
import expertImage from '@/assets/optimize/images/3_08.png';
import { Swipe, SwipeItem, Lazyload } from 'vant';
import APIOptimize from '@/api/optimize';
Vue.use(Lazyload);
@@ -145,14 +143,7 @@ export default {
data() {
return {
expertImages: [
{
id: 1,
image: expertImage
},
{
id: 2,
image: expertImage
}

],
campList: []
};
@@ -160,6 +151,7 @@ export default {
created() { },
mounted() {
this.$nextTick(() => {
this.getBanner();
this.getCampList();
})
},
@@ -189,6 +181,14 @@ export default {
id: item.id
}
});
},
getBanner() {
APIOptimize.getBanner().then(res => {
console.log("轮播图", res);
let data = res.data.data;
this.expertImages = data;
console.log("this.expertImages", this.expertImages);
})
}
}
};


+ 4
- 4
src/views/optimize/scss/index.scss View File

@@ -337,15 +337,15 @@
}

span {
color: $com_light_green;
font-size: 28px;
color: #179B3B;
font-size: 32px;
margin-left: 10px;
}
}

.price-strike {
font-size: 54px;
color: #179b3b;
font-size: 58px;
color: #98c530;
font-weight: bold;
position: relative;



+ 7
- 1
src/views/optimize/scss/trainingcamp.scss View File

@@ -62,10 +62,16 @@

.customer {
height: 100%;
padding: 0 20px;
padding-right: 20px;
@include center();
font-size: 28px;
color: #000;

img {
height: 78px;
width: 53px;
object-fit: contain;
}
}

.price {


+ 12
- 4
src/views/optimize/trainingcamp.vue View File

@@ -27,7 +27,7 @@
</div>
<div class="bottom">
<div class="customer">
<p>客服</p>
<img :src="customerImg" />
</div>
<div class="price">
<div class="left">
@@ -59,12 +59,12 @@
<div class="top">
<img src="@/assets/optimize/icons/3_55.png" alt="" />
<div>
<p>{{ item.nickName }}</p>
<p>{{ item.nickName || '匿名' }}</p>
<span>{{ item.createdAt }} {{ item.address }}</span>
</div>
</div>
<p>{{ item.content }}</p>
<span>{{ item.videoName }}</span>
<span>{{ item.title }}</span>
</div>
</div>
</div>
@@ -95,6 +95,7 @@ export default {
return {
active: 'brief',
campList: [],
customerImg: require('@/assets/optimize/images/3_88.png'),
info: {
videoList: [
/* {
@@ -184,7 +185,14 @@ export default {
})
},
getTrainingCampDetailComment() {

let reqParams = {
courseId: Number(this.$store.getters.campId)
};
APIOptimize.getTrainingCampDetailComment(reqParams).then(res => {
let data = res.data.data;
console.log("data", data);
this.info.evaluate = data;
})
},
// 返回
onNavBack() {


Loading…
Cancel
Save