Prechádzať zdrojové kódy

还有isdata 从个人中心跳转新街口

秦鹏 3 rokov pred
rodič
commit
0e67b101bb

+ 20 - 0
src/api/api.js

@@ -149,6 +149,26 @@ export function materialdetail(data) {
         data,
     })
 }
+
+export function Personamaterialdetail(data) {
+    let userInfor = getToken()
+    let UserCode = '',
+        UserType = '',
+        SessionID = ''
+    if (userInfor) {
+        userInfor = JSON.parse(getToken())
+        UserCode = userInfor.user_code;
+        UserType = userInfor.user_type;
+        SessionID = userInfor.session_id;
+    }
+
+    return request({
+        url: `/GCLSTCServer/material/detail4owner?UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}`,
+        method: "post",
+        data,
+    })
+}
+
 // 上传附件(课程资源)
 export function attachmentinsert(data) {
     return request({

+ 11 - 2
src/components/Header.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 顶部登录导航 -->
-  <div class="LoginNav1">
+  <div class="LoginNav1" v-if="isData">
     <div class="logo" v-if="configInfor">
       <img
         v-if="configInfor.logo_image_url"
@@ -159,6 +159,7 @@ export default {
       lang: "",
       headTimer: null,
       configInfor: null,
+      isData:false,
     };
   },
   watch: {},
@@ -270,9 +271,17 @@ export default {
         });
     },
   },
-  created() {
+  async created() {
     let _this = this;
     _this.getChildSysList();
+    console.log("v2022.09.09.17:38");
+    let userInfor = getToken();
+    if (userInfor) {
+      await updateWordPack({
+        word_key_list: ["Key9", "Key8", "Key39"],
+      });
+      this.isData = true;
+    }
   },
   mounted() {
     let _this = this;

+ 3 - 1
src/components/teacher-dev/Textbook.vue

@@ -26,7 +26,7 @@
         ></el-image> -->
         <p class="one_name">{{ item.name }}</p>
         <p class="price">
-          ¥<span class="price_1" v-html="changePrice(item.price*1, 24, 16)"></span>
+          ¥<span class="price_1" v-html="changePrice(item.price * 1, 24, 16)"></span>
         </p>
       </div>
     </div>
@@ -54,6 +54,8 @@ export default {
         path: "/Preview",
         query: {
           id: item.id,
+          invok_module: "GCLS-Personal",
+
         },
       });
     },

+ 74 - 48
src/views/teacher-dev/Preview.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 预览 -->
-  <div class="tarcer-dev-Preview" v-loading="loading">
+  <div class="tarcer-dev-Preview" v-loading="loading" v-if="isData">
     <Header />
 
     <HeaderOne v-if="!Ispreview && data" :text="data.name" :allList="allList" />
@@ -18,20 +18,13 @@
         <div class="pay_collect" v-if="!Ispreview">
           <div class="price" v-if="!data.isPurchased">
             ¥
-            <span
-              class="price_1"
-              v-html="changePrice(data.price * 1, 24, 16)"
-            ></span>
+            <span class="price_1" v-html="changePrice(data.price * 1, 24, 16)"></span>
           </div>
           <div class="pay" @click="buy" v-if="!data.isPurchased">
             <!-- 购买 -->{{ $t("Key72") }}
           </div>
           <div class="download" v-if="data.isPurchased && IsDownload">
-            <img
-              @click="download"
-              src="../../assets/teacherdev/download.png"
-              alt=""
-            />
+            <img @click="download" src="../../assets/teacherdev/download.png" alt="" />
             <!-- <span>DOWNLOAD</span> -->
           </div>
           <div class="collect">
@@ -53,9 +46,7 @@
       <div :class="data.isPurchased || Ispreview ? 'buy' : 'NObuy'">
         <!--fileUrl需要改成安全地址 file_url_https -->
         <iframe
-          v-if="
-            attachment[0].fileType != 'pdf' && attachment[0].fileType != 'PDF'
-          "
+          v-if="attachment[0].fileType != 'pdf' && attachment[0].fileType != 'PDF'"
           :src="
             'https://view.officeapps.live.com/op/view.aspx?src=' +
             `${attachment[0].fileUrlHttps}`
@@ -81,14 +72,8 @@
         <!-- 点击购买 -->{{ $t("Key574") }}
       </div>
     </div>
-    <el-dialog
-      :visible.sync="NopymentShow"
-      width="720px"
-      :before-close="closeNoPyment"
-    >
-      <div class="dialogTitle" slot="title">
-        <!-- 商品详情 -->{{ $t("Key52") }}
-      </div>
+    <el-dialog :visible.sync="NopymentShow" width="720px" :before-close="closeNoPyment">
+      <div class="dialogTitle" slot="title"><!-- 商品详情 -->{{ $t("Key52") }}</div>
       <Confirmorder
         ref="Confirmorder"
         :data="data"
@@ -103,11 +88,7 @@
       width="720px"
       :before-close="closePyment"
     >
-      <Payment
-        :data="data"
-        :orderNumber="orderNumber"
-        :closePyment="closePyment"
-      />
+      <Payment :data="data" :orderNumber="orderNumber" :closePyment="closePyment" />
     </el-dialog>
   </div>
 </template>
@@ -121,7 +102,12 @@ import Payment from "@/components/payment/Payment";
 import { updateWordPack } from "@/utils/i18n";
 import { getToken } from "@/utils/auth";
 
-import { materialdetail, materialvisit, LearnWebSI } from "@/api/api";
+import {
+  materialdetail,
+  materialvisit,
+  LearnWebSI,
+  Personamaterialdetail,
+} from "@/api/api";
 export default {
   name: "tarcer-dev-Preview",
   components: {
@@ -145,6 +131,7 @@ export default {
       orderNumber: null, //订单号
       IsDownload: false, //是否可以下载
       allList: null,
+      isData: false,
     };
   },
   computed: {},
@@ -172,12 +159,7 @@ export default {
         `/GCLSFileServer/WebFileDownload?UserCode=${data.UserCode}&UserType=${data.UserType}&SessionID=${data.SessionID}&FileID=${data.FileID}`;
     },
     // 生成订单 同时切换到支付弹窗
-    changeOrderNumber(
-      val,
-      back_discount_code,
-      discount_money,
-      receivables_money
-    ) {
+    changeOrderNumber(val, back_discount_code, discount_money, receivables_money) {
       this.orderNumber = val;
       this.NopymentShow = false;
       this.data.back_discount_code = back_discount_code;
@@ -213,9 +195,7 @@ export default {
     getNumPages() {
       this.loading = true;
       let _this = this;
-      let loadingTask = pdf.createLoadingTask(
-        _this.attachment[0].fileRelativePath
-      );
+      let loadingTask = pdf.createLoadingTask(_this.attachment[0].fileRelativePath);
 
       loadingTask.promise
         .then((pdf) => {
@@ -314,8 +294,49 @@ export default {
               // this.attachment[0].fileRelativePath =
               //   process.env.VUE_APP_BASE_API + this.attachment[0].fileRelativePath;
               this.attachment[0].fileRelativePath =
-                process.env.VUE_APP_PDF_API +
-                this.attachment[0].fileRelativePath;
+                process.env.VUE_APP_PDF_API + this.attachment[0].fileRelativePath;
+              console.log(this.attachment[0].fileRelativePath);
+              this.getNumPages();
+            }
+            this.changePrice(this.data.price * 1, 24, 16);
+          }
+        })
+        .catch((res) => {
+          this.loading = false;
+        });
+    },
+    PersonalDetail() {
+      this.loading = true;
+      Personamaterialdetail({
+        materialId: this.materialId,
+        isSelectForUpdate: this.Ispreview ? true : false,
+      })
+        .then((res) => {
+          if (res.data.result) {
+            let index = res.data.result.tag.indexOf("downloadable");
+            if (index != -1) {
+              this.IsDownload = true;
+            }
+            this.data = res.data.result;
+            this.data.pymentTeacher = "";
+            res.data.result.teacher.forEach((item, i) => {
+              if (i != this.data.teacher.length - 1) {
+                this.data.pymentTeacher += item + ";";
+              } else {
+                this.data.pymentTeacher += item;
+              }
+            });
+            this.data.fileType = this.data.tag[this.data.tag.length - 1];
+            this.attachment = JSON.parse(res.data.result.attachment);
+            this.loading = false;
+            if (
+              this.attachment[0].fileType == "pdf" ||
+              this.attachment[0].fileType == "PDF"
+            ) {
+              // this.attachment[0].fileRelativePath =
+              //   process.env.VUE_APP_BASE_API + this.attachment[0].fileRelativePath;
+              this.attachment[0].fileRelativePath =
+                process.env.VUE_APP_PDF_API + this.attachment[0].fileRelativePath;
               console.log(this.attachment[0].fileRelativePath);
               this.getNumPages();
             }
@@ -363,18 +384,23 @@ export default {
     this.materialId = this.$route.query.id;
     this.Ispreview = this.$route.query.type;
     this.allList = this.$route.query.allList;
-    if (this.materialId) {
-      this.getdetail();
-      if (!this.Ispreview) {
-        materialvisit({
-          id: this.materialId,
-        })
-          .then((res) => {})
-          .catch((res) => {
-            this.loading = false;
-          });
+    if (this.$route.query.invok_module == "GCLS-Personal") {
+      this.PersonalDetail();
+    } else {
+      if (this.materialId) {
+        this.getdetail();
+        if (!this.Ispreview) {
+          materialvisit({
+            id: this.materialId,
+          })
+            .then((res) => {})
+            .catch((res) => {
+              this.loading = false;
+            });
+        }
       }
     }
+
     let node = document.getElementsByClassName("cui-ribbonTopBars")[0];
     console.log(node);
   },

+ 2 - 1
src/views/teacher-dev/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="teacher_edu">
+  <div class="teacher_edu" v-if="isData">
     <!-- 头部导航及搜索 -->
     <Header />
     <div class="nav_title">
@@ -84,6 +84,7 @@ export default {
       textBookList: null, //book数据
       teachingList: null, // tea数据
       toolBookList: null, //工具书
+      isData: false,
     };
   },
   computed: {},