8a796e68 by joe

管理端增加小程序跳转配置

1 parent 2422e4ef
......@@ -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",
......
......@@ -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
......
......@@ -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
......
......@@ -5,11 +5,7 @@
<el-form>
<el-form-item>
<div class="tool-wrap fl">
<el-select
v-model="curClassify"
placeholder="请选择"
@change="HandleSelectChange"
>
<el-select v-model="curClassify" placeholder="请选择" @change="HandleSelectChange">
<el-option
v-for="(item,index) in totalData.classifyList"
:key="index"
......@@ -32,39 +28,39 @@
>
<el-table-column label="缩略图">
<template slot-scope="scope">
<img class="poster" :src="scope.row.bannerPic" alt>
<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="跳转路径" 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-table-column prop="link" label="跳转链接"></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="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>
<el-button size="small" type="danger" @click="deleteHandler(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--编辑界面-->
<el-dialog
:title="dialogTitle"
:visible.sync="editFormVisible"
:close-on-click-modal="false"
>
<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
......@@ -86,12 +82,27 @@
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-form-item label="跳转链接" prop="link">
<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>
......@@ -121,14 +132,15 @@ import {
getBannerList,
saveBanner,
deleteBanner,
changeBanner
} from '../../api/api.js'
import UploadItem from '../../components/UploadItem'
changeBanner,
request
} from "../../api/api.js";
import UploadItem from "../../components/UploadItem";
export default {
data() {
return {
key: 'value',
key: "value",
page: 1,
pageSize: 10,
total: 0,
......@@ -137,50 +149,74 @@ export default {
classifyList: [],
classifyDialogList: []
},
classifyMap: {},
jumpType: {},
jumpTypeList: [
{
label: "无跳转",
value: "none"
},
{
label: "网页",
value: "web"
},
{
label: "小程序",
value: "minipro"
}
],
listLoading: false,
editLoading: false,
editFormVisible: false,
dialogTitle: '编辑',
dialogTitle: "编辑",
//编辑界面数据
editForm: {
bannerPic: '',
link: '',
classify: ''
bannerCode: "",
bannerPic: "",
link: "",
classify: "",
linkType: "",
miniproAppId: ""
},
editFormRules: {
bannerPic: [
{
required: true,
message: '请输入头图地址',
trigger: 'blur'
message: "请输入头图地址",
trigger: "blur"
}
],
link: [
{
required: true,
message: '请输入跳转链接',
trigger: 'blur'
message: "请输入跳转链接",
trigger: "blur"
}
],
classify: [
{ required: true, message: '请选择分类', trigger: 'blur' }
]
},
curClassify: ''
miniproAppId: [
{
required: true,
message: "请输入小程序ID",
trigger: "blur"
}
],
classify: [{ required: true, message: "请选择分类", trigger: "blur" }]
},
curClassify: ""
};
},
computed: {
pageNum() {
return Math.ceil(this.total / this.pageSize)
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') {
let { pid, url } = evtAny;
if (pid == "p1") {
this.$set(this.editForm, "bannerPic", url);
} else if (pid == "v1") {
// this.$set(this.editForm, 'vedioUrl', url)
}
},
......@@ -190,155 +226,172 @@ export default {
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)
})
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 = {}
let data = {};
getClassifyList(data)
.then(result => {
let { content, code } = result
this.$set(this.totalData, 'classifyDialogList', content)
let { content, code } = result;
this.$set(this.totalData, "classifyDialogList", content);
//深复制
let content2 = Object.assign([], 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()
classify: "",
dispayType: "",
name: "全部"
});
this.$set(this.totalData, "classifyList", content2);
this.reqQuery();
})
.catch(err => {})
.catch(err => {});
},
upHandler(index, row) {
let lastItem = this.totalData.dataList[index - 1]
let curItem = this.totalData.dataList[index]
this.changeDataHandler(lastItem, curItem)
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)
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)
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()
title: "成功",
message: "操作成功",
type: "success"
});
this.reqQuery();
})
.catch(err => {})
.catch(err => {});
}
},
// 修改 显示修改对话框
modifyHandler(index, row) {
this.dialogTitle = '修改'
this.editFormVisible = true
this.dialogTitle = "修改";
this.editFormVisible = true;
try {
this.$refs['editForm'].resetFields()
this.$refs["editForm"].resetFields();
} catch (error) {}
this.editForm = Object.assign({}, row)
this.editForm = Object.assign({}, row);
},
deleteHandler(index, row) {
let data = {
bannerCode: row.bannerCode
}
console.log('deleteHandler data:', data)
this.$confirm('确认删除吗?', '提示', {}).then(() => {
};
console.log("deleteHandler data:", data);
this.$confirm("确认删除吗?", "提示", {}).then(() => {
deleteBanner(data)
.then(result => {
let { code, content } = result
let { code, content } = result;
if (code == 200) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success'
})
title: "成功",
message: "删除成功",
type: "success"
});
} else {
}
this.editFormVisible = false
this.reqQuery()
})
.catch(err => {})
this.editFormVisible = false;
this.reqQuery();
})
.catch(err => {});
});
},
// 新增
handleAdd() {
this.editForm = {
bannerCode: '',
bannerPic: '',
link: '',
linkType: '',
classify: ''
}
bannerCode: "",
bannerPic: "",
link: "",
linkType: "web",
classify: "",
miniproAppId : ""
};
try {
this.$refs['editForm'].resetFields()
this.$refs["editForm"].resetFields();
} catch (error) {}
this.editFormVisible = true
this.dialogTitle = '新增'
this.editFormVisible = true;
this.dialogTitle = "新增";
},
// 提交 新增/修改
editSubmit() {
let data = this.editForm
let data = this.editForm;
this.$refs.editForm.validate(valid => {
if (valid) {
this.editLoading = true
this.editLoading = true;
saveBanner(data)
.then(result => {
let { code, content } = result
let { code, content } = result;
if (code == 200) {
this.$notify({
title: '成功',
message: '提交成功',
type: 'success'
})
title: "成功",
message: "提交成功",
type: "success"
});
} else {
}
this.editLoading = false
this.editFormVisible = false
this.reqQuery()
this.editLoading = false;
this.editFormVisible = false;
this.reqQuery();
})
.catch(err => {})
.catch(err => {});
}
})
});
},
// 点击页数
handleCurrentChange(val) {
this.page = val
this.reqQuery()
this.page = val;
this.reqQuery();
},
HandleSelectChange() {
this.reqQuery()
this.reqQuery();
},
// 编辑时选择分类
HandleSelectDialogChange() {}
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.reqGetClassifyList()
this.jumpTypeList.forEach(element => {
this.jumpType[element.value] = element.label;
});
this.reqGetClassifyList();
},
components: {
UploadItem
}
}
};
</script>
<style lang="less" scoped>
......@@ -363,5 +416,4 @@ export default {
display: flex;
justify-content: flex-end;
}
</style>
......