<template>
	<div class="padding-sm">
		<el-form label-position="right" label-width="120px">
			<el-form-item label="图片质量配置：">
				<el-select v-model="pictureInfo.image_out_size" placeholder="请选择">
				    <el-option
						v-for="(item,index) in pictureOptions"
						:key="item.value"
						:label="item.label"
						:value="item.value">
				    </el-option>
				  </el-select>
				  <el-button class="margin-left" type="primary" @click="conFirm">确定</el-button>
			</el-form-item>
		</el-form>
	</div>
</template>

<script setup>
	import IpInput from "@/views/components/IpInput/index";
	import { getPictureConfig, setPictureConfig } from "@/api/settConfiguration"
	const { proxy } = getCurrentInstance();
	const baseUrl = location.protocol+"//"+window.location.host+"/";
	// const baseUrl = import.meta.env.VITE_APP_BASE_API;
	const data = reactive({
		pictureInfo: {},
		pictureOptions: [{
		    value: '0',
		    label: '默认'
		}, {
		    value: '600',
		    label: '600P（省流量）'
		}, {
		    value: '720',
		    label: '720P（中级）'
		}, {
		    value: '1080',
		    label: '1080P (高级)'
		}]
	});
	const { pictureInfo, pictureOptions } = toRefs(data);
	const conFirm = function(){
		proxy.$modal.confirm('确认是否修改图片质量配置？')
		.then(function () {
			setPictureConfig(pictureInfo.value).then((response) => {
				if(response.code == 200){
					getPictureInfo();
					editFirm.value = false;
					proxy.$modal.msgSuccess("操作成功！");
				}
			})
		}).catch(() => { 
			
		});
	}
	const getPictureInfo = function(){
		getPictureConfig().then((response) => {
			if(response.code == 200){
				pictureInfo.value = response.data[1];
			}
		})
	}
	getPictureInfo();
	
</script>

<style>  
</style>