particulars.vue 8.8 KB

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