From 9d78c5e2037e4b6943f499ec54f9f7c127881e30 Mon Sep 17 00:00:00 2001 From: al <al@cdhncy.com> Date: Mon, 9 Sep 2024 15:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8Aconsole.log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/public.js | 59 ++++++++++------- api/space.js | 9 ++- api/streamer.js | 40 +++++------ app/bill/[type]/page.jsx | 25 +++---- app/login/page.js | 24 +++---- app/messageDetail/page.js | 8 +-- app/my/editUserProfile/editUserName/page.js | 2 +- .../selectUserProfileItem/page.js | 2 +- app/my/setting/deleteAccount/page.js | 6 +- app/my/setting/editPassword/page.js | 2 +- app/my/setting/feedback/page.js | 2 +- app/my/unlockedWechat/page.jsx | 2 +- app/my/wallet/page.js | 2 +- app/profile/[mid]/page.js | 66 +------------------ app/search/page.js | 11 ++-- app/space/page.js | 4 +- .../person_space_introduce/[mid]/page.js | 2 +- app/space/setting/page.js | 2 +- app/space/setting/spaceRefund/page.jsx | 4 +- app/space/share/[user_id]/page.jsx | 2 +- components/AddWeChat/index.js | 6 +- utils/auth.js | 6 +- utils/upload.js | 6 +- 23 files changed, 120 insertions(+), 172 deletions(-) diff --git a/api/public.js b/api/public.js index c87b449..8f6233a 100644 --- a/api/public.js +++ b/api/public.js @@ -21,7 +21,7 @@ export const handleLogout = async () => { return; } } catch (error) { - console.error(error); + // console.error(error); } }; //关注和取关功能 @@ -34,11 +34,13 @@ export const handleFollow = async (isFollowed, followedID, callback) => { ], }; try { - const data = await requireAPI("POST", `/api/account_relation/${ - !isFollowed ? "create" : "delete" - }`, { - body, - }); + const data = await requireAPI( + "POST", + `/api/account_relation/${!isFollowed ? "create" : "delete"}`, + { + body, + } + ); if (data.ret === -1) { Toast.show({ icon: "fail", @@ -50,7 +52,7 @@ export const handleFollow = async (isFollowed, followedID, callback) => { callback && callback(!isFollowed); } } catch (error) { - console.error(error); + // console.error(error); } }; @@ -68,11 +70,13 @@ export const thumbsUp = async (id, times, callback, isZone) => { }; // console.log("body", body); - const data = await requireAPI("POST", `/api/${ - isZone ? "zone_moment" : "moment" - }/thumbs_up`, { - body, - }); + const data = await requireAPI( + "POST", + `/api/${isZone ? "zone_moment" : "moment"}/thumbs_up`, + { + body, + } + ); if (data.ret === -1) { Toast.show({ icon: "fail", @@ -84,7 +88,7 @@ export const thumbsUp = async (id, times, callback, isZone) => { callback(times == 1 ? -1 : 1); } } catch (error) { - console.error(error); + // console.error(error); } }; //点赞和取消点赞功能 @@ -109,20 +113,23 @@ export const zoneThumbsUp = async (id, times = 1, callback) => { callback(times == 1 ? -1 : 1); } } catch (error) { - console.error(error); + // console.error(error); } }; // 查看关系 export async function checkRelation(subMid, objMid, predicate) { try { - const data = - await requireAPI("POST", `/api/account_relation/list_by_sentence`, { + const data = await requireAPI( + "POST", + `/api/account_relation/list_by_sentence`, + { body: { sub_mid: subMid, obj_mid: objMid, predicate: predicate, }, - }); + } + ); if (data.ret === -1) { Toast.show({ icon: "fail", @@ -133,13 +140,18 @@ export async function checkRelation(subMid, objMid, predicate) { } return data.data.is_account_relation_existed; } catch (error) { - console.error(error); + // console.error(error); } } // 获取用户信息 export async function getUserInfo() { try { - const data = await requireAPI("POST", `/api/account/list_by_mid`, null, true); + const data = await requireAPI( + "POST", + `/api/account/list_by_mid`, + null, + true + ); if (data.ret === -1) { Toast.show({ icon: "fail", @@ -150,7 +162,7 @@ export async function getUserInfo() { } return data.data.account; } catch (error) { - console.error(error); + // console.error(error); } } @@ -228,14 +240,14 @@ export const createOrder = async (type = "alipay_h5") => { break; } } catch (error) { - console.error(error); + // console.error(error); } finally { setIsLoading(false); } }; //点击获取验证码 -export const handleVerification = async (mobilePhone="",regionCode) => { +export const handleVerification = async (mobilePhone = "", regionCode) => { // console.log("mobilePhone",mobilePhone.toString()) //手机号校验 if (!mobilePhone.toString().match(/^1[3456789]\d{9}$/)) { @@ -259,7 +271,6 @@ export const handleVerification = async (mobilePhone="",regionCode) => { }, }); } catch (error) { - console.error(error); + // console.error(error); } }; - diff --git a/api/space.js b/api/space.js index 2512194..72e92fa 100644 --- a/api/space.js +++ b/api/space.js @@ -1,7 +1,6 @@ import requireAPI from "@/utils/requireAPI"; -import {Toast} from "antd-mobile" +import { Toast } from "antd-mobile"; export const getStreamerInfo = async (mid) => { - try { const data = await requireAPI("POST", "/api/zone/list_by_mid", { body: { @@ -22,7 +21,7 @@ export const getStreamerInfo = async (mid) => { refund_status: data.data.refund_status, }; } catch (error) { - console.error(error); + // console.error(error); } }; export const getStreamerDetailInfo = async (mid) => { @@ -44,7 +43,7 @@ export const getStreamerDetailInfo = async (mid) => { ...data.data, }; } catch (error) { - console.error(error); + // console.error(error); } }; //获取空间数据并将该空间标为已读 @@ -84,6 +83,6 @@ export const getSpaceData = async (mid) => { noRole: data.data.list[0].visitor_role === 4, }; } catch (error) { - console.error(error); + // console.error(error); } }; diff --git a/api/streamer.js b/api/streamer.js index c1f223a..bd11e8b 100644 --- a/api/streamer.js +++ b/api/streamer.js @@ -1,24 +1,24 @@ import requireAPI from "@/utils/requireAPI"; // import { Toast } from "antd-mobile"; export const getStreamer = async (userId) => { - try { - const data = await requireAPI("POST", "/api/streamer/list_ext_by_user_id", { - body: { - user_id:userId, - }, - }); - if (data.ret === -1) { - // Toast.show({ - // icon: "fail", - // content: data.msg, - // position: "top", - // }); - return; - } - return { - ...data.data, - }; - } catch (error) { - console.error(error); + try { + const data = await requireAPI("POST", "/api/streamer/list_ext_by_user_id", { + body: { + user_id: userId, + }, + }); + if (data.ret === -1) { + // Toast.show({ + // icon: "fail", + // content: data.msg, + // position: "top", + // }); + return; } - }; \ No newline at end of file + return { + ...data.data, + }; + } catch (error) { + // console.error(error); + } +}; diff --git a/app/bill/[type]/page.jsx b/app/bill/[type]/page.jsx index 72ed7f0..0d13e68 100644 --- a/app/bill/[type]/page.jsx +++ b/app/bill/[type]/page.jsx @@ -1,7 +1,7 @@ "use client"; import React, { useState, useEffect } from "react"; -import {useRouter} from "next/navigation"; +import { useRouter } from "next/navigation"; import requireAPI from "@/utils/requireAPI"; export default function BillDetail({ params }) { const [data, setData] = useState([]); @@ -30,15 +30,13 @@ export default function BillDetail({ params }) { } try { setIsFetching(true); - const _data = await requireAPI( - "POST", - "/api/vas/get_ch_list", - {body: { + const _data = await requireAPI("POST", "/api/vas/get_ch_list", { + body: { type: type, offset: 0, limit: 99, - }} - ); + }, + }); if (_data.ret === -1) { Toast.show({ content: _data.msg, @@ -48,7 +46,7 @@ export default function BillDetail({ params }) { setData(_data.data.list); setIsFetching(false); } catch (error) { - console.error(error); + // console.error(error); } }; const RenderItem = ({ item }) => { @@ -79,7 +77,10 @@ export default function BillDetail({ params }) { return ( <section className="flex flex-1 flex-col"> {params.type == "income" && ( - <div className="flex flex-col mt-4 btn border-none bg-[#FF61B030] items-center text-base font-medium" onClick={()=>router.push("income/income_querry")}> + <div + className="flex flex-col mt-4 btn border-none bg-[#FF61B030] items-center text-base font-medium" + onClick={() => router.push("income/income_querry")} + > <p className="text-primary">查看近一周收益情况</p> </div> )} @@ -116,9 +117,9 @@ export default function BillDetail({ params }) { </div> )} <div> - {data.map((item, index) => ( - <RenderItem key={index} item={item} /> - ))} + {data.map((item, index) => ( + <RenderItem key={index} item={item} /> + ))} </div> </section> ); diff --git a/app/login/page.js b/app/login/page.js index 3eedeab..f129623 100644 --- a/app/login/page.js +++ b/app/login/page.js @@ -19,7 +19,7 @@ import { saveUserInfo, get, save } from "@/utils/storeInfo"; import { connect } from "react-redux"; import { cryptoPassword } from "@/utils/crypto"; import requireAPI from "@/utils/requireAPI"; -import { signOut, signIn,checkAuth } from "@/utils/auth"; +import { signOut, signIn, checkAuth } from "@/utils/auth"; /* params格式: { @@ -55,12 +55,12 @@ function Login({ handleLogin }) { setDeviceType("pc"); } handleLogin({ isSignin: false, userToken: null }); - checkAuth().then(res=>{ - const account = get("account") - if(res && account){ - router.replace("/") + checkAuth().then((res) => { + const account = get("account"); + if (res && account) { + router.replace("/"); } - }) + }); }, []); useEffect(() => { let interval; @@ -166,10 +166,10 @@ function Login({ handleLogin }) { saveUserInfo(data, mobilePhone, regionCode); signIn(data); handleLogin({ isSignin: true, userToken: data.data.token }); - if(get("firstLogin")==null){ - save("firstLogin",1) - }else{ - save("firstLogin",0) + if (get("firstLogin") == null) { + save("firstLogin", 1); + } else { + save("firstLogin", 0); } router.push( !data?.data?.is_enabled && type != "password" @@ -177,7 +177,7 @@ function Login({ handleLogin }) { : "/" ); } catch (error) { - console.error(error); + // console.error(error); } }; //点击获取验证码 @@ -227,7 +227,7 @@ function Login({ handleLogin }) { return; } } catch (error) { - console.error(error); + // console.error(error); } }; return ( diff --git a/app/messageDetail/page.js b/app/messageDetail/page.js index e200e0e..31219b9 100644 --- a/app/messageDetail/page.js +++ b/app/messageDetail/page.js @@ -125,7 +125,7 @@ export default function MessageDetail({}) { createSession(mid); } } catch (error) { - console.error(error); + // console.error(error); } }; //创建session @@ -153,7 +153,7 @@ export default function MessageDetail({}) { setSessionId(data.data.session_id); setLoading(false); } catch (error) { - console.error(error); + // console.error(error); } }; //请求历史记录 @@ -187,7 +187,7 @@ export default function MessageDetail({}) { setLoading(false); return mathNewMessages; } catch (error) { - console.error(error); + // console.error(error); } }; //发送私信功能 @@ -232,7 +232,7 @@ export default function MessageDetail({}) { toScrollBottom.current = 1; }); } catch (error) { - console.error(error); + // console.error(error); } // //每次发送都缓存信息到本地 // addArr(`${selfData.mid}_to_${params.mid}_messages`, messages); diff --git a/app/my/editUserProfile/editUserName/page.js b/app/my/editUserProfile/editUserName/page.js index d7ff277..eaa7045 100644 --- a/app/my/editUserProfile/editUserName/page.js +++ b/app/my/editUserProfile/editUserName/page.js @@ -64,7 +64,7 @@ export default function EditUserName() { const account = await getUserInfo(); save("account", JSON.stringify(account)); } catch (error) { - console.error(error); + // console.error(error); } router.back(); }; diff --git a/app/my/editUserProfile/selectUserProfileItem/page.js b/app/my/editUserProfile/selectUserProfileItem/page.js index 0aa0850..95d2c5a 100644 --- a/app/my/editUserProfile/selectUserProfileItem/page.js +++ b/app/my/editUserProfile/selectUserProfileItem/page.js @@ -42,7 +42,7 @@ export default function SelectUserProfileItem() { save("account", JSON.stringify(account)); setUserInfo(account); } catch (error) { - console.error(error); + // console.error(error); } }; return ( diff --git a/app/my/setting/deleteAccount/page.js b/app/my/setting/deleteAccount/page.js index 6f9e022..7376a0a 100644 --- a/app/my/setting/deleteAccount/page.js +++ b/app/my/setting/deleteAccount/page.js @@ -31,7 +31,7 @@ export default function DeleteAccount() { } if (_data.data.status === 0) setDeadline(_data.data.due_time); } catch (error) { - console.error(error); + // console.error(error); } }; //提交注销申请 @@ -50,7 +50,7 @@ export default function DeleteAccount() { checkAccountStatus(); showMobal.current?.close(); } catch (error) { - console.error(error); + // console.error(error); } }; //取消注销 @@ -67,7 +67,7 @@ export default function DeleteAccount() { } setDeadline(); } catch (error) { - console.error(error); + // console.error(error); } }; const handleShowDialog = () => { diff --git a/app/my/setting/editPassword/page.js b/app/my/setting/editPassword/page.js index 8fc9c4d..fe2fbc5 100644 --- a/app/my/setting/editPassword/page.js +++ b/app/my/setting/editPassword/page.js @@ -153,7 +153,7 @@ export default function EditPassword() { router.push("/"); } } catch (error) { - console.error(error); + // console.error(error); } }; diff --git a/app/my/setting/feedback/page.js b/app/my/setting/feedback/page.js index f7943a7..f69c236 100644 --- a/app/my/setting/feedback/page.js +++ b/app/my/setting/feedback/page.js @@ -55,7 +55,7 @@ export default function Feedback() { }); router.back(); } catch (error) { - console.error(error); + // console.error(error); } finally { setIsSubmitting(false); } diff --git a/app/my/unlockedWechat/page.jsx b/app/my/unlockedWechat/page.jsx index 4243919..f58408e 100644 --- a/app/my/unlockedWechat/page.jsx +++ b/app/my/unlockedWechat/page.jsx @@ -39,7 +39,7 @@ export default function UnlockedWechat() { setOffset(temData.data.offset); setHasMore(temData.data.more); } catch (error) { - console.error(error); + // console.error(error); } }; async function loadMore() { diff --git a/app/my/wallet/page.js b/app/my/wallet/page.js index eac323f..e9f5eb9 100644 --- a/app/my/wallet/page.js +++ b/app/my/wallet/page.js @@ -46,7 +46,7 @@ export default function Wallet() { save("account", _data?.data.account); setData(_data?.data.account); } catch (error) { - console.error(error); + // console.error(error); } }; return ( diff --git a/app/profile/[mid]/page.js b/app/profile/[mid]/page.js index 2e4ec1f..7277e11 100644 --- a/app/profile/[mid]/page.js +++ b/app/profile/[mid]/page.js @@ -48,70 +48,8 @@ export default function PersonSpace() { }, []); const showPhotos = (photos, index) => { currentIndex.current = index; - // const interval = setInterval(() => { - // console.log("bbbbbb") - // const bodyBox = document.getElementsByClassName("photos-bodyBox")[0]; - // if (bodyBox) { - // bodyBox.firstChild.lastChild.style.transform = `translateX(-${ - // currentIndex.current * (window.innerWidth + 16) - // }px)`; - // // console.log(bodyBox.firstChild.lastChild.style.transform); - // } - // }, 400); - - // handleShowImages(index, photos, interval); - // console.log(imagesMaskRef.current, photos); imagesMaskRef.current.show(photos, index, streamerInfo); - // setVisible(true) - // console.log(imagesMaskRef.current); - // imagesMaskRef.current.show( - // photos.map((item) => item?.url), - // index - // ); }; - // const handleShowImages = (index, photos, interval) => { - // const mediaDom = document.createElement("div"); - // mediaDom.style.width = "100vw"; - // document.body.appendChild(mediaDom); - // mediaDom.className = `${ - // photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom" - // }`; - // ImageViewer.clear(); - // ImageViewer.Multi.show({ - // images: photos.map((item) => item.url), - // defaultIndex: index, - // // renderFooter: (image, index) => { - // // return renderFooter(photos[index]?.type == "hid", mediaDom); - // // }, - - // getContainer: mediaDom, - // onIndexChange: (index) => { - // currentIndex.current = index; - // mediaDom.className = `${ - // photos[index]?.type == "hid" ? "mediaDom photos-body" : "mediaDom" - // }`; - // const leftBtn = document.getElementsByClassName("imagesBtnsControllerLeft")[0] - // const rightBtn = document.getElementsByClassName("imagesBtnsControllerRight")[0] - // if(leftBtn && rightBtn){ - // if(!index){ - // leftBtn.style.opacity=0.5 - // rightBtn.style.opacity=1 - // }else if(index==photos.length-1){ - // leftBtn.style.opacity=1 - // rightBtn.style.opacity=0.5 - // }else{ - // leftBtn.style.opacity=1 - // rightBtn.style.opacity=1 - // } - // } - // }, - // afterClose: () => { - // mediaDom.remove(); - // clearInterval(interval); - // }, - // classNames: { body: "photos-bodyBox" }, - // }); - // }; const handleGetStreamerInfo = async () => { try { setLoading(true); @@ -134,7 +72,7 @@ export default function PersonSpace() { setTopPhotos(photosArr); setLoading(false); } catch (error) { - console.error(error); + // console.error(error); } }; const getSpaceData = async () => { @@ -154,7 +92,7 @@ export default function PersonSpace() { } setSpaceData(data.data.list[0]); } catch (error) { - console.error(error); + // console.error(error); } }; const getRelationData = async () => { diff --git a/app/search/page.js b/app/search/page.js index 0999b7e..b10e9a9 100644 --- a/app/search/page.js +++ b/app/search/page.js @@ -226,7 +226,7 @@ export default function Search() { return /^\d+$/.test(str); }; const getResult = async (value) => { - console.log("searchValue", value); + // console.log("searchValue", value); if (filtersValue.comprehensiveUsed.used || filtersValue.priceUsed.used) { handleResetFiltersValue(); handleResetFiltersSearchValue(); @@ -265,7 +265,7 @@ export default function Search() { // } setLoading(false); } catch (error) { - console.error(error); + // console.error(error); } }; const getIsMember = async () => { @@ -278,7 +278,7 @@ export default function Search() { ); setIsMember(data.data.account.is_a_member); } catch (error) { - console.error(error); + // console.error(error); } }; //重置筛选值 @@ -383,7 +383,7 @@ export default function Search() { setRecommList(data.data.recomm_list); setLoading(false); } catch (error) { - console.error(error); + // console.error(error); } }; return ( @@ -694,7 +694,6 @@ export default function Search() { if (item.key == "constellation") { newValue.constellation = value[0]; } else { - console.log("*************", value[0]); newValue.city = value[0]; } return newValue; @@ -1008,7 +1007,7 @@ export default function Search() { <ZoneItem data={item} key={item.id} - link={`/profile/${item.mid}`} + link={`space/person_space_introduce/${item.mid}`} onlyOne={false} /> ))} diff --git a/app/space/page.js b/app/space/page.js index 20ca183..591681c 100644 --- a/app/space/page.js +++ b/app/space/page.js @@ -86,7 +86,7 @@ export default function Space() { return; } } catch (error) { - console.error(error); + // console.error(error); } }; const getSpacePosts = async (offset) => { @@ -116,7 +116,7 @@ export default function Space() { return finalData; } } catch (error) { - console.error(error); + // console.error(error); } }; async function loadMore() { diff --git a/app/space/person_space_introduce/[mid]/page.js b/app/space/person_space_introduce/[mid]/page.js index a1c450e..f214d5a 100644 --- a/app/space/person_space_introduce/[mid]/page.js +++ b/app/space/person_space_introduce/[mid]/page.js @@ -132,7 +132,7 @@ export default function PersonSpaceIntroduce() { } router.push("/space/" + mid); } catch (error) { - console.error(error); + // console.error(error); } }; return ( diff --git a/app/space/setting/page.js b/app/space/setting/page.js index 3e410fd..f55a0f5 100644 --- a/app/space/setting/page.js +++ b/app/space/setting/page.js @@ -103,7 +103,7 @@ export default function Setting() { }); setTimeout(() => router.replace("/"), 500); } catch (error) { - console.error(error); + // console.error(error); } }; return ( diff --git a/app/space/setting/spaceRefund/page.jsx b/app/space/setting/spaceRefund/page.jsx index 7de0049..ad6b5c3 100644 --- a/app/space/setting/spaceRefund/page.jsx +++ b/app/space/setting/spaceRefund/page.jsx @@ -82,7 +82,7 @@ export default function SpaceRefund() { }); router.replace("/"); } catch (error) { - console.error(error); + // console.error(error); } finally { setIsSubmitting(false); } @@ -105,7 +105,7 @@ export default function SpaceRefund() { } setData(_data.data); } catch (error) { - console.error(error); + // console.error(error); } }; return ( diff --git a/app/space/share/[user_id]/page.jsx b/app/space/share/[user_id]/page.jsx index 5ac3c39..a23230f 100644 --- a/app/space/share/[user_id]/page.jsx +++ b/app/space/share/[user_id]/page.jsx @@ -42,7 +42,7 @@ export default function Share() { ); setIsFetching(false); } catch (error) { - console.error(error); + // console.error(error); } }; getData(); diff --git a/components/AddWeChat/index.js b/components/AddWeChat/index.js index 69a11ff..8d6a022 100644 --- a/components/AddWeChat/index.js +++ b/components/AddWeChat/index.js @@ -120,7 +120,7 @@ export default function AddWeChat({ } return unlockData.data.order_id; } catch (error) { - console.error(error); + // console.error(error); } }; @@ -149,7 +149,7 @@ export default function AddWeChat({ return; } } catch (error) { - console.error(error); + // console.error(error); } }; @@ -216,7 +216,7 @@ export default function AddWeChat({ setIsMoneyEnough(false); } } catch (error) { - console.error(error); + // console.error(error); } } }; diff --git a/utils/auth.js b/utils/auth.js index 5487ee3..0b008ee 100644 --- a/utils/auth.js +++ b/utils/auth.js @@ -4,13 +4,13 @@ import { get } from "./storeInfo"; export async function checkAuth() { try { const data = await requireAPI("POST", `/api/login/validate`); - if(data.ret === 1){ + if (data.ret === 1) { return true; - }else{ + } else { return false; } } catch (e) { - console.log(e); + // console.log(e); } } diff --git a/utils/upload.js b/utils/upload.js index 58b72dc..171e49f 100644 --- a/utils/upload.js +++ b/utils/upload.js @@ -31,7 +31,7 @@ async function getAuth(mtype) { } return data.data.policy_token; } catch (error) { - console.error(error); + // console.error(error); } } @@ -120,7 +120,7 @@ async function getFailId() { } return data.data; } catch (e) { - console.warn(e); + // console.warn(e); } } @@ -194,7 +194,7 @@ export async function uploadVideo(asset) { const videoCover = await VideoThumbnails.getThumbnailAsync(asset?.uri); return videoCover; } catch (e) { - console.warn(e); + // console.warn(e); } }; try {