particulars.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view style="position: fixed;top: 64px;">
  5. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="详情"></uni-nav-bar>
  6. <u-swiper :list="list" height="428" @click="examine(list)"></u-swiper>
  7. <view class="quiz">
  8. <view class="quiz_username">
  9. <image :src="'http://static.yfpyx.com/bigdata_app'+'/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="'http://static.yfpyx.com/bigdata_app'+'/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. examine(list){
  122. console.log(list)
  123. var imgarr =[]
  124. for(var i=0;i<list.length;i++){
  125. imgarr.unshift(list[i].image)
  126. }
  127. console.log(imgarr)
  128. uni.previewImage({
  129. urls: imgarr
  130. });
  131. }
  132. },
  133. onLoad(option) {
  134. this.quizdata = JSON.parse(option.items)
  135. console.log(this.quizdata.lower)
  136. if (this.quizdata.img_urls == '' || this.quizdata.img_urls == null) {
  137. this.list[0].image = 'http://static.yfpyx.com/projectimg' + this.defaultimg
  138. } else {
  139. this.list[0].image = this.quizdata.img_urls
  140. }
  141. this.getParticulars(this.quizdata.lower)
  142. }
  143. }
  144. </script>
  145. <style lang="scss">
  146. .u-swiper-wrap {
  147. width: 95%;
  148. margin: 20rpx auto;
  149. }
  150. .quiz {
  151. width: 95%;
  152. margin: 20rpx auto;
  153. border-bottom: 4rpx dashed #E8E8E8;
  154. .quiz_username {
  155. width: 100%;
  156. image {
  157. width: 40rpx;
  158. height: 40rpx;
  159. vertical-align: middle;
  160. margin-right: 20rpx;
  161. }
  162. span {
  163. font-weight: 700;
  164. font-size: 32rpx;
  165. }
  166. }
  167. .quiz_usertime {
  168. width: 100%;
  169. margin-top: 15rpx;
  170. display: flex;
  171. justify-content: space-between;
  172. image {
  173. width: 50rpx;
  174. height: 50rpx;
  175. margin-right: 20rpx;
  176. }
  177. span {
  178. font-size: 24rpx;
  179. color: #C1C1C1;
  180. font-weight: 700;
  181. }
  182. }
  183. .quiz_usercontert {
  184. padding: 20rpx;
  185. margin-bottom: 20rpx;
  186. }
  187. }
  188. .comment {
  189. width: 95%;
  190. margin: 20rpx auto 0;
  191. .comment_title {
  192. font-weight: 700;
  193. font-size: 32rpx;
  194. }
  195. .scroll-view_H {
  196. height: 600rpx;
  197. }
  198. .comment_unit {
  199. .comment_unit_user {
  200. display: flex;
  201. justify-content: space-between;
  202. margin-top: 20rpx;
  203. .username {
  204. display: flex;
  205. align-items: center;
  206. image {
  207. width: 50rpx;
  208. height: 50rpx;
  209. margin-right: 20rpx;
  210. border-radius: 50%;
  211. }
  212. p {
  213. width: 60rpx;
  214. height: 30rpx;
  215. color: white;
  216. background-color: #5CA348;
  217. font-size: 24rpx;
  218. text-align: center;
  219. line-height: 30rpx;
  220. padding: 0 10rpx;
  221. margin-left: 20rpx;
  222. border-radius: 8rpx;
  223. }
  224. }
  225. }
  226. .comment_unit_con {
  227. padding-left: 60rpx;
  228. /deep/p {
  229. margin-top: 20rpx;
  230. img {
  231. margin-top: 20rpx;
  232. display: block;
  233. width: 180rpx !important;
  234. height: 180rpx !important;
  235. }
  236. }
  237. }
  238. }
  239. }
  240. .issue_box {
  241. width: 100%;
  242. background-color: #FFFFFF;
  243. }
  244. .issue {
  245. width: 95%;
  246. margin: 0 auto;
  247. display: flex;
  248. padding-bottom: 20rpx;
  249. input {
  250. width: 90%;
  251. background-color: #F3F3F3;
  252. height: 60rpx;
  253. text-indent: 1em;
  254. }
  255. p {
  256. width: 10%;
  257. text-align: right;
  258. line-height: 60rpx;
  259. color: #7a7a7a;
  260. }
  261. }
  262. </style>