diff --git a/app/globals.css b/app/globals.css
index 9112745..e5958fe 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -92,7 +92,7 @@ body{
.tabPinkLine::after {
content: "";
position: absolute;
- background-image: url(http://localhost:3000/icons/tabindicator.png);
+ background-image: url("/icons/tabindicator.png");
height: 34px;
background-position: -2px -18px;
background-size: cover;
@@ -105,7 +105,7 @@ body{
.titlePinkLine::after {
content: "";
position: absolute;
- background-image: url(http://localhost:3000/icons/pinkline.png);
+ background-image: url("/icons/pinkline.png");
height: 12px;
width: inherit;
min-width: 42px;
diff --git a/app/login/index.module.css b/app/login/index.module.scss
similarity index 80%
rename from app/login/index.module.css
rename to app/login/index.module.scss
index d89143b..76c07d0 100644
--- a/app/login/index.module.css
+++ b/app/login/index.module.scss
@@ -1,11 +1,21 @@
+
+.customTabs {
+ border: none;
+ --active-line-color: #ff8383;
+ --active-title-color: #fff;
+ --title-color: #a0a0a0;
+ --inactive-title-color: #FFFFFF80;
+ --tab-border-color: #ff8383;
+}
+
.customTabs>div>div:last-child>div:first-child {
z-index: 1;
background: none;
}
-.customTabs>div>div:last-child>div:first-child ::after{
- content: '';
- background-image: url(http://localhost:3000/icons/tabindicator.png);
+.customTabs>div>div:last-child>div:first-child::after{
+ content: "";
+ background-image: url("/icons/tabindicator.png");
height: 44px;
background-size: cover;
background-repeat: no-repeat;
@@ -14,14 +24,6 @@
top: -48px;
left: calc(50% - 25px);
}
-.customTabs {
- border: none;
- --active-line-color: #ff8383;
- --active-title-color: #fff;
- --title-color: #a0a0a0;
- --inactive-title-color: #5c5c5c;
- --tab-border-color: #ff8383;
-}
/* .loginBox .adm-tabs .adm-tabs-tab {
color: #a0a0a0;
} */
diff --git a/app/login/page.js b/app/login/page.js
index d4780a3..23e60cd 100644
--- a/app/login/page.js
+++ b/app/login/page.js
@@ -12,7 +12,7 @@ import {
Image,
} from "antd-mobile";
import { useRouter } from "next/navigation";
-import styles from "./index.module.css";
+import styles from "./index.module.scss";
import { JSEncrypt } from "jsencrypt";
import { handleLogin } from "@/store/actions";
import { saveUserInfo, removeUserInfo } from "@/utils/storeInfo";
@@ -197,13 +197,13 @@ function Login({ handleLogin }) {
}
};
return (
-
+
-
+
{
diff --git a/app/messageDetail/page.js b/app/messageDetail/page.js
index d9e70ad..fd7a858 100644
--- a/app/messageDetail/page.js
+++ b/app/messageDetail/page.js
@@ -42,7 +42,6 @@ export default function MessageDetail({}) {
if (oldMessages[0]) {
updateMessages(oldMessages[0]?.id, 0, oldMessages);
// toScrollBottom.current = 1;
-
}
}, 3000); // 间隔时间为3秒
@@ -53,8 +52,7 @@ export default function MessageDetail({}) {
}, [oldMessages]);
useEffect(() => {
if (toScrollBottom.current) {
-
- scrollBox.current?.scrollTo(0, scrollBox.current.scrollHeight+50);
+ scrollBox.current?.scrollTo(0, scrollBox.current.scrollHeight + 50);
toScrollBottom.current = 0;
}
}, [messages]);
@@ -79,14 +77,17 @@ export default function MessageDetail({}) {
}, [sessionId]);
//查询session
const getSession = async (mid) => {
- setLoading(true)
+ setLoading(true);
try {
- const data =
- await requireAPI("POST", "/api/contact_customer_service_session/list_by_mid", {
+ const data = await requireAPI(
+ "POST",
+ "/api/contact_customer_service_session/list_by_mid",
+ {
body: {
mid: Number(mid),
},
- });
+ }
+ );
if (data.ret === -1) {
Toast.show({
icon: "fail",
@@ -94,26 +95,32 @@ export default function MessageDetail({}) {
position: "top",
});
}
- setLoading(false)
+ setLoading(false);
if (data.data.session) {
setSessionId(data.data.session.id);
- return;
+ } else {
+ //如果是第一次发送,需要创建session
+ createSession(mid);
}
} catch (error) {
console.error(error);
}
};
//创建session
- const createSession = async () => {
- setLoading(true)
+ const createSession = async (mid) => {
+ setLoading(true);
try {
- const data =
- await requireAPI("POST", "/api/contact_customer_service_session/create", {
+ const data = await requireAPI(
+ "POST",
+ "/api/contact_customer_service_session/create",
+ {
body: {
sub_mid: Number(mid),
obj_mid: 0,
},
- });
+ }
+ );
+
if (data.ret === -1) {
Toast.show({
icon: "fail",
@@ -122,7 +129,7 @@ export default function MessageDetail({}) {
});
}
setSessionId(data.data.session_id);
- setLoading(false)
+ setLoading(false);
} catch (error) {
console.error(error);
}
@@ -131,15 +138,18 @@ export default function MessageDetail({}) {
const loadEarlierHistory = async () => {
if (!more) return;
try {
- setLoading(true)
- const data =
- await requireAPI("POST", "/api/contact_customer_service/list_by_session_id", {
+ setLoading(true);
+ const data = await requireAPI(
+ "POST",
+ "/api/contact_customer_service/list_by_session_id",
+ {
body: {
session_id: sessionId,
offset: offset,
limit: 12,
},
- });
+ }
+ );
if (data.ret === -1) {
Toast.show({
icon: "fail",
@@ -150,9 +160,9 @@ export default function MessageDetail({}) {
}
setOffset(data.data.offset);
setMore(data.data.more);
- let mathNewMessages = handleData([...oldMessages,...data.data.list]);
+ let mathNewMessages = handleData([...oldMessages, ...data.data.list]);
// setMessages((prev) => [...prev, ...temMessages]);
- setLoading(false)
+ setLoading(false);
return mathNewMessages;
} catch (error) {
console.error(error);
@@ -170,21 +180,21 @@ export default function MessageDetail({}) {
return;
}
- //如果是第一次发送,需要创建session
- if (!sessionId) await createSession();
-
//查询历史记录的时候后移一位,防止记录重复
setOffset((prev) => prev + 1);
//请求接口发送私信
try {
- const data =
- await requireAPI("POST", "/api/contact_customer_service/create", {
+ const data = await requireAPI(
+ "POST",
+ "/api/contact_customer_service/create",
+ {
body: {
session_id: sessionId,
predicate: 0,
message,
},
- });
+ }
+ );
if (data.ret === -1) {
Toast.show({
icon: "error",
@@ -195,7 +205,7 @@ export default function MessageDetail({}) {
}
// updateLatestHistory();
// console.log("oldArr", oldArr);
- updateMessages(lastId, 0, oldArr).then(res=>{
+ updateMessages(lastId, 0, oldArr).then((res) => {
setNewMessage("");
toScrollBottom.current = 1;
});
@@ -310,14 +320,17 @@ export default function MessageDetail({}) {
const updateMessages = async (lastId, currentOffset, oldArr) => {
// console.log("lastId", lastId);
try {
- const data =
- await requireAPI("POST", "/api/contact_customer_service/list_by_session_id", {
+ const data = await requireAPI(
+ "POST",
+ "/api/contact_customer_service/list_by_session_id",
+ {
body: {
session_id: sessionId,
offset: currentOffset,
limit: 12,
},
- });
+ }
+ );
if (data.ret === -1) {
Toast.show({
icon: "fail",
@@ -330,12 +343,12 @@ export default function MessageDetail({}) {
return element.id > lastId;
});
// console.log("[...messages,...newData]", [...newData]);
- let mathNewMessages = handleData([...newData,...oldArr]);
+ let mathNewMessages = handleData([...newData, ...oldArr]);
setMessages((old) => {
toScrollBottom.current = 1;
return mathNewMessages;
});
- return
+ return;
} catch (error) {
console.error(error);
}
@@ -357,11 +370,14 @@ export default function MessageDetail({}) {
-
- {loading?
: more ?
查看更早:
无更早消息}
+
+ {loading ? (
+
+ ) : more ? (
+ 查看更早
+ ) : (
+ 无更早消息
+ )}
@@ -429,7 +445,9 @@ export default function MessageDetail({}) {