123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- {include file="public/layout" /}
- <body class="bodystyle">
- <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div class="page">
- <div class="fixed-bar">
- <div class="item-title"><a class="back" href="{:url("Weapp/index")}" title="返回列表"><i class="fa fa-chevron-left"></i></a>
- <div class="subject">
- <h3>插件应用</h3>
- <h5></h5>
- </div>
- <ul class="tab-base nc-row">
- {eq name="$Think.const.CONTROLLER_NAME.'@create'|is_check_access" value="1"}
- <li><a href="{:url("Weapp/create")}" class="tab {if condition="in_array($Request.action, array('create'))"}current{/if}"><span>创建插件</span></a></li>
- {/eq}
- {eq name="$Think.const.CONTROLLER_NAME.'@pack'|is_check_access" value="1"}
- <li><a href="{:url("Weapp/pack")}" class="tab {if condition="in_array($Request.action, array('pack'))"}current{/if}"><span>打包插件</span></a></li>
- {/eq}
- </ul>
- </div>
- </div>
- <form class="form-horizontal" id="post_form" action="{:url('Weapp/create')}" method="post">
- <div class="ncap-form-default">
- <dl class="row">
- <dt class="tit">
- <label for="code"><em>*</em>插件标识</label>
- </dt>
- <dd class="opt">
- <input type="text" name="code" placeholder="比如:Demo" id="code" class="input-txt">
- <span class="err"></span>
- <p class="notic"></p>
- <p class="">易优插件库中唯一的标识,首字母必须大写,只支持大小字母与数字。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="name"><em>*</em>插件名称</label>
- </dt>
- <dd class="opt">
- <input type="text" name="name" value="" id="name" class="input-txt">
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="version">插件版本号</label>
- </dt>
- <dd class="opt">
- v1.0.0
- <input type="hidden" name="version" value="v1.0.0" id="version" class="input-txt">
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="min_version">CMS版本号</label>
- </dt>
- <dd class="opt">
- {$min_version|default='v1.1.6'}
- <input type="hidden" name="min_version" value="{$min_version|default='v1.1.6'}" id="min_version" class="input-txt">
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="author"><em>*</em>开发者</label>
- </dt>
- <dd class="opt">
- <input type="text" name="author" value="" id="author" class="input-txt">
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="scene"><em>*</em>应用场景</label>
- </dt>
- <dd class="opt">
- <label><input type="radio" value="0" name="scene" checked="checked" />手机端+PC端</label>
- <label><input type="radio" value="1" name="scene" />手机端</label>
- <label><input type="radio" value="2" name="scene" />PC端</label>
- <p class="">在哪种场景展现,不指定的场景调用插件无效。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="description"><em>*</em>插件描述</label>
- </dt>
- <dd class="opt">
- <textarea rows="5" cols="80" id="description" name="description" style="height:80px;" placeholder=""></textarea>
- <p class="notic"></p>
- </dd>
- </dl>
- <div class="bot"><a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">初始化结构</a></div>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- /**
- * 插件标识格式判断
- * @param str
- */
- function checkCode(str){
- var reg = /^[A-Z]([a-zA-Z0-9]*)$/;
- if(reg.test(str)){
- return true;
- }else{
- return false;
- }
- }
- /**
- * 版本号格式判断
- * @param str
- */
- function checkVersion(str){
- var reg = /^v\d+\.\d+\.\d+([0-9\.]*)$/i;
- if(reg.test(str)){
- return true;
- }else{
- return false;
- }
- }
- /**
- * 插件标识验证
- * @param str
- */
- function ajax_check_code()
- {
- var flag = false;
- var code = $.trim($('input[name=code]').val());
- var reg = /(^[a-zA-Z0-9]{1,}$)/;
- if (!reg.test(code)) {
- showErrorMsg('插件标识格式不正确!');
- $('input[name=code]').focus();
- return false;
- }
- if ('Sample' == code) {
- showErrorMsg('插件标识已被占用!');
- $('input[name=code]').focus();
- return false;
- }
- $.ajax({
- url: "{:url('Weapp/ajax_check_code', ['_ajax'=>1])}",
- type: 'GET',
- async: false,
- dataType: 'JSON',
- data: {code: code},
- success: function(res){
- console.log(res)
- if(res.code == 1){
- flag = true;
- } else {
- showErrorMsg(res.msg);
- $('input[name=code]').focus();
- }
- },
- error: function(e){}
- });
- return flag;
- }
- // 判断输入框是否为空
- function checkForm(){
- if(!checkCode($('input[name=code]').val())){
- showErrorMsg('插件标识格式不正确!');
- $('input[name=code]').focus();
- return false;
- }
- if(!ajax_check_code())
- {
- return false;
- }
- if($('input[name=name]').val() == ''){
- showErrorMsg('插件名称不能为空!');
- $('input[name=name]').focus();
- return false;
- }
- if(!checkVersion($('input[name=version]').val())){
- showErrorMsg('插件版本号格式不正确!');
- $('input[name=version]').focus();
- return false;
- }
- if(!checkVersion($('input[name=min_version]').val())){
- showErrorMsg('CMS最低版本号格式不正确!');
- $('input[name=min_version]').focus();
- return false;
- }
- if($('input[name=author]').val() == ''){
- showErrorMsg('开发者不能为空!');
- $('input[name=author]').focus();
- return false;
- }
- if($('input[name=scene]').val() == ''){
- showErrorMsg('应用场景不能为空!');
- $('input[name=scene]').focus();
- return false;
- }
- if($('#description').val() == ''){
- showErrorMsg('插件名称不能为空!');
- $('#description').focus();
- return false;
- }
- layer_loading('正在处理');
- $('#post_form').submit();
- }
- </script>
- {include file="public/footer" /}
|