This commit is contained in:
2024-04-28 15:48:51 +08:00
parent 298edb2c53
commit 3211f16a40
4 changed files with 2175 additions and 25 deletions

View File

@@ -98,6 +98,12 @@
@click="addOrUpdateHandle(scope.row.productId)"
>修改</el-button
>
<el-button
type="text"
size="small"
@click="handleEditCurriculum(scope.row.productId)"
>修改课程</el-button
>
<el-button
type="text"
size="small"
@@ -130,26 +136,39 @@
@refreshDataList="getDataList"
@showchooseBookf="showchooseBookf"
></add-or-update>
<choose-book
v-if="chooseBookVisible"
:bookIds="bookIds"
ref="chooseBook"
:chooseBookVisible="chooseBookVisible"
@closeBookf="closeBookf"
></choose-book>
<commonTags ref="commonTags" ></commonTags>
<curriculum
v-if="curriculumVisible"
ref="curriculum"
@refreshDataList="getDataList"
@showchooseBookf="showchooseBookf"
></curriculum>
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"
@showchooseBookf="showchooseBookf"
></add-or-update>
<commonTags ref="commonTags"></commonTags>
</div>
</template>
<script>
import chooseBook from "./chooseBook.vue";
import curriculum from "./curriculum.vue";
import AddOrUpdate from "./shopproduct-add-or-update";
// import AddOrUpdate from "./shopproduct-add-or-update";
import commonTags from "./commonBookTags/commonTags.vue";
export default {
data() {
return {
dataForm: {
key: "",
key: ""
},
dataList: [],
publishStatus: false,
@@ -160,19 +179,21 @@ export default {
dataListSelections: [],
addOrUpdateVisible: false,
chooseBookVisible: false,
bookIds: [],
curriculumVisible: false,
bookIds: []
};
},
components: {
curriculum,
AddOrUpdate,
chooseBook,
commonTags,
commonTags
},
activated() {
this.getDataList();
},
methods: {
handleEditTags (id) {
handleEditTags(id) {
this.$nextTick(() => {
this.$refs.commonTags.open(id);
});
@@ -198,8 +219,8 @@ export default {
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key,
}),
key: this.dataForm.key
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list;
@@ -233,11 +254,17 @@ export default {
this.$refs.addOrUpdate.init(id);
});
},
handleEditCurriculum(id) {
this.curriculumVisible = true;
this.$nextTick(() => {
this.$refs.curriculum.init(id);
});
},
// 删除
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map((item) => {
: this.dataListSelections.map(item => {
return item.productId;
});
this.$confirm(
@@ -246,13 +273,13 @@ export default {
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/book/shopproduct/delete"),
method: "post",
data: this.$http.adornData(ids, false),
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
@@ -261,7 +288,7 @@ export default {
duration: 1500,
onClose: () => {
this.getDataList();
},
}
});
} else {
this.$message.error(data.msg);
@@ -273,28 +300,28 @@ export default {
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
var parms = {
publishStatus: event.publishStatus,
productId: event.productId,
productId: event.productId
};
// console.log(parms)
this.$http({
url: this.$http.adornUrl("/book/shopproduct/update"),
method: "post",
data: parms,
data: parms
})
.then((res) => {
.then(res => {
this.$message({
message: "成功",
type: "success",
type: "success"
});
this.loading = false;
this.getDataList();
})
.catch((error) => {
.catch(error => {
this.loading = false;
console.log(error);
});
console.log(event);
},
},
}
}
};
</script>