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 {
DOMAIN = 'http://192.168.1.152:8081'
DOMAIN = '/cwq'
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)
}
post (url, params, returnAll) {
post(url, params, returnAll) {
return this.request('POST', url, params, returnAll)
}
request (method, url, params, returnAll) {
return window.fetch(`/${url}`, {
request(method, url, params, returnAll) {
var requestConfig = {
headers: {
'Content-Type': 'application/json'
},
body: params,
method,
}).then(res => res.json())
}
}
method
}
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
export default Request
......@@ -7,9 +7,9 @@
<p :class="[ 'rank-title', rankFlag == 'last' ? 'rank-title-active' : '' ]" @click="handleRankChange('last')">后5{{ storeOrBrandTxt }}</p>
</div>
<div class="rank-block">
<div class="ramk-item" v-for="(item, index) in rankList" :key="index">
<p>{{ item.name }}</p>
<p>{{ item.num }}</p>
<div class="rank-line" v-for="(item, index) in rankList" :key="index">
<marquee class="line-item" :direction="directionTimer" :delay="delayTimer" :text="item.name"></marquee>
<p class="line-item txt-orange">{{ item.num }}</p>
</div>
</div>
</div>
......@@ -17,11 +17,11 @@
</template>
<script>
import datas from '@/utils/data'
import * as echarts from 'echarts'
import getLineOptions from './lineOptions'
export default {
name: 'LineChart',
props: {
apiName: {
type: String,
......@@ -32,13 +32,15 @@ export default {
default: '门店'
},
rankList: {
type: String,
type: Array,
default: () => []
}
},
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'first',
lineOptions: [],
xAxisLabel: {
......@@ -142,6 +144,9 @@ p {
color: #ffffff;
// padding: 4px 8px;
font-size: 0.75em;
.txt-orange {
color: #eb6001;
}
.line-chart {
width: 100%;
height: calc(100% - 3.1vh - 4.6vh);
......@@ -154,33 +159,40 @@ p {
border-top: 1px solid #373739;
.rank-title-block {
flex: 0 0 55px;
}
.rank-title {
box-sizing: border-box;
width: 100%;
font-size: 0.6em;
background: #353535;
padding: 0.2vh 5px;
height: 1.8vh;
line-height: 1.8vh;
opacity: 0.7;
cursor: pointer;
}
.rank-title-active {
opacity: 1;
color: #ffffff;
background: #eb6001;
.rank-title {
box-sizing: border-box;
width: 100%;
text-align: center;
font-size: 0.6em;
background: #353535;
padding: 0.2vh 5px;
height: 1.8vh;
line-height: 1.8vh;
opacity: 0.7;
cursor: pointer;
}
.rank-title-active {
opacity: 1;
width: 100%;
color: #ffffff;
background: #eb6001;
}
}
.rank-block {
width: calc(100% - 55px);
display: flex;
.ramk-item {
.rank-line {
box-sizing: border-box;
width: 25%;
padding: 0 6px;
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;
}
}
......
......@@ -10,14 +10,14 @@ import {
*/
Date.prototype.format = function (fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒
'S': this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
......@@ -118,7 +118,7 @@ const makePhoneCall = phoneNumber => {
const isFullSucreen = () => {
let result = false;
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
return result
}
......@@ -179,6 +179,11 @@ const closeWindow = () => {
wx.closeWindow()
}
/** 三个数字加一个逗号 */
const numAddSymbol = val => {
return (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',')
}
const utils = {
removeLocalStorage,
setClipboardData,
......@@ -202,10 +207,11 @@ const utils = {
throttle,
decimal,
dialog,
toTop
toTop,
numAddSymbol
}
Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key]
})
export default utils
\ No newline at end of file
export default utils
......@@ -13,8 +13,12 @@
</template>
<script>
import { changeMixin } from '@/mixins'
import afterApi from '@/api/afterSales'
import qs from 'qs'
export default {
name: 'File',
mixins: [changeMixin],
props: {
height: {
type: String,
......@@ -47,8 +51,33 @@ export default {
]
}
},
mounted() { },
mounted() {
// this.dealList()
},
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) {
console.log(value)
}
......
......@@ -4,9 +4,9 @@ const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const resolve = dir => path.join(__dirname, dir)
// page title
// page title
const name = defaultSettings.title || 'vue mobile template'
// 生产环境,测试和正式
// 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
module.exports = {
......@@ -18,13 +18,29 @@ module.exports = {
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
disableHostCheck: true,
host: '0.0.0.0',
port: 9527, // 端口
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: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false,
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: {
// //配置跨域
......@@ -54,14 +70,13 @@ module.exports = {
configureWebpack: config => {
config.name = name
config.resolve.modules = ['node_modules', './src/assets/spritesmith']
const Plugins = [
]
const Plugins = []
config.plugins = [...config.plugins, ...Plugins]
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
},
chainWebpack: config => {
......@@ -102,26 +117,30 @@ module.exports = {
return options
})
.end()
/**
* 打包分析
*/
/**
* 打包分析
*/
if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [{
analyzerMode: 'static'
}])
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'static'
}
])
}
config
// https://webpack.js.org/configuration/devtool/#development
// https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool('cheap-source-map'))
config.when(IS_PROD, config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/
}])
.use('script-ext-html-webpack-plugin', [
{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/
}
])
.end()
config.optimization.splitChunks({
chunks: 'all',
......@@ -150,4 +169,4 @@ module.exports = {
config.optimization.runtimeChunk('single')
})
}
}
\ 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!