Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fda702be
authored
Nov 24, 2022
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' into develop
2 parents
deb247d6
43764a5c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
263 additions
and
125 deletions
linkwe-mobile/src/api/common.js
linkwe-mobile/src/utils/index.js
linkwe-pc/package.json
linkwe-pc/src/components/SelectUser.vue
linkwe-pc/src/components/SelectWeUser.vue
linkwe-pc/src/views/conversation/security/setSensitiveWord.vue
linkwe-mobile/src/api/common.js
View file @
fda702b
import
request
from
'@/utils/request'
const
service
=
window
.
lwConfig
.
services
.
wecom
const
weChat
=
window
.
lwConfig
.
services
.
weChat
/**
* 获取应用的jsapi_ticket
...
...
@@ -17,7 +18,7 @@ export function getAgentTicket (url) {
export
function
getWxTicket
(
data
)
{
return
request
({
url
:
service
+
'/ticket/getWxTicket'
,
url
:
weChat
+
'/ticket/getWxTicket'
,
params
:
{
url
:
data
,
},
...
...
linkwe-mobile/src/utils/index.js
View file @
fda702b
...
...
@@ -91,57 +91,36 @@ import { getUserOpenid, getWechatUserInfo, getWxRedirect, wxLogin } from '@/api/
// 微信端授权登录
export
async
function
getWxCode
()
{
let
userinfo
=
sessionStorage
.
getItem
(
'userinfo'
)
//取缓存中的用户信息
if
(
userinfo
)
{
try
{
userinfo
=
JSON
.
parse
(
userinfo
)
}
catch
(
error
)
{
// alert(error)
}
return
userinfo
}
//缓存中没有用户信息,进入授权流程
// let appId = 'wxa57479bcd3f15461'
let
appId
=
window
.
lwConfig
.
appId
// 微信公众号id
// let appId = 'wxa57479bcd3f15461' // 公众号appid
let
code
=
getQueryValue
(
'code'
)
//是否存在code
// let query = param2Obj() //
// let { code, appId, secret } = query
let
local
=
window
.
location
.
origin
.
includes
(
'localhost'
)
?
'http://h5.linkwechat.cn/test.html'
:
window
.
location
.
href
if
(
!
code
)
{
//不存在就打开上面的地址进行授权
let
url
=
''
if
(
appId
)
{
url
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
appId
}
&redirect_uri=
${
encodeURIComponent
(
local
)}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
}
else
{
url
=
(
await
getWxRedirect
()).
data
let
id
=
getQueryValue
(
'appid'
,
url
)
sessionStorage
.
setItem
(
'weAppId'
,
id
)
}
window
.
location
.
href
=
url
// return new Promise(() => { })
// window.location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
}
let
userinfo
=
sessionStorage
.
getItem
(
'userinfo'
)
//取缓存中的用户信息
if
(
userinfo
)
{
try
{
if
(
code
)
{
let
{
data
:
dataLogin
}
=
await
wxLogin
(
code
)
sessionStorage
.
setItem
(
'token'
,
dataLogin
.
access_token
)
let
{
data
:
dataUser
}
=
await
getWechatUserInfo
()
sessionStorage
.
setItem
(
'userinfo'
,
JSON
.
stringify
(
dataUser
))
return
dataUser
}
userinfo
=
JSON
.
parse
(
userinfo
)
}
catch
(
error
)
{
// alert(JSON.stringify(error))
return
Promise
.
reject
()
// alert(error)
}
return
userinfo
}
let
code
=
getQueryValue
(
'code'
)
//是否存在code
if
(
!
code
)
{
let
url
=
(
await
getWxRedirect
()).
data
let
id
=
getQueryValue
(
'appid'
,
url
)
sessionStorage
.
setItem
(
'weAppId'
,
id
)
window
.
location
.
href
=
url
}
try
{
if
(
code
)
{
let
{
data
:
dataLogin
}
=
await
wxLogin
(
code
)
sessionStorage
.
setItem
(
'token'
,
dataLogin
.
access_token
)
let
{
data
:
dataUser
}
=
await
getWechatUserInfo
()
sessionStorage
.
setItem
(
'userinfo'
,
JSON
.
stringify
(
dataUser
))
return
dataUser
}
}
catch
(
error
)
{
return
Promise
.
reject
()
}
}
// 日期时间格式化
export
function
dateFormat
(
dateString
,
fmt
=
'yyyy-MM-dd hh:mm:ss'
)
{
...
...
linkwe-pc/package.json
View file @
fda702b
...
...
@@ -47,6 +47,8 @@
"benz-amr-recorder"
:
"^1.1.3"
,
"clipboard"
:
"2.0.4"
,
"core-js"
:
"^3.20.2"
,
"cos-js-sdk-v5"
:
"^1.4.11"
,
"crypto-js"
:
"^4.1.1"
,
"driver.js"
:
"^0.9.8"
,
"echarts"
:
"^5.3.0"
,
"element-ui"
:
"^2.15.7"
,
...
...
@@ -63,9 +65,11 @@
"nprogress"
:
"0.2.0"
,
"path-to-regexp"
:
"2.4.0"
,
"promise.prototype.finally"
:
"^3.1.2"
,
"qrcodejs2"
:
"0.0.2"
,
"screenfull"
:
"4.2.0"
,
"sortablejs"
:
"1.8.4"
,
"uuid"
:
"^8.3.2"
,
"vant"
:
"^2.12.50"
,
"video.js"
:
"^7.11.4"
,
"videojs-contrib-hls"
:
"^5.15.0"
,
"vue"
:
"2.6.10"
,
...
...
@@ -76,6 +80,7 @@
"vue-quill-editor"
:
"3.0.6"
,
"vue-router"
:
"3.5.3"
,
"vue-super-flow"
:
"^1.3.8"
,
"vuedraggable"
:
"^2.24.3"
,
"vuex"
:
"3.1.0"
},
"devDependencies"
:
{
...
...
@@ -99,6 +104,7 @@
"lint-staged"
:
"8.1.5"
,
"mockjs"
:
"1.0.1-beta3"
,
"plop"
:
"2.3.0"
,
"quill-image-extend-module"
:
"^1.1.2"
,
"runjs"
:
"4.3.2"
,
"sass"
:
"^1.47.0"
,
"sass-loader"
:
"8.0.2"
,
...
...
linkwe-pc/src/components/SelectUser.vue
View file @
fda702b
<
script
>
import
{
getDeptTree
,
getDeptUser
}
from
'@/api/organization'
import
{
createUniqueString
}
from
'@/utils'
export
default
{
name
:
'SelectUser'
,
components
:
{},
...
...
@@ -49,7 +47,12 @@
return
{
treeData
:
[],
userList
:
[],
defaultKeys
:
[]
defaultKeys
:
[],
deptId
:
''
,
//根部门Id
keywords
:
''
,
searchResult
:
[],
searchState
:
false
,
checked
:
[]
}
},
watch
:
{
...
...
@@ -86,11 +89,7 @@
label
:
'name'
,
children
:
'children'
,
disabled
(
data
,
node
)
{
return
(
(
that
.
isOnlyLeaf
&&
data
.
isParty
)
||
that
.
disabledValues
.
some
((
e
)
=>
e
==
(
data
.
userId
||
data
.
id
))
||
data
.
userId
===
''
)
return
(
that
.
isOnlyLeaf
&&
data
.
isParty
)
||
that
.
disabledValues
.
some
((
e
)
=>
e
==
(
data
.
userId
||
data
.
id
))
},
isLeaf
(
data
,
node
)
{
return
!
data
.
id
...
...
@@ -101,6 +100,45 @@
created
()
{},
mounted
()
{},
methods
:
{
setChange
(
e
)
{
if
(
!
e
)
{
this
.
searchState
=
false
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
userList
.
map
((
e
)
=>
e
.
userId
||
e
.
id
))
}
},
setSearch
()
{
if
(
!
this
.
keywords
)
return
this
.
searchResult
=
[]
this
.
searchState
=
true
this
.
checked
=
this
.
userList
.
map
((
dd
)
=>
{
return
dd
.
userId
})
getDeptUser
({
deptId
:
this
.
deptId
,
userName
:
this
.
keywords
}).
then
((
res
)
=>
{
this
.
searchResult
=
this
.
handleUser
(
res
.
rows
)
})
},
setSelectChange
(
e
,
index
)
{
if
(
e
)
{
if
(
this
.
isSigleSelect
)
{
this
.
userList
[
0
]
=
this
.
searchResult
[
index
]
}
else
{
this
.
userList
.
push
(
this
.
searchResult
[
index
])
}
this
.
checked
=
this
.
userList
.
map
((
dd
)
=>
{
return
dd
.
userId
})
this
.
$forceUpdate
()
}
else
{
this
.
cancle
(
this
.
searchResult
[
index
].
userId
)
}
setTimeout
(()
=>
{
this
.
keywords
=
''
this
.
setChange
()
},
500
)
},
treeFormat
(
list
)
{
let
dealOptions
=
[]
list
.
forEach
((
one
)
=>
{
...
...
@@ -126,21 +164,15 @@
this
.
userList
=
[]
}
getDeptTree
().
then
(({
data
})
=>
{
// data.forEach((element) => {
// element.key = createUniqueString()
// })
let
_data
=
this
.
handleDepart
(
data
)
resolve
(
this
.
treeFormat
(
_data
)
)
// api.getList({ department: _data[0].id }).then(({ rows, total }) =>
{
// _data && rows.unshift(..._data);
// resolve(rows);
// });
let
value
=
this
.
treeFormat
(
_data
)
if
(
value
.
length
)
{
this
.
deptId
=
value
[
0
].
deptId
}
resolve
(
value
)
})
}
else
{
getDeptUser
({
deptId
:
node
.
data
.
id
}).
then
(({
rows
})
=>
{
// rows.forEach((element) => {
// element.key = createUniqueString()
// })
let
arr
=
this
.
handleUser
(
rows
)
node
.
data
.
children
&&
arr
.
push
(...
node
.
data
.
children
)
resolve
(
arr
)
...
...
@@ -223,22 +255,46 @@
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
:xs=
"24"
>
<div
class=
"head-container"
>
<el-tree
node-key=
"nodeKey"
ref=
"tree"
lazy
accordion
show-checkbox
:check-on-click-node=
"false"
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
<!-- :default-checked-keys="
defaultValues.map((e) => (isOnlyLeaf ? e.userId : e.userId || e.id))
" -->
<div
class=
"search-input"
>
<el-input
size=
"mini"
v-model=
"keywords"
@
keyup
.
enter
.
native=
"setSearch"
placeholder=
"请输入员工名称"
clearable
@
change=
"setChange"
>
<el-button
slot=
"append"
icon=
"el-icon-search"
@
click=
"setSearch"
></el-button>
</el-input>
</div>
<div
class=
"search-list user-list"
v-show=
"searchState"
>
<el-checkbox-group
v-model=
"checked"
>
<el-row
v-for=
"(item, index) in searchResult"
:key=
"index"
>
<el-checkbox
:label=
"item.userId"
:key=
"index"
@
change=
"setSelectChange($event, index)"
>
<div>
{{
item
.
name
}}
</div>
</el-checkbox>
</el-row>
</el-checkbox-group>
</div>
<transition
name=
"fade"
>
<div
class=
"head-container"
v-show=
"!searchState"
>
<el-tree
node-key=
"nodeKey"
ref=
"tree"
lazy
accordion
show-checkbox
:check-on-click-node=
"false"
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
</div>
</transition>
</div>
</el-col>
<el-col
:span=
"12"
:xs=
"24"
class=
"user-list"
>
...
...
@@ -258,9 +314,32 @@
</
template
>
<
style
lang=
"scss"
scoped
>
.content
{
min-height
:
400px
;
}
.search-input
{
margin-top
:
5px
;
margin-bottom
:
10px
;
}
.user-list
{
.el-row
{
line-height
:
26px
;
}
}
.search-list
{
margin-top
:
20px
;
padding
:
0
10px
;
}
.fade-enter-active
{
transition
:
opacity
0.5s
;
}
.fade-enter
{
opacity
:
0
;
}
.fade-leave-active
{
transition
:
opacity
0.5s
;
}
.fade-leave-to
{
opacity
:
0
;
}
</
style
>
linkwe-pc/src/components/SelectWeUser.vue
View file @
fda702b
<
script
>
import
{
getDeptTree
,
getDeptUser
}
from
'@/api/organization'
import
{
createUniqueString
}
from
'@/utils'
export
default
{
name
:
'SelectWeUser'
,
components
:
{},
...
...
@@ -45,7 +43,12 @@
return
{
treeData
:
[],
userList
:
[],
defaultKeys
:
[]
defaultKeys
:
[],
deptId
:
''
,
//根部门Id
keywords
:
''
,
searchResult
:
[],
searchState
:
false
,
checked
:
[]
}
},
watch
:
{
...
...
@@ -90,11 +93,7 @@
label
:
'name'
,
children
:
'children'
,
disabled
(
data
,
node
)
{
return
(
(
that
.
isOnlyLeaf
&&
data
.
isParty
)
||
that
.
disabledValues
.
some
((
e
)
=>
e
==
(
data
.
userId
||
data
.
id
))
||
data
.
userId
===
''
)
return
(
that
.
isOnlyLeaf
&&
data
.
isParty
)
||
that
.
disabledValues
.
some
((
e
)
=>
e
==
(
data
.
userId
||
data
.
id
))
},
isLeaf
(
data
,
node
)
{
return
!
data
.
id
...
...
@@ -105,6 +104,45 @@
created
()
{},
mounted
()
{},
methods
:
{
setChange
(
e
)
{
if
(
!
e
)
{
this
.
searchState
=
false
this
.
$refs
.
tree
.
setCheckedKeys
(
this
.
userList
.
map
((
e
)
=>
e
.
userId
||
e
.
id
))
}
},
setSearch
()
{
if
(
!
this
.
keywords
)
return
this
.
searchResult
=
[]
this
.
searchState
=
true
this
.
checked
=
this
.
userList
.
map
((
dd
)
=>
{
return
dd
.
userId
})
getDeptUser
({
deptId
:
this
.
deptId
,
userName
:
this
.
keywords
}).
then
((
res
)
=>
{
this
.
searchResult
=
this
.
handleName
(
res
.
rows
)
})
},
setSelectChange
(
e
,
index
)
{
if
(
e
)
{
if
(
this
.
isSigleSelect
)
{
this
.
userList
[
0
]
=
this
.
searchResult
[
index
]
}
else
{
this
.
userList
.
push
(
this
.
searchResult
[
index
])
}
this
.
checked
=
this
.
userList
.
map
((
dd
)
=>
{
return
dd
.
userId
})
this
.
$forceUpdate
()
}
else
{
this
.
cancle
(
this
.
searchResult
[
index
].
userId
)
}
setTimeout
(()
=>
{
this
.
keywords
=
''
this
.
setChange
()
},
500
)
},
treeFormat
(
list
)
{
let
dealOptions
=
[]
list
.
forEach
((
one
)
=>
{
...
...
@@ -129,23 +167,16 @@
if
(
!
Array
.
isArray
(
this
.
defaultValues
)
||
this
.
defaultValues
.
length
==
0
)
{
this
.
userList
=
[]
}
console
.
log
(
this
.
defaultValues
)
getDeptTree
().
then
(({
data
})
=>
{
// data.forEach((element) => {
// element.key = createUniqueString()
// })
let
_data
=
this
.
handleTree
(
data
)
resolve
(
this
.
treeFormat
(
_data
)
)
// api.getList({ department: _data[0].id }).then(({ rows, total }) =>
{
// _data && rows.unshift(..._data);
// resolve(rows);
// });
let
value
=
this
.
treeFormat
(
_data
)
if
(
value
.
length
)
{
this
.
deptId
=
value
[
0
].
deptId
}
resolve
(
value
)
})
}
else
{
getDeptUser
({
deptId
:
node
.
data
.
id
}).
then
(({
rows
})
=>
{
// rows.forEach((element) => {
// element.key = createUniqueString()
// })
let
arr
=
this
.
handleName
(
rows
)
node
.
data
.
children
&&
arr
.
push
(...
node
.
data
.
children
)
resolve
(
arr
)
...
...
@@ -166,7 +197,7 @@
handleName
(
data
)
{
return
data
.
map
((
i
)
=>
{
if
(
i
.
userName
)
{
i
.
userId
=
i
.
weUserId
?
i
.
weUserId
:
''
i
.
userId
=
i
.
weUserId
i
.
name
=
i
.
userName
}
return
i
...
...
@@ -174,7 +205,6 @@
},
// 选择变化
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
// console.log(arguments)
if
(
checked
)
{
if
(
this
.
isSigleSelect
)
{
// 单选情况
...
...
@@ -189,11 +219,9 @@
!
isExist
&&
this
.
userList
.
push
(
data
)
}
}
else
{
// let index = this.userList.indexOf(data)
let
index
=
this
.
userList
.
findIndex
((
i
)
=>
i
.
userId
===
data
.
userId
)
index
>
-
1
&&
this
.
userList
.
splice
(
index
,
1
)
}
// console.log(data, checked, indeterminate);
this
.
userList
=
this
.
unique
(
this
.
userList
)
},
unique
(
arr
)
{
...
...
@@ -225,26 +253,48 @@
</
script
>
<
template
>
<el-dialog
:title=
"title"
:visible
.
sync=
"Pvisible"
:close-on-click-modal=
"false"
:destroy-on-close=
"destroyOnClose"
>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
class=
"content"
>
<el-col
:span=
"12"
:xs=
"24"
>
<div
class=
"head-container"
>
<el-tree
node-key=
"userId"
ref=
"tree"
lazy
accordion
show-checkbox
:check-on-click-node=
"false"
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
<!-- :default-checked-keys="
defaultValues.map((e) => (isOnlyLeaf ? e.userId : e.userId || e.id))
" -->
<div
class=
"search-input"
>
<el-input
size=
"mini"
v-model=
"keywords"
@
keyup
.
enter
.
native=
"setSearch"
placeholder=
"请输入员工名称"
clearable
@
change=
"setChange"
>
<el-button
slot=
"append"
icon=
"el-icon-search"
@
click=
"setSearch"
></el-button>
</el-input>
</div>
<div
class=
"search-list user-list"
v-show=
"searchState"
>
<el-checkbox-group
v-model=
"checked"
>
<el-row
v-for=
"(item, index) in searchResult"
:key=
"index"
>
<el-checkbox
:label=
"item.userId"
:key=
"index"
@
change=
"setSelectChange($event, index)"
>
<div>
{{
item
.
name
}}
</div>
</el-checkbox>
</el-row>
</el-checkbox-group>
</div>
<transition
name=
"fade"
>
<div
class=
"head-container"
v-show=
"!searchState"
>
<el-tree
node-key=
"userId"
ref=
"tree"
lazy
accordion
show-checkbox
:check-on-click-node=
"false"
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
</div>
</transition>
</el-col>
<el-col
:span=
"12"
:xs=
"24"
class=
"user-list"
>
<el-row
:gutter=
"10"
>
选择人员列表
</el-row>
...
...
@@ -263,9 +313,32 @@
</
template
>
<
style
lang=
"scss"
scoped
>
.content
{
min-height
:
400px
;
}
.search-input
{
margin-top
:
5px
;
margin-bottom
:
10px
;
}
.user-list
{
.el-row
{
line-height
:
26px
;
}
}
.search-list
{
margin-top
:
20px
;
padding
:
0
10px
;
}
.fade-enter-active
{
transition
:
opacity
0.5s
;
}
.fade-enter
{
opacity
:
0
;
}
.fade-leave-active
{
transition
:
opacity
0.5s
;
}
.fade-leave-to
{
opacity
:
0
;
}
</
style
>
linkwe-pc/src/views/conversation/security/setSensitiveWord.vue
View file @
fda702b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
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 post a comment