修改轮播图状态显示问题;课程分类leve字段不准确的bug

This commit is contained in:
axlrose2333 2023-02-03 17:09:08 +08:00
parent 5b2fdcb833
commit c5fb597626
5 changed files with 22 additions and 16 deletions

View File

@ -4,4 +4,4 @@ VITE_CLI_PORT = 8080
VITE_SERVER_PORT = 8888 VITE_SERVER_PORT = 8888
VITE_BASE_API = /api VITE_BASE_API = /api
#下方修改为你的线上ip #下方修改为你的线上ip
VITE_BASE_PATH = https://demo.gin-vue-admin.com VITE_BASE_PATH = http://118.31.78.83

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ docs/_book
test/ test/
node_modules node_modules
dist

View File

@ -14,9 +14,7 @@ export function parseTime(time, cFormat) {
if (arguments.length === 0) { if (arguments.length === 0) {
return null return null
} }
if (time_str.indexOf('01-01-01') > -1) {
return '-'
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date let date
if (typeof time === 'object') { if (typeof time === 'object') {
@ -45,7 +43,9 @@ export function parseTime(time, cFormat) {
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
return value.toString().padStart(2, '0') return value.toString().padStart(2, '0')
}) })
if (time_str.indexOf('01-01-01') > -1) {
return '-'
}
return time_str return time_str
} }

View File

@ -41,7 +41,7 @@ onMounted(() => {
async function getSubjectList() { async function getSubjectList() {
const res = await api.getSubjectList(queryParams.value) const res = await api.getSubjectList(queryParams.value)
subjectList.value = res.data.records subjectList.value = res.data.records
if(res.code == 0) { if(res.code === 0) {
subjectList.value = res.data.records subjectList.value = res.data.records
total.value = res.data.total total.value = res.data.total
subjectList.value = addTreeFormatSubject(subjectList.value) subjectList.value = addTreeFormatSubject(subjectList.value)
@ -52,7 +52,7 @@ function addTreeFormatSubject(data) {
data.map( item => { data.map( item => {
item.label = item.name item.label = item.name
item.value = item.id item.value = item.id
if(item.level == 3) { if(item.level === 3) {
item.disabled = true item.disabled = true
} }
if(item.children) { if(item.children) {
@ -80,14 +80,12 @@ const handleSelectionChange = (val) => {
apis.value = val apis.value = val
} }
function editApiFunc(row) { function editApiFunc(row) {
// console.log(row)
for(let prop in form.value) { for(let prop in form.value) {
if(row[prop]){ if(row[prop]){
form.value[prop] = row[prop] form.value[prop] = row[prop]
} }
} }
form.value.id = row.id form.value.id = row.id
// console.log(form.value)
// return // return
openDialog('edit') openDialog('edit')
} }
@ -149,7 +147,7 @@ function findLevel(data,val){
let l_id = 0 let l_id = 0
for(let i =0;i<data.length;i++) { for(let i =0;i<data.length;i++) {
if(data[i].id === val) { if(data[i].id === val) {
l_id = data[i].level l_id = parseInt(data[i].level)+1
break; break;
} }
else{ else{
@ -161,8 +159,6 @@ function findLevel(data,val){
return l_id return l_id
} }
async function enterDialog() { // async function enterDialog() { //
// console.log(form.value)
// console.log(type.value)
let func_name = '' let func_name = ''
if(type.value === 'add') { if(type.value === 'add') {
func_name = 'addSubject' func_name = 'addSubject'

View File

@ -11,6 +11,7 @@ const route = useRoute()
const dialogFormVisible = ref(false) const dialogFormVisible = ref(false)
import { useUserStore } from '@/pinia/modules/user' import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
import {parseTime} from '@/utils'
// //
const path = ref(import.meta.env.VITE_BASE_API) const path = ref(import.meta.env.VITE_BASE_API)
const queryParams = ref({ const queryParams = ref({
@ -198,11 +199,15 @@ function handleSizeChange(val) {
</el-table-column> </el-table-column>
<el-table-column align="left" label="是否启用" min-width="150" prop="status" > <el-table-column align="left" label="是否启用" min-width="150" prop="status" >
<template #default="scope"> <template #default="scope">
{{scope.row.status === 1?'启用':'禁用'}} {{scope.row.status === '1'?'启用':'禁用'}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="说明" min-width="150" prop="lbtIntroduction" /> <el-table-column align="left" label="说明" min-width="150" prop="lbtIntroduction" />
<el-table-column align="left" label="更新时间" min-width="150" prop="UpdatedAt" /> <el-table-column align="left" label="更新时间" min-width="150" prop="UpdatedAt">
<template #default="scope">
{{parseTime(scope.row.UpdatedAt)}}
</template>
</el-table-column>
<el-table-column align="left" label="操作" min-width="150" prop="status"> <el-table-column align="left" label="操作" min-width="150" prop="status">
<template #default="scope"> <template #default="scope">
<el-button <el-button
@ -249,7 +254,7 @@ function handleSizeChange(val) {
:on-success="handleAvatarSuccess" :on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
> >
<img v-if="form.lbtUrl" :src="form.lbtUrl" class="avatar" /> <img v-if="form.lbtUrl" :src="form.lbtUrl" class="img-container" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
@ -291,11 +296,15 @@ function handleSizeChange(val) {
</div> </div>
</template> </template>
<style scoped> <style scoped>
.img-container{
width: 200px;
height: 150px;
}
.gva-btn-list{ .gva-btn-list{
justify-content: end; justify-content: end;
} }
.lbt-thumb{ .lbt-thumb{
width: 150px; width: 100px;
height: 50px; height: 50px;
} }
</style> </style>