| | |
| | | "date-fns": "^2.14.0", |
| | | "enquire.js": "^2.1.6", |
| | | "highlight.js": "^10.2.1", |
| | | "js-cookie": "^2.2.1", |
| | | "mockjs": "^1.1.0", |
| | | "nprogress": "^0.2.0", |
| | | "js-md5": "^0.7.3", |
| | |
| | | if (process.env.NODE_ENV == 'dev') { |
| | | // 跨域请求 |
| | | axios.defaults.baseURL = 'http://localhost:8092/cad/'; |
| | | axios.withCredentials = true; // 保持请求头 |
| | | axios.defaults.withCredentials = true; // 保持请求头 |
| | | } else { |
| | | axios.defaults.baseURL = location.protocol + '//' + location.host + '/cad/'; |
| | |
| | | import './theme/index.less' |
| | | import Antd from 'ant-design-vue' |
| | | import Viser from 'viser-vue' |
| | | import '@/mock' |
| | | // import '@/mock' |
| | | import store from './store' |
| | | import 'animate.css/source/animate.css' |
| | | import Plugins from '@/plugins' |
| | |
| | | this.setUser(user); |
| | | this.setPermissions(permissions); |
| | | this.setRoles(roles); |
| | | |
| | | setAuthorization({token: loginRes.data.token, expireAt: new Date(loginRes.data.expireAt)}) |
| | | // 获取路由配置 |
| | | // getRoutesConfig().then(result => { |
| | |
| | | import axios from "@/assets/axios"; |
| | | import formatPassword from '@/assets/js/tools/formatPassword' |
| | | |
| | | /** |
| | | * 查询所有用户信息 |
| | |
| | | */ |
| | | export const deleteUser = (id) => { |
| | | return axios({ |
| | | method: "POST", |
| | | method: "GET", |
| | | url: "docUser/deleteUser", |
| | | params: { id } |
| | | }) |
| | |
| | | url: "docFace/deleteFace", |
| | | params: {faceId} |
| | | }) |
| | | } |
| | | /** |
| | | * 修改用户密码 |
| | | * @returns |
| | | */ |
| | | export const changePwd = (oldSnId, newSnId) => { |
| | | return axios({ |
| | | method: "GET", |
| | | url: "docUser/changeSnId", |
| | | params: { |
| | | newSnId: encodeURIComponent(formatPassword(newSnId)), |
| | | oldSnId: encodeURIComponent(formatPassword(oldSnId)), |
| | | } |
| | | }) |
| | | } |
| | |
| | | :wrapperCol="{ span: 17, offset: 1 }" |
| | | prop="oldPwd" |
| | | > |
| | | <a-input-password v-model="form.oldPwd" placeholder="请输入原密码" /> |
| | | <a-input-password |
| | | v-model="form.oldPwd" |
| | | placeholder="请输入原密码" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24"> |
| | |
| | | :wrapperCol="{ span: 17, offset: 1 }" |
| | | prop="pwd" |
| | | > |
| | | <a-input-password v-model="form.pwd" placeholder="请输入新密码" /> |
| | | <a-input-password v-model="form.pwd" placeholder="请输入新密码" /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24"> |
| | |
| | | :wrapperCol="{ span: 17, offset: 1 }" |
| | | prop="pwd1" |
| | | > |
| | | <a-input-password v-model="form.pwd1" placeholder="请再次输入新密码" /> |
| | | <a-input-password |
| | | v-model="form.pwd1" |
| | | placeholder="请再次输入新密码" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-layout-content> |
| | | <a-layout-footer class="footer"> |
| | | <a-button key="back" @click="submit">确定</a-button> |
| | | <a-button key="back" @click="checkForm">确定</a-button> |
| | | <a-button key="cancel" @click="cancel">取消</a-button> |
| | | </a-layout-footer> |
| | | </a-layout> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | // import { |
| | | // editUser, |
| | | // } from "../apis"; |
| | | import { changePwd } from "../apis"; |
| | | export default { |
| | | name: "", |
| | | data() { |
| | |
| | | message: "请输入新密码", |
| | | trigger: "blur", |
| | | }, |
| | | { |
| | | pattern: /^\S{8,}$/, |
| | | message: "密码最少8位", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | pwd1: [ |
| | | { |
| | |
| | | }, |
| | | components: {}, |
| | | methods: { |
| | | checkForm() { |
| | | this.$refs.formRef.validate((valid) => { |
| | | if (valid) { |
| | | // 新旧密码相同则退出 |
| | | // 两次旧密码不同则退出 |
| | | if (this.form.pwd == this.form.oldPwd) { |
| | | this.$message.error("新密码不应和旧密码相同"); |
| | | return false; |
| | | } |
| | | if (this.form.pwd != this.form.pwd1) { |
| | | this.$message.error("两次输入的新密码不一致"); |
| | | return false; |
| | | } |
| | | this.submit(); |
| | | } else { |
| | | this.$message.error("存在未通过检验的表单项"); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | submit() { |
| | | console.log("close"); |
| | | let newSnId = this.form.pwd; |
| | | let oldSnId = this.form.oldPwd; |
| | | changePwd(oldSnId, newSnId).then((res) => { |
| | | res = res.data; |
| | | if (res.code && res.data) { |
| | | this.$message.success(res.msg); |
| | | this.$emit("close"); |
| | | } else { |
| | | this.$message.error(`操作失败:${res.msg}`); |
| | | } |
| | | }); |
| | | }, |
| | | cancel() { |
| | | this.$emit("close"); |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | this.resetFields(); |
| | | }, |
| | | mounted() {}, |
| | | }; |
| | | </script> |
| | | |
| | |
| | | import Cookie from 'js-cookie' |
| | | // import Cookie from 'js-cookie' |
| | | // 401拦截 |
| | | const resp401 = { |
| | | /** |
| | |
| | | import axios from 'axios' |
| | | import Cookie from 'js-cookie' |
| | | |
| | | // 跨域认证信息 header 名 |
| | | const xsrfHeaderName = 'Authorization' |
| | | // const xsrfHeaderName = 'Authorization' |
| | | |
| | | axios.defaults.timeout = 5000 |
| | | axios.defaults.withCredentials= true |
| | | // axios.defaults.xsrfHeaderName= xsrfHeaderName |
| | | // axios.defaults.xsrfCookieName= xsrfHeaderName |
| | | |
| | | |
| | | // 认证类型 |
| | | const AUTH_TYPE = { |
| | |
| | | function setAuthorization(auth, authType = AUTH_TYPE.BEARER) { |
| | | switch (authType) { |
| | | case AUTH_TYPE.BEARER: |
| | | Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, {expires: auth.expireAt}) |
| | | // Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, {expires: auth.expireAt}) |
| | | break |
| | | case AUTH_TYPE.BASIC: |
| | | case AUTH_TYPE.AUTH1: |
| | |
| | | function removeAuthorization(authType = AUTH_TYPE.BEARER) { |
| | | switch (authType) { |
| | | case AUTH_TYPE.BEARER: |
| | | Cookie.remove(xsrfHeaderName) |
| | | // Cookie.remove(xsrfHeaderName) |
| | | break |
| | | case AUTH_TYPE.BASIC: |
| | | case AUTH_TYPE.AUTH1: |
| | |
| | | merge-stream "^2.0.0" |
| | | supports-color "^7.0.0" |
| | | |
| | | js-cookie@^2.2.1: |
| | | version "2.2.1" |
| | | resolved "https://registry.npm.taobao.org/js-cookie/download/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" |
| | | integrity sha1-aeEG3F1YBolFYpAqpbrsN0Tpsrg= |
| | | |
| | | js-md5@^0.7.3: |
| | | version "0.7.3" |
| | | resolved "https://registry.yarnpkg.com/js-md5/-/js-md5-0.7.3.tgz#b4f2fbb0b327455f598d6727e38ec272cd09c3f2" |