doctorArticleDetails.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="content">
  3. <view class="detail-cont">
  4. <view class="title">{{item.title}}</view>
  5. <view class="doctor-info">
  6. <image :src="item.avatar!==null?item.avatar:'https://qinggetai.oss-rg-china-mainland.aliyuncs.com/qgt/20240511/e7668e973cb44f1d8d7bf749c827f814.jpg'" mode="aspectFill"></image>
  7. <view class="doctor">{{item.doctorName||'崔医生'}}</view>
  8. <view class="source">179集团医院</view>
  9. </view>
  10. <view class="info">
  11. <view class="time">{{utils.timeFormat(item.createTime,'yyyy年mm月dd日 hh:MM:ss') }}</view>
  12. </view>
  13. <view class="video" v-if="item.videoUrl!=null">
  14. <video class="myVideo" id="myVideo" :src="item.videoUrl"
  15. @error="videoErrorCallback" controls></video>
  16. </view>
  17. <!-- 正文 -->
  18. <view class="full-text" >
  19. <view v-html="item.content"></view>
  20. </view>
  21. <view class="reads">阅读数:{{item.views}}</view>
  22. </view>
  23. <!-- 咨询按钮 -->
  24. <!-- <view class="inquiry" >
  25. <view class="content" @click="navTo('/pages_doctor/doctorDetails?doctorId='+item.doctorId)">
  26. <image mode="aspectFill" :src="item.avatar" ></image>
  27. <text class="text">{{item.doctorName}}</text>
  28. </view>
  29. </view> -->
  30. <!-- <view class="ad">
  31. <u-swiper
  32. :list="advImgs"
  33. indicator
  34. indicatorMode="line"
  35. circular
  36. @click="handleAdvClick">
  37. </u-swiper>
  38. </view> -->
  39. </view>
  40. </template>
  41. <script>
  42. // import {getAdvList} from '@/api/adv.js'
  43. import {getDoctorArticleById} from '@/api/doctorArticle.js'
  44. export default {
  45. data() {
  46. return {
  47. advs:[],
  48. advImgs:[],
  49. src: '',
  50. articleId:null,
  51. item:{},
  52. };
  53. },
  54. onLoad(option) {
  55. this.articleId=option.articleId;
  56. },
  57. onShow() {
  58. //this.getAdvList()
  59. this.getDoctorArticleById();
  60. },
  61. //发送给朋友
  62. onShareAppMessage(res) {
  63. return {
  64. title: this.item.title,
  65. path: '/pages_index/index/doctorArticleDetails?articleId='+this.articleId,
  66. }
  67. },
  68. //分享到朋友圈
  69. onShareTimeline(res) {
  70. return {
  71. title: this.item.title,
  72. query:'articleId='+this.articleId,//页面参数
  73. }
  74. },
  75. methods:{
  76. handleAdvClick(index){
  77. var ad=this.advs[index];
  78. console.log(ad.advUrl);
  79. if(ad.showType==1){
  80. uni.setStorageSync('url',ad.advUrl);
  81. uni.navigateTo({
  82. url:"h5"
  83. })
  84. }
  85. else if(ad.showType==2){
  86. uni.navigateTo({
  87. url:ad.advUrl
  88. })
  89. }
  90. else if(ad.showType==3){
  91. uni.setStorageSync('content',ad.content);
  92. uni.navigateTo({
  93. url:"content"
  94. })
  95. }
  96. },
  97. getAdvList() {
  98. //联网加载数据
  99. var that = this;
  100. var data = {
  101. advType:10
  102. };
  103. getAdvList(data).then(res => {
  104. if(res.code==200){
  105. that.advImgs=[];
  106. that.advs=[];
  107. res.data.forEach(function(element) {
  108. if(element.imageUrl!=null&&element.imageUrl!=""){
  109. that.advs.push(element);
  110. that.advImgs.push(element.imageUrl);
  111. }
  112. });
  113. }else{
  114. uni.showToast({
  115. icon:'none',
  116. title: "请求失败",
  117. });
  118. }
  119. });
  120. },
  121. videoErrorCallback: function(e) {
  122. uni.showModal({
  123. content: e.target.errMsg,
  124. showCancel: false
  125. })
  126. },
  127. navTo(url){
  128. uni.navigateTo({
  129. url: url
  130. })
  131. },
  132. getDoctorArticleById(){
  133. let data = {articleId:this.articleId};
  134. getDoctorArticleById(data).then(
  135. res => {
  136. if(res.code==200){
  137. this.item=res.data;
  138. }else{
  139. uni.showToast({
  140. icon:'none',
  141. title: "请求失败",
  142. });
  143. }
  144. },
  145. rej => {}
  146. );
  147. },
  148. }
  149. }
  150. </script>
  151. <style lang="scss">
  152. page{
  153. height: 100%;
  154. }
  155. .content{
  156. height: 100%;
  157. display: flex;
  158. flex-direction: column;
  159. }
  160. .detail-cont{
  161. width: calc(100% - 60rpx) ;
  162. flex: 1;
  163. padding: 30upx;
  164. overflow-y: auto;
  165. background: #fff;
  166. .title{
  167. font-size: 44upx;
  168. font-family: PingFang SC;
  169. font-weight: bold;
  170. color: #222222;
  171. line-height: 70upx;
  172. }
  173. .doctor-info{
  174. display: flex;
  175. align-items: center;
  176. margin:20rpx 0;
  177. image{
  178. width: 64rpx;
  179. height: 64rpx;
  180. border-radius: 50%;
  181. }
  182. .doctor{
  183. font-family: PingFang SC, PingFang SC;
  184. font-weight: 400;
  185. font-size: 28rpx;
  186. color: #222426;
  187. text-align: left;
  188. margin:0 16rpx ;
  189. }
  190. .source{
  191. font-family: PingFang SC, PingFang SC;
  192. font-weight: 400;
  193. font-size: 28rpx;
  194. color: #66789E;
  195. text-align: left;
  196. }
  197. }
  198. .info{
  199. display: flex;
  200. align-items: center;
  201. font-family: PingFang SC, PingFang SC;
  202. font-weight: 400;
  203. font-size: 28rpx;
  204. color: #B2B2B2;
  205. line-height: 48upx;
  206. margin: 23upx 0;
  207. }
  208. .full-text{
  209. width: 100%;
  210. font-size: 34upx;
  211. font-family: PingFang SC;
  212. // font-weight: 500;
  213. color: #222222;
  214. line-height: 60upx;
  215. }
  216. .reads{
  217. margin-top: 20rpx;
  218. font-family: PingFang SC, PingFang SC;
  219. font-weight: 400;
  220. font-size: 28rpx;
  221. color: #B2B2B2;
  222. text-align: left;
  223. }
  224. .video{
  225. width: 100%;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. video{
  230. width: 100%;
  231. }
  232. }
  233. }
  234. .ad{
  235. margin-bottom: 50rpx;
  236. width: 100%;
  237. padding: 15rpx;
  238. }
  239. .inquiry{
  240. position: fixed;
  241. right: 22upx;
  242. bottom: 193upx;
  243. z-index: 99;
  244. .content{
  245. display: flex;
  246. align-items: center;
  247. justify-content: center;
  248. flex-direction: column;
  249. image{
  250. box-sizing: border-box;
  251. width: 100upx;
  252. height: 100upx;
  253. border-radius: 50%;
  254. z-index: 9;
  255. border: 2rpx solid #0bb3f2;
  256. }
  257. .text{
  258. margin-top: 15upx;
  259. font-size: 30upx;
  260. font-family: PingFang SC;
  261. font-weight: bold;
  262. color: #0bb3f2;
  263. }
  264. }
  265. }
  266. </style>