提交 cd22c5b5 编写于 作者: 张磊's avatar 张磊

ex echart

上级 b3e11529
{
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
}
}
Android >= 4.0
iOS >= 7
\ No newline at end of file
# comment
deploy
node_modules
public
# https://editorconfig.org
root = true
[*]
charset = utf-8 #字符集utf-8
indent_style = space #缩进风格:空格
indent_size = 2 #缩进大小2
end_of_line = lf #换行符lf
insert_final_newline = true #结尾总是插入新的一行
trim_trailing_whitespace = true #行尾允许空格
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
\ No newline at end of file
NODE_ENV=dev
# baseUrl
BASE_URL=/learning-report/
# 路由 base
VUE_APP_BASE_ROUTE_URL=/learning-report
# 默认路由地址
VUE_APP_BASE_ROUTE=/
# 阿里云OSS对象存储地址
VUE_APP_OSS_URL=https://pica-h5-dev.yunqueyi.com/
# 模拟用户信息,如果有则发送模拟用户信息,只针对开发模式
# VUE_APP_MOCK_USER_INFO=eyJhdmF0YXIiOm51bGwsIm1vYmlsZSI6IjE4MTE3MDIzOTE2Iiwibmlja05hbWUiOiIxODEqKioqMzkxNiIsImlkZW50aWZ5U3RhdHVzIjpudWxsLCJ1c2VySWQiOiI2OTIzMDczNDM1ODQ2NjE1MDQiLCJsb2dpbkNoYW5uZWwiOiJtYW5pdWprLWNoYW5uZWwtY29uc3VtZXItYXBwIn0=
# 是否加密
VUE_APP_ENCRYPT=
# 是否开启 vConsole
VUE_APP_CONSOLE=true
# appid
VUE_APP_APPID=ab5cb3c1fd834ca1892cd7b3c6e57717
#生成骨架屏扫描地址(可选择本地)
VUE_APP_SKELETON='http://localhost:8083'
NUXT_ENV_APP=dev
NODE_ENV=production
# 自定义 VUE_APP_ENV
VUE_APP_ENV ='development'
VUE_APP_SERVICE_URL=https://dev-sc.yunqueyi.com
# 阿里云OSS对象存储地址
VUE_APP_OSS_URL=https://pica-h5-dev.yunqueyi.com/
# 模拟用户信息,如果有则发送模拟用户信息,只针对开发模式
VUE_APP_MOCK_USER_INFO=
# 是否加密
VUE_APP_ENCRYPT=
# 是否开启vConsole
VUE_APP_CONSOLE=true
# 是否开启打印 console.log
VUE_APP_HAS_CONSOLE=true
#OSS上传Bucket_Name
VUE_APP_BUCKET_NAME='pica-app-dev'
# appid
VUE_APP_APPID=wxf4e66242d31c81c2
NODE_ENV=dev
VUE_APP_ENV=development
VUE_APP_SERVICE_URL=https://dev-sc.yunqueyi.com
NUXT_ENV_APP=dev
# 模拟用户信息
VUE_APP_MOCK_USER_INFO=eyJhdmF0YXIiOm51bGwsIm1vYmlsZSI6IjE4MTE3MDIzOTE2Iiwibmlja05hbWUiOiIxODEqKioqMzkxNiIsImlkZW50aWZ5U3RhdHVzIjpudWxsLCJ1c2VySWQiOiI2OTIzMDczNDM1ODQ2NjE1MDQiLCJsb2dpbkNoYW5uZWwiOiJtYW5pdWprLWNoYW5uZWwtY29uc3VtZXItYXBwIn0=
VUE_APP_ENCRYPT=
VUE_APP_CONSOLE=true
# 本地开发环境
VUE_APP_IS_LOCAL=true
# appid
VUE_APP_APPID=wxf4e66242d31c81c2
# 本地token
VUE_APP_TOKEN=42789F2675384BFAB05EA57BDBED0E73
# mock的基础地址
VUE_APP_BASE_MOCK_URL=http://192.168.120.69:40001/mock/
# mock的工作空间地址
VUE_APP_MOCK_URL=12/
NODE_ENV=production
# 自定义 VUE_APP_ENV
VUE_APP_ENV ='production'
VUE_APP_SERVICE_URL=https://sc.yunqueyi.com
# 阿里云OSS对象存储地址
VUE_APP_OSS_URL=https://pica-h5.yunqueyi.com/
# 模拟用户信息,如果有则发送模拟用户信息,只针对开发模式
VUE_APP_MOCK_USER_INFO=
# 是否加密
VUE_APP_ENCRYPT=false
# 是否开启 vConsole
VUE_APP_CONSOLE=
# appid
VUE_APP_APPID=wx2c577552a2d28550
# app渠道
VUE_APP_CHANNEL=prod
# OSS 上传 Bucket_Name
VUE_APP_BUCKET_NAME='pica-app-prod'
#arms日志监控脚本
VUE_APP_ARMS=''
NODE_ENV=production
# 自定义 VUE_APP_ENV
VUE_APP_ENV ='testing'
VUE_APP_SERVICE_URL=https://test1-sc.yunqueyi.com
# 阿里云OSS对象存储地址
VUE_APP_OSS_URL=https://pica-h5-test.yunqueyi.com/
# 模拟用户信息,如果有则发送模拟用户信息,只针对开发模式
VUE_APP_MOCK_USER_INFO=
# 是否加密
VUE_APP_ENCRYPT=false
# 是否开启 vConsole
VUE_APP_CONSOLE=true
# 是否开启打印 console.log
VUE_APP_HAS_CONSOLE=true
# appid
VUE_APP_APPID=wxcaad75b7fff5659c
# APP 渠道
VUE_APP_CHANNEL=_test
# OSS上传Bucket_Name
VUE_APP_BUCKET_NAME='pica-app-test'
NODE_ENV=production
# 自定义 VUE_APP_ENV
VUE_APP_ENV ='uat'
VUE_APP_SERVICE_URL=https://uat-sc.yunqueyi.com
# 阿里云OSS对象存储地址
VUE_APP_OSS_URL=https://pica-h5-uat.yunqueyi.com/
# 模拟用户信息,如果有则发送模拟用户信息,只针对开发模式
VUE_APP_MOCK_USER_INFO=
# 是否加密
VUE_APP_ENCRYPT=false
# 是否开启vConsole
VUE_APP_CONSOLE=
# appid
VUE_APP_APPID=wx342ef0e5afee54a7
# OSS 上传 Bucket_Name
VUE_APP_BUCKET_NAME='pica-app-uat'
/h5-submodules-master
/node_modules
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true,
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// 全局变量
globals: {
'gdp': true,
},
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
'no-console': 0,
'no-debugger':0,
'comma-spacing': [2, { // 控制逗号前面没有空格,后面必须有空格
'before': false,
'after': true
}],
'arrow-spacing': [2, { // 要求箭头函数前后有空格
'before': true,
'after': true
}],
'no-multi-spaces': 2,// 禁止使用多个空格,
'no-spaced-func': 2,// 禁止 function 标识符和括号之间出现空格,this.getList () 报错
'semi-spacing': [2, {// 强制分号之前不允许有空格
'before': false,
'after': true
}],
'space-infix-ops': 2,// 要求操作符前后必须有空格: 2 + 3 2 === 2 3 > 2
'spaced-comment': [2, 'always'], // 强制在注释中 // 或 /* 使用一致的空格
'array-bracket-spacing': [2, 'never'],// 指定数组的元素之间要以空格隔开(, 后面), never参数:[ 之后和 ] 之前不能带空格,always参数:[ 之后和 ] 之前必须带空格
"space-before-blocks": 2, // if/function等的大括号之前需要有空格
'no-undef-init': 2,// 禁止将变量初始化为 undefined,保存时会将let a = undefined变成let a
'semi': [2, 'always'],//强制结尾必须有分号;
'prefer-const': 2,// 要求使用 const 声明那些声明后不再被修改的变量
'quotes': [2, 'single'],//js中强制使用单引号
'no-multiple-empty-lines': [2, {// 不允许多个空行,最多一行
'max': 1
}],
'vue/order-in-components': ['error', {
'order': [
'el',
'name',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
'inheritAttrs',
'model',
['props', 'propsData'],
'data',
'computed',
'watch',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError'
]
}],
'vue/attributes-order': ['error', {
'order': [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT'
]
}],
}
}
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
.DS_Store
node_modules
/dist
.history/
# local env files
update_*.sh
package-lock.json
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
# Editor directories and files
.idea
.editorconfig
# Service worker
sw.*
# Mac OSX
.DS_Store
\ No newline at end of file
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.proxy.js
.version
log/
logs/
# .pica.prompts.js
log
logs
.version
module.exports = {
'autoRouter': false,
'registry': "http://192.168.110.93:4873/",
'type': "h5",
'projectName': "learning-report",
'autoConfig': true,
'transition': false,
'useHistoryRouter': true,
'rewriteHtml': false,
'renderToBranch': false,
'srcAlias': "mn-template",
};
FROM nginx
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\
echo "Asia/shanghai" > /etc/timezone
COPY error.html /usr/share/nginx/html/error.html
COPY nginx.conf /etc/nginx/nginx.conf
COPY dist/ /usr/vue/learning-report/dist/
RUN chmod -R +rw /usr/share/nginx/html/error.html &&\
chown -R nginx:nginx /usr/share/nginx/html/error.html &&\
chmod -R +rw /usr/vue/learning-report/dist/ &&\
chown -R nginx:nginx /usr/vue/learning-report/dist/
# nuxt-ssr
# learning-report
> 请先查看每个目录的 md 文件
> nuxt ssr layout
## 启动
```shell script
npm run start
```
## Build Setup
## 编译打包
```shell script
#开发环境
npm run build:dev
#预发环境
npm run build:pre
#生产环境
npm run build:prod
#测试环境
npm run build:test
```
``` bash
# install dependencies
$ npm run install
## 插件配置
```js
module.exports = {
// 插件配置项
pluginOptions: {
// 蛮牛配置
pica: {
// CDN扩展JS资源排序: ['lodash', 'vue', 'vuex']
jsSort: [],
// CDN扩展CSS资源排序: ['vant.css']
cssSort: [],
// 骨架屏渲染的路由(手动配置)
skeletonRoutes: [
{
path: '/demo',
name: 'Demo',
meta: {
skeleton: true
}
},
],
// 启用自动配置骨架屏渲染路由
enableAutoSkeletonRoutes: false,
// 路由模式
routeMode: 'history',
// 骨架屏一次渲染几个路由
dpsLimit: 5,
// dps骨架屏渲染本地服务配置
dpsServer: {}
},
// 图片压缩
tinypng: {
key: ''
},
// 自动路由配置
autoRouting: {
chunkNamePrefix: 'page-'
}
}
};
# serve with hot reload at localhost:3000
$ npm run dev
```
# build for production and launch server
# 有环境变量 非本地打包请自行带上ENV => dev, test, uat, prod
$ ENV=上一行的变量 npm run build // eg: ENV=dev npm run build
$ npm run start // 对于 start 命令,可以根据需求自行 更改PORT (有部署冲突的时候会改)
## dpsServer
### port
服务监听端口,默认从8000开始查找可用端口
# generate static project // 暂时用不到
$ npm run generate
```
\ No newline at end of file
### proxy
反向代理中间件配置 @See [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware)
如果需要自定义返回:
```js
{
proxy: {
'^/app-gateway': (req, res, next) => {
res.json({ code: 200, data: {} });
res.end();
}
}
}
```
## 图片压缩
> 需要在`vue.config.js`中配置`pluginOptions.tinypng.key`的值。
```shell script
npm run tinypng
```
## 调用生成器
```shell script
vue invoke pica
```
## 根据 pica.prompts 生成封闭式模板
```shell script
npm run core
```
## 使用骨架屏
> 框架默认已开启骨架屏渲染。请查看`vue.config.js`
### 自动根据路由配置
需要在路由页面文件配置`route`
```json
{
"meta": {
"skeleton": true
}
}
```
如需自定义骨架
```json
{
"meta": {
"skeleton": {
"name": "必须和路由定义的name一致",
"path": "匹配当前路由的正则",
"pathname": "访问路由的path地址,例如: /mn/demo",
"skeletonId": "骨架屏路由ID,唯一即可"
}
}
}
```
## Jenkinsfile 构建
在 Jenkinsfile 文件中 `versionType = 'Patch';`,versionType 默认为 Patch,为小版本更新,1.2.3 对应 Major.Minor.Patch。
```bash
npm run build:test versionType:Patch
```
## 后台API接口反向代理
### 本地
如果`VUE_APP_MOCK_USER_INFO`不为空则走代理到本地。并且会在接口地址前加上`/proxy`.
默认会把`/proxy`的接口代理到`http://localhost:8081。
如需修改,请查看项目根目录的`.proxy.js`文件
### 走网关
如果`VUE_APP_MOCK_USER_INFO`为空则走代理到网关。并且会在接口地址前加上`/proxy/app-gateway`.
会把`/proxy`的接口代理到`VUE_APP_SERVICE_URL`环境变量,如该变量为空则默认为``
const path = require('path');
function resolve (dir) {
return path.join(__dirname, dir);
}
module.exports = {
resolve: {
alias: {
'@': resolve('src'),
'mn-template': resolve('node_modules/@pica-cli/vue-cli-plugin-pica-cli-plugin/core/src')
}
}
};
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
plugins: [
'@babel/plugin-proposal-object-rest-spread'
]
};
<!-- 提示信息:报表专用 -->
<template>
<div class="tips-info-wrapper">
<span>{{content}}</span>
</div>
</template>
<script>
export default {
props: {
content: {
type: String,
default: '报表数据来源包括用户参加正式考试,不包含摸底考试'
}
}
}
</script>
<style lang="less" scoped>
.tips-info-wrapper {
height: 44px;
line-height: 44px;
font-size: 20px;
padding: 0 15px;
text-align: center;
span {
display: inline-block;
width: 100%;
font-size: 13px;
font-weight: 400;
color: #676869;
}
}
</style>
\ No newline at end of file
<!-- 提示信息 -->
<template>
<div class="tips-info-wrapper">
<span>{{content}}</span>
</div>
</template>
<script>
export default {
props: {
content: {
type: String,
default: '报表数据来源包括用户参加正式考试,不包含摸底考试'
}
}
}
</script>
<style lang="less" scoped>
.tips-info-wrapper {
height: 44px;
line-height: 44px;
font-size: 20px;
padding: 0 15px;
span {
display: inline-block;
width: 100%;
font-size: 13px;
font-weight: 400;
color: #676869;
border-bottom: 1px solid #F0F1F2;
}
}
</style>
\ No newline at end of file
<!-- Tabs组件 -->
<template>
<div class="common-tabs-wrapper" :class="{'fixed': needFixed}">
<div class="sub-wrapper" :class="{'fixed': needFixed}">
<ul class="common-tabs" id="tabsWrapperId">
<li :id="'tabsItem' + index"
v-show="(item === '总体概况'
|| item === '人群分析'
|| item === '课程分析' && projectInfo.existCourse === 1)
|| (item === '考试分析' && projectInfo.existExam === 1)
|| (item === '学习效果分析' && projectInfo.existEffect === 1)"
v-for="(item, index) in tapList"
:class="{'active': index === cIndex}"
:key="index"
@click="clickTab(index)"
>{{item}}</li>
</ul>
<span class="over"></span>
<span class="border"></span>
</div>
</div>
</template>
<script>
export default {
data() {
return {
cIndex: 0,
tapList: [
"总体概况",
"人群分析",
"课程分析",
"考试分析",
"学习效果分析"
]
};
},
props: {
projectInfo: {
type: Object
},
needFixed: {
type: Boolean,
default: false
}
},
mounted() {},
methods: {
clickTab(index) {
this.cIndex = index;
this.$emit("tabClicked", index);
let tabsItemId = 'tabsItem' + index;
}
}
};
</script>
<style lang="less" scoped>
.common-tabs-wrapper {
.sub-wrapper {
display: flex;
position: relative;
width: 100%;
top: 0;
left: 0;
z-index: 1;
font-size: 13px;
width: 100%;
white-space: nowrap;
&.fixed {
position: fixed;
top: 70px;
width: 100%;
z-index: 1000000000;
background: #fff;
white-space: nowrap;
overflow-x: auto;
}
}
display: flex;
position: relative;
width: 100%;
top: 0;
left: 0;
z-index: 1000000000;
font-size: 13px;
.common-tabs {
width: 100%;
white-space: nowrap;
overflow-x: auto;
padding: 9px 0;
font-size: 13px;
// padding: 5px 0;
li {
display: inline-block;
height: 30px;
line-height: 30px;
font-size: 13px;
font-weight: 700;
margin: 0 6px;
color: #979899;
background: #f0f1f2;
padding: 0 12px;
border-radius: 30px;
&:first-child {
margin-left: 15px;
}
&:last-child {
margin-right: 15px;
}
&.active {
color: #449284;
background: #e3efed;
}
}
margin-top: 0;
}
.over {
display: block;
position: absolute;
bottom: 0px;
left: 0;
width: 100%;
height: 9px;
z-index: 10000000;
background: #fff;
}
.border {
display: block;
width: 100%;
height: 1px;
bottom: 0px;
left: 0;
border-bottom: 1px solid #f0f1f2;
position: absolute;
z-index: 10000000;
}
}
</style>
此差异已折叠。
let dpsConfig = require('@pica-core/dps-config');
const externalsDpsConfig = {};
dpsConfig = {
...dpsConfig,
...externalsDpsConfig
};
module.exports = dpsConfig;
module.exports = [
/* {
name: 'payOrder',
url: 'payOrder'
}*/
];
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Error</title>
</head>
<body>
An error occurred on the server when processing the URL. Please contact the system administrator!
</body>
</html>
{"eb52be7e66c51a0984c4071656521581":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/arr-down-gray.png","d6d3c14b51ff6236db89d1a63b99e097":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/arr-down-white.png","cf1d8782d409a91bd21c1ca3d1033df8":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/arr-down.png","26006d17c4f0a1f7175db864fb29a884":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/arr-selected.png","514fb2bb937b9bef5160c1ed8f485a6a":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/arr-up.png","b81fd33e3bbbea474755d4e4eaf86c37":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/kf.png","9cbb287ec70ff079eedaa81b9afa5df1":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/left-array-black.png","86384dec95e51dce91ee681d2560f37b":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/left-arrow-black.png","1cedfe0e695b56a714919102ca2407c2":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/map-icon.png","7f50214c6a8d4452cf0d6d852fe3330f":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/no-content.png","c7395bde31d5fa141771aab25dce2e2c":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/org.png","9cb816774aac05197cab83f037012ad4":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/pub-time.png","4e865f4817ba4a0454d81095e689f86f":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/rank-1.png","fb0762ecc1e19e3ceb111178279ec626":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/rank-2.png","ea862d99ba6b214b086466a7fb8c77db":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/rank-3.png","4a96286e5b4bcdd65f31d2b36dbe9567":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/right-arrow-grey.png","26607cd1e8dc09440c5b14b432641b34":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/sort-select-icon.png","79ce3fe37ce625360ee9a6079f7f209c":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/tips-1.png","d65cd3a583f87a4774fde8e7a79e166a":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/tips-2.png","992acc8f370f9c252116feb06391a198":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/tips-3.png","db55b2e8292837771d9fd85cb0a66c36":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/what-content-1.png","94e55f41716cb13bda15884125000f8f":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/what-content-2.png","49a6ab331d5c7e8288d54aed12ccb51e":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/what-icon-1.png","6f2938a39189562e337e1d8d4260382b":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/what-icon-2.png","313e7ec48a9413b3c9143c6b1b2d022f":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/what-icon-title.png","0f452ea29b01b0f3d758462882c9f298":"/Users/evan/Desktop/pica/pica-learning-report/src/assets/images/what.png"}
\ No newline at end of file
module.exports = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^~/(.*)$': '<rootDir>/$1',
'^vue$': 'vue/dist/vue.common.js'
},
moduleFileExtensions: ['js', 'vue', 'json'],
transform: {
'^.+\\.js$': 'babel-jest',
'.*\\.(vue)$': 'vue-jest'
},
'collectCoverage': true,
'collectCoverageFrom': [
'<rootDir>/components/**/*.vue',
'<rootDir>/pages/**/*.vue'
]
}
<template>
<div>
<nuxt />
</div>
</template>
<style>
</style>
worker_processes auto;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#隐藏版本号
server_tokens off;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
client_max_body_size 20m;
server {
listen 80;
server_name_in_redirect off;
server_name *.picahealth.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/vue/learning-report/dist/;
# if (-d $request_filename) {
# rewrite ^/(.*)([^/])$ https://$host/learning-report/$1$2/ permanent;
# }
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 404 405 500 502 503 504 /error.html;
location = /error.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
const path = require('path');
const axios = require('axios')
const axios = require('axios');
const fs = require('fs');
const projectName=require('./package.json').name
const projectName = require('./package.json').name;
const filePath = path.join(__dirname, 'src');
// 先删除文件
function deleOldJson(){
function deleOldJson() {
const json_path = path.join(__dirname, 'src/menu_code.json');
try{
fs.unlinkSync(json_path);
}catch(err){
console.log("没有json 文件")
}catch(err) {
console.log('没有json 文件');
}
};
deleOldJson()
}
deleOldJson();
// 文件夹是不是存在
function isFileExisted(filePath) {
return new Promise((resolve, reject) => {
......@@ -23,39 +22,40 @@ function isFileExisted(filePath) {
return reject(false);
} else {
return resolve(true);
}
}
});
});
}
// 请求接口获取menucode
function getMenuCode() {
let url="https://sc.yunqueyi.com/basic-data/menuCode/fetch";
//let url="https://dev-sc.yunqueyi.com/basic-data/menuCode/fetch";
axios.get(url, {params:{"projectName":projectName}})
const url = 'https://sc.yunqueyi.com/basic-data/menuCode/fetch';
// let url="https://dev-sc.yunqueyi.com/basic-data/menuCode/fetch";
console.log(projectName);
axios.get(url, {params:{'projectName':projectName}})
.then(res => {
let resData=res.data;
if(resData.code=="000000"){
if(!resData.data){
console.log("接口data 数据为空");
return
const resData = res.data;
if(resData.code == '000000') {
if(!resData.data) {
console.log('接口data 数据为空');
return;
}
console.log(resData.data.menuCodeDtoList);
return writerJsonFile(JSON.stringify(resData.data.menuCodeDtoList));
}else{
console.log("获取接口失败");
console.log('获取接口失败');
}
}).catch(error => {
console.error('请求menu接口失败error',error);
console.error('请求menu接口失败error', error);
});
}
// 写入json 文件
function writerJsonFile(data) {
const wpath = filePath + '/menu_code.json';
fs.writeFileSync(wpath, data);
console.log("写入文件成功");
console.log('写入文件成功');
}
// 创建目录
function createFiles(filePath) {
return new Promise((resolve, reject) => {
fs.mkdir(filePath, function(err) {
if(!err) {
getMenuCode();
......@@ -63,12 +63,10 @@ function createFiles(filePath) {
console.log('创建目录失败');
}
});
});
}
isFileExisted(filePath).then(res => {
isFileExisted(filePath).then(() => {
return getMenuCode();
}).catch(err => {
}).catch(() => {
// 没有文件创建文件
createFiles(filePath);
});
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: '云鹊医-学情报告',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui' },
{ name: 'screen-orientation', content: 'portrait' },
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
{ name: 'format-detection', content: 'telephone=no' },
{ name: 'full-screen', content: 'yes' },
{ name: 'x5-fullscreen', content: 'true' },
{ name: 'x5-fullscreen', content: 'true' },
{ name: 'referrer', content: 'never' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
// { rel: 'stylesheet', href: '/css/common.css' }
],
style: [
{ cssText: `
@charset "utf-8";html{color:#000;background:#fff;overflow-y:scroll;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}html *{outline:0;-webkit-text-size-adjust:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}html,body{font-family:PingFangSC-Regular,-apple-system-font,Source Han Sans,Helvetica Neue,sans-serif}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}abbr,acronym{border:0;font-variant:normal}del{text-decoration:line-through}address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:500}ol,ul{list-style:none}caption,th{text-align:left}q:before,q:after{content:''}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}a:hover{text-decoration:underline}ins,a{text-decoration:none}
`, type: 'text/css' }
],
__dangerouslyDisableSanitizers: ['script'],
script: [
{ innerHTML: `
!function(a,b){function c(){var b=f.getBoundingClientRect().width;b/i>540&&(b=540*i);var c=b/10;f.style.fontSize=c+"px",k.rem=a.rem=c}var d,e=a.document,f=e.documentElement,g=e.querySelector('meta[name="viewport"]'),h=e.querySelector('meta[name="flexible"]'),i=0,j=0,k=b.flexible||(b.flexible={});if(g){console.warn("将根据已有的meta标签来设置缩放比例");var l=g.getAttribute("content").match(/initial\-scale=([\d\.]+)/);l&&(j=parseFloat(l[1]),i=parseInt(1/j))}else if(h){var m=h.getAttribute("content");if(m){var n=m.match(/initial\-dpr=([\d\.]+)/),o=m.match(/maximum\-dpr=([\d\.]+)/);n&&(i=parseFloat(n[1]),j=parseFloat((1/i).toFixed(2))),o&&(i=parseFloat(o[1]),j=parseFloat((1/i).toFixed(2)))}}if(!i&&!j){var p=(a.navigator.appVersion.match(/android/gi),a.navigator.appVersion.match(/iphone/gi)),q=a.devicePixelRatio;i=p?q>=3&&(!i||i>=3)?3:q>=2&&(!i||i>=2)?2:1:1,j=1/i}if(f.setAttribute("data-dpr",i),!g)if(g=e.createElement("meta"),g.setAttribute("name","viewport"),g.setAttribute("content","initial-scale="+j+", maximum-scale="+j+", minimum-scale="+j+", user-scalable=no"),f.firstElementChild)f.firstElementChild.appendChild(g);else{var r=e.createElement("div");r.appendChild(g),e.write(r.innerHTML)}a.addEventListener("resize",function(){clearTimeout(d),d=setTimeout(c,300)},!1),a.addEventListener("pageshow",function(a){a.persisted&&(clearTimeout(d),d=setTimeout(c,300))},!1),"complete"===e.readyState?e.body.style.fontSize=12*i+"px":e.addEventListener("DOMContentLoaded",function(){e.body.style.fontSize=12*i+"px"},!1),c(),k.dpr=a.dpr=i,k.refreshRem=c,k.rem2px=function(a){var b=parseFloat(a)*this.rem;return"string"==typeof a&&a.match(/rem$/)&&(b+="px"),b},k.px2rem=function(a){var b=parseFloat(a)/this.rem;return"string"==typeof a&&a.match(/px$/)&&(b+="rem"),b}}(window,window.lib||(window.lib={}));
`, type: 'text/javascript', charset: 'utf-8'}
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
'vant/lib/index.css'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
{
src: '~/plugins/vue-inject',
ssr: false
}
],
/*
** Nuxt.js modules
*/
modules: [],
/*
** Build configuration
*/
router: {
base: '/lreport_ssr/', // 上下文根据自己的需求自行打开修改
// base: '/detection/' 上下文根据自己的需求自行打开修改
extendRoutes(routes, resolve){
if(process.env.NUXT_ENV_APP=="uat"){
var handleAllRouter=require("./src/public_uat_ssr.js");
let base=this.base;
let ObjParms={
routes:routes,
baseUrl:base,
fullHost:"https://phome.yunqueyi.com"
}
handleAllRouter(ObjParms);
}
}
},
build: {
postcss: {
plugins: {
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*']
}
}
},
extractCSS: true,
filenames: {
app: ({ isDev }) => isDev ? '[name].js' : '[name].[chunkhash:7].js',
chunk: ({ isDev }) => isDev ? '[name].js' : '[name].[chunkhash:7].js',
css: ({ isDev }) => isDev ? '[name].css' : '[name].[contenthash:7].css',
img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[name].[hash:7].[ext]',
font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[name].[hash:7].[ext]',
video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[name].[hash:7].[ext]'
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {
config.devtool = ['dev', 'test'].indexOf(process.env.NUXT_ENV_APP) !== -1 ? 'source-map' : false;
}
}
}
\ No newline at end of file
/* eslint-disable */
const fs = require('fs');
const path = require('path');
const program = require('commander');
const pathError = path.resolve(process.cwd(), './.error-log')
const ResetPathFile = require('@pica-core/reset-pathfile-plugin');
program
.command('mode <mode>')
.description('备份log日志')
.action(function (mode) {
// 判断.error-log文件是否存在
fs.stat(pathError, (err, stats) => {
// 如果不存在,就正常执行
if (err) {
console.log('正常执行!');
} else {
new ResetPathFile(mode, 1);
}
});
});
program
.command('check <value>')
.description('检查.error-log是否已删除')
.action(function (mode) {
// 判断.error-log文件是否存在
fs.stat(pathError, (err, stats) => {
// 如果不存在,就正常执行
if (err) {
console.log('正常执行!');
} else {
// 如果存在,执行下面的脚本
fs.unlink(pathError, (err) => {
if (err) throw err;
console.log('.error-log文件已被删除');
throw new Error('请联系运维同学去oss服务器手动copy版本控制相关文件');
});
}
});
});
program.parse(process.argv);
此差异已折叠。
{
"name": "learning-report",
"version": "1.0.0",
"description": "nuxt ssr layout",
"author": "souse",
"version": "0.1.0",
"private": true,
"scripts": {
"test": "jest",
"dev": "cross-env NODE_ENV=development NUXT_ENV_APP=dev HOST=0.0.0.0 PORT=4001 nodemon server/index.js --watch server",
"build": "NUXT_ENV_APP=${ENV} nuxt build",
"start": "cross-env NUXT_ENV_APP=${ENV} HOST=0.0.0.0 PORT=3100 NODE_ENV=production node server/index.js",
"generate": "nuxt generate"
"serve": "pica-cli-service serve",
"build": "pica-cli-service build",
"lint": "pica-cli-service lint",
"add-all": "pica-cli-service add-all",
"build-skeleton": "pica-cli-service build-skeleton",
"build:dev": "pica-cli-service build --mode dev",
"build:prod": "pica-cli-service build --mode production",
"build:report": "pica-cli-service build --report",
"build:test": "pica-cli-service build --mode testing",
"build:uat": "pica-cli-service build --mode uat",
"core": "pica-cli-service core",
"img-md5": "pica-cli-service img-md5",
"page": "vue-cli-service page",
"skeleton": "pica-cli-service skeleton",
"tinypng": "pica-cli-service tinypng"
},
"dependencies": {
"@pica-core/web-buried-point": "^1.0.19",
"@pica-kit/pica-topic-stencil": "^2.0.5",
"axios": "^0.19.2",
"clipboard": "^2.0.6",
"cookie-universal": "^2.0.16",
"core-js": "^3.19.3",
"cross-env": "^5.2.0",
"echarts": "^4.4.0",
"dayjs": "^1.8.30",
"dsbridge": "^3.1.4",
"js-base64": "^2.5.1",
"lodash": "^4.17.15",
"md5": "^2.3.0",
"pica-guide-app": "^1.0.5",
"pica-h5-agreement": "^1.0.13",
"pica-h5-login": "^2.0.1",
"pica-topic-stencil": "2.0.12",
"pre-commit": "^1.2.2",
"vant": "^2.8.4",
"vconsole": "^3.3.4",
"vue": "^2.6.11",
"vue-clipboard2": "^0.3.1",
"vue-fragment": "^1.5.1",
"vue-router": "^3.3.1",
"vuescroll": "^4.15.1",
"vuex": "^3.1.1",
"web-buried-point": "^2.1.0",
"weixin-js-sdk": "^1.6.0",
"koa": "^2.6.2",
"nuxt": "^2.0.0",
"v-charts": "^1.19.0",
"vant": "^2.2.13",
"web-buried-point": "^2.1.0"
"v-charts": "^1.19.0"
},
"devDependencies": {
"@nuxtjs/axios": "^5.5.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@pica-cli/pica-cli-framework": "^1.0.11",
"@pica-cli/vue-cli-plugin-pica-cli-plugin": "~1.1.52",
"@pica-core/multiple-versions-plugin": "^1.0.4",
"@pica-core/reset-pathfile-plugin": "^1.0.4",
"@pica-core/web-buried-point": "^1.0.20",
"@pica-kit/page-model": "^1.0.5",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.0",
"colors-console": "^1.0.3",
"css-loader": "^6.5.1",
"dotenv": "^8.2.0",
"draw-page-structure": "^1.0.8",
"eslint": "^6.7.2",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-vue": "^6.2.2",
"fast-install-puppeteer": "^1.0.5",
"husky": "^3.0.9",
"less-loader": "^10.2.0",
"lint-staged": "^9.4.2",
"node-sass": "^4.13.1",
"postcss-px-to-viewport": "^1.1.1",
"prettier": "^2.3.2",
"prettier-eslint-cli": "^5.0.1",
"puppeteer": "^10.1.0",
"sass": "^1.26.3",
"sass-loader": "^8.0.2",
"vue-skeleton-webpack-plugin": "^1.2.2",
"vue-template-compiler": "^2.6.11",
"webpack-bundle-analyzer": "^4.4.2",
"@vue/test-utils": "^1.0.0-beta.27",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^24.1.0",
"jest": "^24.1.0",
"less": "^3.9.0",
"less-loader": "^5.0.0",
"node-sass": "^4.13.0",
"nodemon": "^1.18.9",
"postcss-pxtorem": "^4.0.1",
"qs": "^6.7.0",
"sass-loader": "^8.0.0",
"scss-loader": "^0.0.1",
"vue-jest": "^3.0.3"
}
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
],
"husky": {
"hooks": {
"pre-commit": "pica-cli-service img-md5 && lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
],
"src/**/*.{js,vue,html,css,scss,sass}": [
"prettier-eslint --write",
"git add"
]
},
"pica-cli-service": {}
}
import Vue from 'vue'
import rocNative from '@/utils/jsbridge'
import echarts from 'echarts'
import { Toast } from 'vant';
import { BASE_URL } from '@/utils/enumerate';
import WebBuriedPoint, { sendBuriedData } from 'web-buried-point';
const { NUXT_ENV_APP } = process.env;
// Vue.use(WebBuriedPoint, {
// // component_tag: `467`,
// class_name: `learning_report`,
// url: `${BASE_URL[NUXT_ENV_APP]}/file/log/trace1`
// });
Vue.prototype.$sendBuriedData = sendBuriedData;
Vue.use(Toast);
// // "vconsole": "^3.3.4"
// import VConsole from 'vconsole/dist/vconsole.min.js' //import vconsole
// new VConsole() // 初始化
Vue.prototype.$echarts = echarts
Vue.prototype.$rocNative = new rocNative();
\ No newline at end of file
module.exports = {
plugins: {
autoprefixer: {},
'postcss-px-to-viewport': {
viewportWidth: 375, // 视口的宽度,对应的时设计稿的宽度/2,一般为750
viewportHeight: 667, // 视口的高度,对应的是设计稿的高度(也可以不配置)
unitPrecision: 5, // 指定‘px’转换为视口单位值的小数位数(很多时候无法整除)
viewportUnit: 'vw', // 指定需要转换成的视口单位,建议使用vw
selectorBlankList: ['ignore', 'tab-bar'],
minPixelValue: 1,
mediaQuery: false,
exclude:[/Tabbar/]
}
}
};
## 增加骨架屏占位 Dom #skeleton
```html
<div id="skeleton"></div>
<div id="app"></div>
```
## 初始化时间记录
```js
(function (window) {
var dsBridge = window.dsBridge;
function logToLocaleString(method) {
var date = new Date();
console.log(date.toLocaleString() + ':' + date.getMilliseconds(), method);
}
window.onNativeLCEvent = logToLocaleString;
window.onload = function () {
dsBridge && dsBridge.call && dsBridge.call('onLCEvent', 'onload');
logToLocaleString('onload');
}
document.addEventListener('DOMContentLoaded', function () {
dsBridge && dsBridge.call && dsBridge.call('onLCEvent', 'DOMContentLoaded');
logToLocaleString('DOMContentLoaded');
});
document.addEventListener('readystatechange', function () {
if (document.readyState == 'interactive') {
dsBridge && dsBridge.call && dsBridge.call('onLCEvent', 'interactive');
logToLocaleString('interactive');
}
if (document.readyState == 'complete') {
dsBridge && dsBridge.call && dsBridge.call('onLCEvent', 'complete');
dsBridge && dsBridge.call && dsBridge.call('forceHideLoading');
logToLocaleString('complete');
}
})
}(window));
```
<!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">
<title><%= htmlWebpackPlugin.options.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 -->
<script src="<%= VUE_APP_OSS_URL %>static/js/vue-2.6.11.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/vuex-3.4.0.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/vue-router-3.3.2.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/vant.min-2.12.26.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/axios-0.19.0.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/jsencrypt.min-3.0.0.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/crypto.min-4.0.0.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/vconsole-3.3.4.js"></script>
<script src="<%= VUE_APP_OSS_URL %>static/js/lodash-4.17.15.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/echarts/4.9.0-rc.1/echarts.min.js"></script>
</body>
</html>
const Koa = require('koa')
const consola = require('consola')
const { Nuxt, Builder } = require('nuxt')
const app = new Koa()
// Import and Set Nuxt.js options
const config = require('../nuxt.config.js')
config.dev = !(app.env === 'production')
async function start() {
// Instantiate nuxt.js
const nuxt = new Nuxt(config)
const {
host = process.env.HOST || '10.177.11.247' || '127.0.0.1',
port = process.env.PORT || 3000
} = nuxt.options.server
// Build in development
if (config.dev) {
const builder = new Builder(nuxt)
await builder.build()
} else {
await nuxt.ready()
}
app.use((ctx) => {
ctx.status = 200
ctx.respond = false // Bypass Koa's built-in response handling
ctx.req.ctx = ctx // This might be useful later on, e.g. in nuxtServerInit or with nuxt-stash
nuxt.render(ctx.req, ctx.res)
})
app.listen(port, host)
consola.ready({
message: `Server listening on http://${host}:${port}`,
badge: true
})
}
start()
import Axios from 'axios';
import { Toast } from 'vant';
import { API_CONFIG, REPONSE_CODE } from '@/utils/enumerate';
const { VUE_ENV } = process.env; // server or client
const cookies = require('cookie-universal')();
// const baseUrl = localStorage.getItem('baseUrl');
// const instance = axios.create({
// baseURL: baseUrl,
// timeout: 30000,
// });
Axios.interceptors.request.use(
config => {
// 0. Do something before request is sent
// 1. can be add loading
// 2. make sure if need token
const method = config.method.toLocaleLowerCase();
if (method === 'post' || method === 'put' || method === 'delete') {}
if (config.withCredentials) {
// config.headers.token = '3EB9111164E84A45B5B00428D52BC966';
config.headers.token = cookies.get('lreporttoken') || '568E9A4C115F47649BDA1B0B70D4B4F9';
}
// config.timeout = 30000;
return config;
},
error => {
// when set loading close it
if (
error.code === 'ECONNABORTED' &&
error.message.indexOf('timeout') !== -1
) {
VUE_ENV === 'client' && Toast({ message: '系统繁忙,请稍后重新进入页面查询', duration: 1000 });
// VUE_ENV === 'client' && Toast({ message: '请求超时', duration: 1000 });
}
return Promise.reject(error);
}
)
export default function(options) {
if (typeof options !== 'object') {
throw new Error('make sure the params options is an Object...');
}
const cf = JSON.parse(JSON.stringify(API_CONFIG));
options = Object.assign(cf, options); // 合并 config
return new Promise((resolve, reject) => {
Axios(options)
.then(res => {
const { status, data } = res;
if (status !== 200) {
let cmsg = REPONSE_CODE[status];
let message = cmsg !== undefined ? cmsg : '系统异常。';
throw Error(message);
}
if (!data) throw Error('axios reponse data in not defined.');
if (data.code != '000000') {
// 如果要是有其他特殊需求在此处添加
console.log(`调用后台接口报错,CODE: ${data.code},MESSAGE: ${data.message}。`);
// console.log(`调用后台接口报错,CODE: ${data.code},MESSAGE: ${data.message}。`);
}
resolve(res.data);
})
.catch(error => {
VUE_ENV === 'client' && Toast({ message: '系统繁忙,请稍后重新进入页面查询', duration: 1000 });
// VUE_ENV === 'client' && Toast({ message: error.message, duration: 1000 });
// reject(error);
})
})
}
\ No newline at end of file
该目录建议放置所有请求资源代码,可根据业务划分与不同子目录。
import $http from 'mn-template/plugins/http';
// 获取亲友列表
export const listRelatives = () =>
$http({
method: 'get',
url: '/splitter/live/v2/list',
params: {
version: '3.2.1',
},
});
export const getWidgetList = async ({ id, token }) =>
$http({
method: 'get',
url: `/contents/template/${id}/widgetList?token=${token}&setEntry=true`,
});
export const getWidgetListTab = async ({ id }) =>
$http({
method: 'get',
url: `/contents/template/element/${id}/widgetList`,
});
export const selectAppModuleParam = async ({ id, token }) =>
$http({
method: 'get',
url: `/contents/contentAppModule/selectAppModuleParam?id=${id}&token=${token}&setEntry=true`,
withCredentials: true,
});
// 任务列表查询
export const getActivityDesc = async (data) =>
$http({
method: 'get',
url: `/campaign/admin/task/h5/activityInfo?id=${data.id}&token=${data.token}&setEntry=true`,
headers: {
token: data.token,
},
// withCredentials: true
});
// 新的任务列表查询
export const getNewActivityDesc = async (data) =>
$http({
method: 'get',
url: `/campaign/tims/timsActivityInfo?activityId=${data.id}&token=${
data.token
}&setEntry=true&random=${Math.random()}`,
headers: {
token: data.token,
},
});
export const checkQualification = async ({ token, role, rosterId }) =>
$http({
method: 'get',
url: `contents/template/checkQualification?token=${token}&setEntry=true&role=${role}&rosterId=${rosterId}`,
withCredentials: true,
});
export const checkToken = async (token) =>
$http({
method: 'get',
url: `campaign/admin/task/checkToken?token=${token}`,
withCredentials: true,
});
export const logPut = async (data) =>
$http({
method: 'PUT',
data: data,
url: 'log/',
});
export const getRole = async ({ token }) =>
$http({
method: 'get',
url: `/contents/template/getRole?token=${token}`,
headers: {
token,
},
// withCredentials: true
});
export const sayHello = async ({ token }) =>
$http({
method: 'POST',
// withCredentials: true,
headers: {
token,
},
data: {
token,
},
url: '/diplomat/oauth/sayhello?app_id=pica-crrs',
});
export const getAmountApi = async ({ a, b, c, d }) => {
// a:url b:get or post c:params
if (b == 'get') {
const param = JSON.parse(c);
let str, key;
for (key in param) {
str = str + key + '=' + param[key] + '&';
}
str = str.slice(0, str.length - 1);
return $http({
url: a + '?' + str,
});
} else if (b == 'post') {
return $http({
method: 'POST',
headers: {
token: d,
},
data: JSON.parse(c),
url: a,
});
}
};
export const checkHasAgreementApi = async ({ token }) =>
$http({
url: 'smartcontract/protocol/sign/check?type=3', // 3为云鹊医隐私协议
headers: {
token,
},
});
// 查看直播状态
export const checkLiveStatus = async (resourceId) =>
$http({
url: `campaign/subscribe/liveStatus?liveId=${resourceId}`,
});
// 查看doctorId
export const getDoctorId = async (token) =>
$http({
url: 'campaign/subscribe/getId',
headers: {
token,
},
});
// 校验预约和分享完成状态以及直播状态
export const checkFinishStatus = async (data) =>
$http({
// alert('token'+data.token)
// url: `/campaign/admin/tims/checkFinishStatus?type=${type}&resourcesId=${resourcesId}&doctorId=${doctorId}&setEntry=true`,
url: '/campaign/subscribe/checkFinishStatus',
method: 'POST',
headers: {
token: data.token,
},
data: {
type: data.type,
resourcesId: data.resourcesId,
doctorId: data.doctorId,
},
});
// 预约
export const getSubscribe = async (data) =>
$http({
// url: `/campaign/admin/tims/checkFinishStatus?type=${type}&resourcesId=${resourcesId}&doctorId=${doctorId}&setEntry=true`,
url: '/campaign/subscribe/',
method: 'POST',
headers: {
token: data.token,
},
data: {
type: data.type,
resourcesId: data.resourcesId,
doctorId: data.doctorId,
shareDoctorId: data.shareDoctorId,
subscribeUrl: data.subscribeUrl,
},
});
// 分享
export const getSubscribeShare = async (data) =>
$http({
url: '/campaign/subscribe/share',
method: 'POST',
headers: {
token: data.token,
},
data: {
type: data.type,
resourcesId: data.resourcesId,
doctorId: data.doctorId,
},
});
// 获取打卡状态 参数 activityId 活动id ,id 任务id
export const getClockStatus = (params) =>
$http({
url: `/campaign/clock/v1/${params.activityId}/status/${params.id}`,
method: 'get',
withCredentials: true,
});
// 去打卡 参数 activityId 活动id ,id 任务id
export const goToUpdateClock = (params) =>
$http({
url: 'campaign/clock/clock',
method: 'post',
data: params,
withCredentials: true,
});
// 获取doctorId
export const getDoctorIdObtain = async () =>
$http({
url: '/campaign/second-award/doctorId',
method: 'get',
withCredentials: true,
});
// 记录分享行为
export const recordShareAction = (params) =>
$http({
url: '/contents/template/share-log',
method: 'post',
data: params,
withCredentials: true,
});
// 根据邀请组件id返回口令
export const getCommand = async (params) =>
$http({
url: '/contents/template/invite-token',
method: 'get',
params: params,
withCredentials: false,
});
// 根据商品id批量查询商品信息
export const getGoodsDetailListByIds = async (ids) =>
$http({
url: 'store/medications/queryGoodsDetailListByIds',
method: 'post',
data: ids,
withCredentials: true,
});
// 获取和药代相关的积木id列表
export const getTemplateList = async (params) =>
$http({
url: '/broker/templateList',
method: 'get',
params: params,
withCredentials: false,
});
// 校验是否为药代身份并返回加密医生id
export const checkBroker = async (templateId) =>
$http({
url: `/broker/checkBroker?templateId=${templateId}`,
method: 'get',
withCredentials: true,
});
......@@ -2,225 +2,233 @@
<template>
<div>
<div class="chart-column-vtc">
<div v-show="isShow" :id="id" :style="{width: chartWidth, height: chartHeight}"></div>
<NoContent v-show="!isShow" :id="id" :style="{width: '100%', height: '220px'}"></NoContent>
<div
v-show="isShow"
:id="id"
:style="{ width: chartWidth, height: chartHeight }"
/>
<NoContent
v-show="!isShow"
:id="id"
:style="{ width: '100%', height: '220px' }"
/>
</div>
<CommonNoMore v-show="isShow && dataList.length >= 10"></CommonNoMore>
<CommonNoMore v-show="isShow && dataList.length >= 10" />
</div>
</template>
<script>
let vm = null;
import CommonNoMore from "@/components/common/common-no-more";
import NoContent from "@/components/bussiness/no-content";
import CommonNoMore from '@/components/common/common-no-more';
import NoContent from '@/components/bussiness/no-content';
export default {
components: {
CommonNoMore,
NoContent
NoContent,
},
props: {
id: {
type: String,
default: "chartColumnTCId"
default: 'chartColumnTCId',
},
colors: {
type: Array,
default: () => [
"#FFB01B",
"#39AF9A",
"#5D7092",
"#FF9A4B",
"#abb7bb",
"#76d2d2"
]
'#FFB01B',
'#39AF9A',
'#5D7092',
'#FF9A4B',
'#abb7bb',
'#76d2d2',
],
},
dataList: {
type: Array,
default: () => []
}
default: () => [],
},
},
data() {
return {
chartWidth: "100%",
chartHeight: "200px",
isShow: true
chartWidth: '100%',
chartHeight: '200px',
isShow: true,
};
},
watch: {
dataList: {
handler(newVal) {
if(newVal.length) {
if (newVal.length) {
this.isShow = true;
let yAxisData = [],
series0Data = [],
series1Data = [];
yAxisData = newVal.map(item => {
return this.shortName(item.classifyName)
yAxisData = newVal.map((item) => {
return this.shortName(item.classifyName);
});
series0Data = this.dataList.map(item => {
series0Data = this.dataList.map((item) => {
return ((item.beforeRate || 0) * 100).toFixed(1);
});
series1Data = this.dataList.map(item => {
series1Data = this.dataList.map((item) => {
return ((item.afterRate || 0) * 100).toFixed(1);
});
if (process.client) {
let clientWidth =
const clientWidth =
window.outerWidth ||
document.body.clientWidth ||
document.documentElement.clientWidth;
this.chartWidth = clientWidth + "px";
this.chartHeight = 53 * this.dataList.length + "px";
this.chartWidth = clientWidth + 'px';
this.chartHeight = 53 * this.dataList.length + 'px';
this.drawColumn(yAxisData, series0Data, series1Data);
}
} else {
this.isShow = false;
}
},
deep: true
}
deep: true,
},
},
created() {
},
created() {},
mounted() {
vm = this;
},
methods: {
// 绘制图表
drawColumn(yAxisData, series0Data, series1Data) {
let chartColumn = this.$echarts.init(document.getElementById(this.id));
let options = {
const chartColumn = this.$echarts.init(document.getElementById(this.id));
const options = {
color: vm.colors || [],
tooltip: {
trigger: "axis",
trigger: 'axis',
axisPointer: {
type: "shadow"
type: 'shadow',
},
formatter: "{b}<br/>{a0}{c0}%<br/>{a1}{c1}%"
formatter: '{b}<br/>{a0}{c0}%<br/>{a1}{c1}%',
},
legend: {
show: false,
top: 20,
data: ["培训前正确率", "培训后正确率"],
data: ['培训前正确率', '培训后正确率'],
textStyle: {
fontSize: 12,
// fontWeight: "bolder",
color: "#676869"
}
color: '#676869',
},
},
grid: {
top: "3%",
left: "5%",
right: "5%",
bottom: "3%",
top: '3%',
left: '5%',
right: '5%',
bottom: '3%',
containLabel: true,
borderWidth: 0
borderWidth: 0,
},
lineStyle: {
color: "#fff"
color: '#fff',
},
xAxis: {
axisTick: false,
type: "value",
type: 'value',
minInterval: 1,
axisLabel: {
show: false,
formatter: "{value}",
formatter: '{value}',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#676869",
width: 0
}
color: '#676869',
width: 0,
},
},
splitLine: {
show: false
}
show: false,
},
},
yAxis: {
axisTick: false,
type: "category",
type: 'category',
data: yAxisData,
textStyle: {
fontSize: 12,
color: "#676869"
color: '#676869',
},
splitLine: {
show: false
show: false,
},
axisLabel: {
formatter: "{value}",
textAlign: "left",
formatter: '{value}',
textAlign: 'left',
textStyle: {
textAlign: "left",
color: "#676869"
}
textAlign: 'left',
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#676869",
width: 0
}
color: '#676869',
width: 0,
},
},
},
series: [
{
name: "培训前正确率",
name: '培训前正确率',
data: series0Data,
// data: [12, 200, 150, 80, 70, 110, 130, 130],
type: "bar",
barWidth: 15, //柱图宽度
type: 'bar',
barWidth: 15, // 柱图宽度
label: {
normal: {
align: 'left',
formatter: "{c}%",
formatter: '{c}%',
show: true,
position: "inside"
}
}
position: 'inside',
},
},
},
{
name: "培训后正确率",
name: '培训后正确率',
data: series1Data,
// data: [120, 20, 160, 80, 70, 110, 130, 130],
type: "bar",
barWidth: 15, //柱图宽度
type: 'bar',
barWidth: 15, // 柱图宽度
label: {
normal: {
align: 'left',
formatter: "{c}%",
formatter: '{c}%',
show: true,
position: "inside"
}
}
}
]
position: 'inside',
},
},
},
],
};
chartColumn.setOption(options);
let autoHeight = this.dataList.length * 53; // counst.length为柱状图的条数,即数据长度。35为我给每个柱状图的高度,50为柱状图x轴内容的高度(大概的)。
chartColumn.getDom().style.height = autoHeight + "px";
chartColumn.getDom().childNodes[0].style.height = autoHeight + "px";
chartColumn.getDom().childNodes[0].childNodes[0].setAttribute("height",autoHeight);
chartColumn.getDom().childNodes[0].childNodes[0].style.height = autoHeight + "px";
chartColumn.resize();
const autoHeight = this.dataList.length * 53; // counst.length为柱状图的条数,即数据长度。35为我给每个柱状图的高度,50为柱状图x轴内容的高度(大概的)。
chartColumn.getDom().style.height = autoHeight + 'px';
chartColumn.getDom().childNodes[0].style.height = autoHeight + 'px';
chartColumn
.getDom()
.childNodes[0].childNodes[0].setAttribute('height', autoHeight);
chartColumn.getDom().childNodes[0].childNodes[0].style.height =
autoHeight + 'px';
chartColumn.resize();
},
shortName: function (value, length = 5, append = '...') {
if (value && value.length > length) {
return value.substring(0, length) + append
return value.substring(0, length) + append;
} else {
return value
return value;
}
},
}
},
};
</script>
<style lang="less" scoped>
<style lang="scss" scoped>
.chart-column-vtc {
font-size: 14px;
}
......
......@@ -2,38 +2,45 @@
<template>
<div>
<div class="chart-column-htc">
<div v-show="isShow" :id="id" :style="{width: chartWidth, height: chartHeight}"></div>
<NoContent v-show="!isShow" :id="id" :style="{width: '100%', height: '220px'}"></NoContent>
<div
v-show="isShow"
:id="id"
:style="{ width: chartWidth, height: chartHeight }"
/>
<NoContent
v-show="!isShow"
:id="id"
:style="{ width: '100%', height: '220px' }"
/>
</div>
</div>
</template>
<script>
import { format } from "path";
import NoContent from "@/components/bussiness/no-content";
import NoContent from '@/components/bussiness/no-content';
let vm = null,
chartColumn = null;
export default {
components: {
NoContent
NoContent,
},
props: {
dataList: {
type: Array,
default: () => []
default: () => [],
},
id: {
type: String,
default: "chartColumnTCId"
default: 'chartColumnTCId',
},
colors: {
type: Array,
default: () => ["#FFB01B", "#39AF9A", "#5D7092", "#FF9A4B"]
}
default: () => ['#FFB01B', '#39AF9A', '#5D7092', '#FF9A4B'],
},
},
data() {
return {
chartWidth: "300px",
chartHeight: "350px",
chartWidth: '300px',
chartHeight: '350px',
isShow: true,
};
},
......@@ -41,18 +48,18 @@ export default {
watch: {
dataList: {
handler(newVal) {
if(newVal.length) {
if (newVal.length) {
this.isShow = true;
let yAxisData = [],
series0Data = [],
series1Data = [];
yAxisData = newVal.map(item => {
yAxisData = newVal.map((item) => {
return this.shortName(item.classifyName);
});
series0Data = this.dataList.map(item => {
series0Data = this.dataList.map((item) => {
return ((item.beforeRate || 0) * 100).toFixed(1);
});
series1Data = this.dataList.map(item => {
series1Data = this.dataList.map((item) => {
return ((item.afterRate || 0) * 100).toFixed(1);
});
this.drawColumn(
......@@ -64,17 +71,17 @@ export default {
this.isShow = false;
}
},
deep: false
}
deep: false,
},
},
created() {
if (process.client) {
let clientWidth =
const clientWidth =
window.outerWidth ||
document.body.clientWidth ||
document.documentElement.clientWidth;
this.chartWidth = (clientWidth * 0.9).toFixed(1) + "px";
this.chartWidth = (clientWidth * 0.9).toFixed(1) + 'px';
}
},
......@@ -86,128 +93,128 @@ export default {
// 绘制图表
drawColumn(yAxisData, series0Data, series1Data) {
chartColumn = this.$echarts.init(document.getElementById(this.id));
let options = {
const options = {
color: vm.colors,
tooltip: {
trigger: "axis",
trigger: 'axis',
axisPointer: {
type: "shadow"
type: 'shadow',
},
formatter: "{b}<br/>{a0}{c0}%<br/>{a1}{c1}%"
formatter: '{b}<br/>{a0}{c0}%<br/>{a1}{c1}%',
},
legend: {
top: 20,
data: ["培训前正确率", "培训后正确率"],
data: ['培训前正确率', '培训后正确率'],
textStyle: {
fontSize: 12,
color: "#676869"
}
color: '#676869',
},
},
grid: {
left: "3%",
right: "6%",
bottom: "6%",
containLabel: true
left: '3%',
right: '6%',
bottom: '6%',
containLabel: true,
},
lineStyle: {
color: "#676869"
color: '#676869',
},
xAxis: {
max: 100,
axisTick: false,
type: "value",
type: 'value',
minInterval: 1,
axisLabel: {
formatter: "{value}%",
formatter: '{value}%',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
color: '#efefef',
width: 1,
},
},
//设置网格线颜色
// 设置网格线颜色
splitLine: {
show: true,
lineStyle: {
color: ["#efefef"],
color: ['#efefef'],
width: 1,
type: "solid"
}
}
type: 'solid',
},
},
},
yAxis: {
axisTick: false,
type: "category",
type: 'category',
data: yAxisData,
// data: ["生活方\n式干预", "生活方\n式", "本科", "大专", "中专以下"],
textStyle: {
fontSize: 12,
color: "#676869"
color: '#676869',
},
axisLabel: {
formatter: "{value}",
textAlign: "left",
formatter: '{value}',
textAlign: 'left',
textStyle: {
textAlign: "left",
color: "#676869"
}
textAlign: 'left',
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
}
color: '#efefef',
width: 1,
},
},
},
series: [
{
name: "培训前正确率",
name: '培训前正确率',
data: series0Data,
// data: [12, 200, 150, 80, 70, 110, 130],
type: "bar",
barWidth: 15, //柱图宽度
type: 'bar',
barWidth: 15, // 柱图宽度
label: {
normal: {
formatter: "{c}%",
formatter: '{c}%',
show: false,
position: "inside"
}
}
position: 'inside',
},
},
},
{
name: "培训后正确率",
name: '培训后正确率',
data: series1Data,
// data: [120, 20, 160, 80, 70, 110, 130],
type: "bar",
barWidth: 15, //柱图宽度
type: 'bar',
barWidth: 15, // 柱图宽度
label: {
normal: {
formatter: "{c}%",
formatter: '{c}%',
show: false,
position: "inside"
}
}
}
]
position: 'inside',
},
},
},
],
};
chartColumn.setOption(options);
},
shortName: function(value, length = 5, append = "...") {
shortName: function (value, length = 5, append = '...') {
if (value && value.length > length) {
return value.substring(0, length) + append;
} else {
return value;
}
}
}
},
},
};
</script>
<style lang="less" scoped>
<style lang="scss" scoped>
.chart-column-htc {
position: relative;
top: -6px;
......
<!-- 柱状图-竖向 -->
<template>
<section class="chart-pie">
<div v-show="isShow" :id="id" :style="{width: chartWidth, height: chartHeight}"></div>
<NoContent v-show="!isShow" :id="id" :style="{width: '100%', height: '220px'}"></NoContent>
<div
v-show="isShow"
:id="id"
:style="{ width: chartWidth, height: chartHeight }"
/>
<NoContent
v-show="!isShow"
:id="id"
:style="{ width: '100%', height: '220px' }"
/>
</section>
</template>
<script>
import { format } from "path";
import NoContent from "@/components/bussiness/no-content";
let vm = null, chartColumn = null;
import NoContent from '@/components/bussiness/no-content';
let chartColumn = null;
export default {
components: {
NoContent
NoContent,
},
props: {
id: {
type: String,
default: "chartColumnId"
default: 'chartColumnId',
},
colors: {
type: Array,
default: () => [
"#FFB01B",
"#39AF9A",
"#5D7092",
"#FF9A4B",
]
default: () => ['#FFB01B', '#39AF9A', '#5D7092', '#FF9A4B'],
},
dataList: {
tpye: Array,
default: () => []
}
type: Array,
default: () => [],
},
},
data() {
return {
chartWidth: "300px",
chartHeight: "235px",
chartWidth: '300px',
chartHeight: '235px',
xAxisData: [],
seriesData: [],
options: {
color: ['#FFB01B'],
tooltip: {
trigger: "axis",
trigger: 'axis',
axisPointer: {
type: "shadow"
type: 'shadow',
},
formatter: '{b}分获得人数{c0}人'
formatter: '{b}分获得人数{c0}人',
},
grid: {
top: "10%",
left: "3%",
right: "6%",
bottom: "6%",
containLabel: true
top: '10%',
left: '3%',
right: '6%',
bottom: '6%',
containLabel: true,
},
lineStyle: {
color: "#676869"
color: '#676869',
},
yAxis: {
axisTick: false,
type: "value",
type: 'value',
minInterval: 1,
axisLabel: {
formatter: "{value}",
formatter: '{value}',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
color: '#efefef',
width: 1,
},
},
//设置网格线颜色
// 设置网格线颜色
splitLine: {
show: true,
lineStyle:{
lineStyle: {
color: ['#efefef'],
width: 1,
type: 'solid'
}
   },
type: 'solid',
},
},
},
xAxis: {
axisTick: false,
type: "category",
type: 'category',
data: [],
// data: ["其他", "中专以下", "大专", "本科", "硕士"],
textStyle: {
fontSize: 12,
color: "#676869"
color: '#676869',
},
axisLabel: {
formatter: "{value}分",
formatter: '{value}分',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
color: '#efefef',
width: 1,
},
},
label: {
formatter: "{c}%",
formatter: '{c}%',
// normal: {
// formatter: "{c}%",
// show: true,
// position: "inside"
// }
}
},
},
series: [
{
name: "考试人数",
name: '考试人数',
data: [],
// data: [120, 200, 150, 80, 70, 110, 130],
type: "bar",
barWidth: 20 //柱图宽度
}
]
type: 'bar',
barWidth: 20, // 柱图宽度
},
],
},
isShow: true
isShow: true,
};
},
watch: {
dataList: {
handler(newVal) {
if(newVal.length) {
if (newVal.length) {
this.isShow = true;
this.xAxisData = newVal.map( item => {
return item.times
})
this.seriesData = newVal.map( item => {
return item.count
})
this.xAxisData = newVal.map((item) => {
return item.times;
});
this.seriesData = newVal.map((item) => {
return item.count;
});
this.options.xAxis.data = this.xAxisData;
this.options.series[0].data = this.seriesData;
chartColumn.setOption(this.options, true);
......@@ -144,20 +145,19 @@ export default {
this.isShow = false;
}
},
deep: true
}
deep: true,
},
},
created() {
if (process.client) {
let clientWidth =
const clientWidth =
window.outerWidth ||
document.body.clientWidth ||
document.documentElement.clientWidth;
this.chartWidth = (clientWidth * 0.9).toFixed(1) + 'px';
this.chartWidth = (clientWidth * 0.9).toFixed(1) + 'px';
}
},
mounted() {
vm = this;
this.drawColumn();
},
methods: {
......@@ -165,12 +165,12 @@ export default {
drawColumn() {
chartColumn = this.$echarts.init(document.getElementById(this.id));
chartColumn.setOption(this.options, true);
}
}
},
},
};
</script>
<style lang="less" scoped>
<style lang="scss" scoped>
.chart-pie {
position: relative;
top: -6px;
......
......@@ -2,79 +2,84 @@
<template>
<div>
<div class="chart-column-vtc">
<div v-show="isShow" :id="id" :style="{width: chartWidth, height: chartHeight}"></div>
<NoContent v-show="!isShow" :id="id" :style="{width: '100%', height: '220px'}"></NoContent>
<div
v-show="isShow"
:id="id"
:style="{ width: chartWidth, height: chartHeight }"
/>
<NoContent
v-show="!isShow"
:id="id"
:style="{ width: '100%', height: '220px' }"
/>
</div>
<TipsInfoChart content="报告数据来源仅包含摸底考和正式考的课程培训"></TipsInfoChart>
<TipsInfoChart content="报告数据来源仅包含摸底考和正式考的课程培训" />
</div>
</template>
<script>
import { format } from "path";
import NoContent from "@/components/bussiness/no-content";
import TipsInfoChart from "@/components/bussiness/tips-info-chart";
let vm = null, chartColumn = null;
import NoContent from '@/components/bussiness/no-content';
import TipsInfoChart from '@/components/bussiness/tips-info-chart';
let vm = null,
chartColumn = null;
export default {
components: {
TipsInfoChart,
NoContent
NoContent,
},
props: {
dataList: {
type: Array,
default: () => []
default: () => [],
},
id: {
type: String,
default: "chartColumnTCId"
default: 'chartColumnTCId',
},
colors: {
type: Array,
default: () => [
"#FFB01B",
"#39AF9A",
"#5D7092",
"#FF9A4B",
]
}
default: () => ['#FFB01B', '#39AF9A', '#5D7092', '#FF9A4B'],
},
},
data() {
return {
chartWidth: "300px",
chartHeight: "320px",
chartWidth: '300px',
chartHeight: '320px',
isShow: true,
};
},
created() {
if (process.client) {
let clientWidth =
window.outerWidth ||
document.body.clientWidth ||
document.documentElement.clientWidth;
this.chartWidth = (clientWidth * 0.9).toFixed(1) + 'px';
}
},
watch: {
dataList: {
handler(newVal) {
if(newVal.length) {
if (newVal.length) {
this.isShow = true;
let yAxisData = [], series0Data = [], series1Data = []
yAxisData = newVal.map( item => {
return this.shortName(item.classifyName)
})
series0Data = this.dataList.map( item => {
return ((item.beforeRate|| 0) * 100).toFixed(1);
})
series1Data = this.dataList.map( item => {
return ((item.afterRate|| 0) * 100).toFixed(1);
})
let yAxisData = [],
series0Data = [],
series1Data = [];
yAxisData = newVal.map((item) => {
return this.shortName(item.classifyName);
});
series0Data = this.dataList.map((item) => {
return ((item.beforeRate || 0) * 100).toFixed(1);
});
series1Data = this.dataList.map((item) => {
return ((item.afterRate || 0) * 100).toFixed(1);
});
this.drawColumn(yAxisData, series0Data, series1Data);
// this.drawColumn(yAxisData.splice(0, 5), series0Data.splice(0, 5), series1Data.splice(0, 5));
} else {
this.isShow = false;
}
},
deep: false
deep: false,
},
},
created() {
if (process.client) {
const clientWidth =
window.outerWidth ||
document.body.clientWidth ||
document.documentElement.clientWidth;
this.chartWidth = (clientWidth * 0.9).toFixed(1) + 'px';
}
},
mounted() {
......@@ -85,113 +90,113 @@ export default {
// 绘制图表
drawColumn(yAxisData, series0Data, series1Data) {
chartColumn = this.$echarts.init(document.getElementById(this.id));
let options = {
const options = {
color: vm.colors,
tooltip: {
trigger: "axis",
trigger: 'axis',
axisPointer: {
type: "shadow"
type: 'shadow',
},
// formatter: '{a}<br/>{b}<br/>{c}<br/>{a0}<br/>{a1}<br/>{b0}<br/>{b1}',
formatter: '{b}<br/>{a0}{c0}%<br/> {a1}{c1}%'
formatter: '{b}<br/>{a0}{c0}%<br/> {a1}{c1}%',
},
legend: {
top: 20,
data: ["培训前正确率", "培训后正确率"],
data: ['培训前正确率', '培训后正确率'],
textStyle: {
fontSize: 12,
// fontWeight: "bolder",
color: "#676869"
}
color: '#676869',
},
},
grid: {
left: "3%",
right: "6%",
bottom: "6%",
containLabel: true
left: '3%',
right: '6%',
bottom: '6%',
containLabel: true,
},
lineStyle: {
color: "#676869"
color: '#676869',
},
yAxis: {
axisTick: false,
type: "value",
type: 'value',
minInterval: 1,
axisLabel: {
formatter: "{value}%",
formatter: '{value}%',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
color: '#efefef',
width: 1,
},
},
//设置网格线颜色
// 设置网格线颜色
splitLine: {
show: true,
lineStyle:{
lineStyle: {
color: ['#efefef'],
width: 1,
type: 'solid'
}
   }
type: 'solid',
},
},
},
xAxis: {
axisTick: false,
type: "category",
type: 'category',
// data: ["博士", "硕士", "本科", "大专", "中专以下", "其他"],
data: yAxisData,
textStyle: {
fontSize: 12,
color: "#676869"
color: '#676869',
},
axisLabel: {
formatter: "{value}",
formatter: '{value}',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
}
color: '#efefef',
width: 1,
},
},
},
series: [
{
name: "培训前正确率",
name: '培训前正确率',
data: series0Data,
// data: [120, 200, 150, 80, 70, 110, 130],
type: "bar",
barWidth: 15 //柱图宽度
type: 'bar',
barWidth: 15, // 柱图宽度
},
{
name: "培训后正确率",
name: '培训后正确率',
data: series1Data,
// data: [120, 20, 160, 80, 70, 110, 130],
type: "bar",
barWidth: 15 //柱图宽度
}
]
type: 'bar',
barWidth: 15, // 柱图宽度
},
],
};
chartColumn.setOption(options);
},
shortName: function (value, length = 5, append = '...') {
if (value && value.length > length) {
return value.substring(0, length) + append
return value.substring(0, length) + append;
} else {
return value
return value;
}
},
}
},
};
</script>
<style lang="less" scoped>
<style lang="scss" scoped>
.chart-column-vtc {
position: relative;
top: -6px;
......
<!-- 柱状图-竖向 -->
<template>
<section class="chart-pie">
<div v-show="isShow" :id="id" :style="{width: chartWidth, height: chartHeight}"></div>
<NoContent v-show="!isShow" :id="id" :style="{width: '100%', height: '220px'}"></NoContent>
<div
v-show="isShow"
:id="id"
:style="{ width: chartWidth, height: chartHeight }"
/>
<NoContent
v-show="!isShow"
:id="id"
:style="{ width: '100%', height: '220px' }"
/>
</section>
</template>
<script>
import { format } from "path";
import NoContent from "@/components/bussiness/no-content";
let vm = null, chartColumn = null;
import NoContent from '@/components/bussiness/no-content';
let chartColumn = null;
export default {
components: {
NoContent
NoContent,
},
props: {
id: {
type: String,
default: "chartColumnId"
default: 'chartColumnId',
},
colors: {
type: Array,
default: () => [
"#FFB01B",
"#39AF9A",
"#5D7092",
"#FF9A4B",
"#abb7bb",
"#76d2d2"
]
'#FFB01B',
'#39AF9A',
'#5D7092',
'#FF9A4B',
'#abb7bb',
'#76d2d2',
],
},
dataList: {
tpye: Array,
default: () => []
}
type: Array,
default: () => [],
},
},
data() {
return {
chartWidth: "300px",
chartHeight: "235px",
chartWidth: '300px',
chartHeight: '235px',
xAxisData: [],
seriesData: [],
options: {
color: ['#39AF9A'],
tooltip: {
trigger: "axis",
trigger: 'axis',
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
},
formatter: '{b}完成人数{c0}人'
formatter: '{b}完成人数{c0}人',
},
// legend: {
// top: 20,
......@@ -60,123 +67,121 @@ export default {
// }
// },
grid: {
top: "10%",
left: "3%",
right: "6%",
bottom: "6%",
containLabel: true
top: '10%',
left: '3%',
right: '6%',
bottom: '6%',
containLabel: true,
},
lineStyle: {
color: "#676869"
color: '#676869',
},
yAxis: {
axisTick: false,
type: "value",
type: 'value',
minInterval: 1,
axisLabel: {
formatter: "{value}",
formatter: '{value}',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
color: '#efefef',
width: 1,
},
},
//设置网格线颜色
// 设置网格线颜色
splitLine: {
show: true,
lineStyle:{
lineStyle: {
color: ['#efefef'],
width: 1,
type: 'solid'
}
   }
type: 'solid',
},
},
},
xAxis: {
axisTick: false,
type: "category",
type: 'category',
data: [],
// data: ["其他", "中专以下", "大专", "本科", "硕士"],
textStyle: {
fontSize: 12,
color: "#676869"
color: '#676869',
},
axisLabel: {
formatter: "{value}",
formatter: '{value}',
textStyle: {
color: "#676869"
}
color: '#676869',
},
},
axisLine: {
lineStyle: {
color: "#efefef",
width: 1
}
color: '#efefef',
width: 1,
},
},
},
series: [
{
name: "考试人数",
name: '考试人数',
data: [],
// data: [120, 200, 150, 80, 70, 110, 130],
type: "bar",
barWidth: 20 //柱图宽度
}
]
type: 'bar',
barWidth: 20, // 柱图宽度
},
],
},
isShow: true
isShow: true,
};
},
watch: {
dataList: {
handler(newVal) {
if(newVal.length) {
if (newVal.length) {
this.isShow = true;
let cList = newVal.slice(0, 5);
this.xAxisData = cList.map( item => {
return item.timesStr
})
this.seriesData = cList.map( item => {
return item.count
})
const cList = newVal.slice(0, 5);
this.xAxisData = cList.map((item) => {
return item.timesStr;
});
this.seriesData = cList.map((item) => {
return item.count;
});
this.options.xAxis.data = this.xAxisData;
this.options.series[0].data = this.seriesData;
chartColumn.setOption(this.options, true);
} else {
this.isShow = false;
}
},
deep: true
}
deep: true,
},
},
created() {
if (process.client) {
let clientWidth =
const clientWidth =
window.outerWidth ||
document.body.clientWidth ||
document.documentElement.clientWidth;
this.chartWidth = (clientWidth * 0.9).toFixed(0) + 'px';
this.chartWidth = (clientWidth * 0.9).toFixed(0) + 'px';
}
},
mounted() {
vm = this;
this.drawColumn();
},
methods: {
// 绘制图表
// 绘制图表
drawColumn() {
chartColumn = this.$echarts.init(document.getElementById(this.id));
chartColumn.setOption(this.options, true);
}
}
},
},
};
</script>
<style lang="less" scoped>
<style lang="scss" scoped>
.chart-pie {
position: relative;
top: -6px;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册