refactor: fix routing, update APIs and clean up miscellaneous code

- add mitt-based event emitter utility in src/utils/events.ts
- replace deprecated navigateTo calls with vue router push across multiple components
- fix incorrect API function name (updateImageFile → uploadFile) in CreateServiceOrder
- correct typo in imported function name in AnswerComponent
- temporarily disable location fetch logic in Discovery page
- update external link token handling in LongTextGuideCardPreview
This commit is contained in:
DEV_DSW
2026-05-27 08:55:37 +08:00
parent fbc5137d17
commit 9282b2a9c5
8 changed files with 42 additions and 24 deletions

View File

@@ -73,7 +73,7 @@
import { ref, computed, onMounted, nextTick, defineProps, watch } from "vue"; import { ref, computed, onMounted, nextTick, defineProps, watch } from "vue";
import { SCROLL_TO_BOTTOM } from "@/constants/constant"; import { SCROLL_TO_BOTTOM } from "@/constants/constant";
import { createWorkOrder } from "@/api/workOrder"; import { createWorkOrder } from "@/api/workOrder";
import { updateImageFile } from "@/api/upload"; import { uploadFile } from "@/api/upload";
import { zniconsMap } from "@/assets/fonts/znicons"; import { zniconsMap } from "@/assets/fonts/znicons";
const props = defineProps({ const props = defineProps({
@@ -148,7 +148,7 @@ const updateImagehandle = (file) => {
if (!file) { if (!file) {
return; return;
} }
updateImageFile(file).then((res) => { uploadFile(file).then((res) => {
contentImgUrl.value = res.data; contentImgUrl.value = res.data;
}); });
}; };

View File

@@ -21,7 +21,7 @@
<script setup> <script setup>
import { getAccessToken } from "@/constants/token"; import { getAccessToken } from "@/constants/token";
import { defineProps, computed } from "vue"; import { defineProps, computed } from "vue";
import { navigateTo } from "../../router"; // import { navigateTo } from "../../router";
const props = defineProps({ const props = defineProps({
toolCall: { toolCall: {
@@ -40,7 +40,12 @@ const surveyData = computed(() => {
const handleCall = () => { const handleCall = () => {
const token = getAccessToken(); const token = getAccessToken();
navigateTo(surveyData.value.jumpUrl, { token: token }); router.push({
path: surveyData.value.jumpUrl,
query: {
token: token,
},
});
}; };
</script> </script>

View File

@@ -35,7 +35,7 @@ import ChatMarkdown from "../ChatMarkdown/index.vue";
import ChatLoading from "../ChatLoading/index.vue"; import ChatLoading from "../ChatLoading/index.vue";
import StreamManager from '@/utils/StreamManager'; import StreamManager from '@/utils/StreamManager';
import { import {
getLongTextPredivText, getLongTextPreviewText,
getLongTextValue, getLongTextValue,
hasLongTextExtraSections, hasLongTextExtraSections,
} from "@/constants/longTextCard"; } from "@/constants/longTextCard";

View File

@@ -162,18 +162,18 @@ const handleClick = async (item) => {
const getLocation = () => { const getLocation = () => {
/// 已经有sceneId了说明之前已经获取过位置信息了就不需要再获取一次了 /// 已经有sceneId了说明之前已经获取过位置信息了就不需要再获取一次了
if (sceneId) return; if (sceneId) return;
uni.getLocation({ // uni.getLocation({
type: 'wgs84', // type: 'wgs84',
success: function (res) { // success: function (res) {
// 将位置信息存储到 Pinia 中 // // 将位置信息存储到 Pinia 中
locationStore.setLocationData({ // locationStore.setLocationData({
latitude: res.latitude, // latitude: res.latitude,
longitude: res.longitude, // longitude: res.longitude,
}); // });
console.log('当前位置:' + JSON.stringify(res)); // console.log('当前位置:' + JSON.stringify(res));
getNearbyTagsData(); // getNearbyTagsData();
} // }
}); // });
} }
/// 获取附近标签数据 /// 获取附近标签数据

View File

@@ -37,7 +37,7 @@ import {
SCROLL_TO_BOTTOM, SCROLL_TO_BOTTOM,
} from "@/constants/constant"; } from "@/constants/constant";
import { getAccessToken } from "@/constants/token"; import { getAccessToken } from "@/constants/token";
import { navigateTo } from "@/router"; // import { navigateTo } from "@/router";
const props = defineProps({ const props = defineProps({
@@ -58,7 +58,12 @@ onMounted(() => {
const jumpClick = () => { const jumpClick = () => {
const token = getAccessToken(); const token = getAccessToken();
if (props.toolCall.componentNameParams.jumpUrl) { if (props.toolCall.componentNameParams.jumpUrl) {
navigateTo(props.toolCall.componentNameParams.jumpUrl, { token: token }); router.push({
path: props.toolCall.componentNameParams.jumpUrl,
query: {
token: token,
},
});
} }
}; };

View File

@@ -78,7 +78,7 @@
import TopNavBar from "@/components/TopNavBar/index.vue"; import TopNavBar from "@/components/TopNavBar/index.vue";
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constants/constant"; import { SEND_MESSAGE_CONTENT_TEXT } from "@/constants/constant";
import { getAccessToken } from "@/constants/token"; import { getAccessToken } from "@/constants/token";
import { navigateTo } from "@/router"; // import { navigateTo } from "@/router";
const photo = { const photo = {
thumb: "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/comp4.jpg", thumb: "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/comp4.jpg",
@@ -111,8 +111,8 @@ const showToast = (title) => {
const jumpAigcClick = () => { const jumpAigcClick = () => {
const token = getAccessToken(); const token = getAccessToken();
navigateTo('https://onefeel.brother7.cn/aigc/#/home', { token: token });
location.href = 'https://onefeel.brother7.cn/aigc/#/home?token=' + token;
}; };
const sendReply = (item) => { const sendReply = (item) => {

View File

@@ -39,6 +39,7 @@
import { computed, onMounted, ref } from "vue"; import { computed, onMounted, ref } from "vue";
import { getTimeNoticeList } from "@/api/home"; import { getTimeNoticeList } from "@/api/home";
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constants/constant"; import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constants/constant";
import { emitter } from '@/utils/events'
const props = defineProps({ const props = defineProps({
tipsMessage: { tipsMessage: {
@@ -68,14 +69,18 @@ const getTimeNoticeListData = async () => {
onMounted(() => { onMounted(() => {
getTimeNoticeListData(); getTimeNoticeListData();
uni.$on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
emitter.on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
getTimeNoticeListData(); getTimeNoticeListData();
}); });
}); });
const clickItem = (item) => { const clickItem = (item) => {
uni.navigateTo({ router.push({
url: `/pages/ChatMain/NoticeMessage/detail?noticeData=${encodeURIComponent(JSON.stringify(item))}` path: '/pages/ChatMain/NoticeMessage/detail',
query: {
noticeData: encodeURIComponent(JSON.stringify(item))
}
}); });
} }

3
src/utils/events.ts Normal file
View File

@@ -0,0 +1,3 @@
import mitt from 'mitt'
export const emitter = mitt()