1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-26 01:04:06 +08:00
2019-04-16 09:43:32 +08:00

123 lines
5.3 KiB
Cheetah

{{define "head"}}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
{{range $index, $meta := option . "metas"}}
<meta name="{{index $meta "name"}}" content="{{index $meta "content"}}">
{{end}}
<title>{{options . "componet_name"}}</title>
<link rel="shortcut icon" type="image/ico" href="/static/librarys/{{options . "favicon"}}">
{{range $index, $lib := option . "styles"}}
<link rel="stylesheet" type="text/css" href="/static/librarys/{{$lib}}"></link>
{{end}}
</head>
<body>
<script>
var conf = {
toolkit_view: {{conf . "route" "toolkit_view"}},
bench_data: {{option . "bench_data"}},
}
</script>
<a href="baidumap://map/direction?region=&origin=&destination=&mode=driving">百度</a>
{{end}}
{{define "toolkit"}}
<fieldset class="{{options . "componet_view"}}" data-init="{{options . "componet_init"}}">
<div>{{options . "componet_name"}}({{options . "componet_help"}})</div>
</fieldset>
{{end}}
{{define "componet"}}
<fieldset class="{{options . "componet_view"}}" data-init="{{options . "componet_init"}}">
<legend title="{{options . "componet_help"}}">{{options . "componet_name"}}({{options . "componet_help"}})</legend>
{{$msg := .}}
<form class="option {{options . "componet_name"}}"
data-componet_group="{{options . "componet_group"}}"
data-componet_name="{{options . "componet_name"}}"
{{$form_type := options . "form_type"}} {{if eq $form_type "upload"}}
method="POST" action="/upload" enctype="multipart/form-data" target="_blank"
{{end}}>
<input style="display:none"></input>
{{range $index, $input := option . "inputs"}}
<div>{{$type := index $input "type"}} {{$value := index $input "value" | parse $msg}}
{{if index $input "label"}}
<label>{{index $input "label"}} : </label>
{{end}}
{{if eq $type "button"}}
<input type="button" value="{{$value}}">
{{else if eq $type "submit"}}
<input type="submit" value="{{$value}}">
{{else if eq $type "file"}}
<input type="file" name="{{index $input "name"}}">
{{else if eq $type "choice"}} {{$default_value := index $input "value"}}
<select name="{{index $input "name"}}">
{{range $index, $value := index $input "choice"}} {{$val := index $value "value"}}
{{if eq $default_value $val}}
<option value="{{index $value "value"}}" selected>{{index $value "name"}}</option>
{{else}}
<option value="{{index $value "value"}}">{{index $value "name"}}</option>
{{end}}
{{end}}
</select>
{{else if eq $type "password"}}
<input type="password" name="{{index $input "name"}}" value="{{$value}}" class="{{index $input "class"}}">
{{else if eq $type "textarea"}}
<textarea rows="{{index $input "rows"}}" cols="{{index $input "cols"}}"
name="{{index $input "name"}}" class="{{index $input "class"}}">{{$value}}</textarea>
{{else}}
<input name="{{index $input "name"}}" value="{{$value}}" class="{{index $input "class"}}">
{{end}}</div>
{{end}}
<hr/>
</form>
{{if index .Meta "display_append"}} {{options . "display_append"}} {{else}}
<table class="append {{options . "componet_name"}}"> {{$msg := .}}
<tr>{{range $field := append .}}<th>{{$field}}</th>{{end}}</tr>
{{range $line := table .}}
<tr>{{range $field := append $msg}}<td>{{index $line $field|unescape}}</td>{{end}}</tr>
{{end}}
</table>
{{end}}
{{if index .Meta "display_result"}} {{options . "display_result"}} {{else}}
<code class="result {{options . "componet_name"}}"><pre>{{result .Meta}}</pre></code>
{{end}}
{{if index .Meta "display_div"}} {{options . "display_div"}} {{else}}
<div class="result {{options . "componet_name"}}"></div>
{{end}}
</fieldset>
{{end}}
{{define "mp"}}
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="/static/librarys/wexin.js"></script>
<script>
{{$token := cmd . "context chat js_token"}}
wx.config({
debug: true,
appId: {{append $token "appid"|meta}},
timestamp: {{append $token "timestamp"|meta}},
nonceStr: {{append $token "nonce"|meta}},
signature: {{append $token "signature"|meta}},
jsApiList: [
"scanQRCode",
"chooseImage",
"closeWindow",
"openAddress",
],
})
wx.ready(function(){})
wx.error(function(res){})
</script>
{{end}}
{{define "tail"}}
{{range $index, $lib := option . "scripts"}}
<script src="/static/librarys/{{$lib}}"></script>
{{end}}
</body>
{{end}}