db.htm 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <!--<link rel="icon" href="favicon.ico">-->
  10. <title>DbAdmin Teach</title>
  11. <!-- Bootstrap core CSS -->
  12. <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
  13. <!-- Custom styles for this template -->
  14. <link href="css/U.EX.DB.css" rel="stylesheet">
  15. <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
  16. <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
  17. <script src="js/assets/ie-emulation-modes-warning.js"></script>
  18. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  19. <!--[if lt IE 9]>
  20. <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.js"></script>
  21. <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  22. <![endif]-->
  23. </head>
  24. <body>
  25. <div class="site-wrapper">
  26. <div class="site-wrapper-inner">
  27. <div class="cover-container">
  28. <div class="masthead clearfix">
  29. <div class="inner">
  30. <h3 class="masthead-brand">
  31. DbAdmin</h3>
  32. <ul class="nav masthead-nav">
  33. <li class="active"><a href="#" id="U_db_User">主页</a></li>
  34. </ul>
  35. </div>
  36. </div>
  37. <div class="inner cover" id="U_db_IndexFrame">
  38. <h1 class="cover-heading">
  39. 学习数据库管理</h1>
  40. <p class="lead">
  41. 你可以通过你的1473账号登陆,并创建自己的数据库进行学习。</p>
  42. <p class="lead">
  43. <a href="#" class="btn btn-lg btn-default" onclick="U.dbAdmin.ZFram('U_db_IndexFrame','U_db_LoginFrame')">
  44. Go!</a>
  45. </p>
  46. </div>
  47. <div class="inner cover" style="display: none;" id="U_db_LoginFrame">
  48. <from onkeydown="if(event.keyCode===13) U.dbAdmin.Login();">
  49. <h1 class="cover-heading" style="margin-top: -80px;">
  50. 登陆</h1>
  51. <p class="lead" style="margin-left: -80px;">
  52. 用户名:
  53. <input type="text" id="un" style="color: #343434" name="username" /></p>
  54. <p class="lead" style="margin-left: -80px;">
  55. 密码&nbsp;&nbsp;&nbsp;:
  56. <input type="password" id="ps" style="color: #343434" name="password" />
  57. </p>
  58. <small id="loginError" style="color:Red;"></small>
  59. <p class="lead" style="margin-top: 10px;">
  60. <button class="btn btn-lg btn-default" onclick="U.dbAdmin.Login();">Go!</button>
  61. </p>
  62. </from>
  63. </div>
  64. <div class="inner cover" style="display: none;" id="U_db_ListFrame" onkeydown="if(event.keyCode===13) U.dbAdmin.DbUserCreate();">
  65. <div id="U_db_L_Create" style="display: none;">
  66. 你的数据库账号密码:<input type="password" style="color: #343434" id="U_db_LF_Ps" />
  67. 确认密码:<input type="password" style="color: #343434" id="U_db_LF_Pst" />
  68. <br />
  69. <small id="U_db_LF_Error" style="color: Red; margin-top: 20px;"></small>
  70. <button class="btn btn-lg btn-default" style="margin-top: 20px;" onclick="U.dbAdmin.DbUserCreate();">
  71. 创建你的第一个数据库账号吧!~</button>
  72. </div>
  73. <div id="U_db_L_Data" style="display: block">
  74. </div>
  75. </div>
  76. <div class="mastfoot">
  77. <div class="inner">
  78. <p>
  79. 版权所有 <a href="http://www.1473.cn">1473</a> ,数据库<a href="http://10.1.47.56/phpmyadmin/">点我</a>,
  80. by <a href="http://weibo.com/smalltr">@Qv</a>.</p>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <!--<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>-->
  87. <!--<script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>-->
  88. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  89. <!--<script src="js/assets/ie10-viewport-bug-workaround.js"></script>-->
  90. <script type="text/javascript"> document.domain = "1473.cn";</script>
  91. <script src="http://www.1473.cn/uform.js" type="text/javascript"></script>
  92. <script src="http://teacher.1473.cn/crossdomain.js" type="text/javascript"></script>
  93. <script type="text/javascript">
  94. Namespace.register("U.dbAdmin"); //示例项目命名空间,需要调整命名空间的请重新定义命名空间
  95. U.CD.AjaxUrl = 'http://teacher.1473.cn/'; //后台默认请求页面
  96. U.CD.AjaxCross = "http://teacher.1473.cn/CD.htm"; //后台跨域文件
  97. U.CD.Host = "192.168.100.67"; //需要更换数据库host,在这里更换
  98. U.CD.Database = "mysql"; //需要更换数据库名字,在这里更换UseStudio_School
  99. U.CD.Init();
  100. //视图最简单的切换,由于使用频率高,暂时这样写着先,以后看看有什么可以改的。
  101. U.dbAdmin.ZFram = function (a, b) {
  102. $('#' + a + '')[0].style.display = 'none';
  103. $('#' + b + '')[0].style.display = 'block';
  104. }
  105. //登陆时的各种提示语,配合页面上的静态元素简易表现
  106. //$("#loginError")[0].innerHTML
  107. //登陆的验证,由于是登陆没什么检测规则
  108. U.dbAdmin.Login = function () {
  109. var isNull = ($('#un')[0].value === '' || $('#ps')[0].value === ''); //判断为空的时候
  110. if (isNull) {
  111. $('#loginError')[0].innerHTML = '请填写完整!';
  112. return false;
  113. }
  114. $('#loginError')[0].innerHTML = '';
  115. U.A.Request('UseStudioManage.uploadUserinfo', ([$('#un')[0].value, $('#ps')[0].value, '', 2]), U.dbAdmin.LoginRes, ([]));
  116. }
  117. //登陆成功后,后台数据库反馈的数据,从这个地方
  118. //开始页面视图的初始化 View Loading~~~~
  119. U.dbAdmin.LoginRes = function (res) {
  120. if (!res.value) {
  121. $('#loginError')[0].innerHTML = '账户名或密码错误';
  122. } else {
  123. $('#loginError')[0].innerHTML = '';
  124. U.dbAdmin.Me = res.value[0][0];
  125. //把那些密码啥的都隐藏起来
  126. U.dbAdmin.Name = $('#U_db_User')[0].value = $('#un')[0].value; $('#ps')[0].value = '';
  127. U.dbAdmin.ZFram('U_db_LoginFrame', 'U_db_ListFrame');
  128. //U.ACD.Request(U.CD.AjaxUrl, (["Add_File", userid, node.ID, node.Deep, _nnode.ID, _nnode.Name, content]), U.CD.RT.CP_OKAsyn, ([""]));
  129. // U.A.Request("UseStudioManage.uploadUserinfo", ([$("#un")[0].value, $("#ps")[0].value, "", U.MS.produceGuid()]), U.dbAdmin.LoginRes, ([]));
  130. // U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "USE_SelectUser", U.dbAdmin.Me.UserId]), U.dbAdmin.ListInit, ([]));
  131. U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "TEST_SELECT"]), U.dbAdmin.ListInit, ([]));
  132. }
  133. }
  134. //获取到数据后的视图初始化
  135. //把数据库账号列表load出来
  136. U.dbAdmin.ListInit = function (res) {
  137. if (!res.value[0].length) {
  138. $('#U_db_L_Create')[0].style.display = 'block';
  139. $('#U_db_L_Data')[0].style.display = 'none';
  140. return false;
  141. }
  142. //开始加载列表
  143. $('#U_db_L_Create')[0].style.display = 'none';
  144. $('#U_db_L_Data')[0].style.display = 'block';
  145. var value = res.value[0];
  146. for (var i = 0, t; t = value[i]; i++) {
  147. $('#U_db_L_Data')[0].innerHTML = '<p class="lead">用户名:' + t.username + ' - 密码: ' + t.password + '</p>'
  148. }
  149. }
  150. //新用户创建数据库账号
  151. //创建完成后加载数据~
  152. U.dbAdmin.DbUserCreate = function () {//U_db_LF_Error
  153. var isUnTrue = $('#U_db_LF_Ps')[0].value !== $('#U_db_LF_Pst')[0].value;
  154. var isNull = ($('#U_db_LF_Ps')[0].value === '' || $('#U_db_LF_Pst')[0].value === '');
  155. if (isNull) {
  156. $('#U_db_LF_Error')[0].innerHTML = '请填写完整';
  157. return false;
  158. }
  159. if (isUnTrue) {
  160. $('#U_db_LF_Error')[0].innerHTML = '请确认密码输入一致';
  161. return false;
  162. }
  163. U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, 'USE_CreateUser', U.dbAdmin.Me.UserName, $('#U_db_LF_Ps')[0].value, U.dbAdmin.Me.UserId]), U.dbAdmin.ListInit, ([]));
  164. }
  165. </script>
  166. </body>
  167. </html>