1
杨磊
2025-03-31 2a1f356bb2b37cb8b56eb1d8bc94bf4fe4639e0f
1
1个文件已修改
36个文件已添加
19922 ■■■■■ 已修改文件
.gitignore 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
babel.config.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jsconfig.json 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 9222 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/favicon.ico 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/base.css 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/common.css 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/font/兰亭黑 GBK.TTF 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/images/homeBg.png 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/images/profilePhoto.png 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/config.js 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/WebMiddleGroundApi.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/app.js 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/edu.js 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/file.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/identity.js 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/job.js 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/resource.js 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/store.js 672 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/ugc.js 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/tool.js 430 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/questionModel.js 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/toolClass.js 468 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/userAction.js 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/logo.png 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/base.vue 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/index.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/plugin/axios/index.js 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/index.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yarn.lock 6726 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1,21 +1,23 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj
.DS_Store
node_modules
/dist
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# local env files
.env.local
.env.*.local
# Executables
*.exe
*.out
*.app
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
babel.config.js
New file
@@ -0,0 +1,5 @@
module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ]
}
jsconfig.json
New file
@@ -0,0 +1,19 @@
{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "baseUrl": "./",
    "moduleResolution": "node",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  }
}
package-lock.json
New file
Diff too large
package.json
New file
@@ -0,0 +1,64 @@
{
  "name": "website",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.27.2",
    "core-js": "^3.8.3",
    "element-china-area-data": "^6.1.0",
    "element-ui": "^2.15.10",
    "moment": "^2.29.4",
    "qrcodejs2": "0.0.2",
    "spark-md5": "^3.0.2",
    "video.js": "^7.20.3",
    "vue": "^2.6.14",
    "vue-qr": "^4.0.9",
    "vue-router": "^3.5.1",
    "vue-video-player": "^5.0.2",
    "vue-wxlogin": "^1.0.4",
    "vuex": "^3.6.2",
    "xlsx": "^0.18.5"
  },
  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0",
    "@vue/cli-plugin-eslint": "~5.0.0",
    "@vue/cli-plugin-router": "~5.0.0",
    "@vue/cli-plugin-vuex": "~5.0.0",
    "@vue/cli-service": "~5.0.0",
    "eslint": "^7.32.0",
    "eslint-plugin-vue": "^8.0.3",
    "less": "^4.1.3",
    "less-loader": "^11.0.0",
    "vue-template-compiler": "^2.6.14"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "@babel/eslint-parser"
    },
    "rules": {
      "vue/multi-word-component-names": 0,
      "no-debugger": "off",
      "no-unused-vars": "warn"
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}
public/favicon.ico
public/index.html
New file
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Sans+SC:100,300,400,500,700,900">
    <title>王永炎数据库</title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>
src/App.vue
New file
@@ -0,0 +1,29 @@
<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
export default {
  methods: {
    getBack() {
      document.documentElement.scrollTop = document.body.scrollTop;
    },
  },
};
</script>
<style>
@import "~@/assets/css/base.css";
@import "~@/assets/css/common.css";
#app {
  width: 100%;
  height: 100%;
  font-family: lanting;
  font-weight: 100;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: auto !important;
}
</style>
src/assets/css/base.css
New file
@@ -0,0 +1,250 @@
/**
 * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
 * http://cssreset.com
 */
html,
body,
div,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video,
input {
  margin: 0;
  padding: 0;
  border: 0;
  font-weight: normal;
  vertical-align: baseline;
}
@font-face {
  font-family: "lanting";
  src: url(../font/兰亭黑\ GBK.TTF);
}
@font-face {
  font-family: "LanTing";
  src: url(../font/兰亭黑\ GBK.TTF);
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
blockquote {
  font-size: 14px;
}
a,
button,
input {
  outline: none;
}
/* custom */
a {
  color: #7e8c8d;
  text-decoration: none;
  -webkit-backface-visibility: hidden;
}
li {
  list-style: none;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track-piece {
  background-color: rgba(0, 0, 0, 0.2);
  -webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:vertical {
  height: 5px;
  background-color: rgba(125, 125, 125, 0.7);
  -webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:horizontal {
  width: 5px;
  background-color: rgba(125, 125, 125, 0.7);
  -webkit-border-radius: 6px;
}
body {
  -webkit-text-size-adjust: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* * {
  font-size: 14px;
} */
html,
body {
  width: 100%;
  height: 100%;
  /* min-width: 1500px; */
  font-size: 14px;
}
.contentBox p span {
  font-size: auto !important;
}
iframe {
  height: 100%;
}
a {
  text-decoration: none;
  color: #333;
}
a:hover {
  text-decoration: none;
  color: #333;
}
a:visited {
  text-decoration: none;
  color: #333;
}
a:link {
  text-decoration: none;
  color: #333;
}
a:active {
  text-decoration: none;
  color: #333;
}
.free {
  color: #0bc266 !important;
}
.toBtn {
  background-color: #409eff !important;
  margin-left: 15px;
}
.toBtn:hover {
  color: #fff !important;
}
.noDataTxt {
  margin: 50px auto;
  text-align: center;
  font-size: 22px;
  color: #999;
  flex: 1;
}
[v-cloak] {
  display: none !important;
}
.loginPage .el-dialog__body{
  padding: 10px 20px;
}
.watch .el-dialog__body{
  padding: 10px 20px;
}
.teacherCertification .el-dialog__body{
  padding: 10px 20px;
}
src/assets/css/common.css
New file
@@ -0,0 +1,176 @@
/* è‡ªé€‚应图片 */
.autoImg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
}
/* å…è´¹ */
.freePrice {
  color: #0bc266 !important;
}
/* è¯¾ç¨‹é€šè¿‡,失败,等待,一般 çŠ¶æ€ é¢œè‰² */
.status-s {
  color: #67c23a !important;
}
.status-w {
  color: #e6a23c !important;
}
.status-f {
  color: #f56c6c !important;
}
.status-i {
  color: #999 !important;
}
/* å¯Œæ–‡æœ¬å®¹å™¨ï¼Œä¿ç•™å¯Œæ–‡æœ¬é»˜è®¤æ ·å¼ï¼Œæ‰€è§å³æ‰€å¾— */
.richTextBox {
  line-height: 1.4;
  font-size: 14px;
}
.richTextBox * {
  margin: revert;
  padding: revert;
  border: revert;
  font: revert;
  vertical-align: revert;
}
.richTextBox p {
  display: block;
  margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
}
/* ä¸»é¢˜è‰²ä¿®æ”¹ */
.el-button--primary {
  background-color: #2b68cd !important;
  border-color: #2b68cd !important;
}
.el-button--primary:focus,
.el-button--primary:hover {
  background: #3579ea !important;
  border-color: #3579ea !important;
  color: #fff !important;
}
.el-tabs__item.is-active {
  color: #2b68cd !important;
}
/* å•行省略 */
.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* åŒè¡Œçœç•¥ */
.ellipsis-3 {
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}
/* flex布局 */
.flex {
  display: flex;
}
.flex1 {
  flex: 1;
  overflow: hidden;
}
/* ä¸Šä¼ å›¾ç‰‡ */
.avatar-uploader .el-upload {
  width: 190px;
  height: 140px;
  border: 1px dashed #d9d9d9;
  position: relative;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.noData {
  width: 100%;
  text-align: center;
  color: #999;
  padding: 10px 0;
  font-size: 22px;
}
.avatarCover {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
}
/* å†…置状态字体颜色 */
.primaryTxt {
  color: #2b68cd !important;
}
.successTxt {
  color: #67c23a !important;
}
.warningTxt {
  color: #e6a23c !important;
}
.errorTxt {
  color: #f56c6c !important;
}
.infoTxt {
  color: #999 !important;
}
/* å†…置状态背景颜色 */
.primaryBack {
  color: #fff !important;
  background: #2b68cd !important;
}
.successBack {
  color: #fff !important;
  background: #67c23a !important;
}
.warningBack {
  color: #fff !important;
  background: #e6a23c !important;
}
.errorBack {
  color: #fff !important;
  background: #f56c6c !important;
}
src/assets/font/À¼Í¤ºÚ GBK.TTF
Binary files differ
src/assets/images/homeBg.png
src/assets/images/profilePhoto.png
src/assets/js/config.js
New file
@@ -0,0 +1,138 @@
// export const requestCtx = "http://182.92.203.7:3001"; // è¯·æ±‚地址
// export const appId = 12;
export const requestCtx = "https://www.tepcb.com"; // è¯·æ±‚地址
export const appId = 2;
export const requestTimeOut = 300000; // è¯·æ±‚è¶…æ—¶æ—¶é—´
export const tokenKey = "website-front-token";
export const userInfoKey = "website-front-userInfo"; // ç”¨æˆ·ä¿¡æ¯key
export const appRefCode = "tourismWebsite";
export const goodsStore = `defaultGoodsStore${appId}`; // é»˜è®¤å•†å“åº“(书城)
export const learnPlatformGoodsStore = `tourism_examinationsForTouristGuide`; // å­¦ä¹ å¹³å°åº“
export const teachingResourceGoodsStore = `tourism_teachingResource`; // æ•™å­¦æœåŠ¡åº“
export const teachingMaterialsSeriesGoodsStore = `tourism_teachingMaterialsSeries`; // æ•™æå¥—系库
export const nationalPlanningTextbookGoodsStore = `tourism_nationalPlanningTextbook`; // å›½å®¶è§„划教材库
export const onlineCourseLibGoodsStore = `tourism_onlineCourseLib`; // ç½‘络课程库
export const galleryIndexGoodsStore = `tourism_galleryIndex`; // æ–‡æ—…图库库
export const tourismLawsAndRegulationsDatabaseGoodsStore = `tourism_tourismLawsAndRegulationsDatabase`; // æ—…游法律法规数据库
export const digitalResourceLibraryGoodsStore = `tourism_digitalResourceLibrary`; // æ•°å­—资源库
export const learningPlatformGoodsStore = `tourism_learningPlatform`; // å­¦ä¹ å¹³å°åº“
export const publicStore = `defaultPublicStore${appId}`; // é»˜è®¤èµ„源开放仓储
export const publicRepository = `defaultPublicRepository${appId}`; // é»˜è®¤èµ„源开放库
export const reg_tel =
  /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; // ç”µè¯å·æ­£åˆ™
// export const pdfUrl = "http://182.92.203.7:3007/pdfRead/";
// export const pdfUrl = "http://192.168.1.23:8081/pdfRead/";
export const pdfUrl = "https://www.tepcb.com/pdfRead/";
// export const pdfUrl = "http://192.168.3.197:8081/pdfRead/";
// export const epubUrl = "http://182.92.203.7:3007/epubReader/#/";
export const epubUrl = "https://www.tepcb.com/epubReader/#/";
// é¢‘道refCode
export const refCodes = {
  bookStore: {
    bookCategory: "tourism_bookCategory", // å›¾ä¹¦åˆ†ç±»
    bookCityBanner: {
      top: "tourism_banner\\tourism_bookCityBannerTop",
      left: "tourism_banner\\tourism_bookCityBannerLeft",
      right: "tourism_banner\\tourism_bookCityBannerRight",
    },
    bookRecommendation: "tourism_bookRecommendation", // å›¾ä¹¦æŽ¨è
    bestsellersBooks: "tourism_bestsellersBooks", // ç•…销榜
    newBookRecommendation: "tourism_newBookRecommendation", // æ–°ä¹¦ä¸Šæž¶
    newBookHotSale: "tourism_newBookHotSale", // æ–°ä¹¦çƒ­å–榜
  },
  teachingResource: {
    teachingMaterialsClassification: "tourism_teachingMaterialsClassification", //教学分类
    excellentLecture: "tourism_excellentLecture", //精品教材
    teachingResourceManagement: "tourism_teachingResourceManagement", //旅游管理
    courseRefcode: "tourism_onlineCourseBannerLib", // è¯¾ç¨‹åº“
  },
  applyCourse: {
    ClassValidityPeriod: "tourism_eachClassValidityPeriod",
    ClassesNumber: "tourism_classesNumber",
    ClassStudentsNumber: "tourism_eachClassStudentsNumber",
    CourseValidityPeriod: "tourism_offerCourseValidityPeriod",
  },
  // æŠ•稿方式
  submissionMethod: "submissionMethod",
  //自定义收藏linkType
  LinkType: {
    FavoriteDownload: "FavoriteDownload",
    FavoriteBookCity: "FavoriteBookCity", // ä¹¦åŸŽ
    FavoriteTeachingService: "FavoriteTeachingService", //教学服务
    bookHistory: "bookHistory",
    digitalResourceLibrary: "FavoriteDigitalResourceLibrary", // æ•°å­—资源库
    FavoriteLearnPlatform: "FavoriteLearnPlatform", // å­¦ä¹ å¹³å°
    learnPlatformRefcode: {
      tourism_eBookFolder: "FavoriteEbook", // ç”µå­ä¹¦
      tourism_questionBankFolder: "FavoriteQuestionBank", //题库
      tourism_mockExam: "FavoriteMockList", //模考
      favoriteGuideword: "FavoriteGuideword", //导游词
      tourism_audioClassFolder: "FavoriteAudioList", //音频课
      tourism_videoLessonFolder: "FavoriteMicroLesson", //视频课
      tourism_microClass: "FavoriteTinyClass", //微课
    },
  },
  learnPlatform: {
    videoLessonFolder: "tourism_videoLessonFolder", //视频课
    audioClassFolder: "tourism_audioClassFolder", //音频课
    questionBankFolder: "tourism_questionBankFolder", //题库
    mockExam: "tourism_mockExam", //模考
    ChineseTourGuide: "tourism_ChineseTourGuide", //中文导游词
    ForeignGuideWords: "tourism_ForeignGuideWords", //英语导游词
    tourism: "tourism_microClass", //微课
    eBookFolder: "tourism_eBookFolder",
    intermediateTourGuide: "tourism_intermediateTourGuide", //中级考试
  },
  learnPlatformShoppingValue: {
    videoLesson: "tourism_videoLesson", //视频课
    audioClass: "tourism_audioCourse", //音频课
    questionBank: "tourism_questionBank", //题库
    mockExam: "tourism_mockExam", //模考
    ChineseTourGuide: "tourism_ChineseTourGuide", //中文导游词
    ForeignGuideWords: "tourism_ForeignGuideWords", //英语导游词
    tourism: "tourism_microClass", //微课
    eBook: "tourism_eBook",
  },
};
// é¢˜åž‹æ•°æ®
export const questionType = {
  singleChoice: "单选题",
  multipleChoice: "多选题",
  judge: "判断题",
  shortAnswer: "简答题",
  completion: "填空题",
  matching: "连线题",
  classification: "分类题",
};
const sampleApplicationData = {
  eBook: null,
};
const config = {
  requestCtx,
  requestTimeOut,
  tokenKey,
  userInfoKey,
  appRefCode,
  goodsStore,
  publicStore,
  publicRepository,
  refCodes,
  reg_tel,
  sampleApplicationData,
  pdfUrl,
  epubUrl,
  learnPlatformGoodsStore,
  teachingResourceGoodsStore,
  teachingMaterialsSeriesGoodsStore,
  nationalPlanningTextbookGoodsStore,
  onlineCourseLibGoodsStore,
  galleryIndexGoodsStore,
  tourismLawsAndRegulationsDatabaseGoodsStore,
  digitalResourceLibraryGoodsStore,
  learningPlatformGoodsStore,
};
export default config;
src/assets/js/middleGround/WebMiddleGroundApi.js
New file
@@ -0,0 +1,24 @@
// å–消接口调用能力;
// é˜Ÿåˆ—的必要性??
import resource from "./api/resource";
import store from "./api/store";
import identity from "./api/identity";
import ugc from "./api/ugc";
import app from "./api/app";
import file from "./api/file";
import job from "./api/job";
import edu from "./api/edu";
const WebMiddleGroundApi = {
  resource,
  store,
  identity,
  ugc,
  app,
  file,
  job,
  edu
};
export default WebMiddleGroundApi;
src/assets/js/middleGround/api/app.js
New file
@@ -0,0 +1,48 @@
import request from "@/plugin/axios";
const appApi = {
  // èŽ·å–ç”¨æˆ·æ¶ˆæ¯åˆ—è¡¨
  getAppMessageList(data) {
    return request({
      url: "/app/api/ApiGetAppMessageList",
      method: "post",
      data
    });
  },
  // èŽ·å–ç”¨æˆ·æ¶ˆæ¯è¯¦æƒ…
  getMessage(data) {
    return request({
      url: "/app/api/ApiGetMessage",
      method: "post",
      data
    });
  },
  //获取凭证
  getTicketResult(data) {
    return request({
      url: "/app/api/ApiGetTicketResult",
      method: "post",
      data
    });
  },
  //使用凭证
  useTicket(data) {
    return request({
      url:   "/app/api/ApiUseTicket",
      method: "post",
      data
    });
  },
  // èŽ·å–CmsItem按照Event统计
  getEventRankList(data) {
    return request({
      url: "/app/api/ApiGetEventRankList",
      method: "post",
      data
    });
  },
};
export default appApi;
src/assets/js/middleGround/api/edu.js
New file
@@ -0,0 +1,166 @@
import request from '@/plugin/axios'
import { handleQueryResourceListData } from '../tool'
const eduApi = {
  // èŽ·å–å•†å“ä¸‹çš„ç»„å·ç­–ç•¥
  getQuizConfigListByProduct(data) {
    return request({
      url: '/edu/api/ApiGetQuizConfigListByProduct',
      method: 'post',
      data,
    })
  },
  // èŽ·å–ç»„å·ç»“æžœ
  getEduQuizConfigResult(data) {
    return request({
      url: '/edu/api/ApiGetEduQuizConfigResult',
      method: 'post',
      data,
    })
  },
  //申请课程
  applyNewCourse(data) {
    return request({
      url: '/edu/api/ApiApplyNewCourse',
      method: 'post',
      data,
    })
  },
  //更新课程申请信息
  updateCourseApply(data) {
    return request({
      url: '/edu/api/ApiUpdateCourseApply',
      method: 'post',
      data,
    })
  },
  //获取我的课程
  getAppCourseList(data) {
    return request({
      url: '/edu/api/ApiGetAppCourseList',
      method: 'post',
      data,
    })
  },
  //获取已申请的课程详情
  getCourseById(data) {
    return request({
      url: '/edu/api/ApiGetCourseById',
      method: 'post',
      data,
    })
  },
  //获取创建课程中的班级列表
  getCourseClassList(data) {
    return request({
      url: '/edu/api/ApiGetCourseClassList',
      method: 'post',
      data,
    })
  },
  //创建班级信息
  newCourseClass(data) {
    return request({
      url: '/edu/api/ApiNewCourseClass',
      method: 'post',
      data,
    })
  },
  //删除班级信息
  delCourseClass(data) {
    return request({
      url: '/edu/api/ApiDelCourseClass',
      method: 'post',
      data,
    })
  },
  // æ›´æ–°ç­çº§ä¿¡æ¯
  updateCourseClass(data) {
    return request({
      url: '/edu/api/ApiUpdateCourseClass',
      method: 'post',
      data,
    })
  },
  //创建课程订单
  createCourseOrder(data) {
    return request({
      url: '/store/api/CreateCourseOrder',
      method: 'post',
      data,
    })
  },
  // å…è´¹é¢†å–课程
  makeFreeOrderPay(data) {
    return request({
      url: '/store/api/MakeFreeOrderPay',
      method: 'post',
      data,
    })
  },
  // èŽ·å–æŽ’åç»“æžœ
  getRankingList(data) {
    return request({
      url: '/edu/api/ApiGetRankingList',
      method: 'post',
      data,
    })
  },
  //获取个人排名
  getRanking(data) {
    return request({
      url: '/edu/api/ApiGetTopRanking',
      method: 'post',
      data,
    })
  },
  // æ–°å»ºæŽ’名记录
  newRanking(data) {
    return request({
      url: '/edu/api/ApiNewRanking',
      method: 'post',
      data,
    })
  },
  // åˆ é™¤ç»„卷规则
  delQuizConfig(data) {
    return request({
      url: '/edu/admin/DelQuizConfig',
      method: 'post',
      data,
    })
  },
  // æ›´æ–°ç»„卷规则
  updateQuizConfig(data) {
    return request({
      url: '/edu/admin/UpdateQuizConfig',
      method: 'post',
      data,
    })
  },
  // æ ¹æ®ID获取组卷配置
  getQuizConfig(data) {
    return request({
      url: '/edu/admin/GetQuizConfig',
      method: 'post',
      data,
    })
  },
}
export default eduApi
src/assets/js/middleGround/api/file.js
New file
@@ -0,0 +1,49 @@
import request from "@/plugin/axios";
const fileApi = {
  // èŽ·å–pdf总页数
  getPdfTotalPage(data) {
    return request({
      url: "/file/GetPdfTotalPage",
      method: "post",
      data
    });
  },
  // èŽ·å–pdf、word、ppt等转图片预览
  getPdfInfo(data) {
    return request({
      url: "/file/GetPdfInfo",
      method: "post",
      data
    });
  },
  //上传文件
  upload(data) {
    return request({
      url: "/file/api/ApiUpload",
      method: "post",
      data
    });
  },
  // èŽ·å–é˜¿é‡Œäº‘åŠ é€Ÿåœ°å€
  getAliVod(data) {
    return request({
      url: "/file/GetAliVod",
      method: "post",
      data,
    });
  },
  downloadForAuthorize(params) {
    return request({
      url: '/file/api/ApiDownloadForAuthorize',
      method: 'GET',
      responseType: 'blob',
      params
    });
  }
};
export default fileApi;
src/assets/js/middleGround/api/identity.js
New file
@@ -0,0 +1,196 @@
import request from "@/plugin/axios";
const identityApi = {
  // èŽ·å–å›¾å½¢éªŒè¯ç 
  getImgCode() {
    return request({
      url: "/identity/NewCaptcha",
      method: "post",
    });
  },
  // éªŒè¯å›¾å½¢éªŒè¯ç 
  verificationImgCode(data) {
    return request({
      url: "/identity/ValidCaptcha",
      method: "post",
      data,
    });
  },
  // éªŒè¯æ»‘动验证码
  validSlideCaptcha(options) {
    return request('/identity/ValidSlideCaptcha', {
      method: 'POST',
      data: options || {},
    });
  },
  // èŽ·å–æ»‘åŠ¨éªŒè¯ç 
  getSlideCaptchaImage(options) {
    return request('/identity/GetSlideCaptchaImage', {
      method: 'POST',
      data: options || {},
    });
  },
  // èŽ·å–çŸ­ä¿¡éªŒè¯ç 
  getPhoneCode(data) {
    return request({
      url: "/identity/NewSms",
      method: "post",
      data,
    });
  },
  // éªŒè¯çŸ­ä¿¡éªŒè¯ç 
  verificationPhoneCode(data) {
    return request({
      url: "/identity/api/ApiValidMobilePhone",
      method: "post",
      data,
    });
  },
  // é€šè¿‡æ‰‹æœºå·æ³¨å†Œç”¨æˆ·
  registerAppUserWithPhone(data) {
    return request({
      url: "/identity/api/RegisterAppUserWithPhone",
      method: "post",
      data,
    });
  },
  // è´¦å·å¯†ç ç™»å½•
  loginByPassword(data) {
    return request({
      url: "/identity/api/LoginByPassword",
      method: "post",
      data,
    });
  },
  // çŸ­ä¿¡éªŒè¯ç ç™»å½•
  loginByMobilePhone(data) {
    return request({
      url: "/identity/api/LoginByMobilePhone",
      method: "post",
      data,
    });
  },
  // è®¾ç½®ç”¨æˆ·key
  setUserKey(data) {
    return request({
      url: "/identity/api/ApiAppUserSetKey",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·key
  getUserKey(data) {
    return request({
      url: "/identity/api/ApiGetAppUserKey",
      method: "post",
      data,
    });
  },
  // åˆ é™¤ç”¨æˆ·key
  delUserKey(data) {
    return request({
      url: "/identity/api/ApiDelAppUserKey",
      method: "post",
      data,
    });
  },
  // èŽ·å–åŽ»å½“å‰ç”¨æˆ·ä¿¡æ¯
  getCurrentAppUser() {
    return request({
      url: "/identity/api/GetCurrentAppUser",
      method: "post",
    });
  },
  // æ·»åŠ ç”¨æˆ·ä¿¡æ¯
  setAppUserInfo(data) {
    return request({
      url: "/identity/api/SetAppUserInfoRequest",
      method: "post",
      data,
    });
  },
  // ç”¨æˆ·æ›´æ¢ç»‘定手机号,如没有绑定手机则自动创建
  userSetPhoneNumber(data) {
    return request({
      url: "/identity/api/ApiUserSetPhoneNumber",
      method: "post",
      data,
    });
  },
  // æ£€æµ‹ç”¨æˆ·æ˜¯å¦ç»‘定微信
  checkBuildingWeChat(data) {
    return request({
      url: "/identity/api/ApiCheckBuildingWeChat",
      method: "post",
      data,
    });
  },
  // é€šè¿‡æ‰‹æœºå·é‡ç½®å¯†ç 
  changePasswordByMobilePhone(data) {
    return request({
      url: "/identity/api/ChangePasswordByMobilePhone",
      method: "post",
      data,
    });
  },
  // å¾®ä¿¡å¼€æ”¾å¹³å°æ‰«ç ç™»å½•
  loginByWeChatOpenCode(data) {
    return request({
      url: "/identity/api/LoginByWeChatOpenCode",
      method: "post",
      data,
    });
  },
  // ç”¨æˆ·ç»‘定微信号
  bindingWeChat(data) {
    return request({
      url: "/identity/api/ApiBindingWeChat",
      method: "post",
      data,
    });
  },
  // è®¾ç½®ç™»å½•的用户名和密码,用户名和密码至少6位
  setLoginNameAndPassword(data) {
    return request({
      url: "/identity/api/ApiUserSetLoginNameAndPassword",
      method: "post",
      data,
    });
  },
  // åˆå¹¶å·²æœ‰æ‰‹æœºè´¦å·
  mergePhone(data){
    return request({
      url: "/identity/api/MergePhoneAccount",
      method: "post",
      data,
    });
  },
  // åˆå¹¶å·²æœ‰æ‰‹æœºè´¦å·
  unsubscribeAppuser(data){
    return request({
      url: "/identity/api/ApiWithdraw",
      method: "post",
      data,
    });
  },
};
export default identityApi;
src/assets/js/middleGround/api/job.js
New file
@@ -0,0 +1,34 @@
import request from "@/plugin/axios";
import { tokenKey } from "@/assets/js/config";
import toolClass from "@/assets/js/toolClass";
const jobApi = {
  // ç»Ÿè®¡
  newJobWithNewView(data) {
    return request({
      url: "/job/api/NewJobWithNewView",
      method: "post",
      data
    });
  },
  newSession(data) {
    let token = toolClass.getCookie(tokenKey);
    return request({
      url: token ? "/job/api/AppUserNewSession" : "/job/api/NewSession",
      method: "post",
      data
    });
  },
  newJobWithApiNewEvent(data){
    return request({
      url: "/job/api/NewJobWithApiNewEvent",
      method: "post",
      data
    });
  }
};
export default jobApi;
src/assets/js/middleGround/api/resource.js
New file
@@ -0,0 +1,225 @@
import request from "@/plugin/axios";
import { publicStore, publicRepository } from "@/assets/js/config";
import { tokenKey } from "@/assets/js/config";
import { handleQueryResourceListData } from "../tool";
import toolClass from "@/assets/js/toolClass";
const resourceApi = {
  /*
    **获取资源列表&详情**
    path: æ•°æ®è·¯å¾„
    storeInfo: ä»“储
    repositoryInfo: ä»“库
    queryType: æ£€ç´¢ç±»åž‹
    paging: åˆ†é¡µ
    sort: æŽ’序
    fields: è‡ªå®šä¹‰å­—段
    itemId: èŽ·å–è¯¦æƒ…æ—¶çš„èµ„æºID
  */
  getItem: ({
    path,
    storeInfo = publicStore,
    repositoryInfo = publicRepository,
    queryType,
    linkType,
    paging,
    sort,
    fields,
    itemId,
    itemIds,
    itemType,
    coverSize,
    itemIdArr,
    SysType,
    tourism_isHighQualityResources,
  }) => {
    if (!path) return Promise.reject("接口请求必要参数不能为空!");
    const query = {
      AccessControl: {
        Path: path,
        StoreRefCode: storeInfo + "",
        RepositoryRefCode: repositoryInfo + "",
        Type: queryType || "\\",
        LinkType: linkType || "",
      },
      PageQuery: {
        Start: paging?.start || "0",
        Size: paging?.size || "10",
      },
      SortQuery: sort
        ? [sort]
        : [
            // {
            //   LinkOrder: "Desc",
            // },
            {
              CreateDate: "Desc",
            },
          ],
      CreateDate: [],
      Description: [],
      Name: [],
      Icon: [],
      RefCode: [],
      Type: [],
      TypeId: [],
      State: [],
      Tag: [],
      LinkInfo: [],
      LinkFile: [],
      CmsItemType: [],
      ChildrenFolderCount: [],
      ChildrenCount: [],
      ...fields,
    };
    if (itemIdArr) query["Id"] = itemIdArr;
    if (SysType) query["SysType="] = [`${SysType}`];
    if (tourism_isHighQualityResources)
      query["tourism_isHighQualityResources="] = [
        `${tourism_isHighQualityResources}`,
      ];
    if (itemId) query["Id="] = [`${itemId}`];
    if (itemIds) query["Id="] = itemIds;
    if (itemType) query["Type="] = [`${itemType}`];
    const body = { query: JSON.stringify({ Query: [{ Q1: query }] }) };
    let token = toolClass.getCookie(tokenKey);
    return request({
      url: token ? "/resource/api/ApiAppUserQuery" : "/resource/api/ApiQuery",
      method: "post",
      data: body,
    }).then((resp) => {
      if (resp.length > 0) {
        const data = resp[0];
        const datas = handleQueryResourceListData({
          datas: data.datas,
          fields,
          path,
          storeInfo,
          repositoryInfo,
          coverSize,
        });
        return { datas, total: data.totalCount };
      }
      return { datas: [], total: 0 };
    });
  },
  // æ¨¡ç³Šæœç´¢
  EsQuery(query) {
    let { params, path, paging } = query;
    let queryBody = {
      Type: "*",
      Store: [],
      ItemType: [],
      CmsType: [],
      SysType: ["CmsItem"],
      LinkInfo: [],
      PageQuery: {
        Start: paging?.start || "0",
        Size: paging?.size || "10",
      },
    };
    // è®¾ç½®ä¸åŒçš„Path
    // å¦‚果没有搜索关键字,则只用获取名称
    if (params.length > 0) {
      let data = {
        "||Name": [...params],
        "||tourism_content*": [...params],
        "||tourism_workflow*": [...params],
        "||tourism_notes*": [...params],
        "||tourism_caseIndex*": [...params],
        "||tourism_basicCase*": [...params],
        "||tourism_judgmentAndReasons*": [...params],
        "||tourism_legalIssuesInvolvedInThisCase*": [...params],
        "||tourism_referenceAnswerAndLegalAnalysis*": [...params],
        "||tourism_case*": [...params],
        "||tourism_clause*": [...params],
        "||tourism_unscramble*": [...params],
        "||tourism_specialRemind*": [...params],
        "||tourism_fiction*": [...params],
        "||tourism_authorityNature*": [...params],
        "||tourism_authorityGist*": [...params],
        "||tourism_penaltyGist*": [...params],
        "||tourism_penaltyTerms*": [...params],
        "||tourism_penaltyType*": [...params],
        "||tourism_remarksNote*": [...params],
        "||tourism_keyword*": [...params],
      };
      Object.assign(queryBody, data);
    } else {
      let data = {
        Name: [],
      };
      Object.assign(queryBody, data);
    }
    // å…¨éƒ¨æœç´¢  - å•独的某个库
    if (path != "All") {
      let data = {
        Path: [
          {
            Repository: "tourism_tourismLawsAndRegulationsDatabase",
            Path: path,
          },
        ],
      };
      Object.assign(queryBody, data);
    }
    const body = { query: JSON.stringify({ Query: [{ Q1: queryBody }] }) };
    return request({
      url: "/resource/api/ApiEsQuery",
      method: "post",
      data: body,
    }).then((res) => {
      if (res.length > 0) {
        const data = res[0];
        const datas = handleQueryResourceListData({
          datas: data.datas,
          path,
        });
        return { datas, total: data.totalCount };
      }
      return { data: [], total: 0 };
    });
  },
  //获取资源类型
  getCmsTypeByRefCode(data) {
    return request({
      url: "resource/api/ApiGetCmsTypeByRefCode",
      method: "post",
      data,
    });
  },
  //取消cms收藏
  delCmsItemLink(data) {
    return request({
      url: "/resource/api/ApiDelCmsItemLink",
      method: "post",
      data,
    });
  },
  //cms收藏
  collectCmsItem(data) {
    return request({
      url: "/resource/api/ApiAddCmsItemLink",
      method: "post",
      data,
    });
  },
  // èŽ·å–cms收藏列表
  getCmsCollectList(data) {
    const body = { query: JSON.stringify({ Query: [{ Q1: data }] }) };
    return request({
      url: "/resource/api/ApiAppUserQuery",
      method: "post",
      data: body,
    });
  },
};
export default resourceApi;
src/assets/js/middleGround/api/store.js
New file
@@ -0,0 +1,672 @@
import request from "@/plugin/axios";
import { tokenKey, goodsStore } from "@/assets/js/config";
import toolClass from "@/assets/js/toolClass";
import {
  handleQueryResourceListData,
  handleDetailQueryRequestData,
} from "../tool";
const storeApi = {
  /*
    **获取商品列表**
    path: æ•°æ®è·¯å¾„
    storeInfo: ä»“储
    channelInfo: é¢‘道
    subAccess:
    queryType: æ£€ç´¢ç±»åž‹
    paging: åˆ†é¡µ
    sort: æŽ’序
    fields: è‡ªå®šä¹‰å­—段
  */
  getProductList: ({
    path = "",
    storeInfo = goodsStore,
    storeEventIdOrRefCode = "",
    favoriteTypes = "",
    queryType,
    linkType,
    subAccess = [],
    paging = {},
    sort,
    fields,
    filterList,
    coverSize,
    mainProductId,
    handelEBooK,
  }) => {
    const query = {
      AccessControl: {
        Path: path,
        StoreRefCode: storeInfo + "",
        Type: queryType || "\\",
        LinkType: linkType || "",
      },
      FavoriteTypes: favoriteTypes ? [favoriteTypes] : [],
      SubAccess: subAccess.length > 0 ? subAccess : [],
      PageQuery: {
        Start: paging.start || "0",
        Size: paging.size || "10",
      },
      SortQuery:
        sort?.length == 0
          ? []
          : sort
          ? [sort]
          : [
              {
                LinkOrder: "Desc",
              },
            ],
      CreateDate: [],
      Description: [],
      Name: [],
      Icon: [],
      RefCode: [],
      TypeId: [],
      SysType: [],
      State: [],
      Tag: [],
      BeginDate: [],
      EndDate: [],
      ProductLinkInfo: [],
      AllowDonate: [],
      // DonatePriceList: [],
      StoreEvent: [],
      SubProductCount: [],
      SaleMethod: [],
      SaleMethodValid: [],
      StoreEventIdOrRefCode: storeEventIdOrRefCode,
      ...fields,
      ...filterList,
    };
    if (mainProductId) {
      query.AccessControl.MainProductId = mainProductId;
    }
    if (handelEBooK) {
      query.ProductCmsQuery = [
        {
          QueryCms: {
            Path: "*",
            Type: "\\",
            Name: [],
            Icon: [],
            TypeId: [],
            RefCode: [],
            ChildrenCount: [],
            ChildrenFolderCount: [],
            CreateDate: [],
            SysType: [],
            SaleMethod: [],
            PageQuery: {
              Start: 0,
              Size: 9999,
            },
            ProductLinkInfo: [],
          },
        },
      ];
    }
    const body = {
      query: JSON.stringify({
        Query: [
          {
            Q1: query,
          },
        ],
      }),
    };
    let token = toolClass.getCookie(tokenKey);
    let url = token
      ? "/store/api/ApiQueryProductByAppUser"
      : "/store/api/ApiQueryProduct";
    return request({
      url: url,
      method: "post",
      data: body,
    }).then((resp) => {
      if (resp.length > 0) {
        const data = resp[0];
        const datas = handleQueryResourceListData({
          datas: data.datas,
          fields,
          path,
          storeInfo,
          coverSize,
          handelEBooK,
        });
        return {
          datas,
          total: data.totalCount,
          extraInfos: data.extraInfos?.StoreEvent,
        };
      }
      return {
        datas: [],
        total: 0,
      };
    });
  },
  /*
    **获取商品详情**
    path: æ•°æ®è·¯å¾„
    storeInfo: ä»“储
    channelInfo: é¢‘道
    subAccess:
    fields: è‡ªå®šä¹‰å­—段
    productId: å•†å“ID
    cmsPath:cmsPath
  */
  getProductDetail: ({
    path = "",
    storeInfo = goodsStore,
    channelInfo = "",
    favoriteTypes = "",
    queryType,
    subAccess = [],
    fields,
    productId,
    cmsPath,
    cmsType,
    coverSize,
    itemId,
    itemIds,
    itemFields,
    linkTypes,
    filterList,
    handelEBooK,
    sort,
    cmsSort,
  }) => {
    const subQuery = {};
    if (cmsPath) {
      subQuery["QueryCms"] = {
        Path: cmsPath + "",
        Type: cmsType || "\\",
        Name: [],
        Icon: [],
        TypeId: [],
        RefCode: [],
        ChildrenCount: [],
        ChildrenFolderCount: [],
        CreateDate: [],
        SysType: [],
        SaleMethod: [],
        PageQuery: {
          Start: 0,
          Size: 9999,
        },
        SortQuery: cmsSort
        ? [cmsSort]
        : [
            {
              ProductLinkOrder: "Asc"
            }
          ],
        ProductLinkInfo: [],
        ...itemFields,
      };
      if (itemId) subQuery["QueryCms"]["Id="] = [`${itemId}`];
      if (itemIds) subQuery["QueryCms"]["Id="] = itemIds;
    } else {
      subQuery["QueryCms"] = {
        Path: "*",
        Type: "\\",
        Name: [],
        Icon: [],
        TypeId: [],
        RefCode: [],
        ChildrenCount: [],
        ChildrenFolderCount: [],
        CreateDate: [],
        SysType: [],
        SaleMethod: [],
        PageQuery: {
          Start: 0,
          Size: 9999,
        },
        ProductLinkInfo: [],
      };
    }
    // èŽ·å–å…³è”èµ„æº
    let linkFields = {};
    if (linkTypes && linkTypes.length) {
      for (let i = 0; i < linkTypes.length; i++) {
        const linkType = linkTypes[i];
        subQuery["QueryLink_" + linkType.linkType] = {
          Path: cmsPath + "",
          Type: "\\",
          Name: [],
          Icon: [],
          TypeId: [],
          RefCode: [],
          LinkTypes: [linkType.linkType],
          PageQuery: {
            Start: 0,
            Size: 100,
          },
          ProductLinkInfo: [],
          ...linkType.fields,
        };
        linkFields = {
          ...linkFields,
          ...linkType.fields,
        };
      }
    }
    const query = {
      AccessControl: {
        Path: path,
        StoreRefCode: storeInfo + "",
        ChannelRefCode: channelInfo + "",
        Type: queryType || "\\",
      },
      FavoriteTypes: favoriteTypes ? [favoriteTypes] : [],
      SubAccess: subAccess.length > 0 ? subAccess : [],
      PageQuery: {
        Start: "0",
        Size: "1",
      },
      "Id=": [`${productId}`],
      SortQuery: sort
      ? [sort]
      : [
          {
            LinkOrder: "Desc"
          }
        ],
      CreateDate: [],
      Description: [],
      Name: [],
      Icon: [],
      RefCode: [],
      TypeId: [],
      SysType: [],
      State: [],
      Tag: [],
      BeginDate: [],
      EndDate: [],
      ProductLinkInfo: [],
      AllowDonate: [],
      DonatePriceList: [],
      StoreEvent: [],
      SaleMethod: [],
      SaleMethodValid: [],
      CmsItemValid: [],
      ProductCmsQuery: [subQuery],
      ...fields,
      ...filterList,
    };
    if (productId) query["Id="] = [`${productId}`];
    const body = {
      query: JSON.stringify({
        Query: [
          {
            Q1: query,
          },
        ],
      }),
    };
    let token = toolClass.getCookie(tokenKey);
    let url = token
      ? "/store/api/ApiQueryProductByAppUser"
      : "/store/api/ApiQueryProduct";
    return request({
      url: url,
      method: "post",
      data: body,
    }).then((resp) => {
      if (resp.length > 0) {
        const data = resp[0];
        if (data.datas.length) {
          data.datas[0].subDatas = data.datas[0].cmsDatas;
          const datas = handleDetailQueryRequestData({
            item: data.datas[0],
            fields,
            itemFields: {
              ...itemFields,
              ...linkFields,
            },
            path,
            coverSize,
            handelEBooK,
          });
          return {
            datas,
            total: data.totalCount,
          };
        } else {
          return {
            datas: [],
            total: 0,
          };
        }
      }
      return {
        datas: [],
        total: 0,
      };
    });
  },
  // èŽ·å–ä¼˜æƒ åˆ¸åˆ—è¡¨
  getChannelPromoteCodeList(data) {
    return request({
      url: "/store/api/ApiGetChannelPromoteCodeList",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·å·²é¢†å–çš„ä¼˜æƒ åˆ¸åˆ—è¡¨
  getPromoteCodeList(data) {
    return request({
      url: "/store/api/ApiGetPromoteCodeList",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·æµè§ˆæŽ’è¡Œ
  getProductViewRank(data) {
    return request({
      url: "/store/api/ApiGetProductViewRank",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·é”€å”®æŽ’è¡Œ
  getProductSaleRank(data) {
    return request({
      url: "/store/api/ApiGetProductSaleRank",
      method: "post",
      data,
    });
  },
  // èŽ·å–å•†å“å¯ç”¨ä¼˜æƒ åˆ¸
  getProductPromoteCodeList(data) {
    return request({
      url: "/store/api/ApiGetProductPromoteCodeList",
      method: "post",
      data,
    });
  },
  // èŽ·å–è®¢å•å¯ç”¨ä¼˜æƒ åˆ¸
  getOrderPromoteCodeList(data) {
    return request({
      url: "/store/api/GetOrderPromoteCodeList",
      method: "post",
      data,
    });
  },
  // èŽ·å–é”€å”®æ–¹å¼å¯ç”¨ä¼˜æƒ åˆ¸
  getSaleMethodPromoteCodeList(data) {
    return request({
      url: "/store/api/GetSaleMethodPromoteCodeList",
      method: "post",
      data,
    });
  },
  // é¢†å–优惠卷
  getPromoteCode(data) {
    return request({
      url: "/store/api/ApiGetPromoteCode",
      method: "post",
      data,
    });
  },
  // ä¸ºè®¢å•使用优惠券
  updateOrderPromoteCode(data) {
    return request({
      url: "/store/api/UpdateOrderPromoteCode",
      method: "post",
      data,
    });
  },
  // ä¸ºé”€å”®æ–¹å¼ä½¿ç”¨ä¼˜æƒ åˆ¸
  updateSaleMethodPromoteCode(data) {
    return request({
      url: "/store/api/UpdateSaleMethodPromoteCode",
      method: "post",
      data,
    });
  },
  // é€šè¿‡è®¢å•号获取订单
  getOrderByOrderNum(data) {
    return request({
      url: "/store/api/GetOrderByOrderNum",
      method: "post",
      data,
    });
  },
  // åˆ›å»ºè®¢å•
  initOrder(data) {
    return request({
      url: "/store/api/InitOrder",
      method: "post",
      data,
    });
  },
  // ç¡®è®¤è®¢å•
  confirmOrder(data) {
    return request({
      url: "/store/api/ConfirmOrder",
      method: "post",
      data,
    });
  },
  // å–消订单
  cancelOrder(data) {
    return request({
      url: "/store/api/CancelOrder",
      method: "post",
      data,
    });
  },
  // èµžèµ
  CreateDonateOrder(data) {
    return request({
      url: "/store/api/CreateDonateOrder",
      method: "post",
      data,
    });
  },
  //获取用户订单列表
  getUserOrderList(data) {
    return request({
      url: "/store/api/GetUserOrderList",
      method: "post",
      data,
    });
  },
  //获取频道下的列表
  getStoreChannelList(data) {
    return request({
      url: "/store/api/ApiGetStoreChannelList",
      method: "post",
      data,
    });
  },
  //获取购物车
  getShoppingCartProductList(data) {
    return request({
      url: "/store/api/ApiGetShoppingCartProductList",
      method: "post",
      data,
    });
  },
  //添加到购物车
  addShoppingCart(data) {
    return request({
      url: "/store/api/ApiAddShoppingCart",
      method: "post",
      data,
    });
  },
  //购物车删除商品
  delShoppingCart(data) {
    return request({
      url: "/store/api/ApiDelShoppingCart",
      method: "post",
      data,
    });
  },
  //从购物车创建订单
  shoppingCartCreateOrder(data) {
    return request({
      url: "/store/api/ApiShoppingCartCreateOrder",
      method: "post",
      data,
    });
  },
  //获取已购买的商品列表
  getPurchasedProductList(data) {
    return request({
      url: "/store/api/ApiGetPurchasedProductList",
      method: "post",
      data,
    });
  },
  //调取微信支付
  makeWeChatPay(data) {
    return request({
      url: "/store/api/MakeWeChatPay",
      method: "post",
      data,
    });
  },
  //调取微信二维码支付
  makeWeChatQrPay(data) {
    return request({
      url: "/store/api/MakeWeChatQrPay",
      method: "post",
      data,
    });
  },
  // èŽ·å–æ¿€æ´»ç è¯¦æƒ…
  getActiveCode(data) {
    return request({
      url: "/store/api/ApiGetActiveCode",
      method: "post",
      data,
    });
  },
  // ä½¿ç”¨æ¿€æ´»ç 
  userActiveCode(data) {
    return request({
      url: "/store/api/ApiUseActiveCode",
      method: "post",
      data,
    });
  },
  // ä½¿ç”¨æ¿€æ´»ç ä½¿ç”¨è®°å½•
  userActiveCodeList(data) {
    return request({
      url: "/store/api/ApiGetUsedActiveCodeList",
      method: "post",
      data,
    });
  },
  // å•†å“æŸ¥è¯¢ç±»åž‹å­—段接口
  getProductTypeField(data) {
    return request({
      url: "/store/api/ApiGetProductTypeField",
      method: "post",
      data,
    });
  },
  // æ”¶è—æˆ–加入书架
  addProductLink(data) {
    return request({
      url: "/store/api/ApiAddProductLink",
      method: "post",
      data,
    });
  },
  // å–消收藏或移除书架
  delProductLink(data) {
    return request({
      url: "/store/api/ApiDelProductLink",
      method: "post",
      data,
    });
  },
  //购买免费商品
  MakeFreeOrderPay(data) {
    return request({
      url: "/store/api/MakeFreeOrderPay",
      method: "post",
      data,
    });
  },
  // ç”³è¯·è®¢å•开票
  requestOrderInvoice(data) {
    return request({
      url: "/store/api/RequestOrderInvoice",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·é’±åŒ…
  getUserWallet(data) {
    return request({
      url: "/store/api/GetWallet",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·é’±åŒ…è®°å½•
  getWalletHistory(data) {
    return request({
      url: "/store/api/GetWalletHistory",
      method: "post",
      data,
    });
  },
  // é€šè¿‡é’±åŒ…自动购买
  autoPayWithWallet(data) {
    return request({
      url: "/store/api/AutoPayWithWallet",
      method: "post",
      data,
    });
  },
  // æŸ¥è¯¢å•†å“æ‰€åœ¨Store
  getProductStore(data) {
    return request({
      url: "/store/api/ApiGetProductStore",
      method: "post",
      data,
    });
  },
};
export default storeApi;
src/assets/js/middleGround/api/ugc.js
New file
@@ -0,0 +1,85 @@
import request from "@/plugin/axios";
import { tokenKey } from "@/assets/js/config";
import toolClass from "@/assets/js/toolClass";
// let token = toolClass.getCookie(tokenKey);
const ugcApi = {
  // èŽ·å–å•†å“ç‚¹èµžTopic
  getProductLikesTopic(data) {
    return request({
      url: toolClass.getCookie(tokenKey)
        ? "/ugc/api/ApiAppUserGetProductLikesTopic"
        : "/ugc/api/ApiGetProductLikesTopic",
      method: "post",
      data,
    });
  },
  // èŽ·å–å•†å“è¯„è®ºTopic
  getProductCommentTopic(data) {
    return request({
      url: toolClass.getCookie(tokenKey)
        ? "/ugc/api/ApiAppUserGetProductCommentTopic"
        : "/ugc/api/ApiGetProductCommentTopic",
      method: "post",
      data,
    });
  },
  // èŽ·å–MessageList
  getTopicMessageList(data) {
    return request({
      url: toolClass.getCookie(tokenKey)
        ? "/ugc/api/ApiAppUserGetTopicMessageList"
        : "/ugc/api/ApiGetTopicMessageList",
      method: "post",
      data,
    });
  },
  // æ–°å»ºMessage
  newTopicMessage(data) {
    return request({
      url: "/ugc/api/ApiNewTopicMessage",
      method: "post",
      data,
    });
  },
  // åˆ é™¤Message
  delTopicMessage(data) {
    return request({
      url: "/ugc/api/ApiDelTopicMessage",
      method: "post",
      data,
    });
  },
  // èŽ·å–cms评论
  getCmsItemCommentTopic(data) {
    return request({
      url: "/ugc/api/ApiGetCmsItemCommentTopic",
      method: "post",
      data,
    });
  },
  // èŽ·å–ç”¨æˆ·æäº¤çš„æ•™å­¦èµ„æº
  getProductUserSubmitTopic(data) {
    return request({
      url: "/ugc/api/ApiGetProductUserSubmitTopic",
      method: "post",
      data,
    });
  },
  //更新TOPICMESSAGE
  updateTopicMessage(data) {
    return request({
      url: "/ugc/api/ApiUpdateTopicMessage",
      method: "post",
      data,
    });
  },
};
export default ugcApi;
src/assets/js/middleGround/tool.js
New file
@@ -0,0 +1,430 @@
import { requestCtx } from "@/assets/js/config";
import moment from "moment";
// å¤„理列表查询结果
export function handleQueryResourceListData({
  datas,
  fields,
  path,
  storeInfo,
  repositoryInfo,
  coverSize,
  handelEBooK,
}) {
  const dataList = [];
  for (let i = 0; i < datas.length; i++) {
    const item = datas[i];
    // å¤„理字段
    const _fields = {};
    if (fields != null) {
      for (let fieldKey in fields) {
        if (item.datas[fieldKey]) {
          const values = JSON.parse(item.datas[fieldKey]);
          if (values.length > 0) {
            // ç”¨å­—段名处理返回的字段值
            if (values[0].Value) {
              _fields[fieldKey] = values[0].Value;
            } else if (values[0].Data) {
              _fields[fieldKey] = values[0].Data.Value;
            }
            item.datas[fieldKey] = values[0];
          }
        }
      }
    }
    const subDatas = {};
    if (item.subDatas) {
      for (let subData of item.subDatas) {
        const tag = subData.queryTag.replace("Query", "");
        subDatas[tag] = subData.datas;
      }
    }
    let obj = {
      ...item,
      id: item.id,
      name: item.datas.Name,
      icon: getPublicImage(
        item.datas.Icon,
        coverSize?.width,
        coverSize?.height
      ),
      repositoryInfo: repositoryInfo,
      refCode: item.datas.RefCode === "[]" ? null : item.datas.RefCode,
      state: item.datas.State,
      type: item.datas.Type,
      tag: item.datas.Tag,
      creator: item.datas.Creator ? JSON.parse(item.datas.Creator) : undefined,
      storeInfo: storeInfo,
      linkType: item.datas.LinkType,
      childrenCount: parseInt(item.datas.ChildrenCount ?? "0"),
      childrenFolderCount: parseInt(item.datas.ChildrenFolderCount ?? "0"),
      childrenChannelCount: parseInt(item.datas.ChildrenChannelCount ?? "0"),
      createDate: moment(item.datas.CreateDate).format("YYYY-MM-DD"),
      beginDate: moment(item.datas.BeginDate).format("YYYY-MM-DD"),
      endDate: moment(item.datas.EndDate).format("YYYY-MM-DD"),
      description: item.datas.Description,
      sysType: item.datas.SysType,
      idPath: path + "\\" + item.id,
      typeId: parseInt(item.datas.TypeId),
      linkFile: JSON.parse(item.datas.LinkFile ?? "[]"),
      cmsItemType: item.datas.CmsItemType,
      allowDonate: item.datas.AllowDonate == "True",
      // donatePriceList: JSON.parse(item.datas.DonatePriceList ?? "[]"),
      productLinkInfo: item.datas.ProductLinkInfo ?? "[]",
      storeEvent: JSON.parse(item.datas.StoreEvent ?? "[]"),
      linkInfo: JSON.parse(item.datas.LinkInfo ?? "[]"),
      saleMethod: JSON.parse(item.datas.SaleMethod ?? "[]"),
      subProductCount: parseInt(item.datas.SubProductCount),
      ..._fields,
      datas: item.datas,
      subDatas,
    };
    // ç»Ÿä¸€å¤„理价格
    if (obj.defaultSaleMethod) {
      if (handelEBooK) {
        // èŽ·å–éšä¹¦èµ„æºçš„é”€å”®æ–¹å¼
        let saleMethod = [];
        try {
          saleMethod = obj.cmsDatas[0].datas.find(
            (item) => item.datas.RefCode == "tourism_accompanyingResources"
          ).datas.SaleMethod;
          saleMethod = JSON.parse(saleMethod);
        } catch (error) {
          saleMethod = [];
        }
        if (saleMethod.length) {
          Object.keys(saleMethod[0]).map((key) => {
            let newKey = key.replace(key[0], key[0].toLowerCase());
            saleMethod[0][newKey] = saleMethod[0][key];
            delete saleMethod[0][key];
          });
          obj.defaultSaleMethod = saleMethod[0];
          obj.defaultSaleMethodId = saleMethod[0].id;
          obj.alreadyBuy =
            obj.purchasedSaleMethodIdList.indexOf(obj.defaultSaleMethodId) > -1;
        }
      }
      if (obj.defaultSaleMethod.allowEvent && obj.storeEvent.length) {
        // å·²å‚加活动,获取有效活动并计算价格
        let time = new Date().getTime();
        // è¿‡æ»¤è¿‡æœŸæ´»åЍ
        let event = obj.storeEvent.filter((item) => {
          let endTime = new Date(item.EndDate).getTime();
          return endTime > time;
        });
        // åªå¤„理一条有效活动
        if (event.length) {
          obj.price = (obj.defaultSaleMethod.price * event[0].Value).toFixed(2);
          obj.oldPrice = obj.defaultSaleMethod.price;
          obj.storeEventId = event[0].Id;
          if (
            moment().format("YYYY-MM-DD") <
            moment(obj.defaultSaleMethod.endDate).format("YYYY-MM-DD")
          ) {
            obj.defaultSaleMethodState = "Normal";
          } else {
            obj.defaultSaleMethodState = "Beyond";
          }
        }
      } else {
        if (
          moment().format("YYYY-MM-DD") <
          moment(obj.defaultSaleMethod.endDate).format("YYYY-MM-DD")
        ) {
          obj.defaultSaleMethodState = "Normal";
        } else {
          obj.defaultSaleMethodState = "Beyond";
        }
        obj.price = obj.defaultSaleMethod.price;
        obj.oldPrice = obj.defaultSaleMethod.virtualPrice;
      }
    }
    dataList.push(obj);
  }
  return dataList;
}
// å¤„理详情查询结果
export function handleDetailQueryRequestData({
  item,
  fields,
  path,
  coverSize,
  itemFields,
  handelEBooK,
}) {
  item.fileMap = {};
  let itemFieldsData = [];
  for (const key in itemFields) {
    itemFieldsData.push(key);
  }
  let fieldsData = [];
  for (const key in fields) {
    fieldsData.push(key);
  }
  for (let i = 0; i < fieldsData.length; i++) {
    const field = fieldsData[i];
    item.datas[field] = JSON.parse(item.datas[field]);
    const datas = item.datas[field];
    if (datas.length > 0) {
      if (datas[0].Value) {
        item[field] = datas[0].Value;
        if (datas[0].Data.FileLinkList && datas[0].Data.FileLinkList.length) {
          item.fileMap = {
            ...item.fileMap,
            ...handleLinkFileInfo(
              datas[0].Data.FileLinkList.map((item) => {
                return {
                  ...item.File,
                  ...item,
                };
              })
            ),
          };
        }
      } else if (datas[0].Data) {
        item[field] = datas[0].Data.Value;
        if (datas[0].Data.FileLinkList && datas[0].Data.FileLinkList.length) {
          item.fileMap = {
            ...item.fileMap,
            ...handleLinkFileInfo(
              datas[0].Data.FileLinkList.map((item) => {
                return {
                  ...item.File,
                  ...item,
                };
              })
            ),
          };
        }
      }
    }
  }
  // å¤„理cms资源
  const subDatas = item.subDatas;
  const linkItemsMap = {};
  if (subDatas) {
    for (const sdata of subDatas) {
      const tag = sdata.queryTag;
      for (const subItem of sdata.datas) {
        convertCmsItemBase(subItem, coverSize, handelEBooK);
        subItem.fileMap = {};
        for (let i = 0; i < itemFieldsData.length; i++) {
          const itemField = itemFieldsData[i];
          try {
            subItem.datas[itemField] = JSON.parse(subItem.datas[itemField]);
          } catch (error) {
            subItem.datas[itemField] = [];
          }
          const itemDatas = subItem.datas[itemField];
          if (itemDatas.length > 0) {
            if (itemDatas[0].Value) {
              subItem[itemField] = itemDatas[0].Value;
              if (itemDatas[0].FileList && itemDatas[0].FileList.length) {
                subItem.fileMap = {
                  ...subItem.fileMap,
                  ...handleLinkFileInfo(itemDatas[0].FileList),
                };
              }
            } else if (itemDatas[0].Data) {
              subItem[itemField] = itemDatas[0].Data.Value;
              if (
                itemDatas[0].Data.FileList &&
                itemDatas[0].Data.FileList.length
              ) {
                subItem.fileMap = {
                  ...subItem.fileMap,
                  ...handleLinkFileInfo(itemDatas[0].Data.FileList),
                };
              }
            } else if (itemDatas[0].CmsItemData) {
              subItem[itemField] = itemDatas[0].CmsItemData.Value;
              if (
                itemDatas[0].CmsItemData.FileList &&
                itemDatas[0].CmsItemData.FileList.length
              ) {
                subItem.fileMap = {
                  ...subItem.fileMap,
                  ...handleLinkFileInfo(itemDatas[0].CmsItemData.FileList),
                };
              }
            }
          }
        }
        if (subItem.productLinkInfo && subItem.productLinkInfo.length)
          subItem.productLinkPath =
            subItem.productLinkInfo[0].LinkPath +
            "\\" +
            subItem.productLinkInfo[0].CmsItemId;
        if (subItem.linkInfo && subItem.linkInfo.length)
          subItem.linkPath =
            subItem.linkInfo[0].LinkPath + "\\" + subItem.linkInfo[0].CmsItemId;
      }
      linkItemsMap[tag] = sdata.datas;
    }
  }
  convertCmsItemBase(item, coverSize, handelEBooK);
  item.idPath = path + "\\" + item.id;
  item.subItems = linkItemsMap;
  return item;
}
const handleLinkFileInfo = (linkList) => {
  let linkFileMap = {};
  for (let z = 0; z < linkList.length; z++) {
    const linkItem = linkList[z];
    linkFileMap[linkItem.Md5] = {
      linkType: linkItem.LinkType,
      extension: linkItem.Extension,
      fileName: linkItem.FileName,
      fileType: linkItem.Type,
      md5: linkItem.Md5,
      icon: linkItem.Icon,
      size: linkItem.Size,
      metaData: JSON.parse(linkItem.MetaData ?? "{}"),
      order: linkItem.Order,
      protectType: linkItem.ProtectType,
    };
  }
  return linkFileMap;
};
const convertCmsItemBase = (item, coverSize, handelEBooK) => {
  item.name = item.datas.Name;
  item.description = item.datas.Description;
  item.refCode = item.datas.RefCode;
  item.state = item.datas.State;
  item.type = item.datas.Type;
  item.tag = item.datas.Tag;
  item.typeId = parseInt(item.datas.TypeId);
  item.icon = getPublicImage(
    item.datas.Icon,
    coverSize?.width,
    coverSize?.height
  );
  item.sysType = item.datas.SysType;
  item.linkFile = JSON.parse(item.datas.LinkFile ?? "[]");
  item.linkType = item.datas.LinkType;
  item.linkAppId = parseInt(item.datas.LinkAppId);
  item.linkStoreId = parseInt(item.datas.LinkStore);
  item.linkRepoId = item.datas.LinkRepository;
  item.childrenCount = parseInt(item.datas.ChildrenCount ?? "0");
  (item.childrenFolderCount = parseInt(item.datas.ChildrenFolderCount ?? "0")),
    (item.childrenChannelCount = parseInt(
      item.datas.ChildrenChannelCount ?? "0"
    )),
    (item.linkId = parseInt(item.datas.LinkId));
  item.linkOrg = JSON.parse(item.datas.LinkOrg ?? "[]")[0];
  item.linkDepartment = JSON.parse(item.datas.LinkDepartment ?? "[]")[0];
  item.linkInfo = JSON.parse(item.datas.LinkInfo ?? "[]");
  item.productLinkInfo = JSON.parse(item.datas.ProductLinkInfo ?? "[]");
  item.saleMethod = JSON.parse(item.datas.SaleMethod ?? "[]");
  item.allowDonate = item.datas.AllowDonate == "True";
  // item.donatePriceList = JSON.parse(item.datas.DonatePriceList ?? "[]");
  item.createDate = moment(item.datas.CreateDate).format("YYYY-MM-DD");
  item.beginDate = moment(item.datas.BeginDate).format("YYYY-MM-DD");
  item.endDate = moment(item.datas.EndDate).format("YYYY-MM-DD");
  item.storeEvent = JSON.parse(item.datas.StoreEvent ?? "[]");
  // ç»Ÿä¸€å¤„理价格
  if (item.defaultSaleMethod) {
    if (handelEBooK) {
      // èŽ·å–éšä¹¦èµ„æºçš„é”€å”®æ–¹å¼
      let saleMethod = item.cmsDatas[0].datas.find(
        (item) => item.refCode == "tourism_accompanyingResources"
      ).saleMethod;
      if (saleMethod && saleMethod.length > 0) {
        Object.keys(saleMethod[0]).map((key) => {
          let newKey = key.replace(key[0], key[0].toLowerCase());
          saleMethod[0][newKey] = saleMethod[0][key];
          delete saleMethod[0][key];
        });
        item.defaultSaleMethod = saleMethod[0];
        item.defaultSaleMethodId = saleMethod[0].id;
        item.alreadyBuy =
          item.purchasedSaleMethodIdList.indexOf(item.defaultSaleMethodId) > -1;
      }
    }
    if (item.defaultSaleMethod.allowEvent && item.storeEvent.length) {
      // å·²å‚加活动,获取有效活动并计算价格
      let time = new Date().getTime();
      // è¿‡æ»¤è¿‡æœŸæ´»åЍ
      let event = item.storeEvent.filter((item) => {
        let endTime = new Date(item.EndDate).getTime();
        return endTime > time;
      });
      // åªå¤„理一条有效活动
      if (event.length) {
        item.price = (item.defaultSaleMethod.price * event[0].Value).toFixed(2);
        item.oldPrice = item.defaultSaleMethod.price;
        if (
          moment().format("YYYY-MM-DD") <
          moment(item.defaultSaleMethod.endDate).format("YYYY-MM-DD")
        ) {
          item.defaultSaleMethodState = "Normal";
        } else {
          item.defaultSaleMethodState = "Beyond";
        }
        item.storeEventId = event[0].Id;
      }
    } else {
      item.price = item.defaultSaleMethod.price;
      item.oldPrice = item.defaultSaleMethod.virtualPrice;
      if (
        moment().format("YYYY-MM-DD") <
        moment(item.defaultSaleMethod.endDate).format("YYYY-MM-DD")
      ) {
        item.defaultSaleMethodState = "Normal";
      } else {
        item.defaultSaleMethodState = "Beyond";
      }
    }
  }
};
export function getTopicMsgCmsItemFile(fileType, fileList) {
  let obj = {};
  fileType.forEach((item) => {
    item.sequenceNum = item.config ? JSON.parse(item.config).uuid : "";
    fileList.forEach((e) => {
      if (item.sequenceNum == e.sequenceNum) {
        try {
          if (e.fileLinkList.length > 0) {
            for (let i = 0; i < e.fileLinkList.length; i++) {
              const ele = e.fileLinkList[i];
              ele.name = ele.file.fileName;
              ele.md5 = ele.file.md5;
              ele.status = "success";
            }
            obj[item.typeField.refCode] = e.fileLinkList;
          } else {
            const val = JSON.parse(e.value);
            if (val) {
              obj[item.typeField.refCode] = val;
            } else {
              obj[item.typeField.refCode] = "-";
            }
          }
        } catch (error) {
          obj[item.typeField.refCode] = e.value ? e.value : "-";
        }
      }
    });
  });
  return obj;
}
// èŽ·å–ä¸å—ä¿æŠ¤çš„å›¾ç‰‡
export function getPublicImage(md5, width, height) {
  let src = null;
  if (md5) {
    src = requestCtx + `/file/GetPreViewImage?md5=${md5}`;
  } else {
    return require("@/assets/images/homeBg.png");
  }
  if (width) src += `&width=${width}`;
  if (height) src += `&height=${height}`;
  return src;
}
src/assets/js/questionModel.js
New file
@@ -0,0 +1,180 @@
//题库练习
var Practice = [
    {
        type: "completion",
        typeName: "填空题",
        num: 20,
        score: 1,
        totalScore: 20,
        startIndex: 0,
        cIndex: "一",
        list:[]
    },
    {
        type: "judge",
        typeName: "判断题",
        num: 40,
        score: 0.5,
        totalScore: 20,
        startIndex: 0,
        cIndex: "二",
        list:[]
    },
    {
        type: "singleChoice",
        typeName: "单选题",
        num: 90,
        score: 0.5,
        totalScore: 45,
        startIndex: 0,
        cIndex: "三",
        list:[]
    },
    {
        type: "multipleChoice",
        typeName: "多选题",
        num: 35,
        score: 1,
        totalScore: 35,
        startIndex: 0,
        cIndex: "四",
        list:[]
    },
    {
        type: "shortAnswer",
        typeName: "简述题",
        num: 3,
        score: 5,
        totalScore: 15,
        startIndex: 0,
        cIndex: "五",
        list:[]
    },
    {
        type: "discussionQuestions",
        typeName: "论述题",
        num: 2,
        score: 10,
        totalScore: 20,
        startIndex: 0,
        cIndex: "六",
        list:[]
    }
];
// æ™®é€šæ¨¡è€ƒ
var Normal = [
    {
        type: "judgmentQuestion",
        typeName: "判断题(每题的备选项中,只有1个最符合题意)",
        num: 40,
        score: 0.5,
        totalScore: 20,
        startIndex: 0,
        cIndex: "一"
    },
    {
        type: "singleChoice",
        typeName: "单项选择题(每题的备选项中,只有1个最符合题意)",
        num: 90,
        score: 0.5,
        totalScore: 45,
        startIndex: 40,
        cIndex: "二"
    },
    {
        type: "multipleChoice",
        typeName: "多项选择题(每题的备选项中,有两个或2个以上符合题意,至少有1个错项)",
        num: 35,
        score: 1,
        totalScore: 35,
        startIndex: 130,
        cIndex: "三"
    }
];
// ä¸­çº§è€ƒè¯•第一部分
var zhongjikaoshi1 = [
    {
        type: "judgmentQuestion",
        typeName: "判断题(每题的备选项中,只有1个最符合题意)",
        num: 30,
        score: 0.5,
        totalScore: 15,
        startIndex: 0,
        cIndex: "一"
    },
    {
        type: "singleChoice",
        typeName: "单项选择题(每题的备选项中,只有1个最符合题意)",
        num: 40,
        score: 1,
        totalScore: 40,
        startIndex: 30,
        cIndex: "二"
    },
    {
        type: "multipleChoice",
        typeName: "多项选择题(每题的备选项中,有两个或2个以上符合题意,至少有1个错项)",
        num: 15,
        score: 2,
        totalScore: 30,
        startIndex: 70,
        cIndex: "三"
    },
    {
        type: "briefQuestions",
        typeName: "简述题",
        num: 3,
        score: 5,
        totalScore: 15,
        startIndex: 85,
        cIndex: "四"
    }
];
// ä¸­çº§è€ƒè¯•第二部分
var zhongjikaoshi2 = [
    {
        type: "completion",
        typeName: "填空题",
        num: 20,
        score: 1,
        totalScore: 20,
        startIndex: 0,
        cIndex: "一"
    },
    {
        type: "singleChoice",
        typeName: "单项选择题(每题的备选项中,只有1个最符合题意)",
        num: 30,
        score: 1,
        totalScore: 30,
        startIndex: 20,
        cIndex: "二"
    },
    {
        type: "multipleChoice",
        typeName: "多项选择题(每题的备选项中,有两个或2个以上符合题意,至少有1个错项)",
        num: 20,
        score: 1.5,
        totalScore: 30,
        startIndex: 50,
        cIndex: "三"
    },
    {
        type: "discussionQuestions",
        typeName: "论述题",
        num: 2,
        score: 10,
        totalScore: 20,
        startIndex: 70,
        cIndex: "四"
    }
];
export {
    Practice,
    Normal,
    zhongjikaoshi1,
    zhongjikaoshi2
};
src/assets/js/toolClass.js
New file
@@ -0,0 +1,468 @@
import SparkMD5 from "spark-md5";
import { getPublicImage } from "@/assets/js/middleGround/tool";
import moment from "moment";
var tool = {
  secondToTime(second) {
    var minute = Math.floor(second / 60);
    var sec = second % 60;
    var time;
    if (second < 60) {
      time = second + '"';
    } else {
      time = sec === 0 ? minute + "'" : minute + "'" + sec + '"';
    }
    return time;
  },
  setCookie: function (c_name, value, expiredays, path) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie =
      c_name +
      "=" +
      escape(value) +
      (expiredays == null ? "" : ";expires=" + exdate.toGMTString()) +
      (path ? ";path=" + path : "");
  },
  getCookie: function (c_name) {
    if (document.cookie.length > 0) {
      var c_start = document.cookie.indexOf(c_name + "=");
      if (c_start != -1) {
        c_start = c_start + c_name.length + 1;
        var c_end = document.cookie.indexOf(";", c_start);
        if (c_end == -1) c_end = document.cookie.length;
        return unescape(document.cookie.substring(c_start, c_end));
      }
    }
    return "";
  },
  delCookie: function (name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = tool.getCookie(name);
    if (cval != null)
      document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
  },
  // å¼ºåˆ¶ä¿ç•™2位小数,如:2,会在2后面补上00.即2.00
  toDecimal2(x) {
    var f;
    f = parseFloat(x);
    if (isNaN(f)) {
      return false;
    }
    f = Math.round(x * 100) / 100;
    var s = f.toString();
    var rs = s.indexOf(".");
    if (rs < 0) {
      rs = s.length;
      s += ".";
    }
    while (s.length <= rs + 2) {
      s += "0";
    }
    return s;
  },
  formateTime(date) {
    var newDate = new Date(+new Date(date) + 8 * 3600 * 1000)
      .toISOString()
      .replace(/T/g, " ")
      .replace(/\.[\d]{3}Z/, "");
    var time = new Date(newDate);
    return time.getTime();
  },
};
// å¤„理订单记录
export function setOrderList(res) {
  // èŽ·å–å½“å‰å¹´ä»½çš„å¼€å§‹æ—¶é—´
  let currentTimestamp = moment().startOf("year");
  let arr = [];
  for (let i = 0; i < res.length; i++) {
    const item = res[i];
    // å‘票状态为审核中或者审核失败,将item选中状态设置选中。
    // UI控制禁用(显示的效果为 é€‰ä¸­å¹¶ä¸”禁用)
    if (item.invoiceInfo) {
      item.checked = true;
    } else {
      item.checked = false;
    }
    // åˆ¤æ–­æ˜¯å¦è¶…出申请发票的日期
    item.exceedingTheSpecifiedTime = moment(item.createDate).isBefore(
      currentTimestamp
    );
    if (item.saleMethodLinks.length > 0) {
      let itemName = null;
      let itemIcon = null;
      let cmsItemList = null;
      try {
        cmsItemList = item.saleMethodLinks[0].orderSaleMethod.cmsItemList[0];
      } catch (error) {
        cmsItemList = null;
      }
      if (cmsItemList && cmsItemList.icon) {
        itemName = cmsItemList.name;
        itemIcon = cmsItemList.icon;
      } else {
        itemName = item.saleMethodLinks[0].orderSaleMethod.product.name;
        itemIcon = item.saleMethodLinks[0].orderSaleMethod.product.icon;
      }
      item.saleMethodLinks[0].title = itemName;
      item.saleMethodLinks[0].icon = getPublicImage(itemIcon);
    } else {
      const itemIcon = require("@/assets/images/homeBg.png");
      const saleMethodLink = [];
      const obj = {
        icon: itemIcon,
        orderSaleMethod: {
          price: item.payPrice,
        },
      };
      saleMethodLink.push(obj);
      item.saleMethodLinks = saleMethodLink;
    }
    if (item.state == "Success") {
      item.CustomState = "支付成功";
    }
    if (item.state == "Cancel") {
      item.CustomState = "取消支付";
    }
    if (item.state == "WaitPay") {
      item.CustomState = "等待支付";
    }
    if (item.state == "WaitDeliver") {
      item.CustomState = "正在支付";
    }
    arr.push(item);
  }
  return arr;
}
//处理表单提交数据
export function worksData(res) {
  let arr = [];
  for (let i = 0; i < res.length; i++) {
    const item = res[i];
    if (item.typeField) {
      if (item.typeField.config) {
        item.typeField.options = JSON.parse(item.typeField.config).option;
      }
      arr.push(item.typeField);
    }
  }
  return arr;
}
export function worksDataBytool(res, value, linkList) {
  let arr = [];
  let nrr = [];
  if (linkList && linkList.length > 0) {
    linkList.forEach((e) =>
      nrr.push({
        linkProtectType: e.linkProtectType,
        linkType: e.linkType,
        md5: e.md5,
      })
    );
  }
  res.forEach((item) => {
    const obj = {
      baseType: item.typeField.baseType,
      order: 0,
      typeFieldId: item.typeField.id,
      sequenceNum: item.config ? JSON.parse(item.config).uuid : "",
      newDataAndFileLinkListRequest: [],
    };
    for (let k in value) {
      if (item.typeField.refCode === k) {
        if (typeof value[k] == "object") {
          if (obj.refCode == "region") {
            obj.strValue = value[k]?.join("/");
          } else {
            obj.strValue = JSON.stringify(value[k]);
          }
        } else {
          if (obj.baseType === "String") {
            obj.strValue = value[k] + "";
          } else if (obj.baseType === "Text") {
            obj.textValue = value[k] + "";
          } else {
            obj.strValue = value[k] + "";
          }
        }
        if (item.typeField.type == "File") {
          obj.newDataAndFileLinkListRequest = nrr;
        }
      }
    }
    if (obj.strValue || obj.textValue) {
      arr.push(obj);
    }
  });
  return arr;
}
export function UpdateworksDataBytool(initData, res, value, linkList) {
  let arr = [];
  let newArr = [];
  for (let i = 0; i < initData.length; i++) {
    const ele = initData[i];
    for (let j = 0; j < res.length; j++) {
      const item = res[j];
      if (item.sequenceNum == ele.sequenceNum) {
        item.refCode = ele.typeField.refCode;
      }
    }
  }
  initData.forEach((citem) => {
    const updateOldData = res.find((f) => f.sequenceNum == citem.sequenceNum);
    if (updateOldData) {
      const obj = {
        baseType: citem.typeField.baseType,
        order: 0,
        id: updateOldData.id,
        typeFieldId: citem.typeField.id,
        sequenceNum: citem.sequenceNum,
        setDataAndFileLinkListRequest: [],
      };
      for (let k in value) {
        if (citem.typeField.refCode === k) {
          if (typeof value[k] == "object" && k != "region") {
            obj.strValue = JSON.stringify(linkList);
            obj.setDataAndFileLinkListRequest = linkList;
          } else if (typeof value[k] == "object" && k == "region") {
            obj.strValue = value[k]?.join("/");
            obj.setDataAndFileLinkListRequest = [{ area: value[k] }];
          } else {
            obj.strValue = value[k].toString();
          }
        }
      }
      // if (obj.strValue) {
        arr.push(obj);
      // }
    } else {
      const newObj = {
        baseType: citem.typeField.baseType,
        order: 0,
        typeFieldId: citem.typeField.id,
        sequenceNum: citem.sequenceNum,
        setDataAndFileLinkListRequest: [],
      };
      for (let k in value) {
        if (citem.typeField.refCode === k) {
          if (typeof value[k] == "object") {
            newObj.strValue = JSON.stringify(linkList);
            newObj.setDataAndFileLinkListRequest = linkList;
          } else {
            newObj.strValue = value[k].toString();
          }
        }
      }
      if (newObj.strValue) {
        newArr.push(newObj);
      }
    }
  });
  return {
    updateData: arr,
    newData: newArr,
  };
}
export function download(url) {
  const iframe = document.createElement("iframe");
  iframe.setAttribute("hidden", "hidden");
  document.body.appendChild(iframe);
  iframe.onload = () => {
    if (iframe) {
      iframe.setAttribute("src", "about:blank");
    }
  };
  iframe.setAttribute("src", url);
}
/**
 * èŽ·å–ä¸€ä¸ªUUID
 * @param len
 * @param radix
 * @returns {string}
 */
export function uuid(len = 32, radix = 16) {
  const chars =
    "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
  let uuid = [],
    i;
  radix = radix || chars.length;
  if (len) {
    // Compact form
    for (i = 0; i < len; i++) uuid[i] = chars[0 | (Math.random() * radix)];
  } else {
    // rfc4122, version 4 form
    let r;
    // rfc4122 requires these characters
    uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
    uuid[14] = "4";
    // Fill in random data.  At i==19 set the high bits of clock sequence as
    // per rfc4122, sec. 4.1.5
    for (i = 0; i < 36; i++) {
      if (!uuid[i]) {
        r = 0 | (Math.random() * 16);
        uuid[i] = chars[i === 19 ? (r & 0x3) | 0x8 : r];
      }
    }
  }
  return uuid.join("");
}
export function getFileMd5(file, chunkSize) {
  return new Promise((resolve, reject) => {
    let blobSlice =
      File.prototype.slice ||
      File.prototype.mozSlice ||
      File.prototype.webkitSlice;
    let chunks = Math.ceil(file.size / chunkSize);
    let currentChunk = 0;
    let spark = new SparkMD5.ArrayBuffer();
    let fileReader = new FileReader();
    fileReader.onload = function (e) {
      spark.append(e.target.result);
      currentChunk++;
      if (currentChunk < chunks) {
        loadNext();
      } else {
        const md5 = spark.end();
        resolve(md5);
      }
    };
    fileReader.onerror = function (e) {
      reject(e);
    };
    function loadNext() {
      let start = currentChunk * chunkSize;
      let end = start + chunkSize;
      if (end > file.size) {
        end = file.size;
      }
      fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
    }
    loadNext();
  });
}
// å¤„理时间,用于显示音视频当前时间
export function realFormatSecond(time) {
  let duration = parseInt(time);
  let minute = parseInt(duration / 60);
  let sec = (duration % 60) + "";
  let isM0 = ":";
  if (minute == 0) {
    minute = "00";
  } else if (minute < 10) {
    minute = "0" + minute;
  }
  if (sec.length == 1) {
    sec = "0" + sec;
  }
  return minute + isM0 + sec;
}
export function parseHtml(content) {
  const tagReg =
    /<\/?div[^>]*>|<\/?span[^>]*>|<\/?table[^>]*>|<\/?th[^>]*>|<\/?thead>|<\/?tbody>|<\/?tr>|<\/?td[^>]*>|<br[^>]*>|<\/?p[^>]*>|<\/?sub>|<\/?sup>|<\/?font[^>]*>|<img[^>]*>|<\/?a[^>]*>|\n|\\n/gi;
  const escapeReg =
    /&(lt|gt|le|ge|nbsp|amp|quot|times|Alpha|Beta|Gamma|Delta|Epsilon|Zeta|Eta|Theta|Iota|Kappa|Lambda|MU|NU|Xi|Omicron|Pi|Rho|Sigma|Tau|Upsilon|Phi|Chi|Psi|Omega|alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigmaf|sigma|tau|upsilon|phi|chi|psi|omega|thetasym|upsih|piv|circ|tilde|ndash|permil|lsquo|rsquo|ldquo|rdquo|prime);/gi;
  const escapeElements = {
    lt: "<",
    gt: ">",
    le: "≤",
    ge: "≥",
    nbsp: " ",
    amp: "&",
    quot: '""',
    times: "×",
    Alpha: "Α",
    Beta: "Β",
    Gamma: "Γ",
    Delta: "Δ",
    Epsilon: "Ε",
    Zeta: "Ζ",
    Eta: "Η",
    Theta: "Θ",
    Iota: "Ι",
    Kappa: "Κ",
    Lambda: "Λ",
    Mu: "Μ",
    Nu: "Ν",
    Xi: "Ξ",
    Omicron: "Ο",
    Pi: "Π",
    Rho: "Ρ",
    Sigma: "Σ",
    Tau: "Τ",
    Upsilon: "Î¥",
    Phi: "Φ",
    Chi: "Χ",
    Psi: "Ψ",
    Omega: "Ω",
    alpha: "α",
    beta: "β",
    gamma: "γ",
    delta: "δ",
    epsilon: "ε",
    zeta: "ζ",
    eta: "η",
    theta: "θ",
    iota: "ι",
    kappa: "κ",
    lambda: "λ",
    mu: "μ",
    nu: "ν",
    xi: "ξ",
    omicron: "ο",
    pi: "π",
    rho: "ρ",
    sigmaf: "ς",
    sigma: "σ",
    tau: "τ",
    upsilon: "υ",
    phi: "φ",
    chi: "χ",
    psi: "ψ",
    omega: "ω",
    thetasym: "ϑ",
    upsih: "ϒ",
    piv: "ϖ",
    circ: "ˆ",
    tilde: "˜",
    ndash: "–",
    permil: "‰",
    lsquo: "‘",
    rsquo: "’",
    ldquo: "“",
    rdquo: "”",
    prime: "′",
  };
  const contentWithoutTag = content.replace(tagReg, "");
  const contentWithOnlyOneSpace = contentWithoutTag.replace(/ {2,}/g, " ");
  return contentWithOnlyOneSpace.replace(
    escapeReg,
    (all, t) => escapeElements[t]
  );
}
export default {
  ...tool,
  uuid,
  getFileMd5,
  worksDataBytool,
  UpdateworksDataBytool,
  getPublicImage,
  worksData,
  parseHtml,
};
src/assets/js/userAction.js
New file
@@ -0,0 +1,135 @@
import config from "@/assets/js/config.js";
import jobApi from "./middleGround/api/job"; // newJobWithNewView // newSession,
export function setSessionGuid(type, id) {
  var cityCode = null;
  var SnIp = null;
  try {
    // eslint-disable-next-line
    SnIp = window.returnCitySN;
  } catch (error) {
    SnIp = null;
    console.log(error);
  }
  if (SnIp != undefined && SnIp != null) {
    cityCode = SnIp;
  } else {
    cityCode = {
      cip: "0.0.0.0",
      cname: "未知",
    };
  }
  const _city = cityCode.cname.substring(3);
  const _province = cityCode.cname.substring(0, 3);
  const params = {
    appRefCode: config.appRefCode,
    hostName: config.requestCtx,
    ipAddress: cityCode.cip,
    browser: myBrowser(),
    os: navigator.platform,
    device: "pc",
    province: _province,
    city: _city ? _city : _province,
  };
  jobApi.newSession(params).then(res => {
    storage.set("sessionGuid", res, 30);
    setNewView(type, id);
  });
}
export const storage = {
  /*
   * set å­˜å‚¨æ–¹æ³•
   * @ param {String}     key é”®
   * @ param {String}     value å€¼ï¼Œ
   * @ param {String}     expired è¿‡æœŸæ—¶é—´ï¼Œä»¥åˆ†é’Ÿä¸ºå•位,非必须
   */
  set(key, val, expired) {
    if (typeof val !== "string") {
      val = JSON.stringify(val);
    }
    window.sessionStorage.setItem(key, val);
    if (expired) {
      window.sessionStorage.setItem(
        `${key}__expires__`,
        `${Date.now() + 1000 * 60 * expired}`
      );
    }
  },
  /*
   * get èŽ·å–æ–¹æ³•
   * @ param {String}     key é”®
   * @ param {String}     expired å­˜å‚¨æ—¶ä¸ºéžå¿…须字段,所以有可能取不到,默认为 Date.now+1
   */
  get(key) {
    const expired =
      window.sessionStorage.getItem(`${key}__expires__`) || Date.now + 1;
    const now = Date.now();
    if (now >= expired) {
      window.sessionStorage.removeItem(key);
      return;
    }
    let val = window.sessionStorage.getItem(key);
    try {
      val = JSON.parse(val);
    } catch (e) {
      return e;
    }
    return val;
  },
};
function myBrowser() {
  const userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  const isOpera = userAgent.indexOf("Opera") > -1;
  if (isOpera) {
    //判断是否Opera浏览器
    return "Opera";
  }
  if (userAgent.indexOf("Firefox") > -1) {
    //判断是否Firefox浏览器
    return "Firefox";
  }
  if (userAgent.indexOf("Chrome") > -1) {
    return "Chrome";
  }
  if (userAgent.indexOf("Safari") > -1) {
    //判断是否Safari浏览器
    return "Safari";
  }
  if (
    userAgent.indexOf("compatible") > -1 &&
    userAgent.indexOf("MSIE") > -1 &&
    !isOpera
  ) {
    //判断是否IE浏览器
    return "IE";
  }
  return "";
}
export function setNewView(type, id) {
  if (!sessionStorage.getItem("sessionGuid")) {
    setSessionGuid(type, id);
  }
  const sessionGuid = sessionStorage.getItem("sessionGuid");
  const fromPath = sessionStorage.getItem("fromPath");
  const toPath = sessionStorage.getItem("toPath");
  if (sessionGuid) {
    let params = {
      sessionGuid: sessionGuid,
      appRefCode: config.appRefCode,
      type: "View",
      url: toPath == null ? "/" : toPath,
      ref: fromPath == null ? "/" : fromPath,
    };
    if (id) {
      params[type] = id;
    }
    jobApi.newJobWithNewView(params).then(res => {});
  }
}
src/assets/logo.png
src/layout/base.vue
New file
@@ -0,0 +1,24 @@
<template>
  <keep-alive v-if="keepAliveList.length > 0" :include="keepAliveList">
    <router-view />
  </keep-alive>
  <router-view v-else />
</template>
<script>
import { mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState(["keepAliveList"]),
  },
  watch: {
    $route(to, from) {
      if (to.meta.keepAlive && this.keepAliveList.indexOf(to.name) == -1) {
        this.$store.commit("addKeepAlive", to.name);
      }
    },
  },
};
</script>
src/layout/index.vue
New file
@@ -0,0 +1,37 @@
<template>
  <div class="homeLayoutBox">
    <div class="pageContentBox">
      <keep-alive v-if="keepAliveList.length > 0" :include="keepAliveList">
        <router-view />
      </keep-alive>
      <router-view v-else />
    </div>
  </div>
</template>
<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["userInfo", "keepAliveList"]),
  },
  watch: {
    $route(to, from) {
      if (to.meta.keepAlive && this.keepAliveList.indexOf(to.name) == -1) {
        this.$store.commit("addKeepAlive", to.name);
      }
    },
  },
};
</script>
<style lang="less" scoped>
.homeLayoutBox {
  width: 100%;
  height: 100%;
  .pageContentBox {
    min-height: calc(100% - 525px);
  }
}
</style>
src/main.js
New file
@@ -0,0 +1,68 @@
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
// import VideoPlayer from "vue-video-player";
// Vue.use(VideoPlayer);
// è‡ªå®šä¹‰é…ç½®
import config from "@/assets/js/config";
Vue.prototype.config = config;
// axios
import service from "@/plugin/axios";
Vue.prototype.request = service;
// ElementUI
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
ElementUI.Dialog.props.lockScroll.default = false;
Vue.use(ElementUI);
// è¯·æ±‚处理
import MG from "@/assets/js/middleGround/WebMiddleGroundApi";
Vue.prototype.MG = MG;
//工具类
import toolClass from "./assets/js/toolClass";
Vue.prototype.tool = toolClass;
// æ—¶é—´å¤„理
import moment from "moment";
Vue.prototype.moment = moment;
// è§†é¢‘播放
import VideoPlayer from "vue-video-player";
require("video.js/dist/video-js.css");
require("vue-video-player/src/custom-theme.css");
Vue.use(VideoPlayer);
Vue.config.productionTip = false;
Vue.directive("dialogDrag", {});
// è·¯ç”±åˆ¤æ–­ç™»å½• æ ¹æ®è·¯ç”±é…ç½®æ–‡ä»¶çš„参数
router.beforeEach((to, from, next) => {
  if (to.matched.some((record) => record.meta.authentication)) {
    // åˆ¤æ–­è¯¥è·¯ç”±æ˜¯å¦éœ€è¦ç™»å½•权限
    if (toolClass.getCookie(config.tokenKey)) {
      // åˆ¤æ–­å½“前的token是否存在; ç™»å½•存入的token
      next();
    } else {
      next({
        path: "/login",
        query: {
          redirect: to.fullPath,
        }, // å°†è·³è½¬çš„路由path作为参数,登录成功后跳转到该路由
      });
    }
  } else {
    next();
  }
});
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
src/plugin/axios/index.js
New file
@@ -0,0 +1,67 @@
import axios from "axios";
import myConfig from "@/assets/js/config";
import toolClass from "@/assets/js/toolClass";
import router from "@/router";
// åˆ›å»º axios å®žä¾‹
const service = axios.create({
  baseURL: myConfig.requestCtx,
  timeout: myConfig.requestTimeOut, // è¯·æ±‚è¶…æ—¶æ—¶é—´
});
// è¯·æ±‚拦截器
service.interceptors.request.use(
  config => {
    let token = toolClass.getCookie(myConfig.tokenKey);
    if (token) config.headers["Authorization"] = `bearer ${token}`;
    return config;
  },
  error => {
    // å‘送失败
    Promise.reject(error);
  }
);
// å“åº”拦截器
service.interceptors.response.use(
  response => {
    // dataAxios æ˜¯ axios è¿”回数据中的 data
    const dataAxios = response.data;
    if (typeof dataAxios.data === "boolean") {
      return dataAxios.data;
    }
    if (response.config.responseType == "blob") {
      return dataAxios;
    }
    const { success } = dataAxios;
    if (dataAxios.currentDate) {
      sessionStorage.currentDate = new Date(dataAxios.currentDate).getTime();
    }
    // æ ¹æ® code è¿›è¡Œåˆ¤æ–­
    if (success) {
      return dataAxios.data ? dataAxios.data : dataAxios;
    } else {
      // æç¤ºé”™è¯¯
      console.log(dataAxios.msg);
    }
  },
  error => {
    if (error.response && error.response.status == 401) {
      toolClass.delCookie(myConfig.tokenKey);
      localStorage.clear();
      router.replace({
        path: "/login",
      });
    } else {
      if (error.response && error.response.data && error.response.data.error) {
        console.error(error.response.data.error.msg);
      } else {
        console.error("请求发生错误");
      }
    }
    return Promise.reject(error);
  }
);
export default service;
src/router/index.js
New file
@@ -0,0 +1,61 @@
import Vue from "vue";
import VueRouter from "vue-router";
import HomeLayout from "@/layout";
import Home from "@/views/home";
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
Vue.use(VueRouter);
const routes = [{
    path: "/",
    name: "HomeLayout",
    component: HomeLayout,
    redirect: {
      name: "home"
    },
    children: [
      // åœ¨ä¸»æ¡†æž¶å†…
      {
        path: "/home",
        name: "home",
        meta: {
          name: "首页",
          authentication: false, // æ˜¯å¦éœ€è¦ç™»å½•验证
          keepAlive: false // æ˜¯å¦éœ€è¦ç¼“å­˜
        },
        component: Home
      },
      // {
      //   path: "/login",
      //   name: "login",
      //   meta: {
      //     name: "登录",
      //     authentication: false
      //   },
      //   component: () => import("@/views/login/login")
      // },
    ]
  },
  // ä¸åœ¨ä¸»æ¡†æž¶å†…
  // {
  //   path: "/pdf",
  //   name: "pdf",
  //   component: () => import("@/components/play/pdf")
  // },
];
const router = new VueRouter({
  routes
});
export default router;
src/store/index.js
New file
@@ -0,0 +1,233 @@
import Vue from "vue";
import Vuex from "vuex";
import tool from "@/assets/js/toolClass";
import {
  tokenKey,
  userInfoKey
} from "@/assets/js/config";
Vue.use(Vuex);
export default new Vuex.Store({
  state: {
    token: tool.getCookie(tokenKey),
    userInfo: localStorage.getItem(userInfoKey) ?
      JSON.parse(localStorage.getItem(userInfoKey)) : null,
    //文旅图库商品
    cartTourList: [],
    crumbs: localStorage.getItem("crumbs") ?
      JSON.parse(localStorage.getItem("crumbs")) : {
        bookStore: {},
        teachingResource: {},
        learnPlatform: {},
        personalCenter: {},
      },
    updateRightPop: 0,
    headerSearchType: "bookCity",
    electronicBookList: localStorage.getItem("electronicBookList") ?
      JSON.parse(localStorage.getItem("electronicBookList")) : [], //电子样书列表
    paperBookList: localStorage.getItem("paperBookList") ?
      JSON.parse(localStorage.getItem("paperBookList")) : [], //纸质样书列表
    bookStoreBrowseRecords: localStorage.getItem("bookStoreBrowseRecords") ?
      JSON.parse(localStorage.getItem("bookStoreBrowseRecords")) : [], // ä¹¦åŸŽæµè§ˆè®°å½•
    // ç¼“存组件名称列表
    keepAliveList: [],
  },
  getters: {},
  mutations: {
    // æ·»åŠ ç”µå­æ ·ä¹¦åˆ—è¡¨
    appplyElectronicBook(state, val) {
      state.electronicBookList.push(val);
      localStorage.setItem(
        "electronicBookList",
        JSON.stringify(state.electronicBookList)
      );
    },
    //添加纸质样式列表
    appplyPaperBook(state, val) {
      state.paperBookList.push(val);
      localStorage.setItem(
        "paperBookList",
        JSON.stringify(state.paperBookList)
      );
    },
    //删除电子样书列表
    removeElectronicBook(state, val) {
      state.electronicBookList.splice(val, 1);
      localStorage.setItem(
        "electronicBookList",
        JSON.stringify(state.electronicBookList)
      );
    },
    //删除纸质样式
    removePaperBook(state, val) {
      state.paperBookList.splice(val, 1);
      localStorage.setItem(
        "paperBookList",
        JSON.stringify(state.paperBookList)
      );
    },
    emptyBookList(state, val) {
      if (val && val.type == "eBook") {
        state.electronicBookList = val.list.filter((item) => !item.checked);
        localStorage.setItem(
          "electronicBookList",
          JSON.stringify(state.electronicBookList)
        );
      } else if (val && val.type == "paperBook") {
        state.paperBookList = val.list.filter((item) => !item.checked);
        localStorage.setItem(
          "paperBookList",
          JSON.stringify(state.paperBookList)
        );
      } else {
        state.paperBookList = [];
        state.electronicBookList = [];
        localStorage.removeItem("electronicBookList");
        localStorage.removeItem("paperBookList");
      }
    },
    changeLogin(state, val) {
      if (val) {
        state.token = val;
        tool.setCookie(tokenKey, val);
      } else {
        state.token = null;
        tool.delCookie(tokenKey);
      }
    },
    changeUserInfo(state, val) {
      if (val) {
        // é»˜è®¤å¤´åƒ
        if (!val.icon) val.icon = require("@/assets/images/homeBg.png");
        state.userInfo = JSON.parse(JSON.stringify(val));
        localStorage.setItem(userInfoKey, JSON.stringify(val));
      } else {
        state.userInfo = val;
        localStorage.setItem(userInfoKey, val);
      }
    },
    //main.js改变vue中购物车
    changeVuexCart(state, listObj) {
      var listName = listObj.list;
      if (listName == "cartTourList") {
        state.cartTourList = listObj.newList;
      }
    },
    // é¢åŒ…屑
    changeCrumbs(state, data) {
      // é»˜è®¤æ·»åŠ æ¨¡å—é¦–é¡µ
      switch (data.type) {
        case "bookStore":
          data.data.unshift({
            name: "书城",
            path: "/bookStore",
          });
          break;
        case "teachingResource":
          data.data.unshift({
            name: "教学服务",
            path: "/teachingResource",
          });
          break;
        case "learnPlatform":
          data.data.unshift({
            name: "学习平台",
            path: "/learnPlatform",
          });
          break;
        case "personalCenter":
          data.data.unshift({
            name: "个人中心",
          });
          // path: "/personalCenter"
          // ä¸ªäººä¸­å¿ƒ è¯¦æƒ…页面 ç‚¹å‡»ä¸ªäººä¸­å¿ƒ(面包屑)不跳转
          break;
      }
      // è®°å½•key
      if (!state.crumbs[data.type] || !state.crumbs[data.type].keys) {
        state.crumbs[data.type] = {
          keys: []
        };
      }
      state.crumbs[data.type].keys.push(data.cid);
      state.crumbs[data.type][data.cid] = data.data;
      // åªè®°å½•20条,删除旧记录
      if (state.crumbs[data.type].keys.length > 20) {
        let key = state.crumbs[data.type].keys[0];
        delete state.crumbs[data.type][key];
        state.crumbs[data.type].keys.splice(0, 1);
      }
      localStorage.setItem("crumbs", JSON.stringify(state.crumbs));
    },
    // æ›´æ”¹é¡µé¢å¤´éƒ¨æœç´¢æ¡†ç±»åž‹
    changeHeaderSearchType(state, data) {
      state.headerSearchType = data;
    },
    addBookStoreBrowseRecords(state, data) {
      let oldIndex = state.bookStoreBrowseRecords.findIndex(
        (item) => item.id == data.id
      );
      if (oldIndex != -1) {
        state.bookStoreBrowseRecords.splice(oldIndex, 1);
      }
      state.bookStoreBrowseRecords.unshift(data);
      if (state.bookStoreBrowseRecords.length > 4) {
        state.bookStoreBrowseRecords.pop();
      }
      localStorage.setItem(
        "bookStoreBrowseRecords",
        JSON.stringify(state.bookStoreBrowseRecords)
      );
    },
    // æ›´æ–°å³ä¾§å¼¹å‡ºæ¡†è´­ç‰©è½¦çš„æ•°é‡
    updateRightPop(state) {
      state.updateRightPop += 1;
    },
    // æ·»åŠ ç¼“å­˜ç»„ä»¶
    addKeepAlive(state, val) {
      state.keepAliveList.push(val);
    },
    // ç§»é™¤ç¼“存组件
    delKeepAlive(state, val) {
      if (state.keepAliveList.findIndex((item) => item == val) != -1) {
        state.keepAliveList.splice(
          state.keepAliveList.findIndex((item) => item == val),
          1
        );
      }
    },
  },
  actions: {
    setUserInfo(context, val) {
      context.commit("changeUserInfo", val);
    },
    setToken(context, val) {
      context.commit("changeLogin", val);
    },
    setCrumbs(context, data) {
      // å­˜å‚¨é¢åŒ…屑
      if (!data.cid) {
        data.cid = tool.uuid(8);
      }
      context.commit("changeCrumbs", data);
      if (data.callback) data.callback(data.cid);
    },
    clearBook(context, val) {
      context.commit("emptyBookList", val);
    },
    setBrowseRecords(context, val) {
      if (val.moduleType == "bookStore") {
        if (val.type == "add") {
          context.commit("addBookStoreBrowseRecords", val.data);
        }
      }
    },
  },
  modules: {},
});
src/views/home/index.vue
New file
@@ -0,0 +1,29 @@
<template>
  <div class="home">
    <div class="profilePhoto"></div>
  </div>
</template>
<script>
export default {};
</script>
<style>
.home {
  width: 100%;
  height: 100vh;
  background-image: url("@/assets/images/homeBg.png");
  background-repeat: no-repeat;
  background-size: 100% 95%;
  position: relative;
}
.profilePhoto {
  background-image: url("@/assets/images/profilePhoto.png");
  width: 575px;
  height: 656px;
  background-size: 100% 100%;
  position: relative;
  top: 33%;
  left: 8%;
}
</style>
vue.config.js
New file
@@ -0,0 +1,6 @@
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  publicPath: "/",
  productionSourceMap: false,
  transpileDependencies: true,
});
yarn.lock
New file
Diff too large