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 e9fecf97
authored
Jan 18, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'xxj-智能短链-2023.01.11'
2 parents
5012a143
160fca2f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
938 additions
and
8 deletions
linkwe-pc/src/api/intelligentShortLink.js
linkwe-pc/src/components/PhoneTemplate.vue
linkwe-pc/src/styles/element-ui.scss
linkwe-pc/src/views/intelligentShortLink/addEdit.vue
linkwe-pc/src/views/intelligentShortLink/components/Add.vue
linkwe-pc/src/views/intelligentShortLink/components/PhonePreview.vue
linkwe-pc/src/views/intelligentShortLink/components/mixin.js
linkwe-pc/src/views/intelligentShortLink/detail.vue
linkwe-pc/src/views/intelligentShortLink/index.vue
linkwe-pc/src/api/intelligentShortLink.js
0 → 100644
View file @
e9fecf9
import
request
from
'@/utils/request'
const
service
=
window
.
lwConfig
.
services
.
system
+
window
.
lwConfig
.
services
.
wecom
+
'/short/link'
// 智能短链
// 列表
export
function
getList
(
data
)
{
return
request
({
url
:
service
+
'/list'
,
params
:
data
,
})
}
// 详情
export
function
getDetail
(
id
)
{
return
request
({
url
:
service
+
'/get/'
+
id
,
})
}
// 删除
export
function
remove
(
id
)
{
return
request
({
url
:
service
+
'/delete/'
+
id
,
method
:
'DELETE'
,
})
}
// 新增
export
function
add
(
data
)
{
return
request
({
url
:
service
+
'/add'
,
method
:
'POST'
,
data
,
})
}
// 修改
export
function
update
(
data
)
{
return
request
({
url
:
service
+
'/update/'
+
id
,
method
:
'PUT'
,
data
,
})
}
// 短链数据统计(传ID查单个)
export
function
getAnalysis
(
id
)
{
return
request
({
url
:
service
+
'/data/statistics'
,
params
:
{
id
},
})
}
/**
* 短链折线统计
* {
beginTime,,string,false,,开始时间
endTime,,string,false,,结束时间
id,,integer,false,,主键id
}
*/
export
function
getLineAnalysis
(
data
)
{
return
request
({
url
:
service
+
'/line/statistics'
,
params
:
data
,
})
}
// 通过短链接获取短链详情
export
function
getDetailByUrl
(
shortUrl
)
{
return
request
({
url
:
service
+
'/getByShort/'
+
shortUrl
,
})
}
linkwe-pc/src/components/PhoneTemplate.vue
View file @
e9fecf9
...
...
@@ -29,30 +29,27 @@ export default {
margin
:
0
auto
;
padding
:
0
10px
;
position
:
relative
;
width
:
3
00
px
;
height
:
64
0px
;
width
:
3
75
px
;
height
:
80
0px
;
background
:
url(../assets/drainageCode/preview-bg.png)
;
background-repeat
:
no-repeat
;
background-size
:
100%
100%
;
.preview-title
{
position
:
absolute
;
top
:
37
px
;
top
:
55
px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
font-size
:
14px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#333333
;
}
.preview-content
{
position
:
relative
;
height
:
545px
;
height
:
calc
(
100%
-
120px
)
;
overflow-y
:
auto
;
top
:
70px
;
//
left
:
50%
;
//
transform
:
translateX
(
-50%
);
top
:
88px
;
border-bottom-left-radius
:
20px
;
border-bottom-right-radius
:
20px
;
}
...
...
linkwe-pc/src/styles/element-ui.scss
View file @
e9fecf9
...
...
@@ -221,3 +221,42 @@
border-radius
:
0
;
}
}
// 表单禁用详情数据展示
.form-detail
{
.el-input.is-disabled
.el-input__inner
,
.el-textarea.is-disabled
.el-textarea__inner
{
background-color
:
transparent
;
// border-color: transparent;
color
:
inherit
;
cursor
:
default
;
// &:hover {
// border-color: transparent;
// }
}
.el-radio__input.is-disabled
{
.el-radio__inner
{
background-color
:
#fff
;
border-color
:
#dcdfe6
;
cursor
:
default
;
}
+
span
.el-radio__label
{
color
:
inherit
;
cursor
:
default
;
}
&
.is-checked
.el-radio__inner
{
background-color
:
$blue
;
border-color
:
$blue
;
cursor
:
default
;
&
:
:
after
{
background-color
:
#fff
;
}
}
}
// 必填红 * 隐藏
.el-form-item.is-required
:not
(
.is-no-asterisk
)
>
.el-form-item__label
:before
{
display
:
none
;
}
}
linkwe-pc/src/views/intelligentShortLink/addEdit.vue
0 → 100644
View file @
e9fecf9
<
script
>
import
{
getDetail
,
add
,
update
}
from
'@/api/intelligentShortLink'
import
{
typeDict
,
touchTypeDict
}
from
'./components/mixin'
export
default
{
name
:
''
,
components
:
{
PhonePreview
:
()
=>
import
(
'./components/PhonePreview.vue'
),
Add
:
()
=>
import
(
'./components/Add'
),
},
data
()
{
return
{
loading
:
false
,
currentActive
:
0
,
form
:
{
jumpType
:
1
,
extensionType
:
1
,
type
:
0
,
avatar
:
''
,
qrCode
:
''
,
},
typeDict
,
touchTypeDict
,
data
:
{},
}
},
computed
:
{},
watch
:
{},
created
()
{},
mounted
()
{
this
.
clipboard
=
new
this
.
ClipboardJS
(
'.copy-btn'
)
},
destroyed
()
{
this
.
clipboard
.
destroy
()
},
methods
:
{
getDetail
()
{
this
.
loading
=
true
let
id
=
this
.
$route
.
query
.
id
getDetail
(
id
)
.
then
((
res
)
=>
{
this
.
form
=
res
})
.
catch
((
e
)
=>
{
console
.
log
(
e
)
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
submit
()
{
this
.
$refs
.
add
.
$refs
[
'form'
].
validate
((
validate
)
=>
{
if
(
validate
)
{
if
([
1
,
0
].
includes
(
this
.
form
.
type
))
{
this
.
form
.
touchType
=
this
.
form
.
type
+
1
}
else
{
delete
this
.
form
.
touchType
}
this
.
loading
=
true
;(
this
.
form
.
id
?
update
:
add
)(
this
.
form
)
.
then
((
res
)
=>
{
this
.
data
=
res
this
.
currentActive
++
})
.
catch
((
e
)
=>
{
console
.
log
(
e
)
})
.
finally
(()
=>
{
this
.
loading
=
false
})
}
})
},
download
()
{
const
name
=
this
.
form
.
shortLinkName
+
'.png'
const
link
=
document
.
createElement
(
'a'
)
// 创建a标签
link
.
href
=
this
.
data
.
shortUrl
link
.
download
=
name
// 重命名文件
link
.
click
()
},
},
}
</
script
>
<
template
>
<el-container
v-loading=
"loading"
>
<el-header
class=
"g-card g-pad20 mb10"
height=
"108px"
>
<el-steps
style=
"margin-top: 10px"
:active=
"currentActive"
align-center
>
<el-step
title=
"短链类型"
></el-step>
<el-step
title=
"内容设置"
></el-step>
<el-step
title=
"生成短链"
></el-step>
</el-steps>
</el-header>
<el-form
v-show=
"currentActive == 0"
label-suffix=
":"
label-width=
""
class=
"g-card g-pad20"
style=
"padding-right: 18%"
>
<el-form-item
label=
"跳转类型"
>
<el-radio-group
v-model=
"form.jumpType"
>
<el-radio-button
:label=
"1"
>
跳入微信
</el-radio-button>
<el-radio-button
:label=
"2"
>
跳出微信
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"推广类型"
>
<el-radio-group
v-model=
"form.extensionType"
>
<el-radio-button
v-for=
"(item, key) in typeDict"
:key=
"key"
:label=
"+key"
>
{{
item
.
name
}}
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"触达类型"
>
<el-radio-group
v-model=
"form.type"
>
<template
v-for=
"(item, key) in typeDict"
>
<div
v-show=
"form.extensionType == key"
:key=
"key"
>
<el-radio-button
v-for=
"(unit, unique) in item.touchType"
:key=
"key + '-' + unique"
:label=
"+unique"
>
{{
unit
.
name
}}
</el-radio-button>
</div>
</
template
>
</el-radio-group>
</el-form-item>
<div
class=
"g-card g-pad20"
style=
"background: #eee"
>
<span>
{{ touchTypeDict[form.type].tip }}
</span>
</div>
</el-form>
<div
v-show=
"currentActive == 1"
class=
"fxbw ais mt10"
style=
"overflow: auto"
>
<div
class=
"g-card g-pad20 mr10"
style=
"flex: auto"
>
<Add
ref=
"add"
:form=
"form"
/>
</div>
<PhonePreview
:data=
"form"
/>
</div>
<div
v-show=
"currentActive == 2"
class=
"g-card g-pad20 ac"
>
<i
class=
"el-icon-success"
style=
"font-size: 36px; color: #06c160; margin: 10px 0 20px"
></i>
<div
style=
""
>
短链创建成功,支持直接复制链接或下载短链二维码
</div>
<div
class=
"g-card g-pad20"
style=
"background: #eee; width: 50%; margin: 30px auto"
>
<span>
{{ data.shortUrl }}
</span>
</div>
<el-image
style=
"width: 120px; height: 120px"
:src=
"data.qrCode"
fit=
"fit"
></el-image>
<div>
<el-button
type=
"text"
class=
"copy-btn"
:data-clipboard-text=
"data.shortUrl"
>
复制链接
</el-button>
<el-button
type=
"text"
@
click=
"download(row)"
>
下载二维码
</el-button>
</div>
</div>
<el-footer
class=
"mt20 ar"
style=
"padding: 0"
height=
""
>
<
template
v-if=
"currentActive == 0"
>
<el-button
plain
@
click=
"$router.back()"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"currentActive++"
>
下一步
</el-button>
</
template
>
<
template
v-else-if=
"currentActive == 1"
>
<el-button
type=
"primary"
@
click=
"currentActive--"
>
上一步
</el-button>
<el-button
type=
"primary"
@
click=
"submit()"
>
生成短链
</el-button>
</
template
>
<
template
v-else-if=
"currentActive == 2"
>
<el-button
type=
"primary"
@
click=
"$router.back()"
>
完成
</el-button>
</
template
>
</el-footer>
</el-container>
</template>
<
style
lang=
"scss"
scoped
></
style
>
linkwe-pc/src/views/intelligentShortLink/components/Add.vue
0 → 100644
View file @
e9fecf9
<
script
>
import
{
touchTypeDict
}
from
'./mixin'
export
default
{
components
:
{},
props
:
{
form
:
{
type
:
Object
,
},
},
data
()
{
return
{
rules
:
{
shortLinkName
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
name
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
describe
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
longLink
:
[
{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
},
{
validator
(
rule
,
value
,
callback
)
{
if
(
value
&&
!
/^http/gi
.
test
(
value
))
callback
(
'链接格式错误,需以http(s)开头'
)
else
callback
()
},
trigger
:
'blur'
,
},
],
avatar
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'change'
}],
qrCode
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'change'
}],
qrCodeId
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'change'
}],
appId
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
secret
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}],
},
touchTypeDict
,
prefixFormLabel
:
Object
.
freeze
({
1
:
'公众号'
,
2
:
'微信'
,
3
:
'微信群'
,
10
:
'小程序'
,
}),
}
},
computed
:
{
isDetail
()
{
return
this
.
$route
.
path
.
endsWith
(
'/detail'
)
},
},
watch
:
{},
created
()
{},
mounted
()
{},
methods
:
{},
}
</
script
>
<
template
>
<div>
<el-form
:class=
"isDetail && 'form-detail'"
:disabled=
"isDetail"
ref=
"form"
:model=
"form"
label-suffix=
":"
label-width=
"140px"
:rules=
"rules"
>
<el-form-item
label=
"短链类型"
>
<span>
{{
touchTypeDict
[
form
.
type
].
allName
}}
</span>
</el-form-item>
<el-form-item
label=
"短链名称"
prop=
"shortLinkName"
>
<el-input
clearable
v-model=
"form.shortLinkName"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
<!-- 公众号文章 -->
<template
v-if=
"form.type == 0"
>
<el-form-item
prop=
"longLink"
label=
"公众号文章链接"
>
<!--
<template
v-if=
"isDetail"
>
{{
form
.
longLink
}}
</
template
>
<
template
v-else
>
</
template
>
-->
<el-input
clearable
v-model=
"form.longLink"
placeholder=
"请输入"
></el-input>
<div
v-if=
"!isDetail"
class=
"tips"
>
请在公众号后台文章发布列表页中获取并复制文章的永久链接
</div>
</el-form-item>
</template>
<!-- 公众号二维码,个人二维码,群二维码,小程序二维码 -->
<
template
v-else-if=
"Object.keys(prefixFormLabel).includes(form.type + '')"
>
<el-form-item
prop=
"name"
:label=
"prefixFormLabel[form.type] + '名称'"
>
<el-input
clearable
v-model=
"form.name"
placeholder=
"请输入"
maxlength=
"15"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"describe"
:label=
"prefixFormLabel[form.type] + '描述'"
>
<el-input
clearable
v-model=
"form.describe"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"avatar"
:label=
"prefixFormLabel[form.type] + '头像'"
>
<upload
class=
"image-uploader"
:fileUrl
.
sync=
"form.avatar"
></upload>
</el-form-item>
<el-form-item
prop=
"qrCode"
:label=
"prefixFormLabel[form.type] + '二维码'"
>
<upload
class=
"image-uploader"
:fileUrl
.
sync=
"form.qrCode"
></upload>
</el-form-item>
</
template
>
<!-- 员工活码,客群活码 -->
<
template
v-else-if=
"[4, 5].includes(+form.type)"
>
<el-form-item
prop=
"qrCodeId"
:label=
"'选择' + touchTypeDict[form.type].name"
>
<el-button
type=
"primary"
plain
@
click=
"choiceQqcode(form.type, '选择' + touchTypeDict[form.type].name)"
>
选择
{{
touchTypeDict
[
form
.
type
].
name
}}
</el-button>
</el-form-item>
</
template
>
<!-- 门店导购活码,门店群活码 -->
<
template
v-else-if=
"[6, 8].includes(+form.type)"
>
<el-form-item
prop=
"qrCodeId"
:label=
"touchTypeDict[form.type].name"
>
<el-button
type=
"primary"
plain
@
click=
"choiceQqcode(form.type, '选择' + touchTypeDict[form.type].name)"
>
暂无
{{
touchTypeDict
[
form
.
type
].
name
}}
,去配置
</el-button>
</el-form-item>
</
template
>
<!-- 个人小程序 -->
<
template
v-else-if=
"form.type == 7"
>
<el-form-item
prop=
"name"
label=
"小程序名称"
>
<el-input
clearable
v-model=
"form.name"
placeholder=
"请输入"
maxlength=
"15"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"avatar"
label=
"小程序头像"
>
<upload
class=
"image-uploader"
:fileUrl
.
sync=
"form.avatar"
></upload>
</el-form-item>
<el-form-item
prop=
"appId"
label=
"小程序AppID"
>
<el-input
clearable
v-model=
"form.appId"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"longLink"
label=
"小程序页面路径"
>
<el-input
clearable
v-model=
"form.longLink"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
</
template
>
<!-- 企业小程序 -->
<
template
v-else-if=
"form.type == 9"
>
<el-form-item
prop=
"name"
label=
"小程序名称"
>
<el-input
clearable
v-model=
"form.name"
placeholder=
"请输入"
maxlength=
"15"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"avatar"
label=
"小程序头像"
>
<upload
class=
"image-uploader"
:fileUrl
.
sync=
"form.avatar"
></upload>
</el-form-item>
<el-form-item
prop=
"appId"
label=
"小程序AppID"
>
<el-input
clearable
v-model=
"form.appId"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"secret"
label=
"小程序Secret"
>
<el-input
clearable
v-model=
"form.secret"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
""
label=
"小程序原始ID"
>
<el-input
clearable
v-model=
"form.name"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
<el-form-item
prop=
"longLink"
label=
"小程序页面路径"
>
<el-input
clearable
v-model=
"form.longLink"
placeholder=
"请输入"
maxlength=
"30"
show-word-limit
></el-input>
</el-form-item>
</
template
>
</el-form>
</div>
</template>
<
style
lang=
"scss"
scoped
>
.tips
{
color
:
#aaa
;
font-size
:
12px
;
}
</
style
>
linkwe-pc/src/views/intelligentShortLink/components/PhonePreview.vue
0 → 100644
View file @
e9fecf9
// 短链移动端样式预览
<
script
>
import
{
touchTypeDict
}
from
'./mixin'
export
default
{
name
:
''
,
components
:
{},
props
:
{
data
:
{
type
:
Object
,
default
:
{},
},
},
data
()
{
return
{
touchTypeDict
,
}
},
computed
:
{},
watch
:
{},
created
()
{},
mounted
()
{},
methods
:
{},
}
</
script
>
<
template
>
<div
class=
"g-card"
style=
"margin-top: 0"
>
<div
class=
"g-title"
>
预览
</div>
<div
class=
"g-pad20"
>
<PhoneTemplate
v-if=
"touchTypeDict[data.type]"
:title=
"touchTypeDict[data.type].previewMobileTitle"
>
<template
v-if=
"data.type == 0"
>
<div
class=
"mask"
style=
"position: absolute"
>
<div
class=
"cc ac g-card g-pad20"
style=
"width: 70%"
>
公众号文章示例
</div>
</div>
</
template
>
<
template
v-else-if=
"[7, 9, 10].includes(+data.type)"
>
<div
class=
"g-card g-pad20 cc ac"
style=
"width: 80%"
>
小程序
<el-image
style=
"width: 120px; height: 120px"
:src=
"data.avatar"
error=
"头像"
fit=
"fit"
></el-image>
<el-button
type=
"primary"
>
点击打开小程序
</el-button>
</div>
</
template
>
<
template
v-else
>
<div
class=
"g-card g-pad20 cc ac"
style=
"width: 80%"
>
<div
class=
"al bfc-o"
>
<el-image
class=
"fl mr10"
style=
"width: 50px; height: 50px"
:src=
"data.avatar"
error=
"头像"
fit=
"fit"
></el-image>
<div
class=
"toe"
>
{{
data
.
name
||
'名称'
}}
</div>
<div
class=
"tips mt20 toe"
>
{{
data
.
describe
||
'描述'
}}
</div>
</div>
<el-image
style=
"width: 120px; height: 120px; margin: 20px 0"
:src=
"data.qrCode"
fit=
"fit"
></el-image>
<div
class=
"mt20"
>
长按二维码
{{
touchTypeDict
[
data
.
type
].
previewMobileTitle
}}
</div>
</div>
</
template
>
</PhoneTemplate>
</div>
</div>
</template>
<
style
lang=
"scss"
scoped
></
style
>
linkwe-pc/src/views/intelligentShortLink/components/mixin.js
0 → 100644
View file @
e9fecf9
export
const
typeDict
=
Object
.
freeze
({
1
:
{
name
:
'公众号'
,
touchType
:
{
0
:
{
name
:
'文章'
,
allName
:
'跳入微信-公众号-文章'
,
tip
:
'跳转进入微信后,打开一篇公众号文章'
,
previewMobileTitle
:
'公众号标题'
,
},
1
:
{
name
:
'二维码'
,
allName
:
'跳入微信-公众号-二维码'
,
tip
:
'跳转进入微信后,展示一张公众号二维码,长按引导关注'
,
previewMobileTitle
:
'添加公众号'
,
},
},
},
2
:
{
name
:
'个人微信'
,
touchType
:
{
2
:
{
name
:
'个人二维码'
,
allName
:
'跳入微信-个人微信-个人二维码'
,
tip
:
'跳转进入微信后,展示一张个人二维码,长按扫码添加好友'
,
previewMobileTitle
:
'添加微信'
,
},
3
:
{
name
:
'群二维码'
,
allName
:
'跳入微信-个人微信-群二维码'
,
tip
:
'跳转进入微信后,展示一张微信群二维码,长按扫码入群'
,
previewMobileTitle
:
'添加微信群'
,
},
},
},
3
:
{
name
:
'企业微信'
,
touchType
:
{
4
:
{
name
:
'员工活码'
,
allName
:
'跳入微信-企业微信-员工活码'
,
tip
:
'跳转进入微信后,展示一张企微员工活码,长按扫码添加企业员工'
,
previewMobileTitle
:
'添加企业员工'
,
},
5
:
{
name
:
'客群活码'
,
allName
:
'跳入微信-企业微信-客群活码'
,
tip
:
'跳转进入微信后,展示一张企微客群活码,长按扫码入群'
,
previewMobileTitle
:
'添加企业客群'
,
},
6
:
{
name
:
'门店导购活码'
,
allName
:
'跳入微信-企业微信-门店导购码'
,
tip
:
'跳转进入微信后,展示一张门店导购码,长按扫码添加附近门店的导购'
,
previewMobileTitle
:
'添加门店导购'
,
},
8
:
{
name
:
'门店群活码'
,
allName
:
'跳入微信-企业微信-门店群活码'
,
tip
:
'跳转进入微信后,展示一张门店群活码,长按扫码进入附近的门店群'
,
previewMobileTitle
:
'添加门店群'
,
},
},
},
4
:
{
name
:
'小程序'
,
touchType
:
{
7
:
{
name
:
'个人小程序'
,
allName
:
'跳入微信-小程序-个人小程序'
,
tip
:
'跳转进入微信后,直接打开一个个人小程序'
,
previewMobileTitle
:
'打开小程序'
,
},
9
:
{
name
:
'企业小程序'
,
allName
:
'跳入微信-小程序-企业小程序'
,
tip
:
'跳转进入微信后,直接打开一个企业小程序'
,
previewMobileTitle
:
'打开小程序'
,
},
10
:
{
name
:
'小程序二维码'
,
allName
:
'跳入微信-小程序-小程序二维码'
,
tip
:
'跳转进入微信后,展示一张小程序二维码,长按扫码打开小程序'
,
previewMobileTitle
:
'打开小程序'
,
},
},
},
})
const
touchTypeDict
=
{}
Object
.
values
(
typeDict
).
forEach
((
element
)
=>
Object
.
assign
(
touchTypeDict
,
element
.
touchType
))
export
{
touchTypeDict
}
linkwe-pc/src/views/intelligentShortLink/detail.vue
0 → 100644
View file @
e9fecf9
<
script
>
import
{
getDetail
,
getLineAnalysis
,
getAnalysis
}
from
'@/api/intelligentShortLink'
export
default
{
name
:
''
,
components
:
{
TimeSearchTitle
:
()
=>
import
(
'@/components/common/TimeSearchTitle'
),
PhonePreview
:
()
=>
import
(
'./components/PhonePreview.vue'
),
CardGroupIndex
:
()
=>
import
(
'@/components/CardGroupIndex'
),
ChartLine
:
()
=>
import
(
'@/components/ChartLine'
),
Add
:
()
=>
import
(
'./components/Add'
),
},
data
()
{
return
{
loading
:
false
,
data
:
{},
cardData
:
[],
xData
:
[],
series
:
[],
}
},
computed
:
{},
watch
:
{},
created
()
{
let
id
=
this
.
$route
.
query
.
id
this
.
getDetail
(
id
)
this
.
getAnalysis
(
id
)
},
mounted
()
{},
methods
:
{
getDetail
(
id
)
{
this
.
loading
=
true
getDetail
(
id
)
.
then
(({
data
})
=>
{
this
.
data
=
data
})
.
catch
(()
=>
{})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
getAnalysis
(
id
)
{
this
.
loading
=
true
getAnalysis
()
.
then
(({
data
})
=>
{
this
.
cardData
=
[
{
title
:
'访问总数(pv)'
,
tips
:
'短链页面访问的总次数'
,
value
:
data
.
pvTotalCount
,
},
{
title
:
'访问总人数(uv)'
,
tips
:
'短链页面访问的独立IP数'
,
value
:
data
.
uvTotalCount
,
},
{
title
:
'小程序打开数'
,
tips
:
'小程序成功打开的总次数'
,
value
:
data
.
openTotalCount
,
},
{
title
:
'今日访问总数(pv)'
,
tips
:
'今日短链页面访问的总次数'
,
value
:
data
.
pvTodayCount
,
title1
:
'较昨日'
,
value1
:
data
.
pvDiff
,
},
{
title
:
'今日访问总人数(uv)'
,
tips
:
'今日短链页面访问的独立IP数'
,
value
:
data
.
uvTodayCount
,
title1
:
'较昨日'
,
value1
:
data
.
uvDiff
,
},
{
title
:
'今日小程序打开数'
,
tips
:
'今日小程序成功打开的总次数'
,
value
:
data
.
openTodayCount
,
title1
:
'较昨日'
,
value1
:
data
.
openDiff
,
},
]
})
.
catch
((
e
)
=>
{
console
.
log
(
e
)
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
getLineAnalysis
(
data
)
{
let
query
=
{
id
:
this
.
$route
.
query
.
id
,
beginTime
:
data
.
beginTime
,
endTime
:
data
.
endTime
,
}
getLineAnalysis
(
query
).
then
(({
data
})
=>
{
this
.
series
=
[]
this
.
xData
=
data
.
xaxis
this
.
series
=
data
.
yaxis
// this.series.push(data.map((e) => e.pvTodayCount))
// this.series.push(data.map((e) => e.uvTodayCount))
// this.series.push(data.map((e) => e.openTodayCount))
})
},
},
}
</
script
>
<
template
>
<div
class=
"fxbw ais"
>
<div
class=
"pr10"
style=
"flex: auto; overflow: hidden"
>
<div
class=
"g-title fxbw"
>
短链内容
<el-button
type=
"primary"
class=
"fr"
@
click=
"$router.push(
{ path: './addEdit', query: { id: data.id } })">
编辑
</el-button>
</div>
<div
class=
"g-card g-pad20"
>
<Add
:form=
"data"
/>
</div>
<div
class=
"g-title mt20 mb10"
>
数据趋势
</div>
<CardGroupIndex
:data=
"cardData"
></CardGroupIndex>
<div
class=
"g-card g-pad20"
style=
"margin-top: 0"
>
<TimeSearchTitle
@
search=
"getLineAnalysis"
></TimeSearchTitle>
<ChartLine
:xData=
"xData"
:legend=
"['访问总数(pv)', '访问总人数(uv)', '小程序打开数']"
:series=
"series"
></ChartLine>
</div>
</div>
<PhonePreview
:data=
"data"
/>
</div>
</
template
>
<
style
lang=
"scss"
scoped
></
style
>
linkwe-pc/src/views/intelligentShortLink/index.vue
0 → 100644
View file @
e9fecf9
<
script
>
import
{
getList
,
getAnalysis
,
remove
}
from
'@/api/intelligentShortLink'
import
{
touchTypeDict
}
from
'./components/mixin'
export
default
{
name
:
''
,
components
:
{
CardGroupIndex
:
()
=>
import
(
'@/components/CardGroupIndex'
),
},
data
()
{
return
{
loading
:
false
,
cardData
:
[],
total
:
0
,
query
:
{
pageSize
:
10
,
pageNum
:
1
,
},
touchTypeDict
,
dictStatus
:
Object
.
freeze
({
1
:
'启用'
,
2
:
'关闭'
,
}),
list
:
[],
ids
:
[],
}
},
computed
:
{},
watch
:
{},
created
()
{
this
.
getList
()
this
.
getAnalysis
()
this
.
$store
.
dispatch
(
'app/setBusininessDesc'
,
` <div>生成智能短链,一键跳转公众号、小程序、企业微信</div> `
)
},
mounted
()
{
this
.
clipboard
=
new
this
.
ClipboardJS
(
'.copy-btn'
)
},
destroyed
()
{
this
.
clipboard
.
destroy
()
},
methods
:
{
getAnalysis
()
{
this
.
loading
=
true
getAnalysis
()
.
then
(({
data
})
=>
{
this
.
cardData
=
[
{
title
:
'访问总数(pv)'
,
tips
:
'短链页面访问的总次数'
,
value
:
data
.
pvTotalCount
,
},
{
title
:
'访问总人数(uv)'
,
tips
:
'短链页面访问的独立IP数'
,
value
:
data
.
uvTotalCount
,
},
{
title
:
'小程序打开数'
,
tips
:
'小程序成功打开的总次数'
,
value
:
data
.
openTotalCount
,
},
{
title
:
'今日访问总数(pv)'
,
tips
:
'今日短链页面访问的总次数'
,
value
:
data
.
pvTodayCount
,
title1
:
'较昨日'
,
value1
:
data
.
pvDiff
,
},
{
title
:
'今日访问总人数(uv)'
,
tips
:
'今日短链页面访问的独立IP数'
,
value
:
data
.
uvTodayCount
,
title1
:
'较昨日'
,
value1
:
data
.
uvDiff
,
},
{
title
:
'今日小程序打开数'
,
tips
:
'今日小程序成功打开的总次数'
,
value
:
data
.
openTodayCount
,
title1
:
'较昨日'
,
value1
:
data
.
openDiff
,
},
]
})
.
catch
((
e
)
=>
{
console
.
log
(
e
)
})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
getList
(
page
)
{
page
&&
(
this
.
query
.
pageNum
=
page
)
this
.
loading
=
true
getList
(
this
.
query
)
.
then
(({
rows
,
total
})
=>
{
this
.
list
=
rows
this
.
total
=
+
total
})
.
catch
(()
=>
{})
.
finally
(()
=>
{
this
.
loading
=
false
})
},
resetForm
()
{
this
.
$refs
[
'queryForm'
].
resetFields
()
this
.
getList
(
1
)
},
goRoute
(
row
=
{},
detail
)
{
let
{
id
}
=
row
this
.
$router
.
push
({
path
:
'./'
+
(
detail
||
'addEdit'
),
query
:
{
id
},
})
},
remove
(
id
)
{
const
ids
=
id
||
this
.
ids
+
''
this
.
$confirm
(
'是否确认删除吗?'
,
'警告'
,
{
type
:
'warning'
,
})
.
then
(
function
()
{
return
remove
(
ids
)
})
.
then
(()
=>
{
this
.
getList
()
this
.
msgSuccess
(
'删除成功'
)
})
},
},
}
</
script
>
<
template
>
<div>
<CardGroupIndex
:data=
"cardData"
></CardGroupIndex>
<el-form
ref=
"queryForm"
:inline=
"true"
:model=
"query"
class=
"top-search"
>
<el-form-item
label=
""
prop=
"shortLinkName"
>
<el-input
clearable
v-model=
"query.shortLinkName"
placeholder=
"请输入"
></el-input>
</el-form-item>
<el-form-item
label=
""
prop=
"type"
>
<el-select
clearable
v-model=
"query.type"
placeholder=
"请选择"
>
<el-option
v-for=
"(item, index) in touchTypeDict"
:key=
"index"
:label=
"item.allName"
:value=
"+index"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
""
prop=
"status"
>
<el-select
clearable
v-model=
"query.status"
placeholder=
"请选择"
>
<el-option
v-for=
"(item, index) in dictStatus"
:key=
"index"
:label=
"item"
:value=
"+index"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
""
>
<el-button
type=
"primary"
@
click=
"getList(1)"
>
查询
</el-button>
<el-button
type=
"success"
@
click=
"resetForm()"
>
重置
</el-button>
</el-form-item>
<el-form-item
class=
"fr"
>
<el-button
type=
"primary"
class=
"mr10"
@
click=
"goRoute()"
>
新建短链
</el-button>
<el-button
:disabled=
"!ids.length"
type=
"danger"
@
click=
"remove()"
>
批量删除
</el-button>
</el-form-item>
</el-form>
<el-table
v-loading=
"loading"
:data=
"list"
@
selection-change=
"(val) => (ids = val.map((e) => e.id))"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
></el-table-column>
<el-table-column
label=
"短链名称"
align=
"center"
prop=
"shortLinkName"
show-overflow-tooltip
/>
<el-table-column
label=
"类型"
align=
"center"
prop=
"type"
>
<template
slot-scope=
"
{ row }">
{{
touchTypeDict
[
row
.
type
+
''
].
allName
}}
</
template
>
</el-table-column>
<el-table-column
label=
"短链地址"
align=
"center"
prop=
"consultTotalCnt"
show-overflow-tooltip
>
<
template
slot-scope=
"{ row }"
>
<span>
{{
row
.
shortLink
}}
</span>
<i
class=
"el-icon-copy-document copy-btn ml20 cp"
title=
"复制"
:data-clipboard-text=
"row.shortLink"
></i>
</
template
>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
prop=
"status"
>
<
template
slot-scope=
"{ row }"
>
{{
dictStatus
[
row
.
status
+
''
]
}}
</
template
>
</el-table-column>
<el-table-column
label=
"最后更新时间"
align=
"center"
prop=
"updateTime"
show-overflow-tooltip
></el-table-column>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
slot-scope=
"{ row }"
>
<el-button
type=
"text"
@
click=
"goRoute(row, 'detail')"
>
详情|统计
</el-button>
<el-button
type=
"text"
@
click=
"goRoute(row)"
>
编辑
</el-button>
<el-button
@
click=
"remove(row.id)"
type=
"text"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
:total=
"total"
:page
.
sync=
"query.pageNum"
:limit
.
sync=
"query.pageSize"
@
pagination=
"getList()"
/>
</div>
</template>
<
style
lang=
"scss"
scoped
>
.el-icon-copy-document
{
&:hover
{
color
:
$
blue
;
}
}
</
style
>
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