Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
mgm-growth-admin-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8a796e68
authored
2019-09-18 12:14:10 +0800
by
joe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
管理端增加小程序跳转配置
1 parent
2422e4ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
469 additions
and
347 deletions
package-lock.json
src/api/api.js
src/pages/classroom/ArticleManager.vue
src/pages/classroom/BannerManager.vue
package-lock.json
View file @
8a796e6
...
...
@@ -325,7 +325,8 @@
"version"
:
"1.0.0"
,
"resolved"
:
"http://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz"
,
"integrity"
:
"sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"assign-symbols"
:
{
"version"
:
"1.0.0"
,
...
...
@@ -1972,6 +1973,7 @@
"resolved"
:
"http://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.7.tgz"
,
"integrity"
:
"sha1-LR0kMXr7ir6V1tLAsHtXgTU52Cg="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"delayed-stream"
:
"~1.0.0"
}
...
...
@@ -2763,7 +2765,8 @@
"version"
:
"1.0.0"
,
"resolved"
:
"http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz"
,
"integrity"
:
"sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"depd"
:
{
"version"
:
"1.1.2"
,
...
...
@@ -3531,7 +3534,8 @@
"version"
:
"1.3.0"
,
"resolved"
:
"http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz"
,
"integrity"
:
"sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"fast-deep-equal"
:
{
"version"
:
"1.1.0"
,
...
...
@@ -3870,7 +3874,8 @@
"ansi-regex"
:
{
"version"
:
"2.1.1"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"aproba"
:
{
"version"
:
"1.2.0"
,
...
...
@@ -3891,12 +3896,14 @@
"balanced-match"
:
{
"version"
:
"1.0.0"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"brace-expansion"
:
{
"version"
:
"1.1.11"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"balanced-match"
:
"^1.0.0"
,
"concat-map"
:
"0.0.1"
...
...
@@ -3911,17 +3918,20 @@
"code-point-at"
:
{
"version"
:
"1.1.0"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"concat-map"
:
{
"version"
:
"0.0.1"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"console-control-strings"
:
{
"version"
:
"1.1.0"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"core-util-is"
:
{
"version"
:
"1.0.2"
,
...
...
@@ -4038,7 +4048,8 @@
"inherits"
:
{
"version"
:
"2.0.3"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"ini"
:
{
"version"
:
"1.3.5"
,
...
...
@@ -4050,6 +4061,7 @@
"version"
:
"1.0.0"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"number-is-nan"
:
"^1.0.0"
}
...
...
@@ -4064,6 +4076,7 @@
"version"
:
"3.0.4"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"brace-expansion"
:
"^1.1.7"
}
...
...
@@ -4071,12 +4084,14 @@
"minimist"
:
{
"version"
:
"0.0.8"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"minipass"
:
{
"version"
:
"2.2.4"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"safe-buffer"
:
"^5.1.1"
,
"yallist"
:
"^3.0.0"
...
...
@@ -4095,6 +4110,7 @@
"version"
:
"0.5.1"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"minimist"
:
"0.0.8"
}
...
...
@@ -4175,7 +4191,8 @@
"number-is-nan"
:
{
"version"
:
"1.0.1"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"object-assign"
:
{
"version"
:
"4.1.1"
,
...
...
@@ -4187,6 +4204,7 @@
"version"
:
"1.4.0"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"wrappy"
:
"1"
}
...
...
@@ -4272,7 +4290,8 @@
"safe-buffer"
:
{
"version"
:
"5.1.1"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"safer-buffer"
:
{
"version"
:
"2.1.2"
,
...
...
@@ -4308,6 +4327,7 @@
"version"
:
"1.0.2"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"code-point-at"
:
"^1.0.0"
,
"is-fullwidth-code-point"
:
"^1.0.0"
,
...
...
@@ -4327,6 +4347,7 @@
"version"
:
"3.0.1"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-regex"
:
"^2.0.0"
}
...
...
@@ -4370,12 +4391,14 @@
"wrappy"
:
{
"version"
:
"1.0.2"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"yallist"
:
{
"version"
:
"3.0.2"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
}
}
},
...
...
@@ -5589,7 +5612,8 @@
"version"
:
"0.1.1"
,
"resolved"
:
"http://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz"
,
"integrity"
:
"sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"jsesc"
:
{
"version"
:
"1.3.0"
,
...
...
@@ -10765,7 +10789,8 @@
"version"
:
"0.14.5"
,
"resolved"
:
"http://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz"
,
"integrity"
:
"sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"type-check"
:
{
"version"
:
"0.3.2"
,
...
...
src/api/api.js
View file @
8a796e6
...
...
@@ -189,3 +189,38 @@ export const dashboardExport = params => {
console
.
log
(
"url:"
,
url
);
window
.
open
(
url
)
};
export
const
request
=
{
post
(
url
,
data
)
{
return
axios
.
post
(
`
${
base
}${
url
}
`
,
data
);
},
get
(
url
,
data
)
{
return
axios
.
get
(
`
${
base
}${
url
}
`
,
{
params
:
data
});
},
form
(
url
,
params
)
{
let
formData
=
new
FormData
();
//使用formData对象
for
(
let
key
in
params
)
{
formData
.
append
(
key
,
params
[
key
]);
}
let
requestUrl
=
url
.
indexOf
(
"://"
)
>=
0
?
`
${
url
}
`
:
`
${
base
}${
url
}
`
;
return
axios
.
post
(
requestUrl
,
formData
,
formDataHeaders
)
},
build
(
url
,
params
)
{
let
fullUrl
=
`
${
base
}${
url
}
`
;
let
split
=
""
;
for
(
let
key
in
params
)
{
if
(
split
)
{
split
=
"&"
;
}
else
{
split
=
"?"
}
fullUrl
+=
split
+
key
+
"="
+
params
[
key
];
}
return
fullUrl
;
},
requestDomain
()
{
return
`
${
base
}
`
}
/*test*/
};
\ No newline at end of file
...
...
src/pages/classroom/ArticleManager.vue
View file @
8a796e6
...
...
@@ -27,6 +27,9 @@
style=
"width: 100%;"
>
<el-table-column
prop=
"title"
label=
"标题"
></el-table-column>
<el-table-column
label=
"所属分类"
>
<template
slot-scope=
"scope"
>
{{
formatClassify
(
scope
.
row
)
}}
</
template
>
</el-table-column>
<!-- <el-table-column prop="thumb" label="封面"></el-table-column> -->
<el-table-column
label=
"封面图"
>
<
template
slot-scope=
"scope"
>
...
...
@@ -161,6 +164,7 @@ export default {
classifyDialogList
:
[],
tagList
:
[]
},
classifyMap
:
{},
listLoading
:
false
,
editLoading
:
false
,
editFormVisible
:
false
,
...
...
@@ -294,6 +298,9 @@ export default {
this
.
$set
(
this
.
totalData
,
'classifyDialogList'
,
content
)
//深复制
let
content2
=
Object
.
assign
([],
content
)
content2
.
forEach
(
element
=>
{
this
.
classifyMap
[
element
.
classify
]
=
element
.
name
;
});
content2
.
unshift
({
classify
:
''
,
dispayType
:
''
,
...
...
@@ -330,6 +337,9 @@ export default {
this
.
reqTagList
()
console
.
log
(
'editForm:'
,
this
.
editForm
)
},
formatClassify
(
data
)
{
return
this
.
classifyMap
[
data
.
classify
];
},
deleteHandler
(
index
,
row
)
{
let
data
=
{
articleCode
:
row
.
articleCode
...
...
src/pages/classroom/BannerManager.vue
View file @
8a796e6
<
template
>
<div>
<!--工具条-->
<el-col
:span=
"24"
class=
"toolbar"
style=
"padding-bottom: 0px;"
>
<el-form>
<el-form-item>
<div
class=
"tool-wrap fl"
>
<el-select
v-model=
"curClassify"
placeholder=
"请选择"
@
change=
"HandleSelectChange"
>
<el-option
v-for=
"(item,index) in totalData.classifyList"
:key=
"index"
:label=
"item.name"
:value=
"item.classify"
></el-option>
</el-select>
<el-button
@
click=
"handleAdd()"
v-if=
"true"
type=
"primary"
>
新增
</el-button>
</div>
</el-form-item>
</el-form>
</el-col>
<div>
<!--工具条-->
<el-col
:span=
"24"
class=
"toolbar"
style=
"padding-bottom: 0px;"
>
<el-form>
<el-form-item>
<div
class=
"tool-wrap fl"
>
<el-select
v-model=
"curClassify"
placeholder=
"请选择"
@
change=
"HandleSelectChange"
>
<el-option
v-for=
"(item,index) in totalData.classifyList"
:key=
"index"
:label=
"item.name"
:value=
"item.classify"
></el-option>
</el-select>
<el-button
@
click=
"handleAdd()"
v-if=
"true"
type=
"primary"
>
新增
</el-button>
</div>
</el-form-item>
</el-form>
</el-col>
<!-- 列表 -->
<el-table
:data=
"totalData.dataList"
highlight-current-row
v-loading=
"listLoading"
style=
"width: 100%;"
>
<el-table-column
label=
"缩略图"
>
<template
slot-scope=
"scope"
>
<img
class=
"poster"
:src=
"scope.row.bannerPic"
alt
>
</
template
>
</el-table-column>
<el-table-column
prop=
"link"
label=
"跳转链接"
></el-table-column>
<!-- 列表 -->
<el-table
:data=
"totalData.dataList"
highlight-current-row
v-loading=
"listLoading"
style=
"width: 100%;"
>
<el-table-column
label=
"缩略图"
>
<template
slot-scope=
"scope"
>
<img
class=
"poster"
:src=
"scope.row.bannerPic"
alt
/>
</
template
>
</el-table-column>
<el-table-column
label=
"所属分类"
>
<
template
slot-scope=
"scope"
>
{{
formatClassify
(
scope
.
row
)
}}
</
template
>
</el-table-column>
<el-table-column
label=
"跳转方式"
>
<
template
slot-scope=
"scope"
>
{{
formatJumpType
(
scope
.
row
)
}}
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
:width=
"curClassify ? 300 : 150"
>
<
template
slot-scope=
"scope"
>
<el-button
v-if=
"curClassify"
size=
"small"
@
click=
"upHandler(scope.$index, scope.row)"
>
上移
</el-button>
<el-button
v-if=
"curClassify"
size=
"small"
@
click=
"downHandler(scope.$index, scope.row)"
>
下移
</el-button>
<el-button
size=
"small"
@
click=
"modifyHandler(scope.$index, scope.row)"
>
修改
</el-button>
<el-button
size=
"small"
type=
"danger"
@
click=
"deleteHandler(scope.$index, scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-table-column
label=
"跳转路径"
min-width=
"200px"
>
<
template
slot-scope=
"scope"
>
<div
v-if=
"scope.row.linkType == 'minipro'"
>
{{
scope
.
row
.
miniproAppId
}}
</div>
<div>
{{
scope
.
row
.
link
}}
</div>
</
template
>
</el-table-column>
<!--编辑界面-->
<el-dialog
:title=
"dialogTitle"
:visible
.
sync=
"editFormVisible"
:close-on-click-modal=
"false"
>
<el-form
:model=
"editForm"
label-width=
"80px"
:rules=
"editFormRules"
ref=
"editForm"
>
<el-form-item
label=
"分类"
prop=
"classify"
>
<el-select
v-model=
"editForm.classify"
placeholder=
"请选择"
@
change=
"HandleSelectDialogChange"
>
<el-option
v-for=
"(item,index) in totalData.classifyDialogList"
:key=
"index"
:label=
"item.name"
:value=
"item.classify"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"头图"
prop=
"pic"
>
<img
class=
"upload-poster-image"
v-show=
"editForm.bannerPic"
:src=
"editForm.bannerPic"
alt
>
<upload-item
pid=
"p1"
v-on:upload-success=
"onUploadSuccess"
></upload-item>
<!-- <el-input v-model="editForm.pic"></el-input> -->
</el-form-item>
<el-table-column
label=
"操作"
:width=
"curClassify ? 300 : 150"
>
<
template
slot-scope=
"scope"
>
<el-button
v-if=
"curClassify"
size=
"small"
@
click=
"upHandler(scope.$index, scope.row)"
>
上移
</el-button>
<el-button
v-if=
"curClassify"
size=
"small"
@
click=
"downHandler(scope.$index, scope.row)"
>
下移
</el-button>
<el-button
size=
"small"
@
click=
"modifyHandler(scope.$index, scope.row)"
>
修改
</el-button>
<el-button
size=
"small"
type=
"danger"
@
click=
"deleteHandler(scope.$index, scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-form-item
label=
"跳转链接"
prop=
"link"
>
<el-input
v-model=
"editForm.link"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click
.
native=
"editFormVisible = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click
.
native=
"editSubmit"
:loading=
"editLoading"
>
提交
</el-button>
</div>
</el-dialog>
<!--编辑界面-->
<el-dialog
:title=
"dialogTitle"
:visible
.
sync=
"editFormVisible"
:close-on-click-modal=
"false"
>
<el-form
:model=
"editForm"
label-width=
"80px"
:rules=
"editFormRules"
ref=
"editForm"
>
<el-form-item
label=
"分类"
prop=
"classify"
>
<el-select
v-model=
"editForm.classify"
placeholder=
"请选择"
@
change=
"HandleSelectDialogChange"
>
<el-option
v-for=
"(item,index) in totalData.classifyDialogList"
:key=
"index"
:label=
"item.name"
:value=
"item.classify"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"头图"
prop=
"pic"
>
<img
class=
"upload-poster-image"
v-show=
"editForm.bannerPic"
:src=
"editForm.bannerPic"
alt
/>
<upload-item
pid=
"p1"
v-on:upload-success=
"onUploadSuccess"
></upload-item>
<!-- <el-input v-model="editForm.pic"></el-input> -->
</el-form-item>
<!--分页导航-->
<el-col
:span=
"24"
class=
"toolbar fl pagination-wrap"
>
<div
class=
"page-tips"
>
总共{{total}}条记录,每页{{pageSize}}条,总共{{pageNum}}页
</div>
<el-pagination
layout=
"prev, pager, next"
@
current-change=
"handleCurrentChange"
:page-size=
"pageSize"
:total=
"total"
style=
"float:right;"
></el-pagination>
</el-col>
</div>
<el-form-item
label=
"跳转类型"
prop=
"linkType"
>
<el-select
v-model=
"editForm.linkType"
placeholder=
"请选择"
>
<el-option
v-for=
"(item,index) in jumpTypeList"
:key=
"index"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"小程序ID"
prop=
"miniproAppId"
v-if=
"editForm.linkType == 'minipro'"
>
<el-input
v-model=
"editForm.miniproAppId"
></el-input>
</el-form-item>
<el-form-item
label=
"跳转链接"
prop=
"link"
v-if=
"editForm.linkType != 'none'"
>
<el-input
v-model=
"editForm.link"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click
.
native=
"editFormVisible = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click
.
native=
"editSubmit"
:loading=
"editLoading"
>
提交
</el-button>
</div>
</el-dialog>
<!--分页导航-->
<el-col
:span=
"24"
class=
"toolbar fl pagination-wrap"
>
<div
class=
"page-tips"
>
总共{{total}}条记录,每页{{pageSize}}条,总共{{pageNum}}页
</div>
<el-pagination
layout=
"prev, pager, next"
@
current-change=
"handleCurrentChange"
:page-size=
"pageSize"
:total=
"total"
style=
"float:right;"
></el-pagination>
</el-col>
</div>
</template>
<
script
>
import
{
getClassifyList
,
getBannerList
,
saveBanner
,
deleteBanner
,
changeBanner
}
from
'../../api/api.js'
import
UploadItem
from
'../../components/UploadItem'
getClassifyList
,
getBannerList
,
saveBanner
,
deleteBanner
,
changeBanner
,
request
}
from
"../../api/api.js"
;
import
UploadItem
from
"../../components/UploadItem"
;
export
default
{
data
()
{
return
{
key
:
'value'
,
page
:
1
,
pageSize
:
10
,
total
:
0
,
totalData
:
{
dataList
:
[],
classifyList
:
[],
classifyDialogList
:
[]
},
listLoading
:
false
,
editLoading
:
false
,
editFormVisible
:
false
,
dialogTitle
:
'编辑'
,
//编辑界面数据
editForm
:
{
bannerPic
:
''
,
link
:
''
,
classify
:
''
},
editFormRules
:
{
bannerPic
:
[
{
required
:
true
,
message
:
'请输入头图地址'
,
trigger
:
'blur'
}
],
link
:
[
{
required
:
true
,
message
:
'请输入跳转链接'
,
trigger
:
'blur'
}
],
classify
:
[
{
required
:
true
,
message
:
'请选择分类'
,
trigger
:
'blur'
}
]
},
curClassify
:
''
data
()
{
return
{
key
:
"value"
,
page
:
1
,
pageSize
:
10
,
total
:
0
,
totalData
:
{
dataList
:
[],
classifyList
:
[],
classifyDialogList
:
[]
},
classifyMap
:
{},
jumpType
:
{},
jumpTypeList
:
[
{
label
:
"无跳转"
,
value
:
"none"
},
{
label
:
"网页"
,
value
:
"web"
},
{
label
:
"小程序"
,
value
:
"minipro"
}
],
listLoading
:
false
,
editLoading
:
false
,
editFormVisible
:
false
,
dialogTitle
:
"编辑"
,
//编辑界面数据
editForm
:
{
bannerCode
:
""
,
bannerPic
:
""
,
link
:
""
,
classify
:
""
,
linkType
:
""
,
miniproAppId
:
""
},
editFormRules
:
{
bannerPic
:
[
{
required
:
true
,
message
:
"请输入头图地址"
,
trigger
:
"blur"
}
],
link
:
[
{
required
:
true
,
message
:
"请输入跳转链接"
,
trigger
:
"blur"
}
],
miniproAppId
:
[
{
required
:
true
,
message
:
"请输入小程序ID"
,
trigger
:
"blur"
}
],
classify
:
[{
required
:
true
,
message
:
"请选择分类"
,
trigger
:
"blur"
}]
},
curClassify
:
""
};
},
computed
:
{
pageNum
()
{
return
Math
.
ceil
(
this
.
total
/
this
.
pageSize
);
}
},
methods
:
{
name
()
{},
onUploadSuccess
(
evtAny
)
{
let
{
pid
,
url
}
=
evtAny
;
if
(
pid
==
"p1"
)
{
this
.
$set
(
this
.
editForm
,
"bannerPic"
,
url
);
}
else
if
(
pid
==
"v1"
)
{
// this.$set(this.editForm, 'vedioUrl', url)
}
},
computed
:
{
pageNum
()
{
return
Math
.
ceil
(
this
.
total
/
this
.
pageSize
)
}
// 获取列表
reqQuery
()
{
let
data
=
{
page
:
this
.
page
,
size
:
this
.
pageSize
,
classify
:
this
.
curClassify
};
getBannerList
(
data
).
then
(
result
=>
{
let
{
content
,
code
}
=
result
;
let
{
list
,
total
}
=
content
;
this
.
total
=
total
;
this
.
$set
(
this
.
totalData
,
"dataList"
,
list
);
console
.
log
(
"this.totalData:"
,
this
.
totalData
.
dataList
);
});
},
reqGetClassifyList
()
{
let
data
=
{};
getClassifyList
(
data
)
.
then
(
result
=>
{
let
{
content
,
code
}
=
result
;
this
.
$set
(
this
.
totalData
,
"classifyDialogList"
,
content
);
//深复制
let
content2
=
Object
.
assign
([],
content
);
content2
.
forEach
(
element
=>
{
this
.
classifyMap
[
element
.
classify
]
=
element
.
name
;
});
content2
.
unshift
({
classify
:
""
,
dispayType
:
""
,
name
:
"全部"
});
this
.
$set
(
this
.
totalData
,
"classifyList"
,
content2
);
this
.
reqQuery
();
})
.
catch
(
err
=>
{});
},
upHandler
(
index
,
row
)
{
let
lastItem
=
this
.
totalData
.
dataList
[
index
-
1
];
let
curItem
=
this
.
totalData
.
dataList
[
index
];
this
.
changeDataHandler
(
lastItem
,
curItem
);
},
downHandler
(
index
,
row
)
{
let
lastItem
=
this
.
totalData
.
dataList
[
index
+
1
];
let
curItem
=
this
.
totalData
.
dataList
[
index
];
this
.
changeDataHandler
(
lastItem
,
curItem
);
},
changeDataHandler
(
lastItem
,
curItem
)
{
console
.
log
(
"lastItem:"
,
lastItem
);
console
.
log
(
"curItem:"
,
curItem
);
if
(
lastItem
&&
curItem
)
{
let
data
=
{
lbc
:
lastItem
.
bannerCode
,
rbc
:
curItem
.
bannerCode
};
changeBanner
(
data
)
.
then
(
result
=>
{
this
.
$notify
({
title
:
"成功"
,
message
:
"操作成功"
,
type
:
"success"
});
this
.
reqQuery
();
})
.
catch
(
err
=>
{});
}
},
methods
:
{
name
()
{},
onUploadSuccess
(
evtAny
)
{
let
{
pid
,
url
}
=
evtAny
if
(
pid
==
'p1'
)
{
this
.
$set
(
this
.
editForm
,
'bannerPic'
,
url
)
}
else
if
(
pid
==
'v1'
)
{
// this.$set(this.editForm, 'vedioUrl', url)
}
},
// 获取列表
reqQuery
()
{
let
data
=
{
page
:
this
.
page
,
size
:
this
.
pageSize
,
classify
:
this
.
curClassify
}
getBannerList
(
data
).
then
(
result
=>
{
let
{
content
,
code
}
=
result
let
{
list
,
total
}
=
content
this
.
total
=
total
this
.
$set
(
this
.
totalData
,
'dataList'
,
list
)
console
.
log
(
'this.totalData:'
,
this
.
totalData
.
dataList
)
})
},
reqGetClassifyList
()
{
let
data
=
{}
getClassifyList
(
data
)
.
then
(
result
=>
{
let
{
content
,
code
}
=
result
this
.
$set
(
this
.
totalData
,
'classifyDialogList'
,
content
)
//深复制
let
content2
=
Object
.
assign
([],
content
)
content2
.
unshift
({
classify
:
''
,
dispayType
:
''
,
name
:
'全部'
})
this
.
$set
(
this
.
totalData
,
'classifyList'
,
content2
)
this
.
reqQuery
()
})
.
catch
(
err
=>
{})
},
upHandler
(
index
,
row
)
{
let
lastItem
=
this
.
totalData
.
dataList
[
index
-
1
]
let
curItem
=
this
.
totalData
.
dataList
[
index
]
this
.
changeDataHandler
(
lastItem
,
curItem
)
},
downHandler
(
index
,
row
)
{
let
lastItem
=
this
.
totalData
.
dataList
[
index
+
1
]
let
curItem
=
this
.
totalData
.
dataList
[
index
]
this
.
changeDataHandler
(
lastItem
,
curItem
)
},
changeDataHandler
(
lastItem
,
curItem
)
{
console
.
log
(
'lastItem:'
,
lastItem
)
console
.
log
(
'curItem:'
,
curItem
)
if
(
lastItem
&&
curItem
)
{
let
data
=
{
lbc
:
lastItem
.
bannerCode
,
rbc
:
curItem
.
bannerCode
}
changeBanner
(
data
)
.
then
(
result
=>
{
this
.
$notify
({
title
:
'成功'
,
message
:
'操作成功'
,
type
:
'success'
})
this
.
reqQuery
()
})
.
catch
(
err
=>
{})
}
},
// 修改 显示修改对话框
modifyHandler
(
index
,
row
)
{
this
.
dialogTitle
=
'修改'
this
.
editFormVisible
=
true
try
{
this
.
$refs
[
'editForm'
].
resetFields
()
}
catch
(
error
)
{}
this
.
editForm
=
Object
.
assign
({},
row
)
},
deleteHandler
(
index
,
row
)
{
let
data
=
{
bannerCode
:
row
.
bannerCode
}
console
.
log
(
'deleteHandler data:'
,
data
)
this
.
$confirm
(
'确认删除吗?'
,
'提示'
,
{}).
then
(()
=>
{
deleteBanner
(
data
)
.
then
(
result
=>
{
let
{
code
,
content
}
=
result
if
(
code
==
200
)
{
this
.
$notify
({
title
:
'成功'
,
message
:
'删除成功'
,
type
:
'success'
})
}
else
{
}
this
.
editFormVisible
=
false
this
.
reqQuery
()
})
.
catch
(
err
=>
{})
})
},
// 新增
handleAdd
()
{
this
.
editForm
=
{
bannerCode
:
''
,
bannerPic
:
''
,
link
:
''
,
linkType
:
''
,
classify
:
''
// 修改 显示修改对话框
modifyHandler
(
index
,
row
)
{
this
.
dialogTitle
=
"修改"
;
this
.
editFormVisible
=
true
;
try
{
this
.
$refs
[
"editForm"
].
resetFields
();
}
catch
(
error
)
{}
this
.
editForm
=
Object
.
assign
({},
row
);
},
deleteHandler
(
index
,
row
)
{
let
data
=
{
bannerCode
:
row
.
bannerCode
};
console
.
log
(
"deleteHandler data:"
,
data
);
this
.
$confirm
(
"确认删除吗?"
,
"提示"
,
{}).
then
(()
=>
{
deleteBanner
(
data
)
.
then
(
result
=>
{
let
{
code
,
content
}
=
result
;
if
(
code
==
200
)
{
this
.
$notify
({
title
:
"成功"
,
message
:
"删除成功"
,
type
:
"success"
});
}
else
{
}
try
{
this
.
$refs
[
'editForm'
].
resetFields
()
}
catch
(
error
)
{}
this
.
editFormVisible
=
true
this
.
dialogTitle
=
'新增'
},
// 提交 新增/修改
editSubmit
()
{
let
data
=
this
.
editForm
this
.
$refs
.
editForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
editLoading
=
true
saveBanner
(
data
)
.
then
(
result
=>
{
let
{
code
,
content
}
=
result
if
(
code
==
200
)
{
this
.
$notify
({
title
:
'成功'
,
message
:
'提交成功'
,
type
:
'success'
})
}
else
{
}
this
.
editLoading
=
false
this
.
editFormVisible
=
false
this
.
reqQuery
()
})
.
catch
(
err
=>
{})
}
this
.
editFormVisible
=
false
;
this
.
reqQuery
();
})
.
catch
(
err
=>
{});
});
},
// 新增
handleAdd
()
{
this
.
editForm
=
{
bannerCode
:
""
,
bannerPic
:
""
,
link
:
""
,
linkType
:
"web"
,
classify
:
""
,
miniproAppId
:
""
};
try
{
this
.
$refs
[
"editForm"
].
resetFields
();
}
catch
(
error
)
{}
this
.
editFormVisible
=
true
;
this
.
dialogTitle
=
"新增"
;
},
// 提交 新增/修改
editSubmit
()
{
let
data
=
this
.
editForm
;
this
.
$refs
.
editForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
editLoading
=
true
;
saveBanner
(
data
)
.
then
(
result
=>
{
let
{
code
,
content
}
=
result
;
if
(
code
==
200
)
{
this
.
$notify
({
title
:
"成功"
,
message
:
"提交成功"
,
type
:
"success"
});
}
else
{
}
this
.
editLoading
=
false
;
this
.
editFormVisible
=
false
;
this
.
reqQuery
();
})
},
// 点击页数
handleCurrentChange
(
val
)
{
this
.
page
=
val
this
.
reqQuery
()
},
HandleSelectChange
()
{
this
.
reqQuery
()
},
// 编辑时选择分类
HandleSelectDialogChange
()
{}
.
catch
(
err
=>
{});
}
});
},
created
()
{
this
.
reqGetClassifyList
()
// 点击页数
handleCurrentChange
(
val
)
{
this
.
page
=
val
;
this
.
reqQuery
();
},
HandleSelectChange
()
{
this
.
reqQuery
();
},
components
:
{
UploadItem
// 编辑时选择分类
HandleSelectDialogChange
()
{},
formatClassify
(
data
)
{
return
this
.
classifyMap
[
data
.
classify
];
},
formatJumpType
(
data
)
{
let
type
=
this
.
jumpType
[
data
.
linkType
];
if
(
!
type
)
{
type
=
this
.
jumpType
[
"web"
];
}
return
type
;
}
}
},
created
()
{
this
.
jumpTypeList
.
forEach
(
element
=>
{
this
.
jumpType
[
element
.
value
]
=
element
.
label
;
});
this
.
reqGetClassifyList
();
},
components
:
{
UploadItem
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.tool-wrap
{
color
:
#333333
;
color
:
#333333
;
}
.pagination-wrap
{
.page-tips
{
height
:
32px
;
line-height
:
32px
;
color
:
#333333
;
}
.page-tips
{
height
:
32px
;
line-height
:
32px
;
color
:
#333333
;
}
}
.fl
{
display
:
flex
;
justify-content
:
space-between
;
display
:
flex
;
justify-content
:
space-between
;
}
.fle
{
display
:
flex
;
justify-content
:
flex-end
;
display
:
flex
;
justify-content
:
flex-end
;
}
</
style
>
...
...
Please
register
or
sign in
to post a comment