Skip to content

Commit 39baa2f

Browse files
authored
Merge pull request #15 from misterpancn/feature-develop-buck
release v1.0.5
2 parents c74bef9 + 04d8520 commit 39baa2f

File tree

7 files changed

+34
-24
lines changed

7 files changed

+34
-24
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "VueChat",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"author": "[email protected]",
55
"description": "An electron-vue project",
66
"private": true,
@@ -104,6 +104,7 @@
104104
"chalk": "^2.4.1",
105105
"copy-webpack-plugin": "^4.5.1",
106106
"cross-env": "^5.1.6",
107+
"crypto-js": "^3.1.9-1",
107108
"css-loader": "^0.28.11",
108109
"del": "^3.0.0",
109110
"devtron": "^1.4.0",

src/renderer/components/Chat/Modal/modifyAvatar.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
}
2626
},
2727
headers () {
28+
let keys = config.encrypt()
2829
return {
2930
'Accept': 'application/' + config.apiVersion + '+json',
30-
'Client-Key': config.clientKey,
31+
'Client-Key': keys.key,
32+
'Secret-Salt': keys.salt,
3133
'Authorization': localStorage.getItem('tokenType') + ' ' + localStorage.getItem('token')
3234
}
3335
}

src/renderer/components/Chat/msgTextarea.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@
5555
return this.$store.getters.isGroup
5656
},
5757
headers () {
58+
let keys = config.encrypt()
5859
return {
5960
'Accept': 'application/' + config.apiVersion + '+json',
60-
'Client-Key': config.clientKey,
61+
'Client-Key': keys.key,
62+
'Secret-Salt': keys.salt,
6163
'Authorization': localStorage.getItem('tokenType') + ' ' + localStorage.getItem('token')
6264
}
6365
}

src/renderer/request/axios.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import axios from 'axios'
2-
import config from '@/store/config/config'
2+
import localConfig from '@/store/config/config'
33
import store from '@/store'
4-
var transport = config.openssl === false ? 'http://' : 'https://'
4+
var transport = localConfig.openssl === false ? 'http://' : 'https://'
55
var instance = axios.create({
6-
baseURL: transport + config.serviceAddress + '/api/',
6+
baseURL: transport + localConfig.serviceAddress + '/api/',
77
timeout: 1000 * 60,
88
headers: {
9-
'Accept': 'application/' + config.apiVersion + '+json',
10-
'Client-Key': config.clientKey
9+
'Accept': 'application/' + localConfig.apiVersion + '+json'
1110
}
1211
})
1312
// 添加请求拦截器
1413
instance.interceptors.request.use(function (config) {
1514
// 在发送请求之前做些什么
1615
config.headers.Authorization = localStorage.getItem('tokenType') + ' ' + localStorage.getItem('token')
1716
config.headers.common['Accept-Language'] = store.getters.getLanguage || 'zh-CN'
17+
let keys = localConfig.encrypt()
18+
config.headers.common['Client-Key'] = keys.key
19+
config.headers.common['Secret-Salt'] = keys.salt
1820
return config
1921
}, function (error) {
2022
// 对请求错误做些什么

src/renderer/request/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,39 @@ export default {
1212
},
1313
// 获取表情库
1414
getExpression () {
15-
return axios.get('lib/getExpression')
15+
return axios.get('lib/expression')
1616
},
1717
// 获取好友聊天记录
18-
getChatMessage (chatId, limit) {
19-
return axios.get('chat/getChatMessage/chat/' + chatId + '/' + limit)
18+
getChatMessage (chatId, limit, page) {
19+
return axios.get('chat/message/list/chat/' + chatId + '/' + limit + '?page=' + page)
2020
},
2121
// 获取群历史聊天记录
2222
getGroupMessage (groupId, limit, page) {
23-
return axios.get('chat/getGroupMessage/' + groupId + '/' + limit + '?page=' + page)
23+
return axios.get('chat/message/list/group/' + groupId + '/' + limit + '?page=' + page)
2424
},
2525
// 获取用户信息
2626
getUserInfo (uid) {
27-
return axios.get('chat/getUserInfo/' + uid)
27+
return axios.get('chat/user/info/' + uid)
2828
},
2929
// websocket初始化
3030
initChat (data) {
3131
return axios.post('chat/init', Qs.stringify(data))
3232
},
3333
// 对话消息接口 param: chat_id & content
3434
sendChatMessage (data) {
35-
return axios.post('chat/chatMessage', Qs.stringify(data))
35+
return axios.post('chat/message/chat/send', Qs.stringify(data))
3636
},
3737
// 群消息接口 param: group_id & content
3838
sendGroupMessage (data) {
39-
return axios.post('chat/groupMessage', Qs.stringify(data))
39+
return axios.post('chat/message/group/send', Qs.stringify(data))
4040
},
4141
// websocket断开接口
4242
chatConnectClose () {
43-
return axios.get('chat/connectClose');
43+
return axios.get('chat/connect/close');
4444
},
4545
// 重置消息提醒 param:chat_id or group id & is_group
4646
resetBadge (data) {
47-
return axios.post('chat/resetBadge', Qs.stringify(data))
47+
return axios.post('chat/reset/badge', Qs.stringify(data))
4848
},
4949
// 对话发送语音
5050
uploadRecorderByChat (chatId, data, config) {
@@ -56,11 +56,11 @@ export default {
5656
},
5757
// 添加群或好友 param: friend_id | group_id & remarks
5858
addFriends (data) {
59-
return axios.post('chat/addFriends', Qs.stringify(data))
59+
return axios.post('chat/friend/add', Qs.stringify(data))
6060
},
6161
// 搜索好友和群 param: chat_number
6262
searchNo (data) {
63-
return axios.post('chat/searchNo', Qs.stringify(data))
63+
return axios.post('chat/number/search', Qs.stringify(data))
6464
},
6565
// 加群加好友审核 param: audit
6666
audit (applyId, data) {
@@ -76,11 +76,11 @@ export default {
7676
},
7777
// 获取好友列表 无参数
7878
getFriendList () {
79-
return axios.get('chat/friendsList/get')
79+
return axios.get('chat/friend/list')
8080
},
8181
// 获取登录用户的群列表 无参数
8282
getGroupList () {
83-
return axios.get('chat/groupList/get')
83+
return axios.get('chat/group/list')
8484
},
8585
me () {
8686
return axios.post('auth/me')
@@ -103,6 +103,6 @@ export default {
103103
},
104104
// 获取群成员
105105
getGroupMember (groupId) {
106-
return axios.get('chat/getGroupMember/' + groupId)
106+
return axios.get('chat/member/group/' + groupId)
107107
}
108108
}

src/renderer/store/config/config.js.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ const config = {
2222
/**
2323
* 客户端请求授权码
2424
*/
25-
clientKey: 'ce10ae3d3c94432db913cf9349d238b6',
25+
appId: 10001,
26+
secretId: '71c1d9683afa4b5dafb398dc2f49d580',
27+
secretKey: 'd578ac32dd044fb3b3c80ead326e0806',
28+
encrypt: () => {},
2629
/**
2730
* 程序自动更新地址
2831
*/

src/renderer/view/auth/login.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
this.loading = false;
115115
}
116116
}).catch((error) => {
117-
console.log(error.response)
117+
console.log(error)
118118
this.loading = false;
119119
this.$Notice.error({
120120
title: this.$t('notifyTitle.errorReminding'),

0 commit comments

Comments
 (0)