|
@@ -34,84 +34,12 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- //app.initSocket(); 链接websocket 用于测试
|
|
|
+ //app.initSocket();链接websocket 用于测试
|
|
|
const that = this;
|
|
|
this.setData({
|
|
|
timdialogid: options.id,
|
|
|
userid: wx.getStorageSync('userData').userid
|
|
|
});
|
|
|
- //详情
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "system.im.imdialog.imdialog",
|
|
|
- "method": "query_imdialogMain",
|
|
|
- "content": {
|
|
|
- "timdialogid": this.data.timdialogid
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("详情", res)
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- let title = res.data[0].fimdialogname.split('-'),
|
|
|
- headerTitle = (title[0] == res.data[0].fname) ? title[1] : title[0],
|
|
|
- joinHands = false;
|
|
|
- //供需类型对话框,判断对话框ID是否为当前账号,当前账号更改供需状态,非当前账号显示合作按钮
|
|
|
- if (res.data[0].fimdialogtype == '供需') {
|
|
|
- if (res.data[0].fimuserid == this.data.userid) {
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "customer.supplyanddemand.supplyanddemand",
|
|
|
- "method": "updatesupplyanddemandstatus",
|
|
|
- "content": {
|
|
|
- "tsupplyanddemandid": res.data[0].ownerid,
|
|
|
- "fstatus": "对接中",
|
|
|
- "timdialogid": res.data[0].timdialogid
|
|
|
- }
|
|
|
- }, false).then(res => {
|
|
|
- console.log("对接中", res)
|
|
|
- })
|
|
|
- } else {
|
|
|
- joinHands = true
|
|
|
- }
|
|
|
- }
|
|
|
- //返回数据
|
|
|
- this.setData({
|
|
|
- headerTitle,
|
|
|
- ownerid: res.data[0].ownerid,
|
|
|
- initiator: res.data[0].fimuserid,
|
|
|
- joinHands,
|
|
|
- fimuserid: res.data[0].fimuserid,
|
|
|
- fimdialogtype: res.data[0].fimdialogtype
|
|
|
- })
|
|
|
- //判断是否为话题类型对话框
|
|
|
- if (res.data[0].fimdialogtype == '话题') {
|
|
|
- _Http.basic({
|
|
|
- "accesstoken": wx.getStorageSync('userData').token,
|
|
|
- "classname": "system.im.imdialog.imdialog",
|
|
|
- "method": "queryDialogUncloseSubject",
|
|
|
- "content": {
|
|
|
- "timdialogid": res.data[0].timdialogid
|
|
|
- }
|
|
|
- }, false).then(s => {
|
|
|
- if (s.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- if (s.data != '成功') {
|
|
|
- this.setData({
|
|
|
- timsubjectid: s.data[0].timsubjectid
|
|
|
- })
|
|
|
- this.endGambit(true) //存在未关闭话题,调用关闭话题,并在关闭后重新获取历史话题
|
|
|
- } else {
|
|
|
- this.query_imdialogMessage(); //不存在未关闭话题,直接获取历史话题
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.query_imdialogMessage(); //非话题类型对话框,直接获取历史记录
|
|
|
- }
|
|
|
- })
|
|
|
//判断是否存在安全距离
|
|
|
let iosX = (getApp().globalData.safeAreaBottom == 0) ? false : true;
|
|
|
this.setData({
|
|
@@ -120,6 +48,11 @@ Page({
|
|
|
//获取表情包
|
|
|
this.getMeme()
|
|
|
},
|
|
|
+ toCreate() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/chatRoom/create?timdialogid=' + this.data.timdialogid,
|
|
|
+ })
|
|
|
+ },
|
|
|
/* 创建话题,回复话题 */
|
|
|
createGambit() {
|
|
|
_Http.basic({
|
|
@@ -346,7 +279,6 @@ Page({
|
|
|
},
|
|
|
/* 根据话题ID查询详情 */
|
|
|
async querySubject(array) {
|
|
|
- console.log("列表", array)
|
|
|
let list = [];
|
|
|
for (let index = 0; index < array.length; index++) {
|
|
|
await _Http.basic({
|
|
@@ -363,10 +295,12 @@ Page({
|
|
|
if (res.data[0].closedate != null) {
|
|
|
let time = res.data[0].closedate.split('.');
|
|
|
res.data[0].closedate = time[0];
|
|
|
+ res.data[0].finish = true;
|
|
|
list.push(res.data[0]);
|
|
|
} else {
|
|
|
let time = res.data[0].createdate.split('.');
|
|
|
res.data[0].createdate = time[0];
|
|
|
+ res.data[0].finish = false;
|
|
|
list.push(res.data[0]);
|
|
|
}
|
|
|
}
|
|
@@ -636,6 +570,79 @@ Page({
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
var that = this;
|
|
|
+ //详情
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "system.im.imdialog.imdialog",
|
|
|
+ "method": "query_imdialogMain",
|
|
|
+ "content": {
|
|
|
+ "getdatafromdbanyway": true,
|
|
|
+ "timdialogid": this.data.timdialogid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("详情", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let title = res.data[0].fimdialogname.split('-'),
|
|
|
+ headerTitle = (title[0] == res.data[0].fname) ? title[1] : title[0],
|
|
|
+ joinHands = false;
|
|
|
+ //供需类型对话框,判断对话框ID是否为当前账号,当前账号更改供需状态,非当前账号显示合作按钮
|
|
|
+ if (res.data[0].fimdialogtype == '供需') {
|
|
|
+ if (res.data[0].fimuserid == this.data.userid) {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.supplyanddemand.supplyanddemand",
|
|
|
+ "method": "updatesupplyanddemandstatus",
|
|
|
+ "content": {
|
|
|
+ "tsupplyanddemandid": res.data[0].ownerid,
|
|
|
+ "fstatus": "对接中",
|
|
|
+ "timdialogid": res.data[0].timdialogid
|
|
|
+ }
|
|
|
+ }, false).then(res => {
|
|
|
+ console.log("对接中", res)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ joinHands = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //返回数据
|
|
|
+ this.setData({
|
|
|
+ headerTitle,
|
|
|
+ ownerid: res.data[0].ownerid,
|
|
|
+ initiator: res.data[0].fimuserid,
|
|
|
+ joinHands,
|
|
|
+ fimuserid: res.data[0].fimuserid,
|
|
|
+ fimdialogtype: res.data[0].fimdialogtype
|
|
|
+ })
|
|
|
+ //判断是否为话题类型对话框
|
|
|
+ if (res.data[0].fimdialogtype == '话题') {
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "system.im.imdialog.imdialog",
|
|
|
+ "method": "queryDialogUncloseSubject",
|
|
|
+ "content": {
|
|
|
+ "timdialogid": res.data[0].timdialogid
|
|
|
+ }
|
|
|
+ }, false).then(s => {
|
|
|
+ if (s.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (s.data != '成功') {
|
|
|
+ this.setData({
|
|
|
+ timsubjectid: s.data[0].timsubjectid
|
|
|
+ })
|
|
|
+ this.endGambit(true) //存在未关闭话题,调用关闭话题,并在关闭后重新获取历史话题
|
|
|
+ } else {
|
|
|
+ this.query_imdialogMessage(); //不存在未关闭话题,直接获取历史话题
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.query_imdialogMessage(); //非话题类型对话框,直接获取历史记录
|
|
|
+ }
|
|
|
+ });
|
|
|
app.globalData.callback = function (res) {
|
|
|
//res 接收websocket onMessage事件返回的数据
|
|
|
let objs = JSON.parse(res.data),
|
|
@@ -644,6 +651,7 @@ Page({
|
|
|
that.setData({
|
|
|
socketMsgQueue: that.data.socketMsgQueue
|
|
|
})
|
|
|
+ console.log(objs.message.sendfrom)
|
|
|
if (objs.message.sendfrom) that.setData({
|
|
|
sendfrom: objs.message.sendfrom
|
|
|
})
|
|
@@ -656,7 +664,7 @@ Page({
|
|
|
} */
|
|
|
/* ,
|
|
|
toView: `item${that.data.socketMsgQueue.length - 1}` */
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
|
|
|
/**
|