From 12fcb594b1a6c4c136acb3fa5c844428c5c50631 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 19 Aug 2021 15:06:56 +0800
Subject: [PATCH] 好友功能完善
---
pages/registerUser/registerUser.vue | 6
pages/groupChat/chatingQZ.vue | 6
pages/groupChat/newGroup/newGroup.vue | 200 ++++++++++++++++++++++++++++++++++++++++
components/contacts/contacts.vue | 5
pages.json | 12 ++
static/qunzhu.png | 0
pages/groupChat/groupChat.vue | 56 ++++++++++
pages/groupChat/chatingcopy.vue | 2
store/index.js | 5
9 files changed, 276 insertions(+), 16 deletions(-)
diff --git a/components/contacts/contacts.vue b/components/contacts/contacts.vue
index da0cf91..8d8c7e2 100644
--- a/components/contacts/contacts.vue
+++ b/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() {
diff --git a/pages.json b/pages.json
index cae87cc..12dc4a3 100644
--- a/pages.json
+++ b/pages.json
@@ -391,7 +391,17 @@
// "enablePullDownRefresh": false
}
}
- ],
+ ,{
+ "path" : "pages/groupChat/newGroup/newGroup",
+ "style" :
+ {
+ "navigationBarTitleText": "新建群组",
+ "navigationBarBackgroundColor": "#0BB9C8",
+ "navigationBarTextStyle": "white"
+ }
+
+ }
+ ],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",
diff --git a/pages/groupChat/chatingQZ.vue b/pages/groupChat/chatingQZ.vue
index 0d47c8f..00d3742 100644
--- a/pages/groupChat/chatingQZ.vue
+++ b/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,
diff --git a/pages/groupChat/chatingcopy.vue b/pages/groupChat/chatingcopy.vue
index 43738c0..d948384 100644
--- a/pages/groupChat/chatingcopy.vue
+++ b/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"),
diff --git a/pages/groupChat/groupChat.vue b/pages/groupChat/groupChat.vue
index d658255..e9fed06 100644
--- a/pages/groupChat/groupChat.vue
+++ b/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;
diff --git a/pages/groupChat/newGroup/newGroup.vue b/pages/groupChat/newGroup/newGroup.vue
new file mode 100644
index 0000000..fbdc103
--- /dev/null
+++ b/pages/groupChat/newGroup/newGroup.vue
@@ -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>
diff --git a/pages/registerUser/registerUser.vue b/pages/registerUser/registerUser.vue
index cf8c65a..f49843d 100644
--- a/pages/registerUser/registerUser.vue
+++ b/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,
diff --git a/static/qunzhu.png b/static/qunzhu.png
new file mode 100644
index 0000000..5df7a63
--- /dev/null
+++ b/static/qunzhu.png
Binary files differ
diff --git a/store/index.js b/store/index.js
index 65af572..23e1888 100644
--- a/store/index.js
+++ b/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: '',
--
Gitblit v1.9.3