Skip to content

Commit a398399

Browse files
committed
显示左侧测试用例时隐藏请求代码
1 parent 8b625bb commit a398399

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

js/main.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
var handler
112112
var docObj
113113
var doc
114+
var output
114115

115116
var isSingle = true
116117

@@ -530,7 +531,8 @@
530531
//显示远程的测试用例文档
531532
showRemote: function (show) {
532533
App.isRemoteShow = show
533-
App.view = 'markdown'
534+
vOutput.value = show ? '' : (output || '')
535+
App.showDoc()
534536

535537
if (show && App.remotes.length <= 0) {
536538
App.isRemoteShow = false
@@ -554,15 +556,25 @@
554556

555557
if (rpObj != null && rpObj.code === 200) {
556558
App.isRemoteShow = true
557-
App.view = 'markdown' //貌似未生效,或者被后面的操作覆盖
558559
App.remotes = rpObj['Document[]']
560+
vOutput.value = show ? '' : (output || '')
561+
App.showDoc()
559562

560563
//App.onChange(false)
561564
}
562565
})
563566
}
564567
},
565568

569+
// 设置文档
570+
showDoc: function () {
571+
if (App.setDoc(doc) == false) {
572+
this.getDoc(function (d) {
573+
App.setDoc(d);
574+
});
575+
}
576+
},
577+
566578
saveCache: function (url, key, value) {
567579
var cache = this.getCache(url);
568580
cache[key] = value
@@ -687,15 +699,11 @@
687699

688700
vInput.value = before;
689701
vSend.disabled = false;
690-
vOutput.value = 'OK,请点击 [发送请求] 按钮来测试。' + code;
702+
output = 'OK,请点击 [发送请求] 按钮来测试。' + code;
703+
vOutput.value = output
691704

692705

693-
// 设置文档
694-
if (App.setDoc(doc) == false) {
695-
this.getDoc(function (d) {
696-
App.setDoc(d);
697-
});
698-
}
706+
App.showDoc()
699707

700708
} catch(e) {
701709
log(e)

0 commit comments

Comments
 (0)