智慧保安互联网APP
zengh
2021-08-13 3298665410b5d275ec3b90edb7f387f46d86b9ae
初版集成
2 files modified
172 ■■■■ changed files
components/contacts/contacts.vue 24 ●●●● patch | view | raw | blame | history
pages/groupChat/groupChat.vue 148 ●●●● patch | view | raw | blame | history
components/contacts/contacts.vue
@@ -13,18 +13,6 @@
            </view>
        </view>
        <view class="inPColumn" v-if="fromW == 1">
            <view class="left" @click="QZchating">
                <view class="top">
                    <view class="userImg">
                        <img class="img" :src=Pdata.avatar>
                    </view>
                    <view class="t-type">{{Pdata.GroupName}}</view>
                    <!-- <view class="t-id">{{Pdata.postTime}}</view> -->
                </view>
                <view class="bottom">{{Pdata.GroupContent}}</view>
            </view>
        </view>
        <view class="inPColumn" v-if="fromW == 2">
            <view class="left" @click="TXLchating">
                <view class="top">
                    <view class="userImg">
@@ -36,6 +24,18 @@
                <view class="bottom">电话:{{Pdata.phone}}</view>
            </view>
        </view>
        <view class="inPColumn" v-if="fromW == 2">
            <view class="left" @click="QZchating">
                <view class="top">
                    <view class="userImg">
                        <img class="img" :src=Pdata.avatar>
                    </view>
                    <view class="t-type">{{Pdata.GroupName}}</view>
                    <!-- <view class="t-id">{{Pdata.postTime}}</view> -->
                </view>
                <view class="bottom">{{Pdata.GroupContent}}</view>
            </view>
        </view>
    </view>
</template>
pages/groupChat/groupChat.vue
@@ -3,11 +3,11 @@
    <view class="work">
        <!-- 自定义顶部导航栏 -->
        <!-- <navBarTop :title="'聊天室'"></navBarTop> -->
        <view style="height:205rpx;"></view>
        <view class="tab" style="position: fixed;top: 0;width: 100%;height: 205rpx;z-index: 100;">
            <u-navbar style="position: relative;left: -20rpx;" :is-fixed="false" :border-bottom="false" :is-back="false" title="好友"
                :background="{ background: '#0BB9C8' }" title-color="#fff">
            <u-navbar style="position: relative;left: -20rpx;" :is-fixed="false" :border-bottom="false" :is-back="false"
                title="好友" :background="{ background: '#0BB9C8' }" title-color="#fff">
                <image slot="right" src="/static/images/home/message.png" class="message-icon" mode="widthFix"></image>
            </u-navbar>
            <u-tabs :list="list" :is-scroll="false" :current="current" active-color="#14B9C8" inactive-color="#595959"
@@ -31,7 +31,7 @@
                        <div class="m-main">
                            <!-- <view class="inTitle">{{Task}}</view> -->
                            <view class="inTmain">
                                <contacts v-for="(item,index) in dataListQZ" :key="index" :Pdata="item" :fromW="indexs"
                                <contacts v-for="(item,index) in dataListTXL" :key="index" :Pdata="item" :fromW="indexs"
                                    @refreshTask="refreshTask"></contacts>
                            </view>
                        </div>
@@ -42,7 +42,7 @@
                        <div class="m-main">
                            <!-- <view class="inTitle">{{Task}}</view> -->
                            <view class="inTmain">
                                <contacts v-for="(item,index) in dataListTXL" :key="index" :Pdata="item" :fromW="indexs"
                                <contacts v-for="(item,index) in dataListQZ" :key="index" :Pdata="item" :fromW="indexs"
                                    @refreshTask="refreshTask"></contacts>
                            </view>
                        </div>
@@ -50,7 +50,7 @@
                </view>
            </swiper-item>
        </swiper>
    </view>
</template>
@@ -59,9 +59,10 @@
    import axios from '../../static/lib/axios.js'
    import contacts from '../../components/contacts/contacts.vue'
    import navBarTop from '../../components/nav-bar-top/nav-bar-top.vue';
    export default{
    export default {
        components: {
            navBarTop,contacts
            navBarTop,
            contacts
        },
        data() {
            return {
@@ -69,10 +70,10 @@
                        name: '正在聊天'
                    },
                    {
                        name: '群组'
                        name: '好友'
                    },
                    {
                        name: '好友'
                        name: '群组'
                    }
                ],
                swiperHeight: 0,
@@ -81,7 +82,7 @@
                show: true,
                dataListP: [],
                dataListQZ: [],
                dataListTXL:[],
                dataListTXL: [],
                fromW: '',
                onTop: false, //是否吸顶
                rect: '', //页面滚动距离
@@ -91,30 +92,30 @@
                userName: '',
            }
        },
        activated(){
              this.beginObj();
              this.getdataList(0);
            },
            onReady() {
                let that = this;
                uni.getSystemInfo({
                    success(e) {
                        console.log(e);
                        let {
                            windowWidth,
                            windowHeight,
                            safeArea
                        } = e;
                        const query = uni.createSelectorQuery().in(that);
                        query
                            .select('#swiperBox')
                            .boundingClientRect(data => {
                                that.swiperHeight = safeArea.bottom - data.top;
                            })
                            .exec();
                    }
                });
            },
        activated() {
            this.beginObj();
            this.getdataList(0);
        },
        onReady() {
            let that = this;
            uni.getSystemInfo({
                success(e) {
                    console.log(e);
                    let {
                        windowWidth,
                        windowHeight,
                        safeArea
                    } = e;
                    const query = uni.createSelectorQuery().in(that);
                    query
                        .select('#swiperBox')
                        .boundingClientRect(data => {
                            that.swiperHeight = safeArea.bottom - data.top;
                        })
                        .exec();
                }
            });
        },
        methods: {
            change(index) {
                this.current = index;
@@ -137,17 +138,17 @@
            },
            getdataList() {
                var that = this;
                if(this.current == 0){
                if (this.current == 0) {
                    uni.request({
                        url:"http://223.82.109.183:2080/api/chat-records/getChatListPage",
                        method:"get",
                        data:{
                        url: "http://223.82.109.183:2080/api/chat-records/getChatListPage",
                        method: "get",
                        data: {
                            senderId: WxStorage.get("ids")
                        },
                        success:(res)=> {
                        success: (res) => {
                            var resdata = res.data.data;
                            for (var i = 0; i < resdata.length; i++) {
                                if(resdata[i].avatar == null || resdata[i].avatar == ""){
                                if (resdata[i].avatar == null || resdata[i].avatar == "") {
                                    resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/img-logo.png";
                                }
                            }
@@ -155,40 +156,41 @@
                            that.swiperHeight = resdata.length * 85;
                        }
                    });
                }else if(this.current == 1){
                } else if (this.current == 1) {
                    uni.request({
                        url:"http://223.82.109.183:2080/api/chatgroup/selectList",
                        method:"POST",
                        data:{
                        url: "http://223.82.109.183:2080/api/blade-user/page?current=1&size=9999",
                        method: "get",
                        data: {
                            senderId: WxStorage.get("ids")
                        },
                        success:(res)=> {
                            var resdata = res.data.data;
                            for (var i = 0; i < resdata.length; i++) {
                                if(resdata[i].avatar == null || resdata[i].avatar == ""){
                                    resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/qunz.png";
                                }
                            }
                            that.dataListQZ = resdata;
                            that.swiperHeight = resdata.length * 85;
                        }
                    })
                }else if(this.current == 2){
                    uni.request({
                        url:"http://223.82.109.183:2080/api/blade-user/page?current=1&size=9999",
                        method:"get",
                        data:{
                            senderId: WxStorage.get("ids")
                        },
                        success:(res)=> {
                        success: (res) => {
                            var resdata = res.data.data.records;
                            for (var i = 0; i < resdata.length; i++) {
                                if(resdata[i].avatar == null || resdata[i].avatar == ""){
                                if (resdata[i].avatar == null || resdata[i].avatar == "") {
                                    resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/img-logo.png";
                                }
                            }
                            that.dataListTXL = resdata;
                            that.swiperHeight = resdata.length * 85;
                        }
                    })
                } else if (this.current == 2) {
                    uni.request({
                        url: "http://223.82.109.183:2080/api/chatgroup/selectList",
                        method: "POST",
                        data: {
                            senderId: WxStorage.get("ids")
                        },
                        success: (res) => {
                            var resdata = res.data.data;
                            for (var i = 0; i < resdata.length; i++) {
                                if (resdata[i].avatar == null || resdata[i].avatar == "") {
                                    resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/qunz.png";
                                }
                            }
                            that.dataListQZ = resdata;
                            that.swiperHeight = resdata.length * 85;
                        }
                    })
@@ -197,12 +199,12 @@
            refreshTask() {
                this.getdataList(1);
            },
        },
        mounted() {
            this.beginObj();
            this.getdataList(0);
        },
        onPageScroll(e) {
            // console.log(e.scrollTop, 'pingmu')
@@ -220,9 +222,9 @@
        onLoad: function(options) {
            this.userName = options.login;
            // if(options.txlType == 2){
                this.current = 2;
            this.current = 2;
            // }
        }
    }
</script>
@@ -270,7 +272,7 @@
        .main {
            margin-top: 0.625rem;
            .m-title {
                width: 100%;
                height: 2rem;
@@ -307,7 +309,7 @@
                    padding-bottom: 0.5rem;
                    box-sizing: border-box;
                }
            }
            .m-main {
@@ -315,10 +317,10 @@
            }
        }
    }
    .message-icon {
        width: 32rpx;
        height: auto;
        margin-right: 27rpx;
    }
</style>