Copilot小助理

This commit is contained in:
liuye
2024-06-17 10:44:55 +08:00
parent d0727f8991
commit e2e3f35e17
4 changed files with 237 additions and 126 deletions

View File

@@ -2,7 +2,7 @@
<div class="AppDialogue">
<u-navbar title="Copilot小助理" title-color="#000" title-width="300" title-size="32" :title-bold="true" :background="backgroundNavbar" :is-back="false"></u-navbar>
<!-- <scroll-view scroll-y="true" class="scroll-Y" @scroll="scroll"> -->
<!-- <div class="service-content">
<!-- <div class="service-content" v-if="!messageList.length">
<div class="text-content">
<div class="text-left">
<div>你好呀</div>
@@ -15,7 +15,7 @@
<div class="list-bg"></div>
<div class="list-content">
<div v-for="(item, index) in messageList" :key="index">
<div class="send-time">6-8 10:31</div>
<div class="send-time">{{item.createTime.substring(5, 16)}}</div>
<div :class="item.userType == 1 ? 'item-left' : 'item-right'">
<img src="./img/user-img.png" alt="" class="user-img" v-if="item.userType == 1">
<div class="item" :class="'item'+index">
@@ -103,23 +103,9 @@ export default {
...mapState(['user', 'token']),
},
onLoad() {
this.autoLogin().then(() => {
if(this.token) {
this.getHistoryList()
// uni.getLocation({
// type: 'wgs84', // 返回可以用于uni.openLocation的经纬度默认为wgs84的gps坐标
// success : (res) => {
// let location = `${res.latitude}, ${res.longitude}`
// this.$instance.post(`/admin/area/reverseGeocoding?location=${location}`).then(res => {
// if(res && res.code == 0){
// this.areaId = res.data.result.addressComponent.adcode + '000000'
// }
// })
// },
// fail: (error) => {
// console.log('获取位置失败:', error);
// }
// });
})
}
recorderManager.onStop((res)=> {
this.upLoad(res.tempFilePath)
});
@@ -202,7 +188,7 @@ export default {
},
sendMsg() {
this.$loading()
this.$instance.post("/app/appaigccopilotinfo/add", {content: this.content, appType: 0, areaId: this.areaId}).then(res => {
this.$instance.post("/app/appaicopilotinfo/add", {content: this.content, appType: 0, areaId: this.areaId}).then(res => {
if(res.code == 0) {
this.content = ''
this.messageList.push(res.data[0])
@@ -219,7 +205,7 @@ export default {
},
sendVoice() {
this.$loading()
this.$instance.post("/app/appaigccopilotinfo/add", {sdkFileUrl: this.voiceUrl, fileId: this.voiceId, appType: 0}).then(res => {
this.$instance.post("/app/appaicopilotinfo/add", {sdkFileUrl: this.voiceUrl, fileId: this.voiceId, appType: 0}).then(res => {
if(res.code == 0) {
this.voiceUrl = ''
this.voiceId = ''
@@ -240,7 +226,7 @@ export default {
},
getHistoryList() {
this.$loading()
this.$instance.post(`/app/appaigccopilotinfo/list?current=${this.current}&size=10`).then(res => {
this.$instance.post(`/app/appaicopilotinfo/list?current=${this.current}&size=10`).then(res => {
if(res.code == 0 && res.data.records.length) {
res.data.records.map((item) => {
if(item.sdkFileUrl) {
@@ -292,7 +278,7 @@ export default {
},
handleAdminLogin({detail: {code: phoneCode}}) {
if (!this.token) {
this.autoLogin({loginWay: 'admin', phoneCode}).then(() => {
this.autoLogin({corpId: "ww596787bb70f08288", loginWay: 'admin', phoneCode}).then(() => {
this.getUserInfo()
})
} else this.$u.toast("已登录,无需重新登录!")