questionsDetails.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="content">
  3. <!-- #ifdef APP -->
  4. <u-navbar
  5. :title="item.title"
  6. :autoBack="true"
  7. ></u-navbar>
  8. <view style="height: 160rpx;"></view>
  9. <!-- #endif -->
  10. <view class="detail-cont">
  11. <view class="title">{{item.title}}</view>
  12. <view class="info">
  13. <view class="reads">阅读数:{{item.views}}</view>
  14. <view class="time">{{item.createTime}}</view>
  15. </view>
  16. <!-- 正文 -->
  17. <view class="full-text">
  18. <view v-html="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://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20241018/b810f26926904253ae46ea4e93b71dee.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://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20241018/b810f26926904253ae46ea4e93b71dee.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. .content{
  81. height: 100%;
  82. display: flex;
  83. flex-direction: column;
  84. }
  85. .detail-cont{
  86. flex: 1;
  87. padding: 40upx;
  88. overflow-y: auto;
  89. .title{
  90. font-size: 40upx;
  91. font-family: PingFang SC;
  92. // font-weight: bold;
  93. color: #222222;
  94. line-height: 70upx;
  95. }
  96. .info{
  97. display: flex;
  98. align-items: center;
  99. font-size: 24upx;
  100. font-family: PingFang SC;
  101. font-weight: 500;
  102. color: #999999;
  103. line-height: 48upx;
  104. margin: 23upx 0;
  105. .reads{
  106. margin-right: 30upx;
  107. }
  108. }
  109. .full-text{
  110. font-size: 36upx;
  111. font-family: PingFang SC;
  112. // font-weight: 500;
  113. color: #222222;
  114. line-height: 60upx;
  115. }
  116. }
  117. .recent-reads{
  118. flex-shrink: 0;
  119. box-sizing: border-box;
  120. height: 121upx;
  121. background: #FFFFFF;
  122. border-top: 1px solid #F0F0F0;
  123. padding: 0 40upx 0 37upx;
  124. display: flex;
  125. align-items: center;
  126. justify-content: space-between;
  127. .left{
  128. display: flex;
  129. align-items: center;
  130. .label{
  131. font-size: 28upx;
  132. font-family: PingFang SC;
  133. font-weight: 500;
  134. color: #666666;
  135. line-height: 1;
  136. margin-right: 20upx;
  137. }
  138. .peop-box{
  139. display: flex;
  140. align-items: center;
  141. .head-box{
  142. margin-right: 28upx;
  143. display: flex;
  144. align-items: center;
  145. .head{
  146. width: 48upx;
  147. height: 48upx;
  148. border-radius: 50%;
  149. overflow: hidden;
  150. box-shadow: 0 0 0 1px #fff;
  151. margin-right: -10upx;
  152. image{
  153. width: 100%;
  154. height: 100%;
  155. }
  156. }
  157. }
  158. .arrow{
  159. width: 13upx;
  160. height: 23upx;
  161. }
  162. }
  163. }
  164. .share-btn{
  165. position: relative;
  166. width: 240upx;
  167. height: 80upx;
  168. line-height: 80upx;
  169. font-size: 30upx;
  170. font-family: PingFang SC;
  171. font-weight: 500;
  172. color: #FFFFFF;
  173. background: #018C39;
  174. border-radius: 40upx;
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. image{
  179. width: 32upx;
  180. height: 32upx;
  181. margin-right: 15upx;
  182. }
  183. .share{
  184. position: absolute;
  185. width: 100%;
  186. height: 100%;
  187. opacity: 0;
  188. }
  189. }
  190. }
  191. .inquiry{
  192. width: 131upx;
  193. height: 131upx;
  194. position: fixed;
  195. right: 22upx;
  196. bottom: 193upx;
  197. z-index: 99;
  198. .content{
  199. position: relative;
  200. image{
  201. width: 100%;
  202. height: 100%;
  203. position: absolute;
  204. top: 0;
  205. left: 0;
  206. z-index: 9;
  207. }
  208. .text{
  209. position: absolute;
  210. top: 70upx;
  211. left: 50%;
  212. transform: translateX(-50%);
  213. z-index: 10;
  214. font-size: 22upx;
  215. font-family: PingFang SC;
  216. font-weight: bold;
  217. color: #018C39;
  218. line-height: 1;
  219. }
  220. }
  221. }
  222. .contact-btn{
  223. display: inline-block;
  224. position: absolute;
  225. top: 0;
  226. left: 0;
  227. width: 100%;
  228. height: 100%;
  229. opacity: 0;
  230. z-index: 9999;
  231. }
  232. </style>