particulars.vue 6.4 KB

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