|
@@ -17,10 +17,7 @@ Page({
|
|
|
infoHeight: '',
|
|
|
total: '4',
|
|
|
//上传比分
|
|
|
- item: {
|
|
|
- id: '1', head2: '/image/head2.png', head1: '/image/head1.png', fraction2: '0', groupname2: '马尼拉组', fraction1: '0', site: '第一场', groupname1: '哈拉海组', week: '星期五', time: '13:00',
|
|
|
- state: '已结束', date: '01.15', start: '未开始'
|
|
|
- },
|
|
|
+ match: [],
|
|
|
//个人信息详情
|
|
|
item1: {},
|
|
|
//团队列表
|
|
@@ -113,62 +110,91 @@ Page({
|
|
|
wx.getStorage({
|
|
|
key: 'token',
|
|
|
success: res => {
|
|
|
- //数据请求
|
|
|
- //用户详情
|
|
|
- wx.request({
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/user/${res.data.id}`, //接口地址
|
|
|
- method: "get",//请求方法
|
|
|
- data: {},//请求参数
|
|
|
- header: {},
|
|
|
- success: res => {
|
|
|
- that.setData({ item1: res.data.data })
|
|
|
- let type = res.data.data.type;
|
|
|
- let icon = res.data.data.icon[0];
|
|
|
- if (icon) this.setData({ icon: icon.url })
|
|
|
- else this.setData({ icon: '/image/tou.png' });
|
|
|
- // 判断用户身份显示不同功能按钮
|
|
|
- let jump = btn.filter((i) => i.type.includes(type));
|
|
|
- if (jump) that.setData({ jumpList: jump });
|
|
|
- },
|
|
|
- error: err => {
|
|
|
- }
|
|
|
- })
|
|
|
- let type = res.data.type
|
|
|
- if (type == 1) {
|
|
|
- //团队管理员-团队列表
|
|
|
- wx.request({
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
|
|
|
- method: "get",//请求方法
|
|
|
- data: {},//请求参数
|
|
|
- header: {},
|
|
|
- success: res => {
|
|
|
- that.setData({ list: res.data.data })
|
|
|
- },
|
|
|
- error: err => {
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (type == 2) {
|
|
|
- //个人用户-所在团队列表
|
|
|
- wx.request({
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`, //接口地址
|
|
|
- method: "get",//请求方法
|
|
|
- data: { user_id: res.data.id },//请求参数
|
|
|
- header: {},
|
|
|
- success: res => {
|
|
|
- console.log(res);
|
|
|
- that.setData({ list: res.data.data })
|
|
|
- },
|
|
|
- error: err => {
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ //查询用户信息
|
|
|
+ that.searchUser(res.data);
|
|
|
+ //查询团队列表
|
|
|
+ that.searchTeam(res.data);
|
|
|
},
|
|
|
fail: res => {
|
|
|
wx.redirectTo({ url: '/pages/login/index', })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ //查询用户信息
|
|
|
+ searchUser: function (e) {
|
|
|
+ const that = this;
|
|
|
+ var id = e.id;
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/user/${id}`,
|
|
|
+ method: "get",
|
|
|
+ data: {},
|
|
|
+ header: {},
|
|
|
+ success: res => {
|
|
|
+ that.setData({ item1: res.data.data })
|
|
|
+ let type = res.data.data.type;
|
|
|
+ let icon = res.data.data.icon[0];
|
|
|
+ if (icon) this.setData({ icon: icon.url })
|
|
|
+ else this.setData({ icon: '/image/tou.png' });
|
|
|
+ // 判断用户身份显示不同功能按钮
|
|
|
+ let jump = btn.filter((i) => i.type.includes(type));
|
|
|
+ if (jump) that.setData({ jumpList: jump });
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //查询团队列表
|
|
|
+ searchTeam: function (e) {
|
|
|
+ let id = e.id;
|
|
|
+ let type = e.type
|
|
|
+ if (type == 1) {
|
|
|
+ //团队管理员-团队列表
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/team`,
|
|
|
+ method: "get",
|
|
|
+ data: {},
|
|
|
+ header: {},
|
|
|
+ success: res => {
|
|
|
+ this.setData({ list: res.data.data })
|
|
|
+ //查询比赛列表
|
|
|
+ this.searchMatch(res.data.data);
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (type == 2) {
|
|
|
+ //个人用户-所在团队列表
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/team/userteams`,
|
|
|
+ method: "get",
|
|
|
+ data: { user_id: id },
|
|
|
+ header: {},
|
|
|
+ success: res => {
|
|
|
+ this.setData({ list: res.data.data })
|
|
|
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查询比赛列表
|
|
|
+ searchMatch: function (e) {
|
|
|
+ let id = e[0]._id
|
|
|
+ console.log(e[0]._id);
|
|
|
+ wx.request({
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/schedule`,
|
|
|
+ method: "get",
|
|
|
+ data: { blue_id: id , red_id :id},
|
|
|
+ header: {},
|
|
|
+ success: res => {
|
|
|
+ console.log(res.data.data);
|
|
|
+ this.setData({ match: res.data.data })
|
|
|
+ },
|
|
|
+ error: err => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 计算高度
|
|
|
searchHeight: function () {
|
|
|
let frameStyle = this.data.frameStyle;
|