diff --git a/api/api.js b/api/api.js index 462b47e..6c7c2aa 100644 --- a/api/api.js +++ b/api/api.js @@ -136,6 +136,12 @@ const api = { getDraftList(data){ return request('/exchange/draft/search', data, 'post',false,'application/json'); }, + saveDraft(data){ + return request('/exchange/draft', data, 'post',false,'application/json'); + }, + delDraft(id){ + return request('/exchange/draft/'+id, {}, 'delete',false); + }, getVideoCommentUser(data){ return request('/clinical/video/user/comment/page', data, 'post',false,'application/json'); }, @@ -151,93 +157,17 @@ const api = { getOss(data){ return request('/sign/oss',data, 'get', false); }, + getCaseLabel(data){ + return request('/case/label',data,'get', false); + }, ossUpload(url,data){ return request(url,data,'post','multipart/form-data') }, - queryList(data) { - const listCount = 24; - return _queryList(data, listCount); - } - -}; -function _queryList(data, listCount, showNews = false ,random = false, showChat = false) { - if (!data.pageNo || !data.pageSize) { - return _callQueryResult([]); - } - let pageNo = parseInt(data.pageNo); - let pageSize = parseInt(data.pageSize); - let type = data.type || 0; - if (pageNo < 0 || pageSize <= 0) { - return _callQueryResult([]); - } - if (showLog) { - console.log('%c\n----------请求开始--------', 'color:green;'); - console.info(`请求参数:【pageNo:${pageNo},pageSize:${pageSize}】`) - console.log('%c----------请求结束--------\n', 'color:green;'); - } - uni.showLoading({ - title: '加载中...' - }) - if (pageNo == 0) { - pageNo = 1; - } - var totalPagingList = []; - for (let i = 0; i < listCount; i++) { - if (!showChat) { - const item = { - 'title': (i + 1).toString(), - 'detail': '测试信息' + type - }; - if (showNews) { - item.detail = getNews(random); - } - totalPagingList.push(item); - } else { - const item = { - 'name': '哆啦A梦', - 'icon': '/static/duola.jpg', - 'content': getNews(true), - 'isMe': false - }; - totalPagingList.push(item); - } - } - let pageNoIndex = (pageNo - 1) * pageSize; - if (pageNoIndex + pageSize <= totalPagingList.length) { - return _callQueryResult(totalPagingList.splice(pageNoIndex, pageSize)); - } else if (pageNoIndex < totalPagingList.length) { - return _callQueryResult(totalPagingList.splice(pageNoIndex, totalPagingList.length - pageNoIndex)); - } else { - return _callQueryResult([]); - } - } - -function _callQueryResult(arg) { - return new Promise((resolve, reject) => { - setTimeout(() => { - uni.hideLoading(); - if (showLog) { - console.log('%c\n----------响应开始--------', 'color:#0113fa;'); - // #ifdef H5 - console.table(arg); - // #endif - - // #ifndef H5 - console.log(arg); - // #endif - console.log('%c----------响应结束--------\n', 'color:#0113fa;'); - } - resolve({ - data: { - list: arg - } - }); - }, loadingTime) - }) } + export default api \ No newline at end of file diff --git a/components/backNav/backNav.vue b/components/backNav/backNav.vue index a3e8a7a..1e2e2f2 100644 --- a/components/backNav/backNav.vue +++ b/components/backNav/backNav.vue @@ -38,8 +38,7 @@ const goBack = () => { #43c9c3 0%, rgba(255, 255, 255, 0) 100% ); -} -.bg { + .bg { z-index: 0; top: 0; bottom: 0; @@ -90,4 +89,6 @@ const goBack = () => { } } } +} + \ No newline at end of file diff --git a/pages.json b/pages.json index 3f7e7e4..51a14ac 100644 --- a/pages.json +++ b/pages.json @@ -12,6 +12,7 @@ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { "path": "pages/index/index", "style": { @@ -26,6 +27,14 @@ "navigationStyle": "custom" } }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录" + } + }, + + { "path": "pages/caseTalk/caseTalk", "style": { @@ -93,12 +102,7 @@ "navigationStyle": "custom" } }, - { - "path": "pages/login/login", - "style": { - "navigationBarTitleText": "登录" - } - }, + { "path": "pages/case/case", diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 322c1e1..ee6b7ff 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -11,7 +11,8 @@ {{ info.video_title }} - {{ info.article_title }} + {{ info.article_title }} + {{ info.exchange_title }} { Object.assign(info, result); }); }; +const getExchangeDetail = (id) => { + api.getExchangeDetail(id).then((res) => { + let result = res.data.data; + Object.assign(info, result); + }); +}; onLoad((options) => { id.value = options.id; type.value = options.type; if (type.value == "article") { getArticleDetail(options.id); - } else { + } else if(type.value == "video") { getVideoDetail(options.id); + }else{ + getExchangeDetail(options.id); } }); const clearComment = () => { @@ -603,7 +612,14 @@ const queryList = (pageNo, pageSize) => { page: pageNo, page_size: pageSize, }; - type.value == "article" ? getArticleComment(params) : getVideoComment(params); + // type.value == "article" ? getArticleComment(params) : getVideoComment(params); + if(type.value == "article"){ + getArticleComment(params) + }else if(type.value == "video"){ + getVideoComment(params); + }else{ + getExchangeComment(params); + } }; const getArticleComment = (params) => { @@ -634,8 +650,40 @@ const getArticleComment = (params) => { }); }; const getVideoComment = (params) => { + const form = { + video_id: id.value, + is_have_sub_comment: 1, + }; api .getVideoComment({ + ...form, + ...params, + }) + .then((res) => { + paging.value.complete(res.data.data.data); + total.value = res.data.data.total; + setTimeout(() => { + if (showMore.value) { + openMorePop( + mainCommentObj, + dataList.value[clickIndex.value].sub_comment, + clickIndex.value + ); + } + }, 1500); + }) + .catch((res) => { + paging.value.complete(false); + }); +}; +const getExchangeComment = (params) => { + const form = { + exchange_id: id.value, + is_have_sub_comment: 1, + }; + api + .getExchangeComment({ + ...form, ...params, }) .then((res) => { @@ -1066,15 +1114,7 @@ const collectArticle = (id) => { getArticleDetail(id); }); }; -const cancelCollectArticle = (id) => { - api.cancelCollectArticle(id).then((res) => { - uni.showToast({ - icon: "none", - title: "已取消收藏", - }); - getArticleDetail(id); - }); -}; + const collectVideo = (id) => { api.collectVideo(id).then((res) => { uni.showToast({ @@ -1084,6 +1124,25 @@ const collectVideo = (id) => { getVideoDetail(id); }); }; + +const collectExchange = (id) => { + api.collectExchange(id).then((res) => { + uni.showToast({ + icon: "none", + title: "收藏成功", + }); + getExchangeDetail(id); + }); +}; +const cancelCollectArticle = (id) => { + api.cancelCollectArticle(id).then((res) => { + uni.showToast({ + icon: "none", + title: "已取消收藏", + }); + getArticleDetail(id); + }); +}; const cancelCollectVideo = (id) => { api.cancelCollectVideo(id).then((res) => { uni.showToast({ @@ -1093,11 +1152,22 @@ const cancelCollectVideo = (id) => { getVideoDetail(id); }); }; +const cancelCollectExchange = (id) => { + api.cancelCollectExchange(id).then((res) => { + uni.showToast({ + icon: "none", + title: "已取消收藏", + }); + getExchangeDetail(id); + }); +}; const toggleCollect = () => { if (type.value == "video") { info.is_collect ? cancelCollectVideo(id.value) : collectVideo(id.value); - } else { + } else if(type.value == "article") { info.is_collect ? cancelCollectArticle(id.value) : collectArticle(id.value); + }else{ + info.is_collect ? cancelCollectExchange(id.value) : collectExchange(id.value); } }; const addArticleComment = (id, data) => { @@ -1112,7 +1182,18 @@ const addArticleComment = (id, data) => { }); }; const addVideoComment = (id, data) => { - api.addVideoContent(id, data).then((res) => { + api.addVideoComment(id, data).then((res) => { + uni.showToast({ + icon: "none", + title: "评论成功", + }); + clearComment(); + showCommentDialog.value = false; + paging.value.refresh(); + }); +}; +const addExchangeComment = (id, data) => { + api.addExchangeComment(id, data).then((res) => { uni.showToast({ icon: "none", title: "评论成功", @@ -1140,6 +1221,15 @@ const delVideoComment = (id) => { paging.value.refresh(); }); }; +const delExchangeComment = (id) => { + api.delExchangeComment(id).then((res) => { + uni.showToast({ + icon: "none", + title: "删除成功", + }); + paging.value.refresh(); + }); +}; const topArticleComment = (id) => { api.topArticleComment(id).then((res) => { uni.showToast({ @@ -1160,6 +1250,16 @@ const topVideoComment = (id) => { showDeal.value = false; paging.value.refresh(); }; +const topExchangeComment = (id) => { + api.topExchangeComment(id).then((res) => { + uni.showToast({ + icon: "none", + title: "置顶成功", + }); + }); + showDeal.value = false; + paging.value.refresh(); +}; const cancelTopArticleComment = (id) => { api.cancelTopArticleComment(id).then((res) => { uni.showToast({ @@ -1180,6 +1280,16 @@ const cancelTopVideoComment = (id) => { showDeal.value = false; paging.value.refresh(); }; +const cancelTopExchangeComment = (id) => { + api.cancelTopExchangeComment(id).then((res) => { + uni.showToast({ + icon: "none", + title: "取消置顶成功", + }); + }); + showDeal.value = false; + paging.value.refresh(); +}; const delComment = () => { showModal.value = true; showDeal.value = false; @@ -1187,8 +1297,10 @@ const delComment = () => { const confirmDel = () => { if (type.value == "article") { delArticleComment(parent_id.value); - } else { + } else if(type.value == "video") { delVideoComment(parent_id.value); + }else{ + delExchangeComment(parent_id.value); } showModal.value = false; }; @@ -1198,10 +1310,14 @@ const toggleTop = () => { is_top.value ? cancelTopArticleComment(parent_id.value) : topArticleComment(parent_id.value); - } else { + } else if(type.value == "video") { is_top.value ? cancelTopVideoComment(parent_id.value) : topVideoComment(parent_id.value); + }else{ + is_top.value + ? cancelTopExchangeComment(parent_id.value) + : topExchangeComment(parent_id.value); } }; const sendComment = () => { @@ -1229,8 +1345,10 @@ const sendComment = () => { } if (type.value == "article") { addArticleComment(id.value, postData); - } else { + } else if(type.value == "video") { addVideoComment(id.value, postData); + }else{ + addExchangeComment(id.value, postData); } }; const formatHtml = (val) => { @@ -1245,6 +1363,9 @@ const formatHtml = (val) => {