DESKTOP-D85FA51\111
2021-01-15 99d9e5990ee4b77d178e16382b0af7bd4c1c9cdf
小课包模块
1 files added
16 files modified
1551 ■■■■■ changed files
debug.log 1 ●●●● patch | view | raw | blame | history
src/apis/coursewareSource/packageManage/index.js 26 ●●●●● patch | view | raw | blame | history
src/assets/css/common.css 3 ●●●●● patch | view | raw | blame | history
src/components/common/NavList.vue 44 ●●●● patch | view | raw | blame | history
src/components/course/imgUp.vue 1 ●●●● patch | view | raw | blame | history
src/views/businessManage/vipCard/Gold.vue 20 ●●●● patch | view | raw | blame | history
src/views/businessManage/vipCard/List.vue 42 ●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/ClassifyManage.vue 5 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/Model.vue 402 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/PackageList.vue 5 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/PassManage.vue 5 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/SetPackage.vue 72 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/SetTask.vue 5 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/packageManage/router.js 10 ●●●●● patch | view | raw | blame | history
src/views/coursewareSource/wordsManage/WordsList.vue 28 ●●●●● patch | view | raw | blame | history
src/views/lineRead/readManage/AddRead.vue 417 ●●●● patch | view | raw | blame | history
src/views/lineRead/readManage/EditRead.vue 465 ●●●●● patch | view | raw | blame | history
debug.log
@@ -1,2 +1,3 @@
[1222/135534.684:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[1224/092934.760:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
[0115/093254.525:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
src/apis/coursewareSource/packageManage/index.js
@@ -15,7 +15,9 @@
const PassUrl = "api/v1/SmallClassPackage/getLevelList"; //任务  关卡列表
const setTaskUrl = "api/v1/SmallClassPackage/setTask"; //新建修改任务
const getTaskDetailUrl = "api/v1/SmallClassPackage/getTaskInfo"; //任务详情
const getModelUrl = "api/v1/SmallClassPackage/getSmallModelList"; //模块列表
const setModelUrl = "api/v1/SmallClassPackage/setSmallModel"; // 添加修改模块
const changeModelUrl = "api/v1/SmallClassPackage/setSmallModelStatus"; //修改状态
/**
 *
 * @param {*} page
@@ -305,3 +307,25 @@
  network.post(getTaskDetailUrl, {
    id,
  });
/**
 * @params page
 * @params pageSize
 * @params smallclasspackageId
 * @params status
 */
export const getModel = (page, pageSize, smallclasspackageId, status) =>
  network.post(getModelUrl, { page, pageSize, smallclasspackageId, status });
/**
 * @params id
 * @params modelName
 * @params smallclasspackageId
 * @params status
 */
export const setModel = (id, modelName, smallclasspackageId, status) =>
  network.post(setModelUrl, { id, modelName, smallclasspackageId, status });
/**
 * @params ids
 * @params status
 */
export const changeModel = (ids, status) =>
  network.post(changeModelUrl, { ids, status });
src/assets/css/common.css
@@ -841,3 +841,6 @@
.wd-300 {
  width: 300px;
}
.searchParams {
  height: 40px;
}
src/components/common/NavList.vue
@@ -1,34 +1,38 @@
<template>
  <div class="top-bar mb-20">
    <ul class="bar-ul">
      <li v-for="(item,index) in navList" @click="jump(item)" :class="{'active':item.active}">{{item.name}}</li>
      <li
        v-for="(item, index) in navList"
        @click="jump(item)"
        :class="{ active: item.active }"
      >
        {{ item.name }}
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: 'NavList',
  data(){
      return {
      }
  name: "NavList",
  data() {
    return {};
  },
  methods:{
      jump(item){
          if(!item.active){
              this.$router.push({path:item.path});
          }
  methods: {
    jump(item) {
      if (!item.active) {
        this.$router.push({ path: item.path });
      }
    },
  },
  props:{
      navList:{
          type: Array,
          default: function(){
              return []
          }
      }
  }
}
  props: {
    navList: {
      type: Array,
      default: function () {
        return [];
      },
    },
  },
};
</script>
<style lang="less" scoped>
</style>
src/components/course/imgUp.vue
@@ -61,6 +61,7 @@
  created() {
    this.imgSrc = this.upDis;
    this.styles = this.style1 || "";
    console.log(this.imgSrc, "imgsrc");
  },
  watch: {
    upDis: {
src/views/businessManage/vipCard/Gold.vue
@@ -56,7 +56,7 @@
            </template>
          </el-table-column>
          <el-table-column label="操作">
          <el-table-column label="操作" width="200">
            <template slot-scope="scope">
              <el-button
                size="mini"
@@ -87,7 +87,12 @@
        ></el-pagination>
      </div>
      <div class="dialog">
        <el-dialog :title="vipTitle" :visible.sync="vipVisible" width="35%">
        <el-dialog
          :title="vipTitle"
          :visible.sync="vipVisible"
          width="35%"
          :before-close="handleClose"
        >
          <el-form
            :model="ruleForm"
            :rules="rules"
@@ -120,7 +125,7 @@
            </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="vipVisible = false">取 消</el-button>
            <el-button @click="handleClose">取 消</el-button>
            <el-button type="primary" @click="submit">确 定</el-button>
          </span>
        </el-dialog>
@@ -152,6 +157,10 @@
        },
      ],
      breadList: [
        {
          bread_name: "运营管理",
          bread_url: "",
        },
        {
          bread_name: "金币充值",
          bread_url: "",
@@ -285,6 +294,11 @@
      this.pageInfo.page = page;
      this.getGold();
    },
    // 关闭弹窗清空校验情况
    handleClose() {
      this.$refs.ruleForm.resetFields();
      this.vipVisible = false;
    },
  },
  created() {
    this.getGold();
src/views/businessManage/vipCard/List.vue
@@ -67,7 +67,7 @@
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作">
          <el-table-column label="操作" width="200">
            <template slot-scope="scope">
              <el-button
                size="mini"
@@ -98,7 +98,12 @@
        ></el-pagination>
      </div>
      <div class="dialog">
        <el-dialog :title="vipTitle" :visible.sync="vipVisible" width="35%">
        <el-dialog
          :title="vipTitle"
          :visible.sync="vipVisible"
          width="35%"
          :before-close="handleClose"
        >
          <el-form
            :model="ruleForm"
            :rules="rules"
@@ -195,7 +200,7 @@
            </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="vipVisible = false">取 消</el-button>
            <el-button @click="handleClose">取 消</el-button>
            <el-button type="primary" @click="submitForm">确 定</el-button>
          </span>
        </el-dialog>
@@ -273,12 +278,7 @@
        days: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
        type: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
        price: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
        applePhoneProductPrice: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
        appleProductPrice: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
        linePrice: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
@@ -379,6 +379,7 @@
      }
      this.vipVisible = true;
      this.getMemberOptions();
      this.$refs.ruleForm ? this.$refs.ruleForm.resetFields() : "";
    },
    // 筛选id
    filterId(price, data, type) {
@@ -396,7 +397,23 @@
            this.ruleForm.sort == "" ? 0 : this.ruleForm.sort * 1;
          this.ruleForm.days =
            this.ruleForm.days == "" ? 0 : this.ruleForm.days * 1;
          console.log(this.ruleForm);
          this.ruleForm.applePhoneProductId =
            this.ruleForm.applePhoneProductPrice == ""
              ? ""
              : this.ruleForm.applePhoneProductId;
          this.ruleForm.appleProductId =
            this.ruleForm.appleProductPrice == ""
              ? ""
              : this.ruleForm.appleProductId;
          this.ruleForm.appleProductPrice =
            this.ruleForm.appleProductPrice == ""
              ? 0
              : this.ruleForm.appleProductPrice;
          this.ruleForm.applePhoneProductPrice =
            this.ruleForm.applePhoneProductPrice == ""
              ? 0
              : this.ruleForm.applePhoneProductPrice;
          this.setMember();
        } else {
          console.log("error submit!!");
@@ -411,6 +428,11 @@
      rex.test(value) ? "" : (this.ruleForm[id] = 0);
    },
    // 关闭弹窗清空校验情况
    handleClose() {
      this.$refs.ruleForm.resetFields();
      this.vipVisible = false;
    },
  },
  created() {
    this.getMemerData();
src/views/coursewareSource/packageManage/ClassifyManage.vue
@@ -255,6 +255,11 @@
          active: false,
          path: "/courseware/miniCourse/setTask",
        },
        {
          name: "小课包模块",
          active: false,
          path: "/courseware/miniCourse/model",
        },
      ],
      breadList: [
        {
src/views/coursewareSource/packageManage/Model.vue
New file
@@ -0,0 +1,402 @@
<template>
  <div class="model">
    <div class="v-box">
      <bread-crumb :breadList="breadList"></bread-crumb>
      <nav-list :navList="navList"></nav-list>
      <div class="searchParams">
        <div class="fl">
          <el-button type="primary" @click="addModel" class="ml-20"
            >新建</el-button
          >
        </div>
        <div class="fl">
          <el-button type="success" class="ml-20" @click="changeModel(1)"
            ><i class="el-icon-switch-button" style="margin-right: 2px"></i
            >启用</el-button
          >
        </div>
        <div class="fl">
          <el-button type="danger" class="ml-20" @click="changeModel(2)"
            ><i class="el-icon-circle-close"></i>禁用</el-button
          >
        </div>
      </div>
      <div class="searchParams" style="width: 100%">
        <div class="wd-300 mt-20">
          <div class="label fl ml-10">状态</div>
          <div class="select fl ml-10">
            <el-select
              v-model="search.status"
              @change="searchAll()"
              placeholder="请选择"
            >
              <el-option
                v-for="item in statusOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
      </div>
      <div class="main-box">
        <div class="left-box wd-300 mt-20 fl">
          <el-table
            :data="treeData"
            style="width: 100%; margin-bottom: 20px"
            row-key="id"
            @cell-click="checkId"
            border
            highlight-current-row
            :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
          >
            <el-table-column label="小课包">
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.packageName }}</span>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="right-box fl ml-20" style="width: 70%; margin-top: 20px">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column label="序号">
              <template slot-scope="scope">
                <div>{{ scope.$index + 1 }}</div>
              </template>
            </el-table-column>
            <el-table-column prop="modelName" label="模板名称">
            </el-table-column>
            <el-table-column prop="createTime" label="创建时间">
            </el-table-column>
            <el-table-column prop="status" label="状态">
              <template slot-scope="scope">
                <div
                  style="display: flex; align-items: center"
                  v-if="scope.row.status == 1"
                  class="fl"
                >
                  <div
                    style="
                      width: 5px;
                      height: 5px;
                      border-radius: 50%;
                      background-color: #ff8c15;
                      margin-right: 8px;
                    "
                  ></div>
                  <span style="color: #ff8c15">启用</span>
                </div>
                <div
                  v-if="scope.row.status == 2"
                  style="display: flex; align-items: center"
                >
                  <div
                    style="
                      width: 5px;
                      height: 5px;
                      border-radius: 50%;
                      background-color: black;
                      margin-right: 8px;
                    "
                  ></div>
                  <span>禁用</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <!-- <el-button type="text" size="small">查看</el-button> -->
                <el-button
                  type="text"
                  size="small"
                  @click="editModel(scope.row)"
                  >编辑</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="clear" style="clear: both"></div>
        <!-- 分页 -->
        <div
          class="page"
          v-show="pageInfo.total > 0"
          style="text-align: center"
        >
          <el-pagination
            background
            @current-change="pageInfoChange"
            :current-page.sync="pageInfo.page"
            :page-size="pageInfo.pageSize"
            layout="prev, pager, next, jumper"
            :total="pageInfo.total"
          ></el-pagination>
        </div>
        <!-- 新增编辑弹窗 -->
        <div class="dialog">
          <el-dialog
            title="提示"
            :visible.sync="dialogVisible"
            width="30%"
            :before-close="handleClose"
          >
            <el-form
              :model="ruleForm"
              :rules="rules"
              ref="ruleForm"
              label-width="100px"
              class="demo-ruleForm"
            >
              <el-form-item label="状态" prop="status">
                <el-switch
                  v-model="ruleForm.status"
                  :active-value="1"
                  :inactive-value="2"
                >
                </el-switch>
              </el-form-item>
              <el-form-item label="名称" prop="modelName">
                <el-input v-model="ruleForm.modelName"></el-input>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="handleClose">取 消</el-button>
              <el-button type="primary" @click="submit">确 定</el-button>
            </span>
          </el-dialog>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import {
  getSmallList,
  getModel,
  setModel,
  changeModel,
} from "@/apis/coursewareSource/packageManage";
export default {
  name: "model",
  data() {
    return {
      breadList: [
        {
          bread_name: "小课包模块",
          bread_url: "",
        },
      ],
      dialogVisible: false,
      ruleForm: {
        id: -1,
        smallclasspackageId: "",
        status: 1,
        modelName: "",
      },
      rules: {
        modelName: [
          { required: true, message: "请输入模块名称", trigger: "blur" },
        ],
      },
      tableData: [],
      navList: [
        {
          name: "小课包管理",
          active: false,
          path: "/courseware/miniCourse",
        },
        {
          name: "关卡管理",
          active: false,
          path: "/courseware/miniCourse/pass",
        },
        {
          name: "分类管理",
          active: false,
          path: "/courseware/miniCourse/classify",
        },
        {
          name: "任务管理",
          active: false,
          path: "/courseware/miniCourse/setTask",
        },
        {
          name: "小课包模块",
          active: true,
        },
      ],
      statusOptions: [
        {
          label: "全部",
          value: 0,
        },
        {
          label: "启用",
          value: 1,
        },
        {
          label: "禁用",
          value: 2,
        },
      ],
      search: {
        smallclasspackageId: "",
        status: "",
      },
      checkList: [],
      pageInfo: {
        page: 1,
        pageSize: 10,
        total: 10,
        totalPage: 1,
      },
      treeData: [],
    };
  },
  methods: {
    //   获取模块列表
    async getModel() {
      let { code, data, msg } = await getModel(
        this.pageInfo.page,
        this.pageInfo.pageSize,
        this.search.smallclasspackageId,
        this.search.status
      );
      if (code == 1) {
        this.tableData = data.list;
        for (let key in this.pageInfo) {
          this.pageInfo[key] = data[key];
        }
      } else {
        this.$message.error(msg);
      }
    },
    //   获取左侧小课包
    async getSmallList() {
      let { code, data, msg } = await getSmallList(1, 1000, 1, "");
      if (code == 1) {
        this.treeData = data.list;
      } else {
        this.$message.error(msg);
      }
    },
    // 添加(修改)模块
    async setModel() {
      let { code, data, msg } = await setModel(
        this.ruleForm.id,
        this.ruleForm.modelName,
        this.ruleForm.smallclasspackageId,
        this.ruleForm.status
      );
      if (code == 1) {
        this.title == "新建小课包模块"
          ? this.$message.success("创建成功")
          : this.$message.success("修改成功");
        this.dialogVisible = false;
        this.getModel();
      } else {
        this.$message.error(msg);
        this.dialogVisible = false;
      }
    },
    //批量修改
    async changeModel(status) {
      if (this.checkList.length == 0) {
        return this.$message.error("请选择列表内容");
      }
      let ids = [];
      this.checkList.forEach((item) => {
        ids.push(item.id);
      });
      ids = ids.join(",");
      let { code, data, msg } = await changeModel(ids, status);
      if (code == 1) {
        this.$message.success("修改成功");
        if (this.search.smallclasspackageId) {
          this.getModel();
        }
      } else {
        this.$message.error(msg);
      }
    },
    // 状态改变
    searchAll() {
      if (this.search.smallclasspackageId == "") {
        return this.$message.error("请选择小课包");
      }
      this.getModel();
    },
    // 新建
    addModel() {
      if (this.search.smallclasspackageId == "") {
        return this.$message.error("请选择小课包");
      }
      this.title = "新建小课包模块";
      this.ruleForm.smallclasspackageId = this.search.smallclasspackageId;
      this.ruleForm = {
        id: -1,
        status: 1,
        smallclasspackageId: this.search.smallclasspackageId,
        modelName: "",
      };
      this.dialogVisible = true;
    },
    // 编辑
    editModel(row) {
      for (let key in this.ruleForm) {
        this.ruleForm[key] = row[key];
      }
      this.title = "编辑小课包模块";
      this.dialogVisible = true;
    },
    // 分页事件
    pageInfoChange(page) {
      this.pageInfo.page = page;
      this.getModel();
    },
    // 选择小课包
    checkId(value) {
      this.search.smallclasspackageId = value.id;
      this.getModel();
    },
    // 选择多个
    handleSelectionChange(value) {
      this.checkList = value;
    },
    // 关闭前回调
    handleClose() {
      this.$refs.ruleForm.resetFields();
      this.dialogVisible = false;
    },
    // 提交表单
    submit() {
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          this.setModel();
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
  created() {
    this.getSmallList();
  },
};
</script>
<style>
</style>
src/views/coursewareSource/packageManage/PackageList.vue
@@ -203,6 +203,11 @@
          active: false,
          path: "/courseware/miniCourse/setTask",
        },
        {
          name: "小课包模块",
          active: false,
          path: "/courseware/miniCourse/model",
        },
      ],
      breadList: [
        {
src/views/coursewareSource/packageManage/PassManage.vue
@@ -257,6 +257,11 @@
          active: false,
          path: "/courseware/miniCourse/setTask",
        },
        {
          name: "小课包模块",
          active: false,
          path: "/courseware/miniCourse/model",
        },
      ],
      tableData: [],
      search: {
src/views/coursewareSource/packageManage/SetPackage.vue
@@ -79,7 +79,7 @@
              placeholder="请输入学习基数"
            ></el-input>
          </el-form-item>
          <el-form-item label="小课包模块" prop="modelArr" required="">
          <!-- <el-form-item label="小课包模块" prop="modelArr" required="">
            <div
              v-for="(item, index) in ruleForm.modelArr"
              :key="JSON.stringify(item + index)"
@@ -107,7 +107,7 @@
                >删除</el-button
              >
            </div>
          </el-form-item>
          </el-form-item> -->
          <el-form-item label="功能管理">
            <div style="display: flex">
              <el-checkbox
@@ -294,11 +294,13 @@
        sort: "",
        packageIntroduce: "",
        packageCoverImg: "",
        httpPackageCoverImg: "",
        httPguidanceImage: "",
        guidanceImage: "",
        vocabulary: "",
        learningBase: "",
        status: "1",
        modelArr: [{ name: "" }],
        // modelArr: [{ name: "" }],
        funArr: [],
        taskArr: [{ content: "", sort: "", nectarNum: "" }],
      },
@@ -320,9 +322,9 @@
        packageClassifyId: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
        modelArr: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
        // modelArr: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        // ],
        packageCoverImg: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
        ],
@@ -353,7 +355,7 @@
        this.ruleForm.vocabulary,
        this.ruleForm.learningBase,
        this.ruleForm.status,
        this.ruleForm.modelArr,
        // this.ruleForm.modelArr,
        this.funArr
      );
      if (code == 1) {
@@ -370,11 +372,13 @@
          sort: "",
          packageIntroduce: "",
          packageCoverImg: "",
          httpPackageCoverImg: "",
          httPguidanceImage: "",
          guidanceImage: "",
          vocabulary: "",
          learningBase: "",
          status: "1",
          modelArr: [{ name: "" }],
          // modelArr: [{ name: "" }],
          funArr: [],
        };
      }
@@ -388,13 +392,13 @@
        }
        this.ruleForm.httpPackageCoverImg = data.httpPackageCoverImg;
        this.ruleForm.httPguidanceImage = data.httPguidanceImage;
        this.ruleForm.modelArr = [];
        data.model_many.forEach((item) => {
          this.ruleForm.modelArr.push({
            name: item.modelName,
            smallclasspackageId: item.smallclasspackageId,
          });
        });
        // this.ruleForm.modelArr = [];
        // data.model_many.forEach((item) => {
        //   this.ruleForm.modelArr.push({
        //     name: item.modelName,
        //     smallclasspackageId: item.smallclasspackageId,
        //   });
        // });
        this.ruleForm.funArr = [];
        data.fun_many.forEach((item) => {
          console.log(item, "item");
@@ -572,21 +576,21 @@
            this.ruleForm.learningBase == "" ? 0 : this.ruleForm.learningBase;
          let list = [];
          let num = 0;
          this.ruleForm.modelArr.forEach((item) => {
            list.push(item.name);
            if (item.name == "") {
              num++;
            }
          });
          if (num == this.ruleForm.modelArr.length) {
            this.$message.error("请输入必选项");
            return;
          }
          if (this.ruleForm.funArr == []) {
            this.$message.error("请选择必选项");
            return;
          }
          this.ruleForm.modelArr = list.join(",");
          // this.ruleForm.modelArr.forEach((item) => {
          //   list.push(item.name);
          //   if (item.name == "") {
          //     num++;
          //   }
          // });
          // if (num == this.ruleForm.modelArr.length) {
          //   this.$message.error("请输入必选项");
          //   return;
          // }
          // if (this.ruleForm.funArr == []) {
          //   this.$message.error("请选择必选项");
          //   return;
          // }
          // this.ruleForm.modelArr = list.join(",");
          this.funArr = "";
@@ -614,11 +618,13 @@
          sort: "",
          packageIntroduce: "",
          packageCoverImg: "",
          httpPackageCoverImg: "",
          httPguidanceImage: "",
          guidanceImage: "",
          vocabulary: "",
          learningBase: "",
          status: "1",
          modelArr: [{ name: "" }],
          // modelArr: [{ name: "" }],
          funArr: [],
          taskArr: [{ content: "", sort: "", nectarNum: "" }],
        };
@@ -645,11 +651,13 @@
        sort: "",
        packageIntroduce: "",
        packageCoverImg: "",
        httpPackageCoverImg: "",
        guidanceImage: "",
        vocabulary: "",
        httPguidanceImage: "",
        learningBase: "",
        status: "1",
        modelArr: [{ name: "" }],
        // modelArr: [{ name: "" }],
        funArr: [],
        taskArr: [{ content: "", sort: "", nectarNum: "" }],
      };
src/views/coursewareSource/packageManage/SetTask.vue
@@ -332,6 +332,11 @@
          name: "任务管理",
          active: true,
        },
        {
          name: "小课包模块",
          active: false,
          path: "/courseware/miniCourse/model",
        },
      ],
      taskVisible: false,
      taskTitle: "",
src/views/coursewareSource/packageManage/router.js
@@ -9,6 +9,7 @@
const SetPackage = () => import("./SetPackage.vue");
const SetPass = () => import("./SetPass.vue");
const SetTask = () => import("./SetTask.vue");
import Model from "./Model.vue";
const miniCourse = [
  {
    path: "miniCourse",
@@ -68,6 +69,15 @@
          title: "任务管理",
        },
      },
      {
        path: "model",
        component: Model,
        name: "Model",
        meta: {
          auth: true,
          title: "小课包模块",
        },
      },
    ],
  },
];
src/views/coursewareSource/wordsManage/WordsList.vue
@@ -9,26 +9,14 @@
          :data="treeData"
          style="width: 100%; margin-bottom: 20px"
          row-key="id"
          @cell-click="checkedRow"
          @cell-mouse-enter="hoverTable"
          @cell-mouse-leave="leaveTable"
          border
          highlight-current-row
          :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
        >
          <el-table-column label="单词分类">
          <el-table-column label="小课包">
            <template slot-scope="scope">
              <div>
                <span>{{ scope.row.classifyName }}</span>
                <el-button
                  v-if="hoverId == scope.row.id"
                  class="ml-20"
                  type="warning"
                  size="mini"
                  plain
                  @click.stop="editCate(scope.row)"
                  >编辑</el-button
                >
              </div>
            </template>
          </el-table-column>
@@ -355,7 +343,7 @@
        <el-button
          type="primary"
          v-if="wordsTitle == '新建单词'"
          @click="submit('ruleForm')"
          @click="submit('ruleForm', 1)"
          >确定并继续添加</el-button
        >
      </div>
@@ -677,7 +665,7 @@
    },
    // 资源翻页
    // 添加修改单词
    async setWordData() {
    async setWordData(index = 0) {
      let { code, data, msg } = await setWord(
        this.ruleForm.id,
        this.ruleForm.wordClassifyId,
@@ -697,7 +685,10 @@
          ? this.$message.success("修改成功")
          : this.$message.success("新增成功");
        this.wordsVisible = false;
        this.getTableData();
        await this.getTableData();
        if (index == 1) {
          this.wordsVisible = true;
        }
      } else {
        this.$message.error(msg);
        this.wordsVisible = false;
@@ -748,14 +739,13 @@
    getTableData() {
      this.getWordList();
    },
    //关闭弹窗
    //提交
    submit(formName) {
    submit(formName, index = 0) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.ruleForm.wordType = this.ruleForm.wordType.join(",");
          this.setWordData();
          this.setWordData(index);
          this.handleClose();
          this.wordsVisible = false;
        } else {
src/views/lineRead/readManage/AddRead.vue
@@ -274,7 +274,7 @@
          <li class="full-width" v-show="drawer.imgUrl">
            <div class="th">图片路径:</div>
            <div class="td">
              {{drawer.imgUrl}}
              {{ drawer.imgUrl }}
            </div>
          </li>
        </ul>
@@ -370,27 +370,25 @@
  </div>
</template>
<script>
import moment from 'moment';
import { Utils } from '@/assets/js/utils'
import moment from "moment";
import { Utils } from "@/assets/js/utils";
let utils = new Utils();
import readApi from '@/apis/lineRead/readManage'
import { mapState } from 'vuex';
import readApi from "@/apis/lineRead/readManage";
import { mapState } from "vuex";
export default {
  name: 'AddRead',
  data () {
  name: "AddRead",
  data() {
    return {
      breadList: [
        {
          bread_name: '点读书管理',
          bread_url: '/lineRead/readManage'
          bread_name: "点读书管理",
          bread_url: "/lineRead/readManage",
        },
        {
          bread_name: '新建点读书',
          bread_url: ''
        }
          bread_name: "新建点读书",
          bread_url: "",
        },
      ],
      // id
      id: -1,
@@ -399,29 +397,29 @@
        //   是否上架
        status: true,
        //   套书套装
        setBooksId: '',
        setBooksId: "",
        // 点读书名称
        bookName: '',
        bookName: "",
        // 排序
        sort: '',
        sort: "",
        // 词汇
        wordCount: '0',
        wordCount: "0",
        // 点读书封面
        coverUrl: '',
        fullcoverUrl: '',
        coverUrl: "",
        fullcoverUrl: "",
        // 句子输入
        //wordAll: '',
        // 句子音频
        fileUrl: '',
        fullfileUrl: '',
        fileUrl: "",
        fullfileUrl: "",
        // 句子视频
        videoPath: '',
        videoPath: "",
        // 视频id
        videoId: '',
        videoId: "",
        // 标签
        tags: [],
        // 权限
        payType: 0
        payType: 0,
      },
      //   表格数据
      tableData: [],
@@ -432,47 +430,46 @@
      //   是否打开抽屉
      showDrawer: false,
      // 抽屉宽度
      drawerWidth: '580px',
      drawerWidth: "580px",
      //   抽屉表单数据
      drawer: {
        // 页面封面
        imgUrl: '',
        fullimgUrl: '',
        imgUrl: "",
        fullimgUrl: "",
        // 宽
        width: '',
        width: "",
        // 高
        height: '',
        height: "",
        // 信息数据
        sons: [
          {
            id: 1,
            //   句子内容
            sentence: '',
            sentence: "",
            // 音频
            audioUrl: '',
            fullaudioUrl: ''
          }
        ]
            audioUrl: "",
            fullaudioUrl: "",
          },
        ],
      },
      // 编辑的drawerid
      drawerId: '',
      drawerId: "",
      warning: {
        setBooksId: false,
        bookName: false,
      }
    }
      },
    };
  },
  computed: {
    ...mapState('common', {
      user: state => JSON.parse(state.user)
    })
    ...mapState("common", {
      user: (state) => JSON.parse(state.user),
    }),
  },
  methods: {
    /**
     * 限制输入数字
     */
    limitNum (key) {
    limitNum(key) {
      if (key) {
        this.form[key] = this.form[key].replace(/[^0-9]/g, "");
      } else {
@@ -482,11 +479,17 @@
    /**
     * 限制句子输入
     */
    limitWord (key, index) {
    limitWord(key, index) {
      if (index == undefined) {
        this.form[key] = this.form[key].replace(/[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g, '');
        this.form[key] = this.form[key].replace(
          /[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g,
          ""
        );
      } else {
        this.drawer.sons[index][key] = this.drawer.sons[index][key].replace(/[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g, '');
        this.drawer.sons[index][key] = this.drawer.sons[index][key].replace(
          /[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g,
          ""
        );
      }
    },
    /**
@@ -496,48 +499,50 @@
     * key 区别属于哪个对象属性
     * index 抽屉组件多个上传索引
     */
    fnUpload (option, type, key, index) {
      let fileExtend = option.file.name.substring(option.file.name.lastIndexOf('.')).toLowerCase();
      let rulefileExtend = '';
    fnUpload(option, type, key, index) {
      let fileExtend = option.file.name
        .substring(option.file.name.lastIndexOf("."))
        .toLowerCase();
      let rulefileExtend = "";
      switch (type) {
        case '1':
        case "1":
          // 图片
          rulefileExtend = '.jpg、.jpeg、.png';
          rulefileExtend = ".jpg、.jpeg、.png";
          if (rulefileExtend.indexOf(fileExtend) === -1) {
            this.$message.error('只能上传.jpg、.jpeg、.png格式文件!');
            this.$message.error("只能上传.jpg、.jpeg、.png格式文件!");
            return false;
          } else {
            let isLt5M = option.file.size / 1024 / 1024 <= 5;
            if (!isLt5M) {
              this.$message.error('图片文件大小不超过5M!');
              this.$message.error("图片文件大小不超过5M!");
              return false;
            }
          }
          break;
        case '2':
        case "2":
          // 音频
          rulefileExtend = '.mp3';
          rulefileExtend = ".mp3";
          if (rulefileExtend.indexOf(fileExtend) === -1) {
            this.$message.error('只能上传.mp3格式文件!');
            this.$message.error("只能上传.mp3格式文件!");
            return false;
          } else {
            let isLt100M = option.file.size / 1024 / 1024 <= 100;
            if (!isLt100M) {
              this.$message.error('音频文件大小不超过100M!');
              this.$message.error("音频文件大小不超过100M!");
              return false;
            }
          }
          break;
        case '3':
        case "3":
          // 视频频
          rulefileExtend = '.mp4';
          rulefileExtend = ".mp4";
          if (rulefileExtend.indexOf(fileExtend) === -1) {
            this.$message.error('只能上传.mp4格式文件!');
            this.$message.error("只能上传.mp4格式文件!");
            return false;
          } else {
            let isLt500M = option.file.size / 1024 / 1024 <= 500;
            if (!isLt500M) {
              this.$message.error('视频文件大小不超过500M!');
              this.$message.error("视频文件大小不超过500M!");
              return false;
            }
          }
@@ -545,7 +550,7 @@
        default:
          break;
      }
      this.uploadFile(option.file, type, key, index)
      this.uploadFile(option.file, type, key, index);
    },
    /**
     * 上传文件
@@ -553,19 +558,18 @@
     * key 对应的key值
     * index 索引
     */
    uploadFile (file, type, key, index) {
      let uploadUrl = '';
    uploadFile(file, type, key, index) {
      let uploadUrl = "";
      let cid = 0;
      switch (type) {
        case '1':
          uploadUrl = '/Api/v1/ImgSet/imgUploadSub';
        case "1":
          uploadUrl = "/Api/v1/ImgSet/imgUploadSub";
          break;
        case '2':
          uploadUrl = '/Api/v1/AudioSet/audioUoloadSub';
        case "2":
          uploadUrl = "/Api/v1/AudioSet/audioUoloadSub";
          break;
        case '3':
          uploadUrl = '/Api/v1/VideosSet/videoUoloadSub';
        case "3":
          uploadUrl = "/Api/v1/VideosSet/videoUoloadSub";
          cid = 16;
          break;
@@ -573,116 +577,118 @@
          break;
      }
      let fileObj = {
        timestamp: moment().format('X'),
        classId: '',
        timestamp: moment().format("X"),
        classId: "",
        status: 0,
        title: file.name,
        releaseId: this.user.userId,
        releaseName: this.user.mobile,
        isInside: 0,
        cid,
        source: 6
        source: 6,
      };
      let formData = utils.fnUploadPara(fileObj, file);
      this.instance.post(uploadUrl, formData).then(res => {
        let { data, status } = res.data;
        if (status === 0) {
          if (index == undefined) {
            if (this.form.hasOwnProperty(key) && key != 'videoPath') {
              this.form[key] = data.filePath;
              this.form['full' + key] = data.fileUrl;
            } else if (this.drawer.hasOwnProperty(key)) {
              this.drawer[key] = data.filePath;
              this.drawer['full' + key] = data.fileUrl;
              this.drawer.width = data.width;
              this.drawer.height = data.height;
      this.instance
        .post(uploadUrl, formData)
        .then((res) => {
          let { data, status } = res.data;
          if (status === 0) {
            if (index == undefined) {
              if (this.form.hasOwnProperty(key) && key != "videoPath") {
                this.form[key] = data.filePath;
                this.form["full" + key] = data.fileUrl;
              } else if (this.drawer.hasOwnProperty(key)) {
                this.drawer[key] = data.filePath;
                this.drawer["full" + key] = data.fileUrl;
                this.drawer.width = data.width;
                this.drawer.height = data.height;
              }
              if (key == "videoPath") {
                this.form.videoId = data.aliyunVideoId;
                this.form.videoPath = data.fileUrl;
              }
            } else {
              this.drawer.sons[index].audioUrl = data.filePath;
              this.drawer.sons[index].fullaudioUrl = data.fileUrl;
            }
            if (key == 'videoPath') {
              this.form.videoId = data.aliyunVideoId;
              this.form.videoPath = data.fileUrl;
            }
          } else {
            this.drawer.sons[index].audioUrl = data.filePath;
            this.drawer.sons[index].fullaudioUrl = data.fileUrl;
          }
        }
      }).catch(err => {
        console.log(err)
      })
        })
        .catch((err) => {
          console.log(err);
        });
    },
    /**
     * 删除上传资源
     * key 对应的key值
     * index 索引
     */
    deleteFile (key, index) {
    deleteFile(key, index) {
      if (index == undefined) {
        if (this.form.hasOwnProperty(key) && key != 'videoPath') {
          this.form[key] = '';
          this.form['full' + key] = '';
        if (this.form.hasOwnProperty(key) && key != "videoPath") {
          this.form[key] = "";
          this.form["full" + key] = "";
        } else {
          this.drawer[key] = '';
          this.drawer['full' + key] = '';
          this.drawer.width = '';
          this.drawer.height = '';
          this.drawer[key] = "";
          this.drawer["full" + key] = "";
          this.drawer.width = "";
          this.drawer.height = "";
        }
        if (key == 'videoPath') {
          this.form.videoPath = '';
          this.form.videoId = '';
        if (key == "videoPath") {
          this.form.videoPath = "";
          this.form.videoId = "";
        }
      } else {
        this.drawer.sons[index].audioUrl = '';
        this.drawer.sons[index].fullaudioUrl = '';
        this.drawer.sons[index].audioUrl = "";
        this.drawer.sons[index].fullaudioUrl = "";
      }
    },
    /**
     * 添加页面信息
     */
    addInfo () {
      this.drawerId = '';
    addInfo() {
      this.drawerId = "";
      this.showDrawer = true;
    },
    /**
     * 关闭抽屉
     */
    drawCancel () {
    drawCancel() {
      this.showDrawer = false;
    },
    /**
     * 提交抽屉信息
     */
    drawSubmit () {
    drawSubmit() {
      if (!this.drawer.imgUrl) {
        this.tip('请上传页面图片!', '提示');
        this.tip("请上传页面图片!", "提示");
        return false;
      }
      let obj = {
        sort: '',
        sort: "",
        imgUrl: this.drawer.imgUrl,
        fullimgUrl: this.drawer.fullimgUrl,
        width: this.drawer.width,
        height: this.drawer.height,
        senCount: 0,
        audioCount: 0,
        sons: []
        sons: [],
      };
      this.drawer.sons.forEach(item => {
        if (utils.removeAllSpace(item.sentence) != '') {
      this.drawer.sons.forEach((item) => {
        if (utils.removeAllSpace(item.sentence) != "") {
          obj.senCount++;
        }
        if (item.audioUrl) {
          obj.audioCount++;
        }
        if (utils.removeAllSpace(item.sentence) != '' || item.audioUrl) {
        if (utils.removeAllSpace(item.sentence) != "" || item.audioUrl) {
          obj.sons.push(item);
        }
      });
      this.drawerId ? this.tableData[this.drawerId - 1] = obj : this.tableData.push(obj);
      this.drawerId
        ? (this.tableData[this.drawerId - 1] = obj)
        : this.tableData.push(obj);
      // sons排序
      this.tableData.forEach((item, index) => {
        item.sort = index + 1;
@@ -692,78 +698,82 @@
      });
      this.showDrawer = false;
      if (!this.drawerId) {
        this.drawer.imgUrl = '';
        this.drawer.width = '';
        this.drawer.height = '';
        this.drawer.fullimgUrl = '';
        this.drawer.imgUrl = "";
        this.drawer.width = "";
        this.drawer.height = "";
        this.drawer.fullimgUrl = "";
        this.drawer.sons = [
          {
            id: 1,
            //   句子内容
            sentence: '',
            sentence: "",
            // 音频
            audioUrl: '',
            fullaudioUrl: ''
          }
            audioUrl: "",
            fullaudioUrl: "",
          },
        ];
      }
    },
    /**
     * 编辑页面信息
     */
    edit (row) {
    edit(row) {
      this.drawerId = row.sort;
      if (!row.sons.length) {
        row.sons = [
          {
            id: 1,
            //   句子内容
            sentence: '',
            sentence: "",
            // 音频
            audioUrl: '',
            fullaudioUrl: ''
          }
            audioUrl: "",
            fullaudioUrl: "",
          },
        ];
      };
      }
      this.showDrawer = true;
      this.drawer = JSON.parse(JSON.stringify(row));
    },
    /**
     * 删除页面信息
     */
    del (row) {
      this.$confirm('您确定要删除此条数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableData.splice(row.sort - 1, 1);
        this.tableData.forEach((item, index) => {
          item.sort = index + 1;
        });
      }).catch(() => {
      });
    del(row) {
      this.$confirm("您确定要删除此条数据吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.tableData.splice(row.sort - 1, 1);
          this.tableData.forEach((item, index) => {
            item.sort = index + 1;
          });
        })
        .catch(() => {});
    },
    /**
     * 依次添加抽屉内容
     */
    addBox () {
    addBox() {
      let arr = [];
      this.drawer.sons.forEach(item => {
      this.drawer.sons.forEach((item) => {
        arr = [...arr, item.id];
      });
      let max = Math.max(...arr);
      this.drawer.sons = [
        ...this.drawer.sons,
        { id: max + 1, sentence: '', audioUrl: '', fullaudioUrl: '' }
        { id: max + 1, sentence: "", audioUrl: "", fullaudioUrl: "" },
      ];
    },
    /**
      向前插入句子
     */
    insertBefore (index) {
      this.drawer.sons.splice(index, 0, { sentence: '', audioUrl: '', fullaudioUrl: '' });
    insertBefore(index) {
      this.drawer.sons.splice(index, 0, {
        sentence: "",
        audioUrl: "",
        fullaudioUrl: "",
      });
      this.drawer.sons.forEach((item, index) => {
        item.id = index + 1;
      });
@@ -771,40 +781,39 @@
    /**
     * 删除抽屉内容
     */
    delBox (id) {
    delBox(id) {
      this.drawer.sons.forEach((item, index) => {
        if (item.id == id) {
          this.drawer.sons.splice(index, 1);
        }
      });
    },
    /**
     * 取消
     */
    cancel () {
      this.$router.push({ path: '/lineRead/readManage' });
    cancel() {
      this.$router.push({ path: "/lineRead/readManage" });
    },
    /**
     * 确定
     */
    submit () {
    submit() {
      let isSub = this.verify();
      if (isSub != '-1') {
        this.tip('请完善必填项信息!', '提示');
      if (isSub != "-1") {
        this.tip("请完善必填项信息!", "提示");
        return false;
      }
      if (!this.form.fileUrl) {
        this.tip('请上传音频!', '提示');
        this.tip("请上传音频!", "提示");
        return false;
      }
      if (!this.form.coverUrl) {
        this.tip('请上传点读书封面!', '提示');
        this.tip("请上传点读书封面!", "提示");
        return false;
      }
      this.addOrEditRead();
    },
    verify () {
    verify() {
      let { setBooksId, bookName } = this.form;
      let verify = { setBooksId, bookName };
      return utils.handleRequired(verify, this.warning);
@@ -813,37 +822,52 @@
     * 请求apis
     */
    // 标签数据
    async tagsList () {
    async tagsList() {
      let { code, data } = await readApi.tagsTree();
      if (code == 1) {
        this.tagsData = data.list;
      }
    },
    // 套装数据
    async unitBookAll () {
    async unitBookAll() {
      let { code, data } = await readApi.unitBookAll();
      if (code == 1) {
        this.uniBookData = data.list;
      }
    },
    // 提交保存
    async addOrEditRead () {
      let { status, setBooksId, bookName, sort, wordCount, coverUrl, fileUrl, videoPath, videoId, tags, payType } = this.form;
    async addOrEditRead() {
      let {
        status,
        setBooksId,
        bookName,
        sort,
        wordCount,
        coverUrl,
        fileUrl,
        videoPath,
        videoId,
        tags,
        payType,
      } = this.form;
      status = status ? 1 : 0;
      let tagStr = '';
      let tagStr = "";
      if (tags) {
        tags.forEach((item, index) => {
          tagStr = index == tags.length - 1 ? tagStr + item.join(",") : tagStr + item.join(",") + ',';
          tagStr =
            index == tags.length - 1
              ? tagStr + item.join(",")
              : tagStr + item.join(",") + ",";
        });
      }
      let tableData = JSON.stringify(this.tableData);
      tableData = JSON.parse(tableData);
      if (tableData.length) {
        tableData.forEach(item => {
        tableData.forEach((item) => {
          delete item.senCount;
          delete item.audioCount;
          delete item.fullimgUrl;
          item.sons.forEach(subItem => {
          item.sons.forEach((subItem) => {
            delete subItem.id;
            delete subItem.fullaudioUrl;
          });
@@ -854,7 +878,7 @@
        status,
        setBooksId,
        bookName,
        sort ? sort : '0',
        sort ? sort : "0",
        wordCount,
        coverUrl,
        fileUrl,
@@ -865,40 +889,45 @@
        JSON.stringify(tableData)
      );
      if (code == 1) {
        this.$router.push({ path: '/lineRead/readManage' });
        this.$router.push({ path: "/lineRead/readManage" });
      }
    }
    },
  },
  created () {
  created() {
    this.tagsList();
    this.unitBookAll();
  },
  watch: {
    showDrawer: {
      handler (val, old) {
        val ? document.querySelector('body').setAttribute('style', 'overflow:hidden') : document.querySelector('body').setAttribute('style', 'overflow:auto');
      handler(val, old) {
        val
          ? document
              .querySelector("body")
              .setAttribute("style", "overflow:hidden")
          : document
              .querySelector("body")
              .setAttribute("style", "overflow:auto");
        if (this.drawerId && !val) {
          // 编辑状态点击取消
          this.drawer.imgUrl = '';
          this.drawer.width = '';
          this.drawer.height = '';
          this.drawer.fullimgUrl = '';
          this.drawer.imgUrl = "";
          this.drawer.width = "";
          this.drawer.height = "";
          this.drawer.fullimgUrl = "";
          this.drawer.sons = [
            {
              id: 1,
              //   句子内容
              sentence: '',
              sentence: "",
              // 音频
              audioUrl: '',
              fullaudioUrl: ''
            }
              audioUrl: "",
              fullaudioUrl: "",
            },
          ];
        }
      }
    }
  }
}
      },
    },
  },
};
</script>
<style lang="less" scoped>
@deep: ~">>>";
@@ -918,7 +947,7 @@
        width: 110px;
        text-align: right;
      }
      .td{
      .td {
        word-break: break-all;
      }
    }
src/views/lineRead/readManage/EditRead.vue
@@ -374,58 +374,58 @@
  </div>
</template>
<script>
import moment from 'moment';
import { Utils } from '@/assets/js/utils'
import moment from "moment";
import { Utils } from "@/assets/js/utils";
let utils = new Utils();
import readApi from '@/apis/lineRead/readManage'
import { mapState } from 'vuex';
import readApi from "@/apis/lineRead/readManage";
import { mapState } from "vuex";
export default {
  name: 'EditRead',
  data () {
  name: "EditRead",
  data() {
    return {
      breadList: [
        {
          bread_name: '点读书管理',
          bread_url: '/lineRead/readManage'
          bread_name: "点读书管理",
          bread_url: "/lineRead/readManage",
        },
        {
          bread_name: '编辑点读书',
          bread_url: ''
        }
          bread_name: "编辑点读书",
          bread_url: "",
        },
      ],
      // id
      id: '',
      id: "",
      // 词汇初始数据保存
      wordCountSave: '',
      wordCountSave: "",
      form: {
        //   是否上架
        status: false,
        //   套书套装
        setBooksId: '',
        setBooksId: "",
        // 点读书名称
        bookName: '',
        bookName: "",
        // 排序
        sort: '',
        sort: "",
        // 词汇
        wordCount: '',
        wordCount: "",
        // 点读书封面
        coverUrl: '',
        coverUrl: "",
        // 封面绝对路径
        fullcoverUrl: '',
        fullcoverUrl: "",
        // 句子输入
        // wordAll: '',
        // 句子音频
        fileUrl: '',
        fileUrl: "",
        // 音频绝对
        fullfileUrl: '',
        fullfileUrl: "",
        // 句子视频
        videoPath: '',
        videoPath: "",
        // 视频id
        videoId: '',
        videoId: "",
        // 标签
        tags: [],
        // 权限
        payType: 0
        payType: 0,
      },
      //   表格数据
      tableData: [],
@@ -436,44 +436,44 @@
      //   是否打开抽屉
      showDrawer: false,
      // 抽屉宽度
      drawerWidth: '600px',
      drawerWidth: "600px",
      //   抽屉表单数据
      drawer: {
        // 页面封面
        imgUrl: '',
        fullimgUrl: '',
        width: '',
        height: '',
        imgUrl: "",
        fullimgUrl: "",
        width: "",
        height: "",
        // 信息数据
        sons: [
          {
            id: 1,
            //   句子内容
            sentence: '',
            sentence: "",
            // 音频
            audioUrl: '',
            fullaudioUrl: '',
          }
        ]
            audioUrl: "",
            fullaudioUrl: "",
          },
        ],
      },
      // 编辑的drawerid
      drawerId: '',
      drawerId: "",
      warning: {
        setBooksId: false,
        bookName: false,
      }
    }
      },
    };
  },
  computed: {
    ...mapState('common', {
      user: state => JSON.parse(state.user)
    })
    ...mapState("common", {
      user: (state) => JSON.parse(state.user),
    }),
  },
  methods: {
    /**
     * 只能输入数字
     */
    limitNum (key) {
    limitNum(key) {
      if (key) {
        this.form[key] = this.form[key].replace(/[^0-9]/g, "");
      } else {
@@ -483,11 +483,17 @@
    /**
     * 限制句输入
     */
    limitWord (key, index) {
    limitWord(key, index) {
      if (index == undefined) {
        this.form[key] = this.form[key].replace(/[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g, '');
        this.form[key] = this.form[key].replace(
          /[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g,
          ""
        );
      } else {
        this.drawer.sons[index][key] = this.drawer.sons[index][key].replace(/[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g, '');
        this.drawer.sons[index][key] = this.drawer.sons[index][key].replace(
          /[^\a-\z\A-\Z\0-9\s\'\"\:\,\.\!\-\?\;]/g,
          ""
        );
      }
    },
    /**
@@ -497,48 +503,50 @@
     * key 区别属于哪个对象属性
     * index 抽屉组件多个上传索引
     */
    fnUpload (option, type, key, index) {
      let fileExtend = option.file.name.substring(option.file.name.lastIndexOf('.')).toLowerCase();
      let rulefileExtend = '';
    fnUpload(option, type, key, index) {
      let fileExtend = option.file.name
        .substring(option.file.name.lastIndexOf("."))
        .toLowerCase();
      let rulefileExtend = "";
      switch (type) {
        case '1':
        case "1":
          // 图片
          rulefileExtend = '.jpg、.jpeg、.png';
          rulefileExtend = ".jpg、.jpeg、.png";
          if (rulefileExtend.indexOf(fileExtend) === -1) {
            this.$message.error('只能上传.jpg、.jpeg、.png格式文件!');
            this.$message.error("只能上传.jpg、.jpeg、.png格式文件!");
            return false;
          } else {
            let isLt5M = option.file.size / 1024 / 1024 <= 5;
            if (!isLt5M) {
              this.$message.error('图片文件大小不超过5M!');
              this.$message.error("图片文件大小不超过5M!");
              return false;
            }
          }
          break;
        case '2':
        case "2":
          // 音频
          rulefileExtend = '.mp3';
          rulefileExtend = ".mp3";
          if (rulefileExtend.indexOf(fileExtend) === -1) {
            this.$message.error('只能上传.mp3格式文件!');
            this.$message.error("只能上传.mp3格式文件!");
            return false;
          } else {
            let isLt100M = option.file.size / 1024 / 1024 <= 100;
            if (!isLt100M) {
              this.$message.error('音频文件大小不超过100M!');
              this.$message.error("音频文件大小不超过100M!");
              return false;
            }
          }
          break;
        case '3':
        case "3":
          // 视频频
          rulefileExtend = '.mp4';
          rulefileExtend = ".mp4";
          if (rulefileExtend.indexOf(fileExtend) === -1) {
            this.$message.error('只能上传.mp4格式文件!');
            this.$message.error("只能上传.mp4格式文件!");
            return false;
          } else {
            let isLt500M = option.file.size / 1024 / 1024 <= 500;
            if (!isLt500M) {
              this.$message.error('视频文件大小不超过500M!');
              this.$message.error("视频文件大小不超过500M!");
              return false;
            }
          }
@@ -546,7 +554,7 @@
        default:
          break;
      }
      this.uploadFile(option.file, type, key, index)
      this.uploadFile(option.file, type, key, index);
    },
    /**
     * 上传文件
@@ -554,19 +562,18 @@
     * key 对应的key值
     * index 索引
     */
    uploadFile (file, type, key, index) {
      let uploadUrl = '';
    uploadFile(file, type, key, index) {
      let uploadUrl = "";
      let cid = 0;
      switch (type) {
        case '1':
          uploadUrl = '/Api/v1/ImgSet/imgUploadSub';
        case "1":
          uploadUrl = "/Api/v1/ImgSet/imgUploadSub";
          break;
        case '2':
          uploadUrl = '/Api/v1/AudioSet/audioUoloadSub';
        case "2":
          uploadUrl = "/Api/v1/AudioSet/audioUoloadSub";
          break;
        case '3':
          uploadUrl = '/Api/v1/VideosSet/videoUoloadSub';
        case "3":
          uploadUrl = "/Api/v1/VideosSet/videoUoloadSub";
          cid = 16;
          break;
@@ -574,101 +581,102 @@
          break;
      }
      let fileObj = {
        timestamp: moment().format('X'),
        classId: '',
        timestamp: moment().format("X"),
        classId: "",
        status: 0,
        title: file.name,
        releaseId: this.user.userId,
        releaseName: this.user.mobile,
        isInside: 0,
        cid,
        source: 6
        source: 6,
      };
      let formData = utils.fnUploadPara(fileObj, file);
      this.instance.post(uploadUrl, formData).then(res => {
        let { data, status } = res.data;
        if (status === 0) {
          if (index == undefined) {
            if (this.form.hasOwnProperty(key) && key != 'videoPath') {
              this.form[key] = data.filePath;
              this.form['full' + key] = data.fileUrl;
            } else if (this.drawer.hasOwnProperty(key)) {
              this.drawer[key] = data.filePath;
              this.drawer['full' + key] = data.fileUrl;
              this.drawer.width = data.width;
              this.drawer.height = data.height;
      this.instance
        .post(uploadUrl, formData)
        .then((res) => {
          let { data, status } = res.data;
          if (status === 0) {
            if (index == undefined) {
              if (this.form.hasOwnProperty(key) && key != "videoPath") {
                this.form[key] = data.filePath;
                this.form["full" + key] = data.fileUrl;
              } else if (this.drawer.hasOwnProperty(key)) {
                this.drawer[key] = data.filePath;
                this.drawer["full" + key] = data.fileUrl;
                this.drawer.width = data.width;
                this.drawer.height = data.height;
              }
              if (key == "videoPath") {
                this.form.videoId = data.aliyunVideoId;
                this.form.videoPath = data.fileUrl;
              }
            } else {
              this.drawer.sons[index].audioUrl = data.filePath;
              this.drawer.sons[index].fullaudioUrl = data.fileUrl;
            }
            if (key == 'videoPath') {
              this.form.videoId = data.aliyunVideoId;
              this.form.videoPath = data.fileUrl;
            }
          } else {
            this.drawer.sons[index].audioUrl = data.filePath;
            this.drawer.sons[index].fullaudioUrl = data.fileUrl;
          }
        }
      }).catch(err => {
        console.log(err)
      })
        })
        .catch((err) => {
          console.log(err);
        });
    },
    /**
     * 删除上传资源
     * key 对应的key值
     * index 索引
     */
    deleteFile (key, index) {
    deleteFile(key, index) {
      if (index == undefined) {
        if (this.form.hasOwnProperty(key) && key != 'videoPath') {
          this.form[key] = '';
          this.form['full' + key] = '';
        if (this.form.hasOwnProperty(key) && key != "videoPath") {
          this.form[key] = "";
          this.form["full" + key] = "";
        } else {
          this.drawer[key] = '';
          this.drawer['full' + key] = '';
          this.drawer[key] = "";
          this.drawer["full" + key] = "";
        }
        if (key == 'videoPath') {
          this.form.videoPath = '';
          this.form.videoId = '';
        if (key == "videoPath") {
          this.form.videoPath = "";
          this.form.videoId = "";
        }
      } else {
        this.drawer.sons[index].audioUrl = '';
        this.drawer.sons[index].fullaudioUrl = '';
        this.drawer.sons[index].audioUrl = "";
        this.drawer.sons[index].fullaudioUrl = "";
      }
    },
    /**
     * 添加页面信息
     */
    addInfo () {
      this.drawerId = '';
    addInfo() {
      this.drawerId = "";
      this.showDrawer = true;
    },
    /**
     * 关闭抽屉
     */
    drawCancel () {
    drawCancel() {
      this.showDrawer = false;
    },
    /**
     * 提交抽屉信息
     */
    drawSubmit () {
    drawSubmit() {
      if (!this.drawer.imgUrl) {
        this.tip('请上传页面图片!', '提示');
        this.tip("请上传页面图片!", "提示");
        return false;
      }
      let obj = {
        sort: '',
        sort: "",
        imgUrl: this.drawer.imgUrl,
        fullimgUrl: this.drawer.fullimgUrl,
        width: this.drawer.width,
        height: this.drawer.height,
        senCount: 0,
        audioCount: 0,
        sons: []
        sons: [],
      };
      this.drawer.sons.forEach(item => {
      this.drawer.sons.forEach((item) => {
        if (item.sentence) {
          obj.senCount++;
        }
@@ -679,7 +687,9 @@
          obj.sons.push(item);
        }
      });
      this.drawerId ? this.tableData[this.drawerId - 1] = obj : this.tableData.push(obj);
      this.drawerId
        ? (this.tableData[this.drawerId - 1] = obj)
        : this.tableData.push(obj);
      // sons排序
      this.tableData.forEach((item, index) => {
        item.sort = index + 1;
@@ -689,79 +699,83 @@
      });
      this.showDrawer = false;
      if (!this.drawerId) {
        this.drawer.imgUrl = '';
        this.drawer.fullimgUrl = '';
        this.drawer.width = '';
        this.drawer.height = '';
        this.drawer.imgUrl = "";
        this.drawer.fullimgUrl = "";
        this.drawer.width = "";
        this.drawer.height = "";
        this.drawer.sons = [
          {
            id: 1,
            //   句子内容
            sentence: '',
            sentence: "",
            // 音频
            audioUrl: '',
            audioUrl: "",
            // 路径
            fullaudioUrl: ''
          }
            fullaudioUrl: "",
          },
        ];
      }
    },
    /**
     * 编辑页面信息
     */
    edit (row) {
    edit(row) {
      this.drawerId = row.sort;
      if (!row.sons.length) {
        row.sons = [
          {
            id: 1,
            //   句子内容
            sentence: '',
            sentence: "",
            // 音频
            audioUrl: '',
            fullaudioUrl: ''
          }
            audioUrl: "",
            fullaudioUrl: "",
          },
        ];
      };
      }
      this.showDrawer = true;
      this.drawer = JSON.parse(JSON.stringify(row));
    },
    /**
     * 删除页面信息
     */
    del (row) {
      this.$confirm('您确定要删除此条数据吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableData.splice(row.sort - 1, 1);
        this.tableData.forEach((item, index) => {
          item.sort = index + 1;
        });
      }).catch(() => {
      });
    del(row) {
      this.$confirm("您确定要删除此条数据吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.tableData.splice(row.sort - 1, 1);
          this.tableData.forEach((item, index) => {
            item.sort = index + 1;
          });
        })
        .catch(() => {});
    },
    /**
     * 依次添加抽屉内容
     */
    addBox () {
    addBox() {
      let arr = [];
      this.drawer.sons.forEach(item => {
      this.drawer.sons.forEach((item) => {
        arr = [...arr, item.id];
      });
      let max = Math.max(...arr);
      this.drawer.sons = [
        ...this.drawer.sons,
        { id: max + 1, sentence: '', audioUrl: '', fullaudioUrl: '' }
        { id: max + 1, sentence: "", audioUrl: "", fullaudioUrl: "" },
      ];
    },
    /**
    向前插入句子
   */
    insertBefore (index) {
      this.drawer.sons.splice(index, 0, { sentence: '', audioUrl: '', fullaudioUrl: '' });
    insertBefore(index) {
      this.drawer.sons.splice(index, 0, {
        sentence: "",
        audioUrl: "",
        fullaudioUrl: "",
      });
      this.drawer.sons.forEach((item, index) => {
        item.id = index + 1;
      });
@@ -769,40 +783,39 @@
    /**
     * 删除抽屉内容
     */
    delBox (id) {
    delBox(id) {
      this.drawer.sons.forEach((item, index) => {
        if (item.id == id) {
          this.drawer.sons.splice(index, 1);
        }
      });
    },
    /**
     * 取消
     */
    cancel () {
      this.$router.push({ path: '/lineRead/readManage' });
    cancel() {
      this.$router.push({ path: "/lineRead/readManage" });
    },
    /**
     * 确定
     */
    submit () {
    submit() {
      let isSub = this.verify();
      if (isSub != '-1') {
        this.tip('请完善必填项信息!', '提示');
      if (isSub != "-1") {
        this.tip("请完善必填项信息!", "提示");
        return false;
      }
      if (!this.form.fileUrl) {
        this.tip('请上传音频!', '提示');
        this.tip("请上传音频!", "提示");
        return false;
      }
      if (!this.form.coverUrl) {
        this.tip('请上传点读书封面!', '提示');
        this.tip("请上传点读书封面!", "提示");
        return false;
      }
      this.addOrEditRead();
    },
    verify () {
    verify() {
      let { setBooksId, bookName } = this.form;
      let verify = { setBooksId, bookName };
      return utils.handleRequired(verify, this.warning);
@@ -811,39 +824,56 @@
     * 请求apis
     */
    // 标签数据
    async tagsList () {
    async tagsList() {
      let { code, data } = await readApi.tagsTree();
      if (code == 1) {
        this.tagsData = data.list;
      }
    },
    // 套装数据
    async unitBookAll () {
    async unitBookAll() {
      let { code, data } = await readApi.unitBookAll();
      if (code == 1) {
        this.uniBookData = data.list;
      }
    },
    // 提交保存
    async addOrEditRead () {
      let { status, setBooksId, bookName, sort, coverUrl, fileUrl, videoPath, videoId, tags, payType } = this.form;
      let wordCount = '';
      if (utils.removeAllSpace(this.wordCountSave + '') == utils.removeAllSpace(this.form.wordCount + '')) {
        wordCount = '0';
    async addOrEditRead() {
      let {
        status,
        setBooksId,
        bookName,
        sort,
        coverUrl,
        fileUrl,
        videoPath,
        videoId,
        tags,
        payType,
      } = this.form;
      let wordCount = "";
      if (
        utils.removeAllSpace(this.wordCountSave + "") ==
        utils.removeAllSpace(this.form.wordCount + "")
      ) {
        wordCount = "0";
      } else {
        wordCount = this.form.wordCount;
      }
      status = status ? 1 : 0;
      let tagStr = '';
      let tagStr = "";
      if (tags) {
        tags.forEach((item, index) => {
          tagStr = index == tags.length - 1 ? tagStr + item.join(",") : tagStr + item.join(",") + ',';
          tagStr =
            index == tags.length - 1
              ? tagStr + item.join(",")
              : tagStr + item.join(",") + ",";
        });
      }
      let tableData = JSON.stringify(this.tableData);
      tableData = JSON.parse(tableData);
      if (tableData.length) {
        tableData.forEach(item => {
        tableData.forEach((item) => {
          delete item.fullimgUrl;
          delete item.senCount;
          delete item.audioCount;
@@ -859,7 +889,7 @@
        status,
        setBooksId,
        bookName,
        sort ? sort : '0',
        sort ? sort : "0",
        wordCount,
        coverUrl,
        fileUrl,
@@ -870,41 +900,60 @@
        JSON.stringify(tableData)
      );
      if (code == 1) {
        this.$router.push({ path: '/lineRead/readManage' });
        this.$router.push({ path: "/lineRead/readManage" });
      }
    },
    // 点读书详情
    async getReadDetail () {
    async getReadDetail() {
      let { code, data } = await readApi.getReadDetail(this.id);
      if (code == 1) {
        this.tagsList();
        let { status, setBooksId, ResourcesBook, sort, wordCount, CoverUrl, FileUrl, videoPath, videoId, payType } = data.list;
        let {
          status,
          setBooksId,
          ResourcesBook,
          sort,
          wordCount,
          CoverUrl,
          FileUrl,
          videoPath,
          videoId,
          payType,
        } = data.list;
        this.form.status = status ? true : false;
        this.form.setBooksId = setBooksId ? setBooksId : '';
        this.form.setBooksId = setBooksId ? setBooksId : "";
        this.form.bookName = ResourcesBook;
        this.form.sort = sort;
        this.form.wordCount = wordCount ? wordCount : '0';
        this.form.wordCount = wordCount ? wordCount : "0";
        // 保留初始数据
        this.wordCountSave = wordCount;
        this.form.coverUrl = CoverUrl;
        this.form.fullcoverUrl = CoverUrl ? utils.controlUrl(CoverUrl) + CoverUrl : '';
        this.form.fullcoverUrl = CoverUrl
          ? utils.controlUrl(CoverUrl) + CoverUrl
          : "";
        console.log(this.form.fullcoverUrl);
        return;
        // wordAll = wordAll.replace(/\\n/g, '\n');
        // this.form.wordAll = wordAll;
        this.form.fileUrl = FileUrl;
        this.form.fullfileUrl = FileUrl ? utils.controlUrl(FileUrl) + FileUrl : '';
        this.form.fullfileUrl = FileUrl
          ? utils.controlUrl(FileUrl) + FileUrl
          : "";
        this.form.videoPath = videoPath;
        this.form.videoId = videoId ? videoId : '';
        this.form.videoId = videoId ? videoId : "";
        this.form.payType = payType;
        data.tagsSts.split(",").forEach(item => {
        data.tagsSts.split(",").forEach((item) => {
          let arr = item.split("-").map(Number);
          this.form.tags.push(arr);
        });
        data.pageInfo.forEach(item => {
        data.pageInfo.forEach((item) => {
          item.sort = item.FSort;
          item.imgUrl = item.ImgUrl;
          item.width = item.width ? item.width : '';
          item.height = item.height ? item.height : '';
          item.fullimgUrl = item.ImgUrl ? utils.controlUrl(item.ImgUrl) + item.ImgUrl : '';
          item.width = item.width ? item.width : "";
          item.height = item.height ? item.height : "";
          item.fullimgUrl = item.ImgUrl
            ? utils.controlUrl(item.ImgUrl) + item.ImgUrl
            : "";
          item.senCount = 0;
          item.audioCount = 0;
          delete item.FSort;
@@ -912,13 +961,15 @@
          delete item.Resources;
          delete item.pid;
          if (item.sons.length) {
            item.sons.forEach(son => {
            item.sons.forEach((son) => {
              son.id = son.id;
              son.EnTitle ? item.senCount++ : item.senCount;
              son.AudioUrl ? item.audioCount++ : item.audioCount
              son.AudioUrl ? item.audioCount++ : item.audioCount;
              son.sentence = son.EnTitle;
              son.audioUrl = son.AudioUrl;
              son.fullaudioUrl = son.AudioUrl ? utils.controlUrl(son.AudioUrl) + son.AudioUrl : '';
              son.fullaudioUrl = son.AudioUrl
                ? utils.controlUrl(son.AudioUrl) + son.AudioUrl
                : "";
              delete son.Sort;
              delete son.AudioUrl;
              delete son.EnTitle;
@@ -927,46 +978,48 @@
        });
        this.tableData = data.pageInfo;
      }
    }
    },
  },
  beforeRouteLeave (to, from, next) {
  beforeRouteLeave(to, from, next) {
    to.meta.keepAlive = true;
    next();
  },
  created () {
  created() {
    this.id = this.$route.query.id;
    this.getReadDetail();
    this.unitBookAll();
  },
  watch: {
    showDrawer: {
      handler (val, old) {
        val ? document.querySelector('body').setAttribute('style', 'overflow:hidden') : document.querySelector('body').setAttribute('style', 'overflow:auto');
      handler(val, old) {
        val
          ? document
              .querySelector("body")
              .setAttribute("style", "overflow:hidden")
          : document
              .querySelector("body")
              .setAttribute("style", "overflow:auto");
        if (this.drawerId && !val) {
          // 编辑状态点击取消
          this.drawer.imgUrl = '';
          this.drawer.width = '';
          this.drawer.height = '';
          this.drawer.fullimgUrl = '';
          this.drawer.imgUrl = "";
          this.drawer.width = "";
          this.drawer.height = "";
          this.drawer.fullimgUrl = "";
          this.drawer.sons = [
            {
              id: 1,
              //   句子内容
              sentence: '',
              sentence: "",
              // 音频
              audioUrl: '',
              fullaudioUrl: ''
            }
              audioUrl: "",
              fullaudioUrl: "",
            },
          ];
        }
      }
      },
    },
  }
}
  },
};
</script>
<style lang="less" scoped>
@deep: ~">>>";