index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view v-if="isShowPage">
  3. <view class="con">
  4. <view class="tits ddflex">团队简介<image src="../static/images/pl_ico.png" class="edit" @click="jumpUrl('/office/createTeam/index?id='+teamInfo.id)" v-if="teamInfo.isCreate == 1"></image></view>
  5. <view class="bri">
  6. {{teamInfo.description}}
  7. </view>
  8. <view class="leader ddflex" @click="jumpUrl('/topics/home/home?userId='+teamInfo.teamUserDTO.id)">
  9. <view class="fflex ddflex">
  10. <image :src="teamInfo.teamUserDTO.avatar?teamInfo.teamUserDTO.avatar:'../../static/images/userimg.png'" mode="aspectFill"></image>
  11. <view>{{teamInfo.teamUserDTO.realName?teamInfo.teamUserDTO.realName:teamInfo.teamUserDTO.nickName}}</view>
  12. <text>队长</text>
  13. </view>
  14. <view :class="'gz-btn'+(isFollow?' ed':'')" @click.stop="followUser(teamInfo.teamUserDTO.id)" v-if="teamInfo.isCreate != 1">{{isFollow ? '已关注':'关注'}}</view>
  15. </view>
  16. <view class="tits">团队成员</view>
  17. <view class="list" v-if="pageList.length>0">
  18. <view class="li ddflex" v-for="(item,index) in pageList" :key="index" @click="jumpUrl('/topics/home/home?userId='+item.uid)">
  19. <image :src="item.avatar?item.avatar:'../../static/images/userimg.png'" mode="aspectFill"></image>
  20. <view class="fflex tover">{{item.nickName}}</view>
  21. <view :class="'gz-btn'+(item.isFollow?' ed':'')" @click.stop="followUser(item.uid,index)" v-if="item.uid != userInfo.id">{{item.isFollow == 1 ? '已关注':'关注'}}</view>
  22. <view class="gz-btn" @click.stop="removeUser(item,index)" v-if="teamInfo.isCreate == 1">移出</view>
  23. </view>
  24. </view>
  25. <view class="nodata" v-else>
  26. <image :src="picUrlss + 'empty_yq.png'"></image>
  27. <text>暂无团队成员</text>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. const app = getApp();
  34. const api = require('../../utils/api.js');
  35. const req = require('../../utils/request.js');
  36. export default {
  37. data() {
  38. return {
  39. picUrlss: req.public.picUrls,
  40. isShowPage: false,
  41. opt: {},
  42. teamInfo: {},
  43. form: {
  44. page: 1,
  45. limit: 10
  46. },
  47. isLoad: true,
  48. pageList: [],
  49. isFollow: false,
  50. userInfo: {}
  51. };
  52. },
  53. onLoad(options) {
  54. this.opt = options;
  55. this.getPageList();
  56. },
  57. onShow() {
  58. this.userInfo = req.getStorage('userInfo')
  59. this.getTeamInfo();
  60. },
  61. onReachBottom() {
  62. this.form.page++
  63. this.getPageList();
  64. },
  65. methods: {
  66. getTeamInfo(){
  67. req.getRequest(api.user_team_info+this.opt.id,{},data=>{
  68. this.teamInfo = data;
  69. uni.setNavigationBarTitle({
  70. title: data.title
  71. })
  72. this.isShowPage = true;
  73. if(data.isCreate != 1) this.getBehavior();
  74. })
  75. },
  76. getPageList(){
  77. if (!this.isLoad) return false;
  78. this.isLoad = false;
  79. let form = this.form;
  80. form.userGroupId = this.opt.id;
  81. req.getRequest(api.user_team_users,form,data=>{
  82. if (data.list && data.list.length >= 10) this.isLoad = true;
  83. if (this.form.page > 1) data.list = this.pageList.concat(data.list);
  84. this.pageList = data.list;
  85. })
  86. },
  87. getBehavior(){
  88. let params = {
  89. behavior: 1,
  90. type: 11,
  91. bindId: this.teamInfo.teamUserDTO.id
  92. }
  93. req.getBehavior(params,suc=>{
  94. this.isFollow = suc
  95. })
  96. },
  97. followUser(id,index){
  98. let params = {
  99. behavior: 1,
  100. type: 11,
  101. bindId: id
  102. }
  103. req.saveBehavior(params,suc=>{
  104. console.log('index==',index)
  105. if((index == '' || index == undefined) && index != 0){
  106. console.log('this.isFollow==',this.isFollow)
  107. if(this.isFollow){
  108. this.isFollow = false
  109. req.msg('已取消关注')
  110. }else{
  111. req.msg('已关注')
  112. this.isFollow = true
  113. }
  114. }else{
  115. if(this.pageList[index].isFollow){
  116. req.msg('已取消关注');
  117. this.pageList[index].isFollow = false;
  118. }else{
  119. req.msg('已关注');
  120. this.pageList[index].isFollow = true;
  121. }
  122. }
  123. })
  124. },
  125. removeUser(item,index){
  126. console.log('====77',item.id)
  127. req.msgConfirm('确定将该成员移出团队吗?',suc=>{
  128. req.postRequest(api.user_team_remove,{uid: item.uid,id: item.id,userGroupId: this.teamInfo.id},suc=>{
  129. req.msg('已移出')
  130. this.pageList.splice(index,1);
  131. })
  132. })
  133. },
  134. jumpUrl(url){
  135. uni.navigateTo({
  136. url: url
  137. })
  138. }
  139. }
  140. };
  141. </script>
  142. <style>
  143. @import './index.css';
  144. </style>