questionsDetails.vue 4.5 KB

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