slgn.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div id="app">
  3. <div class="slgn">
  4. <div class="header">
  5. <img src="../assets/Sign-top.png" >
  6. </div>
  7. <div class="nav">
  8. <div class="nav-name">
  9. <div class="nav-name-top">
  10. <span>用户登录</span>
  11. </div>
  12. <div class="nav-name-waist">
  13. <span>欢迎登录系统</span>
  14. </div>
  15. <div class="nav-name-srk">
  16. <span>
  17. <el-input class="srk" placeholder="请输入账号" v-model="username">
  18. <i slot="prefix" class="el-icon-user mt"></i>
  19. </el-input>
  20. </span>
  21. <span>
  22. <el-input class="srk" placeholder="请输入密码" show-password v-model="password">
  23. <i slot="prefix" class="el-icon-lock mt"></i>
  24. </el-input>
  25. </span>
  26. <span class="yzm">
  27. <div class="box_tr" style="width:194px;margin-bottom:0">
  28. <el-input class="srk" placeholder="请输入验证码" v-model="captcha" @keyup.enter.native="login()">
  29. <i slot="prefix" class="el-icon-bell mt"></i>
  30. </el-input>
  31. </div>
  32. <img class="imgUrl" :src="imgUrl" @click="getUuid">
  33. </span>
  34. </div>
  35. <div class="nav-name-an">
  36. <el-button type="warning" @click='login()'>登录</el-button>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="footer">
  41. <div class="footer-top">
  42. <span>Resettlement housing </span>
  43. <div>management platform</div>
  44. </div>
  45. <div class="footer-bottom">
  46. <ul>
  47. <li>服务电话:0571-81951752</li>
  48. <li>邮箱:sunweiherber@163.com</li>
  49. <li>地址:杭州市拱墅区万融城1幢2203室</li>
  50. </ul>
  51. <span>copyright©慈溪市房屋征收管理办公室&杭州兆幅科技有限公司版权所有</span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. export default {
  59. name: 'pp',
  60. data() {
  61. return {
  62. input4: '',
  63. uuid: '',
  64. imgUrl: "",
  65. username: '',
  66. captcha: '',
  67. password: ''
  68. }
  69. },
  70. mounted() {
  71. this.getUuid()
  72. // sessionStorage.clear();
  73. },
  74. methods: {
  75. //获取图片验证码
  76. getUuid() {
  77. var s = [];
  78. var hexDigits = "0123456789abcdef";
  79. for (var i = 0; i < 36; i++) {
  80. s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  81. }
  82. s[14] = "4";
  83. s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
  84. s[8] = s[13] = s[18] = s[23] = "-";
  85. var uuid = s.join("");
  86. this.uuid = uuid;
  87. //获取验证码图片
  88. this.$http.get('api/v1/pub/captcha.jpg?uuid=' + uuid, {
  89. responseType: 'arraybuffer'
  90. }).then(response => {
  91. return 'data:image/png;base64,' + btoa(
  92. new Uint8Array(response.data).reduce((data, byte) => data + String.fromCharCode(byte), '')
  93. )
  94. }).then(data => {
  95. this.imgUrl = data
  96. })
  97. },
  98. // 登录
  99. login() {
  100. let params = {
  101. captcha: this.captcha,
  102. uuid: this.uuid,
  103. username: this.username,
  104. password: this.password
  105. }
  106. this.$http.post('/api/v1/pub/login', params).then((res) => {
  107. window.sessionStorage.setItem("i", 1);
  108. if (res.status == 200 && res.data.code == 0) {
  109. window.sessionStorage.setItem('token', res.data.token);
  110. window.sessionStorage.setItem('dialogVisible', true);
  111. this.$router.push('/home')
  112. } else {
  113. this.getUuid()
  114. }
  115. })
  116. }
  117. }
  118. }
  119. </script>
  120. <style scoped lang="less">
  121. .slgn {
  122. width: 100%;
  123. height: 100%;
  124. background-color: #fff;
  125. min-width: 1434px;
  126. min-height: 816px;
  127. .header {
  128. display: flex;
  129. padding: 2%;
  130. .header-Left {
  131. padding: 0 1%;
  132. .header-Left-top{
  133. span {
  134. font-size: 30px;
  135. display: flex;
  136. color: #323333;
  137. }
  138. h3 {
  139. font-size: 16px;
  140. font-weight: lighter;
  141. border-bottom: 1px solid #323333;
  142. padding: 2% 0;
  143. color: #323333;
  144. }
  145. }
  146. .header-Left-bottom {
  147. span {
  148. margin: 1% 0 0 0;
  149. display: block;
  150. }
  151. h3 {
  152. font-size: 12px;
  153. color: #323333;
  154. line-height: 20px;
  155. font-weight: bold;
  156. font-weight: lighter;
  157. }
  158. }
  159. }
  160. .header-right {
  161. padding: 1%;
  162. border-left: 1px solid #323333;
  163. h2 {
  164. font-size: 64px;
  165. font-weight: 400;
  166. color: #323333;
  167. opacity: 1;
  168. }
  169. }
  170. }
  171. .nav {
  172. background: url(../assets/Sign-background.png) no-repeat;
  173. background-size: 100%, 100%;
  174. width: 100%;
  175. height: 60%;
  176. .nav-name {
  177. width: 22%;
  178. height: 80%;
  179. background-color: #fff;
  180. position: relative;
  181. top: 7%;
  182. left: 60%;
  183. min-width: 422px;
  184. min-height: 407px;
  185. .nav-name-top {
  186. background-color: #323333;
  187. width: 100%;
  188. height: 16%;
  189. span {
  190. color: #fff;
  191. font-size: 32px;
  192. text-align: center;
  193. display: block;
  194. line-height: 74px;
  195. .el-input--prefix{
  196. /deep/.el-input__inner {
  197. border: none;
  198. }
  199. }
  200. }
  201. }
  202. .nav-name-waist {
  203. width: 70%;
  204. margin: 0% auto;
  205. border-bottom: 1px #CCC solid;
  206. padding: 2% 0;
  207. span {
  208. font-size: 16px;
  209. border-bottom: 2px #333 solid;
  210. padding: 3% 0;
  211. color: #333;
  212. }
  213. }
  214. .nav-name-srk {
  215. padding: 7% 5%;
  216. height: 40%;
  217. display: flex;
  218. flex-direction: column;
  219. justify-content: space-around;
  220. /deep/.el-input__inner{
  221. background-color: #fff0;
  222. border: none;
  223. &:focus{
  224. border: none;
  225. }
  226. }
  227. span {
  228. display: flex;
  229. .srk {
  230. border: 1px solid #cccccc;
  231. border-radius: 4px;
  232. .mt {
  233. font-size: 24px;
  234. line-height: 40px;
  235. padding: 0 2.5%;
  236. }
  237. &:hover {
  238. border: 1px solid #e6a23c;
  239. .mt {
  240. color: #e6a23c;
  241. }
  242. }
  243. }
  244. }
  245. .el-input {
  246. width: 80%;
  247. margin: 0 auto;
  248. }
  249. }
  250. .nav-name-an {
  251. width: 80%;
  252. margin: 0 auto;
  253. .el-button {
  254. width: 100%;
  255. }
  256. }
  257. }
  258. }
  259. .footer {
  260. padding: 2% 0 0 0;
  261. margin: 0 1%;
  262. .footer-top {
  263. display: flex;
  264. border-bottom: 1px solid #707070;
  265. padding: 0.5% 0%;
  266. span {
  267. color: #D58905;
  268. font-size: 32px;
  269. margin: 0 1% 0 0;
  270. }
  271. div {
  272. font-size: 32px;
  273. color: #333;
  274. }
  275. }
  276. .footer-bottom {
  277. display: flex;
  278. justify-content: space-between;
  279. margin: 1.5% 0 0 0;
  280. ul {
  281. display: flex;
  282. color: #333;
  283. font-size: 12px;
  284. width: 40%;
  285. li {
  286. margin: 0 2% 0 0;
  287. }
  288. }
  289. span {
  290. color: #333;
  291. font-size: 12px;
  292. }
  293. }
  294. }
  295. .yzm {
  296. display: flex;
  297. width: 80%;
  298. margin: 0 auto;
  299. .imgUrl {
  300. width: 120px;
  301. height: 43px;
  302. cursor: pointer;
  303. }
  304. }
  305. }
  306. </style>