YM
2024-05-22 e296b2bd6cebec047d9406476bf6a7eb323deff9
调整
4个文件已修改
48 ■■■■■ 已修改文件
src/App.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/config.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/content/index.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue
@@ -11,7 +11,7 @@
import childHealth from "./books/childHealth/view/index.vue";
import book from "./books/content/index.vue";
import embedded from "./books/embedded/view/index.vue";
import english from "./books/English/view/index.vue"
import english from "./books/English/view/index.vue";
export default {
  name: "App",
@@ -23,18 +23,28 @@
  },
  data() {
    return {
      activeBook: {},
      activeBook: {}
    };
  },
  async created() {
    this.activeBook = this.thisBookConfig;
    console.log('图书',this.activeBook);
    if (this.$store.state.qiankun,this.$store.state.qiankun.getBookConfig) {
    if (this.setGlobalState) {
      this.setGlobalState({
        initTestBook: async (bookId) => {
          this.activeBook = await this.config.getBookConfig(bookId);
          console.log("图书", this.activeBook);
          if (
            (this.$store.state.qiankun, this.$store.state.qiankun.getBookConfig)
          ) {
      this.$store.state.qiankun.getBookConfig({
        bookConfig: this.activeBook,
              bookConfig: this.activeBook
      });
    }
  },
        }
      });
    } else {
      this.activeBook = await this.config.getBookConfig();
    }
  }
};
</script>
src/assets/js/config.js
@@ -1,10 +1,12 @@
import axios from "axios";
export const resourceCtx = "http://182.92.203.7:3007/books/resource/1"; // 资源请求地址
export const resourceCtx = "http://182.92.203.7:3007/books/resource/"; // 资源请求地址
export let activeBook = {}; // 资源请求地址
export let goodsStore = "";
// 请求教材配置信息
const getBookConfig = async () => {
  const response = await axios.get(resourceCtx + "/bookConfig.json");
const getBookConfig = async (bookId) => {
  const response = await axios.get(
    resourceCtx + (bookId ? bookId : "1") + "/bookConfig.json"
  );
  activeBook = response.data;
  goodsStore = response.data.storeRefcode;
  return response.data;
@@ -20,6 +22,6 @@
  tokenKey,
  goodsStore,
  appId,
  getBookConfig,
  getBookConfig
};
export default config;
src/books/childHealth/view/content/index.vue
@@ -296,16 +296,16 @@
      ).querySelectorAll(".theme-border");
      // 获取配置的主题色
      const bookThemeColor =
        this.thisBookConfig && this.thisBookConfig.bookThemeColor
          ? this.thisBookConfig.bookThemeColor
        this.config.activeBook && this.config.activeBook.bookThemeColor
          ? this.config.activeBook.bookThemeColor
          : null;
      const chapterThemeColor =
        this.thisBookConfig && this.thisBookConfig.chapterThemeColor
          ? this.thisBookConfig.chapterThemeColor
        this.config.activeBook && this.config.activeBook.chapterThemeColor
          ? this.config.activeBook.chapterThemeColor
          : null;
      const pageThemeColor =
        this.thisBookConfig && this.thisBookConfig.pageThemeColor
          ? this.thisBookConfig.pageThemeColor
        this.config.activeBook && this.config.activeBook.pageThemeColor
          ? this.config.activeBook.pageThemeColor
          : null;
      colorDom.forEach((domItem) => {
        // 获取章节、页码
src/main.js
@@ -10,7 +10,7 @@
// 自定义配置
import config from "@/assets/js/config";
Vue.prototype.config = config;
Vue.prototype.thisBookConfig = await config.getBookConfig();
// Vue.prototype.thisBookConfig = await config.getBookConfig();
// 请求处理
import MG from "@/assets/js/middleGround/WebMiddleGroundApi";