Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
aixianling
2024-06-17 16:09:27 +08:00
6 changed files with 328 additions and 132 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">
@@ -52,6 +52,13 @@
</div>
</div>
</div>
<!-- <div class="login-btn">
<img src="./img/question-icon.png" alt="">登录
</div> -->
<button class="login-btn" open-type="getPhoneNumber" @getphonenumber="handleAdminLogin">
<img src="./img/question-icon.png" alt="">登录
</button>
<AiLogin ref="login"/>
</div>
</template>
@@ -96,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)
});
@@ -195,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])
@@ -212,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 = ''
@@ -233,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) {
@@ -282,7 +275,14 @@ export default {
innerAudioContext.onStop(() => {
this.messageList[index].isPlay = false
})
}
},
handleAdminLogin({detail: {code: phoneCode}}) {
if (!this.token) {
this.autoLogin({corpId: "ww596787bb70f08288", loginWay: 'admin', phoneCode}).then(() => {
this.getUserInfo()
})
} else this.$u.toast("已登录,无需重新登录!")
},
},
}
</script>
@@ -438,7 +438,6 @@ page {
left: -12px;
}
}
}
.fixed-bottom {
@@ -502,5 +501,31 @@ page {
}
}
}
.login-btn {
position: fixed;
bottom: 500px;
left: 0;
width: 144px;
height: 64px;
background: #B8B8B8;
border-top-right-radius: 44px;
border-bottom-right-radius: 44px;
padding: 12px 16px;
box-sizing: border-box;
line-height: 40px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28px;
color: #FFF;
z-index: 999;
img {
width: 40px;
height: 40px;
vertical-align: bottom;
margin-right: 8px;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -5,11 +5,12 @@
<div class="my-content">
<div class="user-info">
<div class="user-left">
<img src="./img/header-bg.png" alt="" class="user-img">
<img :src="user.avatarUrl" alt="" class="user-img" v-if="user.avatarUrl">
<img src="https://cdn.cunwuyun.cn/dvcp/myFamily/tx.png" alt="" class="user-img" v-else>
</div>
<div class="user-right">
<p>张总</p>
<div>党委书记</div>
<p>{{user.nickName || '微信用户'}}</p>
<div>{{user.departmentName || ''}}</div>
</div>
</div>
<!-- <div class="app-list">
@@ -30,6 +31,12 @@
</div>
</div>
</div> -->
<div class="login" v-if="!token">
<button class="login-btn" open-type="getPhoneNumber" @getphonenumber="handleAdminLogin">授权手机号登录</button>
</div>
<div class="login" v-else @click="onLogout">
<div class="login-btn">退出登录</div>
</div>
</div>
</div>
</template>
@@ -55,11 +62,32 @@
},
onLoad() {
},
methods: {
...mapActions(['autoLogin']),
...mapActions(['autoLogin', 'getUserInfo']),
handleAdminLogin({detail: {code: phoneCode}}) {
if (!this.token) {
this.autoLogin({loginWay: 'admin', phoneCode}).then(() => {
this.getUserInfo()
})
} else this.$u.toast("已登录,无需重新登录!")
},
onLogout() {
uni.showModal({
title: '提示',
content: "是否要退出登录",
success: res => {
if (res.confirm) {
this.$store.commit('logout')
this.$toast('退出成功');
setTimeout(() => {
this.getAuth();
}, 500)
}
}
})
},
}
}
</script>
@@ -141,5 +169,23 @@
}
}
}
.login {
width: 100%;
height: 96px;
padding: 0 32px;
box-sizing: border-box;
line-height: 96px;
text-align: center;
position: fixed;
bottom: 120px;
left: 0;
.login-btn {
background: #4181FF;
border-radius: 16px;
font-size: 34px;
font-weight: 500;
color: #fff;
}
}
}
</style>

View File

@@ -1,131 +1,256 @@
<template>
<div class="AppRecord">
<u-navbar title="Copilot小助理" title-color="#000" title-width="300" title-size="32" :title-bold="true" :background="backgroundNavbar" :is-back="false"></u-navbar>
<div class="list-bg"></div>
<div class="list-content">
<div class="item">
<p class="content">聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情</p>
<div class="bottom-flex">
<div class="time">2024-06-02 10:21:23</div>
<div class="view">
查看对话
<img src="./img/del-icon.png" alt="" class="del-img">
</div>
</div>
</div>
<div class="item">
<p class="content">聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情</p>
<div class="bottom-flex">
<div class="time">2024-06-02 10:21:23</div>
<div class="view">
查看对话
<img src="./img/del-icon.png" alt="" class="del-img">
</div>
</div>
</div>
<div class="item">
<p class="content">聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情聊天详情</p>
<div class="bottom-flex">
<div class="time">2024-06-02 10:21:23</div>
<div class="view">
查看对话
<img src="./img/del-icon.png" alt="" class="del-img">
<div class="list-bg">
<div class="search-content">
<u-search v-model="searchVal" :clearabled="true" placeholder="请输入搜索关键词…" :show-action="false"
bg-color="#fff" search-icon-color="#E2E8F1" color="#666" height="72" @search="getSearchList" @clear="handerClear">
</u-search>
</div>
</div>
<div class="list-content">
<div v-for="(item, index) in messageList" :key="index">
<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">
<u-icon name="play-right-fill" color="#CCE2FF" size="20" v-if="item.userType != 1" class="u-icon-right"></u-icon>
<u-icon name="play-left-fill" color="#F3F5F7" size="20" v-if="item.userType == 1" class="u-icon-left"></u-icon>
<div class="voice-div" v-if="item.sdkFileUrl" @click="play(item.sdkFileUrl, index)">
<span>8</span>
<img src="./img/play-d.gif" alt="" v-if="item.isPlay">
<img src="./img/play-j.png" alt="" v-else>
</div>
<p v-if="!item.sdkFileUrl">{{item.content || ''}}</p>
</div>
<img src="./img/user-img.png" alt="" class="user-img" v-if="item.userType != 1">
</div>
</div>
<AiEmpty v-if="!messageList.length"/>
</div>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: 'AppRecord',
appName: 'Copilot小助理(记录)',
customNavigation: true,
enablePullDownRefresh: true,
data() {
return {
backgroundNavbar: {
background: 'url(https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/header-bg.jpeg) no-repeat',
backgroundSize: 'cover',
},
}
},
computed: {
...mapState(['user', 'token']),
},
onLoad() {
uni.setNavigationBarTitle({
title: 'Copilot小助理记录'
});
},
methods: {
...mapActions(['autoLogin']),
import {mapActions, mapState} from "vuex";
export default {
customNavigation: true,
enablePullDownRefresh: true,
name: 'AppRecord',
appName: 'Copilot小助理(记录)',
data() {
return {
backgroundNavbar: {
background: 'url(https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/header-bg.jpeg) no-repeat',
backgroundSize: 'cover',
},
searchVal: '',
messageList: [
// {
// userType: 0,
// sdkFileUrl: 'http://test87ftp.cunwuyun.cn/20240104/output.mp3',
// isPlay: false
// }
],
current: 1,
pages: 2,
}
}
},
computed: {
...mapState(['user', 'token']),
},
onLoad() {
if(this.token) {
this.getHistoryList()
}else {
return this.$u.toast("请在'个人中心'登录")
}
},
onPullDownRefresh() {
if(this.current > this.pages) {
return this.$u.toast('没有更多记录')
}
this.current = this.current + 1
this.getHistoryList()
},
methods: {
...mapActions(['autoLogin']),
getHistoryList() {
this.$loading()
this.$instance.post(`/app/appaicopilotinfo/list?current=${this.current}&size=10&content=${this.searchVal}`).then(res => {
if(res.code == 0 && res.data.records.length) {
res.data.records.map((item) => {
if(item.sdkFileUrl) {
item.isPlay = false
}
})
this.messageList = this.current == 1 ? res.data.records : [...res.data.records, ...this.messageList]
var idPage = res.data.records.length-1
this.$nextTick(() => {
uni.pageScrollTo({
duration: 300,
selector: this.current == 1 ? `.item${this.messageList.length-1}` : `.item${idPage}`
});
})
this.pages = res.data.pages
this.$hideLoading()
}
})
},
getSearchList() {
this.current = 1
this.getHistoryList()
},
handerClear() {
this.searchVal = ''
this.getSearchList()
},
play(src, index) {
innerAudioContext.stop();
if(this.messageList[index].isPlay) {
innerAudioContext.onStop(() => {
this.messageList[index].isPlay = false
})
return
}
this.messageList.map((item) => {
if(item.sdkFileUrl) {
item.isPlay = false
}
})
this.messageList[index].isPlay = true
innerAudioContext.src = src;
this.$nextTick(() => {
innerAudioContext.play();
})
innerAudioContext.onEnded(() => {
this.messageList[index].isPlay = false
})
},
playStop(index) {
innerAudioContext.stop();
innerAudioContext.onStop(() => {
this.messageList[index].isPlay = false
})
},
},
}
</script>
<style scoped lang="scss">
.AppRecord {
height: 100vh;
background-color: #fff;
position: relative;
.list-bg {
<style lang="scss" scoped>
@import "~dvcp-wui/common";
page {
height: 100%;
}
.AppRecord {
height: 100vh;
background-color: #fff;
position: relative;
.list-bg {
width: 100%;
height: 420px;
background-image: url("https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/content-top-bg.png");
position: fixed;
top: 184px;
left: 0;
z-index: 1;
background-size: 100vw;
background-repeat: no-repeat;
.search-content {
padding: 32px;
width: 100%;
height: 420px;
background-image: url("https://cdn.cunwuyun.cn/wechat/biaopin/residentAssistant/content-top-bg.png");
box-sizing: border-box;
position: fixed;
top: 184px;
left: 0;
z-index: 1;
background-size: 100vw;
background-repeat: no-repeat;
z-index: 99;
background: linear-gradient(to bottom, #D7EDFE, #EAF5FE);
}
.list-content {
}
.list-content {
width: 100%;
box-sizing: border-box;
background-color: #fff;
padding: 144px 32px 364px;
.send-time {
display: block;
width: 100%;
line-height: 28px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 20px;
color: #999;
text-align: center;
margin-bottom: 28px;
}
.user-img {
display: inline-block;
width: 72px;
height: 72px;
vertical-align: top;
}
.item {
display: inline-block;
max-width: 440px;
border-radius: 8px;
padding: 18px;
box-sizing: border-box;
background-color: #fff;
padding: 0 32px;
.item {
margin-bottom: 16px;
.content {
padding: 18px;
background: #CCE2FF;
border-radius: 8px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28px;
margin-bottom: 28px;
position: relative;
.voice-div {
img {
width: 26px;
height: 28px;
}
span {
display: inline-block;
color: #333;
line-height: 40px;
word-break: break-all;
margin-bottom: 34px;
}
.bottom-flex {
display: flex;
justify-content: space-between;
line-height: 40px;
font-family: PingFangSC-Regular;
font-size: 24px;
.time {
color: #999;
}
.view {
color: #216AFD;
.del-img {
width: 40px;
height: 40px;
margin-left: 40px;
vertical-align: bottom;
}
}
font-size: 28px;
font-family: PingFangSC;
line-height: 28px;
margin-right: 68px;
}
}
p {
word-break: break-all;
line-height: 40px;
font-family: SourceHanSansCN-Regular;
font-size: 32px;
color: #333;
}
}
.item-right {
display: flex;
justify-content: flex-end;
.item {
background-color: #CCE2FF;
}
.user-img {
margin-left: 24px;
}
.u-icon-right {
position: absolute;
top: 12px;
right: -12px;
}
}
.item-left {
.item {
background-color: #F3F5F7;
}
.user-img {
margin-right: 24px;
}
.u-icon-left {
position: absolute;
top: 12px;
left: -12px;
}
}
}
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB