doctorArticleDetails.vue 4.7 KB

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