exchangeShare.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 44px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="交流圈">
  7. <image src="../../static/image/expertDiagnosis/tianjiawenjian.png" mode="" class="right_icon" @click="postmessage"></image>
  8. </uni-nav-bar>
  9. </view>
  10. <u-action-sheet :list="actionSheetList" v-model="post_show" @click="message"></u-action-sheet>
  11. <view class="invitations">
  12. <view class="invitations_item" v-for="(items,index) in invitation" :key="index" @click="particulars(items)">
  13. <view class="invitations_item_left">
  14. <image :src="items.img_urls" mode="" v-if="items.img_urls!='' && items.img_urls!=null"></image>
  15. <image :src="$imghost+defaultimg" mode="" v-else></image>
  16. </view>
  17. <view class="invitations_item_right">
  18. <view class="invitations_item_right_top">
  19. <image src="../../static/image/expertDiagnosis/6940a11a251770f1b0d8b7b10ebdf9b.png" mode="" v-if="Number(items.heat) == 1"></image>
  20. <span>{{items.title}}</span>
  21. </view>
  22. <view class="invitations_item_right_contert" v-html="items.content">
  23. </view>
  24. <view class="invitations_item_right_bot">
  25. <image src="../../static/image/expertDiagnosis/d2014837228702eeceb762bc5302b3f.png" mode=""></image>
  26. <span>{{items.username}}</span>
  27. <p>查看详情</p>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. // pest.pests.pests_heat_rank
  40. invitation: [],
  41. actionSheetList: [{
  42. text: "我的发帖"
  43. }, {
  44. text: "我要发帖"
  45. }],
  46. post_show: false,
  47. defaultimg: '/images/expertDiagnosis/img01.png'
  48. }
  49. },
  50. methods: {
  51. async getInvitation() { //获取问题
  52. const res = await this.$myRequest({
  53. url: '/api/api_gateway?method=pest.pests.pests_heat_rank',
  54. })
  55. this.invitation = res.data
  56. for (var i = 0; i < this.invitation.length; i++) {
  57. var index1 = this.invitation[i].content.indexOf("/>") + 2
  58. var index2 = this.invitation[i].content.indexOf('<img')
  59. var str = this.invitation[i].content.slice(index2, index1)
  60. this.invitation[i].content = this.invitation[i].content.replace(str, '')
  61. }
  62. console.log(this.invitation)
  63. },
  64. async getInvitationMy(str) { //获取自己的发帖
  65. const res = await this.$myRequest({
  66. url: '/api/api_gateway?method=pest.pests.pests_answers_list',
  67. data: {
  68. screen: str
  69. }
  70. })
  71. this.invitation = res.data
  72. for (var i = 0; i < this.invitation.length; i++) {
  73. var index1 = this.invitation[i].content.indexOf("/>") + 2
  74. var index2 = this.invitation[i].content.indexOf('<img')
  75. var str = this.invitation[i].content.slice(index2, index1)
  76. this.invitation[i].content = this.invitation[i].content.replace(str, '')
  77. }
  78. console.log(this.invitation)
  79. },
  80. clickLeft() {
  81. uni.navigateTo({
  82. url: 'index'
  83. })
  84. },
  85. particulars(items) { //详情页
  86. uni.navigateTo({
  87. url: "particulars?items=" + JSON.stringify(items)
  88. })
  89. },
  90. postmessage() { //发帖
  91. this.post_show = true
  92. },
  93. message(index) {
  94. if (this.actionSheetList[index].text.includes("我要发帖")) {
  95. uni.navigateTo({
  96. url: "./postmessage"
  97. })
  98. } else if (this.actionSheetList[index].text.includes("我的发帖")) {
  99. this.actionSheetList[index].text = "全部发帖"
  100. this.getInvitationMy("my")
  101. } else if (this.actionSheetList[index].text.includes("全部发帖")) {
  102. this.getInvitation()
  103. }
  104. }
  105. },
  106. onLoad() {
  107. this.getInvitation()
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .right_icon {
  113. width: 40rpx;
  114. height: 40rpx;
  115. position: absolute;
  116. top: 26rpx;
  117. right: 26rpx;
  118. }
  119. .invitations {
  120. width: 100%;
  121. position: relative;
  122. top: 88rpx;
  123. .invitations_item {
  124. width: 90%;
  125. margin: 0 auto;
  126. display: flex;
  127. justify-content: space-between;
  128. padding: 30rpx 0;
  129. .invitations_item_left {
  130. width: 26%;
  131. image {
  132. width: 100%;
  133. height: 180rpx;
  134. }
  135. }
  136. .invitations_item_right {
  137. width: 71%;
  138. position: relative;
  139. .invitations_item_right_top {
  140. width: 100%;
  141. image {
  142. width: 32rpx;
  143. height: 32rpx;
  144. margin: 0 16rpx 0 0;
  145. vertical-align: text-bottom;
  146. }
  147. span {
  148. font-weight: 700;
  149. }
  150. }
  151. .invitations_item_right_contert {
  152. width: 100%;
  153. margin: 10rpx 0;
  154. overflow: hidden;
  155. -webkit-line-clamp: 2;
  156. text-overflow: ellipsis;
  157. display: -webkit-box;
  158. -webkit-box-orient: vertical;
  159. }
  160. .invitations_item_right_bot {
  161. display: flex;
  162. position: absolute;
  163. bottom: 12rpx;
  164. height: 50rpx;
  165. width: 100%;
  166. image {
  167. width: 50rpx;
  168. height: 50rpx;
  169. position: absolute;
  170. }
  171. span {
  172. color: #B9B9B9;
  173. margin-left: 74rpx;
  174. line-height: 50rpx;
  175. }
  176. p {
  177. width: 100rpx;
  178. height: 40rpx;
  179. font-size: 24rpx;
  180. border: 2rpx solid #5FAE50;
  181. line-height: 40rpx;
  182. padding: 0 10rpx;
  183. position: absolute;
  184. right: 0;
  185. top: 6rpx;
  186. color: #5FAE50;
  187. }
  188. }
  189. }
  190. }
  191. }
  192. </style>