提交 020a66f9 作者: 方治民

feat: 优化示例菜单命名,Chat 模块在 Android 下的顶部状态栏高度适配

上级 230ce021
......@@ -43,6 +43,11 @@
webview.addEventListener(
'loaded',
() => {
let paddingTop = '0px'
if (uni.getSystemInfoSync().platform === 'android') {
paddingTop = '30px'
}
webview.appendJsFile('_www/static/uni.webview.1.5.6.js')
webview.evalJS(`
document.addEventListener('UniAppJSBridgeReady', function() {
......@@ -60,7 +65,7 @@
// 隐藏底部描述和图片上传能力
var style = document.createElement('style')
style.id = 'no-security-webview-style'
style.innerHTML = 'footer, .semi-upload-add { display: none !important; } .close-btn { position: absolute; right: 12px; top: 18px; padding: 8px; }'
style.innerHTML = 'footer, .semi-upload-add { display: none !important; } .close-btn { position: absolute; right: 12px; top: calc(18px + ${paddingTop}); padding: 8px; } html { padding-top: calc(0px + ${paddingTop}) }'
document.body.appendChild(style)
// 添加关闭按钮
......
<script setup lang="ts">
import * as Pages from '@/utils/pages'
interface Item {
name: string
icon: string
page: string
type?: 'link' | 'bottom'
animationType?: Pages.AnimationType
event?: () => void
}
// @unocss-include
const data = reactive({
const data = reactive<{ items: Item[] }>({
items: [
{
name: 'Chat AI 示例',
icon: 'emojione-cowboy-hat-face',
page: `/pages/example/chat/index?link=${encodeURIComponent('https://api.coze.cn/open-platform/sdk/chatapp?params=%7B%22chatClientId%22%3A%22Hd1w0dc49QzvaAGlDONiA%22%2C%22chatConfig%22%3A%7B%22bot_id%22%3A%227426295021118488587%22%2C%22user%22%3A%22NmAh7FUtuyO6RPrzYMg4v%22%2C%22conversation_id%22%3A%22cqnuKy6c3lmYTdjF0vslj%22%7D%2C%22componentProps%22%3A%7B%22layout%22%3A%22mobile%22%2C%22lang%22%3A%22zh_CN%22%2C%22uploadable%22%3Atrue%2C%22title%22%3A%22%E6%B9%96%E5%8D%97%E5%A4%A9%E6%B0%94%20AI%20%E6%99%BA%E8%83%BD%E5%8A%A9%E7%90%86%22%2C%22icon%22%3A%22https%3A%2F%2Fhntq-res.oss-cn-shenzhen.aliyuncs.com%2Fhntq-ai-logo.png%22%7D%7D')}`,
animationType: 'slide-in-bottom',
},
{
name: 'Mapbox 地图示例',
name: 'Mapbox 地图',
icon: 'emojione-globe-showing-europe-africa',
page: '/pages/example/mapbox/index',
},
{
name: 'Echarts 示例',
name: 'Echarts 图表',
icon: 'logos-chartblocks',
page: '/pages/example/echarts/index',
},
{
name: 'Webview(本地) 示例',
name: 'Chat AI 对话',
icon: 'emojione-cowboy-hat-face',
page: `/pages/example/chat/index?link=${encodeURIComponent('https://api.coze.cn/open-platform/sdk/chatapp?params=%7B%22chatClientId%22%3A%22Hd1w0dc49QzvaAGlDONiA%22%2C%22chatConfig%22%3A%7B%22bot_id%22%3A%227426295021118488587%22%2C%22user%22%3A%22NmAh7FUtuyO6RPrzYMg4v%22%2C%22conversation_id%22%3A%22cqnuKy6c3lmYTdjF0vslj%22%7D%2C%22componentProps%22%3A%7B%22layout%22%3A%22mobile%22%2C%22lang%22%3A%22zh_CN%22%2C%22uploadable%22%3Atrue%2C%22title%22%3A%22%E6%B9%96%E5%8D%97%E5%A4%A9%E6%B0%94%20AI%20%E6%99%BA%E8%83%BD%E5%8A%A9%E7%90%86%22%2C%22icon%22%3A%22https%3A%2F%2Fhntq-res.oss-cn-shenzhen.aliyuncs.com%2Fhntq-ai-logo.png%22%7D%7D')}`,
animationType: 'slide-in-bottom',
},
{
name: 'Webview(本地)',
icon: 'vscode-icons-file-type-html',
page: `/pages/common/webview/index?link=${encodeURIComponent('/hybrid/html/local.html')}`,
},
{
name: 'Webview(网络) 示例',
name: 'Webview(网络)',
icon: 'logos-internetexplorer',
page: `/pages/common/webview/index?link=${encodeURIComponent('https://uniapp.dcloud.io/static/web-view.html')}`,
},
{
name: '应用维护全屏通知',
icon: 'twemoji-laptop',
page: '/pages/common/repair/index',
animationType: 'fade-in',
},
],
})
function to(item: Item) {
if (item.type === 'bottom') {
item.event?.()
return
}
Pages.to(item.page, item.animationType)
}
</script>
<template>
......@@ -43,9 +67,10 @@
:bottomBorder="false"
radius="16rpx"
marginTop="24"
:padding="['20rpx', '32rpx']"
v-for="(item, idx) in data.items"
:key="idx"
@click="Pages.to(item.page, item.animationType as Pages.AnimationType)"
@click="to(item)"
>
<view class="fui-list__item fui-align__center">
<Icon :class="[`icon-${item.icon}`]" size="48" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论