|
@@ -4,24 +4,29 @@
|
|
|
<van-icon name="arrow-left" color="#fff" size="16" @click="onClickLeft" />
|
|
|
</div>
|
|
|
<div class="look px-2">当前观看人数:{{detailInfo.kf_view_num}}</div>
|
|
|
- <div class="videoDiv">
|
|
|
+
|
|
|
+ <div v-if="suffix=='mp4'" class="videoDiv">
|
|
|
<div class="aliPlayerShow" id="J_prismPlayer"></div>
|
|
|
</div>
|
|
|
+ <audio v-else-if="suffix=='mp3'" ref="urlResouce" controls :src="commonUrl">
|
|
|
+ <source :src="commonUrl" type="audio/mp3">
|
|
|
+ </audio>
|
|
|
+ <div v-else style="height: calc(100% - 60px);">
|
|
|
+ <iframe :src="commonUrl" frameborder="0" width="100%" height="100%"></iframe>
|
|
|
+ </div>
|
|
|
<!-- <video ref="videoPlay" controls>
|
|
|
<source :src="commonUrl" type="video/mp4" />
|
|
|
<source :src="commonUrl" type="video/ogg" />
|
|
|
</video> -->
|
|
|
|
|
|
- <div></div>
|
|
|
-
|
|
|
<div class="flex justify-between items-center px-3 mt-2">
|
|
|
<div style="font-size: 15px;">{{detailInfo.kf_name}}</div>
|
|
|
<div class="flex space-x-4 tip">
|
|
|
- <div>
|
|
|
+ <div @click="handleFinger">
|
|
|
<van-icon :name="detailInfo.is_like==0 ? 'good-job-o' : 'good-job'" />
|
|
|
<span>{{detailInfo.kf_like_num}}</span>
|
|
|
</div>
|
|
|
- <div class="icon-item">
|
|
|
+ <div @click="handleLoveIcon">
|
|
|
<van-icon :name="detailInfo.is_fav==0 ? 'like-o' : 'like'" />
|
|
|
<span>{{detailInfo.kf_fav_num}}</span>
|
|
|
</div>
|
|
@@ -32,12 +37,13 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { getFullUrl } from '@/utils/helper';
|
|
|
-import { files_detail } from "./api.js";
|
|
|
+import { files_detail, likeApi_add, likeApi_del, collectApi_add, collectApi_del } from "./api.js";
|
|
|
import { useRouter } from 'vue-router';
|
|
|
const router = useRouter();
|
|
|
const parentId = ref(router.currentRoute.value.params.id);
|
|
|
const parentKkId = ref("");
|
|
|
const detailInfo = ref({});
|
|
|
+const suffix = ref("mp4");
|
|
|
const detailLoad = ref(false);
|
|
|
const commonUrl = ref("");
|
|
|
const sourceUrl = ref("");
|
|
@@ -53,6 +59,7 @@ function initDetailData() {
|
|
|
detailInfo.value = res.data.one_info;
|
|
|
parentKkId.value = detailInfo.value.kk_id;
|
|
|
commonUrl.value = getFullUrl(res.data.one_info.kf_path);
|
|
|
+ suffix.value = res.data.one_info.kf_path.substr(res.data.one_info.kf_path.lastIndexOf(".") + 1);
|
|
|
// detailLoad.value = false;
|
|
|
|
|
|
// console.log(detailInfo.value)
|
|
@@ -98,6 +105,89 @@ function initDetailData() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+const handleFinger = () => {
|
|
|
+ if (detailInfo.value.is_like == 1) {//0:关 1:开
|
|
|
+ //去掉赞
|
|
|
+ let transObj = {
|
|
|
+ kf_id: parentId.value,
|
|
|
+ };
|
|
|
+ likeApi_del(transObj)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == "1") {
|
|
|
+ detailInfo.value.kf_like_num--;
|
|
|
+ detailInfo.value.is_like = 0;
|
|
|
+ showSuccessToast(res.msg);
|
|
|
+ } else {
|
|
|
+ showFailToast(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ let transObj = {
|
|
|
+ kczy_files_like: {
|
|
|
+ kf_id: parentId.value,
|
|
|
+ kt_id: parentKkId.value,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ likeApi_add(transObj)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == "1") {
|
|
|
+ detailInfo.value.kf_like_num++;
|
|
|
+ detailInfo.value.is_like = 1;
|
|
|
+ showSuccessToast(res.msg);
|
|
|
+ } else {
|
|
|
+ showFailToast(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleLoveIcon = () => {
|
|
|
+ if (detailInfo.value.is_fav == 1) {
|
|
|
+ //去掉收藏
|
|
|
+ let transObj = {
|
|
|
+ kf_id: parentId.value,
|
|
|
+ };
|
|
|
+ collectApi_del(transObj)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == "1") {
|
|
|
+ detailInfo.value.kf_fav_num--;
|
|
|
+ detailInfo.value.is_fav = 0;
|
|
|
+ showSuccessToast(res.msg);
|
|
|
+ } else {
|
|
|
+ showFailToast(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ let transObj = {
|
|
|
+ kczy_files_fav: {
|
|
|
+ kf_id: parentId.value,
|
|
|
+ kt_id: parentKkId.value,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ collectApi_add(transObj)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == "1") {
|
|
|
+ detailInfo.value.kf_fav_num++;
|
|
|
+ detailInfo.value.is_fav = 1;
|
|
|
+ showSuccessToast(res.msg);
|
|
|
+ } else {
|
|
|
+ showFailToast(res.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -131,6 +221,7 @@ function initDetailData() {
|
|
|
.tip {
|
|
|
color: #00a3ff;
|
|
|
font-size: 12px;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
}
|
|
|
</style>
|