补充页面内容

This commit is contained in:
2026-02-11 19:51:32 +08:00
parent 50ddf01e7c
commit 53820a4654
30 changed files with 5915 additions and 259 deletions

View File

@@ -0,0 +1,146 @@
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 页面标题 -->
<view class="page-header admin-card">
<text class="title">翻译配置</text>
</view>
<!-- 配置表单 -->
<view class="admin-card content-card form-container">
<view class="form-item">
<view class="form-label">
<text class="required">*</text>
<text>AccessKey:</text>
</view>
<view class="form-content">
<input class="form-input" v-model="config.accessKey" placeholder="请输入 AccessKey" />
<text class="form-tip">机器翻译仅支持火山翻译,注册地址 https://console.volcengine.com在访问控制里面新建 api 密钥</text>
</view>
</view>
<view class="form-item mt-24">
<view class="form-label">
<text class="required">*</text>
<text>SecretKey:</text>
</view>
<view class="form-content">
<input class="form-input" v-model="config.secretKey" placeholder="请输入 SecretKey" type="password" />
<text class="form-tip">机器翻译仅支持火山翻译,注册地址 https://console.volcengine.com在访问控制里面新建 api 密钥</text>
</view>
</view>
<view class="form-actions mt-32">
<button class="btn primary submit-btn" @click="onSubmit">提交</button>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const config = ref({
accessKey: 'AKLTMzkzZTEzNjg3OTg2NDVlMzlwnmFIYzhmNzkzMmE4MmI4YmI',
secretKey: 'TVRneU16STFOVFV4WVRWVE5EERTJaV0pqWm1aa1U1UagINVFpPWld'
})
function onSubmit() {
uni.showLoading({ title: '提交中...' })
setTimeout(() => {
uni.hideLoading()
uni.showToast({ title: '保存成功' })
}, 1000)
}
</script>
<style scoped lang="scss">
.admin-page {
padding: 24px;
background-color: #f5f7f9;
min-height: 100vh;
}
.admin-card {
background-color: #fff;
border-radius: 4px;
padding: 20px 24px;
margin-bottom: 24px;
}
.title {
font-size: 18px;
font-weight: 500;
color: #333;
}
.form-item {
display: flex;
flex-direction: row;
align-items: flex-start;
}
.form-label {
width: 120px;
padding-top: 8px;
text-align: right;
margin-right: 16px;
font-size: 14px;
color: #333;
}
.required {
color: #ff4d4f;
margin-right: 4px;
}
.form-content {
flex: 1;
max-width: 600px;
}
.form-input {
width: 100%;
height: 38px;
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 0 12px;
font-size: 14px;
}
.form-tip {
display: block;
margin-top: 8px;
font-size: 12px;
color: #999;
}
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.form-actions {
padding-left: 136px;
}
.btn {
height: 38px;
padding: 0 24px;
border-radius: 4px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border: none;
}
.btn.primary {
background-color: #1890ff;
color: #fff;
}
.submit-btn {
width: 80px;
}
</style>

View File

@@ -0,0 +1,274 @@
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 搜索栏 -->
<view class="admin-card filter-card">
<view class="filter-row">
<view class="filter-item">
<text class="label">语言分类:</text>
<view class="filter-select">
<text class="select-text">页面语言</text>
<text class="arrow">▼</text>
</view>
</view>
<view class="filter-item">
<text class="label">语言类型:</text>
<view class="filter-select select-md">
<text class="select-text">中文(zh-CN)</text>
<text class="arrow">▼</text>
</view>
</view>
<view class="filter-item">
<text class="label">搜索:</text>
<input class="filter-input" placeholder="请输入语言备注" />
</view>
<button class="btn primary" @click="onSearch">搜索</button>
</view>
</view>
<!-- 提示栏 -->
<view class="alert-info">
<view class="info-block">
<text class="info-title">页面语言</text>
<text class="info-content">添加页面语言,添加完成之后状态码为中文文字,移动端面使用 $t('xxxx')js文件中使用 this.$t('xxxx') 或者使用 that.$t('xxxx') 实现语言的切换</text>
</view>
<view class="info-block mt-12">
<text class="info-title">接口语言</text>
<text class="info-content">添加接口语言添加完成之后状态码为6位数字接口返回提示信息时直接返回对应的错误码即可实现语言的切换</text>
</view>
</view>
<!-- 操作栏 -->
<view class="action-bar header-actions">
<button class="btn primary" @click="addWord">添加语句</button>
</view>
<!-- 表格内容 -->
<view class="admin-card content-card">
<view class="table-container list-table">
<view class="table-header">
<view class="col col-id"><text>编号</text></view>
<view class="col col-origin"><text>原语句</text></view>
<view class="col col-translation"><text>对应语言翻译</text></view>
<view class="col col-code"><text>状态码/文字(接口/页面调用参考)</text></view>
<view class="col col-type"><text>语言类型</text></view>
<view class="col col-action"><text>操作</text></view>
</view>
<view class="table-body">
<view v-for="item in dataList" :key="item.id" class="table-row">
<view class="col col-id"><text>{{ item.id }}</text></view>
<view class="col col-origin"><text>{{ item.origin }}</text></view>
<view class="col col-translation"><text>{{ item.translation }}</text></view>
<view class="col col-code"><text>{{ item.code }}</text></view>
<view class="col col-type"><text>{{ item.type }}</text></view>
<view class="col col-action">
<text class="action-btn" @click="editWord(item)">编辑</text>
<text class="action-btn divider">|</text>
<text class="action-btn danger" @click="deleteWord(item)">删除</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const dataList = ref([
{ id: 55493, origin: '秒杀活动', translation: '秒杀活动', code: '秒杀活动', type: '中文(zh-CN)' },
{ id: 55483, origin: '哥哥我', translation: '', code: '哥哥我', type: '中文(zh-CN)' },
{ id: 25221, origin: '提交订单', translation: '提交订单', code: '提交订单', type: '中文(zh-CN)' },
{ id: 25211, origin: '用户等级优惠', translation: '用户等级优惠', code: '用户等级优惠', type: '中文(zh-CN)' },
{ id: 25201, origin: '暂不支付', translation: '暂不支付', code: '暂不支付', type: '中文(zh-CN)' },
{ id: 25191, origin: '确认支付', translation: '确认支付', code: '确认支付', type: '中文(zh-CN)' },
{ id: 25181, origin: '支付剩余时间', translation: '支付剩余时间', code: '支付剩余时间', type: '中文(zh-CN)' },
{ id: 24711, origin: '全部已读', translation: '全部已读', code: '全部已读', type: '中文(zh-CN)' },
{ id: 24701, origin: '获得拼团团长佣金', translation: '获得拼团团长佣金', code: '获得拼团团长佣金', type: '中文(zh-CN)' },
{ id: 24691, origin: '获得事业部推广订单佣金', translation: '获得事业部推广订单佣金', code: '获得事业部推广订单佣金', type: '中文(zh-CN)' }
])
function onSearch() {
uni.showToast({ title: '搜索中...', icon: 'none' })
}
function addWord() {
uni.showToast({ title: '添加语句', icon: 'none' })
}
function editWord(item: any) {
uni.showToast({ title: '编辑: ' + item.origin, icon: 'none' })
}
function deleteWord(item: any) {
uni.showModal({
title: '提示',
content: '确定要删除此翻译语句吗?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '删除成功' })
}
}
})
}
</script>
<style scoped lang="scss">
.admin-page {
padding: 24px;
background-color: #f5f7f9;
min-height: 100vh;
}
.filter-row {
display: flex;
flex-direction: row;
align-items: center;
gap: 20px;
}
.filter-item {
display: flex;
flex-direction: row;
align-items: center;
}
.label {
font-size: 14px;
color: #333;
margin-right: 8px;
white-space: nowrap;
}
.filter-select {
width: 150px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 10px;
}
.select-md {
width: 200px;
}
.filter-input {
width: 200px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 0 10px;
font-size: 14px;
}
.alert-info {
background-color: #fff7e6;
border: 1px solid #ffe7ba;
padding: 20px;
border-radius: 4px;
margin: 24px 0;
}
.info-block {
display: flex;
flex-direction: column;
}
.mt-12 {
margin-top: 12px;
}
.info-title {
color: #fa8c16;
font-size: 14px;
font-weight: bold;
margin-bottom: 4px;
}
.info-content {
color: #fa8c16;
font-size: 14px;
line-height: 1.6;
}
.action-bar {
margin-bottom: 20px;
}
.admin-card {
background-color: #fff;
border-radius: 4px;
padding: 0;
overflow: hidden;
}
.btn {
height: 32px;
padding: 0 16px;
border-radius: 4px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border: none;
}
.btn.primary {
background-color: #1890ff;
color: #fff;
}
.table-container {
width: 100%;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #fafafa;
border-bottom: 1px solid #f0f0f0;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.col {
padding: 16px;
display: flex;
align-items: center;
font-size: 14px;
color: #333;
}
.col-id { width: 80px; }
.col-origin { flex: 2; }
.col-translation { flex: 2; }
.col-code { flex: 2; }
.col-type { width: 150px; }
.col-action { width: 150px; justify-content: flex-end; }
.action-btn {
color: #1890ff;
cursor: pointer;
}
.action-btn.danger {
color: #ff4d4f;
}
.action-btn.divider {
margin: 0 8px;
color: #e8e8e8;
}
</style>

View File

@@ -0,0 +1,226 @@
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 操作栏 -->
<view class="action-bar header-actions">
<button class="btn primary" @click="addLanguage">添加语言</button>
</view>
<!-- 表格内容 -->
<view class="admin-card content-card">
<view class="table-container list-table">
<view class="table-header">
<view class="col col-id"><text>ID</text></view>
<view class="col col-name"><text>语言名称</text></view>
<view class="col col-code"><text>浏览器语言识别码</text></view>
<view class="col col-status"><text>状态</text></view>
<view class="col col-action"><text>操作</text></view>
</view>
<view class="table-body">
<view v-for="item in dataList" :key="item.id" class="table-row">
<view class="col col-id"><text>{{ item.id }}</text></view>
<view class="col col-name">
<text>{{ item.name }}</text>
<text v-if="item.isDefault" class="default-badge">默认</text>
</view>
<view class="col col-code"><text>{{ item.code }}</text></view>
<view class="col col-status">
<view :class="['status-tag', item.status ? 'active' : 'inactive']" @click="toggleStatus(item)">
<text class="tag-text">{{ item.status ? '开启' : '关闭' }}</text>
<view class="tag-dot"></view>
</view>
</view>
<view class="col col-action">
<text class="action-btn" @click="editItem(item)">编辑</text>
<text class="action-btn divider">|</text>
<text class="action-btn danger" @click="deleteItem(item)">删除</text>
</view>
</view>
</view>
</view>
<!-- 分页 -->
<view class="pagination">
<text class="page-info">共 10 条 15条/页</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const dataList = ref([
{ id: 1, name: '中文', code: 'zh-CN', status: true, isDefault: true },
{ id: 2, name: 'English', code: 'en-US', status: true, isDefault: false },
{ id: 3, name: '繁體中文', code: 'zh-Hant', status: true, isDefault: false },
{ id: 4, name: 'Français', code: 'fr-FR', status: true, isDefault: false },
{ id: 5, name: 'Italiano', code: 'it-IT', status: true, isDefault: false },
{ id: 6, name: '日本語', code: 'ja-JP', status: true, isDefault: false },
{ id: 7, name: '한국어', code: 'ko-KR', status: true, isDefault: false },
{ id: 8, name: 'Монгол', code: 'mn-MN', status: true, isDefault: false },
{ id: 9, name: 'ภาษาไทย', code: 'th-TH', status: true, isDefault: false },
{ id: 10, name: 'ViệtName', code: 'vi-VN', status: true, isDefault: false }
])
function addLanguage() {
uni.showToast({ title: '添加语言', icon: 'none' })
}
function toggleStatus(item: any) {
item.status = !item.status
}
function editItem(item: any) {
uni.showToast({ title: '编辑: ' + item.name, icon: 'none' })
}
function deleteItem(item: any) {
uni.showModal({
title: '提示',
content: '确定要删除此语言吗?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '删除成功' })
}
}
})
}
</script>
<style scoped lang="scss">
.admin-page {
padding: 24px;
background-color: #f5f7f9;
min-height: 100vh;
}
.action-bar {
margin-bottom: 20px;
}
.admin-card {
background-color: #fff;
border-radius: 4px;
padding: 0;
overflow: hidden;
}
.btn {
height: 32px;
padding: 0 16px;
border-radius: 4px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border: none;
}
.btn.primary {
background-color: #1890ff;
color: #fff;
}
.table-container {
width: 100%;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #fafafa;
border-bottom: 1px solid #f0f0f0;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.col {
padding: 16px;
display: flex;
align-items: center;
font-size: 14px;
color: #333;
}
.col-id { width: 80px; }
.col-name { flex: 1; position: relative; }
.col-code { flex: 1; }
.col-status { width: 120px; justify-content: center; }
.col-action { width: 150px; justify-content: flex-end; }
.default-badge {
background-color: #e6f7ff;
color: #1890ff;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
margin-left: 8px;
border: 1px solid #91d5ff;
}
.status-tag {
width: 60px;
height: 24px;
border-radius: 12px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 8px;
cursor: pointer;
}
.status-tag.active {
background-color: #1890ff;
color: #fff;
}
.status-tag.inactive {
background-color: #d9d9d9;
color: #fff;
}
.tag-text {
font-size: 12px;
}
.tag-dot {
width: 8px;
height: 8px;
background-color: #fff;
border-radius: 50%;
}
.action-btn {
color: #1890ff;
cursor: pointer;
}
.action-btn.danger {
color: #ff4d4f;
}
.action-btn.divider {
margin: 0 8px;
color: #e8e8e8;
}
.pagination {
padding: 16px 24px;
display: flex;
justify-content: flex-end;
}
.page-info {
font-size: 14px;
color: #999;
}
</style>

View File

@@ -0,0 +1,191 @@
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 搜索栏 -->
<view class="admin-card filter-card">
<view class="filter-row">
<view class="filter-item">
<text class="label">搜索:</text>
<input class="filter-input" placeholder="请输入语言Code" />
</view>
<button class="btn primary" @click="onSearch">搜索</button>
</view>
</view>
<!-- 操作栏 -->
<view class="action-bar header-actions">
<button class="btn primary" @click="addRegion">添加语言地区</button>
</view>
<!-- 表格内容 -->
<view class="admin-card content-card">
<view class="table-container list-table">
<view class="table-header">
<view class="col col-id"><text>编号</text></view>
<view class="col col-code"><text>浏览器语言识别码</text></view>
<view class="col col-desc"><text>语言说明</text></view>
<view class="col col-lang"><text>关联语言</text></view>
<view class="col col-action"><text>操作</text></view>
</view>
<view class="table-body">
<view v-for="item in dataList" :key="item.id" class="table-row">
<view class="col col-id"><text>{{ item.id }}</text></view>
<view class="col col-code"><text>{{ item.code }}</text></view>
<view class="col col-desc"><text>{{ item.desc }}</text></view>
<view class="col col-lang"><text>{{ item.lang || '暂无' }}</text></view>
<view class="col col-action">
<text class="action-btn" @click="editItem(item)">编辑</text>
<text class="action-btn divider">|</text>
<text class="action-btn danger" @click="deleteItem(item)">删除</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const dataList = ref([
{ id: 346, code: 'zh-HK', desc: '中文(繁体, 香港特别行政区)', lang: '' },
{ id: 344, code: 'zh-MO', desc: '中文(繁体, 澳门特别行政区)', lang: '' },
{ id: 343, code: 'zh-Hant', desc: '中文(繁体)', lang: '繁体中文(zh-Hant)' },
{ id: 342, code: 'zh', desc: '中文', lang: '' },
{ id: 340, code: 'vi', desc: '越南语', lang: '' },
{ id: 339, code: 'yo-NG', desc: '约鲁巴语(尼日利亚)', lang: '' },
{ id: 337, code: 'en-GB', desc: '英语(英国)', lang: '' },
{ id: 336, code: 'en-IN', desc: '英语(印度)', lang: '' },
{ id: 335, code: 'en-JM', desc: '英语(牙买加)', lang: '' },
{ id: 334, code: 'en-NZ', desc: '英语(新西兰)', lang: '' }
])
function onSearch() {
uni.showToast({ title: '搜索中...', icon: 'none' })
}
function addRegion() {
uni.showToast({ title: '添加语言地区', icon: 'none' })
}
function editItem(item: any) {
uni.showToast({ title: '编辑: ' + item.code, icon: 'none' })
}
function deleteItem(item: any) {
uni.showModal({
title: '提示',
content: '确定要删除此地区配置吗?',
success: (res) => {
if (res.confirm) {
uni.showToast({ title: '删除成功' })
}
}
})
}
</script>
<style scoped lang="scss">
.admin-page {
padding: 24px;
background-color: #f5f7f9;
min-height: 100vh;
}
.filter-row {
display: flex;
flex-direction: row;
align-items: center;
gap: 16px;
}
.label {
font-size: 14px;
color: #333;
}
.filter-input {
width: 200px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 0 10px;
font-size: 14px;
}
.btn {
height: 32px;
padding: 0 16px;
border-radius: 4px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
border: none;
}
.btn.primary {
background-color: #1890ff;
color: #fff;
}
.action-bar {
margin-bottom: 20px;
}
.admin-card {
background-color: #fff;
border-radius: 4px;
padding: 0;
overflow: hidden;
}
.table-container {
width: 100%;
}
.table-header {
display: flex;
flex-direction: row;
background-color: #fafafa;
border-bottom: 1px solid #f0f0f0;
}
.table-row {
display: flex;
flex-direction: row;
border-bottom: 1px solid #f0f0f0;
}
.col {
padding: 16px;
display: flex;
align-items: center;
font-size: 14px;
color: #333;
}
.col-id { width: 100px; }
.col-code { flex: 1; }
.col-desc { flex: 2; }
.col-lang { flex: 1; }
.col-action { width: 150px; justify-content: flex-end; }
.action-btn {
color: #1890ff;
cursor: pointer;
}
.action-btn.danger {
color: #ff4d4f;
}
.action-btn.divider {
margin: 0 8px;
color: #e8e8e8;
}
</style>