|
@@ -12,9 +12,6 @@ Page({
|
|
|
userList: [],
|
|
|
// 上传图片
|
|
|
imgList: [],
|
|
|
- // 成员
|
|
|
- member: '',
|
|
|
- memberList: []
|
|
|
},
|
|
|
// 上传图片
|
|
|
imgUpl: function (e) {
|
|
@@ -33,26 +30,9 @@ Page({
|
|
|
// 选择成员
|
|
|
userChange(e) {
|
|
|
const that = this;
|
|
|
- const memberList = that.data.memberList
|
|
|
- const index = e.detail.value;
|
|
|
- let data = that.data.userList[index];
|
|
|
- if (data) {
|
|
|
- const res = memberList.find(i => i._id == data._id)
|
|
|
- if (!res) {
|
|
|
- memberList.push(data)
|
|
|
- that.setData({ memberList })
|
|
|
- that.setData({ member: data.name })
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 删除成员
|
|
|
- async toDel(e) {
|
|
|
- const that = this;
|
|
|
- let res = e.currentTarget.dataset.item
|
|
|
- if (res) {
|
|
|
- let memberList = that.data.memberList.filter(i => i._id != res._id);
|
|
|
- that.setData({ memberList })
|
|
|
- }
|
|
|
+ const member = e.detail.value
|
|
|
+ that.setData({ "form.member": member })
|
|
|
+ that.setData({ "form.number": member.length.toString() })
|
|
|
},
|
|
|
//成立日期选择器
|
|
|
bindDateChange: function (e) {
|
|
@@ -71,9 +51,9 @@ Page({
|
|
|
// 判断id使用
|
|
|
let form = that.data.form;
|
|
|
let res;
|
|
|
- parmas.member = that.data.memberList
|
|
|
- parmas.number = that.data.memberList.length.toString()
|
|
|
parmas.logo = that.data.imgList
|
|
|
+ parmas.member = form.member
|
|
|
+ parmas.number = form.number
|
|
|
if (form._id) res = await app.$api(`team/${form._id}`, 'POST', parmas);
|
|
|
else res = await app.$api('team', 'POST', parmas);
|
|
|
if (res.errcode == '0') {
|
|
@@ -115,7 +95,10 @@ Page({
|
|
|
// 成员
|
|
|
res = await app.$api('user', 'GET', { status: '1', type: '0' })
|
|
|
if (res.errcode == '0') {
|
|
|
- for (const val of res.data) if (!val.name) val.name = '暂无';
|
|
|
+ for (const val of res.data) {
|
|
|
+ val.checked = false
|
|
|
+ if (!val.name) val.name = '暂无';
|
|
|
+ }
|
|
|
that.setData({ userList: res.data })
|
|
|
}
|
|
|
},
|
|
@@ -129,7 +112,13 @@ Page({
|
|
|
if (res.errcode == '0') {
|
|
|
let arr = res.data.create_time.split(/\s+/);
|
|
|
if (arr) { res.data.date = arr[0]; res.data.time = arr[1] }
|
|
|
- that.setData({ imgList: res.data.logo, memberList: res.data.member, form: res.data })
|
|
|
+ for (const val of res.data.member) {
|
|
|
+ for (const as of that.data.userList) {
|
|
|
+ if (as._id == val) as.checked = true
|
|
|
+ else as.checked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.setData({ imgList: res.data.logo, form: res.data })
|
|
|
} else {
|
|
|
wx.showToast({ title: `${res.errmsg}`, icon: 'none' });
|
|
|
}
|