Browse Source

Merge branch 'milestone-20251031-简版功能开发' of http://39.101.133.168:8807/qimaohong/deepChartVueApp into milestone-20251031-简版功能开发

lihuilin/feature-20251024095243-我的
ZhangYong 4 weeks ago
parent
commit
6b995ce7a7
  1. 13
      api/deepExploration/deepExploration.js
  2. 253
      components/deepExploration_header.vue
  3. 2
      pages/deepMate/deepMate.vue
  4. 5
      pages/setting/account.vue
  5. 6
      pages/start/Registration/Registration.vue
  6. 7
      pages/start/login/login.vue
  7. 2
      pages/start/recoverPassword/recoverPassword.vue
  8. 2
      pages/start/select/select.vue
  9. 4
      utils/http.js

13
api/deepExploration/deepExploration.js

@ -73,3 +73,16 @@ export const getModel4Second = (data) => {
data data
}) })
} }
//历史记录列表
export const RecordListApi = (data) => {
return http({
method: 'POST',
url: '/api/coze/mainForceList',
data:data
})
}

253
components/deepExploration_header.vue

@ -1,52 +1,81 @@
<template> <template>
<view class="titleContent"> <view class="titleContent">
<view class="left"> <view class="left">
<uni-icons @click="handleBack" type="back" size="23" color="#111"></uni-icons>
<uni-icons
@click="handleBack"
type="back"
size="23"
color="#111"
></uni-icons>
</view> </view>
<view class="title">深度探索</view> <view class="title">深度探索</view>
<view class="right"> <view class="right">
<image class="notice" src="/static/deepExploration-images/notice.png" mode="aspectFill"></image>
<image @click="handleHistory" class="history" src="/static/deepExploration-images/history.png"
mode="aspectFill"></image>
<image
class="notice"
src="/static/deepExploration-images/notice.png"
mode="aspectFill"
></image>
<image
@click="openHistoryDrawer"
class="history"
src="/static/deepExploration-images/history.png"
mode="aspectFill"
></image>
</view> </view>
</view> </view>
<view class="drawer-overlay" v-show="showHistoryDrawer"></view> <view class="drawer-overlay" v-show="showHistoryDrawer"></view>
<view class="drawer-panel" v-show="showHistoryDrawer" @click.stop @touchmove.stop.prevent
:style="{ transform: 'translateY(' + drawerOffsetY + 'px)' }">
<view
class="drawer-panel"
v-show="showHistoryDrawer"
@click.stop
@touchmove.stop.prevent
:style="{ transform: 'translateY(' + drawerOffsetY + 'px)' }"
>
<view class="drawer-header"> <view class="drawer-header">
<text class="drawer-title">历史对话</text> <text class="drawer-title">历史对话</text>
<view class="drawer-actions"> <view class="drawer-actions">
<view class="delete-all-container"> <view class="delete-all-container">
<image class="delete-icon" src="/static/deepExploration-images/delete.png"></image>
<image
class="delete-icon"
src="/static/icons/Group_48095481.svg"
></image>
<text class="delete-all" @click="clearAllHistory">删除全部</text> <text class="delete-all" @click="clearAllHistory">删除全部</text>
</view> </view>
<view class="drawer-close" @click="closeHistoryDrawer">
<image src="/static/deepExploration-images/close.png" mode="aspectFill"></image>
</view>
<view class="drawer-close" @click="onDrawerBackClick"
><text class="drawer-close-icon"></text
></view>
</view> </view>
</view> </view>
<scroll-view scroll-y="true" class="drawer-content"> <scroll-view scroll-y="true" class="drawer-content">
<view class="drawer-inner"> <view class="drawer-inner">
<view v-if="historyList.length === 0" class="empty-history">
<view v-if="groupedHistory.length === 0" class="empty-history">
<text>暂无历史记录</text> <text>暂无历史记录</text>
</view> </view>
<view v-for="(section, sIdx) in historyList" :key="sIdx" class="history-section">
<view
v-for="(section, sIdx) in groupedHistory"
:key="sIdx"
class="history-section"
>
<text class="section-title">{{ section.title }}</text> <text class="section-title">{{ section.title }}</text>
<view v-for="(item, idx) in section.items" :key="idx" class="history-item">
<view
v-for="(item, idx) in section.items"
:key="idx"
class="history-item"
>
<view class="history-left"> <view class="history-left">
<view class="flag-circle">
<image :src="item.icon" mode="aspectFill"></image>
</view>
<view class="flag-circle"
><text class="flag-emoji">🇺🇸</text></view
>
</view> </view>
<view class="history-main" @click="itemClick(item)"> <view class="history-main" @click="itemClick(item)">
<text class="history-query">{{ item.stockName }}</text> <text class="history-query">{{ item.stockName }}</text>
<text class="history-query">{{ item.stockCode }}</text> <text class="history-query">{{ item.stockCode }}</text>
</view> </view>
<text class="history-time">{{ item.createdTime }}</text>
<text class="history-time">{{
formatTimeForHistory(item.createdTime)
}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -55,45 +84,63 @@
</template> </template>
<script setup> <script setup>
import {
ref,
onMounted
} from 'vue'
import { RecordListApi } from "../api/deepExploration/deepExploration";
import { ref, onMounted, computed } from "vue";
const props = defineProps({ const props = defineProps({
name: { name: {
type: String, type: String,
default: ''
}
})
const showHistoryDrawer = ref(false)
default: "",
},
});
const showHistoryDrawer = ref(false);
const drawerOffsetY = ref(0); const drawerOffsetY = ref(0);
const handleHistory = () => {
showHistoryDrawer.value = true
// const handleHistory = () => {
// showHistoryDrawer.value = true;
// };
//
const openHistoryDrawer = async () => {
const res = await RecordListApi({
model: 1,
});
if (res.code === 200) {
historyList.value = res.data;
} }
const clearAllHistory = () => {
uni.setStorageSync("search_history", []);
console.log("historyList.value", historyList.value);
const hideDistance = uni.upx2px(900);
drawerOffsetY.value = hideDistance;
showHistoryDrawer.value = true;
setTimeout(() => {
drawerOffsetY.value = 0;
}, 10);
}; };
const clearAllHistory = () => {
searchHistory.value = [];
// uni.setStorageSync("search_history", []);
};
// //
const handleBack = () => { const handleBack = () => {
uni.navigateBack()
}
uni.navigateBack();
};
const closeHistoryDrawer = () => { const closeHistoryDrawer = () => {
showHistoryDrawer.value = false; showHistoryDrawer.value = false;
}; };
// const onDrawerBackClick = () => {
// const hideDistance = uni.upx2px(900);
// drawerOffsetY.value = hideDistance;
// setTimeout(() => {
// closeHistoryDrawer();
// drawerOffsetY.value = 0;
// }, 180);
// };
const onDrawerBackClick = () => {
const hideDistance = uni.upx2px(900);
drawerOffsetY.value = hideDistance;
setTimeout(() => {
closeHistoryDrawer();
drawerOffsetY.value = 0;
}, 180);
};
// //
async function itemClick(item) { async function itemClick(item) {
@ -102,7 +149,6 @@
// parentId: item.parentId, // parentId: item.parentId,
// model: 5, // model: 5,
// }); // });
// if (res.code == 200) { // if (res.code == 200) {
// const message = res.data.wokeFlowData.One.markdown; // const message = res.data.wokeFlowData.One.markdown;
// messages.value = []; // messages.value = [];
@ -115,37 +161,122 @@
// messages.value.push(botMsg); // messages.value.push(botMsg);
// } // }
} }
const historyList = ref([{
const historyList = ref([
{
title: "今天", // title: "今天", //
items: [{
icon: '/static/deepExploration-images/Americle.png',
items: [
{
icon: "/static/deepExploration-images/Americle.png",
stockName: "TechCore", // stockName: "TechCore", //
stockCode: "600001", // 6 stockCode: "600001", // 6
createdTime: "14:35" // :
createdTime: "14:35", // :
}, },
{ {
icon: '/static/deepExploration-images/Americle.png',
icon: "/static/deepExploration-images/Americle.png",
stockName: "MediaLink", stockName: "MediaLink",
stockCode: "600002", stockCode: "600002",
createdTime: "10:12"
}
]
createdTime: "10:12",
},
],
}, },
{ {
title: "昨天", title: "昨天",
items: [{
icon: '/static/deepExploration-images/Americle.png',
items: [
{
icon: "/static/deepExploration-images/Americle.png",
stockName: "FinServ", stockName: "FinServ",
stockCode: "600003", stockCode: "600003",
createdTime: "09:48"
}]
}
createdTime: "09:48",
},
],
},
]); ]);
onMounted(() => {
// YYYY-MM-DD HH:mm
const formatTimeForHistory = (timeString) => {
// timeString "YYYY-MM-DD HH:mm:ss"
const parts = timeString.split(" ");
if (parts.length >= 2) {
const datePart = parts[0];
const timePart = parts[1];
const timeParts = timePart.split(":");
if (timeParts.length >= 2) {
return `${datePart} ${timeParts[0]}:${timeParts[1]}`;
}
}
return timeString;
};
})
// ///
const groupedHistory = computed(() => {
const sections = [];
// 使
const now = new Date();
const startOfDay = (d) =>
new Date(d.getFullYear(), d.getMonth(), d.getDate());
const isSameDay = (a, b) =>
startOfDay(a).getTime() === startOfDay(b).getTime();
const isYesterday = (d) => {
const y = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
return isSameDay(d, y);
};
const isToday = (d) => isSameDay(d, now);
const withinLast7Days = (d) => {
const seven = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() - 7
);
return d >= seven && !isToday(d) && !isYesterday(d);
};
const monthLabel = (d) => `${d.getMonth() + 1}`;
const today = [];
const yesterday = [];
const last7 = [];
const byMonth = new Map();
// 使 historyList.value searchHistory.value
historyList.value.forEach((item) => {
// 使 createdTime
const dt = new Date(item.createdTime);
if (isToday(dt)) {
today.push(item);
} else if (isYesterday(dt)) {
yesterday.push(item);
} else if (withinLast7Days(dt)) {
last7.push(item);
} else {
const year = dt.getFullYear();
const month = dt.getMonth() + 1;
const key = `${year}-${month}`;
if (!byMonth.has(key))
byMonth.set(key, {
title: `${year}${month}`,
year,
month,
items: [],
});
byMonth.get(key).items.push(item);
}
});
if (today.length) sections.push({ title: "今天", items: today });
if (yesterday.length) sections.push({ title: "昨天", items: yesterday });
if (last7.length) sections.push({ title: "近一周", items: last7 });
const monthSections = Array.from(byMonth.values()).sort((a, b) => {
if (a.year !== b.year) return b.year - a.year;
return b.month - a.month; // 10 9
});
sections.push(...monthSections);
return sections;
});
onMounted(() => {});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -177,7 +308,6 @@
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
line-height: 25px; line-height: 25px;
} }
.right { .right {
@ -199,8 +329,6 @@
} }
} }
/* 搜索历史侧拉框样式 */ /* 搜索历史侧拉框样式 */
.drawer-overlay { .drawer-overlay {
position: fixed; position: fixed;
@ -272,6 +400,7 @@
} }
.drawer-close { .drawer-close {
background: url("../static/icons/关闭2.svg");
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
border-radius: 24rpx; border-radius: 24rpx;
@ -287,7 +416,6 @@
} }
} }
.drawer-header { .drawer-header {
display: flex; display: flex;
align-items: center; align-items: center;
@ -361,7 +489,6 @@
} }
} }
.history-main { .history-main {
flex: 1; flex: 1;
} }

2
pages/deepMate/deepMate.vue

@ -316,7 +316,7 @@ const renderMarkdown = (content) => {
return marked.parse(content); return marked.parse(content);
}; };
const type = ref("member");
const type = ref("deepMate");
const inputMessage = ref(""); const inputMessage = ref("");
const showThinking = ref(true); const showThinking = ref(true);
const isSending = ref(false); const isSending = ref(false);

5
pages/setting/account.vue

@ -71,11 +71,16 @@
ref, ref,
onMounted onMounted
} from 'vue' } from 'vue'
import {useUserStore} from "../../stores/modules/userInfo"
const iSMT = ref(0) const iSMT = ref(0)
const jwcode = ref('90047681') const jwcode = ref('90047681')
const showLogout = ref(false) const showLogout = ref(false)
const userStore = useUserStore()
const handleConfirmLogout = () => { const handleConfirmLogout = () => {
userStore.clearUserInfo()
showLogout.value = false showLogout.value = false
uni.showToast({ uni.showToast({
title: '退出登录成功', title: '退出登录成功',

6
pages/start/Registration/Registration.vue

@ -197,8 +197,9 @@ import {
SendEmailCodeApi, SendEmailCodeApi,
SendPhoneCodeApi, SendPhoneCodeApi,
} from "../../../api/start/login"; } from "../../../api/start/login";
import { useDeviceStore} from "../../../stores/modules/deviceInfo"
const type = ref("member");
const type = ref("");
const email = ref(""); const email = ref("");
const password = ref(""); const password = ref("");
const phone = ref(""); const phone = ref("");
@ -271,11 +272,14 @@ async function register() {
const registerType = changeLoginType(); const registerType = changeLoginType();
isLoading.value = true; isLoading.value = true;
const deviceStore = useDeviceStore()
const res = await registerApi({ const res = await registerApi({
registerType: registerType, registerType: registerType,
account: account, account: account,
verifyCode: verifyCode.value, verifyCode: verifyCode.value,
agree: agreed.value, agree: agreed.value,
deviceId:deviceStore.deviceInfo.deviceId
}); });
isLoading.value = false; isLoading.value = false;

7
pages/start/login/login.vue

@ -266,9 +266,10 @@ import {
} from "../../../api/start/login"; } from "../../../api/start/login";
import { useUserStore } from "../../../stores/modules/userInfo"; import { useUserStore } from "../../../stores/modules/userInfo";
import { useDeviceStore } from "../../../stores/modules/deviceInfo";
const deepChartID = ref(""); const deepChartID = ref("");
const type = ref("member");
const type = ref("");
const email = ref(""); const email = ref("");
const password = ref(""); const password = ref("");
const country = ref("+86"); const country = ref("+86");
@ -347,6 +348,8 @@ async function Login() {
return; return;
} }
const deviceStore = useDeviceStore();
const account = changeAccount(); const account = changeAccount();
const loginType = changeLoginType(); const loginType = changeLoginType();
isLoading.value = true; isLoading.value = true;
@ -357,6 +360,7 @@ async function Login() {
password: password.value, password: password.value,
useCode: verifyCode.value ? true : false, useCode: verifyCode.value ? true : false,
idToken: "", idToken: "",
deviceId: deviceStore.deviceInfo.deviceId,
}); });
isLoading.value = false; isLoading.value = false;
@ -815,7 +819,6 @@ function validatePhoneNumber(countryCode, phoneNumber) {
} }
} }
.back-btn, .back-btn,
.headphone-btn { .headphone-btn {
font-size: 36rpx; font-size: 36rpx;

2
pages/start/recoverPassword/recoverPassword.vue

@ -237,7 +237,7 @@ import uniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-po
import { verificationPhone, verificationEmail } from "../login/verification"; import { verificationPhone, verificationEmail } from "../login/verification";
import { SendEmailCodeApi, SendPhoneCodeApi } from "../../../api/start/login"; import { SendEmailCodeApi, SendPhoneCodeApi } from "../../../api/start/login";
const type = ref("member");
const type = ref("");
const email = ref(""); const email = ref("");
const password = ref(""); const password = ref("");
const newPasswordFirst = ref(""); const newPasswordFirst = ref("");

2
pages/start/select/select.vue

@ -26,7 +26,7 @@ import footerBar from "../../../components/footerBar";
import { ref, reactive, toRefs, watch } from "vue"; import { ref, reactive, toRefs, watch } from "vue";
const type = ref("member");
const type = ref("");
function toRegistration() { function toRegistration() {
uni.redirectTo({ uni.redirectTo({

4
utils/http.js

@ -39,12 +39,12 @@ const httpInterceptor = {
'contentType': 'application/json', 'contentType': 'application/json',
'version': '1', 'version': '1',
'client': client, 'client': client,
'deviceId': deviceInfo.deviceId
'deviceId': deviceInfo.deviceInfo.deviceId
} }
//4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致 //4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致
const memberStore = useUserStore() const memberStore = useUserStore()
const token = memberStore.userInfo?.token || options.data?.token const token = memberStore.userInfo?.token || options.data?.token
// const token = 'dccec0b65a94f498b8183a17589ab16e'
// const token = '1b3a58424c5324e40d4bf4d085e18047'
if (token) { if (token) {
options.header.token = token options.header.token = token
} }

Loading…
Cancel
Save