Selaa lähdekoodia

商家创建群聊

潘超林 1 päivä sitten
vanhempi
commit
6766199315

+ 27 - 2
TUIKit-Homemaking/components/TUIConversation/merChantSideIndex.vue

@@ -1,5 +1,5 @@
 <template>
-  <div >
+  <div>
     <div
       class="tui-conversation"
       @click="handleClickConv"
@@ -11,6 +11,7 @@
       v-if="isShowConversationHeader"
       ref="headerRef"
     /> -->
+      <div class="header" @click="createGroup">创建粉丝群</div>
       <ConversationNetwork />
       <ConversationList
         ref="conversationListDomRef"
@@ -23,7 +24,12 @@
   </div>
 </template>
 <script lang="ts" setup>
-import { TUIStore, StoreName } from "@tencentcloud/chat-uikit-engine";
+import * as MesApi from "../../../api/message";
+import {
+  TUIStore,
+  StoreName,
+  TUIConversationService,
+} from "@tencentcloud/chat-uikit-engine";
 import { TUIGlobal } from "@tencentcloud/universal-api";
 import { ref } from "../../adapter-vue";
 import TUISearch from "../TUISearch/index.vue";
@@ -82,6 +88,25 @@ const handleSwitchConversation = (conversationID: string) => {
 
   emits("handleSwitchConversation", conversationID);
 };
+const shopInfo = ref({});
+const createGroup = async () => {
+  const ownerAccount = uni.getStorageSync("id");
+  let res = await MesApi.default.getInfoByUserId();
+  if (res.code == 200) {
+    shopInfo.value = res.data;
+    let create = await MesApi.default.createGroup({
+      shopId: res.data.id,
+      ownerAccount: ownerAccount,
+      agentType: uni.getStorageSync("agentType"),
+    });
+    if (create.code == 200) {
+      TUIConversationService.switchConversation(`GROUP${create.data.groupId}`);
+      uni.$u.toast(create.msg);
+    } else {
+      uni.$u.toast(create.msg);
+    }
+  }
+};
 
 const closeChildren = () => {
   headerRef?.value?.closeChildren();

+ 1 - 3
TUIKit-House/components/TUIChat/message-list/index.vue

@@ -9,7 +9,7 @@
     >
       <!-- <JoinGroupCard /> -->
       <div class="tui-chat-main">
-        <div class="tui-chat-safe-tips">
+        <div class="tui-chat-safe-tips" v-if="!props.isGroup">
           <div class="qzy-space-between-center function-box">
             <!-- 用户端 -->
             <div @tap="sendMsgHandle('电话沟通')">
@@ -139,7 +139,6 @@
           >
             {{ TUITranslateService.t("TUIChat.查看更多") }}
           </p>
-          <!-- {{messageList}} -->
           <li
             v-for="(item, index) in messageList"
             :id="`tui-${item.ID}`"
@@ -371,7 +370,6 @@ const props = defineProps({
 });
 const mapAddress = ref();
 watch(props, (nweProps) => {
-  console.log("ccc", nweProps);
   mapAddress.value = nweProps.address;
 });
 

+ 8 - 4
TUIKit-House/components/TUIConversation/conversation-list/index.vue

@@ -35,10 +35,14 @@
         <aside class="left">
           <Avatar
             useSkeletonAnimation
-            :url="conversation.userProfile.avatar"
+            :url="
+              conversation.userProfile
+                ? conversation.userProfile.avatar
+                : 'https://oss.qianzhi-y.com/h5/images/static/mrtx.png'
+            "
             size="60px"
           />
-          <!-- <div
+          <div
             v-if="userOnlineStatusMap && isShowUserOnlineStatus(conversation)"
             :class="[
               'online-status',
@@ -51,7 +55,7 @@
                 ? 'online-status-online'
                 : 'online-status-offline',
             ]"
-          /> -->
+          />
           <span
             v-if="conversation.unreadCount > 0 && !conversation.isMuted"
             class="num"
@@ -135,7 +139,7 @@ const currentConversationDomRect = ref<DOMRect>();
 const isShowOverlay = ref<boolean>(false);
 const conversationList = ref<IConversationModel[]>([]);
 setTimeout(() => {
-  console.log("会话列表数据")
+  console.log("会话列表数据");
   console.log(conversationList);
 }, 2000);
 const conversationListDomRef = ref<HTMLElement | undefined>();

+ 51 - 1
TUIKit-House/components/TUIConversation/merChantSideIndex.vue

@@ -7,6 +7,9 @@
       @touchend="handleTouchEnd"
     >
       <TUISearch searchType="global" />
+      <!-- <div class="header" @click="myGourp">我的群聊</div> -->
+      <div class="header" @click="createGroup">创建粉丝群</div>
+
       <!-- <ConversationHeader
       v-if="isShowConversationHeader"
       ref="headerRef"
@@ -24,7 +27,12 @@
   </div>
 </template>
 <script lang="ts" setup>
-import { TUIStore, StoreName } from "@tencentcloud/chat-uikit-engine";
+import * as MesApi from "../../../api/message";
+import {
+  TUIStore,
+  StoreName,
+  TUIConversationService,
+} from "@tencentcloud/chat-uikit-engine";
 import { TUIGlobal } from "@tencentcloud/universal-api";
 import { ref } from "../../adapter-vue";
 import TUISearch from "../TUISearch/index.vue";
@@ -77,6 +85,37 @@ const closeChildren = () => {
   headerRef?.value?.closeChildren();
   conversationListDomRef?.value?.closeChildren();
 };
+const shopInfo = ref({});
+const myGourp = () => {
+  TUIGlobal?.navigateTo({
+    url: "/TUIKit-House/components/TUIContact/index",
+  });
+};
+const createGroup = async () => {
+  const ownerAccount = uni.getStorageSync('id');
+  // TUIConversationService.switchConversation(
+  //   "GROUP17527216214421942041809035223041"
+  // );
+  let res = await MesApi.default.getInfoByUserId();
+  if (res.code == 200) {
+    shopInfo.value = res.data;
+    let create = await MesApi.default.createGroup({
+       shopId: res.data.id ,
+       ownerAccount:ownerAccount,
+       agentType:uni.getStorageSync('agentType')
+
+    });
+    console.log(create);
+    if (create.code == 200) {
+      TUIConversationService.switchConversation(
+        `GROUP${create.data.groupId}`
+      );
+      uni.$u.toast(create.msg);
+    } else {
+      uni.$u.toast(create.msg);
+    }
+  }
+};
 
 const handleClickConv = () => {
   closeChildren();
@@ -118,4 +157,15 @@ const getPassingRef = (ref) => {
 };
 </script>
 
+<style lang="scss" scoped>
+.header {
+  height: 25px;
+  background: white;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: flex-end;
+  padding: 0px 10px 10px 10px;
+}
+</style>
 <style lang="scss" scoped src="./style/index.scss"></style>

+ 2 - 2
TUIKit/components/TUIGroup/manage-group/index.vue

@@ -74,12 +74,12 @@
           <label class="label">{{ TUITranslateService.t(`TUIGroup.群管理`) }}</label>
           <Icon :file="rightIcon" />
         </li>
-        <li class="list-item">
+        <!-- <li class="list-item">
           <label class="label">{{ TUITranslateService.t(`TUIGroup.群ID`) }}</label>
           <div class="groupID">
             <span class="span">{{ currentGroupID }}</span>
           </div>
-        </li>
+        </li> -->
         <li class="list-item">
           <label class="label">{{ TUITranslateService.t(`TUIGroup.群头像`) }}</label>
           <img

+ 28 - 0
api/message.js

@@ -0,0 +1,28 @@
+import Request from '@/request/request.js';
+let request = Request.http;
+
+export default {
+    /**
+     * 家政服务产品-列表
+     * @param {*} data 
+     * @returns 
+     */
+    createGroup(data) {
+        return request({
+            url: '/user/group/createGroup',
+            method: 'post',
+            data: data,
+            header: {
+                'Content-Type': 'application/json'
+            }
+        })
+    },
+    getInfoByUserId(data) {
+        return request({
+            url: '/user/shop/getInfoByUserId',
+            method: 'get',
+            params: data,
+        })
+    },
+    
+}

+ 2 - 1
pages/views/login.vue

@@ -25,7 +25,8 @@ onLoad(() => {
     "refId",
     "demandId",
     "userLoginType",
-    "userType"
+    "userType",
+    "agentType",
   ];
   // 批量获取参数并存储到storage
   const params: any = {};

+ 1 - 1
request/request.js

@@ -43,7 +43,7 @@ class Request {
 							webUni.webView.reLaunch({
 								url: "/pages/index/login/login",
 							});
-						} else if (res.data.code == 400 && res.data.msg == '登录凭证不为空') {
+						} else if (res.data.code == 400 || res.data.code == 501) {
 							uni.$u.toast('请登录小程序~');
 							setTimeout(() => {
 								webUni.webView.reLaunch({