Browse Source

关注优化

master
陈裕财 4 years ago
parent
commit
2be5953e37
  1. 90
      src/views/myWork/my/components/DoFocus.vue

90
src/views/myWork/my/components/DoFocus.vue

@ -1,11 +1,23 @@
<template>
<section>
<el-row v-if="userFocuss.length>0">
<el-tag type="success">已关注</el-tag> <el-button @click="handleDel"></el-button>
<el-row>
<el-tag type="warning" v-if="myUserFocuss.length>0">已关注</el-tag>
<el-tag type="primary" v-if="myUserFocuss.length<=0">未关注</el-tag>
</el-row>
<el-row v-if="myUserFocuss.length>0">
<el-button @click="handleDel" size="mini" type="primary">取消关注</el-button><el-button size="mini" @click="focusListVisible=!focusListVisible"></el-button>
</el-row>
<el-row v-if="userFocuss.length<=0">
<el-tag type="primary">未关注</el-tag> <el-button @click="saveSubmit"></el-button>
<el-row v-if="myUserFocuss.length<=0">
<el-button @click="saveSubmit" type="primary" size="mini">去关注</el-button><el-button size="mini" @click="focusListVisible=!focusListVisible"></el-button>
</el-row>
<el-row v-if="focusListVisible">
<div class="demo-basic--circle">
<div class="block" v-for="(item,idx) in userFocuss" :key="idx">
<el-tag>{{item.username}}</el-tag>&nbsp;&nbsp;
</div>
</div>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
</section>
</template>
@ -29,7 +41,13 @@
watch: {
bizId(){
this.searchUserFocuss()
this.searchMyUserFocuss();
this.focusListVisible=false;
},
focusListVisible(val){
if(val){
this.searchUserFocuss();
}
}
},
data() {
@ -38,26 +56,72 @@
dicts:{},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
userFocuss:[],
myUserFocuss:[],
focusListVisible:false,
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
}//end return
},//end data
methods: {
...util,
getImg(userFocus){
return "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png";
},
// UserFocus
searchMyUserFocuss() {
let params = {
pbizId:this.pbizId,
bizId:this.bizId,
focusType:this.focusType,
userid:this.userInfo.userid
};
this.load.list = true;
listUserFocus(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.myUserFocuss = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// UserFocus
searchUserFocuss() {
let params = {
searchUserFocuss() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count,
pbizId:this.pbizId,
bizId:this.bizId,
focusType:this.focusType
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
this.load.list = true;
listUserFocus(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.userFocuss = res.data.data;
this.userFocuss = res.data.data;
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
@ -65,18 +129,18 @@
}).catch( err => this.load.list = false );
},
initData: function(){
this.searchUserFocuss();
this.searchMyUserFocuss();
},
//userFocus
handleDel: function ( ) {
var row=this.userFocuss[0]
var row=this.myUserFocuss[0]
this.load.del=true;
let params = { userid:row.userid, bizId:row.bizId, pbizId:row.pbizId };
delUserFocus(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchUserFocuss();
this.searchMyUserFocuss();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
@ -91,7 +155,7 @@
var tips=res.data.tips;
if(tips.isOk){
this.searchUserFocuss()
this.searchMyUserFocuss()
this.$emit('submit');// @submit="afterAddSubmit"
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });

Loading…
Cancel
Save