轮播图状态

This commit is contained in:
阿怪 2023-11-14 23:39:52 +08:00
parent 2ad1bf1938
commit 68258684f5
3 changed files with 31 additions and 6 deletions

View File

@ -2,7 +2,7 @@ ENV = 'development'
VITE_CLI_PORT = 8088
VITE_SERVER_PORT = 8888
VITE_BASE_API = /api
VITE_BASE_PATH = http://410fed99.r6.cpolar.top
VITE_BASE_PATH = http://4a1840b2.r12.cpolar.top
VITE_EDITOR = vscode
// VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm
// 如果使用docker-compose开发模式设置为下面的地址或本机主机IP

View File

@ -29,5 +29,12 @@ const api = {
data
})
},
editLbtState: data => {
return service({
url: '/banner/status',
method: 'put',
data
})
},
}
export default api

View File

@ -2,7 +2,7 @@
//
import api from '@/api/lbt'
// import { toSQLLine } from '@/utils/stringFun'
import WarningBar from '@/components/warningBar/warningBar.vue'
// import WarningBar from '@/components/warningBar/warningBar.vue'
import { ref, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
@ -12,6 +12,7 @@ const dialogFormVisible = ref(false)
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
import { parseTime } from '@/utils'
import { fa } from 'element-plus/es/locale'
//
const path = ref(import.meta.env.VITE_BASE_API)
const queryParams = ref({
@ -150,7 +151,7 @@ function delLbtFunc(item) {
.then(async() => {
const res = await api.delLbt({
// ids: [item.ID]
id: item.ID
id: item.ID
})
if (res.code === 0) {
ElMessage({
@ -173,6 +174,22 @@ function handleSizeChange(val) {
queryParams.value.pageSize = val
getLbtList()
}
const state_loading = ref(false)
async function changeStateFunc(row) { //
state_loading.value = true
const res = await api.editLbtState({ status: row.status })
state_loading.value = false
// eslint-disable-next-line no-empty
if (res.code === 0) {
ElMessage({
type: 'success',
message: '修改成功!'
})
return true
} else {
return false
}
}
</script>
<template>
<div>
@ -205,7 +222,8 @@ function handleSizeChange(val) {
</el-table-column>
<el-table-column align="left" label="是否启用" min-width="150" prop="status">
<template #default="scope">
{{ scope.row.status == '1'?'启用':'禁用' }}
<el-switch v-model="scope.row.status" :active-value="1" :loadiing="state_loading" :inactive-value="2" active-text="启用" inactive-text="禁用" :before-change="changeStateFunc(scope.row)" />
<!-- {{ scope.row.status == '1'?'启用':'禁用' }} -->
</template>
</el-table-column>
<!-- <el-table-column align="left" label="说明" min-width="150" prop="lbtIntroduction" /> -->
@ -273,9 +291,9 @@ function handleSizeChange(val) {
<el-form-item label="链接地址" prop="link">
<el-input v-model="form.link" placeholder="链接地址" autocomplete="off" />
</el-form-item>
<!-- <el-form-item label="启用状态" prop="status">
<el-form-item label="启用状态" prop="status">
<el-switch v-model="form.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />
</el-form-item> -->
</el-form-item>
<!-- <el-form-item label="展示位置" prop="lbtType">
<el-select v-model="form.lbtType" class="m-2" placeholder="请选择">
<el-option