轮播图状态

master
阿怪 10 months ago
parent 2ad1bf1938
commit 68258684f5

@ -2,7 +2,7 @@ ENV = 'development'
VITE_CLI_PORT = 8088 VITE_CLI_PORT = 8088
VITE_SERVER_PORT = 8888 VITE_SERVER_PORT = 8888
VITE_BASE_API = /api 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 = vscode
// VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm // VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm
// 如果使用docker-compose开发模式设置为下面的地址或本机主机IP // 如果使用docker-compose开发模式设置为下面的地址或本机主机IP

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

@ -2,7 +2,7 @@
// //
import api from '@/api/lbt' import api from '@/api/lbt'
// import { toSQLLine } from '@/utils/stringFun' // 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 { ref, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
@ -12,6 +12,7 @@ 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' import { parseTime } from '@/utils'
import { fa } from 'element-plus/es/locale'
// //
const path = ref(import.meta.env.VITE_BASE_API) const path = ref(import.meta.env.VITE_BASE_API)
const queryParams = ref({ const queryParams = ref({
@ -173,6 +174,22 @@ function handleSizeChange(val) {
queryParams.value.pageSize = val queryParams.value.pageSize = val
getLbtList() 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> </script>
<template> <template>
<div> <div>
@ -205,7 +222,8 @@ 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'?'启用':'禁用' }} <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> </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" /> -->
@ -273,9 +291,9 @@ function handleSizeChange(val) {
<el-form-item label="链接地址" prop="link"> <el-form-item label="链接地址" prop="link">
<el-input v-model="form.link" placeholder="链接地址" autocomplete="off" /> <el-input v-model="form.link" placeholder="链接地址" autocomplete="off" />
</el-form-item> </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-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-form-item label="展示位置" prop="lbtType">
<el-select v-model="form.lbtType" class="m-2" placeholder="请选择"> <el-select v-model="form.lbtType" class="m-2" placeholder="请选择">
<el-option <el-option

Loading…
Cancel
Save