particulars.vue 4.8 KB

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