communication.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="communication">
  3. <view class="bg"></view>
  4. <!-- 页面头部 -->
  5. <u-navbar
  6. back-icon-color="#fff"
  7. :back-text="$t('common.Back')"
  8. :is-back="true"
  9. :background="{background:'#1777FE'}"
  10. :back-text-style="{color:'#fff'}"
  11. :border-bottom="true"
  12. title-color="#fff"
  13. :title="title"
  14. :custom-back="back"
  15. >
  16. <!-- <view slot="right" class="edit" @click="editMyAdvice">{{$t('common.edit')}}</view> -->
  17. </u-navbar>
  18. <!-- 列表 -->
  19. <view class="tabs">
  20. <view class="item" v-for="(item,index) in tabs" :key="index">
  21. <uni-swipe-action style="width:100%">
  22. <uni-swipe-action-item :right-options="options" @click="deleteInfo(index,item)">
  23. <view class="jtimg" @click="replyInfo(item)"><image class="img" :src="item.src?item.src:defaultImg" mode="widthFix"></image></view>
  24. <view class="jtinfo">
  25. <view class="label" @click="replyInfo(item)">
  26. <!-- <text class="msgflag" v-if="!item.interactiveMessageInfo">●</text> -->
  27. <text class="text">{{$t(item.senderName)}}</text>
  28. </view>
  29. <view class="date" @click="replyInfo(item)">{{formatDate(item.createDate)}}</view>
  30. <view class="jtques" @click="replyInfo(item)" >{{item.content}}</view>
  31. <view class="compnay" @click="showCompnay(item)">
  32. <view class="compnay">{{item.columnName}}</view>
  33. <view class="icon"><u-icon name="attach" :size="24"></u-icon></view>
  34. </view>
  35. <view class="readStatus" @click="replyInfo(item)">
  36. <!-- <text class="tag readed">已读</text> -->
  37. <text class="tag replyed" v-if="item.interactiveMessageInfo">{{$t('common.Replied')}}</text>
  38. </view>
  39. </view>
  40. </uni-swipe-action-item>
  41. </uni-swipe-action>
  42. </view>
  43. </view>
  44. <!-- 页面优化提示 -->
  45. <view class="loading" v-if="showLoading" :class="{fixbottom:pageNo<totalPage}">
  46. <u-loadmore :status="status" iconType="flower" :load-text="{loading: $t('common.Loading')}" margin-top="200" />
  47. </view>
  48. <view class="nodata" v-if="!showLoading && tabs.length==0" style="text-align: center;margin-top: 120upx;">
  49. <view class="imgBox" style="height:600upx;margin-bottom:60upx">
  50. <image src="../../../static/img/public/7.png" style="width: 80%;margin:0 10%" mode="widthFix"></image>
  51. </view>
  52. <text style="font-size: 30upx;color:#ccc">{{$t('common.Nodata')}}</text>
  53. </view>
  54. <u-toast ref="uToast" />
  55. </view>
  56. </template>
  57. <script>
  58. import {getMessageInfosList} from '@/api/cooperation/baseCooperationUnit'
  59. import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue'
  60. import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue'
  61. export default {
  62. name:'Communication',
  63. components:{
  64. UNavbar,
  65. uniSwipeAction
  66. },
  67. data(){
  68. return {
  69. title:'',
  70. keyword:'',
  71. lineIndex:-1,
  72. pageNo:1,
  73. pageSize:5,
  74. totalPage:0,
  75. flagName:'',
  76. tabs:[],
  77. showLoading:true,
  78. status:'loading',
  79. defaultImg:'../../../static/missing-face.png',
  80. token:'',
  81. userId:'',
  82. options:[
  83. {
  84. text:this.$t('common.Delete'),
  85. style: {
  86. fontSize:'12px',
  87. height:'30px',
  88. backgroundColor:'#f2a059',
  89. }
  90. }
  91. ],
  92. }
  93. },
  94. onLoad(e){
  95. this.title= this.$i18n.locale == 'zh'? '互动交流': 'Interaction'
  96. },
  97. created(){
  98. this.getMessageInfosList()
  99. },
  100. onShow(){
  101. this.token=uni.getStorageSync('Auth-Token')?'Bearer '+uni.getStorageSync('Auth-Token'):'';
  102. this.userId = uni.getStorageSync('user')? JSON.parse(uni.getStorageSync('user')).id:'';
  103. // if(!this.token){
  104. // uni.navigateTo({url:'/pages/public/login?back=1'})
  105. // }else{
  106. // }
  107. },
  108. // 滚动监听-加载更多数据
  109. onReachBottom(e){
  110. if(this.pageNo<this.totalPage){
  111. this.showLoading=true;
  112. this.getMessageInfosList('loadmore')
  113. }else{
  114. if(this.showLoading!=false) this.showLoading=false;
  115. }
  116. },
  117. methods:{
  118. // 获取交流互动信息列表
  119. async getMessageInfosList(loadmore){
  120. if(loadmore) this.pageNo++;
  121. let params = {
  122. pageNo:this.pageNo,
  123. pageSize:this.pageSize,
  124. bizObjectType:'0'
  125. }
  126. let res = await this.$myRequest({
  127. url:'/op/interactiveMessage/userContentgetInteractiveMessageInfosList',
  128. headers:{token:this.token},
  129. data:params
  130. })
  131. this.showLoading=false;
  132. if(res.data.interactiveMessageInfos){
  133. this.totalPage=parseInt(res.data.page.totalPage)
  134. if(!loadmore){
  135. this.tabs=res.data.interactiveMessageInfos;
  136. }else{
  137. this.tabs=[...this.tabs,...res.data.interactiveMessageInfos];
  138. }
  139. }
  140. },
  141. //展开或者收起回复
  142. showMore(item){
  143. if(this.lineIndex!=item.id) {
  144. this.lineIndex=item.id;
  145. }else{
  146. this.lineIndex=-1;
  147. }
  148. },
  149. //清空列表
  150. clearList(){
  151. this.tabs=[];
  152. },
  153. //编辑互动交流
  154. editMyAdvice(){
  155. // uni.navigateTo({
  156. // url:'/pages/service/others/myadvicedit'
  157. // })
  158. },
  159. //项目名称
  160. showCompnay(item){
  161. uni.navigateTo({
  162. url:'/pages/country/projectPresentation/projectPresentationDetails?id='+item.columnCode
  163. })
  164. },
  165. //回复信息
  166. replyInfo(item){
  167. uni.setStorageSync("compnayInfo",item)
  168. uni.navigateTo({
  169. url:'/pages/service/others/communicationReply'
  170. })
  171. },
  172. async deleteInfo(index,item){
  173. let res = await this.$myRequest({
  174. url:'/op/interactiveMessage/gateDelInteractiveMessage',
  175. data:{interactiveMessageInfoId:item.id}
  176. })
  177. if(res.status==200){
  178. this.tabs.splice(index,1)
  179. this.$refs.uToast.show({
  180. title: this.$i18n.locale == 'zh'? '删除成功': 'delete success',
  181. icon:false,
  182. type:'success',
  183. })
  184. }else{
  185. this.$refs.uToast.show({
  186. title: this.$i18n.locale == 'zh'? '删除失败': 'delete fail',
  187. icon:false,
  188. type:'error',
  189. })
  190. }
  191. },
  192. //路由后退一步
  193. back(){
  194. // #ifdef H5
  195. history.back()
  196. // #endif
  197. // #ifndef H5
  198. uni.navigateBack()
  199. // #endif
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .communication{
  206. .bg{
  207. position:fixed;
  208. top:0;
  209. left:0;
  210. bottom:0;
  211. right:0;
  212. background-color:#fff;
  213. z-index:-1;
  214. }
  215. .loadmore{
  216. display:fixed;
  217. bottom:0;
  218. z-index:999;
  219. }
  220. .edit{
  221. margin-right:30upx;
  222. color:#fff;
  223. }
  224. .fixbottom{
  225. display:fixed;
  226. bottom:0;
  227. }
  228. .tabs{
  229. width:100%;
  230. background-color:#fff;
  231. .item{
  232. width:100%;
  233. padding:3%;
  234. margin:20upx 0;
  235. border-bottom:2upx solid #eee;
  236. &:last-of-type{border:none}
  237. display:flex;
  238. .label{
  239. position:relative;
  240. overflow:hidden;
  241. display:flex;
  242. align-items:center;
  243. font-size:24upx;
  244. .msgflag{
  245. color:#f20;
  246. font-size:20upx;
  247. }
  248. }
  249. .jtimg{
  250. width:100upx;
  251. height:100upx;
  252. border-radius:50%;
  253. position:relative;
  254. background:#eee;
  255. margin-right:10upx;
  256. .img{
  257. display:block;
  258. width:80%;
  259. margin:10%;
  260. }
  261. }
  262. .jtinfo{
  263. flex:1;
  264. font-size:28upx;
  265. color:#333;
  266. .date{
  267. color:#aaa;
  268. font-size:20upx;
  269. line-height:50upx;
  270. }
  271. .compnay{
  272. color:#1777FE;
  273. overflow:hidden;
  274. text-overflow:ellipsis;
  275. display:-webkit-box;
  276. -webkit-box-orient:vertical;
  277. -webkit-line-clamp:1;
  278. font-size:20upx;
  279. display:flex;
  280. align-items:center;
  281. .icon{
  282. color:#fff;
  283. background-color:#1777FE;
  284. height:32upx;
  285. line-height:32upx;
  286. width:32upx;
  287. text-align:center;
  288. border-radius:50%;
  289. margin-left:10upx;
  290. }
  291. }
  292. .jtques{
  293. font-size:28upx;
  294. margin:16upx 0;
  295. }
  296. .readStatus{
  297. margin:10upx 0;
  298. .tag{
  299. font-size:20upx;
  300. background:#C7C8C9;
  301. padding:8upx 20upx;
  302. border-radius:20upx;
  303. color:#fff;
  304. margin-right:20upx;
  305. &.replyed{
  306. background:#6DD400;
  307. }
  308. }
  309. }
  310. }
  311. }
  312. }
  313. }
  314. </style>