You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

278 lines
8.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="bg">
  3. <div style="display: flex;justify-content: space-between;padding-top: 5px;">
  4. <div></div>
  5. <div style="display: flex;">
  6. <i class="el-icon-setting" @click="toggleDevTools" style="padding-right: 5px;font-size: 22px;cursor:pointer;"></i>
  7. <i class="el-icon-minus" @click="btnMin" style="padding-right: 5px;font-size: 22px;cursor:pointer;"></i>
  8. <i class="el-icon-copy-document" @click="btnMax" style="padding-right: 5px;font-size: 22px;cursor:pointer;"></i>
  9. <i class="el-icon-close" @click="btnClose" style="padding-right: 5px;font-size: 22px;cursor:pointer;"></i>
  10. </div>
  11. </div>
  12. <div class="box">
  13. <div class="mainbody">
  14. <div class="title">
  15. <img src="@/assets/images/logo1.png" />
  16. <div>神豚体检管理系统</div>
  17. </div>
  18. <div class="userform">
  19. <div style="color: #232748;font-size: 24px;font-weight: 700;margin-bottom: 20px;font-family: NotoSansSC-Bold;">
  20. 登录账号</div>
  21. <el-form :model="form" :rules="rules" ref="form" class="demo-ruleForm">
  22. <el-form-item label="" prop="Username" style="margin-bottom: 20px">
  23. <div
  24. style="font-size:16px;font-weight: 400;color: #232748; line-height: 22px;margin-bottom: 10px;font-family: NotoSansSC-Regular;">
  25. 用户名</div>
  26. <el-input class="inputcolor" v-model="form.Username" placeholder="请输入用户名" prefix-icon="el-icon-s-custom"
  27. style="color: #fff" @keyup.native.enter="nextFocus('Username')"></el-input>
  28. </el-form-item>
  29. <el-form-item label="" prop="Password" style="margin-bottom: 5px">
  30. <div
  31. style="font-size:16px;font-weight: 400;color: #232748;line-height: 22px;margin-bottom: 10px;font-family: NotoSansSC-Regular;">
  32. 密码</div>
  33. <el-input v-model="form.Password" placeholder="请输入密码" type="password" prefix-icon="el-icon-unlock"
  34. @keyup.native.enter="nextFocus('Password')" ref="password"></el-input>
  35. </el-form-item>
  36. <el-row>
  37. <el-col :span="12">
  38. <el-form-item>
  39. <el-checkbox></el-checkbox>
  40. <span
  41. style=" font-family: NotoSansSC-Regular;color: #232748;font-weight: 400;font-size: 14px;margin-left: 5px;">记住密码</span>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="12">
  45. <el-form-item>
  46. <div style="text-align: right;color:#396FFA;font-family: NotoSansSC-Regular;">忘记密码</div>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-button type="primary" class="btn" @click="onSubmit(form)" style="margin-bottom: 20px;">
  51. 用户登录
  52. </el-button>
  53. <div style="color:#396FFA;font-size:14px;text-align: center;font-family: NotoSansSC-Regular;">注册新账号</div>
  54. </el-form>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. import { writetoken } from "@/utlis/istoken";
  62. import axios from "axios";
  63. export default {
  64. data() {
  65. return {
  66. sysConfig: {}, // 配置信息
  67. form: {
  68. Username: "",
  69. Password: "",
  70. },
  71. rules: {
  72. Username: [
  73. { required: true, message: "请输入用户名", trigger: "blur" },
  74. //{ min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
  75. ],
  76. Password: [
  77. { required: true, message: "请输入密码", trigger: "blur" },
  78. //{ min: 3, max: 8, message: "长度在 3 到 8 个字符", trigger: "blur" },
  79. ],
  80. },
  81. };
  82. },
  83. async mounted() {
  84. await this.getSysConfig()
  85. // 壳程序懒加载通讯组件
  86. if (this.$peisAPI) {
  87. this.$peisAPI.lazyLoad(); // 加载报表 dll
  88. this.$peisAPI.lazyLoadReportTemplate(); //加载报表 模版
  89. }
  90. },
  91. methods: {
  92. async getSysConfig() {
  93. try {
  94. let res = await axios.get('/sysConfig.html') // , { timeout: 50000 }
  95. console.log('axios.get /sysConfig.html',res)
  96. if(!res.data.apiurl) this.$message.error({ showClose: true, message: `获取配置参数错误,请重新刷新本页面!` })
  97. this.sysConfig = res.data
  98. window.sessionStorage.setItem('sysConfig', JSON.stringify(res.data))
  99. } catch (error) {
  100. this.$message.error({ showClose: true, message: `获取配置参数错误 ${error}` })
  101. }
  102. },
  103. //打开客户端调试工具
  104. toggleDevTools() {
  105. if (!this.$peisAPI) {
  106. this.$message.info("此功能,需要在壳客户端才可运行!")
  107. return
  108. }
  109. this.$peisAPI.toggleDevTools();
  110. },
  111. btnMin() {
  112. if (!this.$peisAPI) {
  113. this.$message.info("此功能,需要在壳客户端才可运行!")
  114. return
  115. }
  116. this.$peisAPI.windowMin();
  117. },
  118. btnMax() {
  119. if (!this.$peisAPI) {
  120. this.$message.info("此功能,需要在壳客户端才可运行!")
  121. return
  122. }
  123. this.$peisAPI.windowMax();
  124. },
  125. btnClose() {
  126. if (!this.$peisAPI) {
  127. this.$message.info("此功能,需要在壳客户端才可运行!")
  128. return
  129. }
  130. this.$peisAPI.windowClose();
  131. },
  132. nextFocus(e) {
  133. if (e == 'Username') {
  134. this.$refs['password'].focus()
  135. } else (
  136. this.onSubmit()
  137. )
  138. },
  139. onSubmit() {
  140. this.$refs.form.validate((valid) => {
  141. if (valid) {
  142. axios.post(`${this.sysConfig.apiurl}/api/identity/users/login`, {
  143. userName: this.form.Username,
  144. passWord: this.form.Password,
  145. }).then(ret => {
  146. let res = ret.data
  147. if (res.code != -1) {
  148. window.sessionStorage.setItem("peisid", res.data.peisid); //设置当前人员所属体检中心
  149. writetoken(res.data.expires_in);
  150. window.sessionStorage.setItem("token", res.data.access_token);
  151. window.sessionStorage.setItem("refresh_token", res.data.refresh_token);
  152. window.sessionStorage.setItem("tokentype", res.data.token_type);
  153. window.sessionStorage.setItem("user", this.form.Username);
  154. this.$router.push({ path: "/home" });
  155. this.$store.state.changepassword = this.form.Password;
  156. } else {
  157. this.$message.warning(res.message);
  158. }
  159. }).catch(err => {
  160. this.$message.error(err);
  161. })
  162. }
  163. });
  164. },
  165. },
  166. created() { },
  167. };
  168. </script>
  169. <style lang="scss" scoped>
  170. ::v-deep .el-input {
  171. color: #232748;
  172. }
  173. // ::v-deep .el-form-item {
  174. // border: 1px solid rgb(0, 183, 92);
  175. // }
  176. .bg {
  177. background-color: black;
  178. // background: url("https://img.zcool.cn/community/013c8b5b62d108a801206a35bea1eb.jpg@2o.jpg");1
  179. // background: url("https://img1.baidu.com/it/u=1097534320,1746985227&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500");
  180. background: url("@/assets/images/BG.png");
  181. background-size: cover;
  182. height: 100%;
  183. width: 100%;
  184. min-height: 100vh;
  185. }
  186. .el-form-item.is-error .el-input__inner {
  187. color: none;
  188. }
  189. .inputcolor {
  190. border: none;
  191. }
  192. .box {
  193. position: absolute;
  194. right: 140px;
  195. top: 119px;
  196. }
  197. .mainbody {
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. flex-direction: column;
  202. .title {
  203. width: 443px;
  204. height: 107px;
  205. display: flex;
  206. justify-content: center;
  207. align-items: center;
  208. margin-bottom: 10px;
  209. img {
  210. width: 45.86px;
  211. height: 45.86px;
  212. }
  213. div {
  214. font-size: 38px;
  215. margin-left: 15px;
  216. color: #232748;
  217. font-weight: 600;
  218. }
  219. }
  220. }
  221. .userform {
  222. width: 356px;
  223. height: 366px;
  224. background-color: #fff;
  225. border-radius: 12px;
  226. padding: 40px 32px;
  227. }
  228. // .btn :hover {
  229. // // background-color: rgb(0, 183, 92);
  230. // }
  231. ::v-deep .el-input__icon {
  232. font-size: 18px;
  233. }
  234. .btn {
  235. background-color: #396FFA;
  236. ;
  237. font-size: 16px;
  238. // background-color: #ccc;
  239. border: none;
  240. color: #fff;
  241. font-weight: 700;
  242. height: 40px;
  243. width: 100%;
  244. }
  245. :deep .el-input--prefix .el-input__inner {
  246. padding-left: 30px;
  247. }
  248. :deep .el-form-item {
  249. margin-bottom: 22px;
  250. }
  251. :deep .el-button {
  252. color: #fff;
  253. }
  254. </style>