mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-22 18:35:35 +08:00
461 lines
15 KiB
HTML
461 lines
15 KiB
HTML
<!--
|
||
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
||
|
||
Licensed under the Apache License, Version 2.0 (the "License");
|
||
you may not use this file except in compliance with the License.
|
||
You may obtain a copy of the License at
|
||
|
||
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
||
Unless required by applicable law or agreed to in writing, software
|
||
distributed under the License is distributed on an "AS IS" BASIS,
|
||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
See the License for the specific language governing permissions and
|
||
limitations under the License.
|
||
-->
|
||
|
||
<!DOCTYPE html
|
||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>
|
||
<{$conf.installer.title}>
|
||
</title>
|
||
<{css src="framework.css" }>
|
||
<{css src="installer.css" }>
|
||
<style><{$conf.installer.style}></style>
|
||
<style>
|
||
html, body {
|
||
background-image: url('%BASE_URL%/app/desktop/statics/perfect/login-bg.jpg');
|
||
background-size: cover;
|
||
background-position: center;
|
||
background-repeat: no-repeat;
|
||
background-attachment: fixed;
|
||
}
|
||
</style>
|
||
<{script src="moo.js" }>
|
||
<{script src="taskRunner.js" }>
|
||
<script>
|
||
_open = function (url, options) {
|
||
options = $extend({
|
||
width: window.getSize().x * 0.8,
|
||
height: window.getSize().y * 0.8
|
||
}, options || {})
|
||
var params = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width={width},height={height}';
|
||
params = params.substitute(options);
|
||
|
||
window.open(url || 'about:blank', '_blank', params);
|
||
|
||
};
|
||
Element.implement({
|
||
isDisplay: function () { return true; }
|
||
});
|
||
var validateMap = new Hash({
|
||
'required': ['本项必填', function (element, v) {
|
||
return v != null && v != '' && v.trim() != '';
|
||
}],
|
||
'number': ['请录入数值', function (element, v) {
|
||
return v == null || v == '' || !isNaN(v) && !/^\s+$/.test(v);
|
||
}],
|
||
'samePas': ['两次密码输入不一致', function (element, v) {
|
||
var parEl = element.getParent(".tableform").getElements("input")[1];
|
||
return parEl.value === v;
|
||
}]
|
||
});
|
||
</script>
|
||
</head>
|
||
|
||
<body>
|
||
<div class="container">
|
||
<div class="logo">
|
||
<div class="banner install_title">
|
||
<{$conf.installer.banner}>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="container-all">
|
||
<div class="installer-main clearfix" id="installer-body">
|
||
<form id="installer_check_form" action="" method="post">
|
||
<{if $serverinfo}>
|
||
<div class="installer-info">
|
||
<div class="right-mainx">
|
||
<div class="right-main-info">
|
||
<input type="hidden" name="dfd" value="dfd" />
|
||
<{foreach from=$serverinfo.data item=group key=name}>
|
||
<div class="installer-detection">
|
||
<div class="installer-detection-title">
|
||
<h4>
|
||
<{$name}>
|
||
</h4>
|
||
</div>
|
||
<table class="tableform">
|
||
<{foreach from=$group.items item=item key=key}>
|
||
<tr>
|
||
<th>
|
||
<{$key}>
|
||
</th>
|
||
<td><span
|
||
class="installer-detection-success <{if $item.result==0}>installer-detection-failure<{/if}>">
|
||
<{$item.value}>
|
||
</span></td>
|
||
</tr>
|
||
<{ /foreach}>
|
||
</table>
|
||
</div>
|
||
<{/foreach}>
|
||
</div>
|
||
<div class="right-main-btn">
|
||
<input type="button" class="taskstepbutton-start taskstepbutton-detection"
|
||
onclick="document.getElementById('installer_check_form').submit();"
|
||
value="<{t}>重新检测<{/t}>" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<{else}>
|
||
<div class="installer-steps">
|
||
<div class="installer-steps-main">
|
||
<ul>
|
||
<li class="step-installing1">
|
||
<em>1</em>
|
||
<span><{t}>软件协议<{ /t}></span>
|
||
</li>
|
||
<li class="installer-step2">
|
||
<em>2</em>
|
||
<span><{t}>信息配置<{ /t}></span>
|
||
</li>
|
||
<li class="installer-step3">
|
||
<em>3</em>
|
||
<span><{t}>安装软件包<{ /t}></span>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="installer-info">
|
||
<div class="right-mainx complete">
|
||
<div class="right-main-info ">
|
||
<div class="info-license">
|
||
<{if file_exists($conf.licence.file) }>
|
||
<textarea class='license'><{$conf.licence.file|file_get_contents}></textarea>
|
||
<{else}>
|
||
<textarea class="license">
|
||
|
||
</textarea>
|
||
<{ /if}>
|
||
</div>
|
||
</div>
|
||
<div class="right-main-btn"> <input type="button"
|
||
class="taskstepbutton taskstepbutton_out taskstepbutton_move"
|
||
value="<{t}>同意协议进入下一步<{/t}>" /> </div>
|
||
</div>
|
||
|
||
<div class="right-mainx" style="display:none">
|
||
<div class="right-main-info">
|
||
<div class="info-license" id="taskconfig">
|
||
<{foreach from=$install_options item=group key=app_id}>
|
||
<h4>
|
||
<{$apps[$app_id].name}>
|
||
</h4>
|
||
<table class="tableform">
|
||
<{foreach from=$group item=item key=key}>
|
||
<tr>
|
||
<th>
|
||
<{if $item['required']==true}>
|
||
<em style="padding-right:4px"><font color="red">*</font></em>
|
||
<{/if}>
|
||
<label><{$item.title}></label>
|
||
</th>
|
||
<td>
|
||
<{input params=$item class="tasks_ipt"
|
||
name="options[{$app_id}][{$key}]" }>
|
||
<font color='red'><{$item.desc}></font>
|
||
</td>
|
||
</tr>
|
||
<{/foreach}>
|
||
</table>
|
||
<{/foreach}>
|
||
</div>
|
||
<div class="info-license" id="taskdemodata">
|
||
<{foreach from=$install_demodata_options item=demo_item key=key}>
|
||
<h4>
|
||
<{$demo_item.name}>
|
||
</h4>
|
||
<table class="tableform">
|
||
<tr>
|
||
<th>
|
||
<{if $demo_item['required']==true}>
|
||
<em style="padding-right:4px"><font color="red">*</font></em>
|
||
<{/if}>
|
||
<label><{$demo_item.title}></label>
|
||
</th>
|
||
<td>
|
||
<{input params=$demo_item class="tasks_ipt"
|
||
name="options[{$key}][{$key}]" }>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<{/foreach}>
|
||
</div>
|
||
</div>
|
||
<div class="right-main-btn">
|
||
<a class="step-back" href="" onClick="Cookie.dispose('setup_Step')">上一步</a>
|
||
<input type="button"
|
||
class="taskstepbutton-start taskstepbutton-startin tasks_start"
|
||
id="task_install" value="<{t}>开始安装软件<{/t}>" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="right-mainx" style="display:none">
|
||
<div class="console_handle">
|
||
<span class="flt" style="color:#333; margin-left:10px;">
|
||
<{t}>系统正在安装...<{ /t}>
|
||
</span>
|
||
</div>
|
||
<div class="clear loadpart">
|
||
<div class="loader"><strong class="appNum"></strong></div>
|
||
</div>
|
||
<div class="btnbox">
|
||
<span style="margin-left:10px">
|
||
<{t}>app名称:<{ /t}><span class="appName"></span>
|
||
</span>
|
||
<span class="lnk" onclick="$('setupinfo').toggleClass('hide');">
|
||
<{t}>安装细节<{ /t}>»
|
||
</span>
|
||
</div>
|
||
|
||
<div class="right-main-info hide" id="setupinfo">
|
||
<{foreach from=$apps item=app key="app_id" }>
|
||
<div class="clearfix boxx item package" appname="<{$app.name}>" action="<{link ctl='default' act='install_app'}>?app=<{$app_id}>">
|
||
<div class="span-3 name">
|
||
<strong>
|
||
<{$app.name}>
|
||
</strong>
|
||
</div>
|
||
<{if $app.version}>
|
||
<div class="version">
|
||
<sup>
|
||
<{$app.version}>
|
||
</sup>
|
||
</div>
|
||
<{/if}>
|
||
<div class="span-auto desc">
|
||
<{$app.description}>
|
||
</div>
|
||
</div>
|
||
<{/foreach}>
|
||
|
||
<{if $demodata.install == "true" }>
|
||
<div id="setupinfo_demodata" class="clearfix boxx item package"
|
||
appname="<{$demodata.name}>" action="<{link ctl='default' act='install_demodata' }>">
|
||
<div class="span-3 name">
|
||
<strong>
|
||
<{$demodata.name}>
|
||
</strong>
|
||
</div>
|
||
<div class="span-auto desc">
|
||
<{$demodata.description}>
|
||
</div>
|
||
</div>
|
||
<{/if}>
|
||
<span class="lnk frt" style="padding:4px 0 0 0;"
|
||
onclick="_open('?console=true');">
|
||
<{t}>打开安装控制台<{/t}>»
|
||
</span>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
<{/if}>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="login-footer">
|
||
<div class="login-footer-text">
|
||
Powered by
|
||
<a href="https://shopex.cn" target="_blank"><img src="%BASE_URL%/app/desktop/statics/mini-logo.png" alt="oneX OMS Logo" /></a>
|
||
</div>
|
||
</div>
|
||
<iframe name="console-frame" id="console-frame" style="display:none" src="about:blank" tabindex='-1'></iframe>
|
||
</div>
|
||
<script>
|
||
window.addEvent('domready', function () {
|
||
var main = $('installer-body'), item = $ES('.right-mainx'),
|
||
item_tip = $ES('.installer-steps-main li'),
|
||
tasks_setup = {
|
||
tasks_start: function () {
|
||
var result = validate($('taskconfig'), 'div');
|
||
if (!result) return;
|
||
item[1].addClass('complete');
|
||
},
|
||
recovery: function (currentStep) {
|
||
// currentStep 从 Cookie 读取,值为 2 或 3(表示当前步骤索引+1)
|
||
var stepIndex = currentStep - 1; // 转换为数组索引(0, 1, 2)
|
||
|
||
item_tip.each(function (tip, i) {
|
||
if (i < stepIndex) {
|
||
// 之前的步骤标记为已完成
|
||
tip.className = 'step-installed' + (i + 1);
|
||
} else if (i == stepIndex) {
|
||
// 当前步骤标记为进行中
|
||
tip.className = 'step-installing' + (i + 1);
|
||
} else {
|
||
// 之后的步骤标记为未开始
|
||
tip.className = 'installer-step' + (i + 1);
|
||
}
|
||
|
||
// 显示当前步骤的内容,隐藏其他步骤
|
||
item[i].style.display = (i == stepIndex) ? '' : 'none';
|
||
if (i < stepIndex) {
|
||
item[i].addClass('complete');
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
// 检查当前页面是否是 process 页面
|
||
var isProcessPage = window.location.href.indexOf('process') !== -1;
|
||
|
||
// 如果是 process 页面,清除 cookie,不恢复状态
|
||
if (isProcessPage) {
|
||
Cookie.dispose('setup_Step');
|
||
} else {
|
||
// 非 process 页面才恢复状态
|
||
var step = Cookie.read('setup_Step');
|
||
if (step && step != 1) {
|
||
tasks_setup.recovery(parseInt(step));
|
||
}
|
||
}
|
||
|
||
var installer = new Object();
|
||
setuptools = {
|
||
init: function () {
|
||
var tasks = [];
|
||
$$('.boxx').each(function (el) { if (!el.hasClass('disabled')) tasks.push(el.get('action')) });
|
||
|
||
installer = new TaskRunner(tasks, {
|
||
iframe: $('console-frame'),
|
||
container: main,
|
||
onError: function (text) {
|
||
var currentStep = parseInt(Cookie.read('setup_Step'), 10) || 3; // 安装阶段默认在第3步
|
||
var targetStep = Math.max(1, currentStep - 1); // 回退到上一步(至少为第1步)
|
||
Cookie.dispose('setup_Step');
|
||
text += '\n是否返回上一步?';
|
||
if (window.confirm(text)) {
|
||
Cookie.write('setup_Step', targetStep);
|
||
tasks_setup.recovery(targetStep);
|
||
}
|
||
|
||
},
|
||
onLoader: function () {
|
||
|
||
var num = this.step / this.num * 100;
|
||
this.showStep.set('text', num.toInt() + '%');
|
||
this.showStep.getParent().setStyle('width', num + '%');
|
||
},
|
||
onSuccess: function () {
|
||
Cookie.dispose('setup_Step');
|
||
location.href = '<{$success_page}>';
|
||
}
|
||
});
|
||
},
|
||
check: function (app, method, e) {
|
||
var option = {
|
||
onComplete: function (json) {
|
||
if (json.error) alert('error');
|
||
}
|
||
};
|
||
this.request('setuptools?app=' + app + '&method=' + method, option);
|
||
},
|
||
getdata: function (app, method, e) {
|
||
var el = $(e);
|
||
var option = {
|
||
onComplete: function (json) {
|
||
var selected = el.getSelected().value ? el.getSelected().value : el.get('default');
|
||
|
||
el.empty();
|
||
var fdoc = document.createDocumentFragment();
|
||
$H(json).each(function (k, v) {
|
||
if (k == selected) {
|
||
var option_el = { 'value': k, 'text': v, 'selected': true };
|
||
} else {
|
||
var option_el = { 'value': k, 'text': v };
|
||
}
|
||
fdoc.appendChild(new Element('option', option_el));
|
||
});
|
||
el.appendChild(fdoc);
|
||
}
|
||
};
|
||
this.request('setuptools?app=' + app + '&method=' + method, option);
|
||
},
|
||
request: function (url, options) {
|
||
new Request.JSON($extend(options, { url: url, data: $$('.installer-info')[0] })).post();
|
||
}
|
||
};
|
||
|
||
setuptools.init();
|
||
|
||
/** demo数据的确认 **/
|
||
var _demodata = $$("select[name^='options[demodata]']");
|
||
if (_demodata) {
|
||
_demodata.addEvent('change', function (el) {
|
||
var _target = $(el.target) || $(el);
|
||
if (_target.value == '0') {
|
||
$('setupinfo_demodata').addClass('disabled');
|
||
$('setupinfo_demodata').style.display = 'none';
|
||
} else {
|
||
$('setupinfo_demodata').removeClass('disabled');
|
||
$('setupinfo_demodata').style.display = 'block';
|
||
}
|
||
setuptools.init();
|
||
});
|
||
}
|
||
|
||
['taskstepbutton', 'tasks_start'].each(function (el, index) {
|
||
if ($E('.' + el, main))
|
||
$E('.' + el, main).addEvent('click', function (e) {
|
||
|
||
if (tasks_setup[el]) tasks_setup[el]();
|
||
|
||
// 检查当前步骤是否有complete类,或者是否是第一个步骤(默认显示)
|
||
if (item[index] && (item[index].hasClass('complete') || (index == 0 && window.getComputedStyle(item[index]).display != 'none'))) {
|
||
// 添加complete类(如果还没有)
|
||
if (!item[index].hasClass('complete')) {
|
||
item[index].addClass('complete');
|
||
}
|
||
|
||
item[index].style.display = 'none';
|
||
var i = index + 1;
|
||
if (item[i]) {
|
||
item[i].style.display = '';
|
||
|
||
// 更新步骤导航:当前步骤标记为已完成,下一步标记为进行中
|
||
item_tip[index].className = 'step-installed' + (index + 1);
|
||
item_tip[i].className = 'step-installing' + (i + 1);
|
||
|
||
// 确保之前的步骤都标记为已完成
|
||
for (var j = 0; j < index; j++) {
|
||
item_tip[j].className = 'step-installed' + (j + 1);
|
||
}
|
||
|
||
Cookie.write('setup_Step', i + 1);
|
||
|
||
if (i == item.length - 1) {
|
||
|
||
installer.run("<{link ctl='default' act='initenv' }>");
|
||
}
|
||
}
|
||
}
|
||
});
|
||
});
|
||
|
||
});
|
||
|
||
</script>
|
||
</body>
|
||
|
||
</html> |