智慧保安互联网APP
zengh
2021-08-19 12fcb594b1a6c4c136acb3fa5c844428c5c50631
好友功能完善
7 files modified
2 files added
292 ■■■■■ changed files
components/contacts/contacts.vue 5 ●●●●● patch | view | raw | blame | history
pages.json 12 ●●●●● patch | view | raw | blame | history
pages/groupChat/chatingQZ.vue 6 ●●●●● patch | view | raw | blame | history
pages/groupChat/chatingcopy.vue 2 ●●● patch | view | raw | blame | history
pages/groupChat/groupChat.vue 56 ●●●●● patch | view | raw | blame | history
pages/groupChat/newGroup/newGroup.vue 200 ●●●●● patch | view | raw | blame | history
pages/registerUser/registerUser.vue 6 ●●●● patch | view | raw | blame | history
static/qunzhu.png patch | view | raw | blame | history
store/index.js 5 ●●●●● patch | view | raw | blame | history
components/contacts/contacts.vue
@@ -48,7 +48,7 @@
                    <text class="mess">{{Pdata.GroupContent}}</text>
                </view>
                <view class="data-wrap">
                    <!-- <text class="data">{{Pdata.postTime}}</text> -->
                    <!-- <text class="data">{{Pdata.time}}</text> -->
                </view>
            </view>
@@ -85,7 +85,8 @@
                var datas = this.Pdata;
                //alert(datas.name)
                uni.navigateTo({
                    url: '/pages/groupChat/chatingQZ?chatID=' + datas.id.toString()
                    url: '/pages/groupChat/chatingQZ?chatID=' + datas.id.toString()+ '&data=' + JSON.stringify(
                        datas)
                });
            },
            TXLchating() {
pages.json
@@ -391,7 +391,17 @@
                // "enablePullDownRefresh": false
            }
        }
    ],
        ,{
            "path" : "pages/groupChat/newGroup/newGroup",
            "style" :
            {
                "navigationBarTitleText": "新建群组",
                "navigationBarBackgroundColor": "#0BB9C8",
                "navigationBarTextStyle": "white"
            }
        }
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "",
pages/groupChat/chatingQZ.vue
@@ -169,6 +169,8 @@
        },
        onLoad(option) {
            this.recipientId = option.chatID;
            var data = JSON.parse(option.data)
            this.recName = data.GroupName;
            this._getMsg(this.nowpage)
            // this.nextPage()
        },
@@ -215,7 +217,7 @@
                var that = this;
                that.senId = WxStorage.get("ids");
                uni.request({
                    url:"http://s16s652780.51mypc.cn/api/chatgroupc/selectList",
                    url:this.$store.state.piAPI + "/chatgroupc/selectList",
                    method:"post",
                    header: {
                        'content-type': 'application/x-www-form-urlencoded', 
@@ -336,7 +338,7 @@
                }
                
                uni.request({
                    url:"http://s16s652780.51mypc.cn/api/chatgroupc/submit",
                    url:this.$store.state.piAPI + "/chatgroupc/submit",
                    method:"post",
                    data:{
                        senderId: that.senId,
pages/groupChat/chatingcopy.vue
@@ -206,7 +206,7 @@
                
                var that = this;
                uni.request({
                    url:"http://s16s652780.51mypc.cn/api/chat-records/getSingleMessagePage",
                    url:this.$store.state.piAPI + "/chat-records/getSingleMessagePage",
                    method:"get",
                    data:{
                        senderId: WxStorage.get("ids"),
pages/groupChat/groupChat.vue
@@ -13,7 +13,7 @@
            <u-tabs :list="list" :is-scroll="false" :current="current" active-color="#14B9C8" inactive-color="#595959"
                height="100" @change="change" style="background-color:rgba(255,255,255,0.8)"></u-tabs>
        </view>
        <swiper id="swiperBox" :style="{ height: swiperHeight + 'px' }" :current="current" @change="tabsChange">
        <swiper id="swiperBox" style="height: 100%;" :current="current" @change="tabsChange">
            <swiper-item class="swiper-item" v-for="(item, indexs) in list" :key="indexs">
                <view v-if="indexs == 0" class="main">
                    <div>
@@ -53,6 +53,21 @@
                <view v-if="indexs == 2" class="main">
                    <div>
                        <div class="m-main">
                            <view class="applys" @click="newGroup">
                                <view class="head-wraps">
                                    <image src="../../static/qunzhu.png" class="head" />
                                    <view v-if=false class="tip">233</view>
                                </view>
                                <view class="content-wrap">
                                    <text class="name">群组创建</text>
                                    <text class="mess">何事秋风悲画扇</text>
                                </view>
                                <view class="data-wrap">
                                    <text class="data"></text>
                                </view>
                            </view>
                            <!-- <view class="inTitle">{{Task}}</view> -->
                            <view class="inTmain">
                                <contacts v-for="(item,index) in dataListQZ" :key="index" :Pdata="item" :fromW="indexs"
@@ -192,10 +207,11 @@
                    uni.request({
                        url: this.$store.state.piAPI + "/chatgroup/selectList",
                        method: "POST",
                        method: "GET",
                        data: {
                            senderId: WxStorage.get("ids")
                            id: WxStorage.get("ids")
                        },
                        contentType:"application/x-www-form-urlencoded",
                        success: (res) => {
                            var resdata = res.data.data;
                            for (var i = 0; i < resdata.length; i++) {
@@ -204,7 +220,6 @@
                                }
                            }
                            that.dataListQZ = resdata;
                            that.swiperHeight = resdata.length * 85;
                        }
                    });
                }
@@ -220,6 +235,11 @@
            addFriend(){
                uni.navigateTo({
                    url: '/pages/groupChat/addFriend?'
                });
            },
            newGroup(){
                uni.navigateTo({
                    url: '/pages/groupChat/newGroup/newGroup?'
                });
            }
        },
@@ -393,6 +413,34 @@
                text-align: center;
            }
        }
        .head-wraps {
            position: relative;
            image {
                width: 96rpx;
                height: 96rpx;
                border-radius: 20upx;
                background-color: rgba(85, 170, 255, 1.0);
            }
            .tip {
                position: absolute;
                top: -6rpx;
                left: 68rpx;
                height: 36rpx;
                min-width: 20rpx;
                min-height: 20rpx;
                background-color: rgba(255, 93, 91, 1);
                border-radius: 18rpx;
                padding: 0 6rpx;
                font-size: 24upx;
                color: rgba(255, 228, 49, 1);
                line-height: 36rpx;
                text-align: center;
            }
        }
        .content-wrap {
            margin-left: 32rpx;
pages/groupChat/newGroup/newGroup.vue
New file
@@ -0,0 +1,200 @@
<template>
    <view class="registerUser">
        <u-form :model="form" ref="uForm">
            <u-form-item :label="item.title" :prop="item.froms" label-width="200" :left-icon="item.img"
                :required="item.requireds" v-for="(item, index) in list" :key="index">
                <u-input v-model="form[item.froms]" :placeholder="item.placeholder" />
            </u-form-item>
            <u-form-item label="群成员" prop="role" left-icon="man-add" label-width="200" :required="true">
                <u-checkbox-group @change="checkboxGroupChange">
                    <u-checkbox v-model="item.checked" v-for="(item, index) in friend" :key="index"
                        :name="item.friendid">
                        {{item.realName}}
                    </u-checkbox>
                </u-checkbox-group>
            </u-form-item>
        </u-form>
        <u-button class="submit" @click="submit">
            创建</u-button>
    </view>
</template>
<script>
    import WxStorage from "../../../static/lib/wxStorage.js"
    export default {
        data() {
            return {
                friend: [],
                list: [{
                        title: '群名称',
                        img: 'chat',
                        froms: 'groupname',
                        requireds: true,
                        placeholder: '请输入群名称'
                    },
                    {
                        title: '群介绍',
                        img: 'order',
                        froms: 'groupcontent',
                        requireds: true,
                        placeholder: '请输入群介绍'
                    },
                    {
                        title: '群公告',
                        img: 'bell',
                        froms: 'groupnotice',
                        requireds: true,
                        placeholder: '请输入群公告'
                    },
                ],
                form: {
                    groupname: '',
                    groupcontent: '',
                    groupnotice: '',
                    groupmember: '',
                },
                rules: {
                    groupname: [{
                        required: true,
                        message: '请输入群名称',
                        // 可以单个或者同时写两个触发验证方式
                        trigger: ['change', 'blur'],
                    }],
                    groupcontent: [{
                        required: true,
                        message: '请输入群介绍',
                        // 可以单个或者同时写两个触发验证方式
                        trigger: ['change', 'blur'],
                    }],
                    groupnotice: [{
                        required: true,
                        message: '请输入群公告',
                        // 可以单个或者同时写两个触发验证方式
                        trigger: ['change', 'blur'],
                    }]
                },
            }
        },
        onReady() {
            this.$refs.uForm.setRules(this.rules);
        },
        onLoad() {
            this.getFriend();
        },
        methods: {
            submit() {
                var that = this;
                this.$refs.uForm.validate(valid => {
                    if (valid) {
                        var d = that.form;
                        if (d.groupmember == "") {
                            uni.showToast({
                                title: '请至少选择一个群成员',
                                icon: "none",
                                duration: 1000
                            });
                            return;
                        }
                        d.time = that.currTime();
                        d.groupid = WxStorage.get("ids");
                        uni.request({
                            url: that.$store.state.piAPI + "/chatgroup/submit",
                            method: "POST",
                            data: d,
                            success: (res) => {
                                uni.showToast({
                                    title: '创建成功',
                                    icon: "none",
                                    duration: 1000
                                });
                                uni.switchTab({
                                    url: '/pages/groupChat/groupChat?'
                                });
                            }
                        });
                    }
                });
            },
            currTime() {
                var date = new Date();
                var Y = date.getFullYear() + '-';
                var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
                var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
                var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
                var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
                var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
                return Y + M + D + h + m + s;
            },
            checkboxGroupChange(e) {
                var arr = "";
                for (var i = 0; i < e.length; i++) {
                    arr += e[i] + ",";
                }
                var obj = arr.substr(0, arr.length - 1);
                this.form.groupmember = obj;
            },
            getFriend() {
                var that = this;
                uni.request({
                    url: this.$store.state.piAPI + "/friend/page?current=1&size=9999",
                    method: "get",
                    data: {
                        applicant: WxStorage.get("ids")
                    },
                    success: (res) => {
                        var resdata = res.data.data.records;
                        that.friend = resdata;
                    }
                })
            }
        }
    }
</script>
<style>
    .warp {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    .rect {
        text-align: center;
        width: 120px;
        height: 120px;
    }
    .submit {
        margin: 30rpx 50rpx 50rpx;
        border: none;
        width: 572rpx;
        height: 86rpx;
        line-height: 86rpx;
        box-sizing: border-box;
        border-radius: 15rpx;
        background-color: #14b9c8;
        color: #ffffff;
        &::after {
            content: none;
        }
        &::before {
            content: none;
        }
        &[disabled='true'] {
            background: #e4e4e4;
            font-size: 36rpx;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: #ffffff;
        }
    }
    .registerUser {
        padding: 0 1.2rem;
    }
</style>
pages/registerUser/registerUser.vue
@@ -204,7 +204,7 @@
                    if (valid) {
                console.log(this.form);
                var d = this.form;
                var url = 'http://s16s652780.51mypc.cn/api/zc/inster',
                var url = this.$store.state.piAPI + '/zc/inster',
                    data = {
                        // deptid: ,
                        password: d.pass,
@@ -239,7 +239,7 @@
            depl(){
                var that = this;
                uni.request({
                    url: "http://s16s652780.51mypc.cn/api/blade-system/dept/trees",
                    url: this.$store.state.piAPI + "/blade-system/dept/trees",
                    method: 'get',
                    success: (res) => {
                        var routerArr = res.data.data;
@@ -390,7 +390,7 @@
                        // console.log('验证通过');
                        console.log(this.form);
                        var d = this.form;
                        var url = 'http://s16s652780.51mypc.cn/api/zc/inster',
                        var url = this.$store.state.piAPI + '/zc/inster',
                            data = {
                                // deptid: ,
                                password: d.pass,
static/qunzhu.png
store/index.js
@@ -33,10 +33,9 @@
            useName: '过客 ',
        },
        logPath: '',
        // piAPI: 'http://223.82.109.183:2080/api',
        // piAPI: 'http://223.82.109.183:2080/api',
        piAPI: 'http://223.82.109.183:2080/api',
        api: 'http://223.82.109.183:2080/api',
        piAPI: 'http://localhost:81/',
        // piAPI: 'http://localhost:81/',
        // piAPI: 'http://192.168.0.108:81',
        puserName: '',
        puserID: '',