优化
This commit is contained in:
20
unpackage/dist/dev/mp-weixin/components/ChatId.js
vendored
Normal file
20
unpackage/dist/dev/mp-weixin/components/ChatId.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
function generateId() {
|
||||
const isUpperCase = Math.random() >= 0.5;
|
||||
const randomLetter = String.fromCharCode(
|
||||
Math.floor(Math.random() * 26) + (isUpperCase ? 65 : 97)
|
||||
);
|
||||
const randomPart = Array.from({ length: 5 }, () => {
|
||||
const type = Math.random();
|
||||
if (type < 0.3)
|
||||
return String.fromCharCode(Math.floor(Math.random() * 26) + 97);
|
||||
else if (type < 0.6)
|
||||
return String.fromCharCode(Math.floor(Math.random() * 26) + 65);
|
||||
else
|
||||
return Math.floor(Math.random() * 10);
|
||||
}).join("");
|
||||
const timestamp = Date.now().toString(16).slice(-4);
|
||||
return `${randomLetter}${randomPart}${timestamp}`;
|
||||
}
|
||||
exports.generateId = generateId;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/ChatId.js.map
|
||||
@@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
function TUIlogin(chatInfo, info, userSig) {
|
||||
common_vendor.index.$SDKAppID = chatInfo;
|
||||
common_vendor.index.$userID = String(info);
|
||||
common_vendor.index.$userSig = userSig;
|
||||
common_vendor.A.login({
|
||||
SDKAppID: common_vendor.index.$SDKAppID,
|
||||
userID: common_vendor.index.$userID,
|
||||
userSig: common_vendor.index.$userSig,
|
||||
useUploadPlugin: true,
|
||||
// If you need to send rich media messages, please set to true.
|
||||
framework: `vue3`
|
||||
// framework used vue2 / vue3
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
exports.TUIlogin = TUIlogin;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/TUILogin.js.map
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
function TimeFormatting(timestamp) {
|
||||
const date = new Date(timestamp * 1e3);
|
||||
const date = new Date(timestamp);
|
||||
date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
const components_debug_libGenerateTestUsersigEs_min = require("./lib-generate-test-usersig-es.min.js");
|
||||
function genTestUserSig(config) {
|
||||
const { SDKAPPID, SECRETKEY, userID } = config;
|
||||
const EXPIRETIME = 604800;
|
||||
const generator = new components_debug_libGenerateTestUsersigEs_min.LibGenerateTestUserSig(SDKAPPID, SECRETKEY, EXPIRETIME);
|
||||
const userSig = generator.genTestUserSig(userID);
|
||||
return {
|
||||
sdkAppID: SDKAPPID,
|
||||
userSig
|
||||
};
|
||||
}
|
||||
exports.genTestUserSig = genTestUserSig;
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/debug/GenerateTestUserSig.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
function generateRandomString(length = 6) {
|
||||
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
let result = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function generateMsgId() {
|
||||
const randomPart = generateRandomString();
|
||||
const timestamp = Date.now();
|
||||
return `${randomPart}${timestamp}`;
|
||||
}
|
||||
exports.generateMsgId = generateMsgId;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/generateMsgId.js.map
|
||||
118
unpackage/dist/dev/mp-weixin/components/goEasyTool/tool.js
vendored
Normal file
118
unpackage/dist/dev/mp-weixin/components/goEasyTool/tool.js
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
function goEasylogin(goeasy, id, avatar, nickname) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:5", "`````````````````goEasylogin`````````````````", id, avatar, nickname);
|
||||
goeasy.connect({
|
||||
id,
|
||||
//im必填,最大长度60字符
|
||||
data: { "avatar": avatar, "nickname": nickname },
|
||||
//必须是一个对象,im必填,最大长度300字符,显示在会话列表中
|
||||
onSuccess: function() {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:10", "IM连接成功");
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:13", "IM连接失败, code:" + error.code + ",error:" + error.content);
|
||||
},
|
||||
onProgress: function(attempts) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:16", "IM连接或自动重连中", attempts);
|
||||
}
|
||||
});
|
||||
}
|
||||
function goEasylogout(goeasy) {
|
||||
goeasy.disconnect({
|
||||
onSuccess: function() {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:25", "IM断开成功");
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:28", "IM断开失败, code:" + error.code + ",error:" + error.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getConversationList(goeasy) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
im.latestConversations({
|
||||
onSuccess: function(result) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:39", "获取会话列表成功", result);
|
||||
resolve(result.content);
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:43", "获取会话列表失败, code:" + error.code + " content:" + error.content);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function getConversationMessages(goeasy, userid, imestamp) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
im.history({
|
||||
id: userid,
|
||||
//用户id或者群id
|
||||
type: common_vendor.jo.IM_SCENE.PRIVATE,
|
||||
//群聊:GoEasy.IM_SCENE.GROUP, 客服:GoEasy.IM_SCENE.CS,
|
||||
lastTimestamp: imestamp,
|
||||
//上次查询结果里最后一条消息的时间戳,首次查询传入null即可
|
||||
limit: 30,
|
||||
//可选项,返回的消息条数,默认为10条,最多30条
|
||||
onSuccess: function(result) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:59", "获取消息列表成功", result);
|
||||
resolve(result.content);
|
||||
},
|
||||
//查询成功
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:63", "获取消息列表失败, code:" + error.code + " content:" + error.content);
|
||||
}
|
||||
//查询失败
|
||||
});
|
||||
});
|
||||
}
|
||||
function sendMessage(goeasy, userid, message, avatar, nickname) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
let textMessage = im.createTextMessage({
|
||||
text: message,
|
||||
//消息内容
|
||||
to: {
|
||||
type: common_vendor.jo.IM_SCENE.PRIVATE,
|
||||
//私聊还是群聊,群聊为GoEasy.IM_SCENE.GROUP
|
||||
id: userid,
|
||||
//接收方用户id
|
||||
data: { "avatar": avatar, "nickname": nickname }
|
||||
//接收方用户扩展数据, 任意格式的字符串或者对象,用于更新会话列表conversation.data
|
||||
}
|
||||
});
|
||||
im.sendMessage({
|
||||
message: textMessage,
|
||||
onSuccess: function() {
|
||||
resolve(textMessage);
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:90", "发送消息失败,code:" + error.code + " ,error " + error.content);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function messageRead(goeasy, userid) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var im = goeasy.im;
|
||||
im.markMessageAsRead({
|
||||
id: userid,
|
||||
type: common_vendor.jo.IM_SCENE.PRIVATE,
|
||||
//群聊:GoEasy.IM_SCENE.GROUP, 客服消息:GoEasy.IM_SCENE.CS,
|
||||
onSuccess: function() {
|
||||
resolve();
|
||||
},
|
||||
onFailed: function(error) {
|
||||
common_vendor.index.__f__("log", "at components/goEasyTool/tool.js:109", "标记私聊已读失败", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.getConversationList = getConversationList;
|
||||
exports.getConversationMessages = getConversationMessages;
|
||||
exports.goEasylogin = goEasylogin;
|
||||
exports.goEasylogout = goEasylogout;
|
||||
exports.messageRead = messageRead;
|
||||
exports.sendMessage = sendMessage;
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/goEasyTool/tool.js.map
|
||||
@@ -3,7 +3,7 @@ const common_vendor = require("../common/vendor.js");
|
||||
const components_addPrefixToHeaderIcon = require("./addPrefixToHeaderIcon.js");
|
||||
function request(urldata) {
|
||||
const { url, data, method, header, userInfo } = urldata;
|
||||
const baseUrl = "https://pk.zhukeping.com/" + url;
|
||||
const baseUrl = "http://120.26.251.180:8086/" + url;
|
||||
if (userInfo) {
|
||||
return new Promise((resolve, reject) => {
|
||||
common_vendor.index.getStorage({
|
||||
@@ -17,6 +17,7 @@ function request(urldata) {
|
||||
method,
|
||||
header,
|
||||
success: function(res2) {
|
||||
common_vendor.index.__f__("log", "at components/request.js:21", "请求成功", res2);
|
||||
resolve(components_addPrefixToHeaderIcon.addPrefixToHeaderIcon(res2.data));
|
||||
},
|
||||
fail: function(res2) {
|
||||
@@ -47,6 +48,7 @@ function request(urldata) {
|
||||
method,
|
||||
header,
|
||||
success: function(res) {
|
||||
common_vendor.index.__f__("log", "at components/request.js:52", "请求成功", res);
|
||||
resolve(components_addPrefixToHeaderIcon.addPrefixToHeaderIcon(res.data));
|
||||
},
|
||||
fail: function(res) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_VerifyLogin = require("../VerifyLogin.js");
|
||||
const components_goEasyTool_tool = require("../goEasyTool/tool.js");
|
||||
if (!Math) {
|
||||
NewAddedPk();
|
||||
}
|
||||
@@ -9,45 +10,18 @@ const _sfc_main = {
|
||||
__name: "tabBar",
|
||||
props: {
|
||||
tabIndex: Number
|
||||
//当前tab索引
|
||||
},
|
||||
emits: ["publishSucces"],
|
||||
setup(__props, { emit: __emit }) {
|
||||
require.async("../../TUIKit/components/TUIConversation/entry.js");
|
||||
setup(__props) {
|
||||
const instance = common_vendor.getCurrentInstance();
|
||||
const $goeasy = instance.appContext.config.globalProperties.$goeasy;
|
||||
const Unread = common_vendor.ref(0);
|
||||
var im = $goeasy.im;
|
||||
function onConversationsUpdated(conversations) {
|
||||
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:47", "监听会话列表", conversations);
|
||||
Unread.value = conversations.unreadTotal;
|
||||
}
|
||||
let showMiddleButton = common_vendor.ref(false);
|
||||
const conversationList = common_vendor.ref([]);
|
||||
let Unread = common_vendor.ref(0);
|
||||
common_vendor.onMounted(() => {
|
||||
common_vendor.Jt.watch(common_vendor.o.CONV, {
|
||||
conversationList: onConversationListUpdated
|
||||
});
|
||||
});
|
||||
common_vendor.onUnmounted(() => {
|
||||
common_vendor.Jt.unwatch(common_vendor.o.CONV, {
|
||||
conversationList: onConversationListUpdated
|
||||
});
|
||||
});
|
||||
function onConversationListUpdated(list) {
|
||||
conversationList.value = list;
|
||||
Unread.value = calculateUnreadCount(list);
|
||||
}
|
||||
const emit = __emit;
|
||||
function publishSuccesss() {
|
||||
emit("publishSucces");
|
||||
}
|
||||
function calculateUnreadCount(arr) {
|
||||
let total = 0;
|
||||
for (const item of arr) {
|
||||
if (!item.hasOwnProperty("unreadCount")) {
|
||||
return null;
|
||||
}
|
||||
const count = item.unreadCount;
|
||||
if (typeof count !== "number" || !Number.isFinite(count)) {
|
||||
return null;
|
||||
}
|
||||
total += count;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
let tabList = common_vendor.reactive([
|
||||
{
|
||||
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Pk.png",
|
||||
@@ -73,7 +47,9 @@ const _sfc_main = {
|
||||
{
|
||||
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Message.png",
|
||||
selectedIconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Messageclick.png",
|
||||
text: "消息"
|
||||
text: "消息",
|
||||
pagePath: "/pages/index/index",
|
||||
middleClass: ""
|
||||
},
|
||||
{
|
||||
iconPath: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Mine.png",
|
||||
@@ -85,6 +61,12 @@ const _sfc_main = {
|
||||
]);
|
||||
common_vendor.onMounted(() => {
|
||||
setTabBar();
|
||||
setTimeout(() => {
|
||||
components_goEasyTool_tool.getConversationList($goeasy).then((conversations) => {
|
||||
Unread.value = conversations.unreadTotal;
|
||||
});
|
||||
im.on(common_vendor.jo.IM_EVENT.CONVERSATIONS_UPDATED, onConversationsUpdated);
|
||||
}, 1e3);
|
||||
});
|
||||
common_vendor.index.getSystemInfo({
|
||||
success: function(res) {
|
||||
@@ -108,16 +90,7 @@ const _sfc_main = {
|
||||
return false;
|
||||
};
|
||||
function handlePush(item, index) {
|
||||
if (index === 3) {
|
||||
components_VerifyLogin.VerifyLogin().then((res) => {
|
||||
if (res) {
|
||||
common_vendor.index.redirectTo({
|
||||
url: "/TUIKit/components/TUIConversation/index",
|
||||
animationType: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (index === 2) {
|
||||
if (index === 2) {
|
||||
components_VerifyLogin.VerifyLogin().then((res) => {
|
||||
if (res) {
|
||||
openPopupQuantity();
|
||||
@@ -144,23 +117,23 @@ const _sfc_main = {
|
||||
a: common_vendor.f(common_vendor.unref(tabList), (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: __props.tabIndex == index ? item.selectedIconPath : item.iconPath,
|
||||
b: index === 3 && common_vendor.unref(Unread) > 0
|
||||
}, index === 3 && common_vendor.unref(Unread) > 0 ? {
|
||||
c: common_vendor.t(common_vendor.unref(Unread) > 99 ? "99+" : common_vendor.unref(Unread))
|
||||
b: index === 3 && Unread.value > 0
|
||||
}, index === 3 && Unread.value > 0 ? {
|
||||
c: common_vendor.t(Unread.value > 99 ? "99+" : Unread.value)
|
||||
} : {}, {
|
||||
d: common_vendor.t(item.text),
|
||||
e: __props.tabIndex == index ? "#1DD2F9" : "#A7A3A3",
|
||||
f: common_vendor.n("list-item flex flex-column flex-middle " + item.middleClass),
|
||||
g: common_vendor.o$1(($event) => handlePush(item, index), index),
|
||||
g: common_vendor.o(($event) => handlePush(item, index), index),
|
||||
h: index
|
||||
});
|
||||
}),
|
||||
b: common_vendor.n(common_vendor.unref(showMiddleButton) === true ? "tab-list-middle" : "tab-list-default"),
|
||||
c: common_vendor.o$1(disabledScroll),
|
||||
c: common_vendor.o(disabledScroll),
|
||||
d: common_vendor.sr(createModule, "c497a889-0", {
|
||||
"k": "createModule"
|
||||
}),
|
||||
e: common_vendor.o$1(publishSuccesss)
|
||||
e: common_vendor.o(_ctx.publishSuccesss)
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ const _sfc_main = {
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o$1((...args) => $options.MakeAppointmentPK && $options.MakeAppointmentPK(...args)),
|
||||
a: common_vendor.o((...args) => $options.MakeAppointmentPK && $options.MakeAppointmentPK(...args)),
|
||||
b: !$data.Select ? 1 : "",
|
||||
c: $data.Select ? 1 : "",
|
||||
d: common_vendor.o$1((...args) => $options.RealTimePk && $options.RealTimePk(...args)),
|
||||
d: common_vendor.o((...args) => $options.RealTimePk && $options.RealTimePk(...args)),
|
||||
e: $data.Select ? 1 : "",
|
||||
f: !$data.Select ? 1 : "",
|
||||
g: common_vendor.o$1((...args) => $options.screening && $options.screening(...args))
|
||||
g: common_vendor.o((...args) => $options.screening && $options.screening(...args))
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ce2f6748"]]);
|
||||
|
||||
Reference in New Issue
Block a user