diff --git a/App.vue b/App.vue
index 65d220e..173b0e5 100644
--- a/App.vue
+++ b/App.vue
@@ -38,6 +38,12 @@ body,
// 重置按钮样式
.reset-btn {
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 1000;
background: none;
border: none;
outline: none;
diff --git a/components/Interceptor/index.vue b/components/Interceptor/index.vue
new file mode 100644
index 0000000..bfea59a
--- /dev/null
+++ b/components/Interceptor/index.vue
@@ -0,0 +1,18 @@
+
+
+
+
+
diff --git a/hooks/useGoLogin.js b/hooks/useGoLogin.js
index d8e1eae..0ca9a36 100644
--- a/hooks/useGoLogin.js
+++ b/hooks/useGoLogin.js
@@ -22,9 +22,6 @@ export const onLogin = (e) => {
// 绑定手机号
bindPhone(params);
-
- // 通知刷新
- uni.$emit("TOKEN_CHANGE");
});
};
diff --git a/manager/AuthManager.js b/manager/AuthManager.js
index 219d9c2..019faba 100644
--- a/manager/AuthManager.js
+++ b/manager/AuthManager.js
@@ -1,14 +1,24 @@
export const getWeChatAuthCode = () => {
- return new Promise((resolve, reject) => {
- uni.login({
- provider: 'weixin',
- onlyAuthorize: true,
- success: (res) => {
- resolve(res.code);
- },
- fail: (err) => {
- reject(err);
- }
- });
+ return new Promise((resolve, reject) => {
+ // 条件编译微信小程序、抖音小程序
+ let provider = "";
+ // #ifdef MP-WEIXIN
+ provider = "weixin";
+ // #endif
+
+ // #ifdef MP-TOUTIAO
+ provider = "toutiao";
+ // #endif
+
+ uni.login({
+ provider,
+ success: (res) => {
+ console.log("微信登录成功", res);
+ resolve(res.code);
+ },
+ fail: (err) => {
+ reject(err);
+ },
});
-}
\ No newline at end of file
+ });
+};
diff --git a/manager/LoginManager.js b/manager/LoginManager.js
index bd561b0..de18336 100644
--- a/manager/LoginManager.js
+++ b/manager/LoginManager.js
@@ -4,6 +4,7 @@ import {
checkUserPhone,
} from "../request/api/LoginApi";
import { getWeChatAuthCode } from "./AuthManager";
+import { useAppStore } from "@/store";
const loginAuth = () => {
return new Promise(async (resolve, reject) => {
@@ -20,6 +21,9 @@ const loginAuth = () => {
if (response.access_token) {
uni.setStorageSync("token", response.access_token);
+ const appStore = useAppStore();
+
+ appStore.setHasToken(true);
resolve();
} else {
reject(response.message || "登录失败");
diff --git a/pages/chat/ChatMainList.vue b/pages/chat/ChatMainList.vue
index 450f66b..3984de9 100644
--- a/pages/chat/ChatMainList.vue
+++ b/pages/chat/ChatMainList.vue
@@ -362,8 +362,16 @@ const initHandler = () => {
initWebSocket();
};
-// 监听token变化
-uni.$on("TOKEN_CHANGE", () => initHandler());
+// 绑定成功,监听token变化,初始化
+
+watch(
+ () => appStore.hasToken,
+ (newValue) => {
+ if (newValue) {
+ initHandler();
+ }
+ }
+);
onMounted(() => {
try {
diff --git a/pages/chat/ChatMoreTips.vue b/pages/chat/ChatMoreTips.vue
index 47db0f1..01b5a48 100644
--- a/pages/chat/ChatMoreTips.vue
+++ b/pages/chat/ChatMoreTips.vue
@@ -6,26 +6,22 @@
v-for="(item, index) in itemList"
:key="index"
>
-
+
diff --git a/pages/chat/styles/ChatMoreTips.scss b/pages/chat/styles/ChatMoreTips.scss
index 87738ed..918d3d3 100644
--- a/pages/chat/styles/ChatMoreTips.scss
+++ b/pages/chat/styles/ChatMoreTips.scss
@@ -21,6 +21,7 @@
flex-direction: column;
flex-shrink: 0;
white-space: nowrap;
+ position: relative;
.more-tips-item-title {
font-weight: 500;
diff --git a/pages/module/recommend/RecommendPostsList.vue b/pages/module/recommend/RecommendPostsList.vue
index 554eeb3..cfe7b8d 100644
--- a/pages/module/recommend/RecommendPostsList.vue
+++ b/pages/module/recommend/RecommendPostsList.vue
@@ -7,7 +7,9 @@
:key="index"
>
-
+
+
+
{{ item.topic }}
@@ -18,9 +20,11 @@
diff --git a/pages/module/recommend/styles/RecommendPostsList.scss b/pages/module/recommend/styles/RecommendPostsList.scss
new file mode 100644
index 0000000..57721ce
--- /dev/null
+++ b/pages/module/recommend/styles/RecommendPostsList.scss
@@ -0,0 +1,53 @@
+.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%;
+ }
+}
\ No newline at end of file
diff --git a/store/modules/app.js b/store/modules/app.js
index ecd4f39..0db9a58 100644
--- a/store/modules/app.js
+++ b/store/modules/app.js
@@ -5,6 +5,7 @@ export const useAppStore = defineStore("app", {
return {
title: "",
sceneId: "",
+ hasToken: false,
};
},
getters: {},
@@ -16,6 +17,9 @@ export const useAppStore = defineStore("app", {
setSceneId(data) {
this.sceneId = data;
},
+ setHasToken(data) {
+ this.hasToken = data;
+ },
},
unistorage: true,