You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
6.2 KiB
HTML

<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-add_chlid-form">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>管理中心></span><span>添加{$promoteTypeName}</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main">添加{$promoteTypeName}</span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('Promote/add')}" novalidate="novalidate" method="post" class="base_info" id="form_reg">
<table class="table2">
<tr>
<input type="hidden" name="promote_type" value="{:I('promote_type', 0)}">
<td class="l"><span class="req">*</span>小程序背景图:</td>
<td class="r">
<input id="images" name="img" type="hidden" value="">
<span id="img"><img src="" width="40%" height="40%"/></span>
<input type="file" id="imgFile"/>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>推广游戏名称:</td>
<td class="r">
<select name="base_game_id" class="select_gallery" id="game" style="width:220px;">
<option value="0">推广游戏名称</option>
<?php foreach($baseGames as $baseGame):?>
<option value="<?=$baseGame['id']?>"><?=$baseGame['name']?></option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="button" class="tj btn ajax-post add-submit" value="确认添加" title="" target-form="base_info" style="cursor: pointer;">
<a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<link href="__STATIC__/uploadifive/uploadifive.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__STATIC__/uploadifive/jquery.uploadifive.min.js"></script>
<script type="text/javascript">
$('#imgFile').uploadifive({
'fileObjName':'file',
'removeCompleted' : true,
'formData' : {},
'buttonText' : '上传',
'uploadScript' : '/index.php?s=/Qrcode/QrCodePromotion/uploadQrCodeBackground',
'multi' : false,
'onUploadComplete' : function(file, data) {
var res = eval('(' + data + ')');
var src = res.path;
$('#img').html('<img src=' + src + ' width="40%" height="40%"/>')
$('#images').val(res.path);
}
});
$('.add-submit').on({
click: function() {
var baseGameId = $("#game").val();
var img = $('#images').val();
var gameName = $('#game').find('option:selected').text();
if (!img) {
return layer.msg('背景图不能为空')
}
$.ajax({
url: '{:U("add")}',
type: 'post',
dataType: 'json',
data: { base_game_id: baseGameId, img: img, game_name: gameName, },
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.history.back();
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
$(".select_gallery").select2();
function validation(){
var json_data = "";
if($('#account').val()==""){
return json_data = {'status':0,'msg':'子渠道账号不能为空'}
}
// if($.trim($('#account').val()).length < 6){
// return json_data = {'status':0,'msg':'子渠道账号不能小于6位字符'}
// }
if($.trim($('#account').val()).length < 6 || $.trim($('#account').val()).length > 15){
return json_data = {'status':0,'msg':'子渠道账号长度为6-15位字符'}
}
if ($.trim($('#real_name').val()) != '') {
if($.trim($('#real_name').val()).length < 2 || $.trim($('#real_name').val()).length > 4){
return json_data = {'status':0,'msg':'子渠道姓名长度为2-4位字符'}
}
}
if($('#password').val()==""){
return json_data = {'status':0,'msg':'子渠道密码不能为空'}
}
if($.trim($('#password').val()).length < 6){
return json_data = {'status':0,'msg':'子渠道密码不能小于6位字符'}
}
if($('#repassword').val()==""){
return json_data = {'status':0,'msg':'确认密码不能为空'}
}
if($('#repassword').val()!==$('#password').val()){
return json_data = {'status':0,'msg':'子渠道密码和确认密码不一致'}
}
var promote_type = parseInt($('[name=promote_type]').val());
if ((promote_type == 0 || promote_type == 1) && $.trim($('#group_remark').val()) == '') {
if (promote_type == 0) {
return json_data = {'status':0,'msg':'请输入部门名称'}
}
if (promote_type == 1) {
return json_data = {'status':0,'msg':'请输入小组名称'}
}
}
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
// if(!myreg.test($('#mobile_phone').val())){
// return json_data = {'status':0,'msg':'请输入正确的手机号'}
// }
// var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
// if(!myreg.test($('#email').val())){
// return json_data = {'status':0,'msg':'请输入正确的邮箱'}
// }
// if($.trim($('#nickname').val()).length == 0){
// return json_data = {'status':0,'msg':'昵称不能为空'};
// }
return json_data = {'status':1,'msg':'成功'};
}
</script>
</block>