|
@@ -6,23 +6,14 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ team_id: "",
|
|
|
id: '',
|
|
|
form: {},
|
|
|
- // 胜者
|
|
|
- winnerList: [],
|
|
|
// 状态
|
|
|
statusList: [],
|
|
|
- userList: []
|
|
|
- },
|
|
|
- // 选择胜者
|
|
|
- winnerChange(e) {
|
|
|
- const that = this;
|
|
|
- const index = e.detail.value;
|
|
|
- let data = that.data.winnerList[index];
|
|
|
- if (data) {
|
|
|
- that.setData({ 'form.winner': data._id })
|
|
|
- that.setData({ 'form.winner_name': data.name })
|
|
|
- }
|
|
|
+ userList: [],
|
|
|
+ red_disabled: false,
|
|
|
+ blue_disabled: false
|
|
|
},
|
|
|
// 过滤字典表
|
|
|
getDict(value, model) {
|
|
@@ -81,7 +72,7 @@ Page({
|
|
|
*/
|
|
|
async onLoad(options) {
|
|
|
const that = this;
|
|
|
- that.setData({ id: options.id });
|
|
|
+ that.setData({ id: options.id, team_id: options.team_id });
|
|
|
wx.showLoading({ title: '加载中', mask: true })
|
|
|
//验证规则函数
|
|
|
that.initValidate();
|
|
@@ -115,13 +106,11 @@ Page({
|
|
|
if (aee.errcode == '0') {
|
|
|
form = aee.data;
|
|
|
if (form && form._id) {
|
|
|
- const red = that.data.userList.filter(i => i._id == form.red_team_id)
|
|
|
- const blue = that.data.userList.filter(i => i._id == form.blue_team_id)
|
|
|
- that.setData({ winnerList: [...red, ...blue] })
|
|
|
+ console.log(that.data.team_id);
|
|
|
+ if (form.red_team_id == that.data.team_id) that.setData({ blue_disabled: true })
|
|
|
+ else if (form.blue_team_id == that.data.team_id) that.setData({ red_disabled: true })
|
|
|
// 状态
|
|
|
if (form.status) form.status_name = that.getDict(form.status, 'status')
|
|
|
- // 胜者
|
|
|
- if (form.winner) form.winner_name = that.getDict(form.winner, 'winner')
|
|
|
}
|
|
|
} else {
|
|
|
wx.showToast({ title: `${aee.errmsg}`, icon: 'error' });
|