diff --git a/components/GPT/index.vue b/components/GPT/index.vue index fe3a513..0119ce4 100644 --- a/components/GPT/index.vue +++ b/components/GPT/index.vue @@ -77,6 +77,7 @@ import Socket from './utils/socket' import { splitTextForTTS } from './utils/util' import { getHistroyMsg, + setMsgData } from './utils/message' import ClientData from './utils/ClientData'; import Pending from './components/pending'; @@ -120,6 +121,7 @@ export default { tmpMsg: {}, lastTxt: {}, txtAudioStaus: {}, + requestMsg: {}, disabledStatus: false } }, @@ -151,11 +153,11 @@ export default { this.socketObj = new Socket({ agentId: this.agentId, onMessage: (e) => { - const index = this.msgList.findIndex(it => it.request_id == e.request_id && it.type == 'reply') console.log(e.request_id + '回复内容', e.content) + // const index = this.msgList.findIndex(it => it.request_id == e.request_id && it.type == 'reply') // this.tmpMsg[e.request_id] = this.tmpMsg[e.request_id] ?? [] // if (this.tmpMsg[e.request_id].length) { - // const txt = this.removeSpecificText(e.content??'', this.lastTxt[e.request_id] ?? '') + // const txt = e.content // if (txt) { // this.tmpMsg[e.request_id].push(txt) // } @@ -163,7 +165,7 @@ export default { // this.tmpMsg[e.request_id].push(e.content) // } // this.lastTxt[e.request_id] = e.content - // // console.log(this.tmpMsg[e.request_id]) + // if (!this.txtAudioStaus[e.request_id]) { // this.txtAudioStaus[e.request_id] = true // this.renderTxt(e) @@ -171,8 +173,12 @@ export default { // console.log(e.content) e.pending = false + // 只输入文字 // if (index > -1) { - // this.msgList[index] = e + // this.msgList[index] = { + // ...e, + // content: this.msgList[index].content + e.content + // } // } else { // if (this.msgList.length) { // const obj = this.msgList[this.msgList.length - 1] @@ -184,34 +190,43 @@ export default { // } else { // this.msgList.push(e) // } - // } else { // this.msgList.push(e) // } // } + // // 写入缓存 + // if (!e.is_from_self && e.is_final) { + // setMsgData(this.msgList[index]) + // } + + this.requestMsg[e.request_id] = (this.requestMsg[e.request_id] ? this.requestMsg[e.request_id] : '') + e.content if (!e.is_from_self && e.is_final) { + e.content = this.requestMsg[e.request_id] const audioParams = e - console.log( audioParams); - // 回复结束 写入缓存 + // 回复结束 写入缓存 + setMsgData(audioParams) + console.log('开始',audioParams); this.audio(audioParams, (txt)=> { + const index = this.msgList.findIndex(it => it.request_id == e.request_id && it.type == 'reply') + console.log(1111111, txt, index) if (index > -1) { + this.msgList[index].content += txt this.$nextTick(() => { - this.msgList[index].content += txt this.scrollToBottom() }) } else { if (this.msgList.length) { const obj = this.msgList[this.msgList.length - 1] if (obj.pending) { + const tmp = { + ...e, + pending: false, + content: txt + } + this.msgList[this.msgList.length - 1] = tmp this.$nextTick(() => { - const tmp = { - ...e, - pending: false, - content: txt - } - this.msgList[this.msgList.length - 1] = tmp this.scrollToBottom() }) } else { @@ -222,8 +237,8 @@ export default { ...e, pending: false } + this.msgList.push(tmp) this.$nextTick(() => { - this.msgList.push(tmp) this.scrollToBottom() }) } @@ -231,8 +246,8 @@ export default { this.scrollToBottom() }) - // - this.disabledStatus = false + // // + // this.disabledStatus = false } this.scrollToBottom() } @@ -307,8 +322,8 @@ export default { audioText(text, cb) { return new Promise(async (resolve, reject) => { - if (!this.audioStatus) { reject() } const url = await this.loadAudioUrl(text) + if (!this.audioStatus) { reject() } console.log('开始播放文字', text) cb && cb(text) this.audioCtx = wx.createInnerAudioContext(); diff --git a/components/GPT/utils/socket.js b/components/GPT/utils/socket.js index 54d65d7..bedd4f1 100644 --- a/components/GPT/utils/socket.js +++ b/components/GPT/utils/socket.js @@ -18,7 +18,6 @@ export default class Socket { this.selfCloseStatus = false this.reconnectLock = false console.log("Socket init", GLOBAL_OBJ); - // 失败回答 this.failMsg = {} } @@ -122,7 +121,7 @@ export default class Socket { }); socket.onMessage((e) => { - // console.log("socket.onMessage", e); + console.log("socket.onMessage", e); const { data } = e; if (data == 2) { // 触发浪涌 @@ -134,10 +133,6 @@ export default class Socket { const params = this.getMsgData(data); const { type } = params ?? {}; this.on(type, params); - if (params && params.type === "reply" && !params.is_from_self) { - // 回复消息 - this._options.onMessage && this._options.onMessage(params); - } const num = "" + data.substring(0, 2); if (num == "40") { console.log("创建对话成功", e); @@ -169,6 +164,10 @@ export default class Socket { } doConnectTimeout() { + if (this.selfCloseStatus){ + // 主动退出 不在重连 + return + } // 重连一次 console.log("websocket 异常关闭 开始重连"); this.connectSocketTimeOut = setTimeout(() => { @@ -192,17 +191,12 @@ export default class Socket { sendFailMsg() { const content = Object.values(this.failMsg) - if (content.length) { - console.log('开始重新发送失败信息') + const lastFailMsgIndex = content.findLastIndex(it => !it.status) + if (lastFailMsgIndex > -1) { + const msg = content[lastFailMsgIndex] + console.log('开始重新发送失败信息', msg) // 重新发送失败的信息 - for (let index = 0; index < content.length; index++) { - const item = content[index]; - if (!item.status) { - console.log('失败消息', item) - // 失败消息 在发送一遍 - this.send(item.data.socketParams,item.data.contentType ) - } - } + this.send(msg.data.socketParams,msg.data.contentType) } } getMsgData(e) { @@ -230,8 +224,12 @@ export default class Socket { emit(type, params, contentType) { console.log("emit", type, params); + const tmpParams = params + tmpParams.incremental = true const data = { - payload: params, + //incremental:true, + payload: tmpParams + }; switch (type) { case "send": @@ -280,6 +278,7 @@ export default class Socket { params.can_rating ) { // 回复消息 + console.log('reply回复内容', tmpParams.content, tmpParams) this._options.onMessage && this._options.onMessage(tmpParams); } @@ -290,7 +289,7 @@ export default class Socket { } // 回复结束 写入缓存 - setMsgData(tmpParams); + // setMsgData(tmpParams); } // 回复 break; @@ -310,6 +309,7 @@ export default class Socket { if (this.timeoutObj) { clearTimeout(this.timeoutObj); } + return this.timeoutObj = setTimeout(() => { this.socket && this.socket.send && this.socket.send({ data: 3 }); }, HEART_BEAT_TIME); diff --git a/components/GPT/utils/util.js b/components/GPT/utils/util.js index 942e0c8..3b03c2a 100644 --- a/components/GPT/utils/util.js +++ b/components/GPT/utils/util.js @@ -81,7 +81,7 @@ function escapeHtml (str) { } -export const splitTextForTTS = (text, maxLength = 30) => { +export const splitTextForTTS = (text, maxLength = 15) => { // 定义优先分割的标点符号 const punctuation = ['。', ',', ';', '?', '!', ',', ';', '?', '!', '、']; let segments = []; diff --git a/pages/index/iSoul.vue b/pages/index/iSoul.vue index 0a32975..70d9721 100644 --- a/pages/index/iSoul.vue +++ b/pages/index/iSoul.vue @@ -81,27 +81,28 @@ --> - - - - - + - + - 数字资产权益 + 我的数字资产权益 + + + + + @@ -174,7 +175,7 @@ - + - 待使用 + 待核销 @@ -226,9 +227,9 @@ - + - 有感商品订单 + 我的有感商品 @@ -257,7 +258,7 @@ - + 数字资产收藏夹 @@ -515,7 +516,7 @@ export default { image: item.goodsImg || "/uploads/20250729/42598a2dcf4c9a6f8c6e122e54b65c4f.png", - badge: "待使用", + badge: "待核销", name: item.goodsTitle || "数字资产权益", desc: item.type == 1 @@ -529,7 +530,7 @@ export default { : item.type == 2 ? "去预约" : "去核销", - status: "待使用", + status: "待核销", ...item, // 保留原始数据 })); } else { @@ -663,7 +664,7 @@ export default { // 否则是点击底部操作按钮 switch (action) { - case "待使用": + case "待核销": uni.navigateTo({ url: "/subPackages/orderQy/list?status=1", }); @@ -1417,7 +1418,7 @@ view { .memorial-divider { display: flex; align-items: center; - padding: 30rpx 0; + padding: 50rpx 0; margin-bottom: 30rpx; } @@ -1738,9 +1739,9 @@ view { .column-divider { width: 2rpx; - height: 60rpx; + height: 50rpx; background: rgba(0, 0, 0, 0.1); - margin: 35rpx 16rpx; + margin: 0rpx 16rpx; flex-shrink: 0; } @@ -1748,7 +1749,7 @@ view { display: flex; align-items: center; justify-content: space-around; - padding: 20rpx 40rpx 0; + padding: 0rpx 40rpx 37rpx; } .popup-actions-bottom { diff --git a/pages/index/sensoryStore.vue b/pages/index/sensoryStore.vue index c53c722..791adc9 100644 --- a/pages/index/sensoryStore.vue +++ b/pages/index/sensoryStore.vue @@ -16,12 +16,26 @@ - + + + 关于有感商品 + + + 寻常商品,满足你的日常所需;而「有感商品」,则回应你的精神所向。 + + + 我们坚信“意义大于产品”。这里的每一件商品都诞生于EPIC SOUL「交响」阅读体的史诗,是精神漫游的实体回响。它的存在,是为了让你在消费中完成一次次深刻的情感连接与自我认同。 + + + 在这里,消费的终点不是拥有,而是更深刻的连接与共鸣。欢迎探索,一件件写满故事与想象力的生活信物。 + + 有感商品上新 + @@ -234,4 +248,15 @@ font-weight: 500; margin: 30rpx 0; } + .desc-box{ + padding: 0 20rpx; + color: #616161; + margin: 30rpx 0; + font-size: 22rpx; + padding: 0 30rpx; + view{ + margin-bottom: 20rpx; + + } + } diff --git a/static/js/request.js b/static/js/request.js index 64a8552..98bdcb1 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -8,8 +8,8 @@ const DEV_API_URL = 'https://epic.new.js-dyyj.com'; // const PROD_API_URL = 'https://epic.js-dyyj.com'; const PROD_API_URL = 'https://epic.new.js-dyyj.com'; const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL; -const DEV_API_URL_DES = 'http://192.168.124.177:8083/xcx'; -// const DEV_API_URL_DES = 'https://des.js-dyyj.com/xcx'; +// const DEV_API_URL_DES = 'http://192.168.124.177:8083/xcx'; +const DEV_API_URL_DES = 'https://des.js-dyyj.com/xcx'; const PROD_API_URL_DES = 'https://des.js-dyyj.com/xcx'; const NEWAPIURL_DES = process.env.NODE_ENV === 'development' ? DEV_API_URL_DES : PROD_API_URL_DES; const getToken = () => { diff --git a/subPackages/other/evita.vue b/subPackages/other/evita.vue index 05c9429..23922cd 100644 --- a/subPackages/other/evita.vue +++ b/subPackages/other/evita.vue @@ -119,13 +119,16 @@ url: "/pages/agent/index?id="+this.agentInfo.agentId }); }else{ - uni.redirectTo({ - url: "/subPackages/equityGoods/detail?id="+this.agentId - }); - // uni.showToast({ - // title: '请先购买当前商品', - // icon: 'none' - // }) + uni.showToast({ + title: '为您跳转商品购买页~', + icon: 'none' + }) + setTimeout(() =>{ + uni.redirectTo({ + url: "/subPackages/equityGoods/detail?id="+this.agentId + }); + },900) + } }