diff --git a/App.vue b/App.vue index 5cf8d22..71d0ad1 100644 --- a/App.vue +++ b/App.vue @@ -34,8 +34,8 @@ overflow: hidden; } .back{ - margin-top: -8rpx; - padding:0 15rpx 15rpx 15rpx; + /* margin-top: -8rpx; */ + padding:0 20rpx 0rpx 20rpx; } .ellipsis-one-lines { overflow: hidden; @@ -59,4 +59,10 @@ .u-dropdown__menu__item__arrow--rotate .uicon-arrow-down{ color: #3cc7c0 !important; } +.tagbox{ + flex-wrap: wrap; +} +.tagbox .tag{ + margin:5rpx 0 ; +} \ No newline at end of file diff --git a/api/api.js b/api/api.js index 5171352..668f081 100644 --- a/api/api.js +++ b/api/api.js @@ -44,7 +44,7 @@ const api = { return request('/exchange/collect/'+id,{}, 'delete',false); }, addVideoComment(id,data){ - return request('/clinical/video/comment/'+id,data, 'post',false,'application/json'); + return request('/clinical/video/comment/'+id,data, 'post',true,'application/json'); }, delVideoComment(id){ return request('/clinical/video/comment/'+id, {}, 'delete',false); @@ -57,7 +57,7 @@ const api = { return request('/clinical/video/comment/top/'+id, {}, 'delete',false); }, addArticleComment(id,data){ - return request('/clinical/article/comment/'+id, data, 'post',false,'application/json'); + return request('/clinical/article/comment/'+id, data, 'post',true,'application/json'); }, delArticleComment(id){ return request('/clinical/article/comment/'+id, {}, 'delete',false); diff --git a/components/backDetailNav/backDetailNav.vue b/components/backDetailNav/backDetailNav.vue index 0bea667..216bd78 100644 --- a/components/backDetailNav/backDetailNav.vue +++ b/components/backDetailNav/backDetailNav.vue @@ -89,7 +89,13 @@ onMounted(()=>{ padding-bottom: 20rpx; background-color: #f9fafb; position: relative; - height:200rpx; + /* #ifdef H5 */ + height:120rpx; + /* #endif */ + /* #ifdef MP-WEIXIN */ + height:200rpx; + /* #endif */ + background: radial-gradient( 60% 90% at 4% 2%, #43c9c3 0%, @@ -109,7 +115,13 @@ onMounted(()=>{ ); } .namebox { + /* #ifdef H5 */ + padding-top: 51rpx; + /* #endif */ + /* #ifdef MP-WEIXIN */ padding-top: 102rpx; + /* #endif */ + margin: 0rpx 30rpx 0rpx; display: flex; align-items: center; diff --git a/components/backNav/backNav.vue b/components/backNav/backNav.vue index 7f0ef41..a061cf9 100644 --- a/components/backNav/backNav.vue +++ b/components/backNav/backNav.vue @@ -53,7 +53,13 @@ const goBack = () => { ); } .namebox { - padding-top: 102rpx; + /* #ifdef H5 */ + padding-top: 51rpx; + /* #endif */ + /* #ifdef MP-WEIXIN */ + padding-top: 102rpx; + /* #endif */ + justify-content: center; margin: 0rpx 30rpx 0rpx; position: relative; diff --git a/components/dNav/dNav.vue b/components/dNav/dNav.vue index a9de09f..a777409 100644 --- a/components/dNav/dNav.vue +++ b/components/dNav/dNav.vue @@ -49,7 +49,13 @@ ); } .namebox { - padding-top: 102rpx; + /* #ifdef H5 */ + padding-top: 51rpx; + /* #endif */ + /* #ifdef MP-WEIXIN */ + padding-top: 102rpx; + /* #endif */ + margin: 0rpx 30rpx 0rpx; display: flex; align-items: center; diff --git a/components/navBar/navBar.vue b/components/navBar/navBar.vue index 483e888..a562488 100644 --- a/components/navBar/navBar.vue +++ b/components/navBar/navBar.vue @@ -30,7 +30,7 @@ { diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 1cfa503..f47c79e 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -5,6 +5,7 @@ loading-more-no-more-text="咱也是有底线的!" :auto-show-back-to-top="false" v-model="dataList" + refresher-out-rate="0.8" :empty-view-super-style="{'paddingBottom':'140rpx'}" :refresher-title-style="{'paddingBottom':'60rpx','paddingTop':'10rpx'}" :refresher-img-style="{'paddingBottom':'60rpx','paddingTop':'10rpx'}" @@ -24,15 +25,19 @@ radius="50%" > - + + + + + @@ -60,10 +65,10 @@ }} {{ info.exchange_title }} - + 病例信息 - + @@ -154,17 +159,17 @@ - - + + 在线投票 - {{ info.case_exchange_vote.vote_title }} + {{ info.exchange_vote.vote_title }} - + 在线投票 - {{ info.case_exchange_vote.vote_title }} + {{ info.exchange_vote.vote_title }} - + {{item.option_value }} {{item.proportion}}% @@ -218,7 +223,7 @@ :key="item.comment_id" > {{ item.user_name }} ... {{ cell.user_name }} ...——展开更多回复——展开更多回复 @@ -412,11 +417,11 @@ @open="openDeal" > - {{ + {{ is_top ? "取消置顶" : "置顶" }} 回复 - 删除 + 删除 取消 @@ -443,7 +448,7 @@ {{ mainCommentObj.user_name}} ... {{ cell.user_name}} ... { @@ -718,18 +726,33 @@ const getArticleDetail = (id) => { api.getArticleDetail(id).then((res) => { let result = res.data.data; Object.assign(info, result); + for (let i= 0; i< info.author.length; i++) { + if(info.author[i].doctor_id==doctor_id.value){ + isArticleAuthor.value=true; + } + + } }); }; const getVideoDetail = (id) => { api.getVideoDetail(id).then((res) => { let result = res.data.data; Object.assign(info, result); + for (let i= 0; i< info.author.length; i++) { + if(info.author[i].doctor_id==doctor_id.value){ + isArticleAuthor.value=true; + } + + } }); }; const getExchangeDetail = (id) => { api.getExchangeDetail(id).then((res) => { let result = res.data.data; Object.assign(info, result); + if(info.doctor_id==doctor_id.value){ + isArticleAuthor.value=true; + } }); }; const getUserPoint=()=>{ @@ -769,14 +792,47 @@ const givePoint=()=>{ showGive.value=false; }) } +const getQueryParam=(param,link)=>{ + const url = link; + // 构造正则表达式,匹配 ? 或 & 后面跟随的参数名称和其值 + const regex = new RegExp('[?&]' + param + '=([^&#]*)', 'i'); + const result = regex.exec(url); + return result ? decodeURIComponent(result[1]) : null; + }; onLoad((options) => { - id.value = options.id; - type.value = options.type; - readRecord() + if(options.scene){ + + var decodedURL = decodeURIComponent(options.scene); + + let idStr=getQueryParam('id',decodedURL); + + let typeStr=getQueryParam('type',decodedURL); + + if(idStr){ + id.value=idStr; + } + if(typeStr){ + if(typeStr==1){ + type.value='article'; + }else if(typeStr==2){ + type.value='video'; + } + + } + }else{ + id.value = options.id; + type.value = options.type; + } + + + console.log('id:'+id.value) + console.log('type:'+type.value) + readRecord() + let userInfo=uni.getStorageSync('userInfo'); - if(userInfo.user_id){ - user_id.value=userInfo.user_id; + if(userInfo.doctor_id){ + doctor_id.value=userInfo.doctor_id; } }); @@ -785,6 +841,7 @@ const clearComment = () => { imgList.value = []; content.value = ""; root_id.value = null; + placeholder.value="请输入评论内容" //is_author.value = false; reply_name.value = ""; level.value = 1; @@ -806,7 +863,7 @@ const showReplyPop = () => { }; const alertDeal = (parentId, rootId, name, top, commentLevel,userId) => { parent_id.value = parentId; - comment_userId.value=userId; + comment_doctorId.value=userId; root_id.value = rootId; //is_author.value = isAuthor == 1 ? true : false; reply_name.value = name; @@ -927,7 +984,7 @@ const open = () => { }; const close = () => { showCommentDialog.value = false; - console.log("close"); + clearComment(); }; const openDeal = () => { @@ -953,8 +1010,7 @@ const previewImg = (url) => { }; const fillTextToImgWx = (base64) => { - let maskText = "@zjd嗯嗯嗯嗯嗯嗯3评论暂时真实的334"; - + let maskText = "@肝胆相照临床病例库"; return new Promise((resolve, reject) => { wx.createSelectorQuery() .select("#watermarkCanvas") @@ -982,15 +1038,15 @@ const fillTextToImgWx = (base64) => { let font = ""; //fontsize"px Arial"; let fontColor = "#fff"; - let strokeWidth = 3; + let strokeWidth =5; uni.getImageInfo({ src: base64, success: (imageRes) => { // 设置canvas宽高 - let scale = - (imageRes.width / 800) * 30 > 12 - ? (imageRes.width / 800) * 30 - : 12; + let scale =28; + // (imageRes.width / 800) * 30 > 12 + // ? (imageRes.width / 800) * 30 + // : 12; font = scale + "px Arial"; console.log(imageRes); canvas.width = imageRes.width; @@ -1046,7 +1102,7 @@ const fillTextToImgWx = (base64) => { let rt_y = posYmargin + textHeight * 2; ctx.font = font; ctx.fillStyle = fontColor; - ctx.strokeStyle = "black"; + ctx.strokeStyle = "#000"; ctx.strokeWidth = strokeWidth; ctx.fillStyle = "#fff"; ctx.fillText(maskText, rt_x, rt_y); @@ -1055,15 +1111,18 @@ const fillTextToImgWx = (base64) => { break; case 3: //右下角 let rb_x = - imgWidth - textWidth * 2.9 - posXmargin <= 0 + imgWidth - 276 - posXmargin <= 0 ? 10 - : imgWidth - textWidth * 2.9 - posXmargin; + : imgWidth - 276- posXmargin; + console.log(rb_x) let rb_y = imgHeight - posYmargin; ctx.font = font; ctx.fillStyle = fontColor; ctx.strokeStyle = "black"; ctx.strokeWidth = strokeWidth; ctx.fillStyle = "#fff"; + console.log('rb_x') + console.log(rb_x) ctx.fillText(maskText, rb_x, rb_y); //ctx.restore() //ctx.save() @@ -1078,8 +1137,8 @@ const fillTextToImgWx = (base64) => { success: function (res) { // 输出生成的带水印的图片临时路径 resolve(res.tempFilePath); - wx.previewImage({ urls: [res.tempFilePath] }); - showCanvas.value = false; + //wx.previewImage({ urls: [res.tempFilePath] }); + }, fail: function (res) { // reject(res) @@ -1112,9 +1171,9 @@ const fillTextToImg = (base64) => { ctx.strokeStyle = "#000"; ctx.fillStyle = "#fff"; const uploadTime = new Date(); - const name = "@zjd"; + const name = "@肝胆相照临床病例库"; const spaceH = remFontSize * 0.1; - let randomNumber = Math.floor(Math.random() * (3 + 1)); + let randomNumber = 3//Math.floor(Math.random() * (3 + 1)); let position = [ { top: remFontSize, @@ -1187,28 +1246,24 @@ const readImages = async (localIds) => { //let localData = await doreadImage(localIds[i]); let img = null; - /* #ifdef H5 */ - - let imgBase64 = await getImageBase64(localIds[i]); + // #ifdef H5 + let imgBase64 = await getImageBase64(localIds[i].url); img = await fillTextToImg(imgBase64); - console.log(img); - uni.previewImage({ urls: [img] }); - /* #endif */ - /* #ifdef MP-WEIXIN */ - let imgpromise = await fillTextToImgWx(localIds[i]); - - console.log(22222); - //console.log(imgBase64); - /* #endif */ - + + + // #endif + // #ifdef MP-WEIXIN + img = await fillTextToImgWx(localIds[i].url); + // #endif + promiseFun.push(getOss(img)) //let imgFile = base64ToFile(img, new Date().getTime() + ".jpg"); // console.log(imgFile) //promiseFun.push(uploadImg(imgFile)); } Promise.all(promiseFun).then((res) => { uni.showToast({ - duration: 1000, - message: "上传成功", + title: "上传成功", + icon:"none" }); }); }; @@ -1259,49 +1314,52 @@ const chooseImg = () => { }, }); }; - +const getOss=(temurl)=>{ + api + .getOss({ + scene: 1, + }) + .then((rep) => { + let result = rep.data; + if (result.code == 200) { + let { access_id, dir, policy, signature, host } = result.data; + + let time = dayjs().format("YYYYMMDDHHmmss"); + let random = generateRandomNumber(); + let filename = time + random; + let imgType = "." + getImageFormat(temurl); + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: host, // 仅为示例,非真实的接口地址 + filePath:temurl, + name: "file", + formData: { + OSSAccessKeyId: access_id, + policy, + key: dir + time + random + imgType, + signature, + }, + success(res) { + if (res.statusCode === 204) { + let url = host + "/" + dir + filename + imgType; + console.log(url); + imgList.value = [url]; + } + }, + fail: (err) => { + console.log(err); + }, + }); + }); + } + }); +} const handleUpload = (file) => { let File = file.file; + console.log(111); + console.log(File); + readImages(File) - // 打印文件对象 - api - .getOss({ - scene: 1, - }) - .then((rep) => { - let result = rep.data; - if (result.code == 200) { - let { access_id, dir, policy, signature, host } = result.data; - - let time = dayjs().format("YYYYMMDDHHmmss"); - let random = generateRandomNumber(); - let filename = time + random; - let imgType = "." + getImageFormat(File[0].url); - return new Promise((resolve, reject) => { - uni.uploadFile({ - url: host, // 仅为示例,非真实的接口地址 - filePath: File[0].url, - name: "file", - formData: { - OSSAccessKeyId: access_id, - policy, - key: dir + time + random + imgType, - signature, - }, - success(res) { - if (res.statusCode === 204) { - let url = host + "/" + dir + filename + imgType; - console.log(url); - imgList.value = [url]; - } - }, - fail: (err) => { - console.log(err); - }, - }); - }); - } - }); }; const generateRandomNumber = () => { let randomNumber = Math.floor(1000 + Math.random() * 9000); @@ -1315,8 +1373,8 @@ const getImageFormat = (imageUrl) => { return "unknown"; }; const afterRead = (file, lists, name) => { - console.log(lists); - console.log(name); + // console.log(lists); + // console.log(name); handleUpload(file); }; const delImg = (index) => { @@ -1557,7 +1615,7 @@ const toggleTop = () => { : topExchangeComment(parent_id.value); } }; -const sendComment = () => { +const sendComment = throttle(() => { if (!content.value) { uni.showToast({ icon: "none", @@ -1587,7 +1645,7 @@ const sendComment = () => { } else { addExchangeComment(id.value, postData); } -}; +}); const formatHtml = (val) => { if (/^回复.+:/.test(val)) { return val.replace( @@ -2097,7 +2155,15 @@ const readRecord= async()=>{ display: flex; overflow: hidden; align-items: center; - + .iptcon{ + position: relative; + .maskipt{ + position: absolute; + width:100%; + height:100%; + z-index:1 + } + } .ipt { margin-left: 15rpx; } @@ -2180,5 +2246,10 @@ const readRecord= async()=>{ margin-left: 8rpx; } } - +.iconbox{ + margin-top: 5rpx; +} +:deep(._root){ + overflow-x: hidden!important; +} \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index a8b4605..053ace7 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -109,7 +109,7 @@ - {{ item.hospital_name }} + {{ item.hospital_name }} @@ -121,7 +121,7 @@ - {{ item.doctor_name }} + {{ item.doctor_name }}({{item.hospital_name}}) diff --git a/pages/login/login.vue b/pages/login/login.vue index 5821abe..5e683cb 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,6 +1,6 @@