Browse Source

设备类型为空请选择判定

whj 4 years ago
parent
commit
32d61de347
1 changed files with 20 additions and 8 deletions
  1. 20 8
      public/testweb/upgrade.html

+ 20 - 8
public/testweb/upgrade.html

xqd xqd xqd xqd xqd xqd
@@ -46,8 +46,11 @@
 <body>
     <div id="main">
         <div class="container" v-if="isInstall">
-            <div v-for="(item,index) in list" style="font-size: .5rem;margin-top: .3rem;" @click="tapvalue(item)">
-                {{item}}
+            <div v-if="list.length!=0">
+                <div v-for="(item,index) in list" :key="index" style="font-size: .5rem;margin-top: .3rem;"
+                    @click="tapvalue(item)">
+                    {{item}}
+                </div>
             </div>
             <input class="inputstyle" type="text" v-model="value" placeholder="请输入你需要升级的设备IMEI号码">
             <button class="btnstyle" @click="installbtn">点击搜索</button>
@@ -55,12 +58,16 @@
         <div v-if="isshezhi" style="margin-top: 1rem; text-align: center">
             <h1 style="font-size: 0.7rem;text-align: center">绿色地球</h1>
             <input type="text" class="inputstyle" disabled v-model="value" placeholder="">
-            <div v-for="(item,index) in phonedata" style="font-size: .5rem;margin-top: .3rem;" @click="tapphone(item)">
-                {{item}}
+            <div v-if="phonedata.length!=0">
+                <div v-for="(item,index) in phonedata" :key="index" style="font-size: .5rem;margin-top: .3rem;"
+                    @click="tapphone(item)">
+                    {{item}}
+                </div>
             </div>
             <input type="text" class="inputstyle" v-model="phone" placeholder="请输入DTU绑定手机卡号">
             <br />
             <select class="inputstyle" v-model="typevalue" @change="changeProduct($event)">
+                <option value="0">请选择</option>
                 <option value="1">四箱</option>
                 <option value="2">五箱</option>
                 <option value="3">四箱可回收</option>
@@ -111,7 +118,7 @@
                 isnew: "",
                 Numarr: [],
                 list: [],
-                typevalue: "1",
+                typevalue: "",
                 phone: "",
                 type: 1,
                 isbox: false,
@@ -148,7 +155,7 @@
             },
             methods: {
                 shezhi() {
-                    if (this.phone != "") {
+                    if (this.phone != "" && this.typevalue != "0") {
                         if (confirm("请再次确定选择的手机号和箱体类型选择正确,提交后不可变更")) {
                             axios.get("/updateDevice?id=" + this.value + "&type=" + this.type + "&phone=" + this.phone).then(res => {
                                 console.log(res)
@@ -160,7 +167,7 @@
                             })
                         }
                     } else {
-                        alert("请输入手机号")
+                        alert("请填写完整")
                     }
                 },
                 changeProduct(e) {
@@ -227,13 +234,18 @@
                                     this.isxian = res.data.data.status
                                     this.versionNum = res.data.data.version
                                     this.isnew = res.data.data.is_last
-                                } else if (res.data.data.phone == null && res.data.data.device_type == null && res.data.data.is_last == 0) {
+                                    this.typevalue = res.data.data.device_type
+                                } else if (res.data.data.phone == null && res.data.data.device_type == null || res.data.data.is_last != 0) {
                                     this.isInstall = false
                                     this.isshezhi = true
                                     this.equipment = res.data.data.id
                                     this.isxian = res.data.data.status
                                     this.versionNum = res.data.data.version
                                     this.isnew = res.data.data.is_last
+                                    this.typevalue = res.data.data.device_type
+                                    if (this.typevalue == null) {
+                                        this.typevalue = "0"
+                                    }
                                 } else {
                                     alert('当前设备已是最新版本,已有箱体和已绑定手机号无需设置升级')
                                 }