修改轮播图无限制访问接口的bug

This commit is contained in:
阿怪 2023-12-10 23:28:40 +08:00
parent ba45ca26bb
commit fe816585f0
2 changed files with 22 additions and 4 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://e07b2b5.r9.cpolar.top
VITE_BASE_PATH = https://api.jimingyiliao.com/
VITE_EDITOR = vscode
// VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm
// 如果使用docker-compose开发模式设置为下面的地址或本机主机IP

View File

@ -175,9 +175,27 @@ function handleSizeChange(val) {
getLbtList()
}
const state_loading = ref(false)
async function changeStateFunc(row) { //
async function changeStateFunc(event, row) { //
// console.log('changeStateFunc is ====', row, event)
// 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
// }
}
async function beforeChangeFunc(index, row) {
// console.log(row, index)
// return false
state_loading.value = true
const res = await api.editLbtState({ status: row.status })
const res = await api.editLbtState({ ID: row.ID, status: row.status == 1 ? 2 : 1 })
state_loading.value = false
// eslint-disable-next-line no-empty
if (res.code === 0) {
@ -222,7 +240,7 @@ async function changeStateFunc(row) { // 改变状态
</el-table-column>
<el-table-column align="left" label="是否启用" min-width="150" prop="status">
<template #default="scope">
<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)" />
<el-switch v-model="scope.row.status" :active-value="1" :loading="state_loading" :inactive-value="2" active-text="启用" inactive-text="禁用" :before-change="()=>{return beforeChangeFunc($event, scope.row)}" @change="changeStateFunc($event,scope.row)" />
<!-- {{ scope.row.status == '1'?'启用':'禁用' }} -->
</template>
</el-table-column>