feat: 更新首页功能,添加消息发送功能,修改接口地址,优化样式
This commit is contained in:
parent
5427c79fe7
commit
504b50f16b
2
App.vue
2
App.vue
|
@ -242,7 +242,7 @@ export default {
|
|||
.catch((err) => {
|
||||
});
|
||||
//初始化获取定位
|
||||
this.getLocation()
|
||||
// this.getLocation()
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.CharLogin()
|
||||
|
|
|
@ -90,6 +90,9 @@ const install = (Vue, vm) => {
|
|||
//【管理端】获取当前是否开启匿名 开启true 关闭false
|
||||
let CheckNM = (params = {}) => vm.$u.get("/app/My/CheckNM", params)
|
||||
|
||||
// 发送消息
|
||||
let SendMessageApi = (params = {}) => vm.$u.post('api/ChatAI/CreateChat', params);
|
||||
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = {
|
||||
LoginApp,
|
||||
|
@ -128,7 +131,8 @@ const install = (Vue, vm) => {
|
|||
getAPIToken,
|
||||
getVerifyInfo,
|
||||
getInfoByCard,
|
||||
updateCard
|
||||
updateCard,
|
||||
SendMessageApi
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ const install = (Vue, vm) => {
|
|||
Vue.prototype.$u.http.setConfig({
|
||||
// baseUrl: 'https://xy.apps.service.zheke.com',
|
||||
// imgUrl: 'https://xy.apps.service.zheke.com/',
|
||||
baseUrl: 'http://sl.vrgon.com:8003',
|
||||
imgUrl: 'http://sl.vrgon.com:8003/',
|
||||
baseUrl: 'http://120.55.234.65:8082',
|
||||
imgUrl: 'http://120.55.234.65:8082/',
|
||||
// imgUrl:'http://115.238.47.235:8987/',
|
||||
// baseUrl: 'http://115.238.47.235:8993',
|
||||
// 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data
|
||||
|
|
|
@ -156,7 +156,10 @@
|
|||
<view class="chat-footer">
|
||||
<!-- 悬浮工具栏 -->
|
||||
<view class="floating-tabs">
|
||||
<view class="tab-item">
|
||||
<view
|
||||
class="tab-item"
|
||||
@click="handleFeatureClick({ title: '招生在线' })"
|
||||
>
|
||||
<image
|
||||
class="tab-icon"
|
||||
src="/static/common/images/icon_admissions2.png"
|
||||
|
@ -165,7 +168,10 @@
|
|||
|
||||
<text>招生在线</text>
|
||||
</view>
|
||||
<view class="tab-item">
|
||||
<view
|
||||
class="tab-item"
|
||||
@click="handleFeatureClick({ title: '留言板' })"
|
||||
>
|
||||
<image
|
||||
class="tab-icon"
|
||||
src="/static/common/images/icon_messageBoard2.png"
|
||||
|
@ -173,7 +179,10 @@
|
|||
/>
|
||||
<text>留言板</text>
|
||||
</view>
|
||||
<view class="tab-item">
|
||||
<view
|
||||
class="tab-item"
|
||||
@click="handleFeatureClick({ title: '电话咨询' })"
|
||||
>
|
||||
<image
|
||||
class="tab-icon"
|
||||
src="/static/common/images/icon_phone2.png"
|
||||
|
@ -186,12 +195,14 @@
|
|||
<view class="input-container">
|
||||
<view class="input-area">
|
||||
<input
|
||||
v-model="messageValue"
|
||||
type="text"
|
||||
class="chat-input"
|
||||
placeholder="请输入内容"
|
||||
placeholder-style="color: #adadad;"
|
||||
@confirm="sendMessageFn"
|
||||
/>
|
||||
<view class="send-btn">
|
||||
<view class="send-btn" @click="sendMessageFn">
|
||||
<image
|
||||
class="send-icon"
|
||||
src="/static/common/images/icon_send.png"
|
||||
|
@ -257,6 +268,9 @@
|
|||
|
||||
<!-- 咨询电话弹出层 -->
|
||||
<advice-phone :show.sync="advicePhoneShow"></advice-phone>
|
||||
|
||||
<!-- 提示 -->
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -323,27 +337,46 @@ export default {
|
|||
],
|
||||
scrollToView: "",
|
||||
messageGroups: [
|
||||
// {
|
||||
// time: "2025-07-01 10:00:00",
|
||||
// messages: [
|
||||
// { id: 1, content: "学校哪些专业比较好?", isUser: true },
|
||||
// {
|
||||
// id: 2,
|
||||
// content:
|
||||
// "我校有多个优势学科,包括计算机科学与技术、电子信息工程、机械工程、生物医学工程等。这些专业在国内都有较高的学术声誉和就业率。如果您对某个具体专业感兴趣,可以进一步咨询更多详情。",
|
||||
// isUser: false,
|
||||
// },
|
||||
// { id: 3, content: "计算机科学专业就业前景如何?", isUser: true },
|
||||
// {
|
||||
// id: 4,
|
||||
// content:
|
||||
// "计算机科学专业的就业前景非常好。根据最新数据,我校计算机专业毕业生就业率超过95%,平均起薪在全校名列前茅。主要就业方向包括互联网公司、IT企业、金融科技等领域,担任软件工程师、数据分析师、产品经理等职位。",
|
||||
// isUser: false,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// time: "2025-07-02 09:15:36",
|
||||
// messages: [
|
||||
// { id: 5, content: "新生报到流程", isUser: true },
|
||||
// {
|
||||
// id: 6,
|
||||
// content:
|
||||
// "新生报到流程:个人信息完善 --预报到 -- 照片信息采集 --缴费 --入校验审 -- 人脸识别 --打印报到单",
|
||||
// isUser: false,
|
||||
// },
|
||||
// { id: 7, content: "预报到需要准备哪些材料?", isUser: true },
|
||||
// {
|
||||
// id: 8,
|
||||
// content:
|
||||
// "预报到需要准备以下材料:\n1. 身份证原件及复印件\n2. 录取通知书原件\n3. 2寸蓝底证件照4张\n4. 学籍档案(密封)\n5. 党团关系材料(如有)\n\n建议提前准备齐全,以便快速完成报到流程。",
|
||||
// isUser: false,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
time: "2025-07-01 10:00:00",
|
||||
messages: [
|
||||
{ id: 1, content: "学校哪些专业比较好?", isUser: true },
|
||||
{
|
||||
id: 2,
|
||||
content:
|
||||
"我校有多个优势学科,包括计算机科学与技术、电子信息工程、机械工程、生物医学工程等。这些专业在国内都有较高的学术声誉和就业率。如果您对某个具体专业感兴趣,可以进一步咨询更多详情。",
|
||||
isUser: false,
|
||||
},
|
||||
{ id: 3, content: "计算机科学专业就业前景如何?", isUser: true },
|
||||
{
|
||||
id: 4,
|
||||
content:
|
||||
"计算机科学专业的就业前景非常好。根据最新数据,我校计算机专业毕业生就业率超过95%,平均起薪在全校名列前茅。主要就业方向包括互联网公司、IT企业、金融科技等领域,担任软件工程师、数据分析师、产品经理等职位。",
|
||||
isUser: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
time: "2025-07-02 09:15:36",
|
||||
time: "",
|
||||
messages: [
|
||||
{ id: 5, content: "新生报到流程", isUser: true },
|
||||
{
|
||||
|
@ -352,17 +385,12 @@ export default {
|
|||
"新生报到流程:个人信息完善 --预报到 -- 照片信息采集 --缴费 --入校验审 -- 人脸识别 --打印报到单",
|
||||
isUser: false,
|
||||
},
|
||||
{ id: 7, content: "预报到需要准备哪些材料?", isUser: true },
|
||||
{
|
||||
id: 8,
|
||||
content:
|
||||
"预报到需要准备以下材料:\n1. 身份证原件及复印件\n2. 录取通知书原件\n3. 2寸蓝底证件照4张\n4. 学籍档案(密封)\n5. 党团关系材料(如有)\n\n建议提前准备齐全,以便快速完成报到流程。",
|
||||
isUser: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
scrollTop: 0,
|
||||
|
||||
messageValue: "", // 输入框内容
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -389,6 +417,12 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
handleLeftClick() {
|
||||
this.$refs.uToast.show({
|
||||
title: "暂未开放",
|
||||
type: "warning",
|
||||
});
|
||||
|
||||
return;
|
||||
this.popupShow = true;
|
||||
},
|
||||
selectChatItem(index) {
|
||||
|
@ -422,19 +456,58 @@ export default {
|
|||
handleFeatureClick(item) {
|
||||
if (item.title === "电话咨询") {
|
||||
this.advicePhoneShow = true;
|
||||
} else if (item.title === "招办在线") {
|
||||
uni.navigateTo({
|
||||
url: "/pages/home/admissions/index",
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: "暂未开放",
|
||||
type: "warning",
|
||||
});
|
||||
} else if (item.title === "留言板") {
|
||||
// this.leaveMessageShow = true;
|
||||
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
sendMessageFn() {
|
||||
if (!this.messageValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sendMessage = this.messageValue;
|
||||
|
||||
console.log("发送消息", sendMessage);
|
||||
this.messageGroups[0].messages.push({
|
||||
id: this.messageGroups[0].messages.length + 1,
|
||||
content: sendMessage,
|
||||
isUser: true,
|
||||
});
|
||||
this.messageValue = "";
|
||||
|
||||
this.$u.api
|
||||
.SendMessageApi({
|
||||
query: sendMessage,
|
||||
conversationId: "",
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("res.....", res);
|
||||
this.messageGroups[0].messages.push({
|
||||
id: res.messageId,
|
||||
content: res.content,
|
||||
isUser: false,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-image: url("/static/common/images/images_bg.png");
|
||||
width: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
background-position: 0 88rpx;
|
||||
}
|
||||
|
||||
.home-container {
|
||||
height: 100vh;
|
||||
// background-color: #f5f7fc;
|
||||
|
@ -443,12 +516,6 @@ export default {
|
|||
); /* 为自定义tabBar预留空间 */
|
||||
padding-top: 88rpx;
|
||||
|
||||
background-image: url("/static/common/images/images_bg.png");
|
||||
width: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
background-position: 0 88rpx;
|
||||
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
@ -832,7 +899,7 @@ export default {
|
|||
border-radius: 16rpx 0 16rpx 16rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
text-align: right;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue