提交 6cdd6daa authored 作者: xiejiang's avatar xiejiang

fix: 修复表格以及新增版本更新

上级 ce0c069f
......@@ -2,18 +2,14 @@
* @Author: xiejiang
* @Date: 2024-11-05 10:14:56
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 16:07:40
* @LastEditTime: 2024-12-10 16:21:35
* @Description:
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
<template>
<div>
<t-config-provider :global-config="globalConfig">
<router-view></router-view>
</t-config-provider>
<!-- <UpdataVersion ref="updataVersionRef" /> -->
</div>
</template>
<script setup lang="ts">
......
......@@ -2,7 +2,7 @@
* @Author: zhanyoulin<zhanyoulin456@163.com>
* @Date: 2023-06-25 09:01:18
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-05 16:18:02
* @LastEditTime: 2024-12-10 18:00:50
* @Description:
*/
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
......@@ -38,6 +38,21 @@ const config = {
class RequestHttp {
service: AxiosInstance
/**
* @description 显示错误消息的方法
* @param msg 错误消息
*/
private showMessage(msg: string) {
if (!this.isMessageShown) {
this.isMessageShown = true
MessagePlugin.error(msg)
setTimeout(() => {
this.isMessageShown = false
}, 2000)
}
}
private isMessageShown: boolean = false // 添加一个标志来跟踪是否已经显示了消息
public constructor(config: AxiosRequestConfig) {
// instantiation
this.service = axios.create(config)
......@@ -54,7 +69,9 @@ class RequestHttp {
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { noLoading: true } 来控制
// config.noLoading || showFullScreenLoading()
if (config.headers && typeof config.headers.set === 'function') {
config.headers.set('menuId', authStore.activeMenuId)
const activeMenu = authStore.activeMenuId || localStorage.getItem('activeMenuId')
config.headers.set('menuId', activeMenu)
// config.headers.set('menuSign', authStore.menuSign)
config.headers.set('client', 'platform')
config.headers.set('device', getDeviceType())
......@@ -83,12 +100,12 @@ class RequestHttp {
if (data.code == ResultEnum.OVERDUE) {
userStore.setToken('')
router.replace(LOGIN_URL)
MessagePlugin.error(data.msg)
this.showMessage(data.msg)
return Promise.reject(data)
}
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
if (data.code && data.code !== ResultEnum.SUCCESS) {
MessagePlugin.error(data.msg)
this.showMessage(data.msg)
return Promise.reject(data)
}
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
......@@ -98,8 +115,8 @@ class RequestHttp {
const { response } = error
tryHideFullScreenLoading()
// 请求超时 && 网络错误单独判断,没有 response
if (error.message.indexOf('timeout') !== -1) MessagePlugin.error('请求超时!请您稍后重试')
if (error.message.indexOf('Network Error') !== -1) MessagePlugin.error('网络错误!请您稍后重试')
if (error.message.indexOf('timeout') !== -1) this.showMessage('请求超时!请您稍后重试')
if (error.message.indexOf('Network Error') !== -1) this.showMessage('网络错误!请您稍后重试')
// 根据服务器响应的错误状态码,做不同的处理
if (response) checkStatus(response.status)
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-12-05 09:20:12
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 17:52:26
* @LastEditTime: 2024-12-10 17:08:56
* @Description:
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
*/
......@@ -35,7 +35,7 @@ export interface ResVersion extends KeyAny {
platformType?: number // 终端类型*【1:平台端(后台);2:机构端;3:】 [必填]
platformVersionLogs?: any[] // 平台端版本日志 [必填]
remark?: string // 备注 [必填]
versionId?: number // 版本id [必填]
versionId?: string // 版本id [必填]
updateTime?: string // 更新时间 [必填]
updateUserId?: number // 更新人id [必填]
version?: string // 版本号 [必填]
......
/*
* @Author: xiejiang
* @Date: 2024-12-08 09:25:34
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 17:53:42
* @Description:
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
*/
import http from '@/api'
import { ReqVersionPage, ResVersionPage, ResVersion, ReqVersion } from '@/api/interface/version/index'
......@@ -78,6 +86,6 @@ export const postVersionRemove = (data: { ids: string[] }) => {
* @param status 版本状态*【1:开发中;2:已发布;3:已下线】 [必填]
* @param versionId 版本id* [必填]
*/
export const postVersionEditStatus = (data: { status: number; versionId: number }) => {
export const postVersionEditStatus = (data: { status: number; versionId: string }) => {
return http.post(api.postVersionEditStatus, data)
}
......@@ -107,6 +107,7 @@ const isShowFilterResult = computed(() => filterData.value.find((v: filterItemPr
const filterResultClose = (item: filterItemProp) => {
item.str = ''
}
// 清空
const handleClear = () => {
filterData.value.flatMap((item: filterItemProp) => {
......@@ -172,16 +173,16 @@ watch(
}
)
watch(
() => filterData,
() => {
handleFilterSearch()
},
{
deep: true,
immediate: true
}
)
// watch(
// () => filterData,
// () => {
// handleFilterSearch()
// },
// {
// deep: true,
// immediate: true
// }
// )
defineExpose<DynamicType>({
resetFilterConditions
......
......@@ -2,32 +2,35 @@
* @Author: xiejiang
* @Date: 2024-12-10 15:36:04
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 16:00:23
* @LastEditTime: 2024-12-10 17:51:30
* @Description: 更新版本弹窗
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
<template>
<Dialog
:dialog-visible="isShowPuzzleVcode"
:dialog-visible="visible"
width="640px"
class="upadte-dialog"
:close-on-overlay-click="false"
@close="isShowPuzzleVcode = false"
@close="visible = false"
>
<template #body>
<main class="updata-main">
<div class="flex items-center">
<span>业务分支:</span>
<span>{{ state.platformType == 1 ? '平台端' : '机构端' }}</span>
<main class="updata-main px-[32px] py-[16px]">
<div class="flex items-center mb-[16px]">
<span class="min-w-[80px]">业务分支:</span>
<span class="text-[var(--td-font-gray-1)]">{{ state?.platformType == 1 ? '平台端' : '机构端' }}</span>
</div>
<div class="flex items-center">
<span>版本号:</span>
<span>{{ state.version }}</span>
<div class="flex items-center mb-[16px]">
<span class="min-w-[80px]">版本号:</span>
<span class="text-[var(--td-font-gray-1)]">{{ state?.version }}</span>
</div>
<div class="flex items-center">
<span>更新说明:</span>
<div class="content-div" v-html="state.description"></div>
<div class="flex">
<span class="min-w-[80px]">更新说明:</span>
<div class="content-div text-[var(--td-font-gray-1)]" v-html="state?.description"></div>
</div>
<div class="flex justify-center">
<t-button class="mt-[60px] w-[250px]" @click="handleConfirm" shape="round">更新至最新版本</t-button>
</div>
<t-button class="mt-[60px] h-[48px] w-full text-[16px]" type="submit" shape="round">更新至最新版本</t-button>
</main>
</template>
</Dialog>
......@@ -35,17 +38,69 @@
<script setup lang="ts" name="upadta-version">
import { ResVersion } from '@/api/interface/version/index'
const isShowPuzzleVcode = ref(false)
const state = reactive<ResVersion>({})
const open = (data: ResVersion) => {
isShowPuzzleVcode.value = true
state.value = data
}
import { postSaveUserClient } from '@/api/modules/menu/index'
defineExpose({
open
const props = withDefaults(defineProps<{ dialogVisible: boolean; state: ResVersion | null }>(), {
dialogVisible: false,
state: null
})
const visible = ref(false)
watch(
() => props.dialogVisible,
val => {
console.log(val)
visible.value = val
},
{ immediate: true }
)
const handleConfirm = () => {
postSaveUserClient({ versionId: props.state?.versionId as string }).finally(() => {
visible.value = false
})
window.location.reload()
}
</script>
<style lang="less" scoped></style>
<style lang="less">
.content-div {
max-height: 400px;
overflow: auto;
* {
padding: 0;
margin: 0;
}
}
.upadte-dialog {
.t-dialog {
border: none;
}
.t-dialog--default {
padding: 0 !important;
}
.t-dialog__header {
height: 187px;
background: url('@/assets/images/update.png');
background-size: 100% 100%;
position: relative;
.t-dialog__close {
color: var(--td-white);
position: absolute;
right: 24px;
top: 24px;
}
.t-dialog__close:hover {
background: none;
}
}
}
</style>
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-08 10:41:05
* @LastEditTime: 2024-12-10 16:47:46
* @Description:
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -17,10 +17,12 @@
</t-aside>
<Main class="content-main" :style="tabWidth" />
</t-layout>
<UpdateVersion :dialog-visible="dialogVisible" :state="userInfo?.clientLastVersion || null" />
</t-layout>
</template>
<script setup lang="ts">
import { useUserStore } from '@/stores/modules/user'
import { useGlobalStore } from '@/stores/modules/global'
import Header from '@/layouts/components/Header/index.vue'
import Main from '@/layouts/components/Main/index.vue'
......@@ -28,6 +30,31 @@ import MenuSearch from '@/layouts/components/Menu/MenuSearch.vue'
import Menu from '@/layouts/components/Menu/index.vue'
// import MiddleBtn from '@/layouts/components/MiddleBtn/index.vue'
const userStore = useUserStore()
const userInfo = computed(() => userStore.userInfo)
const dialogVisible = ref(false)
watch(
userInfo,
val => {
if (!val) return
if (val?.needUpd) {
dialogVisible.value = true
}
},
{
deep: true
}
)
onMounted(() => {
// 获取用户信息
if (userInfo.value?.needUpd) {
dialogVisible.value = true
}
})
const globalStore = useGlobalStore()
const isCollapse = computed(() => globalStore.isCollapse)
const tabWidth = isCollapse.value ? 'width: calc(100% - 52px)' : 'width: calc(100% - 208px)'
......
......@@ -118,6 +118,7 @@ router.beforeEach(async (to, from, next) => {
const activeMenuId = findMenuByName(authStore.authMenuListGet, to.name as string)?.menuId ?? ''
if (activeMenuId) {
authStore.setActiveMenuId(activeMenuId)
localStorage.setItem('activeMenuId', activeMenuId)
}
next()
......
......@@ -33,6 +33,7 @@ const customerRouter: RouteRecordRaw[] = [
title: '添加机构',
access: 'institution',
noTopTag: true,
affix: false,
activeMenu: 'institution',
hideFooter: true
}
......@@ -45,6 +46,7 @@ const customerRouter: RouteRecordRaw[] = [
title: '机构详情',
access: 'institution',
noTopTag: true,
affix: false,
activeMenu: 'institution',
hideFooter: true
}
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-28 15:00:25
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-05 09:45:29
* @LastEditTime: 2024-12-10 17:44:56
* @Description: 系统配置
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
*/
......@@ -34,6 +34,7 @@ const sysConfigRouter: RouteRecordRaw[] = [
title: '管理子集',
access: 'dictionary',
noTopTag: true,
affix: false,
activeMenu: 'dictionary',
hideFooter: true
}
......
......@@ -34,6 +34,7 @@ const sysPermissionsRouter: RouteRecordRaw[] = [
title: '用户详情',
access: 'users',
noTopTag: true,
affix: false,
activeMenu: 'users',
hideFooter: true
}
......@@ -55,6 +56,7 @@ const sysPermissionsRouter: RouteRecordRaw[] = [
title: '角色详情',
access: 'role',
noTopTag: true,
affix: false,
activeMenu: 'role',
hideFooter: true
}
......
......@@ -2,7 +2,7 @@
* @Author: zhanyoulin<zhanyoulin456@163.com>
* @Date: 2023-06-13 09:41:17
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-03 09:48:57
* @LastEditTime: 2024-12-10 17:13:53
* @Description:
*/
......@@ -25,6 +25,7 @@ export interface UserInfo {
loginInfo: {
device: string
ip: string
loginIp?: string
location?: string
loginAddress?: string
time: string
......
......@@ -80,6 +80,7 @@ onMounted(() => {
}
])
getDictData()
getData()
})
// 加载状态
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-05 10:14:56
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-08 14:49:30
* @LastEditTime: 2024-12-10 17:13:32
* @Description: 首页
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -12,7 +12,7 @@
<div></div>
</div> -->
<div class="home-avatar flex items-center justify-center">
<div>
<div class="text-center">
<p class="text-20 bold">{{ userInfo && userInfo.userName }},您好!</p>
<p class="text-14">欢迎使用智慧教育平台</p>
</div>
......@@ -28,10 +28,10 @@
</p>
<p>
<span>上次登录:</span>
<span class="max-w-[calc(100%-90px)]"
>{{ userInfo?.loginInfo.loginAddress || '-' }}{{ userInfo?.loginInfo.time || '-' }}{{
userInfo?.loginInfo.device || '-'
}}</span
<span class="max-w-[calc(100%-90px)] text-right"
>{{ userInfo?.loginInfo.loginAddress || '-' }}{{ userInfo?.loginInfo.loginIp || '-' }}{{
userInfo?.loginInfo.time || '-'
}}{{ userInfo?.loginInfo.device || '-' }}</span
>
</p>
</div>
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 15:04:00
* @LastEditTime: 2024-12-10 17:52:47
* @Description: 系统字典
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -81,6 +81,7 @@ onMounted(() => {
title: '系统字典'
}
])
getData()
})
const dictionaryEditRef = ref()
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 15:19:33
* @LastEditTime: 2024-12-10 17:52:38
* @Description: 菜单管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -112,6 +112,7 @@ onMounted(() => {
title: '菜单管理'
}
])
getData()
GetAllMenuGroup()
})
// 搜索参数类型
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 11:40:24
* @LastEditTime: 2024-12-10 17:21:10
* @Description: 菜单管理-新增编辑菜单
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -81,7 +81,7 @@ const formRef = useTemplateRef<FormInstanceFunctions>('formRef')
const formData = reactive<ReqMenuEdit>({
htmlPlatform: '',
icon: '',
isButton: '1',
isButton: 0,
menuId: '',
menuLevel: 1,
menuName: '',
......@@ -164,7 +164,7 @@ const close = () => {
drawerVisible.value = false
formRef.value?.reset()
formData.menuLevel = 1
formData.isButton = 1
formData.isButton = 0
formData.menuId = ''
}
......@@ -179,6 +179,11 @@ const getLevelMenu = () => {
}
// 菜单层级变化
const changeMenuLevel = () => {
if (formData.menuLevel === 3) {
formData.isButton = 1
} else {
formData.isButton = 0
}
getLevelMenu()
}
......
<template>
<Drawer :drawer-visible="drawerVisible" width="480" title="操作日志" :footer="false" @close="close">
<Drawer :drawer-visible="drawerVisible" width="640" title="操作日志" :footer="false" @close="close">
<SearchWithButton
:loading="loading"
placeholder="操作人姓名"
......@@ -38,7 +38,6 @@ const tableData = ref<ResMenu[]>([])
const pagination = ref<PaginationProps>({
current: 1,
pageSize: 10,
size: 'small',
total: 0
})
// 表格columns配置
......@@ -51,7 +50,7 @@ const columns: PrimaryTableCol[] = [
width: 270,
cell: (h, { row }: { row: any }) => {
return (
<div class='text-[var(--td-brand-color)]'>
<div>
<p>操作:{operateTypeTxt(row.operateType)}</p>
<p>菜单名称:{row.menuName}</p>
<p>路由名称:{row.router}</p>
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 15:20:00
* @LastEditTime: 2024-12-10 17:53:27
* @Description: 版本管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -96,7 +96,7 @@ onMounted(() => {
title: '版本管理'
}
])
// getData()
getData()
})
// 搜索参数类型
const filterConditions = ref<filterItemProp[]>([
......@@ -198,7 +198,7 @@ const handleStatus = (row: ResVersion, status: number) => {
// 请求成功后,销毁弹框
dialog.update({ confirmBtn: { content: '确定', loading: true } })
postVersionEditStatus({
versionId: row?.versionId as number,
versionId: row?.versionId as string,
status: status == 6 ? 3 : 2
})
.then(() => {
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 15:20:22
* @LastEditTime: 2024-12-10 17:52:13
* @Description: 角色管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -76,7 +76,7 @@ onMounted(() => {
name: 'role'
}
])
// getData()
getData()
})
// 加载状态
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 15:25:28
* @LastEditTime: 2024-12-10 17:52:05
* @Description: 用户管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -78,7 +78,7 @@ onMounted(() => {
title: '用户管理'
}
])
// getData()
getData()
})
// 加载状态
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论