problem description
ask for advice in this code, when you choose the solution to join, you can choose to add the real and join the test. I think the real and the test code are the same. I would like to ask how to judge and execute the real and the test. Novice learning, please give more advice! Thank you
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
/ scenario list container /
! function () {
//
var sel;
//
window.PPlanList = function(){
var self = this;
//dom
this.extend("dom-module",
<div class="plan-list">
<div class="left">
<a onclick={function(){
self.load();
}}><i class="if icon-f14"></i></a>
<div lid="left"></div>
</div>
<div lid="right" class="right">
<div class="pl-btn">
<div class="pl-config">
<div>
<input type="checkbox" lid="check-allw" />
<a><input lid="val-allw" type="number" min="0" step="100" value="1000" /></a>
</div>
<div>
<input type="checkbox" lid="check-alll" />
<a><input lid="val-alll" type="number" min="0" step="100" value="1000" /></a>
</div>
</div>
<select lid="sel">
<option value="1"> A </option>
<option value="2"> B </option>
<option value="3"> C </option>
<option value="6"> D </option>
<option value="7"> E </option>
<option value="36"> I</option>
<option value="37"> J</option>
<option value="52"> TB1</option>
<option value="53"> TB2</option>
</select>
<div>
<a class="btn" onclick={function(){
if(!sel)
return alert("!");
Msg.send("base.bet-create",{
user:localStorage["user"],
username:localStorage["username"],
plan:sel.data.id,
planname:sel.data.name,
tabel:self.ids["sel"].value
},function(res){
var obj = {};
for(var i in configs)
if(self.ids["check-"+configs[i]].checked)
obj[configs[i]] = self.ids["val-"+configs[i]].value;
GPlan.addPlan({code:sel.data.code,name:sel.data.name,id:res.insertId},self.ids["sel"].value,obj);
alert("!");
});
}}></a>
<a class="btn" onclick={function(){
if(!sel)
return alert("!");
Msg.send("base.bet-create",{
user:localStorage["user"],
username:localStorage["username"],
plan:sel.data.id,
planname:sel.data.name,
tabel:self.ids["sel"].value
},function(res){
var obj = {};
for(var i in configs)
if(self.ids["check-"+configs[i]].checked)
obj[configs[i]] = self.ids["val-"+configs[i]].value;
GPlan.addPlan({code:sel.data.code,name:sel.data.name,id:res.insertId},self.ids["sel"].value,obj,true);
alert("!");
});
}}></a>
</div>
</div>
</div>
</div>);
//
var configs = ["allw","alll"];
//
this.load = function(){
self.ids["left"].innerText = "";
sel = null;
Msg.send("base.plan-query",{},function(res){
for(var i in res)
self.ids["left"].appendChild(lcg.create(Item,res[i]));
});
}
//
this.load();
}
//
var Item = function(d){
var self = this;
this.data = d;
//dom
this.extend("dom-module",
<div>{d.name}</div>);
this._proxy.onclick = function(){
if(sel)
sel._proxy.className = "";
sel = self;
self._proxy.className = "sel";
}
}
} ();