| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_assets = require("../../common/assets.js");
- const api_message = require("../../api/message.js");
- const api_student = require("../../api/student.js");
- const utils_chatSocket = require("../../utils/chatSocket.js");
- const utils_request = require("../../utils/request.js");
- const _sfc_main = {
- __name: "chat",
- setup(__props) {
- const loading = common_vendor.ref(true);
- const messages = common_vendor.ref([]);
- const inputValue = common_vendor.ref("");
- const inputMode = common_vendor.ref("text");
- const activePanel = common_vendor.ref("none");
- const lastMessageId = common_vendor.ref("bottom-anchor");
- const statusBarHeight = common_vendor.ref(20);
- const sessionId = common_vendor.ref(null);
- const fromUserId = common_vendor.ref(null);
- const sessionUserName = common_vendor.ref("");
- const jobName = common_vendor.ref("");
- const chatType = common_vendor.ref("job");
- const trainingTitle = common_vendor.ref("");
- const assessmentTitle = common_vendor.ref("");
- const assessmentCover = common_vendor.ref("");
- const assessmentLevel = common_vendor.ref("");
- const assessmentId = common_vendor.ref("");
- const assessmentPrice = common_vendor.ref("");
- const positionId = common_vendor.ref(null);
- const salaryRange = common_vendor.ref("");
- const companyName = common_vendor.ref("");
- const workCity = common_vendor.ref("");
- const waiterAvatar = common_vendor.ref("/static/images/hr_avatar.svg");
- function resolveAvatarUrl(url) {
- if (!url || url === "" || url === "undefined")
- return "";
- const str = String(url).trim();
- if (str.startsWith("http://") || str.startsWith("https://"))
- return str;
- if (/^\d+$/.test(str)) {
- return `${utils_request.BASE_URL}/resource/oss/file/${str}`;
- }
- if (str.startsWith("/static/"))
- return "";
- return str;
- }
- const userAvatarUrl = common_vendor.ref("/static/images/user_avatar.png");
- const emojiList = ["😀", "😃", "😄", "😁", "😆", "😅", "😂", "🤣", "😊", "😇", "🙂", "🙃", "😉", "😌", "😍", "🥰", "😘", "😗", "😙", "😚", "😋", "😛", "😝", "😜", "🤪", "🤨", "🧐", "🤓", "😎", "🤩", "🥳"];
- let wsSubId = null;
- common_vendor.onLoad(async (options) => {
- try {
- const sysInfo = common_vendor.index.getSystemInfoSync();
- statusBarHeight.value = sysInfo.statusBarHeight || 20;
- } catch (e) {
- }
- if (options.sessionId)
- sessionId.value = options.sessionId;
- if (options.fromUserId)
- fromUserId.value = options.fromUserId;
- if (options.userName)
- sessionUserName.value = decodeURIComponent(options.userName);
- if (options.jobName)
- jobName.value = decodeURIComponent(options.jobName);
- if (options.type)
- chatType.value = options.type;
- if (options.title)
- trainingTitle.value = decodeURIComponent(options.title || "");
- if (options.title && options.type === "assessment") {
- assessmentTitle.value = decodeURIComponent(options.title || "");
- }
- if (options.cover)
- assessmentCover.value = decodeURIComponent(options.cover || "");
- if (options.level)
- assessmentLevel.value = decodeURIComponent(options.level || "");
- if (options.assessmentId)
- assessmentId.value = options.assessmentId;
- if (options.price)
- assessmentPrice.value = options.price;
- if (options.positionId)
- positionId.value = options.positionId;
- if (options.salaryRange)
- salaryRange.value = decodeURIComponent(options.salaryRange);
- if (options.companyName)
- companyName.value = decodeURIComponent(options.companyName);
- if (options.workCity)
- workCity.value = decodeURIComponent(options.workCity);
- const storedInfo = common_vendor.index.getStorageSync("userInfo") || {};
- const rawUserAvatar = storedInfo.avatarUrl || storedInfo.avatar || "/static/images/user_avatar.png";
- userAvatarUrl.value = resolveAvatarUrl(rawUserAvatar) || "/static/images/user_avatar.png";
- if (!fromUserId.value && storedInfo.studentId)
- fromUserId.value = storedInfo.studentId;
- if (!sessionId.value) {
- loading.value = false;
- common_vendor.index.showToast({ title: "会话参数缺失", icon: "none" });
- return;
- }
- await loadHistory();
- connectWebSocket();
- if (chatType.value === "assessment") {
- setTimeout(async () => {
- try {
- const userInfo = common_vendor.index.getStorageSync("userInfo") || {};
- const res = await api_message.autoCreateOrderCard({
- sessionId: sessionId.value,
- studentId: userInfo.studentId || fromUserId.value,
- orderName: assessmentTitle.value || jobName.value + "-测评服务费",
- orderPrice: assessmentPrice.value || "0",
- orderType: "测评咨询"
- });
- if (res.code === 200 && res.data) {
- pushOrderCardMsg(res.data);
- } else {
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:416", "自动创建结算单失败:", res);
- }
- } catch (err) {
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:419", "自动创建结算单异常:", err);
- }
- }, 800);
- } else if (chatType.value === "job" && positionId.value) {
- try {
- const { getAssessmentList } = require("../../api/assessment.js");
- const evalRes = await getAssessmentList({ positionId: positionId.value, pageNum: 1, pageSize: 1 });
- if (evalRes.code === 200 && evalRes.rows && evalRes.rows.length > 0) {
- const firstEval = evalRes.rows[0];
- if (!assessmentId.value) {
- assessmentId.value = String(firstEval.id);
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:433", "[Chat] 岗位关联测评ID:", assessmentId.value);
- }
- setTimeout(async () => {
- try {
- const userInfo = common_vendor.index.getStorageSync("userInfo") || {};
- const res = await api_message.autoCreateOrderCard({
- sessionId: sessionId.value,
- studentId: userInfo.studentId || fromUserId.value,
- orderName: (firstEval.evaluationName || jobName.value) + "-测评服务费",
- orderPrice: firstEval.price || assessmentPrice.value || "0",
- orderType: "岗位测评"
- });
- if (res.code === 200 && res.data) {
- pushOrderCardMsg(res.data);
- }
- } catch (err) {
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:448", "岗位结算单异常:", err);
- }
- }, 800);
- } else {
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:451", "[Chat] 该岗位无关联测评,不发送结算单");
- }
- } catch (e) {
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:454", "[Chat] 查询关联测评失败:", e);
- }
- }
- });
- let orderTimer = null;
- function startOrderTimer() {
- if (orderTimer)
- return;
- orderTimer = setInterval(() => {
- messages.value.forEach((m) => {
- if (m.msgType === "order_card" && !m.isPaid && m.countdown > 0) {
- m.countdown--;
- }
- });
- }, 1e3);
- }
- common_vendor.onUnload(() => {
- if (wsSubId) {
- utils_chatSocket.unsubscribe(wsSubId);
- wsSubId = null;
- }
- utils_chatSocket.disconnectChat();
- if (orderTimer)
- clearInterval(orderTimer);
- });
- async function loadHistory() {
- try {
- const res = await api_message.getChatHistory({ sessionId: sessionId.value, pageNum: 1, pageSize: 50 });
- if (res.rows) {
- messages.value = res.rows.slice().reverse().map(normalizeMsg);
- scrollToBottom();
- const firstWaiterMsg = res.rows.find((m) => m.senderType === 2);
- if (firstWaiterMsg && firstWaiterMsg.senderAvatar) {
- const resolvedWaiterAvatar = resolveAvatarUrl(firstWaiterMsg.senderAvatar);
- if (resolvedWaiterAvatar) {
- waiterAvatar.value = resolvedWaiterAvatar;
- }
- }
- if (messages.value.length > 0) {
- const lastMsg = messages.value[messages.value.length - 1];
- if (lastMsg.id && !lastMsg.id.toString().startsWith("temp")) {
- api_message.markChatRead({ sessionId: sessionId.value, lastReadMsgId: lastMsg.id });
- }
- }
- }
- } catch (e) {
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:506", "[Chat] 加载历史消息失败:", e);
- } finally {
- loading.value = false;
- }
- if (fromUserId.value) {
- try {
- const stuRes = await api_student.getStudent(fromUserId.value);
- if (stuRes.code === 200 && stuRes.data) {
- const stu = stuRes.data;
- const resolvedUrl = resolveAvatarUrl(stu.avatarUrl || stu.avatar);
- if (resolvedUrl) {
- userAvatarUrl.value = resolvedUrl;
- }
- }
- } catch (e) {
- common_vendor.index.__f__("warn", "at pages/chat/chat.vue:524", "[Chat] 获取学员头像失败:", e);
- }
- }
- }
- function connectWebSocket() {
- const token = common_vendor.index.getStorageSync("token");
- utils_chatSocket.connectChat({
- token,
- onConnect: () => {
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:535", "[Chat] WebSocket 已连接,订阅会话消息");
- if (sessionId.value) {
- wsSubId = utils_chatSocket.subscribe(`/topic/session/${sessionId.value}`, (data) => {
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:539", "[Chat] 收到 WebSocket 消息:", data);
- onWsMessage(data);
- });
- }
- },
- onDisconnect: () => {
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:545", "[Chat] WebSocket 已断开");
- }
- });
- }
- function onWsMessage(data) {
- if (!data)
- return;
- const msgList = Array.isArray(data) ? data : [data];
- msgList.forEach((msgData) => {
- const normalized = normalizeMsg(msgData);
- const existIdx = messages.value.findIndex(
- (m) => m.id && normalized.id && m.id === normalized.id || m.msgNo && normalized.msgNo && m.msgNo === normalized.msgNo
- );
- if (existIdx >= 0) {
- messages.value[existIdx] = { ...messages.value[existIdx], ...normalized };
- } else {
- messages.value.push(normalized);
- }
- });
- scrollToBottom();
- const lastMsg = messages.value[messages.value.length - 1];
- if (lastMsg && lastMsg.id && !String(lastMsg.id).startsWith("temp")) {
- api_message.markChatRead({ sessionId: sessionId.value, lastReadMsgId: lastMsg.id });
- }
- }
- function normalizeMsg(msg) {
- let payload = null;
- if (msg.payload) {
- try {
- payload = typeof msg.payload === "string" ? JSON.parse(msg.payload) : msg.payload;
- } catch (e) {
- }
- }
- return {
- id: msg.msgId,
- msgNo: msg.msgNo,
- senderType: msg.senderType,
- // 1=用户 2=客服 3=系统
- senderName: msg.senderName,
- senderAvatar: msg.senderAvatar,
- msgType: msg.msgType || "text",
- content: msg.content,
- fileUrl: msg.fileUrl,
- fileName: msg.fileName,
- fileSize: msg.fileSize,
- payload,
- sendTime: msg.sendTime,
- isPaid: payload && (payload.status === "paid" || payload.status === "已支付" || payload.paid === true)
- };
- }
- async function sendMessage() {
- const content = inputValue.value.trim();
- if (!content || !sessionId.value)
- return;
- const msgNo = utils_chatSocket.generateMsgNo();
- const tempId = "temp_" + Date.now();
- messages.value.push({
- id: tempId,
- msgNo,
- senderType: 1,
- msgType: "text",
- content,
- sendTime: (/* @__PURE__ */ new Date()).toISOString(),
- payload: null
- });
- inputValue.value = "";
- scrollToBottom();
- try {
- if (utils_chatSocket.isSocketConnected()) {
- const sent = utils_chatSocket.sendTextByWs(sessionId.value, content, "text", msgNo, fromUserId.value);
- if (sent)
- return;
- }
- await api_message.sendTextMessage({
- sessionId: sessionId.value,
- msgNo,
- content,
- msgType: "text",
- senderId: fromUserId.value || void 0
- });
- } catch (e) {
- messages.value = messages.value.filter((m) => m.id !== tempId);
- common_vendor.index.showToast({ title: "发送失败,请重试", icon: "none" });
- }
- }
- async function chooseImage() {
- activePanel.value = "none";
- common_vendor.index.chooseImage({
- count: 1,
- success: async (res) => {
- const filePath = res.tempFilePaths[0];
- const tempId = "temp_img_" + Date.now();
- messages.value.push({
- id: tempId,
- senderType: 1,
- msgType: "image",
- fileUrl: filePath,
- sendTime: (/* @__PURE__ */ new Date()).toISOString(),
- payload: null
- });
- scrollToBottom();
- try {
- const msgNo = "MSG_" + Date.now() + "_" + Math.random().toString(36).slice(2, 6);
- await api_message.sendImageMessage({ sessionId: sessionId.value, msgNo, filePath, senderId: fromUserId.value });
- } catch (e) {
- messages.value = messages.value.filter((m) => m.id !== tempId);
- common_vendor.index.showToast({ title: "图片发送失败", icon: "none" });
- }
- }
- });
- }
- function sendMockOrderCard() {
- activePanel.value = "none";
- messages.value.push({
- id: "manual_order_" + Date.now(),
- msgNo: "ORDER_" + Date.now(),
- senderType: 2,
- msgType: "order_card",
- content: "为您推送测评费用结算单",
- payload: {
- id: 1,
- name: assessmentTitle.value || "测评费用",
- amount: assessmentPrice.value || "680.00"
- },
- sendTime: (/* @__PURE__ */ new Date()).toISOString(),
- isPaid: false
- });
- scrollToBottom();
- }
- function pushOrderCardMsg(card) {
- const hasOrderCard = messages.value.some(
- (m) => m.msgType === "order_card" && m.payload && m.payload.orderCardId === card.orderCardId
- );
- if (hasOrderCard) {
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:696", "[Chat] 已存在相同结算单消息,跳过推送");
- return;
- }
- messages.value.push({
- id: "order_" + card.orderCardId,
- msgNo: "ORDER_" + Date.now(),
- senderType: card.senderType || 3,
- msgType: "order_card",
- content: "项目费用结算单",
- countdown: Math.floor(card.countdownSeconds || 1800),
- payload: {
- orderCardId: card.orderCardId,
- id: card.orderCardId,
- name: card.orderName || assessmentTitle.value || jobName.value,
- // 同时写入amount和price,兼容后端payload字段
- amount: card.orderPrice || assessmentPrice.value || "0",
- price: card.orderPrice || assessmentPrice.value || "0",
- status: "pending"
- },
- sendTime: (/* @__PURE__ */ new Date()).toISOString(),
- isPaid: false
- });
- scrollToBottom();
- startOrderTimer();
- }
- function confirmReg() {
- common_vendor.index.showLoading({ title: "预约中..." });
- setTimeout(() => {
- common_vendor.index.hideLoading();
- common_vendor.index.showToast({ title: "预约成功", icon: "success" });
- }, 1200);
- }
- async function handlePay(msg) {
- if (msg.isPaid)
- return;
- const orderCardId = msg.payload ? msg.payload.orderCardId || msg.payload.id : null;
- const userInfo = common_vendor.index.getStorageSync("userInfo") || {};
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:738", "🔥 开始支付流程");
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:739", "🔥 orderCardId:", orderCardId, "类型:", typeof orderCardId);
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:740", "🔥 fromUserId:", fromUserId.value, "类型:", typeof fromUserId.value);
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:741", "🔥 userInfo:", JSON.stringify(userInfo));
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:742", "🔥 msg.payload:", JSON.stringify(msg.payload));
- if (!orderCardId) {
- common_vendor.index.showToast({ title: "无效的结算单", icon: "none" });
- return;
- }
- try {
- common_vendor.index.showLoading({ title: "创建支付订单..." });
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:772", "🔥 调用支付接口,参数:", { orderCardId, userId: fromUserId.value });
- const payRes = await api_message.createWxPayOrder(orderCardId, fromUserId.value);
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:774", "🔥 支付接口响应:", payRes);
- if (!(payRes.code === 200 || payRes.code === 0)) {
- common_vendor.index.hideLoading();
- common_vendor.index.showToast({ title: payRes.msg || "创建支付订单失败", icon: "none" });
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:779", "🔥 支付接口调用失败:", payRes);
- return;
- }
- if (payRes.data && payRes.data.wechatPayParams) {
- const wxPayParams = payRes.data.wechatPayParams;
- common_vendor.index.hideLoading();
- common_vendor.index.showLoading({ title: "发起微信支付..." });
- common_vendor.index.requestPayment({
- provider: "wxpay",
- timeStamp: wxPayParams.timeStamp,
- nonceStr: wxPayParams.nonceStr,
- package: wxPayParams.package,
- signType: wxPayParams.signType || "RSA",
- paySign: wxPayParams.paySign,
- success: (res) => {
- common_vendor.index.hideLoading();
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:800", "微信支付成功:", res);
- msg.isPaid = true;
- common_vendor.index.showToast({ title: "支付成功", icon: "success" });
- if (assessmentId.value) {
- const paidKey = `audit_paid_${assessmentId.value}`;
- common_vendor.index.setStorageSync(paidKey, true);
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:811", "[Chat] 支付成功,写入 key:", paidKey);
- }
- if (chatType.value === "job" && positionId.value) {
- const fallbackKey = `audit_paid_pos_${positionId.value}`;
- common_vendor.index.setStorageSync(fallbackKey, true);
- common_vendor.index.__f__("log", "at pages/chat/chat.vue:817", "[Chat] 兜底写入 key:", fallbackKey);
- }
- msg.payload = {
- ...msg.payload || {},
- orderCardId,
- orderId: payRes.data.orderId,
- orderNo: payRes.data.orderNo || "",
- status: "paid"
- };
- common_vendor.index.$emit("payment_done", {
- orderCardId,
- orderId: payRes.data.orderId,
- assessmentId: assessmentId.value,
- positionId: positionId.value,
- paid: true
- });
- if (chatType.value === "assessment") {
- setTimeout(() => {
- common_vendor.index.navigateTo({ url: `/pages/assessment/training?title=${encodeURIComponent(assessmentTitle.value)}&assessmentId=${assessmentId.value}` });
- }, 1200);
- }
- },
- fail: (err) => {
- common_vendor.index.hideLoading();
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:846", "微信支付失败:", err);
- if (err.errMsg && err.errMsg.includes("cancel")) {
- common_vendor.index.showToast({ title: "支付已取消", icon: "none" });
- } else {
- common_vendor.index.showToast({ title: "支付失败,请重试", icon: "none" });
- }
- }
- });
- } else {
- common_vendor.index.hideLoading();
- if (payRes.data && payRes.data.success) {
- msg.isPaid = true;
- common_vendor.index.showToast({ title: payRes.data.message || "支付成功", icon: "success" });
- } else {
- common_vendor.index.showToast({ title: "支付处理异常", icon: "none" });
- }
- }
- } catch (e) {
- common_vendor.index.hideLoading();
- common_vendor.index.__f__("error", "at pages/chat/chat.vue:869", "支付失败:", e);
- common_vendor.index.showToast({ title: "支付失败:" + (e.message || "网络错误"), icon: "none" });
- }
- }
- const chatBodyHeight = common_vendor.computed(() => {
- const navH = 100;
- const footerH = activePanel.value === "none" ? 120 : 520;
- return `calc(100vh - ${navH}rpx - ${footerH}rpx - env(safe-area-inset-top) - env(safe-area-inset-bottom))`;
- });
- function scrollToBottom() {
- common_vendor.nextTick$1(() => {
- lastMessageId.value = "";
- common_vendor.nextTick$1(() => {
- lastMessageId.value = "bottom-anchor";
- });
- });
- }
- function goBack() {
- common_vendor.index.navigateBack();
- }
- function toggleInputMode() {
- inputMode.value = inputMode.value === "text" ? "voice" : "text";
- activePanel.value = "none";
- }
- function togglePanel(panel) {
- activePanel.value = activePanel.value === panel ? "none" : panel;
- if (activePanel.value !== "none")
- inputMode.value = "text";
- scrollToBottom();
- }
- function onInputFocus() {
- activePanel.value = "none";
- scrollToBottom();
- }
- function addEmoji(e) {
- inputValue.value += e;
- }
- function previewImg(url) {
- common_vendor.index.previewImage({ urls: [url], current: url });
- }
- function formatFileSize(size) {
- if (!size)
- return "";
- if (size < 1024)
- return size + "B";
- if (size < 1024 * 1024)
- return (size / 1024).toFixed(1) + "KB";
- return (size / 1024 / 1024).toFixed(1) + "MB";
- }
- function formatTime(timeStr) {
- if (!timeStr)
- return "";
- const d = new Date(timeStr);
- if (isNaN(d))
- return timeStr;
- const pad = (n) => n.toString().padStart(2, "0");
- return `${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
- }
- function shouldShowTime(msg, index) {
- if (index === 0)
- return true;
- const prev = messages.value[index - 1];
- if (!prev.sendTime || !msg.sendTime)
- return false;
- return new Date(msg.sendTime) - new Date(prev.sendTime) > 5 * 60 * 1e3;
- }
- function formatAmount(amount) {
- if (!amount && amount !== 0)
- return "—";
- const num = typeof amount === "string" ? parseFloat(amount) : amount;
- if (isNaN(num))
- return "—";
- return num.toFixed(2).replace(/\.?0+$/, "");
- }
- const onVoiceStart = () => common_vendor.index.showToast({ title: "录音中...", icon: "none" });
- const onVoiceEnd = () => common_vendor.index.showToast({ title: "语音功能暂未开放", icon: "none" });
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: statusBarHeight.value + "px",
- b: common_vendor.o(goBack),
- c: common_vendor.t(sessionUserName.value || "在线咨询"),
- d: loading.value
- }, loading.value ? {} : {}, {
- e: !loading.value
- }, !loading.value ? common_vendor.e({
- f: chatType.value === "assessment"
- }, chatType.value === "assessment" ? common_vendor.e({
- g: waiterAvatar.value,
- h: assessmentCover.value || "/static/images/assess_cover.svg",
- i: common_vendor.t(assessmentTitle.value || "测评咨询"),
- j: assessmentLevel.value
- }, assessmentLevel.value ? {
- k: common_vendor.t(assessmentLevel.value)
- } : {}, {
- l: common_vendor.t(assessmentPrice.value ? "¥" + assessmentPrice.value : "咨询获取")
- }) : chatType.value === "training" ? {
- n: waiterAvatar.value,
- o: common_vendor.t(trainingTitle.value || "审计员线下培训"),
- p: common_vendor.o(confirmReg)
- } : {
- q: waiterAvatar.value,
- r: common_vendor.t(jobName.value || "审计员"),
- s: common_vendor.t(salaryRange.value || "13K-23K"),
- t: common_assets._imports_0$2,
- v: common_assets._imports_1$1,
- w: common_assets._imports_2$3,
- x: common_vendor.t(companyName.value || "华财仁合"),
- y: common_assets._imports_2$1,
- z: common_vendor.t(workCity.value ? "上海市·" + workCity.value : "上海市·黄浦区")
- }, {
- m: chatType.value === "training"
- }) : {}, {
- A: !loading.value && messages.value.length === 0
- }, !loading.value && messages.value.length === 0 ? {} : {}, {
- B: common_vendor.f(messages.value, (msg, index, i0) => {
- return common_vendor.e({
- a: shouldShowTime(msg, index)
- }, shouldShowTime(msg, index) ? {
- b: common_vendor.t(formatTime(msg.sendTime))
- } : {}, {
- c: msg.senderType !== 1
- }, msg.senderType !== 1 ? {
- d: resolveAvatarUrl(msg.senderAvatar) || waiterAvatar.value
- } : {}, {
- e: msg.msgType === "text"
- }, msg.msgType === "text" ? {
- f: common_vendor.t(msg.content),
- g: common_vendor.n(msg.senderType === 1 ? "user-bubble" : "shadow")
- } : msg.msgType === "image" ? {
- i: msg.fileUrl,
- j: common_vendor.o(($event) => previewImg(msg.fileUrl), msg.id || index)
- } : msg.msgType === "file" ? {
- l: common_vendor.t(msg.fileName || "文件"),
- m: common_vendor.t(formatFileSize(msg.fileSize))
- } : msg.msgType === "order_card" ? common_vendor.e({
- o: !msg.isPaid && msg.countdown > 0
- }, !msg.isPaid && msg.countdown > 0 ? {
- p: common_vendor.t(msg.countdown)
- } : {}, {
- q: msg.isPaid
- }, msg.isPaid ? {} : {}, {
- r: common_vendor.t(msg.payload && msg.payload.name || "—"),
- s: common_vendor.t(formatAmount(msg.payload && msg.payload.amount)),
- t: common_vendor.t(msg.isPaid ? "已支付" : "立即支付"),
- v: msg.isPaid ? 1 : "",
- w: common_vendor.o(($event) => handlePay(msg), msg.id || index)
- }) : msg.msgType === "job_card" ? common_vendor.e({
- y: common_vendor.t(msg.payload && msg.payload.title || "岗位推荐"),
- z: common_vendor.t(msg.payload && msg.payload.salaryRange || ""),
- A: msg.payload && msg.payload.workCity
- }, msg.payload && msg.payload.workCity ? {
- B: common_vendor.t(msg.payload.workCity)
- } : {}) : msg.senderType === 3 ? {
- D: common_vendor.t(msg.content)
- } : {
- E: common_vendor.t(msg.content || "[消息]")
- }, {
- h: msg.msgType === "image",
- k: msg.msgType === "file",
- n: msg.msgType === "order_card",
- x: msg.msgType === "job_card",
- C: msg.senderType === 3,
- F: msg.senderType === 1
- }, msg.senderType === 1 ? {
- G: resolveAvatarUrl(msg.senderAvatar) || userAvatarUrl.value
- } : {}, {
- H: "msg-" + (msg.id || index),
- I: common_vendor.n(msg.senderType === 1 ? "right" : "left"),
- J: msg.id || index
- });
- }),
- C: lastMessageId.value,
- D: chatBodyHeight.value,
- E: inputMode.value === "text" ? "/static/icons/audio_thin.svg" : "/static/icons/keyboard.svg",
- F: common_vendor.o(toggleInputMode),
- G: inputMode.value === "text"
- }, inputMode.value === "text" ? {
- H: common_vendor.o(sendMessage),
- I: common_vendor.o(onInputFocus),
- J: inputValue.value,
- K: common_vendor.o(($event) => inputValue.value = $event.detail.value)
- } : {
- L: common_vendor.o(onVoiceStart),
- M: common_vendor.o(onVoiceEnd)
- }, {
- N: common_assets._imports_4,
- O: activePanel.value === "emoji" ? 1 : "",
- P: common_vendor.o(($event) => togglePanel("emoji")),
- Q: activePanel.value === "plus" ? "/static/icons/plus_active.svg" : "/static/icons/plus_thin.svg",
- R: common_vendor.o(($event) => togglePanel("plus")),
- S: activePanel.value === "emoji"
- }, activePanel.value === "emoji" ? {
- T: common_vendor.f(emojiList, (e, k0, i0) => {
- return {
- a: common_vendor.t(e),
- b: e,
- c: common_vendor.o(($event) => addEmoji(e), e)
- };
- })
- } : {}, {
- U: activePanel.value === "plus"
- }, activePanel.value === "plus" ? {
- V: common_assets._imports_5,
- W: common_vendor.o(chooseImage),
- X: common_assets._imports_6,
- Y: common_vendor.o(sendMockOrderCard)
- } : {}, {
- Z: activePanel.value !== "none" ? 1 : "",
- aa: activePanel.value !== "none" ? 1 : ""
- });
- };
- }
- };
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0a633310"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/chat/chat.js.map
|