questionsDetails.vue 4.5 KB

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