fix confilcts
This commit is contained in:
commit
656922a915
|
@ -14,7 +14,6 @@ Component({
|
||||||
*/
|
*/
|
||||||
methods: {
|
methods: {
|
||||||
delete(res) {
|
delete(res) {
|
||||||
console.log(res)
|
|
||||||
let index = res.currentTarget.id
|
let index = res.currentTarget.id
|
||||||
let list = this.data.list
|
let list = this.data.list
|
||||||
list.splice(index, 1)
|
list.splice(index, 1)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<view class='container'>
|
<view class='container'>
|
||||||
<view class='scroll-wrapper'>
|
<view class='scroll-wrapper'>
|
||||||
<scroll-view scroll-x style='scroll'>
|
<scroll-view scroll-x style='scroll'>
|
||||||
<text id='{{index}}' class='text' wx:for='{{list}}' wx:key='{{index}}' bindtap='delete'>{{item.name}}</text> </scroll-view>
|
<text id='{{index}}' class='text' wx:for='{{list}}' wx:key="index" bindtap='delete'>{{item.name}}</text></scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<text class='btn' bindtap='confirm'>确定</text>
|
<text class='btn' bindtap='confirm'>确定</text>
|
||||||
</view>
|
</view>
|
|
@ -119,7 +119,12 @@ wx.getStorage({
|
||||||
},
|
},
|
||||||
choosequestioncat:function(){
|
choosequestioncat:function(){
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/questioncat/index',
|
url: '/pages/questioncat/index?type=2',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
choosequestioncat2:function(){
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/questioncat/index?type=3',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
start1:function(){
|
start1:function(){
|
||||||
|
|
|
@ -4,7 +4,14 @@
|
||||||
<view class="page__desc">选择题库分类进行练习。</view>
|
<view class="page__desc">选择题库分类进行练习。</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="page__bd page__bd_spacing">
|
<view class="page__bd page__bd_spacing">
|
||||||
<button class="weui-btn" type="primary" bindtap='choosequestioncat'>选择分类</button>
|
<view style="width:50%;float:left">
|
||||||
|
<button class="weui-btn" type="primary" bindtap='choosequestioncat'>自建分类</button>
|
||||||
|
</view>
|
||||||
|
<view style="width:50%;float:left;">
|
||||||
|
<button class="weui-btn" type="primary" bindtap='choosequestioncat2' style="margin-left:2px">共享分类</button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class="weui-cells__title">已选分类</view>
|
<view class="weui-cells__title">已选分类</view>
|
||||||
<view class="weui-cells weui-cells_after-title" style="height: 5.3em">
|
<view class="weui-cells weui-cells_after-title" style="height: 5.3em">
|
||||||
{{catsname}}
|
{{catsname}}
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
// pages/miss/miss.js
|
// pages/miss/miss.js
|
||||||
|
const api = require("../../utils/request.js");
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
page: 1,
|
query:{
|
||||||
serverUrl: getApp().globalData.serverUrl,
|
a:'listall',
|
||||||
|
page:1,
|
||||||
|
rows:10
|
||||||
|
},
|
||||||
wslist:[]
|
wslist:[]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -51,9 +55,9 @@ Page({
|
||||||
*/
|
*/
|
||||||
onPullDownRefresh: function () {
|
onPullDownRefresh: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getWslist(1);
|
this.data.query.page = 1;
|
||||||
|
that.getWslist();
|
||||||
wx.stopPullDownRefresh();
|
wx.stopPullDownRefresh();
|
||||||
this.data.page = 1;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,9 +65,16 @@ Page({
|
||||||
*/
|
*/
|
||||||
onReachBottom: function () {
|
onReachBottom: function () {
|
||||||
//上拉分页,将页码加1,然后调用分页函数
|
//上拉分页,将页码加1,然后调用分页函数
|
||||||
this.data.page = this.data.page + 1;
|
var that = this
|
||||||
this.getWslist();
|
if (that.data.total <= that.data.query.page * that.data.query.rows) {
|
||||||
wx.stopPullDownRefresh();
|
wx.showToast({
|
||||||
|
title: '没有更多了',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
that.data.query.page = that.data.query.page + 1
|
||||||
|
that.getWslist()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,49 +83,18 @@ Page({
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
getWslist: function (page) {
|
getWslist: function () {
|
||||||
var that = this;
|
var that = this
|
||||||
if (page != 1) { page = that.data.page }
|
api.request('api/miss', 'GET', that.data.query).then(res => {
|
||||||
wx.showLoading({
|
if (that.data.query.page == 1) {
|
||||||
title: '加载中',
|
that.data.wslist = res.rows
|
||||||
}),
|
} else {
|
||||||
wx.request({
|
that.data.wslist = that.data.wslist.concat(res.rows)
|
||||||
url: this.data.serverUrl + 'api/miss?a=listall&rows=10&page=' + page,
|
}
|
||||||
header: {
|
that.setData({
|
||||||
'content-type': 'application/json', // 默认值
|
wslist: that.data.wslist,
|
||||||
'Cookie': getApp().globalData.sessionId,
|
total: res.total
|
||||||
},
|
})
|
||||||
success: res => {
|
})
|
||||||
if (res.statusCode === 200) {
|
|
||||||
if (res.data.rows.length == 0) {
|
|
||||||
if (page == 1) {
|
|
||||||
this.setData({
|
|
||||||
total: 0,
|
|
||||||
wslist: []
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
wx.showModal({
|
|
||||||
content: "已经到底啦!",
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: "确定",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let list
|
|
||||||
if (page == 1) {
|
|
||||||
list = res.data.rows
|
|
||||||
} else {
|
|
||||||
list = this.data.wslist.concat(res.data.rows)
|
|
||||||
}
|
|
||||||
this.setData({
|
|
||||||
total: res.data.total,
|
|
||||||
wslist: list
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wx.hideLoading();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
})
|
})
|
|
@ -13,6 +13,7 @@ Page({
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
this.data.missid = options.missid
|
||||||
this.getWsdetail(options.missid);
|
this.getWsdetail(options.missid);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -41,7 +42,15 @@ Page({
|
||||||
* 生命周期函数--监听页面卸载
|
* 生命周期函数--监听页面卸载
|
||||||
*/
|
*/
|
||||||
onUnload: function () {
|
onUnload: function () {
|
||||||
|
// var pages = getCurrentPages()
|
||||||
|
// var prePage = pages[pages.length-2]
|
||||||
|
// if(prePage.data.wslist){
|
||||||
|
// for(var i=0;i<prePage.data.wslist;i++){
|
||||||
|
// if(prePage.data.wslist[i].missid == this.data.missid){
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,13 +11,17 @@ Page({
|
||||||
selectList: [], //已选择的元素列表
|
selectList: [], //已选择的元素列表
|
||||||
originalList: [], //最原始的数据列表
|
originalList: [], //最原始的数据列表
|
||||||
indexList: [], //存储目录层级的数组,用于准确的返回上一层
|
indexList: [], //存储目录层级的数组,用于准确的返回上一层
|
||||||
selectList: [], //已选中的人员列表
|
selectList: [], //已选中的人员列表,
|
||||||
|
type:2
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
wx.setNavigationBarTitle({
|
wx.setNavigationBarTitle({
|
||||||
title: '选择分类'
|
title: '选择分类'
|
||||||
})
|
})
|
||||||
|
if(options.type){
|
||||||
|
this.data.type = options.type
|
||||||
|
}
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -25,7 +29,7 @@ Page({
|
||||||
//上次选中的列表,用于判断是不是取消选中了
|
//上次选中的列表,用于判断是不是取消选中了
|
||||||
this.lastTimeSelect = []
|
this.lastTimeSelect = []
|
||||||
wx.request({
|
wx.request({
|
||||||
url: getApp().globalData.serverUrl + 'api/questioncat?a=tree',
|
url: getApp().globalData.serverUrl + 'api/questioncat?a=tree' + this.data.type.toString(),
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/json', // 默认值
|
'content-type': 'application/json', // 默认值
|
||||||
'Cookie': getApp().globalData.sessionId,
|
'Cookie': getApp().globalData.sessionId,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<view>姓名</view>
|
<view>姓名</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
{{realname}}
|
{{user__userprofile__realname}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell weui-cell_access">
|
<view class="weui-cell weui-cell_access">
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<view>性别</view>
|
<view>性别</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
{{gender}}
|
{{user__userprofile__gender}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell weui-cell_access">
|
<view class="weui-cell weui-cell_access">
|
||||||
|
|
|
@ -26,7 +26,7 @@ Page({
|
||||||
*/
|
*/
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getsafecertlist()
|
that.getsafecertlist2()
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,4 +167,21 @@ Page({
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
getsafecertlist2: function(){
|
||||||
|
wx.showLoading({ title: '加载中', })
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/safecert?a=listself',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': getApp().globalData.sessionId,
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
safecertlist: res.data.rows
|
||||||
|
})
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
|
@ -26,7 +26,7 @@ Page({
|
||||||
*/
|
*/
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
that.getSocertlist()
|
that.getSocertlist2()
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,4 +166,22 @@ Page({
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getSocertlist2: function() {
|
||||||
|
wx.showLoading({ title: '加载中', })
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/socert?a=listself',
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': getApp().globalData.sessionId,
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
this.setData({
|
||||||
|
total: res.data.total,
|
||||||
|
socertlist: res.data.rows
|
||||||
|
})
|
||||||
|
wx.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
|
@ -6,7 +6,7 @@
|
||||||
<view>姓名</view>
|
<view>姓名</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
{{realname}}
|
{{user__userprofile__realname}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell weui-cell_access">
|
<view class="weui-cell weui-cell_access">
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<view>性别</view>
|
<view>性别</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell__ft">
|
<view class="weui-cell__ft">
|
||||||
{{gender}}
|
{{user__userprofile__gender}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cell weui-cell_access">
|
<view class="weui-cell weui-cell_access">
|
||||||
|
|
|
@ -10,7 +10,8 @@ Page({
|
||||||
genderarray: ['男','女'],
|
genderarray: ['男','女'],
|
||||||
genderIndex:0,
|
genderIndex:0,
|
||||||
userprofile__realname:'',
|
userprofile__realname:'',
|
||||||
userprofile__cardnum:''
|
userprofile__cardnum:'',
|
||||||
|
userprofile__gender:'男'
|
||||||
},
|
},
|
||||||
bindrealnameInput: function (e) {
|
bindrealnameInput: function (e) {
|
||||||
this.data.userprofile__realname = e.detail.value
|
this.data.userprofile__realname = e.detail.value
|
||||||
|
@ -161,18 +162,22 @@ Page({
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
if (res.data.code == 1) {
|
if (res.data.code == 1) {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
wx.navigateBack()
|
wx.showToast({
|
||||||
wx.request({
|
title: '保存成功',
|
||||||
url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself',
|
icon:'none'
|
||||||
header: {
|
})
|
||||||
'content-type': 'application/json', // 默认值
|
// wx.navigateBack()
|
||||||
'Cookie': getApp().globalData.sessionId,
|
// wx.request({
|
||||||
},
|
// url: getApp().globalData.serverUrl + 'api/socert?a=addspiderself',
|
||||||
method: 'GET',
|
// header: {
|
||||||
data: {},
|
// 'content-type': 'application/json', // 默认值
|
||||||
success: res => {
|
// 'Cookie': getApp().globalData.sessionId,
|
||||||
}
|
// },
|
||||||
});
|
// method: 'GET',
|
||||||
|
// data: {},
|
||||||
|
// success: res => {
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ Page({
|
||||||
selectList: [], //已选择的元素列表
|
selectList: [], //已选择的元素列表
|
||||||
originalList: [], //最原始的数据列表
|
originalList: [], //最原始的数据列表
|
||||||
indexList: [], //存储目录层级的数组,用于准确的返回上一层
|
indexList: [], //存储目录层级的数组,用于准确的返回上一层
|
||||||
selectList: [], //已选中的人员列表
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
@ -34,10 +33,9 @@ Page({
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
let list = res.data.data
|
let list = res.data.data
|
||||||
console.log(list)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
currentList: list,
|
currentList: list,
|
||||||
originalList:list
|
originalList: list
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,22 +43,30 @@ Page({
|
||||||
},
|
},
|
||||||
|
|
||||||
clickItem(res) {
|
clickItem(res) {
|
||||||
console.log(res)
|
|
||||||
let index = res.currentTarget.id;
|
let index = res.currentTarget.id;
|
||||||
let item = this.data.currentList[index]
|
let item = this.data.currentList[index]
|
||||||
|
|
||||||
console.log("item", item)
|
|
||||||
|
|
||||||
if (!item.isPeople) {
|
if (!item.isPeople) {
|
||||||
//children的长度为0时,请求服务器
|
//children的长度为0时,请求服务器
|
||||||
if (item.children.length === 0) {
|
if (item.children.length === 0) {
|
||||||
this._getUserByGroup(item)
|
this._getUserByGroup(item)
|
||||||
} else {
|
} else {
|
||||||
//children的长度不为0时,更新 currentList
|
//children的长度不为0时,更新 currentList
|
||||||
this.setData({
|
let currentList = item.children
|
||||||
currentList: item.children
|
let selectids = []
|
||||||
})
|
for (var i=0;i<this.data.selectList.length;i++){
|
||||||
|
selectids.push(this.data.selectList[i].id)
|
||||||
|
}
|
||||||
|
for(var i =0;i<currentList.length;i++){
|
||||||
|
if (currentList[i].isPeople && selectids.indexOf(currentList[i]['id'].toString())>=0){
|
||||||
|
currentList[i]['checked'] = true
|
||||||
|
}else{
|
||||||
|
currentList[i]['checked'] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
currentList: currentList,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
//将当前的索引存入索引目录中。索引多一个表示目录多一级
|
//将当前的索引存入索引目录中。索引多一个表示目录多一级
|
||||||
let indexes = this.data.indexList
|
let indexes = this.data.indexList
|
||||||
|
@ -70,7 +76,9 @@ Page({
|
||||||
indexList: indexes
|
indexList: indexes
|
||||||
})
|
})
|
||||||
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
||||||
|
|
||||||
this.setLastTimeSelectList();
|
this.setLastTimeSelectList();
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -81,12 +89,10 @@ Page({
|
||||||
if (indexList.length > 0) {
|
if (indexList.length > 0) {
|
||||||
//返回时删掉最后一个索引
|
//返回时删掉最后一个索引
|
||||||
indexList.pop()
|
indexList.pop()
|
||||||
|
let currentList = []
|
||||||
if (indexList.length == 0) {
|
if (indexList.length == 0) {
|
||||||
//indexList长度为0说明回到了最顶层
|
//indexList长度为0说明回到了最顶层
|
||||||
this.setData({
|
currentList = this.data.originalList
|
||||||
currentList: this.data.originalList,
|
|
||||||
indexList: indexList
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
//循环将当前索引的对应数组赋值给currentList
|
//循环将当前索引的对应数组赋值给currentList
|
||||||
let list = this.data.originalList
|
let list = this.data.originalList
|
||||||
|
@ -94,12 +100,24 @@ Page({
|
||||||
let index = indexList[i]
|
let index = indexList[i]
|
||||||
list = list[index].children
|
list = list[index].children
|
||||||
}
|
}
|
||||||
this.setData({
|
currentList = list
|
||||||
currentList: list,
|
|
||||||
indexList: indexList
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
//清空上次选中的元素列表,并设置上一层的选中状态给lastTimeSelect
|
||||||
|
let selectids = []
|
||||||
|
for (var i=0;i<this.data.selectList.length;i++){
|
||||||
|
selectids.push(this.data.selectList[i].id)
|
||||||
|
}
|
||||||
|
for(var i =0;i<currentList.length;i++){
|
||||||
|
if (currentList[i].isPeople && selectids.indexOf(currentList[i]['id'].toString())>=0){
|
||||||
|
currentList[i]['checked'] = true
|
||||||
|
}else{
|
||||||
|
currentList[i]['checked'] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
currentList: currentList,
|
||||||
|
indexList: indexList
|
||||||
|
})
|
||||||
this.setLastTimeSelectList();
|
this.setLastTimeSelectList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -108,7 +126,7 @@ Page({
|
||||||
setLastTimeSelectList() {
|
setLastTimeSelectList() {
|
||||||
this.lastTimeSelect = []
|
this.lastTimeSelect = []
|
||||||
this.data.currentList.forEach(item => {
|
this.data.currentList.forEach(item => {
|
||||||
if (item.checked) {
|
if (item.checked && item.isPeople) {
|
||||||
this.lastTimeSelect.push(item)
|
this.lastTimeSelect.push(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -126,7 +144,6 @@ Page({
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
let list = res.data.data
|
let list = res.data.data
|
||||||
console.log(res.list)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
currentList: list
|
currentList: list
|
||||||
})
|
})
|
||||||
|
@ -195,25 +212,19 @@ Page({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setData({
|
this.data.originalList = originalList
|
||||||
originalList: originalList
|
|
||||||
})
|
|
||||||
console.log("originalList", originalList)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//选框变化回调
|
//选框变化回调
|
||||||
checkChange(res) {
|
checkChange(res) {
|
||||||
console.log(res)
|
|
||||||
let values = res.detail.value
|
let values = res.detail.value
|
||||||
let selectItems = []
|
let selectItems = []
|
||||||
|
|
||||||
//将值取出拼接成 id,name 格式
|
//将值取出拼接成 id,name 格式
|
||||||
values.forEach(value => {
|
values.forEach(value => {
|
||||||
let arrs = value.split(",")
|
let arrs = value.split(",")
|
||||||
selectItems.push({ id: arrs[0], name: arrs[1] })
|
selectItems.push({ id: arrs[0], name: arrs[1] })
|
||||||
})
|
})
|
||||||
console.log("selectItems", selectItems)
|
|
||||||
console.log("lastTimeSelect", this.lastTimeSelect)
|
|
||||||
|
|
||||||
//将本次选择的与上次选择的比对,本次比上次多说明新增了,本次比上次少说明删除了,找出被删除的那条数据,在footer中也删除
|
//将本次选择的与上次选择的比对,本次比上次多说明新增了,本次比上次少说明删除了,找出被删除的那条数据,在footer中也删除
|
||||||
if (selectItems.length > this.lastTimeSelect.length) {
|
if (selectItems.length > this.lastTimeSelect.length) {
|
||||||
//将 selectList 与 selectItems 拼接并去重
|
//将 selectList 与 selectItems 拼接并去重
|
||||||
|
@ -235,7 +246,6 @@ Page({
|
||||||
})
|
})
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
diffItem = item
|
diffItem = item
|
||||||
console.log("diff=", item)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//找出被删除的元素在 selectList 中的位置
|
//找出被删除的元素在 selectList 中的位置
|
||||||
|
@ -253,19 +263,16 @@ Page({
|
||||||
selectList: list
|
selectList: list
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log("selectList", this.data.selectList)
|
this.lastTimeSelect = selectItems
|
||||||
//更新 currentList 选中状态并重新挂载在数据树上,以保存选择状态
|
|
||||||
this.updateCurrentList(this.data.currentList, this.data.selectList)
|
this.updateCurrentList(this.data.currentList, this.data.selectList)
|
||||||
},
|
},
|
||||||
|
|
||||||
//footer点击删除回调
|
//footer点击删除回调
|
||||||
footerDelete(res) {
|
footerDelete(res) {
|
||||||
console.log(res)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
selectList: res.detail.selectList
|
selectList: res.detail.selectList
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('selectList', this.data.selectList)
|
|
||||||
this.updateCurrentList(this.data.currentList, res.detail.selectList)
|
this.updateCurrentList(this.data.currentList, res.detail.selectList)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -280,7 +287,6 @@ Page({
|
||||||
wx.navigateBack({
|
wx.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
})
|
})
|
||||||
console.log("selectdone", selectList)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//更新 currentList 并将更新后的列表挂载在数据树上
|
//更新 currentList 并将更新后的列表挂载在数据树上
|
||||||
|
@ -291,17 +297,15 @@ Page({
|
||||||
selectids.push(selectList[i]['id'])
|
selectids.push(selectList[i]['id'])
|
||||||
}
|
}
|
||||||
for (var i = 0; i < currentList.length; i++) {
|
for (var i = 0; i < currentList.length; i++) {
|
||||||
if (selectids.indexOf(currentList[i]['id'].toString())>=0){
|
if (currentList[i].isPeople && selectids.indexOf(currentList[i]['id'].toString())>=0){
|
||||||
currentList[i]['checked']=true
|
currentList[i]['checked'] = true
|
||||||
}else{
|
}else{
|
||||||
currentList[i]['checked'] = false
|
currentList[i]['checked'] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(currentList)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
currentList: currentList
|
currentList: currentList
|
||||||
})
|
})
|
||||||
this.addList2DataTree()
|
this.addList2DataTree()
|
||||||
this.setLastTimeSelectList()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -5,7 +5,7 @@
|
||||||
<view class='people-wrapper'>
|
<view class='people-wrapper'>
|
||||||
<scroll-view scroll-y class='scrollview'>
|
<scroll-view scroll-y class='scrollview'>
|
||||||
<checkbox-group bindchange="checkChange">
|
<checkbox-group bindchange="checkChange">
|
||||||
<view class='item' wx:for='{{currentList}}' wx:key='{{item.id}}'>
|
<view class='item' wx:for='{{currentList}}' wx:key='index'>
|
||||||
<checkbox checked='{{item.checked}}' value='{{item.id + "," + item.name}}' wx:if='{{item.isPeople}}'> </checkbox>
|
<checkbox checked='{{item.checked}}' value='{{item.id + "," + item.name}}' wx:if='{{item.isPeople}}'> </checkbox>
|
||||||
<view id='{{index}}' class='item-content' bindtap='clickItem'>
|
<view id='{{index}}' class='item-content' bindtap='clickItem'>
|
||||||
<image class='img' wx:if='{{!item.isPeople}}' src='../images/part.png'></image>
|
<image class='img' wx:if='{{!item.isPeople}}' src='../images/part.png'></image>
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
{
|
{
|
||||||
"description": "项目配置文件。",
|
"description": "项目配置文件。",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"enhance": false,
|
"postcss": true,
|
||||||
"postcss": true,
|
"minified": true,
|
||||||
"preloadBackgroundData": false,
|
"newFeature": true,
|
||||||
"minified": true,
|
"coverView": true,
|
||||||
"newFeature": true,
|
"nodeModules": true,
|
||||||
"coverView": true,
|
"autoAudits": false,
|
||||||
"nodeModules": true,
|
"showShadowRootInWxmlPanel": true,
|
||||||
"autoAudits": false,
|
"scopeDataCheck": false,
|
||||||
"showShadowRootInWxmlPanel": true,
|
"checkInvalidKey": true,
|
||||||
"scopeDataCheck": false,
|
"checkSiteMap": true,
|
||||||
"uglifyFileName": false,
|
"uploadWithSourceMap": true,
|
||||||
"checkInvalidKey": true,
|
"babelSetting": {
|
||||||
"checkSiteMap": true,
|
"ignore": [],
|
||||||
"uploadWithSourceMap": true,
|
"disablePlugins": [],
|
||||||
"babelSetting": {
|
"outputPath": ""
|
||||||
"ignore": [],
|
},
|
||||||
"disablePlugins": [],
|
"useIsolateContext": true,
|
||||||
"outputPath": ""
|
"useCompilerModule": false,
|
||||||
},
|
"userConfirmedUseCompilerModuleSwitch": false,
|
||||||
"useCompilerModule": false,
|
"enhance": false,
|
||||||
"userConfirmedUseCompilerModuleSwitch": false,
|
"preloadBackgroundData": false,
|
||||||
"compileHotReLoad": false,
|
"uglifyFileName": false,
|
||||||
"useMultiFrameRuntime": false,
|
"compileHotReLoad": false,
|
||||||
"useApiHook": false,
|
"useMultiFrameRuntime": false,
|
||||||
"useIsolateContext": true,
|
"useApiHook": true,
|
||||||
"packNpmManually": false,
|
"packNpmManually": false,
|
||||||
"packNpmRelationList": []
|
"packNpmRelationList": []
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.9.4",
|
"libVersion": "2.9.4",
|
||||||
"appid": "wx5c39b569f01c27db",
|
"appid": "wx5c39b569f01c27db",
|
||||||
"projectname": "aqyj",
|
"projectname": "aqyj",
|
||||||
"isGameTourist": false,
|
"isGameTourist": false,
|
||||||
"simulatorType": "wechat",
|
"simulatorType": "wechat",
|
||||||
"simulatorPluginLibVersion": {},
|
"simulatorPluginLibVersion": {},
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"conversation": {
|
"conversation": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"game": {
|
"game": {
|
||||||
"currentL": -1,
|
"currentL": -1,
|
||||||
"list": []
|
"list": []
|
||||||
},
|
},
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"current": -1,
|
"current": -1,
|
||||||
"list": []
|
"list": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ function request(url, method, data) {
|
||||||
let promise = new Promise((resolve, reject) => {
|
let promise = new Promise((resolve, reject) => {
|
||||||
wx.showNavigationBarLoading();
|
wx.showNavigationBarLoading();
|
||||||
wx.request({
|
wx.request({
|
||||||
url: getApp().globalData.host + url,
|
url: getApp().globalData.serverUrl + url,
|
||||||
method: method,
|
method: method,
|
||||||
data: data,
|
data: data,
|
||||||
header: {
|
header: {
|
||||||
|
|
Loading…
Reference in New Issue