particulars.vue 6.2 KB

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