Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
founder_vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
founder_vue
Commits
dac8cc05
Commit
dac8cc05
authored
Sep 01, 2021
by
liyuhang19990520
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
即时通讯
parent
ca6bc4f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
50 deletions
+76
-50
src/views/im/conf/index.js
+25
-24
src/views/login.vue
+51
-26
No files found.
src/views/im/conf/index.js
View file @
dac8cc05
/*
* @Author: your name
* @Date: 2021-08-20 16:31:17
* @LastEditTime: 2021-0
8-27 15:34:23
* @LastEditTime: 2021-0
9-01 10:22:31
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \V-IM-PC\src\views\im\conf\index.js
...
...
@@ -27,64 +27,65 @@ export default {
chatGroupDelUser_url
:
'/api/chatGroupUser/delete'
,
export_url
:
'/api/message/export'
,
ws_protocol
:
"ws"
,
getHostUrl
:
function
()
{
getHostUrl
:
function
()
{
return
(
this
.
http_protocol
+
"://"
+
localStorage
.
getItem
(
"host"
)
+
":"
+
this
.
http_port
// this.http_protocol +
// "://" +
// localStorage.getItem("host") +
// ":" +
// this.http_port
"http://110.1.6.3:8084"
);
},
getTokenUrl
:
function
()
{
getTokenUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
token_path
;
},
getInitUrl
:
function
()
{
getInitUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
init
;
},
getChatUsersUrl
:
function
()
{
getChatUsersUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
chat_users_url
;
},
getHisUrl
:
function
()
{
getHisUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
his_url
;
},
getRegisterUrl
:
function
()
{
getRegisterUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
addFriend_url
;
},
getaddFriendUrl
:
function
()
{
getaddFriendUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
register_url
;
},
getaddGroupUrl
:
function
()
{
getaddGroupUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
addGroup_url
;
},
getRemoveGroupUrl
:
function
()
{
getRemoveGroupUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
removeGroup_url
;
},
getGroupListUrl
:
function
()
{
getGroupListUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
groupList_url
;
},
getFriendListUrl
:
function
()
{
getFriendListUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
friendList_url
;
},
getChatGroupUserUrl
:
function
()
{
getChatGroupUserUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
chatGroupUser_url
;
},
getChatGroupDelUserUrl
:
function
()
{
getChatGroupDelUserUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
chatGroupDelUser_url
;
},
getChatGroupDelUserUrl
:
function
()
{
getChatGroupDelUserUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
chatGroupDelUser_url
;
},
getChatGroupUserDshUrl
:
function
()
{
getChatGroupUserDshUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
chatGroupUserDsh_url
;
},
getChatGroupUserAgreeUrl
:
function
()
{
getChatGroupUserAgreeUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
chatGroupUserAgree_url
;
},
getExportUrl
:
function
()
{
getExportUrl
:
function
()
{
return
this
.
getHostUrl
()
+
this
.
export_url
;
},
getWsUrl
:
function
()
{
getWsUrl
:
function
()
{
return
(
this
.
ws_protocol
+
"://"
+
...
...
src/views/login.vue
View file @
dac8cc05
...
...
@@ -26,7 +26,7 @@
class=
"item-input"
/>
</div>
<div
class=
"item"
>
<
!--
<
div
class=
"item"
>
<label>
服务:
</label>
<Input
prefix=
"ios-settings-outline"
...
...
@@ -34,7 +34,7 @@
placeholder=
"服务"
class=
"item-input"
/>
</div>
</div>
-->
<div
class=
"btn item"
>
<Button
type=
"primary"
@
click=
"login()"
icon=
"md-contact"
>
登录
</Button>
</div>
...
...
@@ -84,7 +84,7 @@ import conf from "./im/conf";
import
RequestUtils
from
"../utils/RequestUtils"
;
import
StoreUtils
from
"../utils/StoreUtils"
;
import
{
ErrorType
}
from
"../utils/ChatUtils"
;
const
CryptoJS
=
require
(
"crypto-js"
);
//引用AES源码js
export
default
{
name
:
"login"
,
data
()
{
...
...
@@ -99,8 +99,8 @@ export default {
showErr
:
false
,
showSetting
:
false
,
showRegister
:
false
,
host
:
"1
92.168.0.106
"
,
routeQuery
:
''
,
host
:
"1
10.1.6.3:8084
"
,
uap
:
""
,
};
},
components
:
{
...
...
@@ -146,7 +146,6 @@ export default {
},
login
:
function
()
{
let
self
=
this
;
localStorage
.
setItem
(
"host"
,
self
.
host
);
let
requestApi
=
RequestUtils
;
requestApi
.
login
(
self
.
username
.
trim
(),
self
.
password
.
trim
(),
self
)
...
...
@@ -189,32 +188,58 @@ export default {
}
});
},
//解密方法
Decrypt
(
word
)
{
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
"0000000671595991"
);
//十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
"tdrdadq59tbss5n7"
);
//十六位十六进制数作为密钥偏移量
let
encryptedHexStr
=
CryptoJS
.
enc
.
Hex
.
parse
(
word
);
let
srcs
=
CryptoJS
.
enc
.
Base64
.
stringify
(
encryptedHexStr
);
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
srcs
,
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
},
//加密方法
Encrypt
(
word
)
{
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
"0000000671595991"
);
//十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
"tdrdadq59tbss5n7"
);
//十六位十六进制数作为密钥偏移量
let
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
);
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
},
},
created
:
function
()
{
this
.
routeQuery
=
this
.
$route
.
query
;
this
.
uap
=
this
.
$route
.
query
.
uap
;
let
self
=
this
;
let
host
=
localStorage
.
getItem
(
"host"
);
if
(
host
)
{
self
.
host
=
host
;
}
else
{
localStorage
.
setItem
(
"host"
,
self
.
host
);
}
localStorage
.
setItem
(
"host"
,
self
.
host
);
},
mounted
()
{
if
(
this
.
routeQuery
.
username
&&
this
.
routeQuery
.
password
){
this
.
username
=
this
.
routeQuery
.
username
;
this
.
password
=
this
.
routeQuery
.
password
;
if
(
this
.
uap
)
{
let
data
=
this
.
Decrypt
(
this
.
uap
);
console
.
log
(
data
);
let
arr
=
data
.
split
(
"&"
);
arr
.
forEach
((
i
,
index
)
=>
{
arr
[
index
]
=
i
.
split
(
"="
);
});
arr
.
forEach
((
i
,
s
)
=>
{
i
.
forEach
((
j
,
index
)
=>
{
if
(
j
==
"username"
)
{
this
.
username
=
arr
[
s
][
index
+
1
];
}
else
if
(
j
==
"password"
)
{
this
.
password
=
arr
[
s
][
index
+
1
];
}
});
});
console
.
log
(
this
.
username
,
this
.
password
);
this
.
login
();
}
// 密码加密
// var decrypt = this.$cryptoJs.AES.decrypt(
// encrypt,//解密后的文字
// this.$cryptoJs.enc.Utf8.parse(aseKey),//key
// {
// mode: this.$cryptoJs.mode.ECB,
// padding: this.$cryptoJs.pad.Pkcs7,
// }
// ).toString(this.$cryptoJs.enc.Utf8);
}
},
};
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment