Commit 207a581a by 李伟康

init

0 parents
Showing 69 changed files with 2348 additions and 0 deletions
> 1%
last 2 versions
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file \ No newline at end of file
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'staging'
build/*.js
src/assets
src/config
public
dist
module.exports = {
root: true,
env: {
node: true
},
extends: ['plugin:vue/essential', 'eslint:recommended'],
parserOptions: {
parser: 'babel-eslint'
},
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']
}
}
.DS_Store
node_modules
/dist
/docs
# 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
yarn.lock
\ No newline at end of file \ No newline at end of file
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
plugins: {
autoprefixer: {
overrideBrowserslist: ['Android 4.1', 'iOS 7.1', 'Chrome > 31', 'ff > 31', 'ie >= 8']
},
// 'postcss-pxtorem': {
// rootValue: 37.5,
// propList: ['*'],
// selectorBlackList: ['van-','ignore','ign-','.hairlines']
// },
'postcss-px-to-viewport': {
viewportWidth: 1440, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw
selectorBlackList: ['.ignore', '.hairlines', 'ign-'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false // 允许在媒体查询中转换`px`
}
}
}
\ No newline at end of file \ No newline at end of file
{
"printWidth": 200,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 120,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
File mode changed
This diff is collapsed. Click to expand it.
// 获取 VUE_APP_ENV 非 NODE_ENV,测试环境依然 console
const IS_PROD = ['production', 'prod'].includes(process.env.VUE_APP_ENV)
const plugins = [
[
'import',
{
libraryName: 'vant',
libraryDirectory: 'es',
style: true
},
'vant'
]
]
// 去除 console.log
if (IS_PROD) {
plugins.push('transform-remove-console')
}
module.exports = {
presets: [['@vue/cli-plugin-babel/preset', { useBuiltIns: 'usage', corejs: 3 }]],
plugins
}
{
"name": "gh-hall",
"version": "1.0.0",
"description": "GH Hall By Work WeChat",
"author": "limin <limin.mail@qq.com>",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"stage": "vue-cli-service build --mode staging",
"lint": "vue-cli-service lint --fix",
"dev": "npm run serve"
},
"dependencies": {
"autoprefixer": "^8.0.0",
"core-js": "^3.6.4",
"dayjs": "^1.10.5",
"echarts": "^5.3.3",
"glsx-common": "^1.4.9",
"lib-flexible": "^0.3.2",
"postcss-loader": "^6.2.0",
"sha1": "^1.1.1",
"storejs": "^1.1.0",
"vant": "^2.12.21",
"vconsole": "^3.7.0",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"webpack-spritesmith": "^1.1.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.14.1",
"postcss-px-to-viewport": "^1.1.1",
"postcss-pxtorem": "^5.1.1",
"sass-loader": "^8.0.2",
"script-ext-html-webpack-plugin": "^2.1.4",
"vue-loader": "^15.9.8",
"vue-template-compiler": "^2.6.11",
"webpack-bundle-analyzer": "^3.8.0"
}
}
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no,viewport-fit=cover">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<title>
<%= webpackConfig.name %>
</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it
to continue.</strong>
</noscript>
<div id="app"></div>
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style lang="scss"></style>
/*
* @Descripttion:API 统一外部调用入口
* @version: 1.0.0
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-17 18:23:27
*/
import wwbenchApi from './wwbenchApi'
import wxConfig from './wxConfig'
export {
wwbenchApi,
wxConfig,
}
\ No newline at end of file \ No newline at end of file
class Request {
DOMAIN = 'http://192.168.1.152:8081'
constructor(_request_) {
this.DOMAIN = _request_.baseURL
}
get (url, params, returnAll) {
return this.request('GET', url, params, returnAll)
}
post (url, params, returnAll) {
return this.request('POST', url, params, returnAll)
}
request (method, url, params, returnAll) {
return window.fetch(`/${url}`, {
headers: {
'Content-Type': 'application/json'
},
body: params,
method,
}).then(res => res.json())
}
}
export default Request
\ No newline at end of file \ No newline at end of file
const url = '/rop-scrm-wwbench/router'
export default {
/**统计我的待办数据 */
getTaskData (data = {}) {
data.method = 'scrm.api.wwbench.user.task.list.count'
return window.$HTTP({
url,
data
})
},
/** 查询我的待办 */
getTasksList (data = {}) {
data.method = 'scrm.api.wwbench.user.task.list.get'
data.taskTypes = [3, 4, 5, 6, 8]
return window.$HTTP({
url,
data,
returnAll: true
})
},
/**更新待办状态 */
updateTasks (data = {}) {
data.method = 'scrm.api.wwbench.user.task.list.update'
return window.$HTTP({
url,
data
})
}
}
@import './normalize.scss';
@import './sprite.scss';
html,
body .app {
color: #333333;
font-family: Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
background-color: #FFF;
-webkit-overflow-scrolling: touch;
height: 100%;
// overflow: hidden;
--themeColor: #3975C6;
}
img {
width: 100%;
height: 100%;
vertical-align: top;
}
.flex {
display: flex;
align-items: center;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.x-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.y-center {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.box-center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.user-select {
user-select: none;
}
.pointer {
cursor: pointer;
}
.box{
background: #1D1C1C;
}
\ No newline at end of file \ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 139px 104px;}
.icon-default-avatar { width: 44px; height: 44px; background-position: 0px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -96px -63px;}
.icon-eye { width: 13px; height: 8px; background-position: 0px -96px;}
.icon-file { width: 26px; height: 26px; background-position: -42px -54px;}
.icon-index-tips { width: 23px; height: 23px; background-position: -96px 0px;}
.icon-link { width: 32px; height: 32px; background-position: 0px -54px;}
.icon-pdf { width: 32px; height: 34px; background-position: -54px 0px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -96px -33px;}
.icon-send { width: 10px; height: 10px; background-position: -129px 0px;}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14px" height="14px" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>标题</title>
<defs>
<radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="82.6455241%" gradientTransform="translate(0.500000,0.500000),scale(1.000000,0.966292),rotate(90.000000),translate(-0.500000,-0.500000)" id="radialGradient-1">
<stop stop-color="#FFAA01" offset="0%"></stop>
<stop stop-color="#FE7200" offset="100%"></stop>
</radialGradient>
</defs>
<g id="飞机稿" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.985056559">
<g id="广汇BI设计稿" transform="translate(-28.000000, -61.000000)">
<g id="标题备份" transform="translate(24.000000, 56.000000)">
<g id="标题" transform="translate(4.000000, 5.000000)">
<rect id="矩形" x="0" y="0" width="14" height="14"></rect>
<path d="M4.0988764,1 L4.0988764,3 L3.13258427,3 L3.13258427,11 L4.0988764,11 L4.0988764,13 L1.2,13 L1.2,1 L4.0988764,1 Z M12.7955056,1 L12.7955056,13 L9.89662921,13 L9.89662921,11 L10.8629213,11 L10.8629213,3 L9.89662921,3 L9.89662921,1 L12.7955056,1 Z M6.99775281,5 C8.06508963,5 8.93033708,5.8954305 8.93033708,7 C8.93033708,8.1045695 8.06508963,9 6.99775281,9 C5.93041599,9 5.06516854,8.1045695 5.06516854,7 C5.06516854,5.8954305 5.93041599,5 6.99775281,5 Z" id="形状" fill="url(#radialGradient-1)"></path>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file \ No newline at end of file
<template>
<div class="ViewContainer">
<div class="ViewContainer-title">
<slot name="title" />
</div>
<div class="ViewContainer-body">
<slot name="content" />
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewContainer',
props: {
},
data () {
return {
}
},
mounted () { },
methods: {}
}
</script>
<style scoped lang='scss'>
.ViewContainer {
width: 100vw;
height: 100vh;
background: #0a0909;
&-title {
// height: 48px;
height: 5.85vh;
}
&-body {
// height: calc(100% - 48px);
height: 94.15vh;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="content">
<view-content-left />
<view-content-right />
</div>
</template>
<script>
export default {
name: 'ViewContent',
props: {
},
data () {
return {
}
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
position: relative;
padding: 1vh 24px 2vh;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0 24px;
&::after {
content: '';
position: absolute;
top: 1vh;
left: 50%;
transform: translateX(-50%);
background: rgba(55, 55, 57, 0.5);
width: 1px;
height: 91.2vh;
}
}
</style>
<template>
<div class="left">
<div class="top">
<view-sub-title title="集团客户总览" />
<view-tabs />
<view-pie-group />
</div>
<div class="bottom">
<view-sub-title title="销售数据总览" />
<view-pie-group />
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewContentLeft',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.left {
display: flex;
flex-direction: column;
.top {
// height: 59%;
height: 53.3vh;
}
.bottom {
// height: calc(41% - 16px);
height: 35.9vh;
margin-top: auto;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="right">
<view-sub-title title="售后数据总览" />
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewContentRight',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.right {
background: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="control">
<div class="left flex user-select pointer">
<template v-for="(i,index) in tab">
<div
:class="['item flex',index == 0?'text-center':'brand',{'active':i.active}]"
:key="index"
@click="chooseBrand(index)"
>
{{i.text}}
</div>
</template>
<div
class="options-box"
v-show="showBrand"
></div>
</div>
<div class="right y-center flex user-select pointer">
<template v-for="(i,index) in options">
<div
:key="index"
@click="choose(index)"
:class="['item text-center',{'active':reportIndex == index}]"
>
{{i}}
</div>
</template>
<div :class="['line',`line-${reportIndex}`]"></div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewControl',
data () {
return {
tab: [{ text: '广汇集团', active: true }, { text: '品牌概览' }],
options: ['日表', '月表'],
reportIndex: 1,
showBrand: false
}
},
mounted () {
},
methods: {
chooseBrand (index) {
let { tab } = this
tab.map(e => e.active = false)
tab[index].active = true
this.showBrand = index == 1
},
choose (index) {
let { reportIndex } = this
if (reportIndex == index) return
this.reportIndex = index
}
}
}
</script>
<style scoped lang='scss'>
.control {
position: relative;
.left {
width: 280px;
height: 3.9vh;
background: #383737;
border-radius: 4px;
position: relative;
.item {
font-size: 14px;
color: #eb6001;
font-weight: 600;
border-radius: 4px 0px 0px 4px;
}
.brand {
padding-left: 16px;
border-radius: 0 4px 4px 0;
}
.active {
color: #fff;
background: #eb6001;
}
.options-box {
position: absolute;
top: 32px;
right: 0;
width: 50%;
height: 30vh;
background: #383737;
border: 1px solid rgba(96, 98, 102, 1);
box-shadow: 0px 3px 2px 1px rgba(0, 0, 0, 0.5);
border-radius: 4px;
box-sizing: border-box;
z-index: 2;
}
}
.right {
width: 120px;
height: 3.4vh;
background: #383737;
border-radius: 2px;
right: -144px;
.item {
font-size: 12px;
color: #e8e8e8;
}
.active {
font-weight: 500;
font-size: 14px;
color: #eb6001;
}
.line {
border-radius: 2px;
background: #eb6001;
width: 32px;
height: 0.4vh;
position: absolute;
bottom: 0;
transform: translateX(-50%);
transition: all 0.25s;
}
.line-0 {
left: 26%;
}
.line-1 {
left: 76%;
}
}
.item {
width: 50%;
height: 100%;
box-sizing: border-box;
transition: all 0.25s;
&:hover {
opacity: 0.9;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="pie-group">
<template v-for="(i,index) in items">
<div
class="box"
:key="index"
></div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewPieGroup',
props: {},
data () {
return {
items: [1, 2, 3]
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.pie-group {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0 8px;
.box{
height: 16.6vh;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="sub-title flex user-select box">
<img src="@/assets/images/title.svg" class="logo">
<div class="text">{{title}}</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewSubTitle',
props: ['title'],
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.sub-title {
// height: 24px;
height: 2.9vh;
font-size: 14px;
line-height: 20px;
margin-bottom: .5vh;
.logo{
width: 14px;
margin: 0 4px 0 6px;
}
.text {
color: transparent;
background: linear-gradient(left, #ff6800, #f5aa01);
-webkit-background-clip: text;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="tabs">
<div class="tab">
<div class="tab-left box"></div>
<div class="tab-right box"></div>
</div>
<div class="tabs-content box">
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewTabs',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.tabs {
margin-bottom: 0.5vh;
.tab {
height: 7.8vh;
display: grid;
grid-template-columns: 41.5% 57.5%;
justify-content: space-between;
margin-bottom: 0.5vh;
}
&-content {
height: 24.4vh;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="content flex box">
<div class="logo user-select">
<img
src="@/assets/images/logo.svg"
alt="logo"
>
</div>
<div class="title flex user-select">广汇集团客户池数据大屏</div>
<div class="time">
<div class="top">{{now}}</div>
<div class="bottom">数据截止至 {{yesterday}}</div>
</div>
<div class="center-control">
<view-control />
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ViewTitle',
data () {
return {
yesterday: '',
now: new Date().format('yyyy-MM-dd hh:mm:ss')
}
},
mounted () {
this.yesterday = new Date(new Date().setDate(new Date().getDate() - 1)).format('yyyy-MM-dd')
this.timer()
},
methods: {
timer () {
setInterval(() => {
this.now = new Date().format('yyyy-MM-dd hh:mm:ss')
}, 1e3)
}
}
}
</script>
<style scoped lang='scss'>
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0 24px;
position: relative;
.title {
color: transparent;
background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
-webkit-background-clip: text;
font-size: 24px;
&::before {
content: '';
display: block;
background: #373739;
width: 1px;
height: 20px;
margin: 0 8px;
}
}
.time {
margin-left: auto;
text-align: right;
font-size: 14px;
color: #ffffff;
.bottom {
font-size: 10px;
color: #eb6001;
line-height: 16px;
}
}
.center-control {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 2;
}
}
</style>
\ No newline at end of file \ No newline at end of file
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-08 19:20:13
* @LastEditors: limin
* @LastEditTime: 2021-06-25 18:09:28
*/
import Vue from 'vue'
const componentsFiles = require.context(`./`, true, /.vue$/)
componentsFiles.keys().forEach(path => {
const component = componentsFiles(path).default
Vue.component(component.name, component)
})
\ No newline at end of file \ No newline at end of file
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-08 16:55:43
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
const environment = process.env.VUE_APP_ENV || 'production'
let config = require('./env.' + environment)
module.exports = config
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-28 10:13:38
*/
// 本地环境配置
module.exports = {
envVersion: 'trial',
title: '广汇汽车服务',
request: {
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
errId_logout_value: '21',
logout_function: 'reLogin',
code_message_map: {}
},
}
\ No newline at end of file \ No newline at end of file
module.exports = {
title: '广汇汽车服务',
request: {
// baseURL: 'http://ghwx.cgacar.com/scrm-wechat' // 生产
baseURL: 'http://cim.chinagrandauto.com/scrm-wechat' // 生产
// baseURL: 'http://cim.chinagrandauto.com' // 生产
},
APPID: 'xxx',
APPSECRET: 'xxx',
cdn: 'https://www.xxx.cn/static'
}
\ No newline at end of file \ No newline at end of file
module.exports = {
title: '广汇汽车服务',
request: {
baseURL: 'http://xxxxx' // 项目地址
},
APPID: 'xxx',
APPSECRET: 'xxx',
cdn: 'https://www.xxx.cn/static'
}
\ No newline at end of file \ No newline at end of file
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-30 11:23:25
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
let config = require('./conf.js')
let timeout = 30000 //超时时间
export const fetchConfig = function (isEnv = true) {
if (isEnv) {
let { request } = config
Object.assign(request, { timeout })
return Promise.resolve(config)
}
// /**测试mock */ return window.fetch('https://oss-config.dev.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-main-config', {}).then(res => res.json())
/**生产 */ return window.fetch('https://oss-config.test.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-main-config', {}).then(res => res.json())
}
export const cfg = {
install (vue, config) {
vue.prototype.$config = config
}
}
\ No newline at end of file \ No newline at end of file
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-29 15:35:47
*/
// 兼容 IE
// https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
// import 'core-js/stable'
// import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import api from './api'
import Request from './api/request'
import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss'
import './utils/util'
import 'components'
import { components } from '@/plugins/vant'
components.forEach(component => Vue.use(component))
Vue.prototype.api = api
Vue.prototype.to = function (name, params) {
if (name === -1) {
router.go(-1)
return
}
router.push({ name, params })
}
// 移动端适配 rem
// import 'lib-flexible/flexible.js'
Vue.config.productionTip = false
const isMock = ['prod','production'].includes(process.env.NODE_ENV)
fetchConfig(!isMock).then(res => {
console.log(res)
// 从配置服务器获取动态配置
// 设置 js中可以访问 $cdn
Vue.use(cfg)
// if (res.vconsole) new VConsole()
window.$HTTP = new Request(res.request)
window.vm = new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
})
import indexMixin from './indexMixin'
import shareMixin from './shareMixin'
export {
indexMixin,
shareMixin
}
\ No newline at end of file \ No newline at end of file
import { Notify, Dialog } from 'vant'
import { wwbenchApi, ssoApi, sopApi } from '@/api'
const { subsystemInfo, text } = window.$fetchConfig
export default {
data () {
return {
statusEnum: {
0: '去处理',
1: '处理中',
2: '已完成'
},
taskTypeEnum: {
// 1: '批量添加客户好友',
2: '直播群发任务',
3: '客户群发',
4: '客户群群发',
5: '客户资料完善',
6: '营销sop-任务',
8: '线索跟进-任务',
},
userInfo: {},
accountList: [],
tasksList: [],
taskCountData: {},
showCalendar: false,
taskType: '',
status: '',
statusOption: [
{ text: '全部', value: '' },
{ text: '待处理', value: 0 },
{ text: '处理中', value: 1 },
{ text: '已处理', value: 2 }
],
taskTypeOption: [
{ text: '全部', value: '' },
// { text: '批量添加客户好友', value: 1 },
// { text: '直播群发任务', value: 2 },
{ text: '客户群发', value: 3 },
{ text: '客户群群发', value: 4 },
{ text: '客户资料完善', value: 5 },
{ text: '营销sop', value: 6 },
{ text: '线索跟进', value: 8 }
],
list: [
{
text: '未完成任务',
key: 'unFinishTaskCount'
},
{
text: '已完成任务',
key: 'finishTaskCount'
},
{
text: '完成率',
isCanvas: true
}
],
dateRange: '',
minDate: new Date(),
maxDate: new Date(),
default_Date: null,
dateRangeFormat: 'yyyy.MM.dd',
startDate: '',
endDate: '',
tasksFlag: false
}
},
mounted () {
this.init()
},
methods: {
init () {
this.userInfo = this.getLocalStorage('dj_scrm_userInfo')
let accountList = this.getLocalStorage('dj_scrm_accountList')
if (accountList) {
accountList.map(e => {
e.text = e.merchantName
e.value = e.merchantId
})
console.log(accountList)
this.accountList = accountList
}
this.getTaskData()
this.initDate()
},
getTaskData () {
wwbenchApi.getTaskData().then(data => {
let sum = Number(data.finishTaskCount + data.unFinishTaskCount) || 0
let num = Math.round(Number((Number(data.finishTaskCount) / sum) * 100)) || 0
data.num = num
data.sum = sum
this.taskCountData = data
})
},
initDate () {
let { dateRangeFormat } = this
let now = new Date()
let minDate = new Date(new Date().setDate(now.getDate() - 30))
this.minDate = minDate
this.default_Date = [minDate, now]
let startDate = minDate.format(dateRangeFormat)
let endDate = now.format(dateRangeFormat)
this.dateRange = `${startDate}-${endDate}`
this.getTasksList({
startDate,
endDate
})
},
onConfirmCalendar (e) {
let { dateRangeFormat } = this
let [start, end] = e
let startDate = start.format(dateRangeFormat)
let endDate = end.format(dateRangeFormat)
this.dateRange = `${startDate}-${endDate}`
this.showCalendar = false
this.tasksFlag = false
this.getTasksList({
startDate,
endDate
})
},
changeType (e, target) {
let { dateRange } = this
let [startDate, endDate] = dateRange.split('-')
this[target] = e
this.tasksFlag = false
this.getTasksList({
startDate,
endDate
})
},
getTasksList ({ startDate = '', endDate = '' }) {
this.showLoading()
let { status, taskType } = this
if (startDate) startDate = `${startDate.replace(/\./g, '-')} 00:00:00`
if (endDate) endDate = `${endDate.replace(/\./g, '-')} 23:59:59`
let obj = {
status,
taskType,
startDate,
endDate
}
console.log(obj)
wwbenchApi.getTasksList(obj).then(({ code, data, message }) => {
this.hideLoading()
if (code == 0) {
this.tasksList = data
} else {
Notify(message)
}
this.tasksFlag = true
})
},
changeAccount (id) {
console.log(id)
let { accountList } = this
try {
accountList.map(e => {
if (e.value == id) throw e
})
} catch (e) {
this.showLoading('切换中...')
ssoApi
.changeLoginAccount({
loginAccount: e.accountName,
merchantId: id
})
.then(({ code, data, message }) => {
this.hideLoading()
if (code == '0') {
this.setLocalStorage('dj_scrm_userInfo', data)
console.log(data)
this.init()
} else {
Notify(message)
}
})
}
},
click (e) {
let { status, id, taskType } = e
if (status == 2 && (taskType != 6 || taskType != 8)) return
if (taskType == 6 || taskType == 8) {
this.jump(e)
} else {
wwbenchApi.updateTasks({ id }).then(res => {
if (taskType == 3 || taskType == 4) {
Dialog.alert({
message: `请去企业微信“消息”列表-“${text}”中进行转发`,
theme: 'round-button',
confirmButtonText: '我知道了',
confirmButtonColor: '#3975C6'
})
} else {
this.jump(e)
}
})
}
},
jump (e) {
let { taskId, taskType } = e
let sessionId = this.getSessionId()
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
let link = {
1: 'customerDetails',
2: 'customerGroup/mass',
5: 'customer/information',
6: 'home',
8: 'clew/detail'
}[taskType]
let { path } = subsystemInfo[{
5: 'customer',
6: 'sop',
8: 'clew'
}[taskType]]
if (link) {
if (!['prod', 'production'].includes(process.env.NODE_ENV)) path = '/dj-scrm-wx-work-main-lwk/#/'
let url = `${path}${link}?sessionId=${sessionId}&corpId=${corpId}`
if (taskId) url = `${url}&taskId=${taskId}`
window.location.href = url
}
}
}
}
import { wxConfig, marketingApi } from '@/api'
export default {
data () {
return {
entry: 'normal'
}
},
mounted () {
this.wxInit()
},
methods: {
wxInit () {
let _this = this
wxConfig.init(['getContext', 'shareAppMessage', 'shareToExternalMoments'])
},
shareToExternalMoments (i) {
this.sendMessage(i, true)
},
sendMessage (i, isPyq) {
const { shopmall_appid, envVersion } = window.$fetchConfig
const path = 'pages/psdView/psdView'
const { merchantId, uuid, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
const { entry } = this
const { materialName, id, titleUrl, materialTitle, description } = i
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}&shareTime=${Date.now()}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
wxConfig.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid,
envVersion
})
.then(link => {
this.showLoading()
if (isPyq) {
console.log('朋友圈')
wxConfig.shareToExternalMoments({
attachments: [
{
msgtype: 'link', // 消息类型,必填
link: {
title: materialTitle || materialName, // H5消息标题
imgUrl: titleUrl || imgUrl, // H5消息封面图片URL
url: link // H5消息页面url 必填
},
}
]
}).then(() => {
this.sendReadBuriedPoint({ id, merchantId, uuid })
this.hideLoading()
})
.catch(err => {
this.hideLoading()
})
} else {
let params = {
link,
title: materialTitle || materialName,
desc: description || '',
imgUrl: titleUrl || imgUrl
}
this.shareAppMessage(params, { id, merchantId, uuid })
}
})
},
sendReadBuriedPoint ({ id, merchantId, uuid }) {
marketingApi.sendReadBuriedPoint({
materialId: id,
type: 1,
merchantId,
staffUuid: uuid
})
},
shareAppMessage (params, sendParams) {
wxConfig
.shareAppMessage(params)
.then(() => {
this.sendReadBuriedPoint(sendParams)
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
}
}
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-23 11:44:59
*/
// 按需全局引入 vant组件
import {
Button,
List,
Cell,
Tabbar,
TabbarItem,
NavBar,
Lazyload,
Toast,
Search,
ActionSheet,
CellGroup,
Image as VanImage,
Tag,
Field,
Stepper,
Divider,
Step,
Steps,
NoticeBar,
RadioGroup,
Radio,
Uploader,
Tab,
Tabs,
DropdownMenu,
DropdownItem,
Grid,
GridItem,
Popup,
Calendar,
Cascader,
Checkbox,
CheckboxGroup,
Notify,
Icon,
Empty,
PullRefresh,
Picker,
Dialog
} from 'vant'
export const components = [
Button,
List,
Cell,
Tabbar,
TabbarItem,
NavBar,
Search,
ActionSheet,
CellGroup,
VanImage,
Tag,
Field,
Stepper,
Divider,
Step,
Steps,
NoticeBar,
RadioGroup,
Radio,
Uploader,
Tab,
Tabs,
DropdownMenu,
DropdownItem,
Grid,
GridItem,
Popup,
Calendar,
Cascader,
Checkbox,
CheckboxGroup,
Notify,
Icon,
Empty,
PullRefresh,
Picker,
Dialog
]
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-09 17:11:43
*/
import router from './router'
import { keeps } from './routes'
export const keepAlives = keeps
export default router
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-09 10:59:50
* @LastEditors: limin
* @LastEditTime: 2021-06-29 14:51:39
*/
import Vue from 'vue'
import Router from 'vue-router'
import routes from './routes'
// hack router push callback
const originalPush = Router.prototype.push
Router.prototype.push = function push (location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)
const router = createRouter()
function createRouter () {
return new Router({
// mode: 'history', // 如果是 history模式 需要配置vue.config.js publicPath
base: process.env.BASE_URL,
scrollBehavior: function (to, from, savedPosition) {
return savedPosition || { x: 0, y: 0 }
},
routes
})
}
// http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/
router.beforeEach((to, from, next) => {
next()
})
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter () {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router
\ No newline at end of file \ No newline at end of file
const pages = [
{
name: 'home',
meta: {
isTab: true,
keepAlive: true,
backgroundColor: '#F7F7F7'
},
children: []
}
]
const keepAlives = []
const setChildren = (e, parent) => {
let arr = []
e.children.map(child => {
const { children, meta } = child
let url = `${parent}/${child.name}`
let name = url.replace(/\//g, '.')
let route = {
path: `/${url}`,
name,
meta: meta || {},
component: resolve => require([`views/${url}.vue`], resolve)
}
if (meta && meta.keepAlive) keepAlives.push(name)
if (children) route.children = setChildren(child, url)
arr.push(route)
})
return arr
}
const getPages = _ => {
let router = {
path: '/',
name: 'home',
redirect: '/home',
component: resolve => require([`views/home.vue`], resolve),
}
router.children = pages.map(e => {
let name = `${e.name}`
let route = {
path: `/${name}`,
name,
meta: e.meta || {},
component: resolve => require([`views/${name}/index.vue`], resolve)
}
if (e.children) route.children = setChildren(e, name)
if (e.meta && e.meta.keepAlive) keepAlives.push(name)
return route
})
return [router]
}
export const keeps = keepAlives
export default getPages()
\ No newline at end of file \ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-20 12:49:54
* @FilePath: \gh-hall\src\store\getters.js
*/
const getters = {
app: state => state.app
}
export default getters
import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
// import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
app
},
getters
// plugins: [createPersistedState({
// //指定存储模式
// storage: window.sessionStorage
// })]
})
export default store
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-07-06 12:02:21
*/
const state = {
pageMeta: '',
keepAlives: [],
lastPath: ''
}
const mutations = {
SET_PAGE_META (state, meta) {
state.pageMeta = meta
},
}
const actions = {
// 设置name
setUserInfo ({ commit }, user) {
commit('SET_USER_INFO', user)
},
}
export default {
state,
mutations,
actions
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-20 12:49:11
*/
import util from './util'
export { util }
\ No newline at end of file \ No newline at end of file
import Vue from 'vue'
import {
Toast,
Dialog
} from 'vant'
/**
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/
Date.prototype.format = function(fmt) {
let o = {
'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() //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt
}
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function() {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
}
/**防止重复点击 */
const showLoading = (title = '加载中...', callBack, custom) => {
Toast({
type: 'loading',
message: title,
forbidClick: true,
duration: 0
})
if (callBack && typeof callBack == 'function') {
if (!custom) Toast.clear()
callBack()
}
}
const hideLoading = () => {
Toast.clear()
}
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow
}
const showToast = (message = '', callBack) => {
let params = {
message,
forbidClick: true,
duration: 1500
}
Toast(params)
if (callBack && typeof callBack == 'function') {
setTimeout(() => {
callBack()
}, 1500)
}
}
/**触摸样式 */
const touchstart = e => {
e.target.classList.add('btn-on-leave')
}
const touchend = e => {
e.target.classList.remove('btn-on-leave')
}
const setSessionId = val => {
window.localStorage.setItem('dj_scrm_session_id', val)
}
const getSessionId = () => {
return window.localStorage.getItem('dj_scrm_session_id')
}
const clearSessionId = () => {
window.localStorage.removeItem('dj_scrm_session_id')
}
const setLocalStorage = (key, item) => {
window.localStorage.setItem(key, JSON.stringify(item))
// sessionStorage.setItem(key, JSON.stringify(item))
}
const getLocalStorage = key => {
return JSON.parse(window.localStorage.getItem(key))
// return JSON.parse(sessionStorage.getItem(key))
}
const removeLocalStorage = key => {
window.localStorage.removeItem(key)
// sessionStorage.removeItem(key)
}
const dialog = (params = {}) => {
if (!params.confirmButtonColor) params.confirmButtonColor = '#FF7336'
return Dialog.confirm(params)
}
/**拨打电话 */
const makePhoneCall = phoneNumber => {
window.location.href = `tel://${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 // 临界判断值
result = rate > limit
return result
}
const jumpChildrenPage = (to, params) => {
let { name } = window.vm._route
window.vm.$router.push({ name: `${name}.${to}`, params })
}
/**拷贝 */
const setClipboardData = data => {
let transfer = document.createElement('input')
document.body.appendChild(transfer)
transfer.value = data
transfer.focus()
transfer.select()
if (document.execCommand('copy')) document.execCommand('copy')
transfer.blur()
Toast('内容已复制')
document.body.removeChild(transfer)
}
/**接口请求时失败让用户刷新 */
const refreshPage = (message = '系统异常') => {
return Dialog.alert({
message,
theme: 'round-button',
confirmButtonText: '点击重试',
confirmButtonColor: '#FF7336'
})
}
const toTop = () => {
let bodySrcollTop = document.body.scrollTop
if (bodySrcollTop !== 0) {
document.body.scrollTop = 0
return
}
let docSrcollTop = document.documentElement.scrollTop
if (docSrcollTop !== 0) {
document.documentElement.scrollTop = 0
}
}
const getParams = () => {
return window.vm.$route.params
}
const getQuery = (name) => {
let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {}
let param = paramsList.split('&')
let obj = {}
param.map(e => {
let [key, value] = e.split('=')
obj[key] = value
})
return name ? obj[name] : obj
}
const closeWindow = () => {
wx.closeWindow()
}
const utils = {
removeLocalStorage,
setClipboardData,
jumpChildrenPage,
setLocalStorage,
getLocalStorage,
clearSessionId,
makePhoneCall,
isFullSucreen,
setSessionId,
getSessionId,
showLoading,
closeWindow,
hideLoading,
refreshPage,
touchstart,
showToast,
getParams,
getQuery,
touchend,
throttle,
decimal,
dialog,
toTop
}
Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key]
})
export default utils
\ No newline at end of file \ No newline at end of file
<!-- home -->
<template>
<div class="container">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
</keep-alive>
</transition>
<transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view>
</transition>
</div>
</template>
<script>
export default {
data () {
return {
}
},
mounted () { },
methods: {}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="layout">
<view-container>
<template #title>
<view-title>
</view-title>
</template>
<template #content>
<view-content></view-content>
</template>
</view-container>
</div>
</template>
<script>
export default {
name: '',
data () {
return {}
},
mounted () { },
methods: {
}
}
</script>
<style lang="scss" scoped>
</style>
'use strict'
const path = require('path')
const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const resolve = dir => path.join(__dirname, dir)
// page title
const name = defaultSettings.title || 'vue mobile template'
// 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
/**
* 雪碧图插件
*/
const SpritesmithPlugin = require('webpack-spritesmith')
const spritesmithFunction = data => {
let { spritesheet, sprites } = data
let shared = `.sprite-icon { background-image: url(${data.sprites[0].image});background-size: ${spritesheet.width / 2}px ${spritesheet.height / 2}px;}`
let perSprite = sprites.map(sprite => {
let { name, width, height, offset_x, offset_y } = sprite
return `.icon-${name} { width: ${width / 2}px; height: ${height / 2}px; background-position: ${offset_x / 2}px ${offset_y / 2}px;}`
}).join('\n')
return `${shared}\n${perSprite}`
}
module.exports = {
publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router history模式使用 微信开发环境需打开
outputDir: 'dist', // 生产环境构建文件的目录
assetsDir: 'static', // outputDir的静态资源(js、css、img、fonts)目录
lintOnSave: !IS_PROD,
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
disableHostCheck: true,
port: 9527, // 端口
open: false, // 启动后打开浏览器.
public:'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-lwk/#/',
overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false,
errors: true
}
// proxy: {
// //配置跨域
// '/api': {
// target: "https://test.xxx.com",
// // ws:true,
// changOrigin:true,
// pathRewrite:{
// '^/api':'/'
// }
// }
// }
},
css: {
extract: IS_PROD, // 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
sourceMap: false,
loaderOptions: {
scss: {
// 向全局sass样式传入共享的全局变量, $src可以配置图片cdn前缀
// 详情: https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders
prependData: `
$cdn: "${defaultSettings.cdn}";
`
}
}
},
configureWebpack: config => {
config.name = name
config.resolve.modules = ['node_modules', './src/assets/spritesmith']
const Plugins = [
new SpritesmithPlugin({
// 引入图片文件夹
src: {
cwd: path.resolve(__dirname, './src/assets/spritesmith'),
glob: ['*.png', '*.jpg']
},
// 生成图片的路径
target: {
image: path.resolve(__dirname, './src/assets/images/sprite.png'),
// 生成SCSS
css: [
[path.resolve(__dirname, './src/assets/css/sprite.scss'), {
format: 'function_based_template'
}]
]
},
customTemplates: {
'function_based_template': spritesmithFunction,
},
//background引用路径
apiOptions: {
cssImageRef: '../images/sprite.png'
},
// 每个图片间距
spritesmithOptions: {
padding: 20
}
})
]
config.plugins = [...config.plugins, ...Plugins]
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
},
chainWebpack: config => {
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
// 别名 alias
config.resolve.alias
.set('@', resolve('src'))
.set('assets', resolve('src/assets'))
.set('api', resolve('src/api'))
.set('views', resolve('src/views'))
.set('components', resolve('src/components'))
.set('plugins', resolve('src/components'))
.set('utils', resolve('src/utils'))
/**
* 添加CDN参数到htmlWebpackPlugin配置中
*/
// config.plugin('html').tap(args => {
// if (IS_PROD) {
// args[0].cdn = cdn.build
// } else {
// args[0].cdn = cdn.dev
// }
// return args
// })
/**
* 设置保留空格
*/
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions.preserveWhitespace = true
return options
})
.end()
/**
* 打包分析
*/
if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [{
analyzerMode: 'static'
}])
}
config
// 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$/
}])
.end()
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
// cacheGroups 下可以可以配置多个组,每个组根据test设置条件,符合test条件的模块
commons: {
name: 'chunk-commons',
test: resolve('src/components'),
minChunks: 3, // 被至少用三次以上打包分离
priority: 5, // 优先级
reuseExistingChunk: true // 表示是否使用已有的 chunk,如果为 true 则表示如果当前的 chunk 包含的模块已经被抽取出去了,那么将不会重新生成新的。
},
node_vendors: {
name: 'chunk-libs',
chunks: 'initial', // 只打包初始时依赖的第三方
test: /[\\/]node_modules[\\/]/,
priority: 10
},
vantUI: {
name: 'chunk-vantUI', // 单独将 vantUI 拆包
priority: 20, // 数字大权重到,满足多个 cacheGroups 的条件时候分到权重高的
test: /[\\/]node_modules[\\/]_?vant(.*)/
}
}
})
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!