diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..6d9828e --- /dev/null +++ b/.env.development @@ -0,0 +1,9 @@ +ENV = 'development' + +# 接口地址 + +# 许镇-本地服地址 +VUE_APP_BASE_API = 'http://192.168.99.72:14000' + +# 是否启用 babel-plugin-dynamic-import-node插件 +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..2c6d712 --- /dev/null +++ b/.env.production @@ -0,0 +1,9 @@ +ENV = 'production' + +# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 +# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http +# VUE_APP_BASE_API = 'https://openapitest.aiyxlib.com' +VUE_APP_BASE_API = 'http://172.22.0.23:8080' +# VUE_APP_BASE_API = 'http://127.0.0.1:8080' +# 如果接口是 http 形式, wss 需要改为 ws +VUE_APP_WS_API = 'ws://192.168.99.107:7071' diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..187c448 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,197 @@ +module.exports = { + root: true, + parserOptions: { + parser: 'babel-eslint', + sourceType: 'module' + }, + env: { + browser: true, + node: true, + es6: true, + }, + extends: ['plugin:vue/recommended', 'eslint:recommended'], + + + rules: { + "vue/max-attributes-per-line": [2, { + "singleline": 10, + "multiline": { + "max": 1, + "allowFirstLine": false + } + }], + "vue/singleline-html-element-content-newline": "off", + "vue/multiline-html-element-content-newline":"off", + "vue/name-property-casing": ["error", "PascalCase"], + "vue/no-v-html": "off", + 'accessor-pairs': 2, + 'arrow-spacing': [2, { + 'before': true, + 'after': true + }], + 'block-spacing': [2, 'always'], + 'brace-style': [2, '1tbs', { + 'allowSingleLine': true + }], + 'camelcase': [0, { + 'properties': 'always' + }], + 'comma-dangle': [2, 'never'], + 'comma-spacing': [2, { + 'before': false, + 'after': true + }], + 'comma-style': [2, 'last'], + 'constructor-super': 2, + 'curly': [2, 'multi-line'], + 'dot-location': [2, 'property'], + 'eol-last': 2, + 'eqeqeq': ["error", "always", {"null": "ignore"}], + 'generator-star-spacing': [2, { + 'before': true, + 'after': true + }], + 'handle-callback-err': [2, '^(err|error)$'], + 'indent': [2, 2, { + 'SwitchCase': 1 + }], + 'jsx-quotes': [2, 'prefer-single'], + 'key-spacing': [2, { + 'beforeColon': false, + 'afterColon': true + }], + 'keyword-spacing': [2, { + 'before': true, + 'after': true + }], + 'new-cap': [2, { + 'newIsCap': true, + 'capIsNew': false + }], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-console': 'off', + 'no-class-assign': 2, + 'no-cond-assign': 2, + 'no-const-assign': 2, + 'no-control-regex': 0, + 'no-delete-var': 2, + 'no-dupe-args': 2, + 'no-dupe-class-members': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty-character-class': 2, + 'no-empty-pattern': 2, + 'no-eval': 2, + 'no-ex-assign': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-parens': [2, 'functions'], + 'no-fallthrough': 2, + 'no-floating-decimal': 2, + 'no-func-assign': 2, + 'no-implied-eval': 2, + 'no-inner-declarations': [2, 'functions'], + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': [2, { + 'allowLoop': false, + 'allowSwitch': false + }], + 'no-lone-blocks': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': [2, { + 'max': 1 + }], + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new-object': 2, + 'no-new-require': 2, + 'no-new-symbol': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + 'no-return-assign': [2, 'except-parens'], + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-shadow-restricted-names': 2, + 'no-spaced-func': 2, + 'no-sparse-arrays': 2, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-trailing-spaces': 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-unexpected-multiline': 2, + 'no-unmodified-loop-condition': 2, + 'no-unneeded-ternary': [2, { + 'defaultAssignment': false + }], + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'no-unused-vars': [2, { + 'vars': 'all', + 'args': 'none' + }], + 'no-useless-call': 2, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-escape': 0, + 'no-whitespace-before-property': 2, + 'no-with': 2, + 'one-var': [2, { + 'initialized': 'never' + }], + 'operator-linebreak': [2, 'after', { + 'overrides': { + '?': 'before', + ':': 'before' + } + }], + 'padded-blocks': [2, 'never'], + 'quotes': [2, 'single', { + 'avoidEscape': true, + 'allowTemplateLiterals': true + }], + 'semi': [2, 'never'], + 'semi-spacing': [2, { + 'before': false, + 'after': true + }], + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'never'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { + 'words': true, + 'nonwords': false + }], + 'spaced-comment': [2, 'always', { + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] + }], + 'template-curly-spacing': [2, 'never'], + 'use-isnan': 2, + 'valid-typeof': 2, + 'wrap-iife': [2, 'any'], + 'yield-star-spacing': [2, 'both'], + 'yoda': [2, 'never'], + 'prefer-const': 2, + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'object-curly-spacing': [2, 'always', { + objectsInObjects: false + }], + 'array-bracket-spacing': [2, 'never'] + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef4e647 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +.DS_Store +node_modules +dist/ + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +package-lock.json \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3959e1e --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +自助查询机 + +```bash +# install dependency +npm install + +# develop +npm run serve + +# 构建生产环境 +npm run build + +``` +```bash +## 项目结构 +├── src # 源代码 +│ ├── api # 所有请求 +│ ├── assets # 主题 字体等静态资源 +│ ├── router # 路由 +│ ├── views # views 所有页面 +│ │ ├── module +│ │ │ ├── bookDetails.vue # 书籍详情 +│ │ ├── activityDetail # 活动详情 +│ │ ├── activityFeed # 活动资讯list +│ │ ├── digitalResource # 数字资源 +│ │ ├── libraryIntroduction # 图书馆简介 +│ │ ├── newBookRecommend # 新书推荐 +│ ├── App.vue # 入口页面 +│ ├── main.js # 入口文件 加载组件 初始化等 注意:Vue.prototype.libcode使用 +├── .env.xxx # 环境变量配置 +├── .eslintrc.js # eslint 配置项 +├── .babelrc # babel-loader 配置 +├── .travis.yml # 自动化CI配置 +├── vue.config.js # vue-cli 配置 +├── postcss.config.js # postcss 配置 +└── package.json # package.json +``` \ No newline at end of file diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..e0c4c46 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,11 @@ +const plugins = ['@vue/babel-plugin-transform-vue-jsx', '@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-nullish-coalescing-operator'] +// 生产环境移除console +if (process.env.NODE_ENV === 'production') { + plugins.push('transform-remove-console') +} +module.exports = { + plugins: plugins, + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..92d0d01 --- /dev/null +++ b/package.json @@ -0,0 +1,56 @@ +{ + "name": "intelligence-inquiry-machine", + "version": "1.0.0", + "description": "自助查询机", + "scripts": { + "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", + "build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "@babel/core": "^7.19.0", + "@babel/preset-env": "^7.19.0", + "@jiaminghi/data-view": "^2.7.3", + "@types/echarts": "^4.4.3", + "axios": "^0.27.2", + "core-js": "^3.6.4", + "echarts": "^4.6.0", + "element-ui": "^2.15.9", + "swiper": "^8.4.2", + "vue": "^2.6.11", + "vue-awesome": "^4.0.2", + "vue-awesome-swiper": "^3.1.3", + "vue-router": "^3.1.5", + "vuex": "^3.1.2" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "^4.2.0", + "@vue/cli-plugin-eslint": "^4.2.0", + "@vue/cli-service": "^4.2.0", + "babel-eslint": "^10.0.3", + "babel-plugin-transform-remove-console": "^6.9.4", + "eslint": "^6.7.2", + "eslint-plugin-vue": "^6.1.2", + "sass": "^1.25.0", + "sass-loader": "^8.0.2", + "vue-template-compiler": "^2.6.11" + }, + "eslintConfig": { + "root": true, + "env": { + "node": true + }, + "extends": [ + "plugin:vue/essential", + "eslint:recommended" + ], + "parserOptions": { + "parser": "babel-eslint" + }, + "rules": {} + }, + "browserslist": [ + "> 1%", + "last 2 versions" + ] +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..7ee158c --- /dev/null +++ b/public/index.html @@ -0,0 +1,19 @@ + + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + +
+ + + diff --git a/public/static/config.js b/public/static/config.js new file mode 100644 index 0000000..c388cd4 --- /dev/null +++ b/public/static/config.js @@ -0,0 +1,4 @@ +window.g = { + AXIOS_TIMEOUT: 10000, + ApiUrl: 'http://192.168.3.5:8080' // 配置服务器地址 +} diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..f26dc75 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/api/inquiryMachine.js b/src/api/inquiryMachine.js new file mode 100644 index 0000000..742776b --- /dev/null +++ b/src/api/inquiryMachine.js @@ -0,0 +1,84 @@ +import request from '@/utils/request' +import qs from 'qs' + +// 查询机栏目管理详情 +export function FetchQueryTopicDetails(params) { + return request({ + url: '/api/queryMachine/getQueryMenuDetails', + method: 'get', + params: params + }) +} + +// 根据栏目id获取内容 +export function FetchInitQueryTopicContext(params) { + return request({ + url: '/api/queryMachine/initQueryTopicContext', + method: 'get', + params: params + }) +} + +// 新书推荐 +export function FetchNewBook(params) { + return request({ + url: '/api/screenSetting/getNewBook' + '?' + qs.stringify(params, { indices: false }), + method: 'get' + }) +} + +// 通过isbn获取图书详细信息 +export function FetchMarcByISBN(params) { + return request({ + url: '/api/screenSetting/marcByISBN' + '?' + qs.stringify(params, { indices: false }), + method: 'get' + }) +} + +// 数字资源 +export function initNumberResoures(params) { + return request({ + url: '/dxhtsg/initNumberResoures', + method: 'get', + params: params + }) +} + +// 新书推荐 +export function FetchNewBookRecommend(params) { + return request({ + url: '/dxhtsg/newBookRecommend', + method: 'get', + params: params + }) +} + +// 通过isbn获取图书封面 +export function FetchCoverByISBN(params) { + return request({ + url: '/dxhtsg/getCoverByISBN', + method: 'get', + params: params + // responseType: 'blob' + }) +} + +// 图书详情 +export function getBookDetailsByISBN(params) { + return request({ + url: '/api/bookBasice/getBookBasiceByISBN', + method: 'get', + params: params + }) +} + +export default { + FetchQueryTopicDetails, + FetchInitQueryTopicContext, + FetchNewBook, + FetchMarcByISBN, + FetchNewBookRecommend, + FetchCoverByISBN, + initNumberResoures, + getBookDetailsByISBN +} diff --git a/src/assets/404_images/404.png b/src/assets/404_images/404.png new file mode 100644 index 0000000..3d8e230 Binary files /dev/null and b/src/assets/404_images/404.png differ diff --git a/src/assets/404_images/404_cloud.png b/src/assets/404_images/404_cloud.png new file mode 100644 index 0000000..c6281d0 Binary files /dev/null and b/src/assets/404_images/404_cloud.png differ diff --git a/src/assets/fonts/HuXiaoBoNanShenTi.otf b/src/assets/fonts/HuXiaoBoNanShenTi.otf new file mode 100644 index 0000000..4cdf94c Binary files /dev/null and b/src/assets/fonts/HuXiaoBoNanShenTi.otf differ diff --git a/src/assets/fonts/YouSheBiaoTiHei.ttf b/src/assets/fonts/YouSheBiaoTiHei.ttf new file mode 100644 index 0000000..3729151 Binary files /dev/null and b/src/assets/fonts/YouSheBiaoTiHei.ttf differ diff --git a/src/assets/fonts/ZhenyanGB.ttf b/src/assets/fonts/ZhenyanGB.ttf new file mode 100644 index 0000000..207e103 Binary files /dev/null and b/src/assets/fonts/ZhenyanGB.ttf differ diff --git a/src/assets/fonts/fonts.css b/src/assets/fonts/fonts.css new file mode 100644 index 0000000..6d695c6 --- /dev/null +++ b/src/assets/fonts/fonts.css @@ -0,0 +1,19 @@ +@font-face { + font-family: "ZhenyanGB"; + src: url('ZhenyanGB.ttf'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "YouSheBiaoTiHei"; + src: url('YouSheBiaoTiHei.ttf'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: "HuXiaoBoNanShenTi"; + src: url('HuXiaoBoNanShenTi.otf'); + font-weight: normal; + font-style: normal; +} \ No newline at end of file diff --git a/src/assets/iconfont/iconfont.css b/src/assets/iconfont/iconfont.css new file mode 100644 index 0000000..cce3b8f --- /dev/null +++ b/src/assets/iconfont/iconfont.css @@ -0,0 +1,80 @@ +@font-face { + font-family: "iconfont"; /* Project id 3646564 */ + src: url('iconfont.woff2?t=1664428017869') format('woff2'), + url('iconfont.woff?t=1664428017869') format('woff'), + url('iconfont.ttf?t=1664428017869') format('truetype'), + url('iconfont.svg?t=1664428017869#iconfont') format('svg'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-weizhi:before { + content: "\e639"; +} + +.icon-youhua:before { + content: "\e635"; +} + +.icon-zuohua:before { + content: "\e638"; +} + +.icon-a-no21:before { + content: "\e636"; +} + +.icon-a-21:before { + content: "\e637"; +} + +.icon-jianpan:before { + content: "\e634"; +} + +.icon-guanbi:before { + content: "\e630"; +} + +.icon-zuo:before { + content: "\e631"; +} + +.icon-benjiatushu:before { + content: "\e632"; +} + +.icon-remen:before { + content: "\e633"; +} + +.icon-you:before { + content: "\e62f"; +} + +.icon-tongzhi:before { + content: "\e628"; +} + +.icon-a-no3:before { + content: "\e629"; +} + +.icon-a-no1:before { + content: "\e62b"; +} + +.icon-a-3:before { + content: "\e62d"; +} + +.icon-a-1:before { + content: "\e62e"; +} + diff --git a/src/assets/iconfont/iconfont.js b/src/assets/iconfont/iconfont.js new file mode 100644 index 0000000..2e7fbc4 --- /dev/null +++ b/src/assets/iconfont/iconfont.js @@ -0,0 +1 @@ +window._iconfont_svg_string_3646564='',function(t){var F=(F=document.getElementsByTagName("script"))[F.length-1],a=F.getAttribute("data-injectcss"),F=F.getAttribute("data-disable-injectsvg");if(!F){var l,p,h,i,c,d=function(F,a){a.parentNode.insertBefore(F,a)};if(a&&!t.__iconfont__svg__cssinject__){t.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(F){console&&console.log(F)}}l=function(){var F,a=document.createElement("div");a.innerHTML=t._iconfont_svg_string_3646564,(a=a.getElementsByTagName("svg")[0])&&(a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.width=0,a.style.height=0,a.style.overflow="hidden",a=a,(F=document.body).firstChild?d(a,F.firstChild):F.appendChild(a))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(p=function(){document.removeEventListener("DOMContentLoaded",p,!1),l()},document.addEventListener("DOMContentLoaded",p,!1)):document.attachEvent&&(h=l,i=t.document,c=!1,M(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,o())})}function o(){c||(c=!0,h())}function M(){try{i.documentElement.doScroll("left")}catch(F){return void setTimeout(M,50)}o()}}(window); \ No newline at end of file diff --git a/src/assets/iconfont/iconfont.json b/src/assets/iconfont/iconfont.json new file mode 100644 index 0000000..c0909b9 --- /dev/null +++ b/src/assets/iconfont/iconfont.json @@ -0,0 +1,121 @@ +{ + "id": "3646564", + "name": "东西湖图书馆", + "font_family": "iconfont", + "css_prefix_text": "icon-", + "description": "", + "glyphs": [ + { + "icon_id": "32102019", + "name": "位置", + "font_class": "weizhi", + "unicode": "e639", + "unicode_decimal": 58937 + }, + { + "icon_id": "31966175", + "name": "右滑", + "font_class": "youhua", + "unicode": "e635", + "unicode_decimal": 58933 + }, + { + "icon_id": "31966176", + "name": "左滑", + "font_class": "zuohua", + "unicode": "e638", + "unicode_decimal": 58936 + }, + { + "icon_id": "31879702", + "name": "no.2", + "font_class": "a-no21", + "unicode": "e636", + "unicode_decimal": 58934 + }, + { + "icon_id": "31879708", + "name": "2", + "font_class": "a-21", + "unicode": "e637", + "unicode_decimal": 58935 + }, + { + "icon_id": "31879044", + "name": "键盘", + "font_class": "jianpan", + "unicode": "e634", + "unicode_decimal": 58932 + }, + { + "icon_id": "31859389", + "name": "关闭", + "font_class": "guanbi", + "unicode": "e630", + "unicode_decimal": 58928 + }, + { + "icon_id": "31859390", + "name": "左", + "font_class": "zuo", + "unicode": "e631", + "unicode_decimal": 58929 + }, + { + "icon_id": "31859393", + "name": "本架图书", + "font_class": "benjiatushu", + "unicode": "e632", + "unicode_decimal": 58930 + }, + { + "icon_id": "31859394", + "name": "热门", + "font_class": "remen", + "unicode": "e633", + "unicode_decimal": 58931 + }, + { + "icon_id": "31859388", + "name": "右", + "font_class": "you", + "unicode": "e62f", + "unicode_decimal": 58927 + }, + { + "icon_id": "31804863", + "name": "通知", + "font_class": "tongzhi", + "unicode": "e628", + "unicode_decimal": 58920 + }, + { + "icon_id": "31804864", + "name": "no.3", + "font_class": "a-no3", + "unicode": "e629", + "unicode_decimal": 58921 + }, + { + "icon_id": "31804866", + "name": "no.1", + "font_class": "a-no1", + "unicode": "e62b", + "unicode_decimal": 58923 + }, + { + "icon_id": "31804868", + "name": "3", + "font_class": "a-3", + "unicode": "e62d", + "unicode_decimal": 58925 + }, + { + "icon_id": "31804869", + "name": "1", + "font_class": "a-1", + "unicode": "e62e", + "unicode_decimal": 58926 + } + ] +} diff --git a/src/assets/iconfont/iconfont.svg b/src/assets/iconfont/iconfont.svg new file mode 100644 index 0000000..572cb2d --- /dev/null +++ b/src/assets/iconfont/iconfont.svg @@ -0,0 +1,51 @@ + + + + Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/iconfont/iconfont.ttf b/src/assets/iconfont/iconfont.ttf new file mode 100644 index 0000000..74022f5 Binary files /dev/null and b/src/assets/iconfont/iconfont.ttf differ diff --git a/src/assets/iconfont/iconfont.woff b/src/assets/iconfont/iconfont.woff new file mode 100644 index 0000000..02d3965 Binary files /dev/null and b/src/assets/iconfont/iconfont.woff differ diff --git a/src/assets/iconfont/iconfont.woff2 b/src/assets/iconfont/iconfont.woff2 new file mode 100644 index 0000000..6c8d041 Binary files /dev/null and b/src/assets/iconfont/iconfont.woff2 differ diff --git a/src/assets/images/default-img.png b/src/assets/images/default-img.png new file mode 100644 index 0000000..8952025 Binary files /dev/null and b/src/assets/images/default-img.png differ diff --git a/src/assets/images/empty.png b/src/assets/images/empty.png new file mode 100644 index 0000000..be0ac8b Binary files /dev/null and b/src/assets/images/empty.png differ diff --git a/src/assets/images/index/320 180 down.png b/src/assets/images/index/320 180 down.png new file mode 100644 index 0000000..f436b23 Binary files /dev/null and b/src/assets/images/index/320 180 down.png differ diff --git a/src/assets/images/index/320 180 up.png b/src/assets/images/index/320 180 up.png new file mode 100644 index 0000000..2f80140 Binary files /dev/null and b/src/assets/images/index/320 180 up.png differ diff --git a/src/assets/images/index/400 620 left.png b/src/assets/images/index/400 620 left.png new file mode 100644 index 0000000..9e25608 Binary files /dev/null and b/src/assets/images/index/400 620 left.png differ diff --git a/src/assets/images/index/400 620 right.png b/src/assets/images/index/400 620 right.png new file mode 100644 index 0000000..68351c3 Binary files /dev/null and b/src/assets/images/index/400 620 right.png differ diff --git a/src/assets/images/index/760 180 down.png b/src/assets/images/index/760 180 down.png new file mode 100644 index 0000000..475efcb Binary files /dev/null and b/src/assets/images/index/760 180 down.png differ diff --git a/src/assets/images/index/760 180 up.png b/src/assets/images/index/760 180 up.png new file mode 100644 index 0000000..eb388f4 Binary files /dev/null and b/src/assets/images/index/760 180 up.png differ diff --git a/src/assets/images/index/activities.png b/src/assets/images/index/activities.png new file mode 100644 index 0000000..9d440ed Binary files /dev/null and b/src/assets/images/index/activities.png differ diff --git a/src/assets/images/index/bg.png b/src/assets/images/index/bg.png new file mode 100644 index 0000000..6fa4bd0 Binary files /dev/null and b/src/assets/images/index/bg.png differ diff --git a/src/assets/images/index/brief.png b/src/assets/images/index/brief.png new file mode 100644 index 0000000..3d942ba Binary files /dev/null and b/src/assets/images/index/brief.png differ diff --git a/src/assets/images/index/digital.png b/src/assets/images/index/digital.png new file mode 100644 index 0000000..be66dff Binary files /dev/null and b/src/assets/images/index/digital.png differ diff --git a/src/assets/images/index/guide.png b/src/assets/images/index/guide.png new file mode 100644 index 0000000..8699dda Binary files /dev/null and b/src/assets/images/index/guide.png differ diff --git a/src/assets/images/index/logo.png b/src/assets/images/index/logo.png new file mode 100644 index 0000000..8897e7e Binary files /dev/null and b/src/assets/images/index/logo.png differ diff --git a/src/assets/images/index/newbook.png b/src/assets/images/index/newbook.png new file mode 100644 index 0000000..41a671e Binary files /dev/null and b/src/assets/images/index/newbook.png differ diff --git a/src/assets/images/index/search.png b/src/assets/images/index/search.png new file mode 100644 index 0000000..3eea258 Binary files /dev/null and b/src/assets/images/index/search.png differ diff --git a/src/assets/images/index/title.png b/src/assets/images/index/title.png new file mode 100644 index 0000000..af5d270 Binary files /dev/null and b/src/assets/images/index/title.png differ diff --git a/src/assets/images/list-title.png b/src/assets/images/list-title.png new file mode 100644 index 0000000..0124410 Binary files /dev/null and b/src/assets/images/list-title.png differ diff --git a/src/assets/images/local-bg.png b/src/assets/images/local-bg.png new file mode 100644 index 0000000..a8c037f Binary files /dev/null and b/src/assets/images/local-bg.png differ diff --git a/src/assets/images/top.png b/src/assets/images/top.png new file mode 100644 index 0000000..7b4e011 Binary files /dev/null and b/src/assets/images/top.png differ diff --git a/src/assets/logo.png b/src/assets/logo.png new file mode 100644 index 0000000..f3d2503 Binary files /dev/null and b/src/assets/logo.png differ diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss new file mode 100644 index 0000000..5b4ba6f --- /dev/null +++ b/src/assets/styles/index.scss @@ -0,0 +1,87 @@ +#screen-container { + width: 100%; + height: 100vh; + padding: 0 0.175rem; + font-size: 0.25rem; + line-height: 0.35rem; + color: #fff; + background-color: #010326; + overflow: hidden; +} + +.content-main{ + display: flex; + justify-content: space-between; + height: 880px; + background: #F4F4F4; + overflow: hidden; +} + +.introduction-main { + padding: 30px 40px; + .nav-menu { + background: #ffffff; + width: 300px; + ul { + margin-top: 30px; + li { + height: 90px; + font-size: 30px; + font-family: Source Han Sans CN-Regular, Source Han Sans CN; + font-weight: 400; + line-height: 90px; + text-align: center; + margin-bottom: 20px; + &:hover { + background: #e4e4e4; + } + &.is-active { + background: linear-gradient( + 318deg, + #38b8d9 0%, + #5394f1 45%, + #a0a9ef 100% + ); + color: #ffffff; + } + } + } + } + .introduction-info { + margin-left: 30px; + background: #ffffff; + width: 1510px; + padding: 20px; + overflow-y: auto; + .info-title { + height: 100px; + text-align: center; + font-size: 38px; + font-family: Source Han Sans CN-Regular, Source Han Sans CN; + font-weight: 400; + color: #333333; + line-height: 100px; + } + .info-img { + background: url("~@/assets/images/top.png") no-repeat center -5px; + } + } +} +.activity-list li { + height: 90px; + margin: 0 40px; + border-bottom: 1px solid #d9d9d9; + font-size: 30px; + line-height: 90px; + padding: 0 20px; + span.date { + float: right; + } + .activity-title { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + width: calc(100% - 282px); + display: inline-block; + } +} \ No newline at end of file diff --git a/src/assets/styles/quillEditor.css b/src/assets/styles/quillEditor.css new file mode 100644 index 0000000..a7d82ac --- /dev/null +++ b/src/assets/styles/quillEditor.css @@ -0,0 +1,209 @@ +.ql-align-center{ + text-align: center; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; + font-family: "SimHei"; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; + font-family: "Microsoft YaHei"; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; + font-family: "KaiTi"; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before { + content: "仿宋"; + font-family: "FangSong"; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; + font-family: "Arial"; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; + font-family: "Times New Roman"; +} + +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before { + content: "sans-serif"; + font-family: "sans-serif"; +} + +.ql-font-SimSun { + font-family: "SimSun"; +} + +.ql-font-SimHei { + font-family: "SimHei"; +} + +.ql-font-Microsoft-YaHei { + font-family: "Microsoft YaHei"; +} + +.ql-font-KaiTi { + font-family: "KaiTi"; +} + +.ql-font-FangSong { + font-family: "FangSong"; +} + +.ql-font-Arial { + font-family: "Arial"; +} + +.ql-font-Times-New-Roman { + font-family: "Times New Roman"; +} + +.ql-font-sans-serif { + font-family: "sans-serif"; +} + +/* 字号设置 */ +/* 默认字号 */ +.ql-snow .ql-picker.ql-size .ql-picker-label::before, +.ql-snow .ql-picker.ql-size .ql-picker-item::before { + content: "12px"; +} + +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="12px"]::before{ + content: "12px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="14px"]::before{ + content: "14px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="16px"]::before{ + content: "16px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="18px"]::before{ + content: "18px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="20px"]::before{ + content: "20px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="22px"]::before{ + content: "22px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="26px"]::before{ + content: "26px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="28px"]::before{ + content: "28px"; + font-size: 14px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="30px"]::before{ + content: "30px"; + font-size: 14px; +} + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="12px"]::before { + content: "12px"; + font-size: 12px; +} + +.ql-size-12px { + font-size: 12px; +} + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="14px"]::before { + content: "14px"; + font-size: 14px; +} + +.ql-size-14px { + font-size: 14px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="16px"]::before { + content: "16px"; + font-size: 16px; +} + +.ql-size-16px { + font-size: 16px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="18px"]::before { + content: "18px"; + font-size: 18px; +} + +.ql-size-18px { + font-size: 18px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="20px"]::before { + content: "20px"; + font-size: 20px; +} + +.ql-size-20px { + font-size: 20px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="22px"]::before { + content: "22px"; + font-size: 22px; +} + +.ql-size-22px { + font-size: 22px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="26px"]::before { + content: "26px"; + font-size: 26px; +} + +.ql-size-26px { + font-size: 26px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="28px"]::before { + content: "28px"; + font-size: 28px; +} + +.ql-size-28px { + font-size: 28px; +} + + +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="30px"]::before { + content: "30px"; + font-size: 30px; +} + +.ql-size-30px { + font-size: 30px; +} diff --git a/src/assets/styles/style.scss b/src/assets/styles/style.scss new file mode 100644 index 0000000..c250254 --- /dev/null +++ b/src/assets/styles/style.scss @@ -0,0 +1,80 @@ +@import '~@/assets/iconfont/iconfont.css'; + +// 全局样式 +* { + margin: 0; + padding: 0; + list-style-type: none; + box-sizing: border-box; + outline: none; +} + +html { + margin: 0; + padding: 0; +} + +body { + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; + background-color: #f1f1f1; + margin: 0; + padding: 0; +} + +a { + color: #343440; + text-decoration: none; +} + +ul{ + margin: 0; + padding: 0; + li{ + list-style: none; + } +} + +.clearfix { + &::after { + content: ""; + display: table; + height: 0; + line-height: 0; + visibility: hidden; + clear: both; + } +} + +/**滚动条的宽度*/ +::-webkit-scrollbar { + width: 10px; + height: 10px; +} + +//滚动条的滑块 +::-webkit-scrollbar-thumb { + background-color: #44A9E4; + border-radius: 5px; +} + +.icon { + width: 1em; + height: 1em; + vertical-align: -0.15em; + fill: currentColor; + overflow: hidden; +} + +//浮动 +.float-r { + float: right; +} + +//文章一行显示,多余省略号显示 +.title-item { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/src/common/flexible.js b/src/common/flexible.js new file mode 100644 index 0000000..fdb9fa5 --- /dev/null +++ b/src/common/flexible.js @@ -0,0 +1,147 @@ +(function(win, lib) { + var doc = win.document + var docEl = doc.documentElement + var metaEl = doc.querySelector('meta[name="viewport"]') + var flexibleEl = doc.querySelector('meta[name="flexible"]') + var dpr = 0 + var scale = 0 + var tid + var flexible = lib.flexible || (lib.flexible = {}) + + if (metaEl) { + console.warn('将根据已有的meta标签来设置缩放比例') + var match = metaEl + .getAttribute('content') + // eslint-disable-next-line no-useless-escape + .match(/initial\-scale=([\d\.]+)/) + if (match) { + scale = parseFloat(match[1]) + dpr = parseInt(1 / scale) + } + } else if (flexibleEl) { + var content = flexibleEl.getAttribute('content') + if (content) { + // eslint-disable-next-line no-useless-escape + var initialDpr = content.match(/initial\-dpr=([\d\.]+)/) + // eslint-disable-next-line no-useless-escape + var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/) + if (initialDpr) { + dpr = parseFloat(initialDpr[1]) + scale = parseFloat((1 / dpr).toFixed(2)) + } + if (maximumDpr) { + dpr = parseFloat(maximumDpr[1]) + scale = parseFloat((1 / dpr).toFixed(2)) + } + } + } + + if (!dpr && !scale) { + // eslint-disable-next-line no-unused-vars + var isAndroid = win.navigator.appVersion.match(/android/gi) + var isIPhone = win.navigator.appVersion.match(/iphone/gi) + var devicePixelRatio = win.devicePixelRatio + if (isIPhone) { + // iOS下,对于2和3的屏,用2倍的方案,其余的用1倍方案 + if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) { + dpr = 3 + } else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)) { + dpr = 2 + } else { + dpr = 1 + } + } else { + // 其他设备下,仍旧使用1倍的方案 + dpr = 1 + } + scale = 1 / dpr + } + + docEl.setAttribute('data-dpr', dpr) + if (!metaEl) { + metaEl = doc.createElement('meta') + metaEl.setAttribute('name', 'viewport') + metaEl.setAttribute( + 'content', + 'initial-scale=' + + scale + + ', maximum-scale=' + + scale + + ', minimum-scale=' + + scale + + ', user-scalable=no' + ) + if (docEl.firstElementChild) { + docEl.firstElementChild.appendChild(metaEl) + } else { + var wrap = doc.createElement('div') + wrap.appendChild(metaEl) + doc.write(wrap.innerHTML) + } + } + + function refreshRem() { + var width = docEl.getBoundingClientRect().width + // 最小1366px,最大适配2560px + if (width / dpr < 1366) { + width = 1366 * dpr + } else if (width / dpr > 2560) { + width = 2560 * dpr + } + // 设置成24等份,设计稿时1920px的,这样1rem就是80px + var rem = width / 24 + docEl.style.fontSize = rem + 'px' + flexible.rem = win.rem = rem + } + + win.addEventListener( + 'resize', + function() { + clearTimeout(tid) + tid = setTimeout(refreshRem, 300) + }, + false + ) + win.addEventListener( + 'pageshow', + function(e) { + if (e.persisted) { + clearTimeout(tid) + tid = setTimeout(refreshRem, 300) + } + }, + false + ) + + if (doc.readyState === 'complete') { + doc.body.style.fontSize = 12 * dpr + 'px' + } else { + doc.addEventListener( + 'DOMContentLoaded', + // eslint-disable-next-line no-unused-vars + function(e) { + doc.body.style.fontSize = 12 * dpr + 'px' + }, + false + ) + } + + refreshRem() + + flexible.dpr = win.dpr = dpr + flexible.refreshRem = refreshRem + flexible.rem2px = function(d) { + var val = parseFloat(d) * this.rem + if (typeof d === 'string' && d.match(/rem$/)) { + val += 'px' + } + return val + } + flexible.px2rem = function(d) { + var val = parseFloat(d) / this.rem + if (typeof d === 'string' && d.match(/px$/)) { + val += 'rem' + } + return val + } +})(window, window['lib'] || (window['lib'] = {})) diff --git a/src/common/scrollMixins.js b/src/common/scrollMixins.js new file mode 100644 index 0000000..21500bc --- /dev/null +++ b/src/common/scrollMixins.js @@ -0,0 +1,61 @@ +export default { + data() { + return { + scrollDom: null, + interval: null, + scrollTimer: null, // 滚动定时器 + pauseTimer: null, // 暂停定时器 + timeout: null, + step: null + } + }, + created() { + }, + mounted() { + // this.dataCompleteFun() + }, + destroyed() { + // 清理定时器 + clearTimeout(this.pauseTimer) + this.pauseTimer = null + clearInterval(this.scrollTimer) + this.scrollTimer = null + // 清理点击监听 + window.document.removeEventListener('click', this.pauseScroll) + }, + methods: { + autoScroll() { + // 滚动长度为0 + if (this.scrollDom.scrollHeight - this.scrollDom.clientHeight > 0) { + // 如果定时器存在 + if (this.scrollTimer) { + // 则先清除 + clearInterval(this.scrollTimer) + clearTimeout(this.pauseTimer) + this.scrollTimer = null + this.pauseTimer = null + } + this.scrollTimer = setInterval(() => { + const scrollHeight = this.scrollDom.scrollHeight + const clientHeight = this.scrollDom.clientHeight + const scroll = scrollHeight - clientHeight + // 获取当前滚动条距离顶部高度 + const scrollTop = this.scrollDom.scrollTop + // 当滚动到底部时,间隔时间后重回顶部开始 + if (scrollTop + this.step >= scroll) { + this.scrollDom.scrollTop = scroll + this.pauseTimer = setTimeout(() => { + this.scrollDom.scrollTop = 0 + this.autoScroll() + }, this.timeout) + } else { // 没有则继续滚动 + this.scrollDom.scrollTop = scrollTop + this.step + } + // console.log(scrollHeight, clientHeight, scroll, scrollTop) + }, this.interval) + } else { + return + } + } + } +} diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..909dce4 --- /dev/null +++ b/src/main.js @@ -0,0 +1,41 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +// 适配flex +import '@/common/flexible.js' + +// 引入全局css +import './assets/styles/style.scss' +import './assets/iconfont/iconfont.js' +import './assets/fonts/fonts.css' +import './assets/styles/quillEditor.css' + +import ElementUI from 'element-ui' +import 'element-ui/lib/theme-chalk/index.css' +Vue.use(ElementUI) + +import axios from 'axios' +Vue.prototype.$axios = axios + +// 馆代码 1501 江夏图书馆 1201 东西湖图书馆 FTZN 本地 +// Vue.prototype.libcode = 'FTZN' +// Vue.prototype.libcode = '1501' + +import { parseTime } from '@/utils/index.js' +Vue.filter('parseTime', function(time, cFormat) { + return parseTime(time, cFormat) +}) + +// 引入echart +import echarts from 'echarts' +Vue.prototype.$echarts = echarts + +Vue.config.productionTip = false + +new Vue({ + router, + store, + render: (h) => h(App) +}).$mount('#app') diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 0000000..0ae6e62 --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,98 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' +import ColumnLayout from '@/views/columnLayout' +import ColumnListMix from '@/views/columnListMix' +import ColumnListMixDetail from '@/views/columnListMixDetail' + +Vue.use(VueRouter) + +const routes = [ + { + path: '/', + name: 'index', + component: () => import('@/views/index.vue'), + meta: { + title: '首页' + } + }, + { + path: '/NewBookRecommend', + name: 'NewBookRecommend', + component: () => import('@/views/newBookRecommend.vue'), + meta: { + title: '新书推荐' + } + }, + // { + // path: '/DigitalResource', + // name: 'DigitalResource', + // component: () => import('@/views/digitalResource.vue'), + // meta: { + // title: '数字资源' + // } + // }, + // { + // path: '/LibraryIntroduction', + // name: 'LibraryIntroduction', + // component: () => import('@/views/libraryIntroduction.vue'), + // meta: { + // title: '图书馆简介' + // } + // }, + // { + // path: '/ActivityFeed', + // name: 'ActivityFeed', + // component: () => import('@/views/activityFeed.vue'), + // meta: { + // title: '活动咨询' + // } + // }, + // { + // path: '/ActivityDetail', + // name: 'ActivityDetail', + // component: () => import('@/views/activityDetail.vue'), + // meta: { + // title: '活动详情' + // } + // }, + { + path: '/menu', + name: 'menu', + component: () => import('@/views/menu.vue') + }, + { + path: '/imgTxtDetail', + name: 'imgTxtDetail', + component: () => import('@/views/imgTxtDetail.vue') + }, + { + path: '/column', + name: 'ColumnLayout', + component: ColumnLayout, + redirect: '/column/list', + children: [ + { + path: 'list', + name: 'ColumnListMix', + component: ColumnListMix + }, + { + path: 'detail', + name: 'ColumnListMixDetail', + component: ColumnListMixDetail + } + ] + }, + { + path: '/waterfallFlow', + name: 'waterfallFlow', + component: () => import('@/views/waterfallFlow.vue') + } +] + +const router = new VueRouter({ + mode: 'hash', + routes +}) + +export default router diff --git a/src/store/column.js b/src/store/column.js new file mode 100644 index 0000000..8af6bf3 --- /dev/null +++ b/src/store/column.js @@ -0,0 +1,48 @@ + +// 初始状态 +const state = { + tabList: [], + libcode: '', + selectMenuIndex: 0 +} + +// mutations +const mutations = { + // 设置专栏数据 + setColumnData(state, payload) { + state.tabList = payload.tabList || [] + state.libcode = payload.libcode || '' + state.selectMenuIndex = payload.selectMenuIndex || 0 + }, + + // 更新选中的菜单索引 + setSelectMenuIndex(state, index) { + state.selectMenuIndex = index + } +} + +// actions +const actions = { + updateColumnData({ commit }, data) { + commit('setColumnData', data) + }, + + updateSelectIndex({ commit }, index) { + commit('setSelectMenuIndex', index) + } +} + +// getters +const getters = { + getTabList: state => state.tabList, + getLibcode: state => state.libcode, + getSelectIndex: state => state.selectMenuIndex +} + +export default { + namespaced: true, + state, + mutations, + actions, + getters +} diff --git a/src/store/index.js b/src/store/index.js new file mode 100644 index 0000000..38c8fb8 --- /dev/null +++ b/src/store/index.js @@ -0,0 +1,13 @@ +import Vue from 'vue' +import Vuex from 'vuex' +import column from './column' + +Vue.use(Vuex) + +// 创建并导出store实例 +export default new Vuex.Store({ + modules: { + column // 注册column模块 + } +}) + diff --git a/src/utils/index.js b/src/utils/index.js new file mode 100644 index 0000000..b203449 --- /dev/null +++ b/src/utils/index.js @@ -0,0 +1,92 @@ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function(...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} + +// 获取当前日期时间 +export function getCurrentTime() { + const yy = new Date().getFullYear() + const mm = new Date().getMonth() + 1 + const dd = new Date().getDate() + const hh = new Date().getHours() + const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes() + const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds() + const time = yy + '年' + mm + '月' + dd + '日 ' + hh + ':' + mf + ':' + ss + return time +} + +/** + * Parse the time to string + * @param {(Object|string|number)} time + * @param {string} cFormat + * @returns {string} + */ +export function parseTime(time, cFormat) { + if (arguments.length === 0) { + return null + } + const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'undefined' || time === null || time === 'null') { + return '' + } else if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} diff --git a/src/utils/request.js b/src/utils/request.js new file mode 100644 index 0000000..566c75b --- /dev/null +++ b/src/utils/request.js @@ -0,0 +1,55 @@ +import axios from 'axios' +import { Message } from 'element-ui' + +// 创建axios实例 +const service = axios.create({ + // baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', // api 的 base_url + baseURL: process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API, // api 的 base_url + timeout: 1000 * 30, // 请求超时时间 + headers: { + 'Content-Type': 'application/json' + } +}) + +// request拦截器 +service.interceptors.request.use( + config => { + // if (getToken()) { + // config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + // } + const token = '' + config.headers['Authorization'] = token || '' + return config + }, + error => { + console.error('error: ', error) + Promise.reject(error) + } +) + +// response 拦截器 +service.interceptors.response.use( + response => { + const errorMsg = response.data.errMsg + if (response.status === 200) { + // console.log(response.data.data) + if (response.data instanceof Blob) { + return response.data + } else if (response.data.data) { + return response.data.data + } else { + return response.data + } + } else { + Message.error({ + message: errorMsg, + duration: 5000 + }) + Promise.reject() + } + }, + error => { + return Promise.reject(error) + } +) +export default service diff --git a/src/utils/resizeMixins.js b/src/utils/resizeMixins.js new file mode 100644 index 0000000..dbdffd8 --- /dev/null +++ b/src/utils/resizeMixins.js @@ -0,0 +1,26 @@ +// 混入代码 resize-mixins.js +import { debounce } from '@/utils/index' +const resizeChartMethod = '$__resizeChartMethod' + +export default { + data() { + // 在组件内部将图表init的引用映射到chart属性上 + return { + chart: null + } + }, + created() { + window.addEventListener('resize', this[resizeChartMethod], false) + }, + beforeDestroy() { + window.removeEventListener('reisze', this[resizeChartMethod]) + }, + methods: { + // 通过lodash的防抖函数来控制resize的频率 + [resizeChartMethod]: debounce(function() { + if (this.chart) { + this.chart.resize() + } + }, 100) + } +} diff --git a/src/views/columnLayout.vue b/src/views/columnLayout.vue new file mode 100644 index 0000000..aa7d779 --- /dev/null +++ b/src/views/columnLayout.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/src/views/columnListMix.vue b/src/views/columnListMix.vue new file mode 100644 index 0000000..e784cc2 --- /dev/null +++ b/src/views/columnListMix.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/src/views/columnListMixDetail.vue b/src/views/columnListMixDetail.vue new file mode 100644 index 0000000..92c7b08 --- /dev/null +++ b/src/views/columnListMixDetail.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/views/imgTxtDetail.vue b/src/views/imgTxtDetail.vue new file mode 100644 index 0000000..2d3a3a1 --- /dev/null +++ b/src/views/imgTxtDetail.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/views/index.vue b/src/views/index.vue new file mode 100644 index 0000000..ebf3b94 --- /dev/null +++ b/src/views/index.vue @@ -0,0 +1,293 @@ + + + + + diff --git a/src/views/menu.vue b/src/views/menu.vue new file mode 100644 index 0000000..c0711fe --- /dev/null +++ b/src/views/menu.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/src/views/module/bookDetails.vue b/src/views/module/bookDetails.vue new file mode 100644 index 0000000..5eae022 --- /dev/null +++ b/src/views/module/bookDetails.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/src/views/module/waterfall.vue b/src/views/module/waterfall.vue new file mode 100644 index 0000000..38fa6a5 --- /dev/null +++ b/src/views/module/waterfall.vue @@ -0,0 +1,434 @@ + + + + + diff --git a/src/views/newBookRecommend.vue b/src/views/newBookRecommend.vue new file mode 100644 index 0000000..2d7176c --- /dev/null +++ b/src/views/newBookRecommend.vue @@ -0,0 +1,282 @@ + + + + + diff --git a/src/views/old.vue b/src/views/old.vue new file mode 100644 index 0000000..e5d186a --- /dev/null +++ b/src/views/old.vue @@ -0,0 +1,158 @@ + + + + + diff --git a/src/views/waterfallFlow.vue b/src/views/waterfallFlow.vue new file mode 100644 index 0000000..19998e2 --- /dev/null +++ b/src/views/waterfallFlow.vue @@ -0,0 +1,342 @@ + + + + + diff --git a/src/views/waterfallFlow2.vue b/src/views/waterfallFlow2.vue new file mode 100644 index 0000000..36627b3 --- /dev/null +++ b/src/views/waterfallFlow2.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..b802abd --- /dev/null +++ b/vue.config.js @@ -0,0 +1,61 @@ +const path = require('path') +const resolve = dir => { + return path.join(__dirname, dir) +} +const name = '自助查询机' +module.exports = { + publicPath: process.env.NODE_ENV === 'development' ? '/' : './', + outputDir: 'dist', + assetsDir: 'static', + lintOnSave: process.env.NODE_ENV === 'development', + productionSourceMap: false, + devServer: { + port: 3000, + open: true, + overlay: { + warnings: false, + errors: true + }, + proxy: { + '/api': { + target: process.env.VUE_APP_BASE_API, + changeOrigin: true, + pathRewrite: { + '^/api': 'api' + } + }, + '/auth': { + target: process.env.VUE_APP_BASE_API, + changeOrigin: true, + pathRewrite: { + '^/auth': 'auth' + } + } + } + }, + configureWebpack: { + name: name, + resolve: { + alias: { + '@': resolve('src') + } + }, + performance: { + hints: 'warning', + // 入口起点的最大体积 + maxEntrypointSize: 50000000, + // 生成文件的最大体积 + maxAssetSize: 30000000 + } + }, + chainWebpack: config => { + config.resolve + .alias.set('_c', resolve('src/components')) + + config.plugin('html') + .tap(args => { + args[0].title = name + return args + }) + } +}