YY hace 3 años
padre
commit
dcda5f7edf

+ 1 - 1
pages/me/index.js

@@ -55,7 +55,7 @@ Page({
     let id = e.currentTarget.dataset.id;
     let type = this.data.item1.type;
     if (type == 1) wx.navigateTo({ url: `/pages/teamDetails/detail?id=${id}` })
-    else if (type == 2) wx.navigateTo({ url: `/pages/teamDetails/index?id=${id}` })
+    else if (type == 2) wx.navigateTo({ url: `/pages/teamDetails/detail?id=${id}` })
   },
   // 我的服务-功能按钮
   toCommon: function (e) {

+ 53 - 23
pages/teamDetails/detail.js

@@ -17,39 +17,67 @@ Page({
       //队员列表
       { members: [], }
     ],
-    ids: ''
+    ids: '',
+    id1: ''
   },
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
   },
-  //点击减号删除队员
+  //删除队员-退出团队
   delList: function (e) {
     var that = this;
+    var type = that.data.type;
     var members = that.data.list.members;
     var list = that.data.list;
     var ids = that.data.list.id;
-    wx.showModal({
-      title: '是否删除该名队员',
-      success(res) {
-        if (res.confirm) {
-          let id = e.currentTarget.dataset.id;
-          for (var i = 0; i < members.length; i++) {
-            if (members[i].id == id) {
-              members.splice(i, 1)
+    var id1 = that.data.id1;
+    if (type == 1) {
+      wx.showModal({
+        title: '是否删除该名队员',
+        success(res) {
+          if (res.confirm) {
+            let id = e.currentTarget.dataset.id;
+            for (var i = 0; i < members.length; i++) {
+              if (members[i].id == id) {
+                members.splice(i, 1)
+              }
             }
+            that.setData({ ['list.members']: members })
+            wx.request({
+              url: `${app.globalData.publicUrl}/courtAdmin/api/team/${ids}`,
+              method: "post",
+              data: list,
+              header: {},
+              success: res => {
+              },
+            })
+          } else if (res.cancel) { }
+        }
+      })
+    } else if (type == 2) {
+      wx.showModal({
+        title: '是否退出团队',
+        success(res) {
+          if (res.confirm) {
+            wx.request({
+              url: `${app.globalData.publicUrl}/courtAdmin/api/team/leaves`,
+              method: "get",
+              data: { user_id: id1, team_id: ids },
+              header: {},
+              success: res => {
+                console.log(res);
+                return wx.redirectTo({ url: '/pages/me/index' })
+              },
+              error: err => {
+              }
+            })
+
+          } else if (res.cancel) {
           }
-          that.setData({ ['list.members']: members })
-          wx.request({
-            url: `${app.globalData.publicUrl}/courtAdmin/api/team/${ids}`,
-            method: "post",
-            data: list,
-            header: {},
-            success: res => {
-            },
-          })
-        } else if (res.cancel) { }
-      }
-    })
+        }
+      })
+    }
+
   },
   /**
    * 生命周期函数--监听页面加载
@@ -68,8 +96,10 @@ Page({
     wx.getStorage({
       key: 'token',
       success: res => {
+        that.setData({ type: res.data.type })
+        that.setData({ id1: res.data.id })
         wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id, 
+          url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id,
           method: 'get',
           data: '',
           success(res) {

+ 5 - 2
pages/teamDetails/detail.wxml

@@ -38,17 +38,20 @@
         </view>
       </view>
     </view>
-    <view class="thr" >
+    <view class="thr">
       <view><text class="tuan">队员信息</text></view>
       <view class="thr-1" wx:key="item" wx:for="{{list.members}}">
         <view class="thr1">
           <view class="thr-left">
             <image class="img" src="{{item.icon[0].url}}"></image>
-            <image bindtap='delList' data-id="{{item.id}}" class="two_jian" src="/image/jianshao.png"></image>
+            <image bindtap='delList' wx:if="{{type=='1'}}" data-id="{{item.id}}" class="two_jian" src="/image/jianshao.png"></image>
           </view>
           <view class="thr-right"><text class="name textOver">{{item.nickname}}</text> </view>
         </view>
       </view>
     </view>
+    <view class="four" wx:if="{{type=='2'}}">
+      <button class="button" bindtap='delList'>退出团队</button>
+    </view>
   </view>
 </mobile-main>

+ 0 - 141
pages/teamDetails/index.js

@@ -1,141 +0,0 @@
-// pages/login/login.js
-import WxValidate from '../../utils/wxValidate'
-const app = getApp()
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    src: '/image/adimges.jpg',
-    src1: '/image/head1.png',
-    frameStyle: { useTop: false, name: '团队详情', leftArrow: true, useBar: false },
-    // 主体高度
-    infoHeight: '',
-    //团队详情
-    list: [],
-    ids: '',
-    id1: ''
-  },
-  back: function () {
-    wx.navigateBack({ url: '/pages/home/index' })
-  },
-  //退出团队
-  outTeam: function (e) {
-    var id = this.data.list._id;
-    var id1 = this.data.id1;
-    wx.showModal({
-      title: '是否退出团队',
-      success(res) {
-        if (res.confirm) {
-          wx.request({
-            url: `${app.globalData.publicUrl}/courtAdmin/api/team/leaves`,
-            method: "get",
-            data: { user_id: id1, team_id: id },
-            header: {},
-            success: res => {
-              return wx.redirectTo({ url: '/pages/me/index' })
-            },
-            error: err => {
-            }
-          })
-
-        } else if (res.cancel) {
-        }
-      }
-    })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    // 计算高度
-    this.searchHeight()
-    this.setData({ ids: options.id })
-    // 监听用户是否登录
-    this.watchLogin();
-
-  },
-  // 监听用户是否登录
-  watchLogin: function () {
-    const that = this;
-    let id = that.data.ids
-    wx.getStorage({
-      key: 'token',
-      success: res => {
-        that.setData({ id1: res.data.id })
-        wx.request({
-          url: `${app.globalData.publicUrl}/courtAdmin/api/team/` + id,
-          method: 'get',
-          data: '',
-          success(res) {
-            that.setData({ list: res.data.data });
-          }
-        })
-      },
-      fail: res => {
-        return wx.redirectTo({ url: '/pages/login/index', })
-      }
-    })
-  },
-  // 计算高度
-  searchHeight: function () {
-    let frameStyle = this.data.frameStyle;
-    let client = app.globalData.client;
-    let infoHeight = client.windowHeight;
-    // 是否去掉状态栏
-    if (frameStyle.useTop) infoHeight = infoHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
-    // 是否减去底部菜单
-    if (frameStyle.useBar) infoHeight = infoHeight - 50;
-    if (infoHeight) this.setData({ infoHeight: infoHeight })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
-})

+ 0 - 6
pages/teamDetails/index.json

@@ -1,6 +0,0 @@
-{
-    "component": true,
-    "usingComponents": {
-      "mobile-main": "/commpents/mobile-frame/mobile-main"
-    }
-  }

+ 0 - 56
pages/teamDetails/index.wxml

@@ -1,56 +0,0 @@
-<mobile-main frameStyle="{{frameStyle}}" bind:back="back">
-  <view slot="info" class="main" style="height:{{infoHeight}}px;">
-    <view class="one">
-      <view class="one-1">
-        <view class="onea">
-          <cover-image src='/image/back.png' class="back" bindtap='back'></cover-image>
-        </view>
-        <view class="ones">
-          <text>团队详情</text>
-        </view>
-        <image style="width: 100%; height: 280px; background-color: #eeeeee;" src="{{src}}"></image>
-      </view>
-      <view class="one-2">
-        <image class="imgs" src="{{list.logo[0].url}}"></image>
-      </view>
-      <view class="one-3">
-        <view class="group">{{list.name}}</view>
-        <view class="person">共{{list.members.length||0}}人</view>
-      </view>
-    </view>
-    <view class="two">
-      <view class="two-1">
-        <view class="two1">
-          <view class="two-left1">
-            <text class=" icon iconfont icon-dian"></text>
-          </view>
-          <view class="two-right1">
-            <view><text class="zi">创建人:</text>{{list.create_user}}</view>
-          </view>
-        </view>
-        <view class="two2">
-          <view class="two-left2">
-            <text class=" icon iconfont icon-dian"></text>
-          </view>
-          <view class="two-right2">
-            <view><text class="zi">创建时间:</text><text class="date">{{list.create_time}}</text></view>
-          </view>
-        </view>
-      </view>
-    </view>
-    <view class="thr" >
-      <view><text class="tuan">队员信息</text></view>
-      <view class="thr-1" wx:key="item" wx:for="{{list.members}}">
-        <view class="thr1">
-          <view class="thr-left">
-            <image class="img" src="{{item.icon[0].url}}"></image>
-          </view>
-          <view class="thr-right"><text class="name textOver">{{item.nickname}}</text> </view>
-        </view>
-      </view>
-    </view>
-    <view class="four">
-      <button class="button" bindtap='outTeam' >退出团队</button>
-    </view>
-  </view>
-</mobile-main>

+ 0 - 206
pages/teamDetails/index.wxss

@@ -1,206 +0,0 @@
-.main {
-  position: relative;
-  width: 100%;
-}
-
-.back {
-  width: 40rpx;
-  height: 40rpx;
-  left: 15px;
-  width: 40rpx;
-  height: 40rpx;
-}
-
-.onea {
-  font-weight: 600;
-  position: absolute;
-  top: 5%;
-  left: 2%;
-}
-
-.ones {
-  font-weight: 600;
-  position: absolute;
-  top: 5%;
-  left: 42%;
-  color: #ffffff;
-}
-
-.one-2 {
-  position: absolute;
-  top: 18%;
-  left: 41%;
-  width: 18%;
-  height: 63.78px;
-  border-radius: 50%;
-}
-
-.one-3 {
-  position: absolute;
-  top: 29%;
-  left: 30%;
-  width: 43%;
-  height: 63.78px;
-}
-
-.imgs {
-  border-radius: 50%;
-  margin-top: 4px;
-  margin-left: 2px;
-  width: 70px;
-  height: 70px;
-}
-
-.two-1 {
-  margin-top: -4px;
-  background-color: #ffffff;
-  font-size: 15px;
-  margin-bottom: 6%;
-}
-
-.two {
-  background-color: #ffffff;
-}
-
-.two1 {
-  padding-top: 30px;
-  padding-bottom: 10px;
-}
-
-.two2 {
-  padding-bottom: 20px;
-}
-
-.two-left1 {
-  float: left;
-  margin-top: -3px;
-  width: 10%;
-}
-
-.two-left2 {
-  margin-top: -3px;
-  float: left;
-  width: 10%;
-}
-
-.zi {
-  color: #9e9e9e;
-}
-
-.date {
-  margin-right: 2%;
-}
-
-.thr {
-  float: left;
-  width: 100%;
-  padding-top: 15px;
-  background-color: #ffffff;
-}
-
-.tuan {
-  margin-left: 11px;
-  font-size: 16px;
-  font-weight: 550;
-  margin-right: 10px;
-}
-
-.thr-left {
-  width: 49px;
-  height: 49px;
-  background-color: #eeeeee;
-  border-radius: 24.5px;
-}
-
-.thr-right {
-  margin-left: 3px;
-}
-
-.img {
-  border-radius: 50%;
-  width: 49px;
-  height: 49px;
-}
-
-.two_jian {
-  position: relative;
-  top: -20px;
-  left: 35px;
-  width: 20px;
-  height: 20px;
-}
-
-
-.thr-1 {
-  padding-top: 10px;
-  padding-left: 10px;
-  float: left;
-  width: 18%;
-  background-color: #ffffff;
-  padding-bottom: 5px;
-}
-
-.thr1 {
-  background-color: #ffffff;
-}
-
-.thr-2 {
-  padding-top: 10px;
-  padding-left: 8px;
-  float: left;
-  width: 18%;
-  height: 75px;
-  background-color: #ffffff;
-  /* border: 1px solid red; */
-}
-
-.thr2 {
-  float: left;
-  width: 50px;
-  height: 50px;
-  border: 2px solid #dddcdc;
-}
-
-.name {
-  text-align: center;
-  font-size: 13px;
-  color: #727272;
-}
-
-.thr3 {
-  margin-top: 22%;
-  margin-left: 23%;
-}
-
-.group {
-  color: #ffffff;
-  margin-top: 20%;
-  margin-left: 19%;
-  margin-bottom: 10%;
-}
-
-.person {
-  margin-left: 37%;
-  font-size: 13px;
-  color: #ffffff;
-  font-weight: 300;
-}
-
-
-
-.button {
-  margin-top: 5px !important;
-  width: 300px !important;
-  height: 35px;
-  background-color: rgba(243, 32, 162, 0.5);
-  background-image: linear-gradient(to right, rgb(247, 59, 69), rgb(223, 41, 247));
-  border-radius: 30px;
-  color: #ffffff;
-  font-size: 13px;
-}
-
-.four {
-  background-color: white;
-  padding-top: 200px;
-  padding-bottom: 20px;
-}