Browse Source

fix issue

pull/3437/head
zhoupzh 2 years ago
parent
commit
8edcd7d096
2 changed files with 20 additions and 17 deletions
  1. +4
    -2
      modules/templates/helper.go
  2. +16
    -15
      templates/custom/task_wait_count.tmpl

+ 4
- 2
modules/templates/helper.go View File

@@ -471,8 +471,10 @@ func Str2html(raw string) template.HTML {
func subOne(length int) int {
return length - 1
}
func addOne(length int64) int64 {
return length + 1
func addOne(i) int64 {
if i>=0 {
return i + 1
}
}
// Escape escapes a HTML string
func Escape(raw string) string {


+ 16
- 15
templates/custom/task_wait_count.tmpl View File

@@ -1,25 +1,26 @@
<div style="display:inline-block;">
<div style="display:flex;align-items:center;color:#f2711c;">
<i class="ri-error-warning-line" style="margin-right: 0.5rem; font-size: 14px"></i>
<span style="font-size: 12px">{{.i18n.Tr "repo.wait_count_start"}} <span class="__task_wait_count__">{{if .WaitCount}}{{addOne .WaitCount}}{{end}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
<span style="font-size: 12px">{{.i18n.Tr "repo.wait_count_start"}} <span class="__task_wait_count__">{{.WaitCount}}{{if and (.WaitCount) (ne .WaitCount 0) }}{{addOne .WaitCount}}{{end}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
</div>
</div>
<script>
;(function() {
var queuesDetail = {{.QueuesDetail}};
if (queuesDetail) {
function changeSpecs() {
var specsSelEl = $('select#__specs__');
var seldOption = specsSelEl.find('option:selected');
var queueCode = seldOption.attr('queueCode');
$('span.__task_wait_count__').text((queuesDetail[queueCode] || 0) +1);
};
$('body').on('change', 'select#__specs__', function(e) {
changeSpecs();
});
setTimeout(function() {
changeSpecs();
}, 50);
}
// if (queuesDetail) {
// function changeSpecs() {
// var specsSelEl = $('select#__specs__');
// var seldOption = specsSelEl.find('option:selected');
// var queueCode = seldOption.attr('queueCode');
// $('span.__task_wait_count__').text((queuesDetail[queueCode] || 0) +1);
// };
// $('body').on('change', 'select#__specs__', function(e) {
// changeSpecs();
// });
// setTimeout(function() {
// changeSpecs();
// }, 50);
// }
})();
</script>

Loading…
Cancel
Save