questionsDetails.vue 4.7 KB

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