<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Override-Config-Gui</title> <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> </head> <body class="bg-gray-100"> <div id="app" class="container mx-auto p-4"> <h1 class="text-2xl font-bold mb-4">Override-Config-Gui</h1> <div class="bg-white rounded-lg shadow-sm p-5 mb-5 px-8 pt-6 pb-8"> <h2 class="text-2xl bg-white font-bold mb-4">服务管理</h2> <button id="toggleServer" class="px-5 py-2.5 bg-blue-500 text-white border-none rounded cursor-pointer mr-2.5 hover:bg-blue-600" :style="toggleServerStyle()" @click="toggleServer">{{ textContent }}</button> <button id="copyVscodeConfig" class="px-5 py-2.5 bg-blue-500 text-white border-none rounded cursor-pointer mr-2.5 hover:bg-blue-600" @click="copyVscodeConfig">复制 vscode 配置</button> <button id="testConnection" class="px-5 py-2.5 bg-blue-500 text-white border-none rounded cursor-pointer mr-2.5 hover:bg-blue-600" @click="testConnection">连通性测试</button> <div class="inline-block mr-2.5"> <select id="protocolSelect" class="px-3 py-2.5 bg-white text-gray-700 border border-gray-300 rounded cursor-pointer" v-model="selectedProtocol"> <option value="http">HTTP</option> <option value="https">HTTPS</option> </select> </div> </div> <div class="bg-white rounded-lg shadow-sm p-5 mb-5 px-8 pt-6 pb-8"> <h2 class="text-2xl font-bold mb-4">配置管理</h2> <template> <div v-if="config && Object.keys(config).length > 0"> <div v-for="(value, key) in config" :key="key" class="mb-4 flex items-start"> <label class="w-1/3 text-right pr-4 text-gray-700 text-sm font-bold mt-2" :for="key"> {{ key }} </label> <div class="w-2/3"> <template v-if="typeof value === 'object' && value !== null"> <textarea class="w-full shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" :id="key" v-model="config[key]" rows="5" ></textarea> </template> <template v-else> <input class="w-full shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" :id="key" type="text" v-model="config[key]" > </template> </div> </div> </div> <div v-else class="text-center text-red-600 font-bold"> 配置获取失败 </div> </template> <div class="flex items-center justify-end mt-6"> <button @click="updateConfig" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"> 更新配置并重启 </button> </div> </div> <div v-show="showMessage" :class="['fixed', 'top-5', 'left-1/2', 'transform', '-translate-x-1/2', 'px-4', 'py-2', 'rounded', 'text-white', 'transition-opacity', 'duration-500', {'bg-green-500': messageType === 'success', 'bg-red-500': messageType === 'error', 'bg-yellow-500': messageType === 'warning', 'opacity-0': !showMessage, 'opacity-100': showMessage}]"> {{ message }} </div> </div> <script src="app.js"></script> </body> </html>