update 调整oss预览开关 使用前端直接调用更改配置参数

This commit is contained in:
疯狂的狮子li
2022-02-09 14:52:33 +08:00
parent 844e8b2f77
commit d99dd4b875
7 changed files with 35 additions and 31 deletions

View File

@ -43,6 +43,18 @@ export function updateConfig(data) {
})
}
// 修改参数配置
export function updateConfigByKey(key, value) {
return request({
url: '/system/config/updateByKey',
method: 'put',
data: {
configKey: key,
configValue: value
}
})
}
// 删除参数配置
export function delConfig(configId) {
return request({

View File

@ -17,13 +17,3 @@ export function delOss(ossId) {
})
}
export function changePreviewListResource(previewListResource) {
const data = {
previewListResource
}
return request({
url: '/system/oss/changePreviewListResource',
method: 'put',
data: data
})
}

View File

@ -17,7 +17,7 @@ import { download } from '@/utils/request'
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { getConfigKey, updateConfigByKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
// 分页组件
import Pagination from "@/components/Pagination";
@ -41,6 +41,7 @@ import DictData from '@/components/DictData'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.updateConfigByKey = updateConfigByKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange

View File

@ -187,7 +187,7 @@
</template>
<script>
import { listOss, delOss, changePreviewListResource } from "@/api/system/oss";
import { listOss, delOss } from "@/api/system/oss";
export default {
name: "Oss",
@ -344,7 +344,7 @@ export default {
handlePreviewListResource(previewListResource) {
let text = previewListResource ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?').then(() => {
return changePreviewListResource(previewListResource);
return this.updateConfigByKey("sys.oss.previewListResource", previewListResource);
}).then(() => {
this.getList()
this.$modal.msgSuccess(text + "成功");