Files
medical-mall/pages/mall/admin/maintain/api/account.uvue
2026-02-11 19:51:32 +08:00

279 lines
6.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="admin-page">
<view class="admin-sections">
<!-- 提示栏 -->
<view class="alert-warning">
<text class="alert-content">获取访问 Token 的接口:\n请求 URL/outapi/access_token 请求方式POST 请求参数appid和appsecret 返回数据access_token访问令牌 exp_time令牌过期时间 auth_info授权信息\n使用获取到的 Token 访问对外接口:\n在 HTTP 请求头中添加 Authorization 字段 字段值为 Bearer access_token(注意 Bearer 后有一个空格)</text>
</view>
<!-- 操作栏 -->
<view class="action-bar header-actions">
<button class="btn primary" @click="addAccount">添加账号</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-account"><text>账号</text></view>
<view class="col col-desc"><text>描述</text></view>
<view class="col col-add-time"><text>添加时间</text></view>
<view class="col col-last-time"><text>最后登录时间</text></view>
<view class="col col-last-ip"><text>最后登录ip</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-account"><text>{{ item.account }}</text></view>
<view class="col col-desc"><text>{{ item.desc }}</text></view>
<view class="col col-add-time"><text>{{ item.addTime }}</text></view>
<view class="col col-last-time"><text>{{ item.lastTime }}</text></view>
<view class="col col-last-ip"><text>{{ item.lastIp }}</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="setConfig(item)">设置</text>
<text class="action-btn divider">|</text>
<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">共 2 条 20条/页</text>
<view class="page-btns">
<text class="p-btn disabled">˂</text>
<text class="p-btn active">1</text>
<text class="p-btn disabled">˃</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const dataList = ref([
{ id: 9, account: 'ceshi', desc: 'ceshi', addTime: '2024-09-05 11:16:07', lastTime: '暂无', lastIp: '', status: true },
{ id: 10, account: 'tuoluojiang', desc: '', addTime: '2024-09-09 10:12:54', lastTime: '2024-09-10 19:15:01', lastIp: '124.221.49.234', status: true }
])
function addAccount() {
uni.showToast({ title: '添加账号', icon: 'none' })
}
function toggleStatus(item: any) {
item.status = !item.status
}
function setConfig(item: any) {
uni.showToast({ title: '参数设置: ' + item.account, icon: 'none' })
}
function editItem(item: any) {
uni.showToast({ title: '编辑: ' + item.account, 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;
}
.alert-warning {
background-color: #fff7e6;
border: 1px solid #ffe7ba;
padding: 16px 20px;
border-radius: 4px;
margin-bottom: 24px;
}
.alert-content {
color: #fa8c16;
font-size: 14px;
line-height: 1.8;
white-space: pre-wrap;
}
.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-account { width: 120px; }
.col-desc { flex: 1; }
.col-add-time { width: 180px; }
.col-last-time { width: 180px; }
.col-last-ip { width: 150px; }
.col-status { width: 100px; justify-content: center; }
.col-action { width: 200px; justify-content: flex-end; }
.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;
flex-direction: row;
align-items: center;
justify-content: flex-end;
gap: 16px;
}
.page-info {
font-size: 14px;
color: #666;
}
.page-btns {
display: flex;
flex-direction: row;
gap: 8px;
}
.p-btn {
width: 32px;
height: 32px;
border: 1px solid #d9d9d9;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: #666;
cursor: pointer;
}
.p-btn.active {
background-color: #fff;
border-color: #1890ff;
color: #1890ff;
}
.p-btn.disabled {
color: #bfbfbf;
cursor: not-allowed;
}
</style>