From 1ee5968dfefa3e6550c270fe2be44a12433ae408 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Fri, 23 May 2025 17:39:14 +0800 Subject: [PATCH] 111 --- api/api.js | 51 +- components/backNav/backNav.vue | 93 +++ components/navBar/navBar.vue | 48 +- manifest.json | 13 +- package.json | 1 + pages.json | 20 +- pages/detail/detail.vue | 1286 +++++++++++++++++-------------- pages/index/index.vue | 121 +-- pages/login/login.vue | 58 +- pages/my/my.vue | 104 +++ pages/search/search.vue | 282 ++++++- pages/searchList/searchList.vue | 394 ++++++++++ static/arrowright.png | Bin 0 -> 394 bytes static/switch.png | Bin 0 -> 610 bytes utils/config.js | 4 +- utils/navTo.js | 4 +- utils/request.js | 23 +- 17 files changed, 1780 insertions(+), 722 deletions(-) create mode 100644 components/backNav/backNav.vue create mode 100644 pages/my/my.vue create mode 100644 pages/searchList/searchList.vue create mode 100644 static/arrowright.png create mode 100644 static/switch.png diff --git a/api/api.js b/api/api.js index 7167786..fead6d9 100644 --- a/api/api.js +++ b/api/api.js @@ -3,7 +3,7 @@ const loadingTime = 500; const showLog = false; const api = { wxLogin(data) { - return request('/login/wechat_mobile_login', data, 'post', true); + return request('/login/wechat/mobile', data, 'post', true); }, mobileLogin(data) { return request('/login/mobile_login', data, 'post', true); @@ -13,17 +13,48 @@ const api = { }, getHomeData(data) { //首页数据 - return request('/index', data, 'get', true); + return request('/index/clinical', data, 'get', true); }, - getClassify(id) { //获取分类详情 - return request('/class/' + id, {}, 'get', true); - }, - getClassifyList() { //获取分类详情 - return request('/class/list', {}, 'get', false); - }, - getQuestionPage(data) { //获取问题列表-分页 - return request('/question/page', data, 'post', true, 'application/json'); + getHomeStatics(data) { //首页统计数据 + return request('/clinical/stats', data, 'get', true); }, + getArticleDetail(id) { //获取详情 + return request('/clinical/article/'+id,{}, 'get', true); + }, + getVideoDetail(id) { //获取详情 + return request('/clinical/video/'+id,{}, 'get', true); + }, + collectArticle(id){ + return request('/api/clinical/article/collect/'+id, {}, 'post',false); + }, + cancelCollectArticle(id){ + return request('/api/clinical/article/collect/'+id, {}, 'delete',false); + }, + collectVideo(id){ + return request('/api/clinical/video/collect/'+id, {}, 'post',false); + }, + cancelCollectVideo(id){ + return request('/api/clinical/video/collect/'+id,{}, 'delete',false); + }, + searchArticle(data){ + return request('/clinical/article/search', data, 'post',true,'application/json'); + }, + searchVideo(data){ + return request('/clinical/video/search', data, 'post',true,'application/json'); + }, + searchDoctor(data){ + return request('/clinical/doctor/search', data, 'post',true,'application/json'); + }, + searchHospital(data){ + return request('/clinical/hospital/search', data, 'post',true,'application/json'); + }, + getStaticDoctor(id){ + return request('/clinical/stats/doctor/'+id, data={}, 'post',false); + }, + getStaticHospital(id){ + return request('/clinical/stats/hospital/'+id, data={}, 'post',false); + }, + queryList(data) { const listCount = 24; return _queryList(data, listCount); diff --git a/components/backNav/backNav.vue b/components/backNav/backNav.vue new file mode 100644 index 0000000..a3e8a7a --- /dev/null +++ b/components/backNav/backNav.vue @@ -0,0 +1,93 @@ + + + + + \ No newline at end of file diff --git a/components/navBar/navBar.vue b/components/navBar/navBar.vue index 32c8280..5ab1962 100644 --- a/components/navBar/navBar.vue +++ b/components/navBar/navBar.vue @@ -3,7 +3,8 @@ - 肝胆相照临床病例库 + {{ navName }} + @@ -15,8 +16,8 @@ width="30rpx" height="30rpx" > --> - - + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index de38aee..ef0f4b5 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -3,21 +3,22 @@ - 123 + {{ numInfo.article_collect_num }} 文章 - 123 + {{ numInfo.video_collect_num }} 视频 - 123 + {{ numInfo.video_read_num+numInfo.article_read_num }} 阅读量 最新上线 - + 查看更多 - + - 肝胆相照临床病例库肝胆相照临床病例库 + {{item.article_title }} - 陈煜 - - - - - - - 肝胆相照临床病例库肝胆相照临床病例库 - - 陈煜 + {{ tag.doctor_name }} @@ -90,27 +83,18 @@ 最多阅读 - + 查看更多 - + - 肝胆相照临床病例库肝胆相照临床病例库 + {{item.article_title }} - 陈煜 - - - - - - - 肝胆相照临床病例库肝胆相照临床病例库 - - 陈煜 + {{ tag.doctor_name }} @@ -119,27 +103,25 @@ 医院病例库推荐 - + 查看更多 - 首都医科大学附属北京佑安医院 - 首都医科大学附属北京佑安医院 + {{ item.hospital_name }} 医生病例库推荐 - + 查看更多 - 首都医科大学附属北京佑安医院 - 首都医科大学附属北京佑安医院 + {{ item.doctor_name }} @@ -148,7 +130,7 @@ diff --git a/pages/search/search.vue b/pages/search/search.vue index a5db41a..503c851 100644 --- a/pages/search/search.vue +++ b/pages/search/search.vue @@ -9,41 +9,64 @@ @query="queryList" > - - {{ item.title }} + + {{isArticle?item.article_title:item.video_title }} - 陈煜 + {{ tag.doctor_name }} - 1 + {{item.read_num }} - 1 + {{item.collect_num }} - 1 + {{formatdate(item.push_date) }} @@ -57,51 +80,225 @@ import navBar from "@/components/navBar/navBar.vue"; import list from "@/uni_modules/z-paging/components/z-paging/z-paging"; import api from "@/api/api"; import { onLoad } from "@dcloudio/uni-app"; +import dayjs from "dayjs"; +import switchImg from "@/static/switch.png"; const paging = ref(null); +const uDropdownRef=ref(null); const dataList = ref([]); +const total = ref(0); const value = ref(""); -const options = ref([ +const keyWord = ref(""); +const page=ref(1); +const isArticle=ref(true); +const hospital_id=ref(''); +const hospital_name=ref(''); +const doctor_id=ref(''); +const doctor_name=ref(''); +const numInfo=reactive({}); +const navName=ref('肝胆相照临床病例库') +const options= ref([ { - label: "去冰", - value: 1, + label: "正序", + value: 'asc', }, { - label: "加冰", - value: 2, + label: "倒序", + value: 'desc', }, ]); -onLoad(() => {}); -const queryList = (pageNo, pageSize) => { - const params = { - pageNo: pageNo, - pageSize: pageSize, - type: 1, +const order=reactive({ + read_num:'', + push_date:'' +}) + +onLoad((options) => { + if(options.keyWord){ + keyWord.value = options.keyWord; }; - // 此处请求仅为演示,请替换为自己项目中的请求 - api - .queryList(params) - .then((res) => { - // console.log(res) - // dataList.value=dataList.value.concat(res.data.list) - // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用 - paging.value.complete(res.data.list); - }) - .catch((res) => { - // 如果请求失败写paging.value.complete(false); - // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理 - // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可 - paging.value.complete(false); - }); + if(options.order=='new'){ + order.push_date='asc' + }; + if(options.order=='read'){ + order.read_num='desc' + }; + if(options.order=='video'){ + isArticle.value=false; + } + if(options.doctor_id){ + doctor_id.value=options.doctor_id; + doctor_name.value=options.doctor_name + navName.value= doctor_name.value+'临床病例库' + getStaticDoctor(doctor_id.value) + } + if(options.hospital_id){ + hospital_id.value=options.hospital_id; + hospital_name.value=options.hospital_name; + navName.value= hospital_name.value+'临床病例库' + getStaticDoctor(hospital_id.value) + + } +}); +const change=(e)=>{ + paging.value.reload(); +} +const formatdate=(date)=>{ + return dayjs(date).format('YYYY-MM-DD') +} +const goDetail=(id)=>{ + console.log(11111) + console.log(id) + let type=isArticle.value?'article':'video' + uni.navigateTo({ + url: `/pages/detail/detail?id=${id}&type=${type}` + }) +} +const swicthType=()=>{ + isArticle.value=!isArticle.value; + dataList.value=[]; + order.read_num=''; + order.push_date=''; + paging.value.reload(); +} +const searchArticle =(params) => { + let searchForm={ + keyword: keyWord.value, + doctor_id:doctor_id.value, + hospital_id:hospital_id.value + } + if(!order.read_num){ + delete order.read_num + } + if(!order.push_date){ + delete order.push_date + } + if(order.read_num || order.push_date){ + searchForm.order=order + } + api.searchArticle({ + ...searchForm, + ...params + }).then((res)=>{ + paging.value.complete(res.data.data.data); + total.value=res.data.data.total; + }).catch(err=>{ + paging.value.complete(false); + }) +} + +const searchVideo = async(params) => { + let searchForm={ + keyword: keyWord.value, + } + if(!order.read_num){ + delete order.read_num + } + if(!order.push_date){ + delete order.push_date + } + if(order.read_num || order.push_date){ + searchForm.order=order + } + api.searchVideo({ + ...params + }).then((res)=>{ + paging.value.complete(res.data.data.data); + total.value=res.data.data.total; + }).catch(err=>{ + paging.value.complete(false); + }) +} +const getStaticDoctor=(id)=>{ + api.getStaticDoctor(id).then((res)=>{ + let result=res.data.data; + Object.assign(numInfo,result); + }) +} +const getStaticHospital=(id)=>{ + api.getStaticHospital(id).then((res)=>{ + let result=res.data.data; + Object.assign(numInfo,result); + }) +} + + +const queryList = (pageNo, pageSize) => { + console.log(666666); + const params = { + page: pageNo, + page_size: pageSize, + }; + isArticle.value?searchArticle(params):searchVideo(params) }; \ No newline at end of file diff --git a/pages/searchList/searchList.vue b/pages/searchList/searchList.vue new file mode 100644 index 0000000..5bc7ddc --- /dev/null +++ b/pages/searchList/searchList.vue @@ -0,0 +1,394 @@ + + + + + \ No newline at end of file diff --git a/static/arrowright.png b/static/arrowright.png new file mode 100644 index 0000000000000000000000000000000000000000..71fcbc8de2084d7e930a1b4e70c922d9ea0a2ca0 GIT binary patch literal 394 zcmV;50d@X~P)Px$L`g(JR9Hvt)Uis#P!tB>|CoTFICN1Tpj$@^A&rQc)I~b!3%FQcKwm&`cM)d? zC%0lJF$o(Cqi;R~w7R z{xm%^aXc+M)GEL%e5J8)L%wDwh7upPO8XlyPCI1mDUmk|$MmX>#) zTdlY6hyMm(qKi?maR?%|0(3?uob%8Wb%6N@py0DMFFbp@L;(dwQDRPracUFp98fmg zDL@kL3?L160?>r30pa9f%S+Q++kyLQcC}kT>xnrBqgS+QMVqDtWL@ke!~LgV^ZMr_ oW3%Ee05&Px%97#k$R9Hvtl|M`qVHn1r_gaGB!oXk{j7;q-~mz&?9I_ES8A`c1)Z| zU{}LHS`ZcuErg_$h7P1L$_5*ZGB~(73P#%3e82}E=iPTl?*a^T>)m_L?|Gm1-tP#v z_@i57;~pMZ`Y|*0$l!42Mm|$<6LpO}k$BO1($L&tfPWU(7QX8Q1(*=p2KY&hF;L1c zly&v4@OUyk48kV>ABwr`gp=4M7+q&IeB@>z5cvOKX;E*$H(UiXc$*k)AnF8R4vcYK z0>0o@aOgOks5Vx=65;9JQ0;N}#26vMjFW-7;dbCcVg7e4nckD|^5?}Lv1EG6$v|E3 z$Uv&)VMAyKK$nPGbS%JP(pLESwF?7WrT)#e>=$vpF1UCwJ~Z}@xz?kCo#4^{2xb*{ zww25N@&y+UN23#srPBL9>iXGrF7HPosRxzH$7A`w?#>^1 wbF96b%N%+Y^;+i%?p5r%b@%Y=CKgEjKL9M9FaMCsV*mgE07*qoM6N<$f}=Gb1ONa4 literal 0 HcmV?d00001 diff --git a/utils/config.js b/utils/config.js index fc997ef..48aadb8 100644 --- a/utils/config.js +++ b/utils/config.js @@ -1,7 +1,7 @@ let BASE_URL='' if(process.env.NODE_ENV=='production'){ - BASE_URL='1111111' + BASE_URL='https://prod-casedata.igandan.com/api' }else{ - BASE_URL='22222222' + BASE_URL='https://dev-casedata.igandan.com/api' } export default BASE_URL \ No newline at end of file diff --git a/utils/navTo.js b/utils/navTo.js index 25c4831..5033b35 100644 --- a/utils/navTo.js +++ b/utils/navTo.js @@ -2,9 +2,9 @@ import pageUrl from './pageUrl' function navTo(obj){ // let token=''; // if(process.env.NODE_ENV === 'development'){ - // token = uni.getStorageSync('DEV_AUTH_TOKEN_FIGURE'); + // token = uni.getStorageSync('DEV_AUTH_TOKEN_CASEDATA'); // }else{ - // token = uni.getStorageSync('AUTH_TOKEN_FIGURE'); + // token = uni.getStorageSync('AUTH_TOKEN_CASEDATA'); // } // if(!token){ // let page_url=pageUrl(); diff --git a/utils/request.js b/utils/request.js index eca3566..5ef4f18 100644 --- a/utils/request.js +++ b/utils/request.js @@ -21,12 +21,11 @@ export const request = (url, data = {}, method = 'post',loading = false,contentT }) }; - uni.setStorageSync('DEV_AUTH_TOKEN_FIGURE','eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMTgzMzQzMjEwMTI3ODQ1Mzc2MCIsImV4cCI6MTc0MzEzMTY2OCwibmJmIjoxNzQyODcyNDY4LCJpYXQiOjE3NDI4NzI0Njh9.RGsdwvwck8oDNbStbMA18i5VOmy9JbK68hLNILDGUMQ'); let token=''; if(process.env.NODE_ENV === 'development'){ - token = uni.getStorageSync('DEV_AUTH_TOKEN_FIGURE'); + token = uni.getStorageSync('DEV_AUTH_TOKEN_CASEDATA'); }else{ - token = uni.getStorageSync('AUTH_TOKEN_FIGURE'); + token = uni.getStorageSync('AUTH_TOKEN_CASEDATA'); } // if(!token){ // let freeList=['/login','/code/phone','/login/wx','/index','/user/check']; @@ -68,9 +67,9 @@ export const request = (url, data = {}, method = 'post',loading = false,contentT var Authorization_token = res.header.Authorization; if(Authorization_token){ if(process.env.NODE_ENV === 'development'){ - uni.setStorageSync('DEV_AUTH_TOKEN_FIGURE', Authorization_token); + uni.setStorageSync('DEV_AUTH_TOKEN_CASEDATA', Authorization_token); }else{ - uni.setStorageSync('AUTH_TOKEN_FIGURE', Authorization_token); + uni.setStorageSync('AUTH_TOKEN_CASEDATA', Authorization_token); } } @@ -80,16 +79,8 @@ export const request = (url, data = {}, method = 'post',loading = false,contentT if(res.data.code==200){ e(res) }else if(res.data.code==401 || res.data.code==403 || res.data.code==405 || res.data.code==406){ - var u=navigator.userAgent; - let isApp=Boolean(u.match(/Gdxz/ig)); - if(isApp){ - uni.navigateTo({ - url: '/pages/index/index' - }); - }else{ - let freeList=['/login','/code/phone','/login/wx','/index','/user/check']; - if(freeList.indexOf(url) == -1){ - + let freeList=['/login/wechat/mobile','/code/phone','/login/mobile_login','/index','/user/check']; + if(freeList.indexOf(url) == -1){ let page_url=pageUrl(); uni.setStorageSync('redirectUrl',page_url); uni.navigateTo({ @@ -97,7 +88,7 @@ export const request = (url, data = {}, method = 'post',loading = false,contentT }); return false } - } + }else if(res.data.code==500){ n(res)