exchangeShare.vue 5.0 KB

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