12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>欢迎页面-X-admin2.0</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
- <link rel="stylesheet" href="./static/css/font.css">
- <link rel="stylesheet" href="./static/css/xadmin.css">
-
- <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <script src="./static/lib/layui/layui.js" charset="utf-8"></script>
- <script type="text/javascript" src="./static/js/xadmin.js"></script>
- </head>
- <body>
- <input type="text" id="token" value={{.token}} hidden=true>
- <div class="x-body layui-anim layui-anim-up">
- <blockquote class="layui-elem-quote">欢迎{{.rolename}}:
- <span class="x-red">{{.username}}</span>!当前时间:{{.sysTime}}</blockquote>
- </div>
- <div class="x-body layui-anim layui-anim-up">
- <blockquote class="layui-elem-quote">推广码:
- <input id="sharecode" style="width:128px;" value={{.sharecode}} type="text" class="layui-input">
- <br>
- <input value="刷新" class="layui-btn" style="width:128px;" type="button" onclick="randCode()">
- <br>
- <br>
- <input value="更新" class="layui-btn" style="width:128px;" type="button" onclick="UpdateShareCode()">
- </blockquote>
- </div>
- <script language="JavaScript">
- var randChats = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
- function generateMixed(n) {
- var res = "";
- for(var i = 0; i < n ; i ++) {
- var id = Math.ceil(Math.random()*(randChats.length-1));
- res += randChats[id];
- }
- return res;
- }
- // 随机兑换码
- function randCode() {
- document.getElementById("sharecode").value = generateMixed(6);
- }
-
- function UpdateShareCode () {
- var token = document.getElementById("token").value;
- var sharecode = document.getElementById("sharecode").value;
- if (sharecode.length != 6){
- alert("兑换码长度错误!6位大写字母");
- return;
- }
- // 兑换码字符检查
- for (var i = 0; i < sharecode.length; i ++){
- var isMatch = false
- for (var j = 0; j < randChats.length; j ++) {
- if (sharecode[i] == randChats[j]){
- isMatch = true;
- break;
- }
- }
- if (isMatch == false){
- alert("兑换码错误!请使用大写字母");
- return;
- }
- }
- var text = "token=" + encodeURI(token);
- text += "&sharecode=" + encodeURI(sharecode);
- $.ajax({
- type:"post",
- url:"/welcome?" + text,
- success:function (data) {
- // alert(data.status);
- if (data.status){
- window.location.href="/welcome";
- }else{
- if (data.info){
- alert(data.info);
- }else{
- window.location.href="/accountlogin";
- }
- }
- }
- });
- }
- </script>
- </body>
- </html>
|