This commit is contained in:
linfso 2024-05-12 05:18:44 +08:00
parent b52b4b2335
commit fb6dc34ad6
8 changed files with 40 additions and 49 deletions

View File

@ -65,6 +65,10 @@ npm install --save @antv/hierarchy
npm install vue-chartjs
npm install uuid --save
npm i @fingerprintjs/fingerprintjs
```
npm install -save dayjs

View File

@ -42,6 +42,7 @@
"@antv/layout": "^0.3.23",
"@antv/x6": "^2.13.1",
"@antv/x6-vue-shape": "^2.1.1",
"@fingerprintjs/fingerprintjs": "^4.3.0",
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0",
"clipboard": "2.0.8",

View File

@ -1,14 +1,17 @@
import request from '@/utils/request'
import { encrypt } from '@/utils/jsencrypt'
import { Base64 } from "js-base64"
// 登录方法
export function login(mwname, mwpwd, code, uuid,pdomain) {
export function login(mwname, mwpwd, code,mMacCode, uuid,pdomain) {
let username = encrypt(mwname)
let password = encrypt(mwpwd)
let macCode = Base64.encode(mMacCode)
const data = {
username,
password,
code,
macCode,
uuid,
pdomain
}

View File

@ -49,9 +49,10 @@ const user = {
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
const macCode = userInfo.macCode
const pdomain = userInfo.pdomain
return new Promise((resolve, reject) => {
login(username, password, code, uuid,pdomain).then(res => {
login(username, password, code,macCode, uuid,pdomain).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
@ -96,6 +97,8 @@ const user = {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
localStorage.setItem('TnMacCode', user.ecomputid);
// const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile4.png") : process.env.VUE_APP_BASE_API + user.avatar;
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile4.png") : user.avatar;

View File

@ -72,8 +72,8 @@
<el-radio label="0">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="员工机器码" prop="eComputid" label-width="85px" style="margin-left:20px;">
<el-input v-model="form.eComputid" placeholder="请输入员工机器码" style="width:300px" />
<el-form-item label="员工机器码" prop="ecomputid" label-width="85px" style="margin-left:20px;">
<el-input v-model="form.ecomputid" placeholder="请输入员工机器码" style="width:300px" />
</el-form-item>
</el-col>

View File

@ -333,12 +333,16 @@ import { getLocalIp } from "@/utils/custom";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import FingerprintJS from '@fingerprintjs/fingerprintjs' // 引入
const uuidv4 = require("uuid/v4"); // 导入uuid生成插件
export default {
name: "Login",
data() {
return {
zoneConfig:{},
pdomain:null,
codeUrl: "",
localIp:null,
loginForm: {
@ -347,6 +351,7 @@ export default {
rememberMe: false,
code: "",
uuid: "",
macCode:"",
pdomain:""
},
loginRules: {
@ -414,64 +419,31 @@ export default {
},
created() {
document.title="系统登录";
this.zoneConfig=this.$store.state.zoneConfig;
const domain = this.zoneConfig.zoneDomain;
let domainPrefix = null;
if(domain === undefined){
domainPrefix = process.env.VUE_APP_PDOMAIN
this.zoneConfig.zoneDomain=process.env.VUE_APP_PDOMAIN;
}
else{
domainPrefix = domain.substring(0, domain.indexOf('.'))
this.zoneConfig.zoneDomain=domainPrefix;
this.loginForm.pdomain = domainPrefix
this.loginForm2.pdomain = domainPrefix
}
this.getCode();
this.getCookie();
this.initMacId();
},
methods: {
initMacId(){
const offerOptions = {
offerToReceiveAudio: 1,
offerToReceiveVideo: 1
};
// 创建 RTCPeerConnection [对象](https://geek.csdn.net/educolumn/04c51611e4b730957464192e0307b82c?spm=1055.2569.3001.10083)
const pc = new RTCPeerConnection();
// 创建 offer
pc.createOffer(offerOptions)
.then(offer => {
// 成功生成 offer
return pc.setLocalDescription(offer);
})
.then(() => {
// 处理 offer
const localDescription = pc.localDescription;
console.log('Generated offer:', localDescription);
// ...
})
.catch(error => {
// 处理错误
console.error('Error generating offer:', error);
});
},
initMacId1(){
getLocalIp(function(ip){
this.localIp=ip;
console.log(this.localIp)
// li.textContent = ip;
//local IPs
// if (ip.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/))
// document.getElementsByTagName("ul")[0].appendChild(li);
// //assume the rest are public IPs
// else
// document.getElementsByTagName("ul")[1].appendChild(li);
});
async initMacId(){
const fp = await FingerprintJS.load()
const result = await fp.get()
const macCode = result.visitorId
let TnMacCode=localStorage.getItem('TnMacCode')||'';
this.loginForm.macCode=TnMacCode+"###"+macCode;
},
getCode() {
getCodeImg().then(res => {
@ -534,7 +506,7 @@ export default {
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set("pdomain", pdomain, { expires: 30 });
Cookies.set("pdomain", this.zoneConfig.zoneDomain, { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
} else {
Cookies.remove("username");
@ -542,6 +514,7 @@ export default {
Cookies.remove('rememberMe');
Cookies.remove('pdomain');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {

View File

@ -225,6 +225,7 @@
</el-table-column>
<el-table-column label="示例" align="left" prop="dictLabel">
<template slot-scope="scope">
<span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span>
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag>
</template>

View File

@ -103,7 +103,12 @@
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
<el-table-column label="显示顺序" prop="roleSort" width="100" />
<el-table-column label="状态" align="center" width="100">
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<!-- <el-table-column label="状态" align="center" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
@ -112,7 +117,7 @@
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@ -403,6 +408,7 @@ export default {
if(this.form.roleId != undefined){
roleId=this.form.roleId;
}
console.log("===>"+this.domainId);
roleMenuTreeselect(roleId,this.domainId).then(response => {
this.menuOptions = response.menus;