particulars.vue 7.8 KB

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