123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- <template>
- <view class="communication">
- <view class="bg"></view>
- <!-- 页面头部 -->
- <u-navbar
- back-icon-color="#fff"
- :back-text="$t('common.Back')"
- :is-back="true"
- :background="{background:'#1777FE'}"
- :back-text-style="{color:'#fff'}"
- :border-bottom="true"
- title-color="#fff"
- :title="title"
- :custom-back="back"
- >
- <!-- <view slot="right" class="edit" @click="editMyAdvice">{{$t('common.edit')}}</view> -->
- </u-navbar>
- <!-- 列表 -->
- <view class="tabs">
- <view class="item" v-for="(item,index) in tabs" :key="index">
- <uni-swipe-action style="width:100%">
- <uni-swipe-action-item :right-options="options" @click="deleteInfo(index,item)">
- <view class="jtimg" @click="replyInfo(item)"><image class="img" :src="item.src?item.src:defaultImg" mode="widthFix"></image></view>
- <view class="jtinfo">
- <view class="label" @click="replyInfo(item)">
- <!-- <text class="msgflag" v-if="!item.interactiveMessageInfo">●</text> -->
- <text class="text">{{$t(item.senderName)}}</text>
- </view>
- <view class="date" @click="replyInfo(item)">{{formatDate(item.createDate)}}</view>
- <view class="jtques" @click="replyInfo(item)" >{{item.content}}</view>
- <view class="compnay" @click="showCompnay(item)">
- <view class="compnay">{{item.columnName}}</view>
- <view class="icon"><u-icon name="attach" :size="24"></u-icon></view>
- </view>
- <view class="readStatus" @click="replyInfo(item)">
- <!-- <text class="tag readed">已读</text> -->
- <text class="tag replyed" v-if="item.interactiveMessageInfo">{{$t('common.Replied')}}</text>
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </view>
-
- </view>
- <!-- 页面优化提示 -->
- <view class="loading" v-if="showLoading" :class="{fixbottom:pageNo<totalPage}">
- <u-loadmore :status="status" iconType="flower" :load-text="{loading: $t('common.Loading')}" margin-top="200" />
- </view>
- <view class="nodata" v-if="!showLoading && tabs.length==0" style="text-align: center;margin-top: 120upx;">
- <view class="imgBox" style="height:600upx;margin-bottom:60upx">
- <image src="../../../static/img/public/7.png" style="width: 80%;margin:0 10%" mode="widthFix"></image>
- </view>
- <text style="font-size: 30upx;color:#ccc">{{$t('common.Nodata')}}</text>
- </view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import {getMessageInfosList} from '@/api/cooperation/baseCooperationUnit'
- import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue'
- import uniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue'
- export default {
- name:'Communication',
- components:{
- UNavbar,
- uniSwipeAction
- },
- data(){
- return {
- title:'',
- keyword:'',
- lineIndex:-1,
- pageNo:1,
- pageSize:5,
- totalPage:0,
- flagName:'',
- tabs:[],
- showLoading:true,
- status:'loading',
- defaultImg:'../../../static/missing-face.png',
- token:'',
- userId:'',
- options:[
- {
- text:this.$t('common.Delete'),
- style: {
- fontSize:'12px',
- height:'30px',
- backgroundColor:'#f2a059',
- }
- }
- ],
- }
- },
- onLoad(e){
- this.title= this.$i18n.locale == 'zh'? '互动交流': 'Interaction'
- },
- created(){
- this.getMessageInfosList()
- },
-
- onShow(){
- this.token=uni.getStorageSync('Auth-Token')?'Bearer '+uni.getStorageSync('Auth-Token'):'';
- this.userId = uni.getStorageSync('user')? JSON.parse(uni.getStorageSync('user')).id:'';
- // if(!this.token){
- // uni.navigateTo({url:'/pages/public/login?back=1'})
- // }else{
-
- // }
- },
- // 滚动监听-加载更多数据
- onReachBottom(e){
- if(this.pageNo<this.totalPage){
- this.showLoading=true;
- this.getMessageInfosList('loadmore')
- }else{
- if(this.showLoading!=false) this.showLoading=false;
- }
- },
- methods:{
- // 获取交流互动信息列表
- async getMessageInfosList(loadmore){
- if(loadmore) this.pageNo++;
- let params = {
- pageNo:this.pageNo,
- pageSize:this.pageSize,
- bizObjectType:'0'
- }
- let res = await this.$myRequest({
- url:'/op/interactiveMessage/userContentgetInteractiveMessageInfosList',
- headers:{token:this.token},
- data:params
- })
- this.showLoading=false;
- if(res.data.interactiveMessageInfos){
- this.totalPage=parseInt(res.data.page.totalPage)
- if(!loadmore){
- this.tabs=res.data.interactiveMessageInfos;
- }else{
-
- this.tabs=[...this.tabs,...res.data.interactiveMessageInfos];
- }
- }
- },
-
- //展开或者收起回复
- showMore(item){
- if(this.lineIndex!=item.id) {
- this.lineIndex=item.id;
- }else{
- this.lineIndex=-1;
- }
- },
- //清空列表
- clearList(){
- this.tabs=[];
- },
- //编辑互动交流
- editMyAdvice(){
- // uni.navigateTo({
- // url:'/pages/service/others/myadvicedit'
- // })
- },
- //项目名称
- showCompnay(item){
- uni.navigateTo({
- url:'/pages/country/projectPresentation/projectPresentationDetails?id='+item.columnCode
- })
- },
- //回复信息
- replyInfo(item){
- uni.setStorageSync("compnayInfo",item)
- uni.navigateTo({
- url:'/pages/service/others/communicationReply'
- })
- },
- async deleteInfo(index,item){
- let res = await this.$myRequest({
- url:'/op/interactiveMessage/gateDelInteractiveMessage',
- data:{interactiveMessageInfoId:item.id}
- })
- if(res.status==200){
- this.tabs.splice(index,1)
- this.$refs.uToast.show({
- title: this.$i18n.locale == 'zh'? '删除成功': 'delete success',
- icon:false,
- type:'success',
- })
-
- }else{
- this.$refs.uToast.show({
- title: this.$i18n.locale == 'zh'? '删除失败': 'delete fail',
- icon:false,
- type:'error',
- })
- }
- },
- //路由后退一步
- back(){
- // #ifdef H5
- history.back()
- // #endif
- // #ifndef H5
- uni.navigateBack()
- // #endif
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .communication{
-
- .bg{
- position:fixed;
- top:0;
- left:0;
- bottom:0;
- right:0;
- background-color:#fff;
- z-index:-1;
- }
- .loadmore{
- display:fixed;
- bottom:0;
- z-index:999;
- }
- .edit{
- margin-right:30upx;
- color:#fff;
- }
- .fixbottom{
- display:fixed;
- bottom:0;
- }
- .tabs{
- width:100%;
- background-color:#fff;
- .item{
- width:100%;
- padding:3%;
- margin:20upx 0;
- border-bottom:2upx solid #eee;
- &:last-of-type{border:none}
- display:flex;
- .label{
- position:relative;
- overflow:hidden;
- display:flex;
- align-items:center;
- font-size:24upx;
- .msgflag{
- color:#f20;
- font-size:20upx;
-
- }
- }
- .jtimg{
- width:100upx;
- height:100upx;
- border-radius:50%;
- position:relative;
- background:#eee;
- margin-right:10upx;
- .img{
- display:block;
- width:80%;
- margin:10%;
- }
- }
- .jtinfo{
- flex:1;
- font-size:28upx;
- color:#333;
- .date{
- color:#aaa;
- font-size:20upx;
- line-height:50upx;
- }
- .compnay{
- color:#1777FE;
- overflow:hidden;
- text-overflow:ellipsis;
- display:-webkit-box;
- -webkit-box-orient:vertical;
- -webkit-line-clamp:1;
- font-size:20upx;
- display:flex;
- align-items:center;
- .icon{
- color:#fff;
- background-color:#1777FE;
- height:32upx;
- line-height:32upx;
- width:32upx;
- text-align:center;
- border-radius:50%;
- margin-left:10upx;
-
- }
- }
- .jtques{
- font-size:28upx;
- margin:16upx 0;
- }
- .readStatus{
- margin:10upx 0;
- .tag{
- font-size:20upx;
- background:#C7C8C9;
- padding:8upx 20upx;
- border-radius:20upx;
- color:#fff;
- margin-right:20upx;
- &.replyed{
- background:#6DD400;
- }
- }
- }
- }
- }
- }
- }
- </style>
|