Compare commits

..

No commits in common. "1038dd318054195fbf3998d74414419fa5db5a3e" and "07752394eb71c2f5745d54509965dcacac11fd9e" have entirely different histories.

41 changed files with 911 additions and 1105 deletions

View File

@ -1,7 +1,5 @@
NODE_ENV = development
# 测试
VITE_BASE_URL = https://onefeel.brother7.cn/ingress
VITE_BASE_URL = https://biz.nianxx.cn
# 测试
VITE_WSS_URL = wss://onefeel.brother7.cn/ingress/agent/ws/chat
VITE_WSS_URL = wss://biz.nianxx.cn/agent/ws/chat

View File

@ -1,7 +1,5 @@
NODE_ENV = production
# 生产
VITE_BASE_URL = https://biz.nianxx.cn
# 生产
VITE_WSS_URL = wss://biz.nianxx.cn/agent/ws/chat

View File

@ -1,7 +1,5 @@
NODE_ENV = staging
# 生产
VITE_BASE_URL = https://biz.nianxx.cn
# 生产
VITE_WSS_URL = wss://biz.nianxx.cn/agent/ws/chat

42
App.vue
View File

@ -1,8 +1,28 @@
<script setup>
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { onLaunch, onShow, onHide, onLoad } from "@dcloudio/uni-app";
import { checkPhone } from "@/manager/LoginManager";
import { goLogin } from "@/hooks/useGoLogin";
import { goHome } from "@/hooks/useGoHome";
onLaunch(async () => {
console.log("App Launch");
const token = uni.getStorageSync("token");
// token
if (!token) {
goLogin();
return;
}
if (token) {
const res = await checkPhone();
if (res.data) {
goHome();
}
}
});
onShow(() => {
@ -35,24 +55,4 @@ body,
.mb12 {
margin-bottom: 12px;
}
//
.reset-btn {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 1000;
background: none;
border: none;
outline: none;
padding: 0;
margin: 0;
&::after {
border: none;
content: " ";
}
}
</style>

View File

@ -1,18 +0,0 @@
<template>
<button
v-if="!hasToken"
class="reset-btn"
open-type="getPhoneNumber"
@getphonenumber="onLogin"
/>
</template>
<script setup>
import { computed, defineEmits } from "vue";
import { useAppStore } from "@/store";
import { onLogin } from "@/hooks/useGoLogin";
const emits = defineEmits(["click"]);
const hasToken = computed(() => useAppStore().hasToken);
</script>

View File

@ -0,0 +1,8 @@
const isProd = true;
console.log(import.meta.env);
export const BASE_URL = import.meta.env.VITE_BASE_URL;
// socket地址
export const WSS_URL = import.meta.env.VITE_WSS_URL;

View File

@ -1,37 +1 @@
import { loginAuth, checkPhone, bindPhone } from "@/manager/LoginManager";
// 跳转登录
export const goLogin = () => uni.reLaunch({ url: "/pages/login/index" });
// 登录逻辑
export const onLogin = (e) => {
const token = uni.getStorageSync("token");
if (token) return;
const { code } = e.detail;
console.info("onLogin code: ", code);
loginAuth().then(async () => {
// 检测是否绑定手机号
const res = await checkPhone();
if (res.data) return;
const params = { wechatPhoneCode: code, clientId: "2" };
// 绑定手机号
bindPhone(params);
});
};
// 检测token
export const checkToken = async () => {
return new Promise((resolve) => {
const token = uni.getStorageSync("token");
if (!token) return;
resolve(token);
});
};

View File

@ -1,24 +1,14 @@
export const getWeChatAuthCode = () => {
return new Promise((resolve, reject) => {
// 条件编译微信小程序、抖音小程序
let provider = "";
// #ifdef MP-WEIXIN
provider = "weixin";
// #endif
// #ifdef MP-TOUTIAO
provider = "toutiao";
// #endif
uni.login({
provider,
provider: 'weixin',
onlyAuthorize: true,
success: (res) => {
console.log("微信登录成功", res);
resolve(res.code);
},
fail: (err) => {
reject(err);
},
}
});
});
};
}

View File

@ -4,10 +4,9 @@ import {
checkUserPhone,
} from "../request/api/LoginApi";
import { getWeChatAuthCode } from "./AuthManager";
import { useAppStore } from "@/store";
const loginAuth = () => {
return new Promise(async (resolve, reject) => {
const loginAuth = async () => {
try {
const openIdCode = await getWeChatAuthCode();
console.log("获取到的微信授权code:", openIdCode);
const response = await wxLogin({
@ -20,15 +19,13 @@ const loginAuth = () => {
if (response.access_token) {
uni.setStorageSync("token", response.access_token);
const appStore = useAppStore();
appStore.setHasToken(true);
resolve();
return response;
} else {
reject(response.message || "登录失败");
throw new Error(response.message || "登录失败");
}
} catch (err) {
throw err;
}
});
};
const bindPhone = async (params) => {

View File

@ -55,12 +55,9 @@
},
/* */
"quickapp" : {},
/* project.config.json
wx5e79df5996572539
wx23f86d809ae80259
*/
/* */
"mp-weixin" : {
"appid": "wx5e79df5996572539",
"appid" : "wx23f86d809ae80259",
"setting" : {
"urlCheck" : false
},

View File

@ -9,8 +9,6 @@
<!-- 输入框/语音按钮容器 -->
<view class="input-button-container">
<Interceptor />
<textarea
ref="textareaRef"
v-if="!isVoiceMode"
@ -62,10 +60,8 @@
</template>
<script setup>
import { ref, watch, nextTick, onMounted, defineExpose } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import { ref, watch, nextTick, onMounted, computed, defineExpose } from "vue";
import RecordingWaveBtn from "@/components/Speech/RecordingWaveBtn.vue";
import Interceptor from "@/components/Interceptor/index.vue";
const plugin = requirePlugin("WechatSI");
const manager = plugin.getRecordRecognitionManager();
@ -117,7 +113,6 @@ const toggleVoiceMode = () => {
//
const handleVoiceTouchStart = () => {
checkToken().then(() => {
manager.start({ lang: "zh_CN" });
visibleWaveBtn.value = true;
@ -128,7 +123,6 @@ const handleVoiceTouchStart = () => {
recordingWaveBtnRef.value.startAnimation();
}
});
});
};
//
@ -236,5 +230,88 @@ defineExpose({ focusInput });
</script>
<style scoped lang="scss">
@import "./styles/ChatInputArea.scss";
.area-input {
display: flex;
align-items: center;
border-radius: 22px;
background-color: #ffffff;
box-shadow: 0px 0px 20px 0px rgba(52, 25, 204, 0.05);
margin: 0 12px;
margin-bottom: 8px;
.input-container-voice {
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
width: 44px;
height: 44px;
image {
width: 22px;
height: 22px;
}
}
.input-button-container {
flex: 1;
position: relative;
}
.hold-to-talk-button {
width: 100%;
height: 44px;
color: #333333;
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffffff;
transition: all 0.2s ease;
user-select: none;
-webkit-user-select: none;
}
.input-container-send {
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
width: 44px;
height: 44px;
.input-container-send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
image {
width: 28px;
height: 28px;
}
}
.textarea {
flex: 1;
box-sizing: border-box;
width: 100%;
max-height: 92px;
min-height: 22px;
font-size: 16px;
line-height: 22px;
margin: 6px 0;
&::placeholder {
color: #cccccc;
line-height: normal;
}
&:focus {
outline: none;
}
}
}
</style>

View File

@ -97,18 +97,12 @@
/>
<ActivityListComponent
v-if="
mainPageDataModel.activityList &&
mainPageDataModel.activityList.length > 0
"
v-if="mainPageDataModel.activityList && mainPageDataModel.activityList.length > 0"
:activityList="mainPageDataModel.activityList"
/>
<RecommendPostsComponent
v-if="
mainPageDataModel.recommendTheme &&
mainPageDataModel.recommendTheme.length > 0
"
v-if="mainPageDataModel.recommendTheme && mainPageDataModel.recommendTheme.length > 0"
:recommendThemeList="mainPageDataModel.recommendTheme"
/>
</ChatCardOther>
@ -136,14 +130,14 @@
</template>
<script setup>
import { onMounted, nextTick, onUnmounted, ref, defineEmits, watch } from "vue";
import { onMounted, nextTick, onUnmounted, ref, defineEmits } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import {
SCROLL_TO_BOTTOM,
RECOMMEND_POSTS_TITLE,
SEND_COMMAND_TEXT,
} from "@/constant/constant";
import { WSS_URL } from "@/request/base/baseUrl";
import { WSS_URL } from "@/constant/base";
import { MessageRole, MessageType, CompName } from "../../model/ChatModel";
import ChatTopWelcome from "./ChatTopWelcome.vue";
import ChatTopBgImg from "./ChatTopBgImg.vue";
@ -171,7 +165,6 @@ import WebSocketManager from "@/utils/WebSocketManager";
import TypewriterManager from "@/utils/TypewriterManager";
import { IdUtils } from "@/utils";
import { useAppStore } from "@/store";
import { checkToken } from "@/hooks/useGoLogin";
const appStore = useAppStore();
///
@ -353,34 +346,14 @@ onLoad(() => {
});
});
// token
const initHandler = () => {
console.log("initHandler");
loadRecentConversation();
loadConversationMsgList();
initWebSocket();
};
// token,
watch(
() => appStore.hasToken,
(newValue) => {
if (newValue) {
initHandler();
}
}
);
onMounted(() => {
onMounted(async () => {
try {
getMainPageData();
await loadRecentConversation();
loadConversationMsgList();
addNoticeListener();
initTypewriterManager();
// tokensocket
checkToken().then(() => initHandler());
initWebSocket();
} catch (error) {
console.error("页面初始化错误:", error);
}

View File

@ -6,11 +6,9 @@
v-for="(item, index) in itemList"
:key="index"
>
<view class="more-tips-item-title" @click="sendReply(item)">
<Interceptor />
{{ item }}
</view>
<text class="more-tips-item-title" @click="sendReply(item)">{{
item
}}</text>
</view>
</view>
</view>
@ -18,9 +16,6 @@
<script setup>
import { defineProps } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import Interceptor from "@/components/Interceptor/index.vue";
const emits = defineEmits(["replySent"]);
defineProps({
@ -39,11 +34,44 @@ defineProps({
});
const sendReply = (text) => {
//
checkToken().then(() => emits("replySent", text));
emits("replySent", text); //
};
</script>
<style lang="scss" scoped>
@import "./styles/ChatMoreTips.scss";
.more-tips {
width: 100%;
&-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
padding-bottom: 12px;
box-sizing: border-box;
}
.more-tips-item {
border-radius: 8px;
margin: 4px;
box-shadow: 0 2px 5px 0px rgba(0, 0, 0, 0.1);
background-color: #ffffff;
padding: 2px 12px;
display: flex;
flex-direction: column;
flex-shrink: 0;
white-space: nowrap;
.more-tips-item-title {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 12px;
color: #00a6ff;
line-height: 24px;
text-align: center;
white-space: nowrap;
}
}
}
</style>

View File

@ -7,8 +7,6 @@
:key="index"
@click="sendReply(item)"
>
<Interceptor />
<image
class="quick-access-item-bg"
src="/static/quick/quick_icon_bg.png"
@ -26,15 +24,12 @@
<script setup>
import { onMounted, ref } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import Interceptor from "@/components/Interceptor/index.vue";
const itemList = ref([]);
const emits = defineEmits(["replySent"]);
const sendReply = (item) => {
checkToken().then(() => emits("replySent", item)); //
emits("replySent", item); //
};
onMounted(() => {
@ -72,5 +67,75 @@ const initData = () => {
</script>
<style lang="scss" scoped>
@import "./styles/ChatQuickAccess.scss";
.quick-access {
width: 100%;
&-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
.quick-access-item {
flex: 0 0 104px;
border-radius: 8px;
margin: 4px 4px 8px 4px;
box-shadow: 0 2px 5px 0px rgba(0, 0, 0, 0.1);
padding: 12px;
display: inline-flex;
flex-direction: column;
position: relative;
&:first-child {
margin-left: 12px;
}
&:last-child {
margin-right: 12px;
}
.quick-access-item-bg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
border-radius: 8px;
width: 128px;
height: 56px;
}
.quick-access-item-title {
display: flex;
align-items: center;
z-index: 1;
image {
width: 16px;
height: 16px;
margin-right: 4px;
}
text {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 12px;
color: #201f32;
line-height: 16px;
}
}
.quick-access-item-content {
z-index: 1;
margin-top: 4px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 10px;
color: #678cad;
line-height: 18px;
}
}
}
</style>

View File

@ -1,84 +0,0 @@
.area-input {
display: flex;
align-items: center;
border-radius: 22px;
background-color: #ffffff;
box-shadow: 0px 0px 20px 0px rgba(52, 25, 204, 0.05);
margin: 0 12px;
margin-bottom: 8px;
.input-container-voice {
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
width: 44px;
height: 44px;
image {
width: 22px;
height: 22px;
}
}
.input-button-container {
flex: 1;
position: relative;
}
.hold-to-talk-button {
width: 100%;
height: 44px;
color: #333333;
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffffff;
transition: all 0.2s ease;
user-select: none;
-webkit-user-select: none;
}
.input-container-send {
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
width: 44px;
height: 44px;
.input-container-send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
image {
width: 28px;
height: 28px;
}
}
.textarea {
flex: 1;
box-sizing: border-box;
width: 100%;
max-height: 92px;
min-height: 22px;
font-size: 16px;
line-height: 22px;
margin: 6px 0;
&::placeholder {
color: #cccccc;
line-height: normal;
}
&:focus {
outline: none;
}
}
}

View File

@ -1,35 +0,0 @@
.more-tips {
width: 100%;
&-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
padding-bottom: 12px;
box-sizing: border-box;
}
.more-tips-item {
border-radius: 8px;
margin: 4px;
box-shadow: 0 2px 5px 0px rgba(0, 0, 0, 0.1);
background-color: #ffffff;
padding: 2px 12px;
display: flex;
flex-direction: column;
flex-shrink: 0;
white-space: nowrap;
position: relative;
.more-tips-item-title {
font-weight: 500;
font-size: 12px;
color: #00a6ff;
line-height: 24px;
text-align: center;
white-space: nowrap;
}
}
}

View File

@ -1,70 +0,0 @@
.quick-access {
width: 100%;
&-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
.quick-access-item {
flex: 0 0 104px;
border-radius: 8px;
margin: 4px 4px 8px 4px;
box-shadow: 0 2px 5px 0px rgba(0, 0, 0, 0.1);
padding: 12px;
display: inline-flex;
flex-direction: column;
position: relative;
&:first-child {
margin-left: 12px;
}
&:last-child {
margin-right: 12px;
}
.quick-access-item-bg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
border-radius: 8px;
width: 128px;
height: 56px;
}
.quick-access-item-title {
display: flex;
align-items: center;
z-index: 1;
image {
width: 16px;
height: 16px;
margin-right: 4px;
}
text {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 12px;
color: #201f32;
line-height: 16px;
}
}
.quick-access-item-content {
z-index: 1;
margin-top: 4px;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 10px;
color: #678cad;
line-height: 18px;
}
}
}

View File

@ -38,7 +38,6 @@
<script setup>
import { ref, onMounted } from "vue";
import { getLoginUserPhone } from "@/request/api/LoginApi";
import { checkToken } from "@/hooks/useGoLogin";
//
const userInfo = ref({
@ -57,19 +56,15 @@ const menuList = ref([
},
// { label: '&', type: 'navigate', url: '/pages/agreement/agreement' },
{ label: "联系客服", type: "action", action: "contactService" },
{ label: "订阅消息", type: "action", action: "subscribeMessage" },
]);
//
onMounted(() => {
checkToken().then(() => {
getLoginUserPhoneInfo();
});
});
const getLoginUserPhoneInfo = async () => {
const res = await getLoginUserPhone();
if (res.code === 0) {
userInfo.value.phone = res.data;
}
@ -82,13 +77,6 @@ const handleMenuClick = (item) => {
} else if (item.type === "action") {
if (item.action === "contactService") {
uni.showToast({ title: "联系客服功能待实现", icon: "none" });
} else if (item.action === "subscribeMessage") {
uni.requestSubscribeMessage({
tmplIds: ["fMIt1q9GgM3Ep0DJSNgVPm4C3lCpQdz2TediETcv3iM"],
success(res) {
console.log(res);
},
});
}
}
};

View File

@ -70,6 +70,62 @@ onMounted(() => {
});
</script>
<style scoped lang="scss">
@import "./styles/QuickBookingCalender.scss";
<style scoped>
.date-picker {
background: rgba(140, 236, 255, 0.24);
padding: 8rpx 0;
border-radius: 16rpx;
margin: 12px 0 6px;
min-width: 325px;
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1); /* 阴影 */
}
.date-list {
display: flex;
}
.date-item,
.calendar-btn {
flex: 1; /* 等宽 */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 12rpx 0;
border-radius: 16rpx;
}
.label {
font-size: 24rpx;
color: #999;
}
.date {
font-size: 28rpx;
font-weight: bold;
color: #555;
}
.date-item.active {
background-color: #00a6ff;
}
.date-item.active .label,
.date-item.active .date {
color: #fff;
}
/* 日历按钮 */
.calendar-btn {
background: #fff;
border-radius: 0 16rpx 16rpx 0;
margin: -8rpx 0;
}
.calendar-img {
width: 16px;
height: 16px;
}
.calendar-text {
font-size: 22rpx;
color: #666;
margin-top: 4rpx;
}
</style>

View File

@ -62,5 +62,13 @@ onMounted(() => {
</script>
<style scoped lang="scss">
@import './styles/QuickBookingComponent.scss'
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
.calendar {
width: 100%;
}
}
</style>

View File

@ -6,7 +6,7 @@
v-for="(item, index) in commodityDTO.commodityList"
:key="`${item.commodityId}-${index}`"
>
<Interceptor class="mk-card-item" @click="placeOrderHandle(item)">
<view class="mk-card-item" @click="placeOrderHandle(item)">
<!-- <view class="card-badge">超值推荐</view> -->
<image class="card-img" :src="item.commodityIcon" mode="aspectFill" />
<view class="card-content">
@ -38,7 +38,7 @@
<text class="card-btn">下单</text>
</view>
</view>
</Interceptor>
</view>
</view>
</view>
</view>
@ -47,8 +47,6 @@
<script setup>
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { defineProps } from "vue";
import Interceptor from "@/components/Interceptor/index.vue";
const props = defineProps({
commodityDTO: {
type: Object,
@ -65,5 +63,141 @@ const placeOrderHandle = (item) => {
</script>
<style lang="scss" scoped>
@import "./styles/QuickBookingContentList.scss";
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
overflow-y: hidden;
margin: 4px 0;
.mk-card-item {
position: relative;
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
// height: 244px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
padding-bottom: 12px;
.card-badge {
position: absolute;
top: 8px;
left: 8px;
background: #ffe7b2;
color: #b97a00;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
z-index: 2;
}
.card-img {
width: 188px;
height: 114px;
border-radius: 10px;
object-fit: cover; /* 确保图片不变形,保持比例裁剪 */
flex-shrink: 0; /* 防止图片被压缩 */
}
.card-content {
box-sizing: border-box;
padding: 10px 12px 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: start;
width: 100%;
flex: 1; /* 让内容区域占据剩余空间 */
overflow: hidden; /* 防止内容溢出 */
}
.card-title-column {
display: flex;
align-items: start;
flex-direction: column;
width: 100%;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #222;
width: 100%;
/* 限制标题最多显示两行 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.4;
max-height: 2.8em; /* 2行的高度 */
}
.card-tags {
display: flex;
flex-direction: row;
align-items: start;
padding: 6px 0;
}
.card-tag {
color: #ff6600;
font-size: 10px;
border-radius: 4px;
padding: 0 6px;
margin-left: 2px;
border: 1px solid #ff6600;
}
.card-desc {
font-size: 13px;
color: #888;
margin-top: 2px;
}
.card-bottom-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
width: 100%;
}
.card-price-row {
.card-price-fu {
color: #ff6600;
font-size: 11px;
font-weight: normal;
}
.card-price {
color: #ff6600;
font-size: 16px;
font-weight: bold;
}
.card-unit {
font-size: 11px;
color: #888;
font-weight: normal;
margin-left: 2px;
}
}
.card-btn {
background: #ff6600;
color: #fff;
font-size: 15px;
border-radius: 20px;
padding: 0 18px;
height: 32px;
line-height: 32px;
}
}
}
}
</style>

View File

@ -1,57 +0,0 @@
.date-picker {
background: rgba(140, 236, 255, 0.24);
padding: 8rpx 0;
border-radius: 16rpx;
margin: 12px 0 6px;
min-width: 325px;
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1); /* 阴影 */
}
.date-list {
display: flex;
}
.date-item,
.calendar-btn {
flex: 1; /* 等宽 */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 12rpx 0;
border-radius: 16rpx;
}
.label {
font-size: 24rpx;
color: #999;
}
.date {
font-size: 28rpx;
font-weight: bold;
color: #555;
}
.date-item.active {
background-color: #00a6ff;
}
.date-item.active .label,
.date-item.active .date {
color: #fff;
}
/* 日历按钮 */
.calendar-btn {
background: #fff;
border-radius: 0 16rpx 16rpx 0;
margin: -8rpx 0;
}
.calendar-img {
width: 16px;
height: 16px;
}
.calendar-text {
font-size: 22rpx;
color: #666;
margin-top: 4rpx;
}

View File

@ -1,9 +0,0 @@
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
.calendar {
width: 100%;
}
}

View File

@ -1,137 +0,0 @@
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
overflow-y: hidden;
margin: 4px 0;
.mk-card-item {
position: relative;
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
// height: 244px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
padding-bottom: 12px;
.card-badge {
position: absolute;
top: 8px;
left: 8px;
background: #ffe7b2;
color: #b97a00;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
z-index: 2;
}
.card-img {
width: 188px;
height: 114px;
border-radius: 10px;
object-fit: cover; /* 确保图片不变形,保持比例裁剪 */
flex-shrink: 0; /* 防止图片被压缩 */
}
.card-content {
box-sizing: border-box;
padding: 10px 12px 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: start;
width: 100%;
flex: 1; /* 让内容区域占据剩余空间 */
overflow: hidden; /* 防止内容溢出 */
}
.card-title-column {
display: flex;
align-items: start;
flex-direction: column;
width: 100%;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #222;
width: 100%;
/* 限制标题最多显示两行 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.4;
max-height: 2.8em; /* 2行的高度 */
}
.card-tags {
display: flex;
flex-direction: row;
align-items: start;
padding: 6px 0;
}
.card-tag {
color: #ff6600;
font-size: 10px;
border-radius: 4px;
padding: 0 6px;
margin-left: 2px;
border: 1px solid #ff6600;
}
.card-desc {
font-size: 13px;
color: #888;
margin-top: 2px;
}
.card-bottom-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
width: 100%;
}
.card-price-row {
.card-price-fu {
color: #ff6600;
font-size: 11px;
font-weight: normal;
}
.card-price {
color: #ff6600;
font-size: 16px;
font-weight: bold;
}
.card-unit {
font-size: 11px;
color: #888;
font-weight: normal;
margin-left: 2px;
}
}
.card-btn {
background: #ff6600;
color: #fff;
font-size: 15px;
border-radius: 20px;
padding: 0 18px;
height: 32px;
line-height: 32px;
}
}
}
}

View File

@ -26,5 +26,8 @@ const props = defineProps({
</script>
<style scoped lang="scss">
@import "./styles/DetailCardCompontent.scss";
.container {
width: 100%;
padding: 12px 0;
}
</style>

View File

@ -7,7 +7,6 @@
:key="`${item.commodityId}-${index}`"
>
<view class="mk-card-item" @click="placeOrderHandle(item)">
<Interceptor />
<image
class="card-img"
:src="item.commodityPhoto"
@ -48,11 +47,8 @@
</template>
<script setup>
import { defineProps } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import Interceptor from "@/components/Interceptor/index.vue";
import { defineProps } from "vue";
const props = defineProps({
commodityList: {
type: Array,
@ -62,14 +58,149 @@ const props = defineProps({
///
const placeOrderHandle = (item) => {
checkToken().then(() => {
uni.navigateTo({
url: `/pages/goods/index?commodityId=${item.commodityId}`,
});
});
};
</script>
<style lang="scss" scoped>
@import "./styles/DetailCardGoodsContentList.scss";
.container {
margin: 6px 0 0;
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
overflow-y: hidden;
margin: 4px 0;
.mk-card-item {
position: relative;
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
padding-bottom: 12px;
.card-badge {
position: absolute;
top: 8px;
left: 8px;
background: #ffe7b2;
color: #b97a00;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
z-index: 2;
}
.card-img {
width: 188px;
height: 114px;
border-radius: 10px;
object-fit: cover; /* 确保图片不变形,保持比例裁剪 */
flex-shrink: 0; /* 防止图片被压缩 */
}
.card-content {
box-sizing: border-box;
padding: 10px 12px 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: start;
width: 100%;
flex: 1; /* 让内容区域占据剩余空间 */
overflow: hidden; /* 防止内容溢出 */
}
.card-title-column {
display: flex;
align-items: start;
flex-direction: column;
width: 100%;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #222;
width: 100%;
/* 限制标题最多显示两行 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.4;
max-height: 2.8em; /* 2行的高度 */
}
.card-tags {
display: flex;
flex-direction: row;
align-items: start;
padding: 6px 0;
}
.card-tag {
color: #ff6600;
font-size: 10px;
border-radius: 4px;
padding: 0 6px;
margin-left: 2px;
border: 1px solid #ff6600;
}
.card-desc {
font-size: 13px;
color: #888;
margin-top: 2px;
}
.card-bottom-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
width: 100%;
}
.card-price-row {
.card-price-fu {
color: #ff6600;
font-size: 11px;
font-weight: normal;
}
.card-price {
color: #ff6600;
font-size: 16px;
font-weight: bold;
}
.card-unit {
font-size: 11px;
color: #888;
font-weight: normal;
margin-left: 2px;
}
}
.card-btn {
background: #ff6600;
color: #fff;
font-size: 15px;
border-radius: 20px;
padding: 0 18px;
height: 32px;
line-height: 32px;
}
}
}
}
</style>

View File

@ -1,4 +0,0 @@
.container {
width: 100%;
padding: 12px 0;
}

View File

@ -1,138 +0,0 @@
.container {
margin: 6px 0 0;
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
overflow-y: hidden;
margin: 4px 0;
.mk-card-item {
position: relative;
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
padding-bottom: 12px;
.card-badge {
position: absolute;
top: 8px;
left: 8px;
background: #ffe7b2;
color: #b97a00;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
z-index: 2;
}
.card-img {
width: 188px;
height: 114px;
border-radius: 10px;
object-fit: cover; /* 确保图片不变形,保持比例裁剪 */
flex-shrink: 0; /* 防止图片被压缩 */
}
.card-content {
box-sizing: border-box;
padding: 10px 12px 0 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: start;
width: 100%;
flex: 1; /* 让内容区域占据剩余空间 */
overflow: hidden; /* 防止内容溢出 */
}
.card-title-column {
display: flex;
align-items: start;
flex-direction: column;
width: 100%;
}
.card-title {
font-size: 16px;
font-weight: bold;
color: #222;
width: 100%;
/* 限制标题最多显示两行 */
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.4;
max-height: 2.8em; /* 2行的高度 */
}
.card-tags {
display: flex;
flex-direction: row;
align-items: start;
padding: 6px 0;
}
.card-tag {
color: #ff6600;
font-size: 10px;
border-radius: 4px;
padding: 0 6px;
margin-left: 2px;
border: 1px solid #ff6600;
}
.card-desc {
font-size: 13px;
color: #888;
margin-top: 2px;
}
.card-bottom-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
width: 100%;
}
.card-price-row {
.card-price-fu {
color: #ff6600;
font-size: 11px;
font-weight: normal;
}
.card-price {
color: #ff6600;
font-size: 16px;
font-weight: bold;
}
.card-unit {
font-size: 11px;
color: #888;
font-weight: normal;
margin-left: 2px;
}
}
.card-btn {
background: #ff6600;
color: #fff;
font-size: 15px;
border-radius: 20px;
padding: 0 18px;
height: 32px;
line-height: 32px;
}
}
}
}

View File

@ -34,5 +34,9 @@ onMounted(() => {
</script>
<style scoped lang="scss">
@import "./styles/DiscoveryCardComponent.scss";
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
</style>

View File

@ -7,14 +7,8 @@
:key="index"
>
<view class="mk-card-item" @click="sendReply(item)">
<Interceptor />
<image
class="card-img"
:src="item.coverPhoto"
mode="widthFix"
></image>
<text class="card-text">{{ item.topic }}</text>
<image :src="item.coverPhoto" mode="widthFix"></image>
<text>{{ item.topic }}</text>
</view>
</view>
</view>
@ -22,12 +16,9 @@
</template>
<script setup>
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { RECOMMEND_POSTS_TITLE } from "@/constant/constant";
import { defineProps } from "vue";
import { checkToken } from "@/hooks/useGoLogin";
import Interceptor from "@/components/Interceptor/index.vue";
import ModuleTitle from "@/components/ModuleTitle/index.vue";
const props = defineProps({
recommendTheme: {
type: Object,
@ -36,13 +27,41 @@ const props = defineProps({
});
const sendReply = (item) => {
checkToken().then(() => {
const topic = item.userInputContent || item.topic.replace(/^#/, "");
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
});
};
</script>
<style lang="scss" scoped>
@import "./styles/DiscoveryCradContentList.scss";
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin-top: 4px;
.mk-card-item {
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
height: 154px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
image {
width: 188px;
height: 112px;
}
text {
padding: 12px;
text-align: center;
font-weight: 500;
font-size: 12px;
color: #333333;
}
}
}
}
</style>

View File

@ -1,5 +0,0 @@
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}

View File

@ -1,33 +0,0 @@
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin-top: 4px;
.mk-card-item {
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
height: 154px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
position: relative;
.card-img {
width: 188px;
height: 112px;
}
.card-text {
padding: 12px;
text-align: center;
font-weight: 500;
font-size: 12px;
color: #333333;
}
}
}
}

View File

@ -22,5 +22,9 @@ const props = defineProps({
</script>
<style scoped lang="scss">
@import "./styles/RecommendPostsComponent.scss";
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
</style>

View File

@ -7,9 +7,7 @@
:key="index"
>
<view class="mk-card-item" @click="sendReply(item)">
<Interceptor />
<image class="card-img" :src="item.coverPhoto" mode="aspectFill" />
<image :src="item.coverPhoto" mode="aspectFill"></image>
<view class="overlay-gradient">
<text class="overlay-text">{{ item.topic }}</text>
</view>
@ -20,11 +18,9 @@
</template>
<script setup>
import { defineProps } from "vue";
import { RECOMMEND_POSTS_TITLE } from "@/constant/constant";
import { checkToken } from "@/hooks/useGoLogin";
import Interceptor from "@/components/Interceptor/index.vue";
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { defineProps } from "vue";
import { RECOMMEND_POSTS_TITLE } from "@/constant/constant.js";
const props = defineProps({
recommendTheme: {
@ -34,13 +30,63 @@ const props = defineProps({
});
const sendReply = (item) => {
checkToken().then(() => {
const topic = item.userInputContent || item.topic.replace(/^#/, "");
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
});
};
</script>
<style lang="scss" scoped>
@import "./styles/RecommendPostsList.scss";
.container {
width: 100%;
}
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin: 4px 0 6px;
.mk-card-item {
flex-shrink: 0; /* 关键:防止 flex 布局压缩子元素宽度 */
width: 142px;
height: 126px;
border-radius: 10px;
overflow: hidden;
margin-right: 8px;
position: relative;
image {
width: 100%;
height: 100%;
display: block;
}
/* 渐变背景层 */
.overlay-gradient {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 50px; /* 渐变层高度,可调 */
background: linear-gradient(
to bottom,
rgba(0, 0, 0, 0.001) 0%,
rgba(0, 0, 0, 0.5) 100%
);
display: flex;
align-items: flex-end; /* 文字贴近底部 */
padding: 0 8px 6px; /* 内边距让文字与边缘保持距离 */
box-sizing: border-box;
}
/* 渐变层上的文字 */
.overlay-text {
color: #fff;
font-weight: 500;
font-size: 12px;
text-align: left;
width: 100%;
}
}
}
</style>

View File

@ -1,5 +0,0 @@
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}

View File

@ -1,53 +0,0 @@
.container {
width: 100%;
}
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin: 4px 0 6px;
}
.mk-card-item {
flex-shrink: 0; /* 关键:防止 flex 布局压缩子元素宽度 */
width: 142px;
height: 126px;
border-radius: 10px;
overflow: hidden;
margin-right: 8px;
position: relative;
.card-img {
width: 100%;
height: 100%;
display: block;
}
/* 渐变背景层 */
.overlay-gradient {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 50px; /* 渐变层高度,可调 */
background: linear-gradient(
to bottom,
rgba(0, 0, 0, 0.001) 0%,
rgba(0, 0, 0, 0.5) 100%
);
display: flex;
align-items: flex-end; /* 文字贴近底部 */
padding: 0 8px 6px; /* 内边距让文字与边缘保持距离 */
box-sizing: border-box;
}
/* 渐变层上的文字 */
.overlay-text {
color: #fff;
font-weight: 500;
font-size: 12px;
text-align: left;
width: 100%;
}
}

View File

@ -1,5 +1,5 @@
{
"appid": "wx5e79df5996572539",
"appid": "wx23f86d809ae80259",
"compileType": "miniprogram",
"libVersion": "3.8.10",
"packOptions": {

View File

@ -1,8 +1,8 @@
import { BASE_URL } from "@/request/base/baseUrl";
import { BASE_URL } from "../../constant/base";
import { goLogin } from "@/hooks/useGoLogin";
/// 请求流式数据的API
const API = "/agent/assistant/chat";
const API = '/agent/assistant/chat';
/**
* 获取AI聊天流式信息仅微信小程序支持
@ -31,7 +31,7 @@ const stopAbortTask = () => {
activeRequestId = null;
if (currentPromiseReject) {
currentPromiseReject(new Error("请求已被用户终止"));
currentPromiseReject(new Error('请求已被用户终止'));
currentPromiseReject = null;
}
@ -40,15 +40,15 @@ const stopAbortTask = () => {
const cleanupListeners = () => {
try {
if(requestTask.offChunkReceived) {
console.log("======>offChunkReceived");
console.log("======>offChunkReceived")
requestTask.offChunkReceived();
}
if(requestTask.offHeadersReceived) {
console.log("======>offHeadersReceived");
console.log("======>offHeadersReceived")
requestTask.offHeadersReceived();
}
} catch (e) {
console.error("清理事件监听器失败:", e);
console.error('清理事件监听器失败:', e);
}
};
@ -57,22 +57,22 @@ const stopAbortTask = () => {
// 终止请求
try {
if (requestTask.abort) {
console.log("======>abort");
console.log("======>abort")
requestTask.abort();
}
} catch (e) {
console.log("🛑 终止网络请求失败:", e);
console.log('🛑 终止网络请求失败:', e);
}
requestTask = null;
}
console.log("🛑 请求强制终止完成");
};
console.log('🛑 请求强制终止完成');
}
const agentChatStream = (params, onChunk) => {
return new Promise((resolve, reject) => {
const token = uni.getStorageSync("token");
const token = uni.getStorageSync('token');
const requestId = Date.now().toString(); // 生成唯一请求ID
// 重置状态
@ -87,23 +87,21 @@ const agentChatStream = (params, onChunk) => {
// 检查数据块是否来自已终止的请求
const isStaleData = (dataRequestId) => {
return (
dataRequestId === lastRequestId || dataRequestId !== activeRequestId
);
return dataRequestId === lastRequestId || dataRequestId !== activeRequestId;
};
// #ifdef MP-WEIXIN
requestTask = uni.request({
url: BASE_URL + API, // 替换为你的接口地址
method: "POST",
method: 'POST',
data: params,
enableChunked: true,
header: {
Accept: "text/event-stream",
"Content-Type": "application/json",
Accept: 'text/event-stream',
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`, // 如需token可加
},
responseType: "arraybuffer",
responseType: 'arraybuffer',
success(res) {
if (!isAborted && !isStaleData(requestId)) {
console.log(`✅ 请求 [${requestId}] 成功`);
@ -124,39 +122,30 @@ const agentChatStream = (params, onChunk) => {
// 使用 requestId 来验证请求有效性
if (!isAborted && activeRequestId === requestId) {
if (res.statusCode !== 200) {
console.log(
`❌ 请求 [${requestId}] 完成但状态错误,状态:`,
res.statusCode
);
console.log(`❌ 请求 [${requestId}] 完成但状态错误,状态:`, res.statusCode);
if(res.statusCode === 424) {
uni.setStorageSync("token", "");
uni.setStorageSync('token', '');
goLogin();
}
if (onChunk) {
onChunk({
error: true,
message: "服务器错误",
detail: res,
message: '服务器错误',
detail: res
});
}
reject(res);
}
} else {
console.log(
`❌ 请求 [${requestId}] ${
isAborted ? "已终止" : "已过期"
}忽略complete回调`
);
console.log(`❌ 请求 [${requestId}] ${isAborted ? '已终止' : '已过期'}忽略complete回调`);
}
}
},
});
requestTask.onHeadersReceived((res) => {
requestTask.onHeadersReceived(res => {
// 使用 requestId 验证请求有效性
if (isAborted || activeRequestId !== requestId) {
console.log(
`🚫 Headers [${requestId}] ${isAborted ? "已终止" : "已过期"},忽略`
);
console.log(`🚫 Headers [${requestId}] ${isAborted ? '已终止' : '已过期'},忽略`);
return;
}
@ -169,7 +158,7 @@ const agentChatStream = (params, onChunk) => {
onChunk({
error: true,
message: `服务器错误(${status})`,
detail: res,
detail: res
});
}
// 终止异常请求
@ -179,7 +168,7 @@ const agentChatStream = (params, onChunk) => {
}
});
requestTask.onChunkReceived((res) => {
requestTask.onChunkReceived(res => {
// 立即验证请求有效性
if (isAborted || isStaleData(requestId)) {
console.log(`🚫 数据块 [${requestId}] 已终止或过期,忽略`);
@ -187,15 +176,15 @@ const agentChatStream = (params, onChunk) => {
}
const base64 = uni.arrayBufferToBase64(res.data);
let data = "";
let data = '';
try {
data = decodeURIComponent(escape(weAtob(base64)));
} catch (e) {
console.error("Base64解码失败:", e);
console.error('Base64解码失败:', e);
return;
}
console.log("📦 onChunkReceivedres:", data);
console.log("📦 onChunkReceivedres:", data)
// 再次验证请求有效性
if (isAborted || activeRequestId !== requestId) {
@ -204,7 +193,7 @@ const agentChatStream = (params, onChunk) => {
}
const messages = parseSSEChunk(data);
messages.forEach((msg) => {
messages.forEach(msg => {
if (!isAborted && !isStaleData(requestId) && onChunk) {
onChunk(msg);
}
@ -212,16 +201,14 @@ const agentChatStream = (params, onChunk) => {
});
// #endif
});
};
}
// window.atob兼容性处理
const weAtob = (string) => {
const b64re =
/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
const b64 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
// 去除空白字符
string = String(string).replace(/[\t\n\f\r ]+/g, "");
string = String(string).replace(/[\t\n\f\r ]+/g, '');
// 验证 Base64 编码
if (!b64re.test(string)) {
throw new TypeError(
@ -231,10 +218,10 @@ const weAtob = (string) => {
}
// 填充字符
string += "==".slice(2 - (string.length & 3));
string += '=='.slice(2 - (string.length & 3));
let bitmap,
result = "",
result = '',
r1,
r2,
i = 0;
@ -249,7 +236,10 @@ const weAtob = (string) => {
if (r1 === 64) {
result += String.fromCharCode((bitmap >> 16) & 255);
} else if (r2 === 64) {
result += String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255);
result += String.fromCharCode(
(bitmap >> 16) & 255,
(bitmap >> 8) & 255
);
} else {
result += String.fromCharCode(
(bitmap >> 16) & 255,
@ -261,6 +251,7 @@ const weAtob = (string) => {
return result;
};
// 解析SSE分段数据
const parseSSEChunk = (raw) => {
const results = [];
@ -273,7 +264,7 @@ const parseSSEChunk = (raw) => {
let dataLines = [];
for (const line of lines) {
if (line.startsWith("data:")) {
if (line.startsWith('data:')) {
// 提取data:后面的内容并去除首尾空格
dataLines.push(line.slice(5).trim());
}
@ -281,18 +272,18 @@ const parseSSEChunk = (raw) => {
if (dataLines.length > 0) {
// 拼接多行数据
const fullData = dataLines.join("\n");
const fullData = dataLines.join('\n');
try {
const obj = JSON.parse(fullData);
results.push(obj);
} catch (e) {
console.warn("⚠️ SSE数据解析失败:", e, "原始数据:", fullData);
console.warn('⚠️ SSE数据解析失败:', e, '原始数据:', fullData);
// 解析失败忽略
}
}
}
return results;
};
}
export { agentChatStream, stopAbortTask };
export { agentChatStream, stopAbortTask }

View File

@ -1,19 +0,0 @@
const isProd = false;
// 测试
const VITE_BASE_URL_TEST = "https://onefeel.brother7.cn/ingress";
const VITE_WSS_URL_TEST = "wss://onefeel.brother7.cn/ingress/agent/ws/chat";
// 生产
const VITE_BASE_URL_PRO = "https://biz.nianxx.cn";
const VITE_WSS_URL_PRO = "wss://biz.nianxx.cn/agent/ws/chat";
// 环境配置
export const BASE_URL = isProd ? VITE_BASE_URL_PRO : VITE_BASE_URL_TEST;
export const WSS_URL = isProd ? VITE_WSS_URL_PRO : VITE_WSS_URL_TEST;
// =====================================
// 环境配置文件使用方法
// console.log("当前环境:", import.meta.env);
// export const BASE_URL = import.meta.env.VITE_BASE_URL;
// export const WSS_URL = import.meta.env.VITE_WSS_URL;

View File

@ -1,4 +1,4 @@
import { BASE_URL } from "./baseUrl";
import { BASE_URL } from "../../constant/base";
import { goLogin } from "@/hooks/useGoLogin";
const defaultConfig = {
@ -50,10 +50,10 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
success: (res) => {
console.log("请求响应:" + JSON.stringify(res));
resolve(res.data);
// if (res.statusCode && res.statusCode === 424) {
// uni.setStorageSync("token", "");
// goLogin();
// }
if (res.statusCode && res.statusCode === 424) {
uni.setStorageSync("token", "");
goLogin();
}
},
fail: (err) => {
console.error("请求失败:", err);

View File

@ -5,7 +5,6 @@ export const useAppStore = defineStore("app", {
return {
title: "",
sceneId: "",
hasToken: false,
};
},
getters: {},
@ -17,9 +16,6 @@ export const useAppStore = defineStore("app", {
setSceneId(data) {
this.sceneId = data;
},
setHasToken(data) {
this.hasToken = data;
},
},
unistorage: true,