diff --git a/_app.js b/_app.js deleted file mode 100644 index 770b118..0000000 --- a/_app.js +++ /dev/null @@ -1 +0,0 @@ -import '@fortawesome/fontawesome-svg-core/styles.css'; // 引入Font Awesome CSS diff --git a/api/public.js b/api/public.js new file mode 100644 index 0000000..91ceced --- /dev/null +++ b/api/public.js @@ -0,0 +1,81 @@ +import { get } from "@/utils/storeInfo"; +import require from "@/utils/require"; +import { Toast } from "antd-mobile"; +//关注和取关功能 +export const handleFollow = async (isFollowed, followedID, callback) => { + const account = get("account"); + let body = { + [!isFollowed ? "account_relations" : "sentences"]: [ + { sub_mid: account.mid, obj_mid: followedID, predicate: 0 }, + { sub_mid: followedID, obj_mid: account.mid, predicate: 1 }, + ], + }; + try { + const data = await require("POST", `/api/account_relation/${ + !isFollowed ? "create" : "delete" + }`, { + body, + }); + if (data.ret === -1) { + Toast.show({ + icon: "fail", + content: data.msg, + position: "top", + }); + return; + } else { + callback(!isFollowed); + } + } catch (error) { + console.error(error); + } +}; + +//点赞和取消点赞功能 +export const thumbsUp = async (id, times = 1,callback) => { + console.log("times", times); + try { + const body = { + moment_id: id, + times: times==1?-1:1, + }; + const data = await require("POST", `/api/moment/thumbs_up`, { + body, + }); + if (data.ret === -1) { + Toast.show({ + icon: "fail", + content: data.msg, + position: "top", + }); + return; + }else{ + callback(times==1?-1:1); + } + } catch (error) { + console.error(error); + } +}; + +export async function checkRelation(subMid, objMid, predicate) { + try { + const data = await require("POST", `/api/account_relation/list_by_sentence`, { + body:{ + sub_mid: subMid, + obj_mid: objMid, + predicate: predicate, + }, + }); + if (data.ret === -1) { + Toast.show({ + type: "error", + text1: data.msg, + topOffset: 60, + }); + return; + } + return data.data.is_account_relation_existed; + } catch (error) { + console.error(error); + } +} diff --git a/api/space.js b/api/space.js new file mode 100644 index 0000000..61976e4 --- /dev/null +++ b/api/space.js @@ -0,0 +1,65 @@ +import require from "@/utils/require"; + +export const getStreamerInfo = async (mid) => { + try { + const data = await require("POST", "/api/zone/list_by_mid", { + body: { + mid, + }, + }); + if (data.ret === -1) { + Toast.show({ + icon: "fail", + content: data.msg, + position: "top", + }); + return; + } + return { + ...data.data.list[0], + refund_enable: data.data.refund_enable, + refund_status: data.data.refund_status, + }; + } catch (error) { + console.error(error); + } +}; +//获取空间数据并将该空间标为已读 +export const getSpaceData = async (mid) => { + try { + const data = await require("POST", `/api/zone/list_by_mid`, { + body: { + mid, + }, + }); + if (data.ret === -1) { + Toast.show({ + type: "error", + text1: data.msg, + topOffset: 60, + }); + return; + } + + //将空间标为已读 + const data2 = await require("POST", `/api/zone_session/upsert`, { + body: { + zid: data.data.list[0].id, + }, + }); + if (data2.ret === -1) { + Toast.show({ + type: "error", + text1: data2.msg, + topOffset: 60, + }); + return; + } + return { + isRefunding: data.data.refund_status === 1, + noRole: data.data.list[0].visitor_role === 4, + }; + } catch (error) { + console.error(error); + } +}; diff --git a/app/globals.css b/app/globals.css index c15ee24..164b07c 100644 --- a/app/globals.css +++ b/app/globals.css @@ -151,4 +151,9 @@ body{ .adm-dialog .adm-dialog-content{ max-height: none; height: 100%; +} +.adm-toast-icon{ + display: flex; + justify-content: center; + align-items: center; } \ No newline at end of file diff --git a/app/layout.js b/app/layout.js index 9a30a8b..fd5bb48 100644 --- a/app/layout.js +++ b/app/layout.js @@ -1,12 +1,15 @@ +"use client"; import { Inter } from "next/font/google"; -import React, { useEffect } from 'react'; +import React, { useEffect } from "react"; import "./globals.css"; import BottomNav from "../components/BottomNav"; +import { Provider } from 'react-redux'; +import store from '../store'; const inter = Inter({ subsets: ["latin"] }); export const metadata = { title: "铁粉空间", - + description: "与Ta永不失联", keywords: [ "铁粉空间", @@ -29,18 +32,14 @@ export const viewport = { }; export default function RootLayout({ children }) { return ( - +
- {children} ++{regionCode}
++ +{loginInfo.regionCode} +
setMobilePhone(value)} - value={mobilePhone} + onChange={(value) => + setLoginInfo({ ...loginInfo, mobilePhone: value }) + } + value={loginInfo.mobilePhone} + style={{ "--color": "#FFFFFF", "--font-size": "16px" }} + /> ++ 密码 +
+ setLoginInfo({ ...loginInfo, password: value})} + value={loginInfo.password} + type="password" style={{ "--color": "#FFFFFF", "--font-size": "16px" }} />+{regionCode}
++ +{loginInfo.regionCode} +
setMobilePhone(value)} - value={mobilePhone} + onChange={(value) => + setLoginInfo({ ...loginInfo, mobilePhone: value }) + } + value={loginInfo.mobilePhone} style={{ "--color": "#FFFFFF", "--font-size": "16px" }} />测试账号
+{userInfo.name}
粉丝
540
+{userInfo.gold_num}
金币
0
+{userInfo.diamond_num}
钻石
+ {streamerInfo?.streamer_ext?.name} +
++ 个性签名| + {streamerInfo?.streamer_ext?.bio} +
+来这找我玩
+ +PUPIHAN
-- 个性签名| - 专属圈内容都在空间里,永久更新外面看不到哟 -
-来这找我玩
-
御姐风细跟高跟鞋太绝了
-{item?.bio}
御姐风细跟高跟鞋太绝了
+ {streamerInfo?.streamer_ext?.name} +
++ 分享 +
+查看微信
++ {streamerInfo?.is_ironfanship_unlocked === 1 + ? "已是铁粉" + : "成为铁粉"} +
+{`${parseInt( + streamerInfo?.expenditure / 100, + 10 + )}/${parseInt(streamerInfo?.ironfanship_price / 100, 10)}`}
++ {streamerInfo?.is_superfanship_unlocked === 1 + ? "尊贵超粉" + : "成为超粉"} +
+举报
+审核未通过
+查看微信
+已是铁粉
+ {/*0/299
*/} +尊贵超粉
+草莓不可爱
-- 分享 -
-查看微信
-已是铁粉
-0/299
-尊贵超粉
-举报
-查看微信
-已是铁粉
- {/*0/299
*/} -尊贵超粉
-- 当前铁粉解锁进度: - 50% -
-- 空间内累计消费达到¥1280即可成为 - 铁粉 - ,可查看所有铁粉专享内容哟,快来成为我的铁粉吧~ -
-草莓不可爱
-
- 添加时请备注自己“铁粉空间”昵称
-
- 若解锁后72小时为通过好友,请联系客服
-
+ {data?.streamer_ext?.name} +
+查看微信
+{data?.zone_moment_count}
+动态
+{data?.image_count}
+照片
+{data?.video_count}
+视频
++ 空间介绍 +
+{data?.profile}
++ 付费须知 +
++ 1、加入后,您可以查看空间内相关内容; +
++ 2、本空间由空间主人自行创建,加入空间前请确认相关风险,本平台不提供相关保证,请避免上当受骗; +
++ 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买。 +
++ 4、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理。 +
+草莓不可爱
+
+ 添加时请备注自己“铁粉空间”昵称
+
+ 若解锁后72小时为通过好友,请联系客服
+
草莓不可爱
-查看微信
-38
-动态
-38
-照片
-38
-视频
-空间介绍
-- 草莓秘密基地,一次进入永久权限。都是你想看到的哟。 -
-付费须知
-- 1、加入后,您可以查看空间内相关内容; -
-- 2、本空间由空间主人自行创建,加入空间前请确认相关风险,本平台不提供相关保证,请避免上当受骗; -
-- 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买。 -
-- 4、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理。 -
-草莓不可爱
-
- 添加时请备注自己“铁粉空间”昵称
-
- 若解锁后72小时为通过好友,请联系客服
-
{name}
+
+ 添加时请备注自己“铁粉空间”昵称
+
+ 若解锁后72小时为通过好友,请联系客服
+
+ 余额不足 +
+{title}
+{content}
+- 空间内任何消费满399元即可成为铁粉 +
+ 空间内任何消费满{data.ironfanship_price}元即可成为铁粉
)}{data.text}
- { - data.text?.length>50 && + {data.text?.length > 50 && (+ 当前铁粉解锁进度: + {ironFanProgress}% +
+{`${ + expenditure / 100 + } / ${ironfanship_price / 100}`}
++ 空间内累计消费达到¥1280即可成为 + 铁粉 + ,可查看所有铁粉专享内容哟,快来成为我的铁粉吧~ +
+