zhaoxiaohai 3 年之前
父節點
當前提交
8ccbf24ebc

+ 2 - 2
components/My_Checkbox/index.wxml

@@ -23,10 +23,10 @@
     </view>
 </checkbox-group>
 <view class="checkbox_but">
-    <radio-group wx:if="{{type=='annunciate'}}" class="radio" bindchange='allOrPart'>
+    <!-- <radio-group wx:if="{{type=='annunciate'}}" class="radio" bindchange='allOrPart'>
         <radio color='#4EBFCF' checked="{{isAll==0}}" value="0">全部</radio>
         <radio color='#4EBFCF' checked="{{isAll==1}}" value="1" style="margin-left: 18rpx;">指定</radio>
-    </radio-group>
+    </radio-group> -->
     <view class="button">
         <van-button type="info" size="large" color="#4EBFCF" custom-class="customClass" bindtap="confirm">确定</van-button>
     </view>

+ 2 - 1
pages/annunciate/newAndChange.js

@@ -72,7 +72,8 @@ Page({
                         "classname": "customer.noticemag.noticemag",
                         "method": "query_noticeuserList",
                         "content": {
-                            "tnoticeid": options.id
+                            "tnoticeid": options.id,
+                            "getdatafromdbanyway": true
                         }
                     }).then(s => {
                         console.log("查询范围", s)

+ 20 - 16
pages/chatRoom/GambitMsgBubble/index.wxml

@@ -11,14 +11,16 @@
             </view>
         </block>
         <block wx:if="{{isShowBottom}}">
-            <view class="hr"></view>
-            <view class="bottom" wx:if="{{role}}" bindtap="toStats">
-                <text data-type='回复'>查看回复详情</text>
-                <text data-type='已读' style="margin-left: 40rpx;">查看已读/未读详情</text>
-            </view>
-            <view wx:else class="bot-button">
-                <van-button custom-class="call" catchtap="writBack">回复</van-button>
-            </view>
+            <block wx:if="{{itemData.finish}}">
+                <view class="hr"></view>
+                <view class="bottom" wx:if="{{role}}" bindtap="toStats">
+                    <text data-type='回复'>查看回复详情</text>
+                    <text data-type='已读' style="margin-left: 40rpx;">查看已读/未读详情</text>
+                </view>
+                <view wx:else class="bot-button">
+                    <van-button custom-class="call" catchtap="writBack">回复</van-button>
+                </view>
+            </block>
         </block>
         <view class="time">
             {{itemData.closedate}}
@@ -33,14 +35,16 @@
             </view>
         </block>
         <block wx:if="{{isShowBottom}}">
-            <view class="hr"></view>
-            <view class="bottom" wx:if="{{role}}" bindtap="toStats">
-                <text data-type='回复'>查看回复详情</text>
-                <text data-type='已读' style="margin-left: 40rpx;">查看已读/未读详情</text>
-            </view>
-            <view wx:else class="bot-button">
-                <van-button custom-class="call" catchtap="writBack">回复</van-button>
-            </view>
+            <block wx:if="{{itemData.finish}}">
+                <view class="hr"></view>
+                <view class="bottom" wx:if="{{role}}" bindtap="toStats">
+                    <text data-type='回复'>查看回复详情</text>
+                    <text data-type='已读' style="margin-left: 40rpx;">查看已读/未读详情</text>
+                </view>
+                <view wx:else class="bot-button">
+                    <van-button custom-class="call" catchtap="writBack">回复</van-button>
+                </view>
+            </block>
         </block>
         <view class="time">
             {{itemData.closedate}}

+ 188 - 10
pages/chatRoom/create.js

@@ -4,18 +4,26 @@ import {
 const _Http = new ApiModel();
 const handleList = require("../../utils/processingData");
 Page({
-
     /**
      * 页面的初始数据
      */
     data: {
+        pageType: 0, //页面类型 0是添加成员 1是成员列表
         inputValue: '', //群名
         buddyList: [], //好友列表
+        buddyListCopy: [], //备份
         activeNames: [], //折叠面板展开项
         identity: '全部', //选择身份
         result: [],
         checkAll: false, //是否全选
         numberOfPeople: 0, //全部人员计数
+        searchText: '', //搜索内容
+        timdialogid: 0, //群聊id
+        users: [], //成员列表
+        closure: false, //截流
+        itemData: {}, //修改群聊原信息
+        showRemove: false, //是否开启移除成员
+        removeList: [], //清楚列表
     },
 
     /**
@@ -45,42 +53,211 @@ Page({
             this.setData({
                 activeNames
             })
+            //修改群聊信息
+            if (options.timdialogid) {
+                _Http.basic({
+                    "accesstoken": wx.getStorageSync('userData').token,
+                    "classname": "system.im.imdialog.imdialog",
+                    "method": "query_imdialogMain",
+                    "content": {
+                        "timdialogid": options.timdialogid
+                    }
+                }).then(res => {
+                    console.log("群聊详情", res)
+                    if (res.msg != '成功') return wx.showToast({
+                        title: res.data,
+                        icon: "none"
+                    });
+                    let data = res.data[0],
+                        result = [];
+                    for (let i = 0; i < data.users.length; i++) {
+                        result.push(data.users[i].tenterprise_userid.toString())
+                    }
+                    this.setData({
+                        inputValue: data.fimdialogname,
+                        timdialogid: options.timdialogid,
+                        users: data.users,
+                        result,
+                        itemData: data,
+                        pageType: 1
+                    })
+                })
+            }
+        })
+    },
+    /* 移除成员 */
+    removeMember() {
+        let list = this.data.removeList,
+            that = this,
+            _succeed = 0,
+            _fail = 0;
+        if (list.length == 0) return;
+        wx.showModal({
+            title: "提示",
+            content: "是否移除选中成员",
+            success: async function (res) {
+                if (res.confirm) {
+                    wx.showLoading({
+                        title: '移除中...',
+                        mask: true
+                    })
+                    for (let i = 0; i < list.length; i++) {
+                        await _Http.basic({
+                            "accesstoken": wx.getStorageSync('userData').token,
+                            "classname": "system.im.imdialog.imdialog",
+                            "method": "updateDialoguser",
+                            "content": {
+                                "timdialogid": that.data.timdialogid,
+                                "tenterprise_userid": list[i],
+                                "fisremove": 1,
+                                "fimdialognotes": ""
+                            }
+                        }, false).then(res => {
+                            (res.msg == '成功') ? _succeed += 1: _fail += 1;
+                        })
+                    };
+                    wx.hideLoading()
+                    wx.showToast({
+                        title: '移除成功' + _succeed + '个,失败' + _fail + '个',
+                        icon: "none"
+                    });
+                    that.setData({
+                        closure: true
+                    })
+                    setTimeout(() => {
+                        wx.navigateBack({
+                            delta: 0,
+                        })
+                    }, 500)
+                }
+            }
         })
-
+    },
+    /* 移除成员列表更新 */
+    removeListChange(event) {
+        if (event.detail.length == this.data.users.length - 1) return wx.showToast({
+            title: "不可将全部成员移除",
+            icon: "none"
+        });
+        this.setData({
+            removeList: event.detail,
+        });
+    },
+    /* 修改群名 */
+    changeName(e) {
+        if (this.data.users.length == 0) return;
+        const {
+            value
+        } = e.detail,
+            that = this;
+        if (value == this.data.itemData.fimdialogname) return;
+        if (this.data.inputValue != '') {
+            wx.showModal({
+                title: "提示",
+                content: "是否将群聊名称修改为:" + that.data.inputValue,
+                success: function (res) {
+                    if (res.confirm) {
+                        that.createdGroup(true)
+                    } else {
+                        console.log(that.data.itemData.fimdialogname)
+                        that.setData({
+                            inputValue: that.data.itemData.fimdialogname
+                        })
+                    }
+                }
+            })
+        }
+    },
+    /* 返回 */
+    goBack() {
+        if (this.data.users.length !== 0) {
+            this.setData({
+                showRemove: false,
+                pageType: 1
+            })
+        }
+    },
+    /* 编辑群聊,新增或删除成员 */
+    addAndRemove(e) {
+        const {
+            type
+        } = e.target.dataset;
+        console.log(type)
+        if (type == 'add') {
+            this.setData({
+                pageType: 0
+            })
+        } else {
+            this.setData({
+                showRemove: !this.data.showRemove
+            })
+        }
+    },
+    //本地模糊搜索
+    indistinct(e) {
+        const value = e.detail.value.trim();
+        if (value == this.data.searchText) return;
+        if (value == '') {
+            this.setData({
+                buddyList: buddyListCopy
+            })
+        } else {
+            let list = this.data.buddyListCopy,
+                newList = [];
+            for (let i = 0; i < list.length; i++) {
+                if (list[i].fbrand.includes(value)) newList.push(list[i])
+            };
+            this.setData({
+                buddyList: newList
+            })
+        }
     },
     /* 创建群聊 */
-    createdGroup() {
+    createdGroup(isChangeUsers = false) {
+        /*         if (this.data.users.length == 0) {
+                    if (this.data.result.length == 0) return
+                } */
         if (this.data.result.length == 0) {
             wx.showToast({
                 title: '当前还未选择群聊成员',
                 icon: "none"
             })
         } else {
+            if (this.data.closure) return;
             _Http.basic({
                 "accesstoken": wx.getStorageSync('userData').token,
                 "classname": "system.im.imdialog.imdialog",
                 "method": "insertOrModify",
                 "content": {
-                    "timdialogid": 0,
+                    "timdialogid": this.data.timdialogid,
                     "fimdialogname": (this.data.inputValue == '') ? '讨论组' : this.data.inputValue,
                     "fimdialogtype": "话题",
                     "ownertable": "",
                     "ownerid": "",
-                    "users": this.data.result
+                    "users": (isChangeUsers == true) ? [] : this.data.result
                 }
             }).then(res => {
-                console.log("创建群聊", res)
                 if (res.msg != '成功') return wx.showToast({
                     title: res.data,
                     icon: "none"
                 })
+                this.setData({
+                    closure: true
+                })
                 wx.showToast({
-                    title: '创建成功',
+                    title: '保存成功',
                 })
+                if (isChangeUsers == true) return;
                 setTimeout(() => {
-                    wx.redirectTo({
-                        url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
-                    })
+                    if (this.data.users.length == 0) {
+                        wx.redirectTo({
+                            url: '/pages/chatRoom/dialogbox?id=' + res.data[0].timdialogid,
+                        })
+                    } else {
+                        wx.navigateBack({
+                            delta: 0,
+                        })
+                    }
                 }, 500)
             })
         }
@@ -133,6 +310,7 @@ Page({
             buddyList.push(data)
             this.setData({
                 buddyList,
+                buddyListCopy: buddyList,
                 numberOfPeople
             })
         })

+ 68 - 22
pages/chatRoom/create.wxml

@@ -3,48 +3,94 @@
     <view class="group-name">
         <view class="name">
             <text style="opacity: 0;">{{inputValue==''?'编辑群名':inputValue}}</text>
-            <input type="text" bindinput="nameInput" value="{{inputValue}}" placeholder="编辑群名" />
+            <input type="text" bindinput="nameInput" bindblur="changeName" bindconfirm="changeName" value="{{inputValue}}" placeholder="编辑群名" />
         </view>
         <image confirm-type='done' src="/static/icon-17.png"></image>
     </view>
     <!-- 搜索 -->
     <view class="search">
-        <image src="/static/icon-16.png"></image>
-        <input type="text" placeholder="搜索" />
+        <block wx:if="{{pageType==0}}">
+            <image src="/static/icon-16.png"></image>
+            <input type="text" placeholder="搜索" placeholder-style="opacity:.5;" confirm-type='search' bindconfirm="indistinct" />
+        </block>
+        <block wx:else>
+            <view class="users">
+                <view wx:for="{{users}}">
+                    <image class="userImg" wx:if="{{item.headportraiturl}}" src="{{item.headportraiturl}}" mode="aspectFill"></image>
+                    <image class="userImg" wx:else src="https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/userImg.png" mode="aspectFill"></image>
+                </view>
+            </view>
+            <view class="add-remove">
+                <image data-type='add' hidden="{{showRemove}}" class="add-remove-img" catchtap="addAndRemove" src="/static/icon-22.png" />
+                <image data-type='remove' class="add-remove-img" catchtap="addAndRemove" src="/static/icon-21.png" />
+            </view>
+        </block>
     </view>
     <!-- 人员选择 -->
     <view class="choose">
-        <view class="title">
+        <view class="title" wx:if="{{pageType==0}}">
             职位选择
             <van-radio-group direction='horizontal' value="{{ identity }}" bind:change="selectType">
                 <van-radio checked-color='#4DC2D4' name="全部" icon-size="28rpx" custom-class='radio-group-class group-class' label-class='van-radio-class'>全部</van-radio>
                 <van-radio checked-color='#4DC2D4' name="仅老板" icon-size="28rpx" custom-class='group-class' label-class='van-radio-class'>仅老板</van-radio>
             </van-radio-group>
+            <view class="go-back" catchtap="goBack" wx:if="{{users.length!=0}}">
+                <block wx:if="{{showRemove==true|| pageType==0}}">
+                    <van-icon name="arrow-left" />
+                    <van-icon style="margin-left: -12rpx;" name="arrow-left" />返回上一级
+                </block>
+            </view>
+        </view>
+        <view wx:else class="title">
+            群聊成员
+            <view class="go-back" catchtap="goBack" wx:if="{{users.length!=0}}">
+                <block wx:if="{{showRemove==true|| pageType==0}}">
+                    <van-icon name="arrow-left" />
+                    <van-icon style="margin-left: -12rpx;" name="arrow-left" />返回上一级
+                </block>
+            </view>
         </view>
         <view style="flex: 1; max-height: 65vh;  position: relative;">
             <scroll-view style="height: 100%; width: 100vw;" scroll-y>
-                <van-collapse custom-class="collapse-cus" value="{{ activeNames }}" bind:change="collapseChange">
-                    <van-checkbox-group value="{{ result }}" bind:change="userListCheckboxChange">
-                        <van-collapse-item custom-class="collapse-item" wx:for="{{buddyList}}" name="{{index}}">
-                            <view slot="title" class="collapse-title">
-                                <van-checkbox name="{{item.userList[0].tenterprise_userid}}" shape='round' icon-size="14px" checked-color="#4DC2D4" data-index="{{index}}" data-id="{{item.userList[0].tenterprise_userid}}" catchtap="titleRadio"><text class="u-line-1" data-index="{{index}}" data-id="{{item.userList[0].tenterprise_userid}}" style="max-width: 400rpx;display: inline-block;">{{item.fbrand}}</text></van-checkbox>
-                            </view>
-                            <van-checkbox disabled='{{index==0}}' icon-size="14px" data-index="{{index}}" data-id="{{it.tenterprise_userid}}" catchtap="listClick" id="{{item.userList[0].tenterprise_userid}}" wx:for="{{item.userList}}" wx:for-item="it" custom-class='user-list-custom' checked-color='#4DC2D4' label-class="user-list-checkbox" wx:key="index" name="{{it.tenterprise_userid}}">
-                                <view class="user-item u-line-1">
-                                    <image wx:if="{{it.attinfos[0].fobsurl}}" src="{{it.attinfos[0].fobsurl}}" mode="aspectFill" />
-                                    <image wx:else src="https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/userImg.png" mode="aspectFill" />{{it.fname}}
+                <!-- 选择添加成员 -->
+                <block wx:if="{{pageType==0}}">
+                    <van-collapse custom-class="collapse-cus" value="{{ activeNames }}" bind:change="collapseChange">
+                        <van-checkbox-group value="{{ result }}" bind:change="userListCheckboxChange">
+                            <van-collapse-item custom-class="collapse-item" wx:for="{{buddyList}}" name="{{index}}">
+                                <view slot="title" class="collapse-title">
+                                    <van-checkbox name="{{item.userList[0].tenterprise_userid}}" shape='round' icon-size="14px" checked-color="#4DC2D4" data-index="{{index}}" data-id="{{item.userList[0].tenterprise_userid}}" catchtap="titleRadio"><text class="u-line-1" data-index="{{index}}" data-id="{{item.userList[0].tenterprise_userid}}" style="max-width: 400rpx;display: inline-block;">{{item.fbrand}}</text></van-checkbox>
                                 </view>
-                            </van-checkbox>
-                        </van-collapse-item>
-                    </van-checkbox-group>
-                </van-collapse>
-                <van-empty wx:if="{{buddyList.length==0}}" description="暂无数据" />
+                                <van-checkbox disabled='{{index==0}}' icon-size="14px" data-index="{{index}}" data-id="{{it.tenterprise_userid}}" catchtap="listClick" id="{{item.userList[0].tenterprise_userid}}" wx:for="{{item.userList}}" wx:for-item="it" custom-class='user-list-custom' checked-color='#4DC2D4' label-class="user-list-checkbox" wx:key="index" name="{{it.tenterprise_userid}}">
+                                    <view class="user-item u-line-1">
+                                        <image wx:if="{{it.attinfos[0].fobsurl}}" src="{{it.attinfos[0].fobsurl}}" mode="aspectFill" />
+                                        <image wx:else src="https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/userImg.png" mode="aspectFill" />{{it.fname}}
+                                    </view>
+                                </van-checkbox>
+                            </van-collapse-item>
+                        </van-checkbox-group>
+                    </van-collapse>
+                    <van-empty wx:if="{{buddyList.length==0}}" description="暂无数据" />
+                    <view style="height: 60rpx; width: 50rpx;"></view>
+                </block>
+                <!-- 成员列表 -->
+                <block wx:else>
+                    <view class="member-list">
+                        <van-checkbox-group value="{{ removeList }}" bind:change="removeListChange">
+                            <view class="member-item" wx:for="{{users}}">
+                                <van-checkbox disabled='{{index==0}}' wx:if="{{showRemove && index!=0}}" checked-color='#4DC2D4' icon-size='14' name="{{item.tenterprise_userid}}" />
+                                <image wx:if="{{item.headportraiturl}}" src="{{item.headportraiturl}}" mode="aspectFill"></image>
+                                <image wx:else src="https://bwj.obs.cn-east-2.myhuaweicloud.com/resources/WeChat/userCenter/userImg.png" mode="aspectFill"></image>
+                                <text class="u-line-1">{{item.fname!=''?item.fname:'匿名用户'}}{{item.fbrand!=''?'-'+item.fbrand:''}}</text>
+                            </view>
+                        </van-checkbox-group>
+                    </view>
+                </block>
             </scroll-view>
-            <view class="all">
+            <view class="all" wx:if="{{pageType==0}}">
                 <van-checkbox value="{{ checkAll }}" icon-size="28rpx" checked-color='#4DC2D4' bind:change="allChange" custom-class='radio-group-class group-class' label-class='van-radio-class'>全选</van-checkbox>
             </view>
-            <view style="height: 60rpx; width: 50rpx;"></view>
         </view>
-        <van-button disabled='{{result.length==0}}' custom-class='vanBut' catchtap="createdGroup">立即创建</van-button>
+        <van-button disabled='{{result.length==0}}' wx:if="{{pageType==0}}" custom-class='vanBut' catchtap="createdGroup">立即创建</van-button>
+        <van-button disabled='{{removeList.length==0}}' wx:if="{{showRemove}}" custom-class='vanBut' catchtap="removeMember">删除成员</van-button>
     </view>
 </view>

+ 70 - 0
pages/chatRoom/create.wxss

@@ -70,6 +70,38 @@ page {
     width: 635rpx;
 }
 
+.search .users {
+    display: flex;
+    align-items: center;
+    width: 575rpx;
+    height: 100%;
+    margin-left: 32rpx;
+    overflow: hidden;
+}
+
+.search .userImg {
+    width: 70rpx;
+    height: 70rpx;
+    border-radius: 50%;
+    margin: 0;
+    margin-left: 12rpx;
+    margin-top: 8rpx;
+}
+
+.search .add-remove {
+    display: flex;
+    align-items: center;
+    justify-content: space-around;
+    flex: 1;
+    height: 100%;
+}
+
+.search .add-remove .add-remove-img {
+    width: 38rpx;
+    height: 38rpx;
+    margin: 0;
+}
+
 /* 折叠面板 */
 .choose {
     flex: 1;
@@ -83,6 +115,7 @@ page {
 }
 
 .choose .title {
+    position: relative;
     display: flex;
     align-items: center;
     width: 100vw;
@@ -183,4 +216,41 @@ page {
     left: 40rpx;
     width: 100%;
     background-color: #ffffff;
+}
+
+/* 成员列表 */
+.member-list {
+    width: 670rpx;
+    margin: 0 auto;
+}
+
+.member-item {
+    display: flex;
+    align-items: center;
+    width: 100%;
+    height: 130rpx;
+    padding-left: 20rpx;
+    box-sizing: border-box;
+    border-bottom: 2rpx solid #F6F7F8;
+    font-size: 32rpx;
+}
+
+.member-item image {
+    width: 70rpx;
+    height: 70rpx;
+    border-radius: 50%;
+    margin-right: 20rpx;
+}
+
+.member-item text {
+    width: 500rpx;
+}
+
+.go-back {
+    position: absolute;
+    color: #4DC2D4;
+    font-size: 24rpx;
+    top: 50%;
+    right: 0;
+    transform: translate(-30rpx,-50%);
 }

+ 83 - 75
pages/chatRoom/dialogbox.js

@@ -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}` */
-        }
+        };
     },
 
     /**

+ 2 - 2
pages/chatRoom/dialogbox.wxml

@@ -6,7 +6,7 @@
         <van-button custom-class='head-bot-class head-bot-r' catchtap="confirmTheCooperation">确认合作</van-button>
     </view>
     <view class="header_botton" wx:if="{{fimdialogtype=='话题'&&fimuserid==userid}}">
-        <van-button custom-class='compile' catchtap="a54564">
+        <van-button custom-class='compile' catchtap="toCreate">
             <image src="/static/icon-19.png" style="width: 16rpx;height: 20rpx;"></image>
             编辑
         </van-button>
@@ -26,7 +26,7 @@
 <view class="input-box" style="bottom:{{keyboardHeight}}px;" wx:if="{{fimuserid==userid||fimdialogtype!='话题'}}">
     <!-- 普通输入框 -->
     <!-- bindblur="sendMsg" -->
-    <textarea class="input-text" bindfocus="textareaFocus" adjust-position='{{false}}' bindconfirm='sendMsg' show-confirm-bar='{{false}}' confirm-type='send' confirm-hold='true' cursor-spacing='45' bindinput='sendInput' value='{{sendText}}' maxlength='-1' fixed='true' type="text" bindlinechange='linechange' bindkeyboardheightchange='keyboardheightchange'>
+    <textarea class="input-text" bindfocus="textareaFocus" style="padding-right: {{timsubjectid==0?'25rpx':'150rpx'}};" adjust-position='{{false}}' bindconfirm='sendMsg' show-confirm-bar='{{false}}' confirm-type='send' confirm-hold='true' cursor-spacing='45' bindinput='sendInput' value='{{sendText}}' maxlength='-1' fixed='true' type="text" bindlinechange='linechange' bindkeyboardheightchange='keyboardheightchange'>
     <!-- 话题 -->
     <block wx:if="{{fimdialogtype=='话题'}}">
         <view class="gambit" wx:if="{{timsubjectid==0}}" catchtap="createGambit">

+ 1 - 1
pages/chatRoom/index.js

@@ -95,7 +95,7 @@ Page({
                 icon: "none"
             });
             for (let i = 0; i < res.data.length; i++) {
-                let time = res.data[i].fjoindate.split(" "),
+                let time = (res.data[i].latestnews.length == 0) ? res.data[i].fjoindate.split(" ") : res.data[i].latestnews[0].message.fdatetime.split(" "),
                     date = new Date(),
                     getMonth = (date.getMonth() + 1),
                     Month = (getMonth < 10) ? '0' + getMonth : getMonth,

二進制
static/icon-21.png


二進制
static/icon-22.png