particulars.vue 7.8 KB

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