Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout
| | |
| | | VUE_APP_ENV = 'product' |
| | | VUE_APP_API_URL = "https://jsek.bnuic.com" |
| | | VUE_APP_RESOURCE_CTX = 'https://jsek.bnuic.com/books/resource/' |
| | | VUE_APP_PUBLIC_PATH = 'https://jsek.bnuic.com/books/book/aviationEtiquette' |
| | | VUE_APP_PUBLIC_PATH = 'https://jsek.bnuic.com/books/book/toddlerGameImplementation' |
| | | # VUE_APP_RESOURCE_CTX = 'http://182.92.203.7:3007/books/resource/' |
| | | # VUE_APP_PUBLIC_PATH = 'http://182.92.203.7:3007/books/book/botany' |
| | | VUE_APP_BOOK_LIST = "childHealth/lifeCare/sportsAndHealth/embedded/english/artAndDance/artAndDrama/mathBook/botany/civilAviation/civilServices/meetingPlanners/aviationBasicSkills/aviationEtiquette/aviationSafety" |
| | | VUE_APP_BOOK_ID = 'aviationEtiquette' |
| | | VUE_APP_BOOK_LIST = "childHealth/lifeCare/sportsAndHealth/embedded/english/artAndDance/artAndDrama/mathBook/botany/civilAviation/civilServices/meetingPlanners/aviationBasicSkills/aviationEtiquette/aviationSafety/toddlerGameImplementation" |
| | | VUE_APP_BOOK_ID = 'toddlerGameImplementation' |
| | |
| | | import MG from "@/assets/js/middleGround/WebMiddleGroundApi"; |
| | | import {tokenKey} from '@/assets/js/config' |
| | | import { tokenKey } from "@/assets/js/config"; |
| | | import getPublicImage from "@/assets/js/middleGround/tool"; |
| | | // 获取题目列表 |
| | | const getQuestionList = async (page, questionList, activeBook) => { |
| | | const token = localStorage.getItem(tokenKey) |
| | | let collectList = [] |
| | | if(token) collectList = await getCollectList(activeBook) |
| | | const token = localStorage.getItem(tokenKey); |
| | | let collectList = []; |
| | | if (token) collectList = await getCollectList(activeBook); |
| | | const oldAnswerData = localStorage.getItem(activeBook.name + "oldAnswerData"); |
| | | let oldData = null; |
| | | let oldList = []; |
| | |
| | | const getCollectList = async(activeBook) => { |
| | | const allCollect = [ |
| | | { |
| | | type:'bits', |
| | | collectList:[] |
| | | type: "bits", |
| | | collectList: [], |
| | | }, |
| | | { |
| | | type:'json', |
| | | collectList:[] |
| | | type: "json", |
| | | collectList: [], |
| | | }, |
| | | ] |
| | | await MG.identity |
| | | .getUserKey({ |
| | | domain: 'collectData', |
| | | keys: [activeBook.bookId] |
| | | }) |
| | | .then((res) => { |
| | | ]; |
| | | const res = await MG.identity.getUserKey({ |
| | | domain: "collectData", |
| | | keys: [activeBook.bookId], |
| | | }); |
| | | try { |
| | | const collect = JSON.parse(res[0].value) |
| | | const collect = JSON.parse(res[0].value); |
| | | if (collect.length) { |
| | | allCollect[0].collectList = collect.find( |
| | | (citem) => citem.type == 'bits' |
| | | ).collectList |
| | | (citem) => citem.type == "bits" |
| | | ).collectList; |
| | | allCollect[1].collectList = collect.find( |
| | | (citem) => citem.type == 'json' |
| | | ).collectList |
| | | (citem) => citem.type == "json" |
| | | ).collectList; |
| | | } |
| | | } catch (error) { |
| | | console.log('暂无数据') |
| | | console.log("暂无数据"); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | console.log('获取收藏报错'); |
| | | }) |
| | | console.log('收藏数据',allCollect.find(item => item.type == 'bits').collectList) |
| | | return allCollect.find(item => item.type == 'bits').collectList |
| | | } |
| | | return allCollect.find((item) => item.type == "bits").collectList; |
| | | }; |
| | | const getQuestionData = async (chapter, chapterData, activeBook) => { |
| | | const data = { ...chapterData }; |
| | | const oldAnswerData = localStorage.getItem("oldAnswerData"); |
| | |
| | | import identityApi from "../js/middleGround/api/identity"; |
| | | import { tokenKey } from "../js/config"; |
| | | export const getResourcePath = async (md5, appRefCode = "jingshieke") => { |
| | | let path = ""; |
| | | await fileApi |
| | | .getAliVod({ |
| | | const res = fileApi.getAliVod({ |
| | | md5, |
| | | appRefCode, |
| | | }) |
| | | .then((res) => { |
| | | if (res) { |
| | | if (res && res.data == '') { |
| | | path = process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5; |
| | | } else { |
| | | path = res; |
| | | } |
| | | } else if (md5) { |
| | | path = process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5; |
| | | } |
| | | }); |
| | | return path; |
| | | return res.data != "" && res.data != undefined |
| | | ? res.data |
| | | : process.env.VUE_APP_API_URL + "/file/api/ApiDownload?md5=" + md5; |
| | | }; |
| | | // 获取收藏的资源 |
| | | export const getCollectResource = async (key) => { |
| | | if(!localStorage.getItem(tokenKey)) return [] |
| | | let list = [] |
| | | await identityApi |
| | | .getUserKey({ |
| | | if (!localStorage.getItem(tokenKey)) return []; |
| | | const res = await identityApi.getUserKey({ |
| | | domain: "collectResource", |
| | | keys: [key], |
| | | }) |
| | | .then((res) => { |
| | | if(res.length) { |
| | | list = JSON.parse(res[0].value) |
| | | } |
| | | }); |
| | | return list |
| | | } |
| | | return res.length ? JSON.parse(res[0].value) : []; |
| | | }; |
| | | export const setCollectResource = (key,list) => { |
| | | identityApi.setUserKey({ |
| | | setKeyRequests: [ |
| | |
| | | value: JSON.stringify(list), |
| | | }, |
| | | ], |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | const MT = { |
| | | getResourcePath, |
| | | getCollectResource, |
| | | setCollectResource |
| | | setCollectResource, |
| | | }; |
| | | |
| | | export default MT; |
| | |
| | | console.log("暂无数据"); |
| | | } |
| | | }) |
| | | .catch((res) => { |
| | | .catch(() => { |
| | | console.log("index 请求题目收藏id报错"); |
| | | }); |
| | | console.log('收藏id',this.collectId); |