feat(t226): add Go ERP session login
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
{{define "erp-connection"}}
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>{{.Page.Title}} - 采购任务管理</title>
|
||||
{{template "document-head" .}}
|
||||
</head>
|
||||
<body>
|
||||
{{template "site-header" .}}
|
||||
<main id="main-content" class="page narrow-page">
|
||||
<div class="title-row">
|
||||
<div>
|
||||
<h1>ERP 连接</h1>
|
||||
<p class="subtitle">建立本次服务进程内的顺运宝会话</p>
|
||||
</div>
|
||||
<a class="button" href="/freight/import">返回导入</a>
|
||||
</div>
|
||||
{{if .Error}}<div class="notice danger" role="alert">{{.Error}}</div>{{end}}
|
||||
{{if .Notice}}<div class="notice success" role="status">{{.Notice}}</div>{{end}}
|
||||
{{if .Status.Authenticated}}
|
||||
<section class="detail-section" aria-labelledby="erp-connected-title">
|
||||
<h2 id="erp-connected-title">已连接</h2>
|
||||
<p>当前后端进程持有受控 ERP 会话。重启后需要重新获取验证码登录。</p>
|
||||
</section>
|
||||
{{else if not .Status.Configured}}
|
||||
<section class="detail-section" aria-labelledby="erp-config-title">
|
||||
<h2 id="erp-config-title">尚未配置</h2>
|
||||
<p>请在后端启动环境中配置顺运宝账号和密码后重启服务。</p>
|
||||
</section>
|
||||
{{else if .Status.CaptchaReady}}
|
||||
<section class="detail-section" aria-labelledby="erp-captcha-title">
|
||||
<h2 id="erp-captcha-title">输入验证码</h2>
|
||||
<img class="erp-captcha-image" src="/erp/captcha/{{pathPart .Status.CaptchaTicket}}"
|
||||
alt="ERP 验证码" width="180" height="64">
|
||||
<form class="form-panel compact-form" method="post" action="/erp/login" data-loading-form>
|
||||
<input type="hidden" name="csrf_token" value="{{.Page.CSRFToken}}">
|
||||
<input type="hidden" name="captcha_ticket" value="{{.Status.CaptchaTicket}}">
|
||||
<div class="field">
|
||||
<label for="captcha-code">验证码</label>
|
||||
<input id="captcha-code" name="captcha_code" maxlength="64" autocomplete="one-time-code" required>
|
||||
</div>
|
||||
<button class="button primary" type="submit" data-loading-label="正在登录…">登录 ERP</button>
|
||||
</form>
|
||||
</section>
|
||||
{{else}}
|
||||
<form class="form-panel" method="post" action="/erp/captcha" data-loading-form>
|
||||
<input type="hidden" name="csrf_token" value="{{.Page.CSRFToken}}">
|
||||
<h2>获取验证码</h2>
|
||||
<p class="secondary">验证码一次有效,仅用于当前后端进程中的 ERP 会话。</p>
|
||||
<button class="button primary" type="submit" data-loading-label="正在获取…">获取验证码</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
@@ -18,6 +18,7 @@
|
||||
<a href="/tasks" {{if .Page.TasksCurrent}}aria-current="page"{{end}}>任务列表</a>
|
||||
<a href="/tasks/new" {{if .Page.NewCurrent}}aria-current="page"{{end}}>新建任务</a>
|
||||
<a href="/freight" {{if .Page.FreightCurrent}}aria-current="page"{{end}}>ERP 货运</a>
|
||||
<a href="/erp" {{if .Page.ERPCurrent}}aria-current="page"{{end}}>ERP 连接</a>
|
||||
</nav>
|
||||
{{if .Page.CSRFToken}}
|
||||
<form class="logout-form" method="post" action="/logout">
|
||||
|
||||
Reference in New Issue
Block a user