remove unused WeCom backend integration
This commit is contained in:
@@ -1,72 +1,26 @@
|
||||
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",
|
||||
};
|
||||
const CONTACT_WAY_CONFIG_ID = "5f8a2d2756e2c69776c186ef28fc48ee";
|
||||
const CONTACT_WAY_STYLE = 1;
|
||||
|
||||
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 ? (
|
||||
{CONTACT_WAY_CONFIG_ID ? (
|
||||
<View className="contact-plugin-card">
|
||||
<Text className="contact-card-title">添加企微服务管家</Text>
|
||||
<Text className="contact-card-note">点击按钮后将进入企微添加流程</Text>
|
||||
<cell plugid={contactWay.configId} styleType={contactWay.style} />
|
||||
<cell plugid={CONTACT_WAY_CONFIG_ID} styleType={CONTACT_WAY_STYLE} />
|
||||
</View>
|
||||
) : (
|
||||
<View className="contact-plugin-card contact-fallback">
|
||||
|
||||
Reference in New Issue
Block a user