exchangeShare.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 class="delinvit" v-if="myTF" @click.stop="delinvit(items.lower)">
  30. 删除
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. // pest.pests.pests_heat_rank
  43. invitation: [],
  44. actionSheetList: [{
  45. text: "我的发帖"
  46. }, {
  47. text: "我要发帖"
  48. }],
  49. post_show: false,
  50. defaultimg: '/images/expertDiagnosis/img01.png',
  51. page:1,
  52. myTF:false //判断是全部发帖还是我的fatie
  53. }
  54. },
  55. methods: {
  56. async getInvitation(str) { //获取全部发帖 自己发帖"my"
  57. const res = await this.$myRequest({
  58. url: '/api/api_gateway?method=pest.pests.pests_answers_list',
  59. data: {
  60. screen:str,
  61. page:this.page,
  62. page_size:10
  63. }
  64. })
  65. this.invitation = this.invitation.concat(res.data)
  66. for (var i = 0; i < this.invitation.length; i++) {
  67. var index1 = this.invitation[i].content.indexOf("/>") + 2
  68. var index2 = this.invitation[i].content.indexOf('<img')
  69. var str = this.invitation[i].content.slice(index2, index1)
  70. this.invitation[i].content = this.invitation[i].content.replace(str, '')
  71. }
  72. console.log(this.invitation)
  73. },
  74. //pest.pests.del_pests_card删除帖子
  75. async delInvitation(data) { //获取全部发帖 自己发帖"my"
  76. const res = await this.$myRequest({
  77. url: '/api/api_gateway?method=pest.pests.del_pests_card',
  78. data: {
  79. lower:data,
  80. card:1
  81. }
  82. })
  83. if(res.code==200){
  84. this.$forceUpdate()
  85. }
  86. },
  87. clickLeft() {
  88. uni.navigateTo({
  89. url: 'index'
  90. })
  91. },
  92. particulars(items) { //详情页
  93. uni.navigateTo({
  94. url: "particulars?items=" + JSON.stringify(items)
  95. })
  96. },
  97. postmessage() { //发帖
  98. this.post_show = true
  99. },
  100. message(index) {
  101. if (this.actionSheetList[index].text.includes("我要发帖")) {
  102. uni.navigateTo({
  103. url: "./postmessage"
  104. })
  105. } else if (this.actionSheetList[index].text.includes("我的发帖")) {
  106. this.actionSheetList[index].text = "全部发帖"
  107. this.pege =1
  108. let str = "my"
  109. this.invitation = []
  110. this.getInvitation(str)
  111. this.myTF = true
  112. } else if (this.actionSheetList[index].text.includes("全部发帖")) {
  113. this.pege =1
  114. let str = ""
  115. this.invitation = []
  116. this.getInvitation(str)
  117. this.myTF = false
  118. }
  119. },
  120. delinvit(items){
  121. uni.showModal({
  122. title: '提示',
  123. content: '是否删除该帖子?',
  124. success: (res)=> {
  125. if (res.confirm) {
  126. this.delInvitation(items)
  127. this.pege =1
  128. let str = "my"
  129. this.invitation = []
  130. this.getInvitation(str)
  131. } else if (res.cancel) {
  132. console.log('用户点击取消');
  133. }
  134. }
  135. });
  136. }
  137. },
  138. onLoad() {
  139. let str = ""
  140. this.getInvitation(str)
  141. },
  142. onReachBottom(){
  143. this.page ++
  144. if(this.myTF){
  145. let str = "my"
  146. this.getInvitation(str)
  147. }else{
  148. let str = ""
  149. this.getInvitation(str)
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .right_icon {
  156. width: 40rpx;
  157. height: 40rpx;
  158. position: absolute;
  159. top: 26rpx;
  160. right: 26rpx;
  161. }
  162. .invitations {
  163. width: 100%;
  164. position: relative;
  165. top: 88rpx;
  166. .invitations_item {
  167. width: 90%;
  168. margin: 0 auto;
  169. display: flex;
  170. justify-content: space-between;
  171. padding: 30rpx 0;
  172. .invitations_item_left {
  173. width: 26%;
  174. image {
  175. width: 100%;
  176. height: 180rpx;
  177. }
  178. }
  179. .invitations_item_right {
  180. width: 71%;
  181. position: relative;
  182. .invitations_item_right_top {
  183. width: 100%;
  184. image {
  185. width: 32rpx;
  186. height: 32rpx;
  187. margin: 0 16rpx 0 0;
  188. vertical-align: text-bottom;
  189. }
  190. span {
  191. font-weight: 700;
  192. }
  193. }
  194. .delinvit{
  195. position: absolute;
  196. right: 0;
  197. top: 0;
  198. color: #ff0000;
  199. }
  200. .invitations_item_right_contert {
  201. width: 100%;
  202. margin: 10rpx 0;
  203. overflow: hidden;
  204. -webkit-line-clamp: 2;
  205. text-overflow: ellipsis;
  206. display: -webkit-box;
  207. -webkit-box-orient: vertical;
  208. }
  209. .invitations_item_right_bot {
  210. display: flex;
  211. position: absolute;
  212. bottom: 12rpx;
  213. height: 50rpx;
  214. width: 100%;
  215. image {
  216. width: 50rpx;
  217. height: 50rpx;
  218. position: absolute;
  219. }
  220. span {
  221. color: #B9B9B9;
  222. margin-left: 74rpx;
  223. line-height: 50rpx;
  224. }
  225. p {
  226. width: 100rpx;
  227. height: 40rpx;
  228. font-size: 24rpx;
  229. border: 2rpx solid #5FAE50;
  230. line-height: 40rpx;
  231. padding: 0 10rpx;
  232. position: absolute;
  233. right: 0;
  234. top: 6rpx;
  235. color: #5FAE50;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </style>