diff --git a/App.vue b/App.vue index 8c2b732..b5d8f5c 100644 --- a/App.vue +++ b/App.vue @@ -1,13 +1,23 @@ diff --git a/manifest.json b/manifest.json index d682dc5..04a8cdf 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "xunfeiAi", + "name" : "农业咨询", "appid" : "__UNI__9620511", "description" : "", "versionName" : "1.0.0", diff --git a/pages.json b/pages.json index 321d795..60164b0 100644 --- a/pages.json +++ b/pages.json @@ -3,16 +3,10 @@ { "path": "pages/index/index", "style": { - "navigationBarTitleText": "讯飞AI", + "navigationBarTitleText": "农业咨询", "bounce": "none" // "softinputMode": "adjustResize" } - }, { - "path": "pages/index/chat", - "style": { - "navigationBarTitleText": "讯飞星火", - "bounce": "none" - } } ], "globalStyle": { diff --git a/pages/index/index.vue b/pages/index/index.vue index 10c172f..b3e08a3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -7,7 +7,7 @@ - + @@ -65,6 +65,7 @@ content: '', c_content: '', n_content: '', + avatar: '/static/avatar.png', // 用户头像 params: [], // 发送的消息内容 timer: '', socketTask: {}, @@ -94,6 +95,13 @@ }) }) }, + onLoad() { + let avatar = uni.getStorageSync('avatar'); + avatar ? this.avatar = avatar : null; + uni.$on('MPinfo', (e) => { + this.avatar = e.avatar; + }) + }, beforeDestroy() { // #ifdef APP-PLUS uni.offKeyboardHeightChange(); @@ -273,8 +281,8 @@ // this.c_content = ''; // this.n_content = ''; this.socketTask.close({ - code: 500, // APP端存在BUG,正常关闭的code为1000,无法正常关闭,需要将code换为其他值 - complete: (res)=>{ + code: 500, // APP端存在BUG,正常关闭的code为1000,无法正常关闭,需要将code换为其他值 + complete: (res) => { this.showStop = false; console.log('主动断开', res); this.wsLiveFlag = false; @@ -299,15 +307,16 @@ "id": new Date().getTime(), "content": this.content, "type": 1, - "pic": "/static/avatar.png" + "pic": this.avatar } + console.log(data); this.TEXT = this.content; this.talkList.push(data); this.talkList.push({ "id": new Date().getTime(), "content": '', "type": 2, - "pic": "/static/avatar.png" + "pic": "/static/icon/ny.png" }); this.n_content = ''; this.c_content = ''; @@ -330,8 +339,9 @@ let realThis = this; this.socketTask = uni.connectSocket({ //url: encodeURI(encodeURI(myUrl).replace(/\+/g, '%2B')), - url: 'wss://chat.lihaink.cn/chat' + '?timestamp=' + Date.now(), + url: `wss://chat.lihaink.cn/chat?type=农业咨询×tamp=${Date.now()}`, method: 'GET', + token: '', success: res => { console.log(res, "ws成功连接...") realThis.wsLiveFlag = true; @@ -382,7 +392,7 @@ console.log('收到API返回的内容:', res.data); let obj = JSON.parse(res.data) // console.log("我打印的"+obj.payload); - if(!realThis.wsLiveFlag) return ; + if (!realThis.wsLiveFlag) return; let dataArray = obj.payload.choices.text; for (let i = 0; i < dataArray.length; i++) { this.talkList[this.talkList.length - 1].content += dataArray[i].content; diff --git a/static/avatar.png b/static/avatar.png index 4aa23de..2f531da 100644 Binary files a/static/avatar.png and b/static/avatar.png differ diff --git a/static/iat.png b/static/iat.png deleted file mode 100644 index eb114a9..0000000 Binary files a/static/iat.png and /dev/null differ diff --git a/static/iat_active.png b/static/iat_active.png deleted file mode 100644 index 7310a3a..0000000 Binary files a/static/iat_active.png and /dev/null differ diff --git a/static/ise.png b/static/ise.png deleted file mode 100644 index 1b2991a..0000000 Binary files a/static/ise.png and /dev/null differ diff --git a/static/ise_active.png b/static/ise_active.png deleted file mode 100644 index 71e7578..0000000 Binary files a/static/ise_active.png and /dev/null differ diff --git a/static/logo.png b/static/logo.png deleted file mode 100644 index b5771e2..0000000 Binary files a/static/logo.png and /dev/null differ diff --git a/static/tts.png b/static/tts.png deleted file mode 100644 index c33108b..0000000 Binary files a/static/tts.png and /dev/null differ diff --git a/static/tts_avtive.png b/static/tts_avtive.png deleted file mode 100644 index a7f8be8..0000000 Binary files a/static/tts_avtive.png and /dev/null differ