particulars.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view style="position: fixed;top: 40px;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.quizdata.content=this.quizdata.content.replace(/src/g,"none")
  166. this.quizdata.content=this.quizdata.content.replace(/width/g,"none")
  167. this.quizdata.content=this.quizdata.content.replace(/height/g,"none")
  168. this.getParticulars(this.quizdata.lower)
  169. },
  170. recursion(index) {//提取图片链接 递归方法
  171. if (index + 1) {
  172. var src = this.quizdata.content.slice(index, this.quizdata.content.indexOf('"', index))
  173. var length = src.length
  174. var obj = {
  175. image: src
  176. }
  177. this.list.push(obj)
  178. console.log(src)
  179. var index3 = this.quizdata.content.indexOf('http', index + length)
  180. console.log(index3)
  181. this.recursion(index3)
  182. }
  183. }
  184. },
  185. onLoad(option) {
  186. console.log(option.items)
  187. this.getInvitation(option.items)
  188. }
  189. }
  190. </script>
  191. <style lang="scss">
  192. // .u-swiper-wrap {
  193. // width: 95%;
  194. // margin: 20rpx auto;
  195. // }
  196. .partitlteimg {
  197. width: 95%;
  198. margin: 0 auto 20rpx;
  199. height: 428rpx;
  200. image {
  201. max-width: 100%;
  202. max-height: 100%;
  203. }
  204. }
  205. .quiz {
  206. width: 95%;
  207. margin: 20rpx auto;
  208. border-bottom: 4rpx dashed #E8E8E8;
  209. .quiz_title{
  210. width: 100%;
  211. font-size: 36rpx;
  212. font-weight: 700;
  213. text-align: center;
  214. }
  215. .quiz_username {
  216. width: 100%;
  217. image {
  218. width: 40rpx;
  219. height: 40rpx;
  220. vertical-align: middle;
  221. margin-right: 20rpx;
  222. }
  223. span {
  224. font-weight: 700;
  225. font-size: 32rpx;
  226. }
  227. }
  228. .quiz_usertime {
  229. width: 100%;
  230. margin-top: 15rpx;
  231. display: flex;
  232. justify-content: space-between;
  233. image {
  234. width: 50rpx;
  235. height: 50rpx;
  236. margin-right: 20rpx;
  237. border-radius: 50%;
  238. }
  239. span {
  240. font-size: 24rpx;
  241. color: #C1C1C1;
  242. font-weight: 700;
  243. }
  244. }
  245. .quiz_usercontert {
  246. padding: 20rpx;
  247. margin-bottom: 20rpx;
  248. overflow: hidden;
  249. rich-text{
  250. // display: none;
  251. color: red;
  252. image{
  253. width: 0 !important;
  254. }
  255. img{
  256. width: 0 !important;
  257. }
  258. /deep/p{
  259. color: red;
  260. }
  261. /deep/image{
  262. width: 0 !important;
  263. height: 0 !important;
  264. display: none;
  265. }
  266. /deep/img{
  267. width: 0 !important;
  268. height: 0 !important;
  269. display: none;
  270. }
  271. }
  272. }
  273. }
  274. .comment {
  275. width: 95%;
  276. margin: 20rpx auto 0;
  277. .comment_title {
  278. font-weight: 700;
  279. font-size: 32rpx;
  280. }
  281. .scroll-view_H {
  282. height: 600rpx;
  283. padding-bottom: 100rpx;
  284. }
  285. .comment_unit {
  286. .comment_unit_user {
  287. display: flex;
  288. justify-content: space-between;
  289. margin-top: 20rpx;
  290. .username {
  291. display: flex;
  292. align-items: center;
  293. image {
  294. width: 50rpx;
  295. height: 50rpx;
  296. margin-right: 20rpx;
  297. border-radius: 50%;
  298. }
  299. p {
  300. width: 60rpx;
  301. height: 30rpx;
  302. color: white;
  303. background-color: #5CA348;
  304. font-size: 24rpx;
  305. text-align: center;
  306. line-height: 30rpx;
  307. padding: 0 10rpx;
  308. margin-left: 20rpx;
  309. border-radius: 8rpx;
  310. }
  311. }
  312. }
  313. .comment_unit_con {
  314. padding-left: 60rpx;
  315. /deep/p {
  316. margin-top: 20rpx;
  317. img {
  318. margin-top: 20rpx;
  319. display: block;
  320. width: 180rpx !important;
  321. height: 180rpx !important;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. .issue_box {
  328. width: 100%;
  329. background-color: #FFFFFF;
  330. }
  331. .issue {
  332. width: 95%;
  333. margin: 0 auto;
  334. display: flex;
  335. padding-bottom: 20rpx;
  336. input {
  337. width: 90%;
  338. background-color: #F3F3F3;
  339. height: 60rpx;
  340. text-indent: 1em;
  341. }
  342. p {
  343. width: 10%;
  344. text-align: right;
  345. line-height: 60rpx;
  346. color: #7a7a7a;
  347. }
  348. }
  349. </style>