questionsDetails.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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 class="h140"></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. <!-- 正文 -->
  16. <view class="full-text">
  17. <view v-html="item.answers"></view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {getQuestionsById} from '@/api/index'
  24. export default {
  25. data() {
  26. return {
  27. id:null,
  28. item:{},
  29. };
  30. },
  31. onLoad(option) {
  32. this.id=option.id;
  33. },
  34. onShow() {
  35. this.getQuestionsById();
  36. },
  37. onShareAppMessage(res) {
  38. if(this.utils.isLogin()){
  39. return {
  40. title: this.item.vesselName,
  41. path: '/pages_index/questionsDetails?id='+this.id,
  42. imageUrl: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  43. }
  44. }
  45. },
  46. //分享到朋友圈
  47. onShareTimeline(res) {
  48. if(this.utils.isLogin()){
  49. return {
  50. title: this.item.title,
  51. imageUrl: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com/fs/20250115/1736944490230.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  52. }
  53. }
  54. },
  55. methods:{
  56. getQuestionsById(){
  57. let data = {id:this.id};
  58. getQuestionsById(data).then(
  59. res => {
  60. if(res.code==200){
  61. this.item=res.data;
  62. }else{
  63. uni.showToast({
  64. icon:'none',
  65. title: "请求失败",
  66. });
  67. }
  68. },
  69. rej => {}
  70. );
  71. },
  72. }
  73. }
  74. </script>
  75. <style lang="scss">
  76. page{
  77. height: 100%;
  78. }
  79. .content{
  80. height: 100%;
  81. display: flex;
  82. flex-direction: column;
  83. }
  84. .detail-cont{
  85. flex: 1;
  86. padding: 40upx;
  87. overflow-y: auto;
  88. .title{
  89. font-size: 40upx;
  90. font-family: PingFang SC;
  91. // font-weight: bold;
  92. color: #222222;
  93. line-height: 70upx;
  94. }
  95. .info{
  96. display: flex;
  97. align-items: center;
  98. font-size: 24upx;
  99. font-family: PingFang SC;
  100. font-weight: 500;
  101. color: #999999;
  102. line-height: 48upx;
  103. margin: 23upx 0;
  104. .reads{
  105. margin-right: 30upx;
  106. }
  107. }
  108. .full-text{
  109. font-size: 36upx;
  110. font-family: PingFang SC;
  111. // font-weight: 500;
  112. color: #222222;
  113. line-height: 60upx;
  114. }
  115. }
  116. .recent-reads{
  117. flex-shrink: 0;
  118. box-sizing: border-box;
  119. height: 121upx;
  120. background: #FFFFFF;
  121. border-top: 1px solid #F0F0F0;
  122. padding: 0 40upx 0 37upx;
  123. display: flex;
  124. align-items: center;
  125. justify-content: space-between;
  126. .left{
  127. display: flex;
  128. align-items: center;
  129. .label{
  130. font-size: 28upx;
  131. font-family: PingFang SC;
  132. font-weight: 500;
  133. color: #666666;
  134. line-height: 1;
  135. margin-right: 20upx;
  136. }
  137. .peop-box{
  138. display: flex;
  139. align-items: center;
  140. .head-box{
  141. margin-right: 28upx;
  142. display: flex;
  143. align-items: center;
  144. .head{
  145. width: 48upx;
  146. height: 48upx;
  147. border-radius: 50%;
  148. overflow: hidden;
  149. box-shadow: 0 0 0 1px #fff;
  150. margin-right: -10upx;
  151. image{
  152. width: 100%;
  153. height: 100%;
  154. }
  155. }
  156. }
  157. .arrow{
  158. width: 13upx;
  159. height: 23upx;
  160. }
  161. }
  162. }
  163. .share-btn{
  164. position: relative;
  165. width: 240upx;
  166. height: 80upx;
  167. line-height: 80upx;
  168. font-size: 30upx;
  169. font-family: PingFang SC;
  170. font-weight: 500;
  171. color: #FFFFFF;
  172. background: #018C39;
  173. border-radius: 40upx;
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. image{
  178. width: 32upx;
  179. height: 32upx;
  180. margin-right: 15upx;
  181. }
  182. .share{
  183. position: absolute;
  184. width: 100%;
  185. height: 100%;
  186. opacity: 0;
  187. }
  188. }
  189. }
  190. .inquiry{
  191. width: 131upx;
  192. height: 131upx;
  193. position: fixed;
  194. right: 22upx;
  195. bottom: 193upx;
  196. z-index: 99;
  197. .content{
  198. position: relative;
  199. image{
  200. width: 100%;
  201. height: 100%;
  202. position: absolute;
  203. top: 0;
  204. left: 0;
  205. z-index: 9;
  206. }
  207. .text{
  208. position: absolute;
  209. top: 70upx;
  210. left: 50%;
  211. transform: translateX(-50%);
  212. z-index: 10;
  213. font-size: 22upx;
  214. font-family: PingFang SC;
  215. font-weight: bold;
  216. color: #018C39;
  217. line-height: 1;
  218. }
  219. }
  220. }
  221. .contact-btn{
  222. display: inline-block;
  223. position: absolute;
  224. top: 0;
  225. left: 0;
  226. width: 100%;
  227. height: 100%;
  228. opacity: 0;
  229. z-index: 9999;
  230. }
  231. </style>