1 line
6.3 KiB
JSON
1 line
6.3 KiB
JSON
{"ast":null,"code":"//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport md5 from \"js-md5\";\nimport { toLoad } from \"../utils/initialize\";\nexport default {\n name: \"Login\",\n data: function data() {\n return {\n user: {}\n };\n },\n methods: {\n onSubmit: function onSubmit() {\n var _this = this;\n\n if (this.user.username === \"\" || this.user.password === \"\" || this.user.confirmPassword === \"\") {\n this.$message.error(\"账号或密码不能为空\");\n return false;\n }\n\n if (this.user.password !== this.user.confirmPassword) {\n this.$message.error(\"两次密码不一致\");\n return false;\n }\n\n this.user.password = md5(this.user.password);\n this.request.post(\"/register\", this.user).then(function (res) {\n if (res.code === \"200\") {\n _this.$message.success(\"注册成功\");\n\n _this.$router.push(\"/login\");\n } else {\n _this.$message.error(res.msg);\n }\n });\n }\n },\n mounted: function mounted() {\n toLoad();\n }\n};","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA;AACA;AAEA;AACAA,eADA;AAEAC,MAFA,kBAEA;AACA;AACAC;AADA;AAGA,GANA;AAOAC;AACAC,YADA,sBACA;AAAA;;AACA,UACA,6BACA,yBADA,IAEA,gCAHA,EAIA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;;AACA;AACA,SAHA,MAGA;AACA;AACA;AACA,OAPA;AAQA;AAvBA,GAPA;AAgCAC,SAhCA,qBAgCA;AACAC;AACA;AAlCA","names":["name","data","user","methods","onSubmit","mounted","toLoad"],"sourceRoot":"src/views","sources":["Register.vue"],"sourcesContent":["<!--\r\n * @Description: \r\n * @Author: Rabbiter\r\n * @Date: 2023-03-26 15:27:05\r\n-->\r\n<template>\r\n <div id=\"bk\" class=\"wrapper\">\r\n <div class=\"login-box\">\r\n <div class=\"title\">\r\n <b>注 册</b>\r\n </div>\r\n <div style=\"margin-top: 30px\">\r\n <el-form label-width=\"70px\">\r\n <el-form-item label=\"用户名\">\r\n <el-input\r\n v-model.trim=\"user.username\"\r\n aria-required=\"true\"\r\n ></el-input>\r\n </el-form-item>\r\n <el-form-item label=\"密码\" style=\"margin-top: 25px\">\r\n <el-input\r\n v-model.trim=\"user.password\"\r\n show-password\r\n aria-required=\"true\"\r\n ></el-input>\r\n </el-form-item>\r\n <el-form-item label=\"确认密码\" style=\"margin-top: 25px\">\r\n <el-input\r\n v-model.trim=\"user.confirmPassword\"\r\n show-password\r\n aria-required=\"true\"\r\n ></el-input>\r\n </el-form-item>\r\n <el-form-item style=\"text-align: center;\">\r\n <el-button\r\n type=\"success\"\r\n @click=\"onSubmit\"\r\n style=\"font-size: 22px\"\r\n >\r\n <i\r\n class=\"iconfont icon-r-add\"\r\n style=\"font-size: 22px\"\r\n ></i\r\n > 注册</el-button\r\n >\r\n <el-button\r\n @click=\"$router.push('/login')\"\r\n style=\"font-size: 22px\"\r\n >\r\n <i\r\n class=\"iconfont icon-r-left\"\r\n style=\"font-size: 22px\"\r\n ></i\r\n > 返回登录</el-button\r\n >\r\n </el-form-item>\r\n </el-form>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport md5 from \"js-md5\";\r\nimport { toLoad } from \"../utils/initialize\"\r\n\r\nexport default {\r\n name: \"Login\",\r\n data() {\r\n return {\r\n user: {},\r\n };\r\n },\r\n methods: {\r\n onSubmit() {\r\n if (\r\n this.user.username === \"\" ||\r\n this.user.password === \"\" ||\r\n this.user.confirmPassword === \"\"\r\n ) {\r\n this.$message.error(\"账号或密码不能为空\");\r\n return false;\r\n }\r\n if (this.user.password !== this.user.confirmPassword) {\r\n this.$message.error(\"两次密码不一致\");\r\n return false;\r\n }\r\n this.user.password = md5(this.user.password);\r\n this.request.post(\"/register\", this.user).then((res) => {\r\n if (res.code === \"200\") {\r\n this.$message.success(\"注册成功\");\r\n this.$router.push(\"/login\");\r\n } else {\r\n this.$message.error(res.msg);\r\n }\r\n });\r\n },\r\n },\r\n mounted() {\r\n toLoad()\r\n }\r\n};\r\n</script>\r\n\r\n<style scoped>\r\n.wrapper {\r\n height: 100vh;\r\n /* background-image: linear-gradient(to top right,#42b983,#B3C0D1); */\r\n background-color: #006400;\r\n overflow: auto;\r\n}\r\n.login-box {\r\n margin: 220px auto;\r\n padding: 40px;\r\n width: 450px;\r\n height: 310px;\r\n background-color: #ffffff;\r\n border-radius: 10px;\r\n}\r\n.title {\r\n text-align: center;\r\n margin-top: 10px;\r\n font-size: 25px;\r\n color: #006400;\r\n}\r\n\r\n#bk {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n overflow-y: auto;\r\n height: 100%;\r\n background: url(\"../resource/01.jpg\") center top / cover no-repeat;\r\n}\r\n</style>"]},"metadata":{},"sourceType":"module"} |