123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?php
- // 模板设置表单内容
- // 从 publish_setting.php 复制的模板设置部分
- // 获取应用信息
- $id = bees_decrypt(SafeRequest("id", "get"));
- $row = db("appid")->where("in_uid", $this->userid)->where("in_id", $id)->find();
- $row or exit(include_once dirname(__FILE__) . "/../pack/error/404.php");
- ?>
- <div class="download-template">
- <!-- 设置语言 -->
- <div class="form-group clearfix">
- <label class="control-label col-sm-1">设置语言</label>
- <div class="col-sm-10">
- <ul class="clearfix template-language radio-round">
- <li class="clearfix <?php if ($row["template_language"] == "zh") { ?>active<?php } ?>" data-language="zh">
- <span class="icon icon-radio <?php if ($row["template_language"] == "zh") { ?>icon-radio-checked <?php } ?>fl"></span>
- <span class="fl">简体中文</span>
- </li>
- <li class="clearfix <?php if ($row["template_language"] == "en") { ?>active<?php } ?>" data-language="en">
- <span class="icon icon-radio <?php if ($row["template_language"] == "en") { ?>icon-radio-checked <?php } ?>fl"></span>
- <span class="fl">English</span>
- </li>
- <li class="clearfix <?php if ($row["template_language"] == "zh-tw") { ?>active<?php } ?>" data-language="zh-tw">
- <span class="icon icon-radio <?php if ($row["template_language"] == "zh-tw") { ?>icon-radio-checked <?php } ?>fl"></span>
- <span class="fl">繁體中文</span>
- </li>
- <input type="hidden" name="template_language" value="<?php echo $row["template_language"]; ?>">
- </ul>
- </div>
- </div>
- <!-- 设置模板 -->
- <div class="form-group">
- <label class="control-label col-sm-1">设置模板</label>
- <div class="col-sm-10">
- <ul class="clearfix template-list">
- <?php
- foreach (range(1, 7) as $k => $v) {
- ?>
- <li class="<?php echo $row["template"] == $v ? "active" : ""; ?>">
- <div class="t-checked-wrap">
- <img src="/static/index/image/template-<?php echo $v; ?>.jpg" class="img-responsive">
- <div class="t-checked" style="<?php if ($row["template"] == $v) { ?>display: flex;<?php } ?>"></div>
- </div>
- <a style="display: none;" href="/index/template/<?php echo bees_encrypt($row["in_id"]); ?>/tmp<?php echo $v; ?>" target="_blank" class="text">预览</a>
- <input type="radio" name="template" value="<?php echo $v; ?>" <?php if ($row["template"] == $v) { ?>checked<?php } ?> class="hidden">
- </li>
- <?php
- }
- ?>
- </ul>
- </div>
- </div>
- <!-- 保存按钮 -->
- <div class="form-group clearfix">
- <input type="hidden" name="id" value="<?php echo bees_encrypt($row["in_id"]); ?>" />
- <label class="control-label col-sm-1"></label>
- <div class="col-sm-6">
- <button id="submitTemplateButton" type="button" class="btn-apps-save">
- 保存
- </button>
- </div>
- </div>
- </div>
- <!-- 成功提示模态框 -->
- <div class="modal fade ms-modal auto-hide-modal" id="msModalTemplateSetting" tabindex="-1" role="dialog" style="display: none;">
- <div class="modal-dialog modal-sm" role="document">
- <div class="modal-content">
- <div class="modal-body">
- <div class="text-center">
- <div class="auto-hide">
- <span class="icon icon-modal-success3"></span>
- <div class="mt5">
- 保存成功
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
- // 模板设置相关的JavaScript逻辑
- $(document).ready(function() {
- // 初始化单选按钮样式
- tab.radioRound({
- el: ".radio-round li",
- checkedClass: "icon-radio-checked"
- });
- // 下载模板选中
- $(".download-template ul li .t-checked-wrap").click(function() {
- var i = $(this).parent().index();
- $(".download-template ul li .t-checked-wrap").find(".t-checked").hide();
- $(this).find(".t-checked").css("display", "flex");
- $(".download-template ul li input[type=radio]").prop("checked", false);
- $(this).parent("li").find("input[type=radio]").prop("checked", true);
- });
- // 设置模板页语言
- $(".download-template .template-language li").click(function() {
- var val = $(this).data('language');
- $("input[name='template_language']").val(val);
- });
- // 保存按钮点击事件
- $('#submitTemplateButton').click(function() {
- // 创建临时表单进行提交,包含所有必要的参数
- var formData = {
- id: $('input[name="id"]').val(),
- // 保持基本设置字段的默认值
- app_name: '<?php echo addslashes($row["in_name"]); ?>',
- url: '<?php echo $row["in_link"]; ?>',
- // 保持高级设置字段的默认值
- show_guide: '<?php echo $row["in_tutorial"]; ?>',
- in_private: '<?php echo $row["in_private"]; ?>',
- in_use_auth_code: '<?php echo $row["in_use_auth_code"]; ?>',
- password: '<?php echo $row["in_apppwd"]; ?>',
- auth_code_dispense_url: '<?php echo $row["auth_code_dispense_url"]; ?>',
- in_captcha: '<?php echo $row["in_captcha"]; ?>',
- limit_num: '<?php echo $row["in_applimit"]; ?>',
- qq: '<?php echo $row["in_contact"]; ?>',
- appstore_url: '<?php echo $row["in_appstore"]; ?>',
- remark: '<?php echo $row["in_remark"]; ?>',
- app_intro: '<?php echo addslashes($row["in_appintro"]); ?>',
- // 模板设置字段
- template_language: $("input[name='template_language']").val(),
- template: $("input[name='template']:checked").val()
- };
-
- $.ajax({
- url: '/index/ajax_profile/edit',
- type: 'POST',
- data: formData,
- dataType: 'json',
- success: function(data) {
- if (data.code != 200) {
- alert(data.msg);
- } else {
- $("#msModalTemplateSetting").find(".modal-dialog").addClass("modal-sm").find(".auto-hide .mt5").text("保存成功");
- autoHideModal('#msModalTemplateSetting', 3000);
- }
- },
- error: function() {
- alert('保存失败,请重试');
- }
- });
- });
- });
- // 自动隐藏模态框函数
- function autoHideModal(obj1, time) {
- var autoHide = null;
- clearTimeout(autoHide);
- $(obj1).modal('show');
- $(".modal-backdrop").hide();
- autoHide = setTimeout(function() {
- $(obj1).modal("hide");
- }, time);
- }
- </script>
|