fix(index): 优化外链提示及删除复制咨询模板功能
- 替换小程序内外链打开方式提示为弹窗提醒用户手动复制 - 删除复制咨询模板功能及相关按钮 - 修改联系我们文案,突出直接电话沟通或需求反馈 - 移除无用导入的复制文本工具函数copyText
This commit is contained in:
@@ -47,3 +47,15 @@
|
||||
- **原因**: 项目没有声明微信小程序原生全局对象 `wx` 的类型
|
||||
- **修复**: 在 `types/global.d.ts` 中添加 `declare const wx: any;` 全局类型声明
|
||||
- **验证**: `tsc` 不再报 `common.ts` 相关错误,`npx taro build --type weapp` 构建成功
|
||||
|
||||
## 去掉首页「复制咨询模板」按钮及复制逻辑
|
||||
|
||||
- **问题**: `wx.setClipboardData` 在小程序开发者工具中报 `no permission` 错误,且审核对复制功能敏感
|
||||
- **修复**:
|
||||
- 移除 `src/pages/index/index.tsx` 中的 `copyConsultTemplate` 函数
|
||||
- 删除「复制咨询模板」按钮,只保留「电话咨询」
|
||||
- 修改联系我们区域文案,去掉「复制咨询模板」相关描述
|
||||
- `openMaybeLink` 中外链不再调用 `copyText`,改为 `Taro.showModal` 提示用户手动复制到浏览器打开
|
||||
- 移除首页对 `copyText` 的 import
|
||||
- **验证**: `npx taro build --type weapp` 构建成功,首页无复制相关调用
|
||||
- **备注**: 项目其他页面仍有复制功能(如礼品卡分享、优惠券分享、订单号复制、密钥复制等),如需要可继续逐个移除
|
||||
|
||||
@@ -3,7 +3,6 @@ import { View, Text } from '@tarojs/components'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { Button } from '@nutui/nutui-react-taro'
|
||||
import { useConfig } from '@/hooks/useConfig'
|
||||
import { copyText } from '@/utils/common'
|
||||
import './index.scss'
|
||||
|
||||
function Home() {
|
||||
@@ -76,28 +75,19 @@ function Home() {
|
||||
Taro.navigateTo({ url })
|
||||
return
|
||||
}
|
||||
// 外链在小程序内无法直接打开,复制链接降低认知成本
|
||||
// 小程序内无法直接打开外链,提示用户手动复制到浏览器
|
||||
if (/^https?:\/\//i.test(abs)) {
|
||||
copyText(abs)
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '该链接需要在浏览器中打开,请点击确认后手动复制链接访问。',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
})
|
||||
return
|
||||
}
|
||||
Taro.showToast({ title: '请在 PC 端访问该入口', icon: 'none', duration: 1600 })
|
||||
}
|
||||
|
||||
const copyConsultTemplate = () => {
|
||||
const tel = config?.tel ? `\n联系电话:${config.tel}` : ''
|
||||
const text =
|
||||
'【需求咨询】\n' +
|
||||
'1) 想开通哪些产品:企业官网 / 电商 / 小程序 / 其他\n' +
|
||||
'2) 是否需要模板/插件市场:是 / 否\n' +
|
||||
'3) 是否需要“支付即开通”:是 / 否\n' +
|
||||
'4) 交付方式:SaaS / 私有化 / 混合\n' +
|
||||
'5) 合规/部署要求:\n' +
|
||||
'6) 期望上线时间:\n' +
|
||||
tel
|
||||
copyText(text)
|
||||
}
|
||||
|
||||
const callPhone = () => {
|
||||
const tel = (config?.tel || '').trim()
|
||||
if (!tel) {
|
||||
@@ -456,7 +446,7 @@ function Home() {
|
||||
<View className="section__head">
|
||||
<Text className="section__title">联系我们</Text>
|
||||
<Text className="section__desc">
|
||||
复制咨询模板或直接电话沟通,我们会按你的业务场景给出产品组合、开通链路与部署方案(SaaS/私有化)。
|
||||
直接电话沟通或留下需求,我们会按你的业务场景给出产品组合、开通链路与部署方案(SaaS/私有化)。
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
@@ -492,9 +482,6 @@ function Home() {
|
||||
</View>
|
||||
|
||||
<View className="contactActions">
|
||||
<Button type="default" block onClick={copyConsultTemplate}>
|
||||
复制咨询模板
|
||||
</Button>
|
||||
<Button type="primary" block onClick={callPhone}>
|
||||
电话咨询
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user