particulars.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view style="position: fixed;top: 44px;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="详情"></uni-nav-bar>
  6. <u-swiper :list="list" height="428"></u-swiper>
  7. <view class="quiz">
  8. <view class="quiz_username">
  9. <image src="../../static/image/expertDiagnosis/6940a11a251770f1b0d8b7b10ebdf9b.png" mode="" v-if="Number(quizdata.heat)==1"></image>
  10. <span>{{quizdata.title}}</span>
  11. </view>
  12. <view class="quiz_usertime">
  13. <view style="display: flex;align-items: center;">
  14. <image src="../../static/image/fourMoodBase/touxiang.png" mode=""></image>
  15. <span>{{quizdata.username}}</span>
  16. </view>
  17. <view>
  18. <span>{{quizdata.adtime|timeFormat()}}</span>
  19. </view>
  20. </view>
  21. <view class="quiz_usercontert" v-html="quizdata.content"></view>
  22. </view>
  23. <view class="comment">
  24. <p class="comment_title">评论</p>
  25. <scroll-view class="scroll-view_H" :scroll-y="true" @scrolltolower="scroll" scroll-top="0">
  26. <view class="comment_unit" v-for="(item,index) in commentdata" :key="index">
  27. <view class="comment_unit_user">
  28. <view class="username">
  29. <image :src="item.image" mode=""></image>
  30. <span style="font-size: 26rpx;color:#C1C1C1;">{{item.username}}</span>
  31. <p v-if="Number(item.user_type) == 1">专家</p>
  32. </view>
  33. <view>
  34. <span style="font-size: 26rpx;color:#C1C1C1;">{{item.uptime|timeFormat()}}</span>
  35. </view>
  36. </view>
  37. <view class="comment_unit_con">
  38. <p v-html="item.content"></p>
  39. </view>
  40. </view>
  41. </scroll-view>
  42. </view>
  43. </view>
  44. <view class="issue_box" :style="{position: 'absolute',bottom: height+'px'}">
  45. <view class="issue">
  46. <input type="text" v-model="issuedata" @focus="focus" :auto-blur="true" :adjust-position='false' @blur="blur"
  47. @confirm="confirm" />
  48. <p @click="issue">发布</p>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. list: [{}],
  58. quizdata: {},
  59. commentdata: [],
  60. issuedata: '',
  61. defaultimg: '/images/expertDiagnosis/img01.png',
  62. height: 0,
  63. page: 1,
  64. }
  65. },
  66. methods: { //
  67. async getParticulars(datas) {//获取评论列表
  68. const res = await this.$myRequest({
  69. url: '/api/api_gateway?method=pest.pests.pests_answers_list',
  70. data: {
  71. lower: datas,
  72. page: this.page,
  73. page_size: 10
  74. }
  75. })
  76. this.commentdata = this.commentdata.concat(res.data)
  77. console.log(res.data)
  78. },
  79. async getDiscuss(data) {//发布评论
  80. const res = await this.$myRequest({
  81. url: '/api/api_gateway?method=pest.pests.pests_new_idea',
  82. data: {
  83. lower: data.lower,
  84. content: data.content,
  85. }
  86. })
  87. if(res.code==200){
  88. this.commentdata = []
  89. this.page = 1
  90. this.getParticulars(this.quizdata.lower)
  91. }
  92. console.log(res)
  93. },
  94. clickLeft() {
  95. uni.navigateTo({
  96. url: "./exchangeShare"
  97. })
  98. },
  99. issue() { //发布评论
  100. let obj = {}
  101. obj.lower = this.quizdata.lower
  102. obj.content = this.issuedata
  103. if (this.issuedata != '') {
  104. this.getDiscuss(obj)
  105. this.issuedata = ''
  106. }
  107. },
  108. focus(e) {
  109. this.height = e.detail.height
  110. },
  111. blur() {
  112. this.height = 0
  113. },
  114. confirm() {
  115. this.issue()
  116. },
  117. scroll(e) {
  118. this.page++
  119. this.getParticulars(this.quizdata.lower)
  120. }
  121. },
  122. onLoad(option) {
  123. this.quizdata = JSON.parse(option.items)
  124. console.log(this.quizdata.lower)
  125. if (this.quizdata.img_urls == '' || this.quizdata.img_urls == null) {
  126. this.list[0].image = 'http://static.yfpyx.com/projectimg' + this.defaultimg
  127. } else {
  128. this.list[0].image = this.quizdata.img_urls
  129. }
  130. this.getParticulars(this.quizdata.lower)
  131. }
  132. }
  133. </script>
  134. <style lang="scss">
  135. .u-swiper-wrap {
  136. width: 95%;
  137. margin: 20rpx auto;
  138. }
  139. .quiz {
  140. width: 95%;
  141. margin: 20rpx auto;
  142. border-bottom: 4rpx dashed #E8E8E8;
  143. .quiz_username {
  144. width: 100%;
  145. image {
  146. width: 40rpx;
  147. height: 40rpx;
  148. vertical-align: middle;
  149. margin-right: 20rpx;
  150. }
  151. span {
  152. font-weight: 700;
  153. font-size: 32rpx;
  154. }
  155. }
  156. .quiz_usertime {
  157. width: 100%;
  158. margin-top: 15rpx;
  159. display: flex;
  160. justify-content: space-between;
  161. image {
  162. width: 50rpx;
  163. height: 50rpx;
  164. margin-right: 20rpx;
  165. }
  166. span {
  167. font-size: 24rpx;
  168. color: #C1C1C1;
  169. font-weight: 700;
  170. }
  171. }
  172. .quiz_usercontert {
  173. padding: 20rpx;
  174. margin-bottom: 20rpx;
  175. }
  176. }
  177. .comment {
  178. width: 95%;
  179. margin: 20rpx auto 0;
  180. .comment_title {
  181. font-weight: 700;
  182. font-size: 32rpx;
  183. }
  184. .scroll-view_H {
  185. height: 600rpx;
  186. }
  187. .comment_unit {
  188. .comment_unit_user {
  189. display: flex;
  190. justify-content: space-between;
  191. margin-top: 20rpx;
  192. .username {
  193. display: flex;
  194. align-items: center;
  195. image {
  196. width: 50rpx;
  197. height: 50rpx;
  198. margin-right: 20rpx;
  199. border-radius: 50%;
  200. }
  201. p {
  202. width: 60rpx;
  203. height: 30rpx;
  204. color: white;
  205. background-color: #5CA348;
  206. font-size: 24rpx;
  207. text-align: center;
  208. line-height: 30rpx;
  209. padding: 0 10rpx;
  210. margin-left: 20rpx;
  211. border-radius: 8rpx;
  212. }
  213. }
  214. }
  215. .comment_unit_con {
  216. padding-left: 60rpx;
  217. /deep/p {
  218. margin-top: 20rpx;
  219. img {
  220. margin-top: 20rpx;
  221. display: block;
  222. width: 180rpx !important;
  223. height: 180rpx !important;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. .issue_box {
  230. width: 100%;
  231. background-color: #FFFFFF;
  232. }
  233. .issue {
  234. width: 95%;
  235. margin: 0 auto;
  236. display: flex;
  237. padding-bottom: 20rpx;
  238. input {
  239. width: 90%;
  240. background-color: #F3F3F3;
  241. height: 60rpx;
  242. text-indent: 1em;
  243. }
  244. p {
  245. width: 10%;
  246. text-align: right;
  247. line-height: 60rpx;
  248. color: #7a7a7a;
  249. }
  250. }
  251. </style>