|
@@ -8,19 +8,53 @@ Page({
|
|
* 页面的初始数据
|
|
* 页面的初始数据
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
|
|
+ showModal: false,
|
|
// 主体高度
|
|
// 主体高度
|
|
infoHeight: '',
|
|
infoHeight: '',
|
|
frameStyle: { useTop: true, name: '创建团队', leftArrow: true, useBar: false },
|
|
frameStyle: { useTop: true, name: '创建团队', leftArrow: true, useBar: false },
|
|
form: {
|
|
form: {
|
|
type: ['乒乓球', '足球', '篮球'],
|
|
type: ['乒乓球', '足球', '篮球'],
|
|
objectType: [{ id: 0, name: '乒乓球' }, { id: 1, name: '足球' }, { id: 2, name: '篮球' },],
|
|
objectType: [{ id: 0, name: '乒乓球' }, { id: 1, name: '足球' }, { id: 2, name: '篮球' },],
|
|
|
|
+ create_time: '2016-09-01',
|
|
},
|
|
},
|
|
- lists: [{ id: '1', menbers: '' }],
|
|
|
|
- menbers:[],
|
|
|
|
|
|
+ lists: [],
|
|
index: 0,
|
|
index: 0,
|
|
|
|
+ item: [],
|
|
|
|
+ check: [],
|
|
// 上传图片
|
|
// 上传图片
|
|
fileList: [],
|
|
fileList: [],
|
|
},
|
|
},
|
|
|
|
+ apply: function (e) {
|
|
|
|
+ // this.setData({ showModal: false })
|
|
|
|
+ console.log(this.data.check);
|
|
|
|
+ },
|
|
|
|
+ //选择队员
|
|
|
|
+ checkboxChange: function (e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let data = e.detail.value;
|
|
|
|
+ let _id = [];
|
|
|
|
+ let item = that.data.item;
|
|
|
|
+ let check = [];
|
|
|
|
+ for (const val of _id) {
|
|
|
|
+ let arr = item.find((i) => i._id == val);
|
|
|
|
+ if (arr) check.push({ id: arr._id, nickname: arr.nickname, icon: arr.icon })
|
|
|
|
+ }
|
|
|
|
+ that.setData({ check: check })
|
|
|
|
+ },
|
|
|
|
+ //显示对话框
|
|
|
|
+ clickme: function () {
|
|
|
|
+ this.setData({
|
|
|
|
+ showModal: true
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ preventTouchMove: function () {
|
|
|
|
+ },
|
|
|
|
+ //关闭弹窗
|
|
|
|
+ go: function () {
|
|
|
|
+ this.setData({
|
|
|
|
+ showModal: false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
//选择
|
|
//选择
|
|
bindPickerChange: function (e) {
|
|
bindPickerChange: function (e) {
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
@@ -28,18 +62,16 @@ Page({
|
|
index: e.detail.value
|
|
index: e.detail.value
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- back: function () {
|
|
|
|
- wx.navigateBack({ url: '/pages/me/index' })
|
|
|
|
- },
|
|
|
|
- //点击加号添加
|
|
|
|
- addList: function () {
|
|
|
|
- var lists = this.data.lists;
|
|
|
|
- var newData = [];
|
|
|
|
- lists.push(newData);//实质是添加lists数组内容,使for循环多一次
|
|
|
|
|
|
+ bindDateChange: function (e) {
|
|
|
|
+ console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
this.setData({
|
|
this.setData({
|
|
- lists: lists,
|
|
|
|
|
|
+ create_time: e.detail.value
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ back: function () {
|
|
|
|
+ wx.navigateBack({ url: '/pages/me/index' })
|
|
|
|
+ },
|
|
|
|
+
|
|
//点击减号删除
|
|
//点击减号删除
|
|
delList: function () {
|
|
delList: function () {
|
|
var lists = this.data.lists;
|
|
var lists = this.data.lists;
|
|
@@ -48,51 +80,54 @@ Page({
|
|
lists: lists,
|
|
lists: lists,
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- //提交
|
|
|
|
- formSubmit: function (e) {
|
|
|
|
- const value = e.detail.value;
|
|
|
|
- const that = this;
|
|
|
|
- if (!this.WxValidate.checkForm(value)) {
|
|
|
|
- const error = this.WxValidate.errorList[0];
|
|
|
|
- wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
|
- return false
|
|
|
|
- } else {
|
|
|
|
- value.icon = this.data.fileList;
|
|
|
|
- wx.getStorage({
|
|
|
|
- key: 'token',
|
|
|
|
- success: function (res) {
|
|
|
|
- wx.request({
|
|
|
|
- url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
|
|
|
|
- method: "post",//请求方法
|
|
|
|
- data: value,//请求参数
|
|
|
|
- header: {},
|
|
|
|
- success: res => {
|
|
|
|
- // var menbers = JSON.parse(res.data.menbers)
|
|
|
|
- console.log(res);
|
|
|
|
- if (res.data.errcode == 0) {
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '创建团队成功',
|
|
|
|
- icon: 'success',
|
|
|
|
- duration: 2000//延迟两秒
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '创建团队失败',
|
|
|
|
- icon: 'error',
|
|
|
|
- duration: 2000
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- error: err => {
|
|
|
|
- console.log(err);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // //提交
|
|
|
|
+ // formSubmit: function (e) {
|
|
|
|
+ // const value = e.detail.value;
|
|
|
|
+ // if (!this.WxValidate.checkForm(value)) {
|
|
|
|
+ // const error = this.WxValidate.errorList[0];
|
|
|
|
+ // wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
|
+ // return false
|
|
|
|
+ // } else {
|
|
|
|
+ // value.icon = this.data.fileList;
|
|
|
|
+ // wx.getStorage({
|
|
|
|
+ // key: 'token',
|
|
|
|
+ // success: function (res) {
|
|
|
|
+ // wx.request({
|
|
|
|
+ // url: `${app.globalData.publicUrl}/courtAdmin/api/team`, //接口地址
|
|
|
|
+ // method: "post",//请求方法
|
|
|
|
+ // //请求参数
|
|
|
|
+ // data: value,
|
|
|
|
+ // header: {},
|
|
|
|
+ // success: res => {
|
|
|
|
+ // console.log(res);
|
|
|
|
+ // if (res.data.errcode == 0) {
|
|
|
|
+ // wx.showToast({
|
|
|
|
+ // title: '创建团队成功',
|
|
|
|
+ // icon: 'success',
|
|
|
|
+ // duration: 2000//延迟两秒
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // wx.showToast({
|
|
|
|
+ // title: '创建团队失败',
|
|
|
|
+ // icon: 'error',
|
|
|
|
+ // duration: 2000
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // error: err => {
|
|
|
|
+ // console.log(err);
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
//上传图片
|
|
//上传图片
|
|
|
|
+ formSubmit(e) {
|
|
|
|
+ console.log('form发生了submit事件,携带数据为:', e.detail.value)
|
|
|
|
+ },
|
|
afterRead: function (event) {
|
|
afterRead: function (event) {
|
|
|
|
+ const that = this;
|
|
const { file } = event.detail;
|
|
const { file } = event.detail;
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式app.globalData.fileUrl:
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式app.globalData.fileUrl:
|
|
console.log(file);
|
|
console.log(file);
|
|
@@ -132,7 +167,6 @@ Page({
|
|
this.watchLogin();
|
|
this.watchLogin();
|
|
//验证规则函数
|
|
//验证规则函数
|
|
this.initValidate()
|
|
this.initValidate()
|
|
-
|
|
|
|
},
|
|
},
|
|
// 监听用户是否登录
|
|
// 监听用户是否登录
|
|
watchLogin: function () {
|
|
watchLogin: function () {
|
|
@@ -141,6 +175,19 @@ Page({
|
|
key: 'token',
|
|
key: 'token',
|
|
success: res => {
|
|
success: res => {
|
|
//数据请求
|
|
//数据请求
|
|
|
|
+ wx.request({
|
|
|
|
+ url: `${app.globalData.publicUrl}/courtAdmin/api/user`, //接口地址
|
|
|
|
+ method: "get",
|
|
|
|
+ data: {},
|
|
|
|
+ header: {},
|
|
|
|
+ success: res => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ that.setData({ item: res.data.data })
|
|
|
|
+ },
|
|
|
|
+ error: err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
fail: res => {
|
|
fail: res => {
|
|
wx.redirectTo({ url: '/pages/login/index', })
|
|
wx.redirectTo({ url: '/pages/login/index', })
|
|
@@ -157,7 +204,6 @@ Page({
|
|
if (frameStyle.useBar) infoHeight = infoHeight - 50;
|
|
if (frameStyle.useBar) infoHeight = infoHeight - 50;
|
|
if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
if (infoHeight) this.setData({ infoHeight: infoHeight })
|
|
},
|
|
},
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|