This commit is contained in:
2025-04-03 17:56:37 +08:00
parent 93f487dcd9
commit d18d1fd882
9 changed files with 3289 additions and 22 deletions

View File

@@ -66,6 +66,7 @@ const mainRoutes = {
{ path: '/course-courseVideo', component: _import('modules/course/courseVideo'), name: 'course-courseVideo', meta: { title: '课程目录章节视频列表', isTab: true } },
{ path: '/course-sociologyList', component: _import('modules/course/sociologyList'), name: 'course-sociologyList', meta: { title: '国学标签列表', isTab: true } },
{ path: '/userCourse', component: _import('modules/user/userCourse'), name: 'userCourse', meta: { title: '用户课程列表', isTab: true } },
{ path: '/userCertificate', component: _import('modules/user/userCertificate'), name: 'userCertificate', meta: { title: '用户证书列表', isTab: true } },
{ path: '/workOrder', component: _import('modules/workOrderLIst'), name: 'workOrder', meta: { title: '工单列表', isTab: true } },
// { path: '/miniClassList', component: _import('modules/miniClass/miniClassList'), name: 'miniClass', meta: { title: '班级列表', isTab: true } },
// { path: '/miniClassList8', component: _import('modules/miniClass/miniClassList8'), name: 'miniClassList8', meta: { title: 'miniClassList8', isTab: true } },

View File

@@ -61,7 +61,7 @@
<!-- @selection-change="handleSelectionChange" -->
<el-table
ref="table"
height="100%"
:height="`${isShowPagination?'calc(100% - 50px)':'100%'}`"
:data="associatedGoodsList"
:row-key="getRowKeys"
border
@@ -81,7 +81,7 @@
</el-table-column> -->
<!-- -->
<el-table-column
<el-table-column v-if="!disableOperate"
header-align="center"
align="center"
label="操作"
@@ -89,7 +89,10 @@
>
<template slot-scope="scope">
<slot name="operation" :row="scope.row"></slot>
<el-button type="text" v-if="urlList.editCourse" @click="editCourse(scope.row)"
<el-button
type="text"
v-if="urlList.editCourse"
@click="editCourse(scope.row)"
>编辑</el-button
>
<el-button
@@ -102,8 +105,24 @@
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top: 10px;"
v-if="isShowPagination"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="current"
:page-sizes="[50, 100, 200]"
:page-size="limit"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
<el-dialog title="提示" :visible.sync="editVisible" width="40%" style="font-size:12px">
<el-dialog
title="提示"
:visible.sync="editVisible"
width="40%"
style="font-size:12px"
>
<div style="width:100%">
<div style="margin-bottom:15px">
<span style="font-weight:bold"
@@ -116,7 +135,7 @@
placeholder="请输入标签排序"
style="width: 50%"
v-model="editForm.sort"
:min="0"
:min="0"
>
</el-input-number> </el-form-item
><el-form-item label="课程等级:">
@@ -156,8 +175,11 @@ export default {
"currentType",
"isNoSearch",
"isNoPaging",
"disableOperate",
"isShowPagination",
"axiosType",
"otherInfo"
"otherInfo",
"CustomEdit"
],
data() {
return {
@@ -173,6 +195,9 @@ export default {
pageIndex: 1,
pageSize: 10,
totalPage: 0,
current: 1,
limit: 50,
total: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
@@ -206,9 +231,19 @@ export default {
// await this.getGoodsTypeList();
},
methods: {
editHandleClose(){
this.editForm = {}
this.editVisible = false
handleSizeChange(val) {
this.limit = val;
this.getAssociatedGoodsList({ ...this.dataForm });
console.log(`每页 ${val}`);
},
handleCurrentChange(val) {
this.current = val;
this.getAssociatedGoodsList({ ...this.dataForm });
console.log(`当前页: ${val}`);
},
editHandleClose() {
this.editForm = {};
this.editVisible = false;
},
submitEdit() {
this.$http({
@@ -217,19 +252,23 @@ export default {
data: this.$http.adornData(this.editForm)
}).then(data => {
this.$message.success("操作成功!");
this.editHandleClose()
this.getAssociatedGoodsList()
this.editHandleClose();
this.getAssociatedGoodsList();
});
},
editCourse(row) {
console.log("row", row);
if (this.CustomEdit) {
this.$emit("edit", row);
return;
}
this.editVisible = true;
this.editForm = {
title: row.title,
id: row.bindId,
sort:row.toSociologySort,
level:row.level,
selective:row.selective
sort: row.toSociologySort,
level: row.level,
selective: row.selective
};
},
shopDelete(row) {
@@ -293,7 +332,6 @@ export default {
// 获取数据列表
async getDataList(bookMarketId) {
this.bookMarketId = bookMarketId;
this.dataListLoading = true;
this.getDataList = [];
@@ -338,8 +376,39 @@ export default {
var form = { ...this.defaultForm, ...this.dataForm };
this.dataListLoading = true;
if (this.otherInfo.httpType == "raw" && this.isShowPagination) {
this.$http
.request({
url: this.$http.adornUrl(`${this.urlList.hasBindProductList}`),
method: "POST",
data: { current: this.current, limit: this.limit, ...form },
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(async ({ data }) => {
if (data && data.code === 0) {
console.log("data at line 359:", data);
if (this.otherInfo.resultValueName) {
this.associatedGoodsList = [
...data[this.otherInfo.resultValueName].records
];
this.total = data.certificateList.total;
console.log("this.total at line 392:", this.total);
this.$forceUpdate();
} else {
this.associatedGoodsList = [...data.result.records];
this.total = data[result].total;
}
if (this.otherInfo.httpType == "raw" && this.otherInfo.isNoPaging) {
this.dataListLoading = false;
}
});
} else if (
this.otherInfo.httpType == "raw" &&
this.otherInfo.isNoPaging
) {
this.$http
.request({
url: this.$http.adornUrl(`${this.urlList.hasBindProductList}`),
@@ -352,7 +421,14 @@ export default {
})
.then(async ({ data }) => {
if (data && data.code === 0) {
this.associatedGoodsList = [...data.result.records];
console.log("data at line 359:", data);
if (this.otherInfo.resultValueName) {
this.associatedGoodsList = [
...data[this.otherInfo.resultValueName].records
];
} else {
this.associatedGoodsList = [...data.result.records];
}
this.dataListLoading = false;
}
@@ -371,7 +447,7 @@ export default {
}
})
.then(async ({ data }) => {
console.log('data at line 373:', data)
console.log("data at line 373:", data);
if (data && data.code === 0) {
this.associatedGoodsList = [
...data[this.otherInfo.httpDataValueName]
@@ -501,7 +577,7 @@ li {
height: calc(100% - 50px);
overflow: auto;
// margin-left: -10px;
padding-bottom: 20px;
// padding-bottom: 20px;
// margin-top: 20px;
.shop_box_item {
width: 23.7%;

View File

@@ -63,6 +63,8 @@
</el-table-column> -->
<slot name="tableItem"></slot>
<el-table-column
header-align="center"
align="center"
@@ -70,11 +72,12 @@
width="80"
>
<template slot-scope="scope">
<el-button
<el-button
type="text"
@click="handleCurrentChange(scope.row)"
size="mini"
>绑定</el-button
>{{CustomOperationText?CustomOperationText:'绑定'}}</el-button
>
</template>
</el-table-column>
@@ -120,6 +123,7 @@ export default {
"title",
"isNoModal",
"urlList",
"CustomOperationText",
],
data() {
return {

View File

@@ -0,0 +1,397 @@
<template>
<div>
<div class="imgbox">
<div
class="preview-img"
:class="boxClass"
v-if="
Imageslist == 3 ||
Imageslist == 5 ||
Imageslist == 7 ||
Imageslist == 8 ||
Imageslist >= 9
"
>
<div
class="img-box"
v-for="(item, index) in imgArr"
:key="index"
>
<div v-for="(_item, _index) in item" :key="_index">
<div class="box-image" v-if="_index <= 3">
<el-image
ref="preview"
fit="cover"
:preview-src-list="previewImages"
:src="_item"
/>
<div
class="box-image-shade"
@click="imglistclick()"
v-if="item.length > 4 && _index == 3"
>
<div class="shade-more">
<i class="el-icon-d-arrow-right"></i>
<i
class="arrow"
custom-style="margin-left:-16px;"
></i>
</div>
<div>{{ Imageslist }}张</div>
</div>
</div>
</div>
</div>
</div>
<div :class="boxClass" class="preview-img" v-else>
<div
v-if="
Imageslist != 3 ||
Imageslist != 5 ||
Imageslist != 7 ||
Imageslist != 8 ||
Imageslist <= 9
"
class="box-image"
v-for="(item, index) in imgArr"
:key="index"
>
<el-image fit="contain" :src="item" />
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
previewData: {
type: Array,
default: () => {
return [];
},
// observer: function (newVal, oldVal) {
// console.log("newVal, oldVal", newVal, oldVal);
// const previewImages = [];
// newVal.map((item) => {
// previewImages.push(item);
// });
// this.setData({
// previewImages,
// });
// this.formatImageList(newVal);
// },
},
},
watch: {
previewData: function (newVal, oldVal) {
console.log("newVal, oldVal", newVal, oldVal);
const previewImages = [];
newVal.map((item) => {
previewImages.push(item);
});
this.previewImages = previewImages;
this.formatImageList(previewImages);
console.log("222222", newVal.length);
this.$nextTick(() => {
this.Imageslist = newVal.length;
});
// this.formatImageList(newVal);
},
},
data() {
return {
previewImages: [],
imgArr: [],
boxClass: "one",
Imageslist: 0,
};
},
mounted() {},
methods: {
imglistclick() {
console.log("图片", this.$refs.preview[8]);
this.$refs.preview[8].clickHandler();
},
formatImageList(imageArr) {
// console.log("imageArr---", imageArr);
console.log("长度:", imageArr.length);
const arrLength = imageArr.length;
if (arrLength == 1) {
// this.setData({
// imgArr: imageArr,
// boxClass: "one",
// });
this.imgArr = imageArr;
this.boxClass = "one";
}
if (arrLength == 2) {
// this.setData({
// imgArr: imageArr,
// boxClass: "two",
// });
this.imgArr = imageArr;
this.boxClass = "two";
}
if (arrLength == 3) {
const firstArr = [...imageArr.splice(0, 1)];
const threeArr = [[...firstArr], [...imageArr]];
// this.setData({
// imgArr: threeArr,
// boxClass: "three",
// });
this.imgArr = threeArr;
this.boxClass = "three";
}
if (arrLength == 4) {
// this.setData({
// imgArr: imageArr,
// boxClass: "four",
// });
this.imgArr = imageArr;
this.boxClass = "four";
}
if (arrLength == 5) {
const firstArr = [...imageArr.splice(0, 1)];
const fiveArr = [[...firstArr], [...imageArr]];
// this.setData({
// imgArr: fiveArr,
// boxClass: "five",
// });
this.imgArr = fiveArr;
this.boxClass = "five";
}
if (arrLength == 6) {
// this.setData({
// imgArr: imageArr,
// boxClass: "six",
// });
this.imgArr = imageArr;
this.boxClass = "six";
}
if (arrLength == 7) {
const firstArr = [...imageArr.splice(0, 1)];
const secondArr = [...imageArr.splice(0, 4)];
const sevenArr = [[...firstArr], [...secondArr], [...imageArr]];
console.log("sevenArr", sevenArr);
// this.setData({
// imgArr: sevenArr,
// boxClass: "seven",
// });
this.imgArr = sevenArr;
this.boxClass = "seven";
}
if (arrLength == 8) {
const firstArr = [...imageArr.splice(0, 1)];
const secondArr = [...imageArr.splice(0, 4)];
const eightArr = [[...firstArr], [...secondArr], [...imageArr]];
console.log("eightArr", eightArr);
// this.setData({
// imgArr: eightArr,
// boxClass: "eight",
// });
this.imgArr = eightArr;
this.boxClass = "eight";
}
if (arrLength >= 9) {
const firstArr = [...imageArr.splice(0, 1)];
const secondArr = [...imageArr.splice(0, 4)];
const nineArr = [[...firstArr], [...secondArr], [...imageArr]];
console.log("nineArr", nineArr);
// this.setData({
// imgArr: nineArr,
// boxClass: "nine",
// });
this.imgArr = nineArr;
this.boxClass = "nine";
}
},
},
};
</script>
<style lang="scss" scoped>
.spanimg {
}
.imgbox {
width: 675px;
padding-bottom: 50px;
// background: red;
}
.preview-img {
padding: 16px 5px 0;
box-sizing: border-box;
}
.box-image {
margin-top: 10px;
width: 315px;
height: 315px;
border-radius: 6px;
overflow: hidden;
}
.box-image .el-image {
width: 100%;
height: 100%;
// width: 100px;
// height: 100px;
display: block;
}
.two {
display: flex;
align-items: center;
justify-content: flex-start;
}
.two .box-image + .box-image {
margin-left: 12px;
}
.three,
.five,
.seven,
.eight,
.nine {
display: flex;
align-items: center;
justify-content: flex-start;
}
.three .img-box + .img-box {
margin-left: 12px;
}
.three .img-box + .img-box .box-image {
width: 154px;
height: 153px;
}
.four {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
}
.four .box-image {
width: 205px;
height: 205px;
margin-right: 14px;
margin-top: 14px;
}
.five .img-box + .img-box {
margin-left: 12px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.five .img-box + .img-box .box-image {
width: 153px;
height: 153px;
}
.six {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
}
.six .box-image {
width: 205px;
height: 205px;
margin-top: 14px;
}
.seven,
.eight,
.nine {
flex-wrap: wrap;
}
.seven .img-box:nth-child(2),
.eight .img-box:nth-child(2),
.nine .img-box:nth-child(2) {
margin-left: 12px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
width: 315px;
}
.seven .img-box:nth-child(2) .box-image,
.eight .img-box:nth-child(2) .box-image,
.nine .img-box:nth-child(2) .box-image {
width: 153px;
height: 153px;
}
.seven .img-box:nth-child(3) {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
}
.seven .img-box:nth-child(3) .box-image + .box-image {
margin-left: 12px;
margin-top: 14px;
width: 315px;
}
.eight .img-box:nth-child(3),
.nine .img-box:nth-child(3) {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.eight .img-box:nth-child(3) .box-image {
width: 206px;
height: 206px;
margin-top: 14px;
}
.nine .img-box:nth-child(3) .box-image {
width: 152px;
height: 152px;
margin-top: 12px;
position: relative;
}
.box-image-shade {
width: 152px;
height: 152px;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.55);
text-align: center;
font-size: 28px;
font-weight: 500;
color: #ffffff;
line-height: 42px;
padding-top: 36px;
box-sizing: border-box;
}
</style>

View File

@@ -0,0 +1,523 @@
<template>
<div class="mod-config">
<el-dialog
:title="`${isEdit ? '编辑' : '新增'}证书`"
:visible.sync="dialogVisible"
width="600px"
>
<div>
<el-form
:model="addCertificateForm"
ref="addCertificateForm"
label-width="110px"
>
<!-- <div style="background-color: #f0f0f0;padding:0 10px;box-sizing: border-box;color: #000;">
<p>绑定用户</p>
</div> -->
<template v-if="pageType == 'label'">
<el-form-item label="手机号/邮箱:" prop="user" class="form_item">
<div style="display: flex;align-items: center;">
<el-autocomplete
style="width: 400px;"
v-model="addCertificateForm.userKey"
:fetch-suggestions="loadAll"
placeholder="请输入用户信息"
@select="handleSelect"
>
<template #default="{ item }">
<div class="custom-item">
<span>{{ item.tel ? item.tel : item.email }}</span>
<span
style="color: gray; margin-left: 10px;"
v-if="item.name"
>({{ item.name }})</span
>
</div>
</template>
</el-autocomplete>
</div>
</el-form-item>
<el-form-item
label="用户姓名:"
style="width: 400px;"
v-if="addCertificateForm.userId"
prop="user"
class="form_item"
>
<div>
<!-- <span
style="width: 110px;display: inline-block;text-align: right;"
>用户姓名</span
> -->
{{
addCertificateForm.userName
? addCertificateForm.userName
: "-"
}}
</div></el-form-item
>
</template>
<template v-if="pageType == 'user'">
<el-form-item label="手机号/邮箱:" prop="user" class="form_item">
<div style="display: flex;align-items: center;">
{{ addCertificateForm.userKey }}
</div>
</el-form-item>
<el-form-item
label="用户姓名:"
style="width: 400px;"
prop="user"
class="form_item"
>
<div>
{{
addCertificateForm.userName
? addCertificateForm.userName
: "-"
}}
</div></el-form-item
>
<el-form-item
label="证书分类"
prop="user"
class="form_item"
>
<div>
<el-cascader style="width: 400px;"
:show-all-levels="false"
v-model="value"
:props="{
value: 'id',
label: 'title',
}"
:options="cateOptions"
placeholder="证书分类"
@change="handleChange"
></el-cascader></div
></el-form-item>
</template>
<div
class="flexbox width100"
style="display: flex;align-items: center;"
>
<div>
<el-form-item label="课程名:" prop="courseId">
<el-select
v-model="addCertificateForm.courseId"
filterable
remote
reserve-keyword
placeholder="请输入课程名"
:remote-method="remoteMethod"
style="width: 400px;"
@change="selectChange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.title"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if="
addCertificateForm.cate && addCertificateForm.cate.length > 0
"
style="margin-left:20px"
>
<el-form-item
label="请选择开通的分部:"
label-width="150px"
prop="catalogueId"
>
<div>
<el-checkbox-group v-model="linshiids">
<el-checkbox
:label="item.id"
v-for="(item, index) in addCertificateForm.cate"
:key="index"
>{{ item.title }}</el-checkbox
>
</el-checkbox-group>
</div>
<!-- <div v-for="(item, index) in addCertificateForm.cate" style=""
:key="index">
<el-radio
v-model="addCertificateForm.catalogueId"
:label="item.id"
>{{ item.title }}</el-radio
>
</div> -->
</el-form-item>
</div>
</div>
<!-- <el-form-item label="课程名称:" prop="course" class="form_item">
<el-button plain type="primary" @click="selectCourse('addCertificateForm')"
size="mini">选择</el-button>
<span style="margin-left: 20px"></span>
<br/>
<div v-if="addCertificateForm.courseId" style="font-weight: bold;margin-top: 20px;display: flex;align-items: center;justify-content: space-between;"><p><img v-if="addCertificateForm.courseImg" :src="addCertificateForm.courseImg" alt=""style="width: 30px;height: 40px;margin-right: 20px;">{{ addCertificateForm.courseName }}</p><span @click="clearCourse" style="color: red;cursor: pointer;"><i class="el-icon-delete" style="margin-right: 4px;"></i> 删除</span></div>
</el-form-item> -->
<el-form-item label="证书编号" prop="title" class="form_item">
<el-input
placeholder="请输入证书编号"
style="width: 400px;"
></el-input>
</el-form-item>
<el-form-item
label="上传证书"
prop="title"
class="form_item"
v-if="dialogVisible"
>
<el-upload
action="https://api.nuttyreading.com/oss/fileoss"
list-type="picture-card"
accept="image/png, image/jpeg"
:file-list="fileList"
:on-success="onSuccessImg"
:before-upload="beforeUpload"
:on-progress="onProgress"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="file" slot-scope="{ file }">
<img
class="el-upload-list__item-thumbnail"
:src="file.url"
alt=""
/>
<span class="el-upload-list__item-actions">
<!-- <span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in"></i>
</span> -->
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<i class="el-icon-download"></i>
</span>
<span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete"></i>
</span>
</span>
<!-- 上传中的加载动画 -->
<div v-if="file.uploading" class="loading-spinner">
<i class="el-icon-loading"></i>
</div>
</div>
</el-upload>
<!-- <div class="flexBox" style="width:100%;justify-content: space-between;">
<div class="" style="display:flex">
<div
style="display:flex; align-items:center; width:100%;justify-content:center">
<div style="margin-right:15px">封面图</div>
<div>
<el-upload class="avatar-uploader" :action="baseUrl + '/oss/fileoss'"
:show-file-list="false" :on-success="handlePicSuccess">
<img v-if="fimages" :src="fimages" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
<div>
<div v-if="fimages != ''">
<el-tag class="delImgBtn" @click="delImg()"
type="danger">清空图片</el-tag>
</div>
</div>
</div>
</div>
</div> -->
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="handleSubmit('addCertificateForm')">
确 定</el-button
>
</span>
</el-dialog>
</div>
</template>
<script>
import { quillEditor } from "vue-quill-editor";
import global from "../../common/common.vue"; //引入共用组间
import debounce from "lodash/debounce"; //导入lodash中的debounce
import AddOrUpdate from "@/views/components/commonBookTags/bookTagsForm.vue";
import commonShop from "@/views/components/commonBookTags/shopproduct.vue";
import commonShopTable from "@/views/components/commonBookTags/shopproductTable.vue";
import commonTree from "@/views/components/commonBookTags/tags.vue";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
const toolbarOptions = [
["bold", "italic", "underline", "strike"], // 加粗,斜体,下划线,删除线
["blockquote", "code-block"], //引用,代码块
[{ header: 1 }, { header: 2 }], // 几级标题
[{ list: "ordered" }, { list: "bullet" }], // 有序列表,无序列表
[{ script: "sub" }, { script: "super" }], // 下角标,上角标
[{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ direction: "rtl" }], // 文字输入方向
[{ size: ["small", false, "large", "huge"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 颜色选择
[
{
font: [
"SimSun",
"SimHei",
"Microsoft-YaHei",
"KaiTi",
"FangSong",
"Arial"
]
}
], // 字体
[{ align: [] }], // 居中
["clean"], // 清除样式,
["link", "image"] // 上传图片、上传视频
];
// import dialogComponent from './seckillprodrelation'
export default {
props: ["data", "pageType", "dataInfo"],
data() {
return {
isUploading: false, // 上传过程中是否显示加载动画
isUploading: false, // 上传过程中是否显示加载动画
isEdit: false, // 上传过程中是否显示加载动画
dialogImageUrl: "",
dialogVisibleImg: false,
disabled: false,
restaurants: [],
fileList: [],
options: [],
cateOptions: [],
state: "",
timeout: null,
addCertificateForm: {},
baseUrl: global.baseUrl,
isEdit: false,
checkAll: false,
isIndeterminate: true,
dialogVisible: false,
urlList: {},
activeName: "first",
addForm: {},
audioFileList: [],
isFresh: false,
dataRule: {
name: [
{
required: true,
message: "标签名称不能为空"
// trigger: "change",
}
]
}
};
},
components: {
AddOrUpdate,
commonShop,
commonTree,
commonShopTable,
quillEditor
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
activated() {
this.isEdit = false;
// this.getDataList();
},
methods: {
remoteMethod(query) {
console.log(query, "query", this.addCertificateForm.key);
// return false
if (this.addCertificateForm.key !== "") {
let data = {
title: query //关键字
};
this.totalLaoding = true;
this.$http({
url: this.$http.adornUrl("/master/userManage/courseAndChildrenList"),
method: "post",
data: this.$http.adornData(data)
}).then(({ data }) => {
if (data && data.code === 0) {
this.options = data.list;
} else {
this.options = [];
}
this.totalLaoding = false;
if (data.code !== 0) return this.$message.error(data.msg);
});
} else {
this.options = [];
this.totalLaoding = false;
}
},
getCateList() {
this.$http({
url: this.$http.adornUrl("/master/userCertificate/userCertificateLabelList"),
method: "post",
data: this.$http.adornData({})
}).then(({ data }) => {
if (data && data.code === 0) {
this.cateOptions = data.labelList;
} else {
this.cateOptions = [];
}
this.totalLaoding = false;
if (data.code !== 0) return this.$message.error(data.msg);
});
},
loadAll(queryString, cb) {
if (queryString == "") {
return false;
}
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/book/user/getUserList"),
method: "post",
data: this.$http.adornData({
page: 1,
limit: 9999,
key: queryString
})
}).then(({ data }) => {
if (data && data.code === 0) {
var arr = data.user.records;
console.log("arr at line 467:", arr);
cb(arr);
} else {
cb([]);
}
});
},
createStateFilter(queryString) {
return state => {
return (
state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
);
};
},
handleSelect(item) {
console.log(item);
this.addCertificateForm.userKey = item.tel ? item.tel : item.email;
this.addCertificateForm.userName = item.name;
this.addCertificateForm.userId = item.id;
},
init(type, data) {
this.getCateList()
console.log("data at line 372:", data);
this.addCertificateForm = {};
this.fileList = [];
this.isEdit = type == "edit" ? true : false;
if (data) {
this.addCertificateForm = {
courseId: data.id,
courseName: data.title,
courseImg: data.image,
images: data.image
// userId: data.userId
};
this.remoteMethod(this.addCertificateForm.courseName);
if (this.addCertificateForm.images) {
this.fileList = this.addCertificateForm.images
.split(",")
.map((image, i) => ({
uid: i, // 假设 id 是唯一标识符
name: i, // 文件名
status: "done", // 状态
url: image // 文件 URL
}));
console.log("this.fileList at line 308:", this.fileList);
}
} else {
this.addCertificateForm = {};
}
if (this.pageType == "label") {
if (data.userId) {
this.addCertificateForm.userKey = data.tel ? data.tel : data.email;
this.addCertificateForm.userName = data.name;
this.addCertificateForm.userId = data.id;
}
} else {
this.addCertificateForm.userKey = this.dataInfo.tel
? this.dataInfo.tel
: this.dataInfo.email;
this.addCertificateForm.userName = this.dataInfo.name;
this.addCertificateForm.userId = this.dataInfo.id;
}
this.dialogVisible = true;
},
handleSubmit() {
console.log(
"this.fileList at line 728:",
this.fileList.map(e => e.url)
); // 直接取 url
},
onSuccessImg(response, file, fileList) {
// 上传成功后,直接将返回的 URL 放到 file 对象中
file.uploading = false;
file.url = response.url; // 假设返回的数据包含文件的 url 地址
this.fileList = fileList; // 更新 fileList
},
beforeUpload(file) {
// 在文件上传之前,设置文件的上传状态
file.uploading = true;
},
onProgress(event, file, fileList) {
// 进度更新时,文件状态可以继续保持上传中
file.uploading = true;
},
handleRemove(file) {
this.fileList = this.fileList.filter(f => f.uid !== file.uid); // 删除文件
},
handleDownload(file) {
const link = document.createElement("a");
link.href = file.url;
link.download = file.name;
link.click();
},
selectChange(val) {
console.log("options", this.options);
// this.getCate(val)
},
handlePictureCardPreview(file) {
// 图片预览逻辑
}
}
};
</script>
<style lang="less" scoped></style>

File diff suppressed because it is too large Load Diff

View File

@@ -224,6 +224,15 @@
</el-button>
</router-link>
</el-dropdown-item>
<el-dropdown-item>
<router-link
:to="{ path: '/userCertificate', query: { id: scope.row.id } }"
>
<el-button type="text" size="small">
用户证书管理
</el-button>
</router-link>
</el-dropdown-item>
<!-- <el-dropdown-item>
<el-button type="text" size="small" @click="openVip(scope.row)">
开通VIP

View File

@@ -0,0 +1,719 @@
<template>
<div class="mod-config">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item label="">
<el-form-item
label="证书分类"
style="width: 400px;"
prop="user"
class="form_item"
>
<div>
<el-cascader
:show-all-levels="false"
v-model="Certificate"
:props="{
value: 'id',
label: 'title'
}"
:options="cateOptions"
placeholder="证书分类"
@change="handleChange"
></el-cascader></div
></el-form-item>
<el-form-item label="证书名称">
<el-input
v-model="dataForm.title"
placeholder="请输入证书名称"
clearable
>
</el-input>
</el-form-item>
<!-- <el-form-item label="">
<el-input v-model="dataForm.userInfo" placeholder="用户手机/邮箱/姓名" clearable>
</el-input>
</el-form-item> -->
<!-- <el-select v-model="dataForm.expire" placeholder="证书分类"
@change="
pageIndex = 1;
getDataList();">
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select> -->
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
<el-button
@click="
dataForm = {};
Certificate=[]
"
>重置</el-button
>
</el-form-item>
<!-- <el-form-item>
<el-button @click="showAddD" type="primary">开通证书</el-button>
</el-form-item> -->
<el-form-item style="float:right">
<div v-if="user.id" class="flexbox userInfo">
<div>用户信息{{ user.name }}{{ user.tel }}</div>
<div>
<span v-if="user.vip == 0">普通用户</span>
<span v-else-if="user.vip == 2">吴门医述VIP</span>
<span v-else-if="user.vip == 1">超级VIP</span>
<span v-else-if="user.vip == 3">众妙之门VIP</span>
</div>
</div>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column
label="证书编号"
width="160"
align="center"
prop="certificateNo"
>
<!-- <template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template> -->
</el-table-column>
<el-table-column
prop="title"
header-align="center"
align="center"
label="证书名称"
>
</el-table-column>
<!-- <el-table-column
header-align="center"
align="center"
label="课程图"
width="140"
>
<template slot-scope="scope">
<img
v-if="scope.row.image != ''"
:src="scope.row.image"
width="25"
height="35"
class="tableImg"
/>
</template>
</el-table-column> -->
<el-table-column
header-align="center"
align="center"
label="证书"
width="160"
>
<template slot-scope="scope" v-if="scope.row.certificateUrl != ''">
<!-- <el-image
ref="preview"
fit="cover"
:preview-src-list="previewImages"
:src="item"
v-for="(item,index) in scope.row.certificateUrl.split(',')"
/> -->
<el-image
:key="index"
v-for="(item, index) in scope.row.certificateUrl.split(',')"
style="width: 50px; height: 60px;margin-right: 4px;cursor: pointer;"
:src="item"
:preview-src-list="scope.row.certificateUrl.split(',')"
>
</el-image>
<!-- <img style="margin-right: 5px;"
v-for="(item,index) in scope.row.certificateUrl.split(',')"
:src="item"
width="30"
height="40"
class="tableImg"
/> -->
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="160"
label="创建日期"
>
</el-table-column>
<!-- <el-table-column
fixed="right"
header-align="center"
align="center"
width="160"
label="操作"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.expire == 0"
type="primary"
@click="delay(scope.row)"
plain
size="mini"
>修改</el-button
>
<el-button type="danger" @click="dataFormDelete(scope.row)" plain size="mini"
>删除</el-button
>
</template>
</el-table-column> -->
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[50, 100, 200]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
<el-dialog
title="开通课程"
:close-on-click-modal="false"
:visible.sync="youVisible"
append-to-body
width="60%"
@close="dialogClose"
>
<el-form
style="width:100%"
:model="youForm"
label-width="100px"
ref="youForm"
:rules="youFormRule"
>
<el-form-item label="用户">
{{ user.tel }} <span v-if="user.name != ''">{{ user.name }}</span>
<span v-if="user.vip == 0">普通用户</span>
<span v-else-if="user.vip == 2">吴门医述VIP</span>
<span v-else-if="user.vip == 1">超级VIP</span>
<span v-else-if="user.vip == 3">众妙之门VIP</span>
</el-form-item>
<div class="flexbox width100">
<div>
<el-form-item label="课程名:" prop="courseId">
<el-select
v-model="youForm.courseId"
filterable
remote
reserve-keyword
placeholder="请输入课程名"
:remote-method="remoteMethod"
:loading="totalLaoding"
@change="selectChange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.title"
:value="item.id"
>
</el-option>
</el-select>
<!-- <el-input v-model="youForm.key" placeholder="" clearable></el-input> -->
</el-form-item>
</div>
<!-- {{youForm.cate}} -->
<div
v-if="youForm.cate && youForm.cate.length > 0"
style="margin-left:20px"
>
<el-form-item
label="请选择开通的分部:"
label-width="150px"
prop="catalogueId"
>
<div>
<el-checkbox-group v-model="linshiids">
<el-checkbox
:label="item.id"
v-for="(item, index) in youForm.cate"
:key="index"
>{{ item.title }}</el-checkbox
>
</el-checkbox-group>
</div>
<!-- <div v-for="(item, index) in youForm.cate" style=""
:key="index">
<el-radio
v-model="youForm.catalogueId"
:label="item.id"
>{{ item.title }}</el-radio
>
</div> -->
</el-form-item>
</div>
</div>
<el-form-item
label="开通时长:"
v-if="youForm.courseId"
prop="days"
style="width:400px"
>
<el-input v-model="youForm.days" placeholder="请选择开通时长"
><template slot="append"></template></el-input
>
<!-- <el-select v-model="youForm.days" placeholder="请选择开通时长">
<el-option
v-for="item in timeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select> -->
</el-form-item>
<el-form-item label="开通原因:" prop="come" style="width: 400px">
<el-input
v-model="youForm.come"
type="textarea"
:rows="2"
placeholder="请输入内容"
></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogClose">取消</el-button>
<el-button @click="submit" type="primary">确认开通</el-button>
</span>
</el-dialog>
<addCertificate
ref="addCertificate"
:data="addCertificateForm"
pageType="user"
:dataInfo="user"
></addCertificate>
</div>
</template>
<script>
import debounce from "lodash/debounce"; //导入lodash中的debounce
import addCertificate from "@/views/modules/certificate/addCertificate.vue";
// import AddOrUpdate from './user-add-or-update'
export default {
data() {
return {
cateOptions: [],
Certificate: [],
dataForm: {
key: "",
expire: "",
userInfo: ""
},
statusOptions: [
{
value: "0",
label: "有效"
},
{
value: "-1",
label: "已过期"
}
],
userId: this.$route.query.id,
user: {},
pointFormRules: {
pointAmount: [
{ required: true, message: "请输入金额", trigger: "blur" }
],
pointType: {
required: true,
message: "请选择操作类型",
trigger: "blur"
}
},
youFormRule: {
catalogueId: [
{ required: true, message: "请选择开通的分部", trigger: "blur" }
],
days: [{ required: true, message: "请选择开通时长", trigger: "blur" }]
},
options: [],
timeOptions: [
// 开通时长
{
value: "30",
label: "30天"
},
{
value: "60",
label: "60天"
},
{
value: "90",
label: "90天"
},
{
value: "120",
label: "120天"
},
{
value: "150",
label: "150天"
},
{
value: "180",
label: "180天"
},
{
value: "365",
label: "365天"
},
{
value: "730",
label: "730天"
}
],
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
total: 0,
totalLaoding: false,
dataListLoading: false,
dataListSelections: [],
youVisible: false,
linshiids: [],
youForm: {
courseId: null,
cate: [],
catalogueId: "",
days: "",
come: "" //管理员开通(原因)
},
linshilist: [
{
title: "1"
},
{
title: "2"
},
{ title: "3" }
]
};
},
components: {
addCertificate
// AddOrUpdate
},
created() {
this.userId = this.$route.query.id;
console.log(this.$route.query);
console.log(this.userId, "onsole.log(this.$route.query)");
this.init();
},
activated() {
this.userId = this.$route.query.id;
this.init();
// this.getDataList()
// this.getcourpeList()
},
methods: {
dataFormDelete: debounce(async function(row, deleteType) {
console.log("row at line 515:", row);
this.$confirm(
`确定要删除${deleteType != "all" ? "该" : "所有"}证书嘛?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(async () => {
// var lableIds = row[0].bookLabelId;
var productIds = row[0].id;
await this.$http
.request({
url: this.$http.adornUrl(`${this.urlList.deleteShop}`),
method: "POST",
data: {
id: row[0].bindId
// marketId: this.addForm.id
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(async ({ data }) => {
if (data && data.code === 0) {
this.$message.success("删除成功");
} else {
this.$message.error(data.msg);
}
this.$nextTick(() => {
// this.$refs.commonShop.selectShopArr = [];
if (this.$refs.commonShop) {
this.$refs.commonShop.getAssociatedGoodsList();
}
});
});
})
.catch(() => {});
}, 200),
getCateList() {
this.$http({
url: this.$http.adornUrl(
"/master/userCertificate/userCertificateLabelList"
),
method: "post",
data: this.$http.adornData({})
}).then(({ data }) => {
if (data && data.code === 0) {
this.cateOptions = data.labelList;
} else {
this.cateOptions = [];
}
if (data.code !== 0) return this.$message.error(data.msg);
});
},
delay(val) {
this.$nextTick(() => {
this.$refs.addCertificate.init("edit", { val });
});
},
delaySubmit(data) {
this.$http({
url: this.$http.adornUrl("/master/userCourseBuy/delayUserCourseBuy"),
method: "post",
data: this.$http.adornData(data)
})
.then(({ data }) => {
if (data && data.code == 0) {
this.$message.success("操作成功!");
this.getDataList();
} else {
this.$message.error("操作失败!");
}
})
.catch(err => {
this.$message.error(err.msg);
});
},
submit() {
console.log(this.youForm, "youForm");
this.youForm.catalogueId = this.linshiids.join(",");
this.$refs["youForm"].validate(valid => {
if (valid) {
let data = {
userId: this.userId,
...this.youForm
};
delete data.cate;
console.log("data", data);
this.$http({
url: this.$http.adornUrl(
"/master/userCourseBuy/insertUserCourseBuy"
),
method: "post",
data: this.$http.adornData(data)
})
.then(({ data }) => {
if (data.code !== 0) return this.$message.error(data.msg);
this.$message.success("开课成功!");
this.getDataList();
this.dialogClose();
})
.catch(e => {
console.log("表单提交报错");
});
}
});
},
dialogClose() {
this.youVisible = false;
this.linshiids = [];
this.$nextTick(() => {
this.youForm.cate = [];
this.options = [];
this.$refs["youForm"].resetFields();
console.log(this.youForm, "youForm");
});
console.log(this.youForm, "youForm");
},
selectChange(val) {
console.log("options", this.options);
this.getCate(val);
},
remoteMethod(query) {
console.log(query, "query", this.youForm.key);
// return false
if (this.youForm.key !== "") {
let data = {
// page: this.pageIndex,
// limit: this.pageSize,
title: query //关键字
// medicalId: "",
// sociologyId: "",
// type: 0
};
this.totalLaoding = true;
this.$http({
url: this.$http.adornUrl("/master/userManage/courseAndChildrenList"),
method: "post",
data: this.$http.adornData(data)
}).then(({ data }) => {
if (data && data.code === 0) {
this.options = data.list;
} else {
this.options = [];
}
this.totalLaoding = false;
if (data.code !== 0) return this.$message.error(data.msg);
});
} else {
this.options = [];
this.totalLaoding = false;
}
},
showAddD() {
this.$nextTick(() => {
this.$refs.addCertificate.init("add", {});
});
},
init() {
this.getCateList();
// if (!this.userId) {
// setTimeout(() => {
// this.init();
// }, 1000);
// }
this.$http({
url: this.$http.adornUrl(`/book/user/info/${this.userId}`),
method: "get",
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code !== 0) return this.$message.error(data.msg);
this.user = data.user;
this.getDataList();
});
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/master/userCertificate/userCertificateList"),
method: "post",
data: this.$http.adornData({
current: this.pageIndex,
limit: this.pageSize,
userId: this.userId, //用户id
title: this.dataForm.title, //课程名
labelId: this.Certificate[this.Certificate.length-1] //课程名
})
}).then(({ data }) => {
if (data && data.code !== 0) return this.$message.error(data.msg);
console.log(data, "data");
this.dataList = data.certificateList.records;
this.totalPage = data.certificateList.pages;
this.total = data.certificateList.total;
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
// // 多选
// selectionChangeHandle(val) {
// this.dataListSelections = val
// },
// 新增 / 修改
closeDia() {
this.adc = false;
this.$refs.pointForm.resetFields();
// this.pointForm.pointType == 0
},
getCate(id) {
this.linshiids = [];
this.$http({
url: this.$http.adornUrl("/master/userManage/catalogueListByCourse"),
method: "post",
data: this.$http.adornData({
courseId: id
})
})
.then(({ data }) => {
if (data && data.code === 0) {
console.log("data", "data++++++++++++++++++++");
this.youForm.cate = data.list;
// this.youForm.cate
} else {
this.youForm.cate = [];
this.linshiids = [];
}
})
.catch(e => {
console.log("数据报错");
});
}
}
};
</script>
<style lang="less" scoped>
/deep/ .width100 .el-input__inner {
width: 100%;
}
.flexbox {
display: flex;
}
.userInfo {
margin-bottom: 20px;
}
.userInfo * {
font-size: 16px;
}
</style>

View File

@@ -6,7 +6,7 @@
// api接口请求地址
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
//window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川
//window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb'; //本地
// cdn地址 = 域名 + 版本号