旅游教育出版社-数字教材移动端
QYF-GitLab1
17 小时以前 8e3ee81b6ed824866734b7034604121f370f4201
src/views/personalCenter/teacherCertificate.vue
@@ -150,7 +150,7 @@
            label="联系电话"
            :rules="[
              { required: true, message: '请填写您的手机号码!' },
              { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式错误!' }
              { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式错误!' },
            ]"
            placeholder="请输入您的联系电话"
          />
@@ -216,7 +216,11 @@
          </div>
          <div
            v-if="!stateDisable"
            style="background-color: rgb(240, 240, 240); padding-top: 25px; height: 175px"
            style="
              background-color: rgb(240, 240, 240);
              padding-top: 25px;
              height: 175px;
            "
          >
            <van-checkbox
              v-model="approve.agree"
@@ -241,7 +245,7 @@
            </div>
          </div>
          <div v-if="stateDisable && approve.state != 'WaitAudit'">
            <div style="margin:40px;">
            <div style="margin: 40px">
              <van-button round block type="info" @click="stateDisable = false"
                >修 改</van-button
              >
@@ -294,7 +298,7 @@
      protocolTxt: "",
      refCode: "",
      headers: {
        Authorization: ""
        Authorization: "",
      },
      submitDisabled: true, // 提交按钮,默认禁选
      showPicker: false,
@@ -337,7 +341,7 @@
        //相关证件
        certificate: [],
        // 教师同意勾选框
        checked: false
        checked: false,
      },
      isUpdate: false,
@@ -358,7 +362,7 @@
        // description: "", //个人简介
        relevantCertificates: [], //相关证件
        state: "", //审核状态默认待审核
        agree: false
        agree: false,
      },
      //picker选择列表
      colunmsJob: [
@@ -370,7 +374,7 @@
        "系副主任",
        "专业负责人",
        "主任",
        "其他"
        "其他",
      ],
      colunmsTitle: ["正高级", "高级", "一级", "二级", "三级", "无"],
      colunmsEdu: ["大专", "本科", "硕士", "博士"],
@@ -379,14 +383,14 @@
      fileList: [],
      isWaitAudit: false,
      userId: "",
      isFree: false
      isFree: false,
    };
  },
  watch: {
    "approve.agree": {
      handler(val) {
        this.submitDisabled = !val;
      }
      },
    },
    $route(to, from) {
      if (
@@ -395,7 +399,7 @@
      ) {
        this.getProtocol();
      }
    }
    },
  },
  created() {
    var that = this;
@@ -432,7 +436,7 @@
    finishAddress({ selectedOptions }) {
      this.showPicker3 = false;
      this.approve.region = selectedOptions
        .map(option => option.text)
        .map((option) => option.text)
        .join("/");
    },
    deleteFile(file) {
@@ -444,33 +448,39 @@
    },
    getUserRole() {
      let that = this;
      that.MG.identity.getCurrentAppUser().then(res => {
      that.MG.identity.getCurrentAppUser().then((res) => {
        that.userId = res.userId;
        let teacherRole = res.roleLinks.find(item => item.role?.refCode == "teacher");
        let teacherInfo = res.infoList.find(item => item.type == "teacherInfo") ?? {};
        let wechatInfo = res.infoList.find(item => item.type == "WeChat") ?? {};
        let studentInfo = res.infoList.find(item => item.type == "Default");
        let phoneInfo = res.secretList.find(item => item.type == "MobilePhone");
        let teacherRole = res.roleLinks.find(
          (item) => item.role?.refCode == "teacher"
        );
        let teacherInfo =
          res.infoList.find((item) => item.type == "teacherInfo") ?? {};
        let wechatInfo =
          res.infoList.find((item) => item.type == "WeChat") ?? {};
        let studentInfo = res.infoList.find((item) => item.type == "Default");
        let phoneInfo = res.secretList.find(
          (item) => item.type == "MobilePhone"
        );
        if (teacherRole && teacherInfo) {
          this.$store.dispatch("setUserInfo", {
            ...teacherInfo,
            phoneNumber: phoneInfo?.credential,
            icon: wechatInfo?.icon,
            role: "Teacher",
            roleId: teacherRole.role.id
            roleId: teacherRole.role.id,
          });
        } else if (wechatInfo) {
          this.$store.dispatch("setUserInfo", {
            ...wechatInfo,
            phoneNumber: phoneInfo?.credential,
            role: "Student"
            role: "Student",
          });
        } else if (studentInfo) {
          this.$store.dispatch("setUserInfo", {
            ...studentInfo,
            icon: wechatInfo?.icon,
            phoneNumber: phoneInfo?.credential,
            role: "Student"
            role: "Student",
          });
        }
      });
@@ -478,9 +488,9 @@
    getType() {
      const data = {
        refCodes: ["tourism_teacherCertification"]
        refCodes: ["tourism_teacherCertification"],
      };
      this.MG.resource.getCmsTypeByRefCode(data).then(res => {
      this.MG.resource.getCmsTypeByRefCode(data).then((res) => {
        this.newGetTeacherInfo();
        this.worksInfo = res[0].cmsTypeLinks[0].children;
      });
@@ -496,15 +506,15 @@
        appRefCode: "tourismWebsite",
        sort: {
          type: "Desc",
          field: "CreateDate"
        }
          field: "CreateDate",
        },
      };
      that.MG.ugc.getTopicMessageList(data).then(res => {
      that.MG.ugc.getTopicMessageList(data).then((res) => {
        try {
          if (res.datas.length > 0) {
            that.fileList = [];
            const resData = res.datas.find(
              i => i.appUserCreator.userId == that.userId
              (i) => i.appUserCreator.userId == that.userId
            );
            that.approve = that.tool.resultsBytool(
              that.worksInfo,
@@ -528,7 +538,7 @@
            }
            if (that.approve.relevantCertificates.length > 0) {
              if (typeof that.approve.relevantCertificates == "object") {
                that.approve.relevantCertificates.forEach(ele => {
                that.approve.relevantCertificates.forEach((ele) => {
                  let imgObj = {
                    md5: ele.file.md5,
                    url:
@@ -537,7 +547,7 @@
                      ele.file.md5,
                    linkType: "LinkFile",
                    linkProtectType: "Public",
                    isImage: true
                    isImage: true,
                  };
                  that.fileList.push(imgObj);
                });
@@ -550,7 +560,7 @@
                  md5: that.approve.relevantCertificates,
                  linkType: "LinkFile",
                  linkProtectType: "Public",
                  isImage: true
                  isImage: true,
                };
                that.fileList.push(imgObj);
              }
@@ -570,13 +580,13 @@
        .getItem({
          path: "tourism_protocol",
          fields: {
            tourism_content: []
          }
            tourism_content: [],
          },
        })
        .then(res => {
        .then((res) => {
          try {
            const data = res.datas.find(
              e => e.refCode == "tourism_teacherCertificationAgreement"
              (e) => e.refCode == "tourism_teacherCertificationAgreement"
            );
            this.protocolTxt = data ? data.tourism_content : "暂无协议";
          } catch (error) {
@@ -609,7 +619,7 @@
              this.worksInfo,
              this.approve,
              this.fileList
            )
            ),
          };
          let basicInfo = JSON.parse(JSON.stringify(this.approve));
          delete basicInfo.agree;
@@ -620,16 +630,24 @@
              {
                data: JSON.stringify(basicInfo),
                name: basicInfo.fullName,
                type: "teacherInfo"
              }
            ]
                type: "teacherInfo",
              },
            ],
          };
          this.MG.identity.setAppUserInfo(userInfo).then(res => {
          this.MG.identity.setAppUserInfo(userInfo).then((res) => {
            this.MG.ugc.newTopicMessage(data).then(() => {
              console.log(res);
              this.subLoading = true;
              const fromRouter = this.$route.query;
              if (res !== false) {
                that.newGetTeacherInfo();
              }
              if (fromRouter.from && fromRouter.from == "bookDetail") {
                this.$router.replace({
                  name: "bookDetail",
                  query: {
                    id: this.$route.query.id,
                  },
                });
              }
            });
          });
@@ -665,8 +683,8 @@
        newDataRequests: fields.newData,
        updateDataRequests: fields.updateData,
        delDataRequest: {
          ids: []
        }
          ids: [],
        },
      };
      delete basicInfo.tourism_relevantCertificates;
      delete basicInfo.agree;
@@ -677,17 +695,26 @@
          {
            data: JSON.stringify(basicInfo),
            name: basicInfo.fullName,
            type: "newTeacherInfo"
          }
        ]
            type: "newTeacherInfo",
          },
        ],
      };
      this.MG.identity.setAppUserInfo(userInfo).then(res => {
      this.MG.identity.setAppUserInfo(userInfo).then((res) => {
        if (res) {
          this.MG.ugc.updateTopicMessage(data).then(res => {
          this.MG.ugc.updateTopicMessage(data).then((res) => {
            this.subLoading = false;
            const fromRouter = this.$route.query;
            if (res !== false) {
              this.getUserRole();
              this.newGetTeacherInfo();
            }
            if (fromRouter.from && fromRouter.from == "bookDetail") {
              this.$router.replace({
                name: "bookDetail",
                query: {
                  id: this.$route.query.id,
                },
              });
            }
          });
        }
@@ -737,7 +764,7 @@
      let size = 1024;
      that.tool
        .getFileMd5(file.file, size * 1024)
        .then(e => {
        .then((e) => {
          const imgData = new FormData();
          that.fileMd5 = e;
          imgData.append("Md5", e);
@@ -746,14 +773,14 @@
          imgData.append("FileType", FileType);
          imgData.append("MetaData", null);
          imgData.append("file", file.file);
          that.MG.file.upload(imgData).then(res => {
          that.MG.file.upload(imgData).then((res) => {
            if (res) {
              this.fileList.push({
                md5: e,
                url: this.config.requestCtx + `/file/GetPreViewImage?md5=` + e,
                linkType: "LinkFile",
                linkProtectType: "Public",
                isImage: true
                isImage: true,
              });
              this.approve.relevantCertificates = this.fileList;
              // this.fileList = this.approve.relevantCertificates
@@ -761,7 +788,7 @@
            }
          });
        })
        .catch(e => {
        .catch((e) => {
          that.isLoding = false;
          console.error(e);
        });
@@ -802,12 +829,12 @@
      }
      this.MG.store
        .getProductTypeField({
          refCodes: ["post"]
          refCodes: ["post"],
        })
        .then(res => {
        .then((res) => {
          if (res && res[0].config) {
            let list = JSON.parse(res[0].config).option;
            list.forEach(item => {
            list.forEach((item) => {
              item.text = item.name;
            });
            this.colunmsJob = list;
@@ -822,12 +849,12 @@
      }
      this.MG.store
        .getProductTypeField({
          refCodes: ["positionalTitle"]
          refCodes: ["positionalTitle"],
        })
        .then(res => {
        .then((res) => {
          if (res && res[0].config) {
            let list = JSON.parse(res[0].config).option;
            list.forEach(item => {
            list.forEach((item) => {
              item.text = item.name;
            });
            this.colunmsTitle = list;
@@ -841,12 +868,12 @@
      }
      this.MG.store
        .getProductTypeField({
          refCodes: ["education"]
          refCodes: ["education"],
        })
        .then(res => {
        .then((res) => {
          if (res && res[0].config) {
            let list = JSON.parse(res[0].config).option;
            list.forEach(item => {
            list.forEach((item) => {
              item.text = item.name;
            });
            this.colunmsEdu = list;
@@ -877,8 +904,8 @@
    onConfirm2(value) {
      this.approve.education = value.text;
      this.showPicker2 = false;
    }
  }
    },
  },
};
</script>