完善农业咨询小程序

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> <script>
export default { export default {
onLaunch: function() { onLaunch: function(info) {
console.log('App Launch') 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() { onShow: function() {
console.log('App Show') console.log('App Show');
}, },
onHide: function() { onHide: function() {
console.log('App Hide') console.log('App Hide');
} }
} }
</script> </script>

View File

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

View File

@ -3,16 +3,10 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "讯飞AI", "navigationBarTitleText": "农业咨询",
"bounce": "none" "bounce": "none"
// "softinputMode": "adjustResize" // "softinputMode": "adjustResize"
} }
}, {
"path": "pages/index/chat",
"style": {
"navigationBarTitleText": "讯飞星火",
"bounce": "none"
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@ -7,7 +7,7 @@
<view class="talk-list"> <view class="talk-list">
<view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`"> <view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`">
<view class="item flex_col" :class=" item.type == 1 ? 'push':'pull' "> <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"> <view v-if="talkList.length-1==index" class="content multiline-text">
<!-- <rich-text :nodes="item.content"></rich-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> <bing-math v-if="c_content!=''" :key="`math-${item.id}`" class="bing-math" :latex="c_content"></bing-math>
@ -65,6 +65,7 @@
content: '', content: '',
c_content: '', c_content: '',
n_content: '', n_content: '',
avatar: '/static/avatar.png', //
params: [], // params: [], //
timer: '', timer: '',
socketTask: {}, 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() { beforeDestroy() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
uni.offKeyboardHeightChange(); uni.offKeyboardHeightChange();
@ -299,15 +307,16 @@
"id": new Date().getTime(), "id": new Date().getTime(),
"content": this.content, "content": this.content,
"type": 1, "type": 1,
"pic": "/static/avatar.png" "pic": this.avatar
} }
console.log(data);
this.TEXT = this.content; this.TEXT = this.content;
this.talkList.push(data); this.talkList.push(data);
this.talkList.push({ this.talkList.push({
"id": new Date().getTime(), "id": new Date().getTime(),
"content": '', "content": '',
"type": 2, "type": 2,
"pic": "/static/avatar.png" "pic": "/static/icon/ny.png"
}); });
this.n_content = ''; this.n_content = '';
this.c_content = ''; this.c_content = '';
@ -330,8 +339,9 @@
let realThis = this; let realThis = this;
this.socketTask = uni.connectSocket({ this.socketTask = uni.connectSocket({
//url: encodeURI(encodeURI(myUrl).replace(/\+/g, '%2B')), //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', method: 'GET',
token: '',
success: res => { success: res => {
console.log(res, "ws成功连接...") console.log(res, "ws成功连接...")
realThis.wsLiveFlag = true; 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