| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!--<link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">-->
- <link href="../css/mui.min.css" rel="stylesheet" />
- <link rel="stylesheet" type="text/css" href="../css/iconfont.css" />
- <link href="../css/common.css" rel="stylesheet" />
- <style type="text/css">
- .headRightIcon:before {
- margin: 3px 0 -3px 0;
- }
- /*input*/
-
- .mui-table-view-cell input {
- line-height: 30px;
- width: 100%;
- height: inherit;
- margin-bottom: 0;
- padding: 0;
- -webkit-user-select: text;
- border: none;
- border-radius: none;
- outline: 0;
- background-color: #fff;
- -webkit-appearance: none;
- }
-
- input::-webkit-input-placeholder {
- color: #BEBEBE;
- }
-
- input::-moz-placeholder {
- /* Mozilla Firefox 19+ */
- color: #BEBEBE;
- }
-
- input:-moz-placeholder {
- /* Mozilla Firefox 4 to 18 */
- color: #BEBEBE;
- }
-
- input:-ms-input-placeholder {
- /* Internet Explorer 10-11 */
- color: #BEBEBE;
- }
- /*select*/
-
- .mui-input-row select {
- padding: 0;
- margin: 0;
- height: 30px;
- font-size: 17px;
- }
- /*btn*/
-
- .btnBox {
- margin: 15px;
- text-align: center;
- }
-
- .btnBox button {
- width: 60%;
- border-radius: 10px;
- line-height: 26px;
- font-size: 18px;
- letter-spacing: 5px;
- background: #21b2e7;
- color: #fff;
- }
- .nullData {
- top: 45px;
- }
- </style>
- </head>
- <body>
- <header class="mui-bar mui-bar-nav">
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
- <h1 class="mui-title">添加描述</h1>
- <a class="headRightIcon iconfont icon-worm mui-pull-right" id="categoryBtn">种类</a>
- </header>
- <div class="mui-content">
- <ul class="mui-table-view" id="user">
- <li class="mui-table-view-cell">
- <span class="equipTitle">害虫名称</span>
- <div class="mui-input-row mui-select">
- <select name="wormName" id="wormName">
- </select>
- </div>
- </li>
- <li class="mui-table-view-cell">
- <span class="equipTitle">数量</span>
- <p><input type="number" name="" placeholder="请输入数量" id="wormnum" value="" /></p>
- </li>
- <li class="mui-table-view-cell">
- <span class="equipTitle">作物种类</span>
- <p><input type="text" name="" placeholder="选填项" id="cropArea" value="" /></p>
- </li>
- <li class="mui-table-view-cell">
- <span class="equipTitle">虫害阶段</span>
- <p><input type="text" name="" placeholder="选填项" id="worstage" value="" /></p>
- </li>
- </ul>
- <div class="btnBox">
- <button class="" id="sendBtn">确定</button>
- </div>
- </div>
- <script src="../js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
- <script src="../js/mui.min.js"></script>
- <script src="../js/common.js"></script>
- <script type="text/javascript">
- var equipId;
- var addr;
- mui.init();
- window.addEventListener('refresh', function(e) { //执行刷新
- location.reload();
- });
- mui.plusReady(function() {
- var self = plus.webview.currentWebview();
- equipId = self.equipId;
- addr = self.addr;
- console.log(equipId);
- console.log(addr);
- mui.ajax('http://120.27.222.26/cbd_describe_img', {
- data: {
- req: 'pest_kind',
- addr: addr
- },
- dataType: 'json', //服务器返回json格式数据
- type: 'get', //HTTP请求类型
- timeout: 10000, //超时时间设置为10秒;
- success: function(data) {
- var html = '';
- if(data.length) {
- for(var i = 0; i < data.length; i++) {
- html += '<option value="' + data[i].pest_name + '">' + data[i].pest_name + '</option>'
- }
- $('#wormName').html(html);
- } else {
- html = '<option value="0">请添加种类</option>'
- $('#wormName').html(html);
- }
- },
- error: function(xhr, type, errorThrown) {
- console.log(type)
- mui('.mui-content')[0].appendChild(netStyle('../images/netBlocked.png'));
- }
- });
- //保存害虫详情
- document.getElementById('sendBtn').addEventListener('tap', function() {
- var describe = {
- "pest_name":document.getElementById('wormName').value,
- "crop_name":document.getElementById('cropArea').value,
- "pest_num":document.getElementById('wormnum').value,
- "pest_case":document.getElementById('worstage').value
- }
- mui.ajax('http://120.27.222.26/cbd_describe_img', {
- data: {
- req: 'add_save',
- addr: addr,
- describe: JSON.stringify(describe)
- },
- dataType: 'json', //服务器返回json格式数据
- type: 'post', //HTTP请求类型
- timeout: 10000, //超时时间设置为10秒;
- success: function(data) {
- console.log(data)
- if(data == 0){
- mui.alert("数据保存成功","添加描述","确定",function () {
- mui.back();
- });
- }else if(data == 1){
- mui.alert("添加描述失败!","提示");
- }else if(data == 2){
- mui.alert("该害虫描述已存在!","提示");
- }
-
- },
- error: function(xhr, type, errorThrown) {
- console.log(type)
- }
- });
- })
- //添加害虫种类
- document.getElementById('categoryBtn').addEventListener('tap', function() {
- mui.openWindow({
- url: 'addwormCategory.html',
- id: 'addwormCategory',
- extras: {
- equipId: equipId,
- addr: addr
- }
- })
- })
- })
- </script>
- </body>
- </html>
|