Commit da9620fb by chenwq

折线图,代理

1 parent 8b606a3f
import Request from './request'
var request = new Request()
const afterApi = {
// 售后档案客户
getFile: params => {
return request.post('brand/aftersale', params)
}
}
export default afterApi
class Request { class Request {
DOMAIN = 'http://192.168.1.152:8081' DOMAIN = '/cwq'
constructor(_request_) { constructor(_request_) {
this.DOMAIN = _request_.baseURL this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN
} }
get (url, params, returnAll) { get(url, params, returnAll) {
return this.request('GET', url, params, returnAll) return this.request('GET', url, params, returnAll)
} }
post (url, params, returnAll) { post(url, params, returnAll) {
return this.request('POST', url, params, returnAll) return this.request('POST', url, params, returnAll)
} }
request (method, url, params, returnAll) { request(method, url, params, returnAll) {
return window.fetch(`/${url}`, { var requestConfig = {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: params, body: params,
method, method
}).then(res => res.json()) }
}
}
if (method === 'POST') {
Object.defineProperty(requestConfig, 'body', {
value: JSON.stringify(params)
})
}
return window
.fetch(this.DOMAIN + `/${url}`, requestConfig)
.then(res => {
return res.json()
})
.catch(error => {
alert(error)
})
}
}
export default Request
\ No newline at end of file \ No newline at end of file
export default Request
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
<p :class="[ 'rank-title', rankFlag == 'last' ? 'rank-title-active' : '' ]" @click="handleRankChange('last')">后5{{ storeOrBrandTxt }}</p> <p :class="[ 'rank-title', rankFlag == 'last' ? 'rank-title-active' : '' ]" @click="handleRankChange('last')">后5{{ storeOrBrandTxt }}</p>
</div> </div>
<div class="rank-block"> <div class="rank-block">
<div class="ramk-item" v-for="(item, index) in rankList" :key="index"> <div class="rank-line" v-for="(item, index) in rankList" :key="index">
<p>{{ item.name }}</p> <marquee class="line-item" :direction="directionTimer" :delay="delayTimer" :text="item.name"></marquee>
<p>{{ item.num }}</p> <p class="line-item txt-orange">{{ item.num }}</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
</template> </template>
<script> <script>
import datas from '@/utils/data'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import getLineOptions from './lineOptions' import getLineOptions from './lineOptions'
export default { export default {
name: 'LineChart', name: 'LineChart',
props: { props: {
apiName: { apiName: {
type: String, type: String,
...@@ -32,13 +32,15 @@ export default { ...@@ -32,13 +32,15 @@ export default {
default: '门店' default: '门店'
}, },
rankList: { rankList: {
type: String, type: Array,
default: () => [] default: () => []
} }
}, },
data() { data() {
return { return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'first', rankFlag: 'first',
lineOptions: [], lineOptions: [],
xAxisLabel: { xAxisLabel: {
...@@ -142,6 +144,9 @@ p { ...@@ -142,6 +144,9 @@ p {
color: #ffffff; color: #ffffff;
// padding: 4px 8px; // padding: 4px 8px;
font-size: 0.75em; font-size: 0.75em;
.txt-orange {
color: #eb6001;
}
.line-chart { .line-chart {
width: 100%; width: 100%;
height: calc(100% - 3.1vh - 4.6vh); height: calc(100% - 3.1vh - 4.6vh);
...@@ -154,33 +159,40 @@ p { ...@@ -154,33 +159,40 @@ p {
border-top: 1px solid #373739; border-top: 1px solid #373739;
.rank-title-block { .rank-title-block {
flex: 0 0 55px; flex: 0 0 55px;
} .rank-title {
.rank-title { box-sizing: border-box;
box-sizing: border-box; width: 100%;
width: 100%; text-align: center;
font-size: 0.6em; font-size: 0.6em;
background: #353535; background: #353535;
padding: 0.2vh 5px; padding: 0.2vh 5px;
height: 1.8vh; height: 1.8vh;
line-height: 1.8vh; line-height: 1.8vh;
opacity: 0.7; opacity: 0.7;
cursor: pointer; cursor: pointer;
} }
.rank-title-active { .rank-title-active {
opacity: 1; opacity: 1;
color: #ffffff; width: 100%;
background: #eb6001; color: #ffffff;
background: #eb6001;
}
} }
.rank-block { .rank-block {
width: calc(100% - 55px); width: calc(100% - 55px);
display: flex; display: flex;
.ramk-item { .rank-line {
box-sizing: border-box; box-sizing: border-box;
width: 25%; width: 25%;
padding: 0 6px; padding: 0 6px;
border-left: 1px solid rgba(96, 98, 102, 0.4); border-left: 1px solid rgba(96, 98, 102, 0.4);
.line-item {
height: 1.8vh;
font-size: 10px;
padding-bottom: 0.6vh;
}
} }
.ramk-item:first-child { .rank-line:first-child {
border-width: 0; border-width: 0;
} }
} }
......
...@@ -10,14 +10,14 @@ import { ...@@ -10,14 +10,14 @@ import {
*/ */
Date.prototype.format = function (fmt) { Date.prototype.format = function (fmt) {
let o = { let o = {
'M+': this.getMonth() + 1, //月份 'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日 'd+': this.getDate(), //日
'h+': this.getHours(), //小时 'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分 'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒 's+': this.getSeconds(), //秒
//季度 //季度
'q+': Math.floor((this.getMonth() + 3) / 3), 'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒 'S': this.getMilliseconds() //毫秒
}; };
if (/(y+)/.test(fmt)) { if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
...@@ -118,7 +118,7 @@ const makePhoneCall = phoneNumber => { ...@@ -118,7 +118,7 @@ const makePhoneCall = phoneNumber => {
const isFullSucreen = () => { const isFullSucreen = () => {
let result = false; let result = false;
const rate = window.screen.height / window.screen.width const rate = window.screen.height / window.screen.width
let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值 let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值
result = rate > limit result = rate > limit
return result return result
} }
...@@ -179,6 +179,11 @@ const closeWindow = () => { ...@@ -179,6 +179,11 @@ const closeWindow = () => {
wx.closeWindow() wx.closeWindow()
} }
/** 三个数字加一个逗号 */
const numAddSymbol = val => {
return (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',')
}
const utils = { const utils = {
removeLocalStorage, removeLocalStorage,
setClipboardData, setClipboardData,
...@@ -202,10 +207,11 @@ const utils = { ...@@ -202,10 +207,11 @@ const utils = {
throttle, throttle,
decimal, decimal,
dialog, dialog,
toTop toTop,
numAddSymbol
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key] Vue.prototype[key] = utils[key]
}) })
export default utils
\ No newline at end of file \ No newline at end of file
export default utils
...@@ -13,8 +13,12 @@ ...@@ -13,8 +13,12 @@
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
import afterApi from '@/api/afterSales'
import qs from 'qs'
export default { export default {
name: 'File', name: 'File',
mixins: [changeMixin],
props: { props: {
height: { height: {
type: String, type: String,
...@@ -47,8 +51,33 @@ export default { ...@@ -47,8 +51,33 @@ export default {
] ]
} }
}, },
mounted() { }, mounted() {
// this.dealList()
},
methods: { methods: {
init(val) {
// console.log(val)
var params = {
req: {
corporateGroupName: '广汇集团',
queryItem: 'file',
queryTime: '2022-06-25',
queryType: 0
}
}
afterApi.getFile(params).then(res => {
console.log(res)
})
},
// 折线图数据
getList() { },
// 排名数据
getRankList() { },
dealList() {
this.rankList.forEach(item => {
item.num = this.numAddSymbol(item.num)
})
},
handleRankChange(value) { handleRankChange(value) {
console.log(value) console.log(value)
} }
......
...@@ -4,9 +4,9 @@ const defaultSettings = require('./src/config/conf.js') ...@@ -4,9 +4,9 @@ const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const resolve = dir => path.join(__dirname, dir) const resolve = dir => path.join(__dirname, dir)
// page title // page title
const name = defaultSettings.title || 'vue mobile template' const name = defaultSettings.title || 'vue mobile template'
// 生产环境,测试和正式 // 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV) const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
module.exports = { module.exports = {
...@@ -18,13 +18,29 @@ module.exports = { ...@@ -18,13 +18,29 @@ module.exports = {
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: { devServer: {
disableHostCheck: true, disableHostCheck: true,
host: '0.0.0.0',
port: 9527, // 端口 port: 9527, // 端口
open: false, // 启动后打开浏览器. open: false, // 启动后打开浏览器.
public:'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-lwk/#/', // public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-lwk/#/',
overlay: { overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层 // 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false, warnings: false,
errors: true errors: true
},
proxy: {
'/cwq': {
target: 'http://192.168.1.152:8081',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/cwq': ''
},
onProxyReq: (proxyReq, req, res) => {
// console.log(`原路径:${req.originalUrl}`)
// console.log(`代理路径:${req.url}`)
console.log(proxyReq)
}
}
} }
// proxy: { // proxy: {
// //配置跨域 // //配置跨域
...@@ -54,14 +70,13 @@ module.exports = { ...@@ -54,14 +70,13 @@ module.exports = {
configureWebpack: config => { configureWebpack: config => {
config.name = name config.name = name
config.resolve.modules = ['node_modules', './src/assets/spritesmith'] config.resolve.modules = ['node_modules', './src/assets/spritesmith']
const Plugins = [ const Plugins = []
]
config.plugins = [...config.plugins, ...Plugins] config.plugins = [...config.plugins, ...Plugins]
// 为生产环境修改配置... // 为生产环境修改配置...
// if (IS_PROD) { // if (IS_PROD) {
// // externals // // externals
// config.externals = externals // config.externals = externals
// } // }
}, },
chainWebpack: config => { chainWebpack: config => {
...@@ -102,26 +117,30 @@ module.exports = { ...@@ -102,26 +117,30 @@ module.exports = {
return options return options
}) })
.end() .end()
/** /**
* 打包分析 * 打包分析
*/ */
if (IS_PROD) { if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [{ config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
analyzerMode: 'static' {
}]) analyzerMode: 'static'
}
])
} }
config config
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool('cheap-source-map')) .when(!IS_PROD, config => config.devtool('cheap-source-map'))
config.when(IS_PROD, config => { config.when(IS_PROD, config => {
config config
.plugin('ScriptExtHtmlWebpackPlugin') .plugin('ScriptExtHtmlWebpackPlugin')
.after('html') .after('html')
.use('script-ext-html-webpack-plugin', [{ .use('script-ext-html-webpack-plugin', [
// 将 runtime 作为内联引入不单独存在 {
inline: /runtime\..*\.js$/ // 将 runtime 作为内联引入不单独存在
}]) inline: /runtime\..*\.js$/
}
])
.end() .end()
config.optimization.splitChunks({ config.optimization.splitChunks({
chunks: 'all', chunks: 'all',
...@@ -150,4 +169,4 @@ module.exports = { ...@@ -150,4 +169,4 @@ module.exports = {
config.optimization.runtimeChunk('single') config.optimization.runtimeChunk('single')
}) })
} }
}
\ No newline at end of file \ No newline at end of file
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!