| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
- <head>
- <th:block th:include="include :: header('亚马逊ASR参数配置')" />
- <th:block th:include="include :: layout-latest-css" />
- <th:block th:include="include :: ztree-css" />
- <style>
- </style>
- </head>
- <body>
- <div class="main-content">
- <div class="h4 form-header" th:text="#{switchconf.asr.aws.header}"></div>
- <div id="baseConfigs"></div>
- <!-- 保存按钮 -->
- <div class="row" ></div>
- <div class="row" >
- <div class="col-sm-offset-5 col-sm-10">
- <button id="saveConfig" type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><span th:text="#{switchconf.btn.save}"></span></button>
- </div>
- </div>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: layout-latest-js" />
- <script>
- // 页面加载完成后,发送AJAX请求获取配置数据
- var prefix = ctx + "cc/fsconf";
- $(function() {
- $.ajax({
- url: prefix + '/getAwsAsrConf',
- type: 'GET',
- success: function(_data) {
- // 假设后端返回的数据格式为 [{"aliasName":"xxx", "name":"xxx", "value":"xxx"},{}]
- var baseConfigsHtml = '';
- var data = _data.data;
- // 渲染基础配置
- $.each(data, function(index, config) {
- baseConfigsHtml += '<div className="row">';
- baseConfigsHtml += '<div class="col-sm-12">';
- baseConfigsHtml += '<label class="col-sm-2 control-label">' + config.aliasName + '</label><div class="col-sm-10"><input class="config-value form-control" type="text" id="' + config.name + '" value="' + config.value + '" /></div>';
- baseConfigsHtml += '</div>';
- baseConfigsHtml += '</div>';
- });
- $('#baseConfigs').html(baseConfigsHtml);
- },
- error: function(error) {
- console.error('Error fetching configuration:', error);
- }
- });
- });
- // 保存配置
- $('#saveConfig').click(function() {
- var configs = [];
- $('input.config-value').each(function() {
- var config = {
- name: $(this).attr('id'),
- value: $(this).val().trim()
- };
- configs.push(config);
- });
- $.ajax({
- url: prefix + '/setAwsAsrConf', // 假设后端保存配置的接口是 /setConfig
- type: 'POST',
- contentType: 'application/json',
- data: JSON.stringify(configs),
- beforeSend: function () {
- $.modal.loading(i18n("common.tip.loading"));
- $.modal.disable();
- },
- success: function(response) {
- processAjaxReponseJson(response);
- },
- error: function(error) {
- }
- });
- });
- </script>
- </body>
- </html>
|