|
@@ -2,6 +2,7 @@ import {
|
|
|
ApiModel
|
|
ApiModel
|
|
|
} from "../../utils/api";
|
|
} from "../../utils/api";
|
|
|
const _Http = new ApiModel();
|
|
const _Http = new ApiModel();
|
|
|
|
|
+const handleList = require("../../utils/processingData");
|
|
|
Page({
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -12,7 +13,9 @@ Page({
|
|
|
buddyList: [], //好友列表
|
|
buddyList: [], //好友列表
|
|
|
activeNames: [], //折叠面板展开项
|
|
activeNames: [], //折叠面板展开项
|
|
|
identity: '全部', //选择身份
|
|
identity: '全部', //选择身份
|
|
|
- result: []
|
|
|
|
|
|
|
+ result: [],
|
|
|
|
|
+ checkAll: false, //是否全选
|
|
|
|
|
+ numberOfPeople: 0, //全部人员计数
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,6 +48,68 @@ Page({
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
+ /* 创建群聊 */
|
|
|
|
|
+ createdGroup() {
|
|
|
|
|
+ if (this.data.result.length == 0) {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '当前还未选择群聊成员',
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _Http.basic({
|
|
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
|
|
+ "classname": "system.im.imdialog.imdialog",
|
|
|
|
|
+ "method": "insertOrModify",
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ "timdialogid": 0,
|
|
|
|
|
+ "fimdialogname": (this.data.inputValue == '') ? '讨论组' : this.data.inputValue,
|
|
|
|
|
+ "fimdialogtype": "话题",
|
|
|
|
|
+ "ownertable": "",
|
|
|
|
|
+ "ownerid": "",
|
|
|
|
|
+ "users": this.data.result
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ console.log("创建群聊", res)
|
|
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
|
|
+ title: res.data,
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ })
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '创建成功',
|
|
|
|
|
+ })
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ wx.redirectTo({
|
|
|
|
|
+ url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
|
|
|
|
|
+ })
|
|
|
|
|
+ }, 500)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 是否全选 */
|
|
|
|
|
+ allChange({
|
|
|
|
|
+ detail
|
|
|
|
|
+ }) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ checkAll: detail
|
|
|
|
|
+ })
|
|
|
|
|
+ if (detail) {
|
|
|
|
|
+ let result = [];
|
|
|
|
|
+ for (let i = 0; i < this.data.buddyList.length; i++) {
|
|
|
|
|
+ if (this.data.identity == '全部') {
|
|
|
|
|
+ this.batchChange(i, true)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.push(this.data.buddyList[i].userList[0].tenterprise_userid.toString())
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.data.identity != '全部') this.setData({
|
|
|
|
|
+ result
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ result: []
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
/* 商户成员列表 */
|
|
/* 商户成员列表 */
|
|
|
query_CooperationAgentUsers(data) {
|
|
query_CooperationAgentUsers(data) {
|
|
|
_Http.basic({
|
|
_Http.basic({
|
|
@@ -53,18 +118,22 @@ Page({
|
|
|
"method": "query_CooperationAgentUsers",
|
|
"method": "query_CooperationAgentUsers",
|
|
|
"content": {
|
|
"content": {
|
|
|
"getdatafromdbanyway": true,
|
|
"getdatafromdbanyway": true,
|
|
|
- "tagentsid": data.tcooperationagentsid
|
|
|
|
|
|
|
+ "tagentsid": data.tcooperationagentsid,
|
|
|
|
|
+ "hasAdministrator": "1"
|
|
|
}
|
|
}
|
|
|
}, false).then(res => {
|
|
}, false).then(res => {
|
|
|
|
|
+ console.log("成员列表", res)
|
|
|
if (res.msg != '成功') return wx.showToast({
|
|
if (res.msg != '成功') return wx.showToast({
|
|
|
title: res.data,
|
|
title: res.data,
|
|
|
icon: "none"
|
|
icon: "none"
|
|
|
})
|
|
})
|
|
|
- data.userList = res.data;
|
|
|
|
|
|
|
+ data.userList = handleList.imageType(res.data, 'headportrait');
|
|
|
|
|
+ let numberOfPeople = this.data.numberOfPeople += data.userList.length; //计数
|
|
|
let buddyList = this.data.buddyList;
|
|
let buddyList = this.data.buddyList;
|
|
|
buddyList.push(data)
|
|
buddyList.push(data)
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- buddyList
|
|
|
|
|
|
|
+ buddyList,
|
|
|
|
|
+ numberOfPeople
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -72,9 +141,20 @@ Page({
|
|
|
selectType({
|
|
selectType({
|
|
|
detail
|
|
detail
|
|
|
}) {
|
|
}) {
|
|
|
|
|
+ /* if (detail == '仅老板') {
|
|
|
|
|
+ let list = this.data.buddyList,
|
|
|
|
|
+ result = []
|
|
|
|
|
+ for (let index = 0; index < list.length; index++) {
|
|
|
|
|
+ result.push(list[index].userList[0].tenterprise_userid.toString())
|
|
|
|
|
+ }
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ result
|
|
|
|
|
+ })
|
|
|
|
|
+ } */
|
|
|
if (this.data.identity != detail) this.setData({
|
|
if (this.data.identity != detail) this.setData({
|
|
|
- detail
|
|
|
|
|
|
|
+ identity: detail
|
|
|
});
|
|
});
|
|
|
|
|
+ this.isAll()
|
|
|
},
|
|
},
|
|
|
/* 编辑群名称 */
|
|
/* 编辑群名称 */
|
|
|
nameInput(e) {
|
|
nameInput(e) {
|
|
@@ -96,14 +176,17 @@ Page({
|
|
|
this.setData({
|
|
this.setData({
|
|
|
result: e.detail
|
|
result: e.detail
|
|
|
})
|
|
})
|
|
|
|
|
+ this.isAll();
|
|
|
},
|
|
},
|
|
|
- /* 标题选择框 */
|
|
|
|
|
|
|
+ /* 商户选中 */
|
|
|
titleRadio(e) {
|
|
titleRadio(e) {
|
|
|
const {
|
|
const {
|
|
|
index,
|
|
index,
|
|
|
id
|
|
id
|
|
|
} = e.target.dataset;
|
|
} = e.target.dataset;
|
|
|
- if (!this.data.result.some((value) => value == id)) this.batchChange(index, false);
|
|
|
|
|
|
|
+ this.isAll()
|
|
|
|
|
+ if (!this.data.result.some((value) => value == id)) return this.batchChange(index, false);
|
|
|
|
|
+ if (this.data.identity == '全部') this.batchChange(index, true);
|
|
|
},
|
|
},
|
|
|
//批量修改
|
|
//批量修改
|
|
|
batchChange(index, bool) {
|
|
batchChange(index, bool) {
|
|
@@ -111,7 +194,16 @@ Page({
|
|
|
result = this.data.result;
|
|
result = this.data.result;
|
|
|
for (let index = 0; index < data.length; index++) {
|
|
for (let index = 0; index < data.length; index++) {
|
|
|
if (bool) {
|
|
if (bool) {
|
|
|
- if (!result.some((v) => v == data[index])) result.push(data[index].tenterprise_userid.toString())
|
|
|
|
|
|
|
+ if (!result.some((v) => v == data[index])) {
|
|
|
|
|
+ result.push(data[index].tenterprise_userid.toString())
|
|
|
|
|
+ result = result.reduce((pre, cur) => {
|
|
|
|
|
+ if (!pre.includes(cur)) {
|
|
|
|
|
+ return pre.concat(cur)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return pre
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [])
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
result = result.filter((value) => value != data[index].tenterprise_userid);
|
|
result = result.filter((value) => value != data[index].tenterprise_userid);
|
|
|
}
|
|
}
|
|
@@ -119,6 +211,7 @@ Page({
|
|
|
this.setData({
|
|
this.setData({
|
|
|
result
|
|
result
|
|
|
})
|
|
})
|
|
|
|
|
+ this.isAll();
|
|
|
},
|
|
},
|
|
|
/* 选择子账号同时选中主账号 */
|
|
/* 选择子账号同时选中主账号 */
|
|
|
listClick(e) {
|
|
listClick(e) {
|
|
@@ -134,38 +227,43 @@ Page({
|
|
|
result
|
|
result
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ isAll() {
|
|
|
|
|
+ let checkAll = this.data.checkAll;
|
|
|
|
|
+ if (this.data.identity == '全部') {
|
|
|
|
|
+ checkAll = (this.data.numberOfPeople == this.data.result.length) ? true : false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ checkAll = (this.data.result.length == this.data.buddyList.length) ? true : false;
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log("isall", checkAll)
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ checkAll
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
*/
|
|
|
onReady: function () {},
|
|
onReady: function () {},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
*/
|
|
|
onShow: function () {},
|
|
onShow: function () {},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
*/
|
|
|
onHide: function () {},
|
|
onHide: function () {},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
*/
|
|
|
onUnload: function () {},
|
|
onUnload: function () {},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
*/
|
|
|
onPullDownRefresh: function () {},
|
|
onPullDownRefresh: function () {},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
*/
|
|
|
onReachBottom: function () {},
|
|
onReachBottom: function () {},
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
*/
|