'ss'
This commit is contained in:
@@ -3,7 +3,7 @@ import Taro from "@tarojs/taro";
|
||||
import { View, Text, Image, Button } from "@tarojs/components";
|
||||
import "./index.scss";
|
||||
import { AtTabBar } from "taro-ui";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect, useState, useRef } from "react";
|
||||
import { AtGrid } from "taro-ui";
|
||||
import { Swiper, SwiperItem } from "@tarojs/components";
|
||||
import { AtCard } from "taro-ui";
|
||||
@@ -12,6 +12,11 @@ import { AtButton } from "taro-ui";
|
||||
import { AtSearchBar } from "taro-ui";
|
||||
import { Picker } from "@tarojs/components";
|
||||
import { AtList, AtListItem, AtNavBar, AtTag, AtMessage } from "taro-ui";
|
||||
import { marked } from "marked";
|
||||
import infoText from "../book/info.md";
|
||||
import bookText from "../book/book.md";
|
||||
import index from "./index.md";
|
||||
|
||||
import {
|
||||
AtModal,
|
||||
AtModalHeader,
|
||||
@@ -80,7 +85,39 @@ const Index = () => {
|
||||
const [bookpay, setbookpay] = useState(0);
|
||||
|
||||
const [isWeChat, setisWeChat] = useState(false);
|
||||
const [markText, setmarkText] = useState(vip == 1 ? index : index);
|
||||
const [headers, setHeaders] = useState([]); // 存储所有 <h1> 的内容
|
||||
const contentRef = useRef(null); // 用于获取渲染后的 DOM
|
||||
|
||||
marked.setOptions({
|
||||
breaks: true, // 是否回车换行
|
||||
gfm: true, //使用经批准的 GitHub Flavored Markdown (GFM) 规范
|
||||
// pedantic: true, //严格模式
|
||||
// highlight(code:any, lang:any) {
|
||||
// // 语法高亮
|
||||
// let val = code;
|
||||
// if (lang) {
|
||||
// val = hljs.highlight(lang, code).value;
|
||||
// } else {
|
||||
// val = hljs.highlightAuto(code).value;
|
||||
// }
|
||||
// return val;
|
||||
// },
|
||||
});
|
||||
useEffect(() => {
|
||||
if (contentRef.current) {
|
||||
const h1Elements = contentRef.current.querySelectorAll("h1");
|
||||
const h2Elements = contentRef.current.querySelectorAll("h2");
|
||||
|
||||
const h1Texts = Array.from(h1Elements).map((el) => el.textContent);
|
||||
const h2Texts = Array.from(h2Elements).map((el) => el.textContent);
|
||||
|
||||
setHeaders(h1Texts);
|
||||
// console.log("获取到的 H1 标题:"); // 控制台查看
|
||||
console.log("获取到的 H1 标题:", h1Texts); // 控制台查看
|
||||
console.log("获取到的 H2 标题:", h2Texts); // 控制台查看
|
||||
}
|
||||
}, [markText]); // 监听 HTML 内容变化
|
||||
const getOpenidFromUrl = (url) => {
|
||||
const pattern = /[?&]openid=([^&#]+)/;
|
||||
const match = url.match(pattern);
|
||||
@@ -400,13 +437,21 @@ const Index = () => {
|
||||
<Image className="cardItem_left_img" src={group}></Image>
|
||||
</View>
|
||||
<View className="cardItem_right">
|
||||
<View className="cardItem_rightUp">聊天机器人</View>
|
||||
<View className="cardItem_rightDown">智能AI回复/加群</View>
|
||||
<View className="cardItem_rightUp">不只云手机</View>
|
||||
<View className="cardItem_rightDown">折腾技术</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View
|
||||
ref={contentRef}
|
||||
className="markdown-body markVip" // 添加 GitHub Markdown 主题类
|
||||
dangerouslySetInnerHTML={{
|
||||
// __html: marked(markText),
|
||||
__html: marked(vip == 1 ? index : index),
|
||||
}}
|
||||
></View>
|
||||
|
||||
<View className="left_btn ">
|
||||
<View className="left_btn">
|
||||
{vip != 1 ? (
|
||||
<AtButton
|
||||
onClick={() => {
|
||||
@@ -416,8 +461,8 @@ const Index = () => {
|
||||
return false;
|
||||
} else {
|
||||
if (!!isWeChat) {
|
||||
//98元
|
||||
payh5("vip", 9800);
|
||||
//58元
|
||||
payh5("vip", 5800);
|
||||
} else {
|
||||
window.location.href = `https://mp.weixin.qq.com/s/16xcMIgxEEGBPY7fanNq0g`;
|
||||
}
|
||||
@@ -428,18 +473,24 @@ const Index = () => {
|
||||
size="small"
|
||||
circle
|
||||
>
|
||||
加群
|
||||
{`${"加 入 交 流"}`}
|
||||
</AtButton>
|
||||
) : (
|
||||
<View className="vipcode">
|
||||
<Image className="vipcodeImg" src={hackrobot}></Image>
|
||||
<View onClick={()=>{
|
||||
window.location.href = `https://memos.hackrobot.org`;
|
||||
}}>👉星球地址: memos.hackrobot.org</View>
|
||||
<View
|
||||
onClick={() => {
|
||||
window.location.href = `https://memos.hackrobot.org`;
|
||||
}}
|
||||
>
|
||||
👉星球地址: memos.hackrobot.org
|
||||
</View>
|
||||
|
||||
<View>添加<span style={{color:'green'}}>微信好友: hackrobot</span></View>
|
||||
<View>
|
||||
添加
|
||||
<span style={{ color: "green" }}>微信好友: hackrobot</span>
|
||||
</View>
|
||||
<View>获取 账号</View>
|
||||
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user