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:
@@ -73,7 +73,7 @@
|
||||
import { ref, computed, onMounted, nextTick, defineProps, watch } from "vue";
|
||||
import { SCROLL_TO_BOTTOM } from "@/constants/constant";
|
||||
import { createWorkOrder } from "@/api/workOrder";
|
||||
import { updateImageFile } from "@/api/upload";
|
||||
import { uploadFile } from "@/api/upload";
|
||||
import { zniconsMap } from "@/assets/fonts/znicons";
|
||||
|
||||
const props = defineProps({
|
||||
@@ -148,7 +148,7 @@ const updateImagehandle = (file) => {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
updateImageFile(file).then((res) => {
|
||||
uploadFile(file).then((res) => {
|
||||
contentImgUrl.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<script setup>
|
||||
import { getAccessToken } from "@/constants/token";
|
||||
import { defineProps, computed } from "vue";
|
||||
import { navigateTo } from "../../router";
|
||||
// import { navigateTo } from "../../router";
|
||||
|
||||
const props = defineProps({
|
||||
toolCall: {
|
||||
@@ -40,7 +40,12 @@ const surveyData = computed(() => {
|
||||
|
||||
const handleCall = () => {
|
||||
const token = getAccessToken();
|
||||
navigateTo(surveyData.value.jumpUrl, { token: token });
|
||||
router.push({
|
||||
path: surveyData.value.jumpUrl,
|
||||
query: {
|
||||
token: token,
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import ChatMarkdown from "../ChatMarkdown/index.vue";
|
||||
import ChatLoading from "../ChatLoading/index.vue";
|
||||
import StreamManager from '@/utils/StreamManager';
|
||||
import {
|
||||
getLongTextPredivText,
|
||||
getLongTextPreviewText,
|
||||
getLongTextValue,
|
||||
hasLongTextExtraSections,
|
||||
} from "@/constants/longTextCard";
|
||||
|
||||
@@ -162,18 +162,18 @@ const handleClick = async (item) => {
|
||||
const getLocation = () => {
|
||||
/// 已经有sceneId了,说明之前已经获取过位置信息了,就不需要再获取一次了
|
||||
if (sceneId) return;
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
// 将位置信息存储到 Pinia 中
|
||||
locationStore.setLocationData({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude,
|
||||
});
|
||||
console.log('当前位置:' + JSON.stringify(res));
|
||||
getNearbyTagsData();
|
||||
}
|
||||
});
|
||||
// uni.getLocation({
|
||||
// type: 'wgs84',
|
||||
// success: function (res) {
|
||||
// // 将位置信息存储到 Pinia 中
|
||||
// locationStore.setLocationData({
|
||||
// latitude: res.latitude,
|
||||
// longitude: res.longitude,
|
||||
// });
|
||||
// console.log('当前位置:' + JSON.stringify(res));
|
||||
// getNearbyTagsData();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/// 获取附近标签数据
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
SCROLL_TO_BOTTOM,
|
||||
} from "@/constants/constant";
|
||||
import { getAccessToken } from "@/constants/token";
|
||||
import { navigateTo } from "@/router";
|
||||
// import { navigateTo } from "@/router";
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
@@ -58,7 +58,12 @@ onMounted(() => {
|
||||
const jumpClick = () => {
|
||||
const token = getAccessToken();
|
||||
if (props.toolCall.componentNameParams.jumpUrl) {
|
||||
navigateTo(props.toolCall.componentNameParams.jumpUrl, { token: token });
|
||||
router.push({
|
||||
path: props.toolCall.componentNameParams.jumpUrl,
|
||||
query: {
|
||||
token: token,
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import { SEND_MESSAGE_CONTENT_TEXT } from "@/constants/constant";
|
||||
import { getAccessToken } from "@/constants/token";
|
||||
import { navigateTo } from "@/router";
|
||||
// import { navigateTo } from "@/router";
|
||||
|
||||
const photo = {
|
||||
thumb: "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/comp4.jpg",
|
||||
@@ -111,8 +111,8 @@ const showToast = (title) => {
|
||||
|
||||
const jumpAigcClick = () => {
|
||||
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) => {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { getTimeNoticeList } from "@/api/home";
|
||||
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constants/constant";
|
||||
import { emitter } from '@/utils/events'
|
||||
|
||||
const props = defineProps({
|
||||
tipsMessage: {
|
||||
@@ -68,14 +69,18 @@ const getTimeNoticeListData = async () => {
|
||||
|
||||
onMounted(() => {
|
||||
getTimeNoticeListData();
|
||||
uni.$on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
|
||||
|
||||
emitter.on(NOTICE_EVENT_LOGIN_SUCCESS, () => {
|
||||
getTimeNoticeListData();
|
||||
});
|
||||
});
|
||||
|
||||
const clickItem = (item) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/ChatMain/NoticeMessage/detail?noticeData=${encodeURIComponent(JSON.stringify(item))}`
|
||||
router.push({
|
||||
path: '/pages/ChatMain/NoticeMessage/detail',
|
||||
query: {
|
||||
noticeData: encodeURIComponent(JSON.stringify(item))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
3
src/utils/events.ts
Normal file
3
src/utils/events.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import mitt from 'mitt'
|
||||
|
||||
export const emitter = mitt()
|
||||
Reference in New Issue
Block a user