particulars.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view>
  3. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="详情"></uni-nav-bar>
  4. <u-swiper :list="list" height="428"></u-swiper>
  5. <view class="quiz">
  6. <view class="quiz_username">
  7. <image src="../../static/image/expertDiagnosis/6940a11a251770f1b0d8b7b10ebdf9b.png" mode="" v-if="Number(quizdata.heat)==1"></image>
  8. <span>{{quizdata.title}}</span>
  9. </view>
  10. <view class="quiz_usertime">
  11. <view style="display: flex;align-items: center;">
  12. <image src="../../static/image/fourMoodBase/touxiang.png" mode=""></image>
  13. <span>{{quizdata.username}}</span>
  14. </view>
  15. <view>
  16. <span>{{quizdata.adtime|timeFormat()}}</span>
  17. </view>
  18. </view>
  19. <view class="quiz_usercontert" v-html="quizdata.content"></view>
  20. </view>
  21. <view class="comment">
  22. <p class="comment_title">评论</p>
  23. <view class="comment_unit" v-for="(item,index) in commentdata" :key="index">
  24. <view class="comment_unit_user">
  25. <view class="username">
  26. <image :src="item.image" mode=""></image>
  27. <span style="font-size: 26rpx;color:#C1C1C1;">{{item.username}}</span>
  28. <p v-if="Number(item.user_type) == 1">专家</p>
  29. </view>
  30. <view>
  31. <span style="font-size: 26rpx;color:#C1C1C1;">{{item.uptime|timeFormat()}}</span>
  32. </view>
  33. </view>
  34. <view class="comment_unit_con">
  35. <p v-html="item.content"></p>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="issue_box">
  40. <view class="issue">
  41. <input type="text" v-model="issuedata"/>
  42. <p @click="issue">发布</p>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. list: [{}],
  52. quizdata: {},
  53. commentdata: [],
  54. issuedata:'',
  55. defaultimg: '/images/expertDiagnosis/img01.png',
  56. }
  57. },
  58. methods: {//
  59. async getParticulars(data) {
  60. const res = await this.$myRequest({
  61. url: '/api/api_gateway?method=pest.pests.pests_answers_list',
  62. data: {
  63. lower: data.lower
  64. }
  65. })
  66. this.commentdata = res.data
  67. console.log(this.commentdata)
  68. },
  69. async getDiscuss(data) {
  70. const res = await this.$myRequest({
  71. url: '/api/api_gateway?method=pest.pests.pests_new_idea',
  72. data: {
  73. lower: data.lower,
  74. content:data.content
  75. }
  76. })
  77. console.log(res)
  78. },
  79. clickLeft() {
  80. uni.navigateTo({
  81. url: "exchangeShare"
  82. })
  83. },
  84. issue(){//发布评论
  85. let obj = {}
  86. obj.lower = this.quizdata.lower
  87. obj.content=this.issuedata
  88. if(this.issuedata!=''){
  89. this.getDiscuss(obj)
  90. }
  91. uni.navigateTo({
  92. url:"particulars?items="+JSON.stringify(this.quizdata)
  93. })
  94. }
  95. },
  96. onLoad(option) {
  97. this.quizdata = JSON.parse(option.items)
  98. console.log(this.quizdata.img_urls)
  99. if(this.quizdata.img_urls =='' || this.quizdata.img_urls ==null){
  100. this.list[0].image = 'http://static.yfpyx.com/projectimg'+this.defaultimg
  101. }else{
  102. this.list[0].image = this.quizdata.img_urls
  103. }
  104. let data = {}
  105. data.lower = this.quizdata.lower
  106. this.getParticulars(data)
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .u-swiper-wrap {
  112. width: 95%;
  113. margin: 20rpx auto;
  114. }
  115. .quiz {
  116. width: 95%;
  117. margin: 20rpx auto;
  118. border-bottom: 4rpx dashed #E8E8E8;
  119. .quiz_username {
  120. width: 100%;
  121. image {
  122. width: 40rpx;
  123. height: 40rpx;
  124. vertical-align: middle;
  125. margin-right: 20rpx;
  126. }
  127. span{
  128. font-weight: 700;
  129. font-size: 32rpx;
  130. }
  131. }
  132. .quiz_usertime {
  133. width: 100%;
  134. margin-top: 15rpx;
  135. display: flex;
  136. justify-content: space-between;
  137. image {
  138. width: 50rpx;
  139. height: 50rpx;
  140. margin-right: 20rpx;
  141. }
  142. span {
  143. font-size: 12rpx;
  144. color: #C1C1C1;
  145. }
  146. }
  147. .quiz_usercontert {
  148. padding: 20rpx;
  149. margin-bottom: 20rpx;
  150. }
  151. }
  152. .comment {
  153. width: 95%;
  154. margin: 20rpx auto 0;
  155. .comment_title {
  156. font-weight: 700;
  157. font-size: 32rpx;
  158. }
  159. .comment_unit {
  160. .comment_unit_user {
  161. display: flex;
  162. justify-content: space-between;
  163. margin-top: 20rpx;
  164. .username {
  165. display: flex;
  166. align-items: center;
  167. image {
  168. width: 50rpx;
  169. height: 50rpx;
  170. margin-right: 20rpx;
  171. border-radius: 50%;
  172. }
  173. p{
  174. width: 60rpx;
  175. height: 30rpx;
  176. color: white;
  177. background-color: #5CA348;
  178. font-size: 24rpx;
  179. text-align: center;
  180. line-height: 30rpx;
  181. padding: 0 10rpx;
  182. margin-left: 20rpx;
  183. border-radius: 8rpx;
  184. }
  185. }
  186. }
  187. .comment_unit_con {
  188. padding-left: 60rpx;
  189. /deep/p {
  190. margin-top: 20rpx;
  191. img {
  192. margin-top: 20rpx;
  193. display: block;
  194. width: 180rpx !important;
  195. height: 180rpx !important;
  196. }
  197. }
  198. }
  199. }
  200. }
  201. .issue_box{
  202. width: 100%;
  203. position: fixed;
  204. bottom: 0;
  205. background-color: #FFFFFF;
  206. }
  207. .issue{
  208. width: 95%;
  209. margin: 0 auto;
  210. display: flex;
  211. padding-bottom: 20rpx;
  212. input{
  213. width: 90%;
  214. background-color: #F3F3F3;
  215. height: 60rpx;
  216. text-indent: 1em;
  217. }
  218. p{
  219. width: 10%;
  220. text-align: right;
  221. line-height: 60rpx;
  222. color: #7a7a7a;
  223. }
  224. }
  225. </style>