particulars.vue 7.5 KB

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