chore: initialize WanderQ MiniAPP 2.0 repository

This commit is contained in:
inman
2026-07-23 15:48:34 +08:00
commit b4c0a1c516
93 changed files with 53525 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
import { Button, Text, View } from "@tarojs/components";
import Taro from "@tarojs/taro";
import { useEffect, useState } from "react";
import { apiUrl } from "../../services/api";
const SUPPORT_PHONE = "18786174929";
type ContactWayResponse = {
enabled: boolean;
configId: string;
type: number;
scene: number;
style: number;
remark?: string | null;
state?: string | null;
pluginId: string;
pluginVersion: string;
};
const DEFAULT_CONTACT_WAY: ContactWayResponse = {
enabled: true,
configId: "5f8a2d2756e2c69776c186ef28fc48ee",
type: 1,
scene: 1,
style: 1,
remark: null,
state: null,
pluginId: "wx104a1a20c3f81ec2",
pluginVersion: "1.4.3",
};
export default function ContactPage() {
const [contactWay, setContactWay] = useState<ContactWayResponse>(DEFAULT_CONTACT_WAY);
useEffect(() => {
let active = true;
Taro.request<ContactWayResponse>({ url: apiUrl("/api/public/wecom/contact-way") })
.then((response) => {
if (!active) return;
if (response.statusCode >= 200 && response.statusCode < 300 && response.data?.configId) {
setContactWay(response.data);
}
})
.catch(() => {
if (active) console.warn("企微联系配置接口暂时不可达,使用内置联系我配置", DEFAULT_CONTACT_WAY.configId);
});
return () => {
active = false;
};
}, []);
const callSupport = () => {
void Taro.makePhoneCall({ phoneNumber: SUPPORT_PHONE });
};
const showPlugin = Boolean(contactWay.enabled && contactWay.configId);
return (
<View className="page contact-page">
<View className="contact-hero">
<Text className="eyebrow"></Text>
<Text className="contact-title"></Text>
</View>
{showPlugin ? (
<View className="contact-plugin-card">
<Text className="contact-card-title"></Text>
<Text className="contact-card-note"></Text>
<cell plugid={contactWay.configId} styleType={contactWay.style} />
</View>
) : (
<View className="contact-plugin-card contact-fallback">
<Text className="contact-card-title"></Text>
<Text className="contact-card-note"></Text>
<Button className="phone-cta" onClick={callSupport}> {SUPPORT_PHONE}</Button>
</View>
)}
<Button className="contact-back" onClick={() => void Taro.navigateBack()}></Button>
</View>
);
}