平台规则样式优化

master
sunke 5 years ago
parent ec309c2b6a
commit 1fe794b597

@ -965,8 +965,12 @@ class ArticleController extends AdminController {
$file_name = $savePath.$name; $file_name = $savePath.$name;
$error=$upfile["error"];//上传后系统返回的值 $error=$upfile["error"];//上传后系统返回的值
$data['document_route'] = 'Documents/'.$name; $data['document_route'] = 'Documents/'.$name;
M('document_pop_rules')->where(['id' => $id])->save($data); $updateres = M('document_pop_rules')->where(['id' => $id])->save($data);
$backData['tmp'] = $file_name; if ($updateres) {
$backData['code'] = 10000;
}else {
$backData['code'] = 10001;
}
$this->ajaxReturn(json_encode($backData,TRUE)); $this->ajaxReturn(json_encode($backData,TRUE));
} }
} }

@ -27,7 +27,8 @@
<label>上传文档</label> <label>上传文档</label>
<input type="file" name="upfile" id="file_doc" style="width:200px"/> <input type="file" name="upfile" id="file_doc" style="width:200px"/>
<input type="button" onclick="suba({$rule['id']})" style="background: #3E96C9;color:white;border:none;outline: none;width:70px;height:30px;border-radius: 3px;" value="上传" /> <input type="button" onclick="suba({$rule['id']})" style="background: #3E96C9;color:white;border:none;outline: none;width:70px;height:30px;border-radius: 3px;" value="上传" />
<span class="notice-text" id="uploadstatus" style="color:red;margin-left:10px;display: none;">上传成功</span>
<span class="notice-text" id="uploadstatus1" style="color:red;margin-left:10px;display: none;">上传失败</span>
</li> </li>
<li> <li>
@ -96,7 +97,15 @@
processData : false, // 使数据不做处理 processData : false, // 使数据不做处理
contentType : false, // 不要设置Content-Type请求头 contentType : false, // 不要设置Content-Type请求头
success:function(res) { success:function(res) {
// console.log(res) res = JSON.parse(res)
if (res.code == 10000) {
document.getElementById('uploadstatus').style.display = 'block'
document.getElementById('uploadstatus1').style.display = 'none'
}else {
document.getElementById('uploadstatus1').style.display = 'block'
document.getElementById('uploadstatus').style.display = 'none'
}
} }
}) })
} }

Loading…
Cancel
Save