init: api-gateway v2.4.0(Agnes/b.ai/火山方舟 三家供应商网关)
This commit is contained in:
commit
f136c9ee81
91 files changed
+24653
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div ref="el" class="echart" :style="{ height: height }"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { echarts, type EChartsCoreOption } from '../lib/echarts'
|
||||
|
||||
const props = defineProps<{
|
||||
option: EChartsCoreOption
|
||||
height?: string
|
||||
}>()
|
||||
|
||||
const el = ref<HTMLElement>()
|
||||
let chart: any = null
|
||||
let ro: ResizeObserver | null = null
|
||||
|
||||
function setOpt() {
|
||||
if (chart) chart.setOption(props.option || {}, true)
|
||||
}
|
||||
function resize() { if (chart) chart.resize() }
|
||||
|
||||
onMounted(() => {
|
||||
chart = echarts.init(el.value!)
|
||||
setOpt()
|
||||
if (typeof ResizeObserver !== 'undefined') {
|
||||
ro = new ResizeObserver(resize)
|
||||
ro.observe(el.value!)
|
||||
}
|
||||
})
|
||||
watch(() => props.option, setOpt, { deep: true })
|
||||
onUnmounted(() => {
|
||||
if (ro) ro.disconnect()
|
||||
if (chart) { chart.dispose(); chart = null }
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.echart { width: 100%; }
|
||||
</style>
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<!-- 反馈附图:缩略图内嵌(服务端 JSON 里带着),点开才去取原图 —— 列表页因此零额外请求。 -->
|
||||
<div v-if="item.images && item.images.length" class="fb-imgs">
|
||||
<button
|
||||
v-for="(im, i) in item.images"
|
||||
:key="i"
|
||||
class="fb-th"
|
||||
type="button"
|
||||
:title="im.name || t('inbox.preview')"
|
||||
@click="open(i)"
|
||||
>
|
||||
<img v-if="im.thumb" :src="im.thumb" :alt="im.name || 'feedback image'" />
|
||||
<span v-else class="ph"><Icon name="img" :size="16" /></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="show" :title="title" width="min(860px, 92vw)">
|
||||
<div class="fb-full">
|
||||
<div v-if="loading" class="hint">{{ t('inbox.loading') }}</div>
|
||||
<img v-else-if="full" :src="full" alt="feedback image" />
|
||||
<div v-else class="hint">{{ t('inbox.loadFail') }}</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import Icon from './Icon.vue'
|
||||
import { feedbackImage, type FeedbackItem } from '../lib/feedback'
|
||||
|
||||
const props = defineProps<{ item: FeedbackItem }>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const show = ref(false)
|
||||
const loading = ref(false)
|
||||
const full = ref('')
|
||||
const title = ref('')
|
||||
|
||||
/** 同一张图重复点开时复用已取到的 data URI,别反复要同一份数据。 */
|
||||
const cache = new Map<number, string>()
|
||||
|
||||
async function open(idx: number) {
|
||||
const im = props.item.images[idx]
|
||||
const kb = im && im.bytes ? `${Math.round(im.bytes / 1024)}KB` : ''
|
||||
title.value = [im?.name || t('inbox.preview'), kb].filter(Boolean).join(' · ')
|
||||
show.value = true
|
||||
if (cache.has(idx)) {
|
||||
full.value = cache.get(idx) as string
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
full.value = ''
|
||||
try {
|
||||
const uri = await feedbackImage(props.item.id, idx)
|
||||
cache.set(idx, uri)
|
||||
full.value = uri
|
||||
} catch {
|
||||
full.value = ''
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fb-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
|
||||
.fb-th {
|
||||
width: 84px; height: 84px; padding: 0; border: 1px solid var(--line);
|
||||
border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in;
|
||||
}
|
||||
.fb-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.fb-th .ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted-2); }
|
||||
.fb-full { display: grid; place-items: center; min-height: 120px; }
|
||||
.fb-full img { max-width: 100%; max-height: 68vh; border-radius: 10px; display: block; }
|
||||
</style>
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<!--
|
||||
处理记录时间线(第二十二轮追加):提交 + 每一次状态变更,old → new 逐条列出。
|
||||
提交人和管理员看到的是**同一串记录**(服务端 history 原样下发),不各算各的。
|
||||
|
||||
超过 LIMIT 条时默认只显示最后几条(最新的处理动作最重要),点开看全部。
|
||||
-->
|
||||
<div v-if="steps.length" class="tl">
|
||||
<div class="tl-h">
|
||||
<span>{{ t('fbLog.title') }}</span>
|
||||
<span class="cnt">{{ steps.length }}</span>
|
||||
</div>
|
||||
<ol class="tl-list">
|
||||
<li v-for="(s, i) in shown" :key="i" class="tl-i" :class="s.to">
|
||||
<span class="dot" />
|
||||
<!-- 第一格是「提交」(没有上一个状态);后面每格是「改到哪个状态 ← 原来是什么」 -->
|
||||
<span class="lbl">{{ s.from ? t(`fbStatus.${s.to}`) : t('fbLog.submitted') }}</span>
|
||||
<span v-if="s.from && s.from !== s.to" class="from">← {{ t(`fbStatus.${s.from}`) }}</span>
|
||||
<span v-if="s.by" class="who">{{ s.by }}</span>
|
||||
<span class="spacer" />
|
||||
<span class="ts">{{ fmt(s.ts) }}</span>
|
||||
<div v-if="s.note" class="note">{{ s.note }}</div>
|
||||
</li>
|
||||
</ol>
|
||||
<button v-if="steps.length > LIMIT" class="more" type="button" @click="expanded = !expanded">
|
||||
{{ expanded ? t('fbLog.less') : t('fbLog.more', { n: steps.length }) }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { FeedbackItem } from '../lib/feedback'
|
||||
|
||||
const props = defineProps<{ item: FeedbackItem }>()
|
||||
const { t } = useI18n()
|
||||
|
||||
const LIMIT = 4 // 默认最多显示 4 条(再长就折叠)
|
||||
const expanded = ref(false)
|
||||
|
||||
const steps = computed(() => props.item.history || [])
|
||||
const shown = computed(() => (expanded.value ? steps.value : steps.value.slice(-LIMIT)))
|
||||
|
||||
function fmt(ts: number): string {
|
||||
if (!ts) return '—'
|
||||
const d = new Date(ts * 1000)
|
||||
const p = (n: number) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tl { margin-top: 12px; }
|
||||
.tl-h { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
|
||||
.tl-h .cnt {
|
||||
min-width: 16px; padding: 0 4px; border-radius: 6px; text-align: center;
|
||||
background: var(--chip); color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.tl-list { list-style: none; margin: 10px 0 0; padding: 0 0 0 2px; }
|
||||
.tl-i {
|
||||
position: relative; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
|
||||
padding: 0 0 15px 20px; font-size: 11.5px; color: var(--muted); line-height: 1.5;
|
||||
}
|
||||
/* 竖线串起每一步:最后一条不再往下画 */
|
||||
.tl-i::before {
|
||||
content: ''; position: absolute; left: 5px; top: 7px; bottom: 0;
|
||||
width: 1px; background: var(--line);
|
||||
}
|
||||
.tl-i:last-child::before { display: none; }
|
||||
.dot {
|
||||
position: absolute; left: 2px; top: 5px; width: 7px; height: 7px; border-radius: 50%;
|
||||
background: var(--muted-2);
|
||||
}
|
||||
.tl-i.pending .dot { background: var(--warn, #d99b3a); }
|
||||
.tl-i.doing .dot { background: var(--primary); }
|
||||
.tl-i.done .dot { background: var(--ok, #3aa76d); }
|
||||
.tl-i .lbl { color: var(--text); font-weight: 600; }
|
||||
.tl-i .from { color: var(--muted-2); }
|
||||
.tl-i .who {
|
||||
padding: 0 5px; border-radius: 6px; background: var(--chip); color: var(--muted); font-size: 10.5px;
|
||||
}
|
||||
.tl-i .spacer { flex: 1; }
|
||||
.tl-i .ts { color: var(--muted-2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
|
||||
/* 说明:左侧主题色竖线,和正文区分开("官方回复了"一眼可见) */
|
||||
.tl-i .note {
|
||||
flex: 1 0 100%; margin-top: 10px; padding: 8px 12px;
|
||||
border-left: 2px solid var(--primary); background: var(--primary-soft);
|
||||
border-radius: 0 8px 8px 0; color: var(--text); font-size: 11.5px;
|
||||
line-height: 1.62; word-break: break-word; white-space: pre-wrap;
|
||||
}
|
||||
.more {
|
||||
margin: 0 0 2px 16px; padding: 0; border: 0; background: none; cursor: pointer;
|
||||
color: var(--primary); font-size: 11.5px;
|
||||
}
|
||||
.more:hover { text-decoration: underline; }
|
||||
</style>
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<!-- 线性几何图标:跨设备字形不变(emoji 在 Windows/Android 上长得完全不一样)。 -->
|
||||
<svg
|
||||
:width="size"
|
||||
:height="size"
|
||||
viewBox="0 0 20 20"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
:stroke-width="stroke"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="gw-icon"
|
||||
aria-hidden="true"
|
||||
v-html="body"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = withDefaults(defineProps<{ name: string; size?: number; stroke?: number }>(), {
|
||||
size: 18,
|
||||
stroke: 1.7,
|
||||
})
|
||||
|
||||
// 图标表:键为语义名,值为 20×20 视框内的路径。与设计稿同一套几何。
|
||||
const ICONS: Record<string, string> = {
|
||||
dash: '<rect x="3" y="3" width="6.2" height="6.2" rx="1.8"/><rect x="10.8" y="3" width="6.2" height="6.2" rx="1.8"/><rect x="3" y="10.8" width="6.2" height="6.2" rx="1.8"/><rect x="10.8" y="10.8" width="6.2" height="6.2" rx="1.8"/>',
|
||||
chat: '<path d="M3.5 6.2A2.7 2.7 0 0 1 6.2 3.5h7.6a2.7 2.7 0 0 1 2.7 2.7v4.6a2.7 2.7 0 0 1-2.7 2.7H8.6L4.7 16.2v-2.9a2.7 2.7 0 0 1-1.2-2.2z"/>',
|
||||
img: '<rect x="3" y="4" width="14" height="12" rx="2.4"/><circle cx="7.4" cy="8.4" r="1.3"/><path d="M3.6 14.4l4-3.6 2.8 2.4 2.9-2.6 3.1 2.8"/>',
|
||||
vid: '<rect x="2.6" y="5" width="14.8" height="10" rx="2.4"/><path d="M8.6 8l3.6 2-3.6 2z"/>',
|
||||
model: '<path d="M10 3l6.6 3.6L10 10.2 3.4 6.6z"/><path d="M3.4 10.6L10 14.2l6.6-3.6"/><path d="M3.4 14L10 17.6 16.6 14"/>',
|
||||
metric: '<path d="M4 16.4V10"/><path d="M8 16.4V4.6"/><path d="M12 16.4v-4.2"/><path d="M16 16.4V7.4"/>',
|
||||
key: '<circle cx="6.6" cy="10" r="3.1"/><path d="M9.4 10h7"/><path d="M14.6 10v2.6"/><path d="M16.6 10v2"/>',
|
||||
users: '<circle cx="8" cy="7.4" r="2.9"/><path d="M3.4 16.2c0-2.6 2-4.2 4.6-4.2s4.6 1.6 4.6 4.2"/><path d="M13.6 5.5a2.9 2.9 0 0 1 0 5.2"/><path d="M14.6 12.4c1.7.6 2.9 1.9 2.9 3.8"/>',
|
||||
log: '<rect x="3.4" y="3.4" width="13.2" height="13.2" rx="2.4"/><path d="M6.6 8h6.8"/><path d="M6.6 11h6.8"/><path d="M6.6 14h4"/>',
|
||||
set: '<path d="M3.6 6.2h12.8"/><path d="M3.6 10h12.8"/><path d="M3.6 13.8h12.8"/><circle cx="7.4" cy="6.2" r="1.7"/><circle cx="13" cy="10" r="1.7"/><circle cx="8.8" cy="13.8" r="1.7"/>',
|
||||
menu: '<path d="M3.6 6h12.8"/><path d="M3.6 10h12.8"/><path d="M3.6 14h12.8"/>',
|
||||
refresh: '<path d="M16.2 8.6A6.4 6.4 0 1 0 16 12.6"/><path d="M16.6 3.6v4.4h-4.4"/>',
|
||||
dl: '<path d="M10 3.6v8"/><path d="M6.6 8.8L10 12.2l3.4-3.4"/><path d="M4.4 15.8h11.2"/>',
|
||||
bell: '<path d="M10 3.4A4.4 4.4 0 0 1 14.4 8c0 3 .8 4 1.3 4.6H4.3C4.8 12 5.6 11 5.6 8A4.4 4.4 0 0 1 10 3.4z"/><path d="M8.4 15.6a1.7 1.7 0 0 0 3.2 0"/>',
|
||||
plus: '<path d="M10 4.6v10.8"/><path d="M4.6 10h10.8"/>',
|
||||
up: '<path d="M10 15.6V4.8"/><path d="M5.6 9.2L10 4.8l4.4 4.4"/>',
|
||||
theme: '<circle cx="10" cy="10" r="6.8"/><circle cx="7.4" cy="8.2" r="1.05" fill="currentColor"/><circle cx="12.6" cy="8.2" r="1.05" fill="currentColor"/><circle cx="10" cy="12.8" r="1.05" fill="currentColor"/>',
|
||||
play: '<circle cx="10" cy="10" r="7"/><path d="M8.4 7.4l4.6 2.6-4.6 2.6z"/>',
|
||||
eye: '<path d="M2.6 10S5.4 5.4 10 5.4 17.4 10 17.4 10 14.6 14.6 10 14.6 2.6 10 2.6 10z"/><circle cx="10" cy="10" r="2.2"/>',
|
||||
bolt: '<path d="M11.6 2.2 4.8 11.1h4.3L8.7 17.8l6.9-9.3h-4.4z"/>',
|
||||
send: '<path d="M17 3 3.4 8.8l4.9 2.3L11 16.8z"/><path d="M17 3l-8.7 8.1"/>',
|
||||
chev: '<path d="M7.6 4.6 13 10l-5.4 5.4"/>',
|
||||
chevD: '<path d="M4.6 7.6 10 13l5.4-5.4"/>',
|
||||
clip: '<path d="M13.4 8.6 8 14a2.6 2.6 0 0 1-3.7-3.7l7-7a1.8 1.8 0 0 1 2.6 2.6l-7 7"/>',
|
||||
x: '<path d="M5.2 5.2l9.6 9.6"/><path d="M14.8 5.2l-9.6 9.6"/>',
|
||||
check: '<path d="M4.6 10.6l3.4 3.4 7.4-8"/>',
|
||||
copy: '<rect x="7" y="7" width="9.4" height="9.4" rx="2"/><path d="M13 4.4a1.8 1.8 0 0 0-1.8-1.8H5.4A1.8 1.8 0 0 0 3.6 4.4v5.8A1.8 1.8 0 0 0 5.4 12"/>',
|
||||
trash: '<path d="M4.4 6h11.2"/><path d="M8 6V4.6a1.2 1.2 0 0 1 1.2-1.2h1.6A1.2 1.2 0 0 1 12 4.6V6"/><path d="M5.8 6l.7 9.2a1.4 1.4 0 0 0 1.4 1.3h4.2a1.4 1.4 0 0 0 1.4-1.3L14.2 6"/>',
|
||||
search: '<circle cx="9" cy="9" r="5.2"/><path d="M12.9 12.9 17 17"/>',
|
||||
user: '<circle cx="10" cy="7" r="3.2"/><path d="M4 17c0-3 2.7-4.8 6-4.8s6 1.8 6 4.8"/>',
|
||||
link: '<path d="M8.6 11.4a3 3 0 0 0 4.2 0l2.2-2.2a3 3 0 0 0-4.2-4.2L9.6 6.2"/><path d="M11.4 8.6a3 3 0 0 0-4.2 0L5 10.8a3 3 0 0 0 4.2 4.2l1.2-1.2"/>',
|
||||
stop: '<rect x="5.6" y="5.6" width="8.8" height="8.8" rx="2"/>',
|
||||
filter: '<path d="M3.6 5.4h12.8"/><path d="M6.4 10h7.2"/><path d="M8.6 14.6h2.8"/>',
|
||||
dots: '<circle cx="5" cy="10" r="1.2" fill="currentColor"/><circle cx="10" cy="10" r="1.2" fill="currentColor"/><circle cx="15" cy="10" r="1.2" fill="currentColor"/>',
|
||||
// 第二十二轮:意见反馈(灯泡=想法)/ 用户反馈(收件盘=收到的意见)
|
||||
bulb: '<path d="M10 2.8a5 5 0 0 0-3 9v2.2h6V11.8a5 5 0 0 0-3-9z"/><path d="M8.2 16.6h3.6"/><path d="M8.8 18.4h2.4"/>',
|
||||
// 第二十三轮:网关配置(滑杆 = 调参数)
|
||||
sliders: '<path d="M3.6 6.8h5.6"/><path d="M12.6 6.8h3.8"/><circle cx="10.9" cy="6.8" r="1.7"/><path d="M3.6 13.2h3.8"/><path d="M10.8 13.2h5.6"/><circle cx="9.1" cy="13.2" r="1.7"/>',
|
||||
inbox: '<path d="M3.4 11.6 6 4.6h8l2.6 7v4.8H3.4z"/><path d="M3.4 11.6h3.2l.9 1.8h5l.9-1.8h3.2"/>',
|
||||
// 第二十四轮:账号停用(禁用符号「圆 + 斜杠」),启用配已有的 play(圆 + 三角)
|
||||
ban: '<circle cx="10" cy="10" r="7"/><path d="M5.1 5.1l9.8 9.8"/>',
|
||||
}
|
||||
|
||||
const body = computed(() => ICONS[props.name] || '')
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.gw-icon { display: block; flex: none; }
|
||||
</style>
|
||||
Reference in new issue
Block a user