完善农业咨询小程序

This commit is contained in:
weipengfei 2023-09-25 19:13:07 +08:00
parent 22cf9c81c4
commit 88f4d0b4fc
12 changed files with 33 additions and 19 deletions

18
App.vue
View File

@ -1,13 +1,23 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
onLaunch: function(info) {
console.log('App Launch');
if (info.referrerInfo?.extraData?.uniMP) {
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
if(info.referrerInfo?.extraData?.avatar){
uni.setStorageSync('avatar', info.referrerInfo?.extraData?.avatar);
uni.$emit('MPinfo', {
avatar: info.referrerInfo?.extraData?.avatar,
});
}
}
},
onShow: function() {
console.log('App Show')
console.log('App Show');
},
onHide: function() {
console.log('App Hide')
console.log('App Hide');
}
}
</script>

View File

@ -1,5 +1,5 @@
{
"name" : "xunfeiAi",
"name" : "农业咨询",
"appid" : "__UNI__9620511",
"description" : "",
"versionName" : "1.0.0",

View File

@ -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": {

View File

@ -7,7 +7,7 @@
<view class="talk-list">
<view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`">
<view class="item flex_col" :class=" item.type == 1 ? 'push':'pull' ">
<image :src="item.pic" mode="aspectFill" class="pic"></image>
<image :src="item.type==1?avatar:item.pic" mode="aspectFill" class="pic"></image>
<view v-if="talkList.length-1==index" class="content multiline-text">
<!-- <rich-text :nodes="item.content"></rich-text> -->
<bing-math v-if="c_content!=''" :key="`math-${item.id}`" class="bing-math" :latex="c_content"></bing-math>
@ -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();
@ -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=农业咨询&timestamp=${Date.now()}`,
method: 'GET',
token: '',
success: res => {
console.log(res, "ws成功连接...")
realThis.wsLiveFlag = true;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB