go语言写的人脸本地化程序
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

194 wiersze
5.0 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>配置页面</title>
  7. <style>
  8. body{
  9. margin: 0;
  10. }
  11. li {
  12. list-style-type: none;
  13. }
  14. @media screen and (orientation: portrait) {
  15. .login {
  16. width: 100vw;
  17. height: 100vh;
  18. background-image: url("/static/img/phoneBgc.jpg");
  19. background-size: 100% 100%;
  20. background-repeat: no-repeat;
  21. }
  22. .register {
  23. background-image: url("/static/img/registerBgc.jpg") !important;
  24. padding-top: 15vh;
  25. }
  26. .enterprise-name, .devId, .devIp, .sync, .serverIp {
  27. width: 50vw;
  28. height: 5vh;
  29. border-radius: 2vw;
  30. background-color: transparent;
  31. font-size: 3vw;
  32. padding-left: 2vw;
  33. border: 1px solid #000;
  34. margin-bottom: 2vh;
  35. }
  36. .register_inputBox {
  37. display: flex;
  38. flex-direction: column;
  39. justify-content: center;
  40. align-items: center;
  41. margin-top: 5vh;
  42. position: relative;
  43. }
  44. .register_loginButton {
  45. width: 40vw;
  46. height: 5vh;
  47. background-color: rgb(101, 161, 255);
  48. border-radius: 10vw;
  49. display: flex;
  50. justify-content: center;
  51. align-items: center;
  52. color:#fff;
  53. font-size: 4vw;
  54. margin: 2vh 0 0 30vw;
  55. }
  56. #div-a-login{
  57. margin-top: 3vh;
  58. text-align: center;
  59. }
  60. }
  61. @media screen and (orientation: landscape) {
  62. input:focus {
  63. border: 0.1vw solid #000;
  64. outline: none; /* 可选,用于去除默认的外边框样式 */
  65. }
  66. .login {
  67. width: 100vw;
  68. height: 100vh;
  69. background-image: url("/static/img/phoneBgc_pc.jpg");
  70. background-size: 100% 100%;
  71. background-repeat: no-repeat;
  72. position: relative;
  73. }
  74. .register {
  75. background-image: url("/static/img/registerBgc_pc.jpg") !important;
  76. }
  77. .register_inputBox {
  78. width: 100vw;
  79. display: flex;
  80. flex-direction: column;
  81. justify-content: center;
  82. align-items: center;
  83. position: relative;
  84. padding-top: 42vh;
  85. }
  86. .enterprise-name, .devId, .devIp,.sync, .serverIp {
  87. width: 37vh;
  88. height: 6vh;
  89. border-radius: 2vh;
  90. background-color: transparent;
  91. font-size: 3vh;
  92. border: 0.1vw solid #000;
  93. padding-left: 1vw ;
  94. margin-bottom: 2vh;
  95. }
  96. .register_loginButton {
  97. width: 8vw;
  98. height: 2vw;
  99. background-color: rgb(101, 161, 255);
  100. border-radius: 1vw;
  101. display: flex;
  102. justify-content: center;
  103. align-items: center;
  104. color: #fff;
  105. font-size: 3vh;
  106. position: absolute;
  107. left: 46vw;
  108. top: 65vh;
  109. }
  110. .hand:hover{
  111. cursor: pointer;
  112. }
  113. #div-a-login{
  114. margin-top: 10vh;
  115. text-align: center;
  116. font-size: 3vh;
  117. }
  118. }
  119. </style>
  120. </head>
  121. <body>
  122. <!-- 注册页面 -->
  123. <div class="register login">
  124. <div class="register_inputBox">
  125. <input class="enterprise-name" name="enterpriseName" value="{{.config.EnterpriseName}}" type="text" placeholder="租户名">
  126. <input class="devId" name="devId" type="text" value="{{.config.DevId}}" placeholder="对应数字人设备号">
  127. <input class="devIp" name="devIp" value="{{.config.DevIp}}" type="text" placeholder="数字人ip">
  128. <input class="serverIp" name="serverIp" value="{{.config.ServerIp}}" type="text" placeholder="服务器域名或ip">
  129. <select class="sync" name="sync" >
  130. <option value="1" {{if eq .config.Sync 1}}selected{{end}}>同步</option>
  131. <option value="0" {{if eq .config.Sync 0}}selected{{end}}>不同步</option>
  132. </select>
  133. </div>
  134. <div class="register_loginButton hand">保存配置</div>
  135. <div id="div-a-login"><a id="a-login" href="/">去登录</a></div>
  136. </div>
  137. <script src="/static/js/jquery.min.js"></script>
  138. <script src="/static/js/msg-box.js"></script>
  139. <script>
  140. $(function(){
  141. $(".register_loginButton").on("click",function() {
  142. var enterpriseName = $(".enterprise-name").val();
  143. var devId = $(".devId").val();
  144. var devIp = $(".devIp").val();
  145. //ip4正则字符串
  146. const regex = /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
  147. if (devIp !== "" && !regex.test(devIp)){
  148. $.MsgBox.Alert("提示", "ip填写错误,请检查");
  149. return;
  150. }
  151. var settings = {
  152. "url": "/updateConfig",
  153. "method": "POST",
  154. "timeout": 0,
  155. "headers": {
  156. "Content-Type": "application/json"
  157. },
  158. "data": JSON.stringify({
  159. "devIp": devIp,
  160. "devId": devId,
  161. "enterpriseName": enterpriseName,
  162. "sync": Number($(".sync").val())
  163. }),
  164. };
  165. $.ajax(settings).done(function (response) {
  166. $.MsgBox.AlertWithCallback( "提示",response.message, function(){
  167. window.location.reload()
  168. })
  169. });
  170. })
  171. })
  172. </script>
  173. </body>
  174. </html>