Commit 5a28b6ca by 无尘

add clique project

parent 3f0cca6f
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}
# 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
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
# gicfront
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
publicPath: '../../', //注意: 此处根据路径, 自动更改
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'components': resolve('src/components'),
'view': resolve('src/view')
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.scss$/,
loaders: ["style", "css", "scss", "sass"]
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true,
favicon: './favicon.ico'
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path');
const proxyConfig = require('./proxyList');
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},//proxyConfig.proxyList,
// Various Dev Server settings
// host: '0.0.0.0', // can be overwritten by process.env.HOST
host: 'localhost',//'192.168.1.20',//
port: 8001, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}
'use strict'
module.exports = {
NODE_ENV: '"production"'
}
module.exports = {
proxyList: {
'/api-auth/': {
target: 'http://gicdev.demogic.com/api-auth/',
changeOrigin: true,
pathRewrite: {
'^/api-auth': ''
}
},
'/api-admin/': {
target: 'http://gicdev.demogic.com/api-admin/',
changeOrigin: true,
pathRewrite: {
'^/api-admin': ''
}
},
'/api-plug/': {
target: 'http://gicdev.demogic.com/api-plug/',
changeOrigin: true,
pathRewrite: {
'^/api-plug': ''
}
},
'/api-mall/': {
target: 'http://gicdev.demogic.com/api-mall/',
changeOrigin: true,
pathRewrite: {
'^/api-mall': ''
}
}
}
}
File added
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="./favicon.ico">
<title>GIC-集团后台</title>
</head>
<body style="background-color: #f0f2f5;min-width: 1400px;">
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "gicfront",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "hexiaoxia",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
"dependencies": {
"@gic-test/vue-area-ab": "^1.4.3",
"@gic-test/vue-gic-aside-menu": "^1.1.41",
"@gic-test/vue-gic-footer": "^1.0.8",
"@gic-test/vue-gic-header": "^1.3.28",
"@riophae/vue-treeselect": "0.0.29",
"@tinymce/tinymce-vue": "^1.0.8",
"element-ui": "^2.3.9",
"file-saver": "^1.3.8",
"script-loader": "^0.7.2",
"tinymce": "^4.8.0",
"vue": "^2.5.2",
"vue-clipboard2": "^0.2.0",
"vue-router": "^3.0.1",
"xlsx": "^0.13.0"
},
"devDependencies": {
"@antv/data-set": "^0.8.9",
"@antv/g2": "^3.1.0",
"autoprefixer": "^7.1.2",
"axios": "^0.18.0",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.11",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"node-notifier": "^5.1.2",
"node-sass": "^4.9.0",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"sass-loader": "^7.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-axios": "^2.1.1",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
<template>
<div id="app">
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
</div>
</template>
<script>
export default {
name: 'App',
data() {
return {
}
}
}
</script>
<style>
</style>
import Vue from 'vue'
import axios from 'axios';
import qs from 'qs';
import {Message} from 'element-ui'
Vue.axios.defaults.timeout = 15000;
var local = window.location.origin;
if (local.indexOf('localhost')!= -1) {
local = 'http://gicdev.demogic.com';
}
console.log(local)
Vue.axios.interceptors.request.use(config=> {
console.log(local)
return config;
}, err=> {
Message.error({message: '请求超时!'});
return Promise.resolve(err);
})
Vue.axios.interceptors.response.use(data=> {
console.log("response data:",data)
if (data.status && data.status == 200 && data.data.status == 'error') {
Message.error({message: data.data.msg});
return;
}
return data;
}, err=> {
console.log("response err:",err);
Message.error({message: err.response.message});
if (err.response.status == 504||err.response.status == 404) {
// window.location.href= local + "/gic-web/#/"
// Message.error({message: '服务异常⊙﹏⊙∥'});
} else if (err.response.status == 403) {
// window.location.href= local + "/gic-web/#/"
// Message.error({message: '权限不足,请联系管理员!'});
}else {
// window.location.href= local + "/gic-web/#/"
// Message.error({message: '未知错误!'});
}
return Promise.resolve(err);
})
// var localhost = window.location.protocol +'//'+ window.location.host
// console.log(localhost)
// let base = local + '/gicweb/cloudweb/';
const timeout = 15000;
let token = '';//sessionStorage.getItem('user');
/*
*
* 统一 get 请求方法
* @url: 请求的 url
* @params: 请求带的参数
* @header: 带 token
*
*/
export const getRequest = (url, params) => {
params.requestProject = "gic-clique";
return Vue.axios({
method: 'get',
url: `${local}${url}`,
data: {},
params: params,
headers: {'content-type': 'application/x-www-form-urlencoded'},// "token": token
});
}
/*
*
* 统一 post 请求方法
* url: 请求的 url
* @params: 请求带的参数
* @header: 带 token
*
*/
export const postRequest = (url, params) => {
params.requestProject = "gic-clique";
return Vue.axios({
method: 'post',
url: `${local}${url}`,
data: qs.stringify(params),
// params: params,
// paramsSerializer: function(params) {
// return QS.stringify(params, {arrayFormat: 'brackets'})
// },
// transformRequest: [function (data) {
// // Do whatever you want to transform the data
// console.log(data)
// data = JSON.stringify(data)
// return data;
// }],
// transformRequest: [
// function (data) { // 解决传递数组变成对象的问题
// Object.keys(data).forEach((key) => {
// if ((typeof data[key]) === 'object') {
// data[key] = JSON.stringify(data[key]) // 这里必须使用内置JSON对象转换
// }
// })
// data = qs.stringify(data) // 这里必须使用qs库进行转换
// return data
// }
// ],
headers: {'content-type': 'application/x-www-form-urlencoded'} //multipart/form-data{"token": token}
});
}
export const postJsonRequest = (url, params) => {
params.requestProject = "gic-clique";
return Vue.axios({
method: 'post',
url: `${local}${url}`,
data: "{}",
params: params,
// paramsSerializer: function(params) {
// return QS.stringify(params, {arrayFormat: 'brackets'})
// },
// transformRequest: [function (data) {
// // Do whatever you want to transform the data
// console.log(data)
// data = JSON.stringify(data)
// return data;
// }],
// transformRequest: [
// function (data) { // 解决传递数组变成对象的问题
// Object.keys(data).forEach((key) => {
// if ((typeof data[key]) === 'object') {
// data[key] = JSON.stringify(data[key]) // 这里必须使用内置JSON对象转换
// }
// })
// data = qs.stringify(data) // 这里必须使用qs库进行转换
// return data
// }
// ],
// withCredentials: true,
// credentials: 'same-origin',
headers: {'Content-Type': 'application/json;charset=UTF-8'} //multipart/form-data{"token": token}
});
}
/*
* method: 'post'
* 'Content-Type': 'application/json;charset=UTF-8'
* @data: params
* @requestProject: 'gic-clique'
*
*/
export const postJson = (url, params) => {
// params.requestProject = "gic-clique";
return Vue.axios({
method: 'post',
url: `${local}${url}`,
data: params,
params: {requestProject:'gic-clique'},
// withCredentials: true,
// credentials: 'same-origin',
headers: {'Content-Type': 'application/json;charset=UTF-8'} //multipart/form-data{"token": token}
});
}
/*
* method: 'post'
* data: params
*
*/
export const postForm = (url, params) => {
params.requestProject = "gic-clique";
return Vue.axios({
method: 'post',
url: `${local}${url}`,
data: params,
// params: params,
// paramsSerializer: function(params) {
// return QS.stringify(params, {arrayFormat: 'brackets'})
// },
// transformRequest: [function (data) {
// // Do whatever you want to transform the data
// console.log(data)
// data = JSON.stringify(data)
// return data;
// }],
// transformRequest: [
// function (data) { // 解决传递数组变成对象的问题
// Object.keys(data).forEach((key) => {
// if ((typeof data[key]) === 'object') {
// data[key] = JSON.stringify(data[key]) // 这里必须使用内置JSON对象转换
// }
// })
// data = qs.stringify(data) // 这里必须使用qs库进行转换
// return data
// }
// ],
headers: {} //'content-type': 'application/x-www-form-urlencoded'multipart/form-data{"token": token}
});
}
import * as api from './api';
export default api;
This source diff could not be displayed because it is too large. You can view the blob instead.
/* eslint-disable */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'));
} else {
// Browser globals
factory({}, root.echarts);
}
}(this, function (exports, echarts) {
var log = function (msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg);
}
};
if (!echarts) {
log('ECharts is not Loaded');
return;
}
var colorPalette = [
'#2ec7c9','#b6a2de','#5ab1ef','#ffb980','#d87a80',
'#8d98b3','#e5cf0d','#97b552','#95706d','#dc69aa',
'#07a2a4','#9a7fd1','#588dd5','#f5994e','#c05050',
'#59678c','#c9ab00','#7eb00a','#6f5553','#c14089'
];
var theme = {
color: colorPalette,
title: {
textStyle: {
fontWeight: 'normal',
color: '#008acd'
}
},
visualMap: {
itemWidth: 15,
color: ['#5ab1ef','#e0ffff']
},
toolbox: {
iconStyle: {
normal: {
borderColor: colorPalette[0]
}
}
},
tooltip: {
backgroundColor: 'rgba(50,50,50,0.5)',
axisPointer : {
type : 'line',
lineStyle : {
color: '#008acd'
},
crossStyle: {
color: '#008acd'
},
shadowStyle : {
color: 'rgba(200,200,200,0.2)'
}
}
},
dataZoom: {
dataBackgroundColor: '#efefff',
fillerColor: 'rgba(182,162,222,0.2)',
handleColor: '#008acd'
},
grid: {
borderColor: '#eee'
},
categoryAxis: {
axisLine: {
lineStyle: {
color: '#008acd'
}
},
splitLine: {
lineStyle: {
color: ['#eee']
}
}
},
valueAxis: {
axisLine: {
lineStyle: {
color: '#008acd'
}
},
splitArea : {
show : true,
areaStyle : {
color: ['rgba(250,250,250,0.1)','rgba(200,200,200,0.1)']
}
},
splitLine: {
lineStyle: {
color: ['#eee']
}
}
},
timeline : {
lineStyle : {
color : '#008acd'
},
controlStyle : {
normal : { color : '#008acd'},
emphasis : { color : '#008acd'}
},
symbol : 'emptyCircle',
symbolSize : 3
},
line: {
smooth : true,
symbol: 'emptyCircle',
symbolSize: 3
},
candlestick: {
itemStyle: {
normal: {
color: '#d87a80',
color0: '#2ec7c9',
lineStyle: {
color: '#d87a80',
color0: '#2ec7c9'
}
}
}
},
scatter: {
symbol: 'circle',
symbolSize: 4
},
map: {
label: {
normal: {
textStyle: {
color: '#d87a80'
}
}
},
itemStyle: {
normal: {
borderColor: '#eee',
areaColor: '#ddd'
},
emphasis: {
areaColor: '#fe994e'
}
}
},
graph: {
color: colorPalette
},
gauge : {
axisLine: {
lineStyle: {
color: [[0.2, '#2ec7c9'],[0.8, '#5ab1ef'],[1, '#d87a80']],
width: 10
}
},
axisTick: {
splitNumber: 10,
length :15,
lineStyle: {
color: 'auto'
}
},
splitLine: {
length :22,
lineStyle: {
color: 'auto'
}
},
pointer : {
width : 5
}
}
};
echarts.registerTheme('macarons', theme);
}));
/* 后台返回消息提示 */
import { Message } from 'element-ui';
// 后台返回异常提示
export default {
errorMsg: function(response) {
var local = window.location.origin;
if (local.indexOf('localhost')) {
local = 'http://gicdev.demogic.com';
}
console.log(response)
if (response.errorCode != 0) {
if (response.errorCode == 401) {
window.location.href = local + "/gic-web/#/";
return false;
}
Message.error({
duration: 1000,
message: response.message
})
}
}
}
/* 消息提示 */
import { Message } from 'element-ui';
export default {
showmsg: function(msg,type) {
Message({
duration: 1000,
message: msg,
type: type
})
}
};
/*
* 判断字符长度
* @param: str
*/
export default {
/*
* 一个汉字算两个字符,一个英文字母或数字算一个字符
*/
getByteLen: function(val) {
var len = 0;
for (var i = 0; i < val.length; i++) {
var a = val.charAt(i);
if (a.match(/[^\x00-\xff]/ig) != null) {
len += 2;
}
else {
len += 1;
}
}
return len;
},
/*
* 一个汉字算一个字,一个英文字母或数字算半个字
*/
getZhLen: function (val) {
var len = 0;
for (var i = 0; i < val.length; i++) {
var a = val.charAt(i);
if (a.match(/[^\x00-\xff]/ig) != null) {
len += 1;
}
else {
len += 0.5;
}
}
return Math.ceil(len);
},
/*暂无用*/
cutStr: function(str, len,type){
var char_length = 0;
for (var i = 0; i < str.length; i++){
var son_str = str.charAt(i);
if(type==1) {
encodeURI(son_str).length > 2 ? char_length += 1 : char_length += 0.5;
}
if(type==2) {
char_length += 1 ;
}
if (char_length >= len){
var sub_len = char_length == len ? i+1 : i;
return str.substr(0, sub_len);
}
}
},
/*
* 限制字数用, 一个汉字算一个字,两个英文/字母算一个字
*/
getByteVal: function(val, max) {
var returnValue = '';
var byteValLen = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null)
byteValLen += 1;
else
byteValLen += 0.5;
if (byteValLen > max)
break;
returnValue += val[i];
}
return returnValue;
},
/*
* 限制字符数用, 一个汉字算两个字符,一个英文/字母算一个字符
*/
getCharVal: function (val, max) {
var returnValue = '';
var byteValLen = 0;
for (var i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null)
byteValLen += 2;
else
byteValLen += 1;
if (byteValLen > max)
break;
returnValue += val[i];
}
return returnValue;
},
/*
* 正则校验,校验非负数字
*/
regPos: function(v) {
var regTest = /^\d+(\.\d+)?$/;
return regTest.test(v);
}
}
\ No newline at end of file
/*
* 时间日期转换
* @param: "10:00-22:00"/ new Date()
*/
export default {
/*
* var storeBusinessTime="10:00-22:00" to
*/
timeToDate: function(val) {
var date = new Date()
var y = date.getFullYear();
var m = date.getMonth() +1;
var day = date.getDate();
var d = [],newArr = [];
var dArr = val.split('-');
dArr.forEach(function(ele,index){
newArr.push(ele.split(':'))
})
d = [new Date(y,m,day,newArr[0][0],newArr[0][1]),new Date(y,m,day,newArr[1][0],newArr[1][1])]
return d;
},
dateToTime(val) {
console.log(val)
// (0-9)年月数字的显示
function formatDig(num) {
return num > 9 ? '' + num : '0' + num;
}
var t;
var t1 = formatDig(new Date(val[0]).getHours())+':'+formatDig(new Date(val[0]).getMinutes())
var t2 = formatDig(new Date(val[1]).getHours())+':'+formatDig(new Date(val[1]).getMinutes())
t= t1+'-'+t2
return t;
}
}
var SIGN_REGEXP = /([yMdhsm])(\1*)/g;
var DEFAULT_PATTERN = 'yyyy-MM-dd';
function padding(s, len) {
var len = len - (s + '').length;
for (var i = 0; i < len; i++) { s = '0' + s; }
return s;
};
export default {
getQueryStringByName: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
var context = "";
if (r != null)
context = r[2];
reg = null;
r = null;
return context == null || context == "" || context == "undefined" ? "" : context;
},
formatDate: {
format: function (date, pattern) {
pattern = pattern || DEFAULT_PATTERN;
return pattern.replace(SIGN_REGEXP, function ($0) {
switch ($0.charAt(0)) {
case 'y': return padding(date.getFullYear(), $0.length);
case 'M': return padding(date.getMonth() + 1, $0.length);
case 'd': return padding(date.getDate(), $0.length);
case 'w': return date.getDay() + 1;
case 'h': return padding(date.getHours(), $0.length);
case 'm': return padding(date.getMinutes(), $0.length);
case 's': return padding(date.getSeconds(), $0.length);
}
});
},
parse: function (dateString, pattern) {
var matchs1 = pattern.match(SIGN_REGEXP);
var matchs2 = dateString.match(/(\d)+/g);
if (matchs1.length == matchs2.length) {
var _date = new Date(1970, 0, 1);
for (var i = 0; i < matchs1.length; i++) {
var _int = parseInt(matchs2[i]);
var sign = matchs1[i];
switch (sign.charAt(0)) {
case 'y': _date.setFullYear(_int); break;
case 'M': _date.setMonth(_int - 1); break;
case 'd': _date.setDate(_int); break;
case 'h': _date.setHours(_int); break;
case 'm': _date.setMinutes(_int); break;
case 's': _date.setSeconds(_int); break;
}
}
return _date;
}
return null;
}
}
};
export default {
name: "salesanalysis",
data() {
return {
tableData: [{
id: 'aaa',
name: '门店1',
remarks: '测试',
validity: '2018-05-21',
store: '门店1',
stock: '222'
}],
radio: '',
page: {
current_page: 1,
page_size: 10,
total: 100
},
dialogCardVisible: false
}
},
props: {
dialogStoreVisible: {
type: Boolean,
default: false
}
},
watch: {
dialogStoreVisible: function (val) {
if(val) {
this.dialogCardVisible = true;
}
}
},
methods: {
closeDialog() {
this.radio = '';
this.$emit('cancleHandle','')
},
cancle(){
this.radio = '';
this.dialogCardVisible = false;
this.$emit('cancleHandle','')
},
handleCurrentChange(val) {
this.page.current_page = val;
},
sureCard() {
if(!this.radio) {
this.$message({
type: 'warnning',
message: '请选择门店'
});
return false;
}else {
this.dialogCardVisible = false;
this.$emit('cancleHandle',this.radio);
}
},
getList() {
//动态获取数据
}
},
created() {
this.getList();
},
mounted() {
}
}
<template>
<div>
<!--弹框-->
<el-dialog
title="门店选择"
@close="closeDialog"
:visible.sync="dialogCardVisible"
width="600px">
<div class="dialogwrap">
<div class="dialogcontent">
<el-radio-group v-model="radio" style="width: 100%;">
<el-table ref="singleTable" :data="tableData">
<el-table-column width="33" prop="id">
<template scope="scope">
<el-radio fill="red" :label="scope.row.id"></el-radio>
</template>
</el-table-column>
<el-table-column prop="name" label="门店名称"></el-table-column>
<el-table-column prop="remarks" label="门店代码"></el-table-column>
</el-table>
</el-radio-group>
<div class="page">
<el-pagination
@current-change="handleCurrentChange"
:current-page="page.current_page"
:page-size="page.page_size"
layout="prev, pager, next"
:total="page.total">
</el-pagination>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="sureCard">确 定</el-button>
<el-button @click="cancle">取 消</el-button>
</span>
</el-dialog>
<!--弹框end-->
</div>
</template>
<script>
module.exports = require('./dialog')
</script>
<style lang="less" scoped>
.dialogwrap{
position: relative;
&:before{
position: absolute;
left: -20px;
top: -20px;
right: -20px;
content: '';
border-bottom: 1px solid #dedede;
}
}
.dialogcontent{
padding: 0 10px;
}
.cue{
margin-bottom: 20px;
text-indent: 2rem;
}
.el-radio__label{
color: transparent;
}
.el-radio__input.is-checked+.el-radio__label{
color: transparent;
}
.page{
margin: 20px 0;
text-align: right;
}
</style>
<template>
<div>
<el-row>
<el-col style="width: 230px;">
<el-select v-model="value" @change="changeStore" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-col>
<el-col style="width: 240px;" v-show="groupwrap">
<div class="groupwrap" @click="showGroup">
<div class="groupselect">
{{groupvalue}}
<i class="el-icon-arrow-down grouparrow" :class="{arrowrotate: showGroupTree}"></i>
</div>
<div class="grouptree" v-show="showGroupTree">
<el-tree @check="checkedStore" :data="data" show-checkbox node-key="id" :default-expanded-keys="[1]" :props="defaultProps">
</el-tree>
</div>
</div>
</el-col>
<el-col style="width: 240px;" v-show="partstore">
<el-select v-model="partvalue" @change="changePartStore" multiple filterable remote reserve-keyword placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
name: "store",
data() {
return {
options: [{
value: 'allstore',
label: '所有门店'
},{
value: 'groupstore',
label: '门店分组'
},{
value: 'partstore',
label: '部分门店'
}],
value: '',
groupvalue: '已选择0个门店分组',
selectgroup: '',
groupwrap: false,
showGroupTree:false,
data: [{
id: 1,
label: '一级 1',
children: [{
id: 4,
label: '二级 1-1',
children: [{
id: 9,
label: '三级 1-1-1'
}, {
id: 10,
label: '三级 1-1-2'
}]
}]
}],
defaultProps: {
children: 'children',
label: 'label'
},
partstore: false,
partvalue: '',
options4: [],
list: [],
loading: false,
states: ["Alabama", "Alaska", "Arizona","Arkansas"],
}
},
methods: {
changePartStore() {
this.$emit('selectStore',{
type: 'partstore',
stores: this.partvalue
})
},
remoteMethod(query) {
this.list = this.states.map(item => {
return { value: item, label: item };
});
if (query !== '') {
this.loading = true;
setTimeout(() => {
this.loading = false;
this.options4 = this.list.filter(item => {
return item.label.toLowerCase()
.indexOf(query.toLowerCase()) > -1;
});
}, 200);
} else {
this.options4 = [];
}
},
checkedStore(Nodes,Keys) {
let count = Keys.checkedKeys.length;
this.groupvalue = `已选择${ count }个门店分组`;
this.selectgroup = Keys.checkedKeys;
this.$emit('selectStore',{
type: 'groupstore',
stores: this.selectgroup
})
},
getStore() {
//获取门店树
},
changeStore() {
if(this.value == 'allstore') {
this.$emit('selectStore',{
type: 'allstore',
stores: ''
})
this.groupwrap = false;
this.partstore = false;
}else if(this.value == 'groupstore') {
this.groupwrap = true;
this.partstore = false;
this.$emit('selectStore',{
type: 'groupstore',
stores: this.selectgroup
})
}else {
if(this.value == 'partstore') {
this.partstore = true;
this.$emit('selectStore',{
type: 'partstore',
stores: this.options4
})
}
this.groupwrap = false;
}
},
showGroup() {
this.showGroupTree = !this.showGroupTree;
}
},
created() {
this.getStore();
},
mounted() {
}
}
</script>
<style lang="less" scoped>
.groupselect{
position: relative;
width: 240px;
height: 40px;
line-height: 40px;
font-size: 14px;
border: 1px solid #ddd;
box-sizing: border-box;
border-radius: 4px;
text-indent: 10px;
background-color: #fff;
cursor: pointer;
color: #606266;
}
.grouparrow{
position: absolute;
right: 10px;
bottom: 12px;
transition: all .3s;
}
.arrowrotate{
transform-origin: 65% 50%;
transform: rotateZ(-180deg);
}
.grouptree{
min-height: 100px;
margin-top: 12px;
padding: 10px 20px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);;
background-color: #fff;
border: 1px solid #eee;
color: #606266;
}
</style>
<template>
<div>
<a @click="showDialog">会员分析</a>
<v-dialog :dialogVisible="show" @cancleHandle="cancleHandle">
</v-dialog>
<div style="margin: 100px 100px;">
<v-selectStore @selectStore="selectStore"></v-selectStore>
</div>
</div>
</template>
<script>
import vDialog from 'components/com/dialog.vue'
import vSelectStore from 'components/com/selectStore.vue'
export default {
name: "salesanalysis",
data() {
return {
show: false,
curraido: '',
}
},
methods: {
showDialog() {
this.show = true;
},
cancleHandle(radio) {
this.show = false;
if(radio) {
this.curraido = radio;
console.log(this.curraido);
}
},
selectStore(stores) {
console.log(stores);
}
},
created() {
},
mounted() {
},
components: {
vDialog,
vSelectStore
}
}
</script>
<style>
</style>
module.exports = (parantfile,file) => (r) => {
import('components/'+ parantfile + '/' + file + '.vue').then((module) => {
r(module)
})
}
<template>
<div class="loginwrap" :style="{height: imgHeight + 'px'}">
<div style="position: absolute;left: 0;height: 0;width: 100%;">
<canvas id="loginwrap" :width="imgWidth" :height="imgHeight"></canvas>
</div>
<div class="logintop">
<div class="fl loginlogo">
<a class="fr logo" href="#">login_logo.png</a>
</div>
<a class="home-link fr" href="http://www.demogic.com/">返回首页</a>
</div>
<div class="login_contetnt">
<h3 class="login-top">让信息连接一切</h3>
<h4 class="login-bottom">GIC商户后台</h4>
<div class="formlogin">
<el-form ref="form" :model="form" label-width="">
<el-form-item label="">
<el-input class="forminput" v-model="form.loginName" placeholder="账号"></el-input>
</el-form-item>
<el-form-item label="">
<el-input v-model="form.password" type="password" placeholder="密码" @keyup.enter.native="submitLogin('form')"></el-input>
</el-form-item>
<el-form-item>
<button class="submit" @click.prevent="submitLogin('form')">立即登录</button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
let qs = require('qs');
import * as types from '../../store/types'
import { checkSuccess,checkFalse,checkStatus } from '../../../static/js/checkStatus'
import { setCookie,getCookie } from '../../../static/js/cookie'
export default {
name: "login",
data() {
return {
redirect: this.$route.query.redirect,
token: '',
form: {
loginName: 'damogic',
password: '1',
eid: 'ff808081593917d90159398ec6340012'
}
}
},
computed: {
imgHeight() {
return document.body.clientHeight
},
imgWidth() {
return document.body.clientWidth
}
},
methods: {
loginAnimate() {
let animate = new LoginAnimate(loginwrap,{
length: 90,
LineWeight: 0.1,
clicked:true,
moveon:true
});
animate.Run();
},
submitLogin(){
this.axios.post('/api-auth/do-login',qs.stringify({
loginName: this.form.loginName,
password: this.form.password,
eid: 'ff808081593917d90159398ec6340012'
})).then(res => {
if(res.data.success) {
checkSuccess(res.data.message);
let redirect = decodeURIComponent(this.$route.query.redirect || '/index');
this.$router.push({
path: redirect
})
}else {
checkFalse(res.data.message);
}
}).catch(err => {
checkStatus(err);
})
},
getMenu() {
this.axios.get('/gic/get-menu').then(res => {
if(res.data.success) {
this.menuList = res.data.list;
sessionStorage.setItem('menuList',JSON.stringify(this.menuList));
// let tempArr = [];
// this.menuList.forEach(item => {
// item.rightDTOs.forEach(i => {
// let a = {
// path: '/'+ i.rtcode,
// name: i.rtname,
// component: _import(i.parentRtcode,i.rtcode)
// };
// tempArr.push(a);
// })
// });
//
// let c = [
// {
// path: '/index',
// name: '总览',
// component: _import('index','index'),
// children: tempArr
// }
// ]
// let a = [
// {
// path: '/storeAdd',
// name: '门店新增',
// component: _import('index','index'),
// children: tempArr
// }
// ];
// console.log(c);
// this.$router.addRoutes(c);
let redirect = this.$route.query.redirect || '/index';
this.$router.push({
path: redirect
})
}else {
checkFalse(res.data.errorMessage);
}
}).catch(err => {
checkStatus(err);
})
}
},
mounted() {
this.$store.commit(types.TITLE,'login');
document.title = this.$store.state.title;
this.loginAnimate();
},
}
</script>
<style lang="less">
.loginwrap{
position: relative;
width: 100%;
background: url("./login_bg.jpg") no-repeat center center;
overflow: hidden;
text-align: center;
.logo {
display: block;
float: left;
margin-left: 100px;
width: 150px;
height: 80px;
background: url("login_logo.png") no-repeat left center;;
text-indent: -999px;
}
.logintop{
width: 100%;
height: 80px;
position: relative;
z-index: 2;
}
.home-link {
width: 80px;
height: 32px;
margin-top: 23px;
margin-right: 135px;
border-radius: 0;
text-align: center;
font-size: 14px;
line-height: 32px;
color: rgba(255, 255, 255, .6);
border: 1px solid #fede29;
background: 0 0;
}
}
.login_contetnt {
width: 350px;
margin: 0 auto;
}
.login-top {
position: relative;
z-index: 1;
font-size: 24px;
font-weight: normal;
color: #FFFFFF;
margin: 70px 0 20px;
}
.login-bottom {
position: relative;
z-index: 1;
font-size: 16px;
font-weight: normal;
color: #fede29;
margin-bottom: 40px;
}
.login-bottom {
position: relative;
z-index: 1;
font-size: 16px;
font-weight: normal;
color: #fede29;
margin-bottom: 40px;
}
.formlogin {
position: relative;
z-index: 3;
width: 350px;
margin: 0 auto;
.el-input__inner{
font-size: 14px;
margin-bottom: 10px;
font-weight: 100;
width:100%;
height: 46px;
line-height: 14px;
text-indent: 15px;
border-radius: 0;
background: rgba(0, 0, 0, .5);
border: 1px solid transparent;
color: #fff;
background-image: none;
&:focus{
border: 1px solid #fede29;
}
}
}
.submit {
width: 100%;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 16px;
margin-top: 30px;
margin-bottom: 36px;
color: #000;
outline: 0;
border: 0;
background-color: #fede29;
cursor: pointer;
&:hover{
background-color: #fcd916;
}
}
</style>
<template>
<div>
<!--弹框-->
<el-dialog
title="添加适用单品"
:visible.sync="dialogGoodsVisible"
width="516px"
:before-close="handleClose">
<div class="dialogwrap">
<div class="good-input">
<el-input v-model="goodsInput" placeholder="请输入商品货号,多个货号之间用空格隔开"></el-input>
<el-button class="add-btn" @click="addGoods">添加</el-button>
</div>
<div class="good-clear">
<div class="flex-1">已添加{{goodsList.length}}件商品</div>
<el-button class="flex-1" type="text" @click="delGoods">全部清除</el-button>
</div>
<div class="good-list">
<ul class="goods-ul">
<li v-for="(item,index) in goodsList">
<img :src="item.goodsImg" :alt="item.name"/>
<div class="good-info">
<div class="good-name">{{item.name}}</div>
<div class="good-num">{{item.googsNum}}</div>
</div>
</li>
</ul>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirm">确 定</el-button>
<el-button @click="cancle">取 消</el-button>
</span>
</el-dialog>
<!--弹框end-->
</div>
</template>
<script>
import { getRequest } from '../../api/api';
export default {
name: "add-goods",
props:{
goodShow: Boolean,
projectName: String
},
data() {
return {
dialogGoodsVisible: false, // 默认隐藏
goodsInput: '', //输入框
repProjectName: 'gic-clique', //当前所在项目名
// 商品列表
goodsList: [
{
id: '1',
name: '长裤ESS70305261',
googsNum: 'ESS70222169',
goodsImg: 'https://pic01-10001430.image.myqcloud.com/d8ef8432-2aed-4fa6-ab7c-a54b1e58f7ff'
},
{
id: '2',
name: '长裤ESS70305261',
googsNum: 'ESS70222169',
goodsImg: 'https://pic01-10001430.image.myqcloud.com/d8ef8432-2aed-4fa6-ab7c-a54b1e58f7ff'
},
{
id: '3',
name: '长裤ESS70305261',
googsNum: 'ESS70222169',
goodsImg: 'https://pic01-10001430.image.myqcloud.com/d8ef8432-2aed-4fa6-ab7c-a54b1e58f7ff'
},
{
id: '4',
name: '长裤ESS70305261',
googsNum: 'ESS70222169',
goodsImg: 'https://pic01-10001430.image.myqcloud.com/d8ef8432-2aed-4fa6-ab7c-a54b1e58f7ff'
}
]
}
},
methods: {
// 确定
confirm() {
var that = this
// 触发父组件返回添加商品
that.$emit('selectGoods')
},
// 关闭
handleClose(){
var that = this
that.cancle();
},
// 取消
cancle() {
var that = this
that.$confirm('确认关闭?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: ''
}).then(() => {
console.log("点击确认")
that.$emit('selectGoods')
}).catch(() => {
console.log("取消 取消关闭")
});
},
// 添加
addGoods() {
var that = this
that.goodsList.push({})
},
// 清除
delGoods() {
var that = this
that.goodsList = []
}
},
watch: {
goodShow: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.dialogGoodsVisible = newData
},
projectName: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.repProjectName = newData || 'gic-clique';
},
},
created() {
// this.selectReplayStyle()
console.log('create1')
},
beforeMount() {
console.log('beforeMount1')
},
/* 接收数据 */
mounted(){
var that = this;
// 项目名
that.repProjectName = that.projectName || 'gic-clique';
that.dialogGoodsVisible = that.goodShow;
},
}
</script>
<style lang="less" scoped>
.el-dialog__wrapper {
/deep/ .el-dialog__body {
padding: 15px 0px;
}
}
.dialogwrap{
position: relative;
&:before{
position: absolute;
left: 0px;
top: -15px;
right: 0px;
content: '';
border-bottom: 1px solid #dedede;
}
.good-input {
margin-bottom: 15px;
padding: 0 15px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.el-input {
width: 384px;
}
.add-btn {
margin-left: 5px;
}
.good-clear {
display: flex;
justify-content: space-between;
height: 30px;
line-height: 30px;
padding: 0 15px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: #F5F6FA;
.flex-1 {
flex: 1;
&+.flex-1 {
text-align: right;
}
}
}
.good-list {
height: 300px;
padding: 0 15px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
overflow-y: auto;
}
.goods-ul {
li {
display: flex;
border-bottom: 1px solid #e6eaeb;
position: relative;
cursor: pointer;
padding: 10px 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
img {
width: 58px;
height: 58px;
vertical-align: middle;
margin-right: 10px;
}
.good-info {
display: flex;
flex-direction: column;
justify-content: flex-start;
div {
flex: 1;
display: flex;
align-items: center;
}
}
}
}
}
</style>
<template>
<div class="input-line-cell">
<el-input class="w-340" v-model="itemValue" placeholder="" :disabled="disableInput==0? false: true" @focus="inputFocus(c3Index)" @keyup.native="(value) => toInput(value)"></el-input>
<span class="tip"><span class="len_span">{{inputNum}}</span>/{{limitLength}}</span>
</div>
</template>
<script>
import strLength from '@/common/js/strlen';
export default {
name: "addinput",
props: {
childItem: String, // 传入是不是 k303(原C3)
childIndex: Number, // 传入的 k303(原C3) 索引
titleName: String, //传入的标题子段
inputValue: String, // 传入 input value
maxLength: Number, // 限制长度
disFlag: Number, // 禁用标志,0: false,1: true
child: String, // 传入的子级标题
},
data() {
return {
inputNum: 0,
limitLength: 10,
itemValue: '',
disableInput: false,
c3Flag: '',
c3Index: '',
titleFlag: '',
childFlag: '',
}
},
methods: {
inputFocus(num) {
var that = this
console.log(num)
},
// 输入
toInput: function(value) {
var that = this;
console.log(value)
var temp = '';
var temp = strLength.getByteVal(value.target.value,that.limitLength)
// console.log(temp)
that.itemValue= temp.trim()
that.inputNum = strLength.getZhLen(that.itemValue);
// 如果是子级
if (!!that.childFlag) {
var obj = {}
obj.child = that.childFlag
obj.value = that.itemValue;
if (that.titleFlag == 'title') {
obj.title = that.titleFlag;
}
if (that.c3Flag == 'k303') {
obj.c3Index = that.c3Index;
obj.flag = that.c3Flag;
}
that.$emit('itemInput',obj)
return;
}
// 如果是标题
if (that.titleFlag == 'title') {
var obj = {}
obj.value = that.itemValue;
obj.title = that.titleFlag;
that.$emit('itemInput',obj)
return;
}
// console.log(that.inputNum )
if (that.c3Flag == 'k303') {
var obj = {}
obj.value = that.itemValue;
obj.flag = that.c3Flag;
obj.c3Index = that.c3Index;
that.$emit('itemInput',obj)
return;
}
that.$emit('itemInput',that.itemValue)
},
},
watch: {
maxLength: function(newData,oldData){
var that = this;
that.limitLength = newData
},
inputValue: function(newData,oldData){
var that = this;
that.itemValue = newData
that.inputNum = strLength.getZhLen(that.itemValue)
},
disFlag: function(newData,oldData){
var that = this;
that.disableInput = newData
},
childItem: function(newData,oldData){
var that = this;
that.c3Flag = newData
},
childIndex: function(newData,oldData){
var that = this;
that.c3Index = newData
},
titleName: function(newData,oldData){
var that = this;
that.titleFlag = newData
},
child: function(newData,oldData){
var that = this;
that.childFlag = newData
},
},
/* 接收数据 */
mounted(){
var that = this;
console.log(that.childIndex)
that.limitLength = that.maxLength;
that.itemValue = that.inputValue || '';
that.inputNum = strLength.getZhLen(that.inputValue);
that.disableInput = that.disFlag || 0;
that.c3Flag = that.childItem || '';
that.c3Index = that.childIndex==0? 0: that.childIndex;
that.titleFlag = that.titleName
that.childFlag = that.child
},
}
</script>
<style lang="less" scoped>
.input-line-cell {
display: inline-block;
}
.w-340 {
width: 340px;
/deep/ .el-input__inner {
font-size: 12px;
color: #fff;
background-color: rgba(255,255,255,.1);
}
}
.el-input {
/deep/ .el-input__inner {
font-size: 12px;
color: #fff;
background-color: rgba(255,255,255,.1);
}
.is-disabled{
/deep/ .el-input__inner {
font-size: 12px;
color: #fff;
background-color: rgba(255,255,255,.1);
}
}
}
.edit-item {
color:#fff;
.tip {
margin-left: -47px;
color: rgba(255,255,255,0.7);
width: 30px;
display: inline-block;
text-align: right;
margin-right: 10px;
font-size: 12px;
}
}
</style>
<!--
安装 tinymce
$ npm install @tinymce/tinymce-vue -S
npm install tinymce -S
安装之后,在 node_modules 中找到 tinymce/skins 目录,然后将 skins 目录拷贝到 static 目录下
文中所有 static 目录相关都这样处理
tinymce 默认是英文界面,所以还需要下载一个中文语言包:
中文:https://tinymce-services.azurewebsites.net/1/i18n/download?langs=zh_CN
然后将这个语言包放到 static 目录下,为了结构清晰,包一层 tinymce 目录
static
|____tinymce
|___skins
|___zh_CN.js
<tinymce-edit ref="tinymceWrap" :bodyHtml="ruleForm.gradeDescribe" :projectName="projectName"></tinymce-edit>
import tinymceEdit from 'components/memberShip/tinymce-edit'
公共上传图片请求方法
/*
* method: 'post'
* data: params
*
*/
export const postForm = (url, params) => {
params.requestProject = "gic-clique";
return Vue.axios({
method: 'post',
url: `${local}${url}`,
data: params,
headers: {}
});
}
引入路径修改成自己的路径
-->
<template>
<div class="tinymce-contain">
<editor id='tinymce' v-model='tinymceHtml' :init='init'></editor>
</div>
</template>
<script>
import { getRequest,postForm } from '../../api/api';
import tinymce from 'tinymce/tinymce'
import 'tinymce/themes/modern/theme'
import Editor from '@tinymce/tinymce-vue'
import 'tinymce/plugins/image'
import 'tinymce/plugins/link'
import 'tinymce/plugins/code'
import 'tinymce/plugins/table'
import 'tinymce/plugins/lists'
import 'tinymce/plugins/contextmenu'
import 'tinymce/plugins/wordcount'
import 'tinymce/plugins/colorpicker'
import 'tinymce/plugins/textcolor'
export default {
name: "tinymce-edit",
props: ["bodyHtml",'projectName'],
data() {
return {
// tinymce
tinymceHtml: '请输入内容',
init: {
language_url: 'static/tinymce/zh_CN.js',
language: 'zh_CN',
skin_url: 'static/tinymce/skins/lightgray',
height: 300,
// 图片上传
// without images_upload_url set, Upload tab won't show up
// images_upload_url: '',
// images_upload_base_path: '/some/basepath',
images_upload_credentials: true, //是否应传递cookie等跨域的凭据
// images_upload_handler提供三个参数:blobInfo, success, failure
images_upload_handler: (blobInfo, success, failure)=>{
console.log(blobInfo)
this.handleImgUpload(blobInfo, success, failure)
},
// 添加插件
plugins: 'link lists image code table colorpicker textcolor wordcount contextmenu',
toolbar:
'bold italic underline strikethrough | fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote | undo redo | link unlink image code | removeformat',
branding: false,
setup: function(editor) {
// 点击编辑框回调
editor.on('click', function(e) {
console.log('Editor was clicked');
});
}
}
}
},
methods: {
// 上传图片
handleImgUpload (blobInfo, success, failure) {
var that = this
let formdata = new FormData()
formdata.set('upload_file', blobInfo.blob())
formdata.set("requestProject",that.repProjectName);
console.log(formdata)
postForm('/api-plug/upload-img', formdata).then(res => {
success(res.data.result[0].qcloudImageUrl)
}).catch(res => {
console.log(res)
failure('error')
})
},
},
watch: {
projectName: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.repProjectName = newData || 'gic-web';
},
bodyHtml: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.tinymceHtml = newData;
},
},
components: {
Editor
},
mounted() {
var that = this
tinymce.init({});
that.tinymceHtml = that.bodyHtml;
}
}
</script>
<style lang="less" scoped >
.tinymce-contain {
width: 890px;
/deep/ .mce-tinymce {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: 1px solid #dcdfe6;
}
/deep/ .mce-panel {
border: 0px solid #dcdfe6;
}
}
</style>
<template>
<div class="edit-dialog-wrap">
<el-dialog
title="完成订单评价"
:visible.sync="dialogEdit"
width="600px"
:before-close="handleEditClose"
>
<div class="edit-dialog-body">
<div class="edit-row">
<el-radio v-model="acceptData.radio" label="0">固定奖励</el-radio>
<span class="pad-l-10">获得</span><el-input v-model="acceptData.point" placeholder="" @keyup.native="($event,value) => numInput($event,value)" type="tel" :maxlength="inputLength"></el-input><span class="pad-l-10">积分/笔</span>
</div>
<div class="edit-row">
<el-radio v-model="acceptData.radio" label="1">按金额设置</el-radio>
<span class="pad-l-10">订单实付金额每满 </span>
<el-input v-model="acceptData.money" placeholder="" @keyup.native="($event,value) => moneyInput($event,value)" type="tel" :maxlength="inputLength"></el-input>
<span>元,得</span>
<el-input v-model="acceptData.moneyPoint" placeholder="" @keyup.native="($event,value) => moneyPointInput($event,value)" type="tel" :maxlength="inputLength"></el-input>
<span class="pad-l-10">积分</span>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogEditcancel">取 消</el-button>
<el-button type="primary" @click="dialogEditConfirm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import { getRequest } from './api';
import strLength from './../../common/js/strlen';
import qs from 'qs';
export default {
name: 'edit-dialog',
props: ['showEditDialog','projectName','transData'],
data () {
return {
repProjectName: 'gic-web', // 项目名
acceptData: {
radio: '1',
point: '',
money: 10,
moneyPoint: 10
}, //接收的数据
dialogEdit: false,
inputLength: 6
}
},
methods:{
// 输入框输入
numInput(e,r){
var that = this
console.log(e,r)
// 过滤非数字
that.inputNum = strLength.getCharVal(e.target.value.replace(/[^\d]/g,''),that.inputLength)
that.acceptData.point = that.inputNum
},
// 输入框输入
moneyInput(e,r){
var that = this
console.log(e,r)
// 过滤非数字
that.moneyInputNum = strLength.getCharVal(e.target.value.replace(/[^\d]/g,''),that.inputLength)
that.acceptData.money = that.moneyInputNum
},
// 输入框输入
moneyPointInput(e,r){
var that = this
console.log(e,r)
// 过滤非数字
that.moneyNum = strLength.getCharVal(e.target.value.replace(/[^\d]/g,''),that.inputLength)
that.acceptData.moneyPoint = that.moneyNum
},
// 设置接收参数
setNewData(flag) {
var that = this;
that.dialogEdit = flag;
console.log("弹框是否显示: ",flag)
},
// 检查编辑弹窗
checkEditPoint() {
var that = this
if (!that.acceptData.point) {
that.$message.error({
duration: 1000,
message: "请输入积分,且不能小于等于0"
})
return false;
}else{
return true;
}
},
checkEditMoney() {
var that = this
if (!that.acceptData.money || !that.acceptData.moneyPoint) {
that.$message.error({
duration: 1000,
message: "请输入金额和积分,且不能小于等于0"
})
return false;
}else{
return true;
}
},
// 确认
dialogEditConfirm() {
var that = this;
console.log("确认",that.acceptData.radio)
if (that.acceptData.radio == 0) {
console.log(0)
if(!that.checkEditPoint()){
return;
}else {
console.log(1,that.acceptData)
that.$emit('setEdit',that.acceptData)
}
}else {
console.log(1)
if(!that.checkEditMoney()){
return;
}else {
console.log(2)
that.$emit('setEdit',that.acceptData)
}
}
},
handleEditClose() {
var that = this;
that.dialogEditcancel();
},
// 取消
dialogEditcancel() {
var that = this;
that.$confirm('确认关闭?', '', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: ''
}).then(() => {
console.log("点击确认")
that.radio = null;
that.dialogEdit = false;
that.$emit('setEdit')
}).catch(() => {
console.log("取消 取消关闭")
});
},
// 获取卡券列表
getCardList() {
var that = this
var para = {
currentPage: that.cardCurrentPage,
pageSize: that.cardPageSize,
searchParam: that.searchText,
requestProject: that.repProjectName,
cardLimitType: '',
cardTypes: '',
}
that.axios.post('/api-plug/get-coupon-list',{})
.then((res) => {
console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
return;
}
that.$message.error({
duration: 1000,
message: error.message
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
})
});
}
},
watch: {
showEditDialog: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.setNewData(newData)
},
projectName: function(newData,oldData){
var that = this;
// console.log("新数据:",newData,oldData)
that.repProjectName = newData || 'gic-web';
},
transData: function(newData,oldData){
var that = this;
newData.radio = String(newData.radio)
that.acceptData = newData;
},
},
/* 接收数据 */
mounted(){
console.log("传递的参数对象:",this.showEditDialog)
var that = this;
// 项目名
that.repProjectName = that.projectName || 'gic-web';
that.transData.radio = String(that.transData.radio)
that.acceptData = that.transData;
that.setNewData(that.showEditDialog)
},
}
</script>
<style lang="scss" scoped>
.edit-dialog-wrap {
.pad-l-10 {
padding-left: 10px;
}
.pad-r-10 {
padding-right: 10px;
}
.el-input {
width: 60px;
padding: 0 10px;
}
.edit-row{
&+.edit-row {
margin-top: 10px;
}
}
}
</style>
<template>
<div class="navwrap boxbttom">
<el-breadcrumb separator="/">
<template v-for="item in navpath">
<template v-if="!!item.path">
<!-- <el-breadcrumb-item :data-v="item.path" :to="{ path: item.path }">{{ item.name }}</el-breadcrumb-item> -->
<el-breadcrumb-item :to="{ path: item.path }" @click="changeRoute(item.path)"><span class="el-breadcrumb__inner is-link" @click="changeRoute(item.path)">{{ item.name }}</span></el-breadcrumb-item>
</template>
<template v-else>
<el-breadcrumb-item>{{ item.name }}</el-breadcrumb-item>
</template>
</template>
<!-- :to="{ path: item.path}"-->
</el-breadcrumb>
<h1 class="navtitle">{{ navpath[navpath.length - 1].name }}</h1>
<div class="navtip navmTop" v-if="navtip == true"><i class="el-icon-info navtipcolor"></i>变更导航个数,移动顺序,更换页面链接均需提交小程序审核后重新发布生效,其他变更立即生效。小程序审核请联系品牌项目经理。</div>
</div>
</template>
<script>
import { getRequest, postRequest, postJsonRequest, postForm } from '@/api/api';
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';
export default {
name: "navpath",
data() {
return {
projectName: 'gic-clique', // 当前项目名
navpath: [
{
name: '首页',
path: ''
},
{
name: '',
path: ''
},
{
name: '',
path: ''
},
],
}
},
props: {
// navpath: {
// type: Array,
// default: []
// },
navtip: {
type: Boolean,
default: false
}
},
methods: {
changeRoute(path) {
var that = this
console.log(path)
that.$router.push(path)
},
// get nav path
getNavPath() {
var that = this
var para = {
project: that.projectName,
path: that.$route.path.split('/')[1]
}
postRequest('/api-auth/get-current-memu-data',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
if (!resData.result) {
console.log("resData.result: ",resData.result)
return;
}
that.navpath = [];
if (!!resData.result.list&&!!resData.result.list.length) {
resData.result.list.forEach(function(ele,index){
ele.name = ele.menuName
ele.path = ''
if (index == (resData.result.list.length-1)) {
ele.path = '/'+ ele.menuUrl
}
if (index>0) {
that.navpath.push(ele)
}
})
// that.navpath = resData.result.list
}
console.log("///>>>>",that.navpath)
// that.navpath[0].name = resData.result.level2.menuName;
// that.navpath[0].path = ''
// that.navpath[1].name = resData.result.level3.menuName;
// that.navpath[1].path = ''
// if (!!resData.result.level4) {
// that.navpath[2] = {
// name:'',
// path: ''
// }
// that.navpath[2].name = resData.result.level4.menuName;
// that.navpath[2].path = ''
// }
return;
}
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
})
});
}
},
mounted() {
var that = this
that.getNavPath();
}
}
</script>
<style scoped>
.navwrap{
padding: 20px 24px;
/*margin-top: 20px;*/
background-color: #fff;
border-radius: 2px;
}
.boxbttom{
border-bottom: 1px solid #e4e7ed;
}
.boxshow {
border-bottom: 1px solid #e4e7ed;
box-shadow: 5px -1px 5px #dfdfdf;
}
.navtitle{
margin: 24px 0 0 0;
font-size: 20px;
color: #303133;
font-weight:700;
}
.navtip{
width: 100%;
height: 38px;
line-height: 38px;
font-size: 13px;
border-radius: 2px;
color: #606266;
background-color: #f4f4f5;
}
.navmTop{
margin-top: 25px;
}
.navtipcolor{
margin: 0 12px;
color: #409eff;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner, .el-breadcrumb__item:last-child .el-breadcrumb__inner a, .el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover, .el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
font-weight: 700;
text-decoration: none;
cursor: pointer;
color: #303133;
}
</style>
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI ,{ Message } from 'element-ui'
import VueAxios from 'vue-axios'
import axios from 'axios'
import store from './store/store'
import * as types from './store/types'
import '../static/css/index.less'
import 'element-ui/lib/theme-chalk/index.css'
import '../static/font/iconfont.css'
import vueGicHeader from '@gic-test/vue-gic-header'
import vueGicAsideMenu from '@gic-test/vue-gic-aside-menu'
import vueAreaAb from '@gic-test/vue-area-ab'
// 新增公共 footer插件
import vueGicFooter from '@gic-test/vue-gic-footer'
Vue.use(vueGicFooter)
Vue.use(vueAreaAb)
Vue.use(vueGicAsideMenu)
Vue.use(vueGicHeader)
Vue.config.productionTip = false;
Vue.use(ElementUI,{size: 'large'});
Vue.use(VueAxios,axios);
Vue.axios.defaults.withCredentials = true ;// 跨域cookie访问
Vue.axios.interceptors.request.use(
config => {
return config;
},
err => {
console.log('requesterr' + err);
return Promise.reject(err);
});
Vue.axios.interceptors.response.use(
response => {
console.log("main:",response);
if(response.status == 200 && response.data.errorCode == 1) {
// router.replace({
// path: 'login',
// query: {redirect: router.currentRoute.fullPath}
// })
console.log("main:",response);
}
return response;
},
error => {
console.log(error);
if (error.response) {
switch (error.response.status) {
case 401:
// 401 清除token信息并跳转到登录页面
// store.commit(types.LOGOUT);
// router.replace({
// path: 'login',
// query: {redirect: router.currentRoute.fullPath}
// });
window.location.href = window.location.origin + '/gic-web/#/';
case 500:
Message.error('服务器500')
}
}
return Promise.reject(error.response.data)
});
// router.beforeEach((to, from, next) => {
// console.log("")
// if (window.location.pathname.slice(-1) !== '/') {
// window.location = window.location.pathname + '/';
// }
// })
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
});
module.exports = (parantfile,file) => (r) => {
import('view/'+ parantfile + '/' + file + '.vue').then((module) => {
r(module)
})
}
import Vue from 'vue'
import Router from 'vue-router'
import _import from './_import.js'
Vue.use(Router);
const error401 = (r) => {
import('view/errorPage/401.vue').then((module) => {
r(module)
})
};
const error404 = (r) => {
import('view/errorPage/404.vue').then((module) => {
r(module)
})
};
// 页面刷新时,重新赋值token
if (window.sessionStorage.getItem('token')) {
store.commit(types.LOGIN, window.sessionStorage.getItem('token'))
}
export const constantRouterMap = [
{
path: '/',
name: 'index',
component: _import('index','index'),
children: [
// 集团后台
// 配置中心
{
path: '/companyGroup',
name: '集团信息',
component: _import('companyGroup/membershipSystem','companyGroupInfo')
},
{
path: '/memberCardSet',
name: '会员卡设置',
component: _import('companyGroup/membershipSystem','memberCardSet')
},
{
path: '/memberGrade',
name: '会员等级列表',
component: _import('companyGroup/membershipSystem','memberGrade')
},
{
path: '/addMemberGrade',
name: '添加等级列表',
component: _import('companyGroup/membershipSystem','addMemberGrade')
},
{
path: '/editMemberGrade',
name: '编辑等级列表',
component: _import('companyGroup/membershipSystem','editMemberGrade')
},
{
path: '/addGroupGrade',
name: '添加集团会员等级',
component: _import('companyGroup/membershipSystem','addGroupGrade')
},
{
path: '/editGroupGrade',
name: '编辑集团会员等级',
component: _import('companyGroup/membershipSystem','editGroupGrade')
},
{
path: '/addGroupCate',
name: '添加集团折扣策略',
component: _import('companyGroup/membershipSystem','addGroupCate')
},
{
path: '/editGroupCate',
name: '编辑集团折扣策略',
component: _import('companyGroup/membershipSystem','editGroupCate')
},
{
path: '/pointSystem',
name: '积分制度',
component: _import('companyGroup/membershipSystem','pointSystem')
},
{
path: '/addPointSystem',
name: '新增积分获取策略',
component: _import('companyGroup/membershipSystem','addPointSystem')
},
{
path: '/editPointSystem',
name: '编辑积分获取策略',
component: _import('companyGroup/membershipSystem','editPointSystem')
},
{
path: '/addIntegralSytem',
name: '新增积分抵现策略',
component: _import('companyGroup/membershipSystem','addIntegralSytem')
},
{
path: '/editIntegralSytem',
name: '编辑积分抵现策略',
component: _import('companyGroup/membershipSystem','editIntegralSytem')
},
{
path: '/nearStoreSet',
name: '附近门店',
component: _import('companyGroup/membershipSystem','nearStoreSet')
},
{
path: '/memberAchievement',
name: '会员成就',
component: _import('companyGroup/memberServices','memberAchievement')
},
{
path: '/memberTask',
name: '会员任务',
component: _import('companyGroup/memberServices','memberTask')
}
]
},
{
path: '/memberInfoTemplate',
name: '开卡字段配置模板',
component: _import('companyGroup/membershipSystem','memberInfoTemplate')
},
{
path: '/login',
name: '集团商户登录',
component: _import('companyGroup','login')
},
{
path: '/401',
name: '无权访问',
component: error401
},
{
path: '/404',
name: 'error404',
component: error404
},
{ path: '*', redirect: '/404', hidden: true },
];
export default new Router({
// mode:'history',
routes: constantRouterMap,
scrollBehavior: () => ({ y: 0 }),
})
import Vuex from 'vuex'
import Vue from 'vue'
import * as types from './types'
Vue.use(Vuex);
export default new Vuex.Store({
state: {
user: {},
token: null,
title: '',
show: false
},
mutations: {
[types.LOGIN]: (state, data) => {
sessionStorage.token = data;
state.token = data;
},
[types.LOGOUT]: (state) => {
sessionStorage.removeItem('token');
state.token = null
},
[types.TITLE]: (state, data) => {
state.title = data;
},
[types.SHOW]: (state,data) => {
state.show = data;
}
}
})
export const LOGIN = 'login';
export const LOGOUT = 'logout';
export const TITLE = 'title';
export const SHOW = 'show';
import Vue from 'vue'
import Clipboard from 'clipboard'
function clipboardSuccess() {
Vue.prototype.$message({
message: 'Copy successfully',
type: 'success',
duration: 1500
})
}
function clipboardError() {
Vue.prototype.$message({
message: 'Copy failed',
type: 'error'
})
}
export default function handleClipboard(text, event) {
const clipboard = new Clipboard(event.target, {
text: () => text
})
clipboard.on('success', () => {
clipboardSuccess()
clipboard.off('error')
clipboard.off('success')
clipboard.destroy()
})
clipboard.on('error', () => {
clipboardError()
clipboard.off('error')
clipboard.off('success')
clipboard.destroy()
})
clipboard.onClick(event)
}
/*设置cookie*/
export function setCookie(c_name,value,expire) {
var date=new Date();
date.setSeconds(date.getSeconds()+expire);
document.cookie = c_name + "="+ encodeURI(value)+"; expires="+date.toGMTString();
}
/*获取cookie*/
export function getCookie(c_name){
if(document.cookie.length>0){
var name = encodeURI(c_name);
var allcookies = document.cookie;
name += "=";
var pos = allcookies.indexOf(name);
if(pos != -1){
var start = pos + name.length;
var end = allcookies.indexOf(";",start);
if(end == -1){
end = allcookies.length;
}
var value = allcookies.substring(start,end);
return decodeURI(value);
} else{
return "";
}
}
}
/*删除cookie*/
export function delCookie(c_name){
setCookie(c_name, "", -1);
}
/**
* Created by jiachenpan on 17/3/8.
*/
export default function createUniqueString() {
const timestamp = +new Date() + ''
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
return (+(randomNum + timestamp)).toString(32)
}
/**
* Created by jiachenpan on 16/11/18.
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if (('' + time).length === 10) time = parseInt(time) * 1000
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
export function formatTime(time, option) {
time = +time * 1000
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000
if (diff < 30) {
return '刚刚'
} else if (diff < 3600) { // less 1 hour
return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
return '1天前'
}
if (option) {
return parseTime(time, option)
} else {
return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
}
}
// 格式化时间
export function getQueryObject(url) {
url = url == null ? window.location.href : url
const search = url.substring(url.lastIndexOf('?') + 1)
const obj = {}
const reg = /([^?&=]+)=([^?&=]*)/g
search.replace(reg, (rs, $1, $2) => {
const name = decodeURIComponent($1)
let val = decodeURIComponent($2)
val = String(val)
obj[name] = val
return rs
})
return obj
}
/**
*get getByteLen
* @param {Sting} val input value
* @returns {number} output value
*/
export function getByteLen(val) {
let len = 0
for (let i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null) {
len += 1
} else { len += 0.5 }
}
return Math.floor(len)
}
export function cleanArray(actual) {
const newArray = []
for (let i = 0; i < actual.length; i++) {
if (actual[i]) {
newArray.push(actual[i])
}
}
return newArray
}
export function param(json) {
if (!json) return ''
return cleanArray(Object.keys(json).map(key => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' +
encodeURIComponent(json[key])
})).join('&')
}
export function param2Obj(url) {
const search = url.split('?')[1]
if (!search) {
return {}
}
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
}
export function html2Text(val) {
const div = document.createElement('div')
div.innerHTML = val
return div.textContent || div.innerText
}
export function objectMerge(target, source) {
/* Merges two objects,
giving the last one precedence */
if (typeof target !== 'object') {
target = {}
}
if (Array.isArray(source)) {
return source.slice()
}
Object.keys(source).forEach((property) => {
const sourceProperty = source[property]
if (typeof sourceProperty === 'object') {
target[property] = objectMerge(target[property], sourceProperty)
} else {
target[property] = sourceProperty
}
})
return target
}
export function scrollTo(element, to, duration) {
if (duration <= 0) return
const difference = to - element.scrollTop
const perTick = difference / duration * 10
setTimeout(() => {
console.log(new Date())
element.scrollTop = element.scrollTop + perTick
if (element.scrollTop === to) return
scrollTo(element, to, duration - 10)
}, 10)
}
export function toggleClass(element, className) {
if (!element || !className) {
return
}
let classString = element.className
const nameIndex = classString.indexOf(className)
if (nameIndex === -1) {
classString += '' + className
} else {
classString = classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length)
}
element.className = classString
}
export const pickerOptions = [
{
text: '今天',
onClick(picker) {
const end = new Date()
const start = new Date(new Date().toDateString())
end.setTime(start.getTime())
picker.$emit('pick', [start, end])
}
}, {
text: '最近一周',
onClick(picker) {
const end = new Date(new Date().toDateString())
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date(new Date().toDateString())
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date(new Date().toDateString())
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
} else {
return new Date(new Date().toDateString())
}
}
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result
const later = function() {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
// 上次被包装函数被调用时间间隔last小于设定时间间隔wait
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last)
} else {
timeout = null
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args)
if (!timeout) context = args = null
}
}
}
return function(...args) {
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
// 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait)
if (callNow) {
result = func.apply(context, args)
context = args = null
}
return result
}
}
export function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'shallowClone')
}
const targetObj = source.constructor === Array ? [] : {}
Object.keys(source).forEach((keys) => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = source[keys].constructor === Array ? [] : {}
targetObj[keys] = deepClone(source[keys])
} else {
targetObj[keys] = source[keys]
}
})
return targetObj
}
/**
*Created by jiachenpan on 16/11/29.
* @param {Sting} url
* @param {Sting} title
* @param {Number} w
* @param {Number} h
*/
export default function openWindow(url, title, w, h) {
// Fixes dual-screen position Most browsers Firefox
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height
const left = ((width / 2) - (w / 2)) + dualScreenLeft
const top = ((height / 2) - (h / 2)) + dualScreenTop
const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left)
// Puts focus on the newWindow
if (window.focus) {
newWindow.focus()
}
}
import axios from 'axios'
import { Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
// create an axios instance
const service = axios.create({
baseURL: process.env.BASE_API, // api的base_url
timeout: 5000 // request timeout
})
// request interceptor
service.interceptors.request.use(config => {
// Do something before request is sent
if (store.getters.token) {
config.headers['X-Token'] = getToken() // 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
}
return config
}, error => {
// Do something with request error
console.log(error) // for debug
Promise.reject(error)
})
// respone interceptor
service.interceptors.response.use(
response => response,
/**
* 下面的注释为通过response自定义code来标示请求状态,当code返回如下情况为权限有问题,登出并返回到登录页
* 如通过xmlhttprequest 状态码标识 逻辑可写在下面error中
*/
// const res = response.data;
// if (res.code !== 20000) {
// Message({
// message: res.message,
// type: 'error',
// duration: 5 * 1000
// });
// // 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了;
// if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// MessageBox.confirm('你已被登出,可以取消继续留在该页面,或者重新登录', '确定登出', {
// confirmButtonText: '重新登录',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// store.dispatch('FedLogOut').then(() => {
// location.reload();// 为了重新实例化vue-router对象 避免bug
// });
// })
// }
// return Promise.reject('error');
// } else {
// return response.data;
// }
error => {
console.log('err' + error)// for debug
Message({
message: error.message,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
})
export default service
/**
* Created by jiachenpan on 16/11/18.
*/
export function isvalidUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
}
/* 合法uri*/
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
}
/* 小写字母*/
export function validateLowerCase(str) {
const reg = /^[a-z]+$/
return reg.test(str)
}
/* 大写字母*/
export function validateUpperCase(str) {
const reg = /^[A-Z]+$/
return reg.test(str)
}
/* 大小写字母*/
export function validateAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
/**
* validate email
* @param email
* @returns {boolean}
*/
export function validateEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(email)
}
/* eslint-disable */
/* Blob.js
* A Blob implementation.
* 2014-05-27
*
* By Eli Grey, http://eligrey.com
* By Devin Samarin, https://github.com/eboyjr
* License: X11/MIT
* See LICENSE.md
*/
/*global self, unescape */
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
plusplus: true */
/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
(function (view) {
"use strict";
view.URL = view.URL || view.webkitURL;
if (view.Blob && view.URL) {
try {
new Blob;
return;
} catch (e) {}
}
// Internally we use a BlobBuilder implementation to base Blob off of
// in order to support older browsers that only have BlobBuilder
var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {
var
get_class = function(object) {
return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
}
, FakeBlobBuilder = function BlobBuilder() {
this.data = [];
}
, FakeBlob = function Blob(data, type, encoding) {
this.data = data;
this.size = data.length;
this.type = type;
this.encoding = encoding;
}
, FBB_proto = FakeBlobBuilder.prototype
, FB_proto = FakeBlob.prototype
, FileReaderSync = view.FileReaderSync
, FileException = function(type) {
this.code = this[this.name = type];
}
, file_ex_codes = (
"NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
).split(" ")
, file_ex_code = file_ex_codes.length
, real_URL = view.URL || view.webkitURL || view
, real_create_object_URL = real_URL.createObjectURL
, real_revoke_object_URL = real_URL.revokeObjectURL
, URL = real_URL
, btoa = view.btoa
, atob = view.atob
, ArrayBuffer = view.ArrayBuffer
, Uint8Array = view.Uint8Array
;
FakeBlob.fake = FB_proto.fake = true;
while (file_ex_code--) {
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
}
if (!real_URL.createObjectURL) {
URL = view.URL = {};
}
URL.createObjectURL = function(blob) {
var
type = blob.type
, data_URI_header
;
if (type === null) {
type = "application/octet-stream";
}
if (blob instanceof FakeBlob) {
data_URI_header = "data:" + type;
if (blob.encoding === "base64") {
return data_URI_header + ";base64," + blob.data;
} else if (blob.encoding === "URI") {
return data_URI_header + "," + decodeURIComponent(blob.data);
} if (btoa) {
return data_URI_header + ";base64," + btoa(blob.data);
} else {
return data_URI_header + "," + encodeURIComponent(blob.data);
}
} else if (real_create_object_URL) {
return real_create_object_URL.call(real_URL, blob);
}
};
URL.revokeObjectURL = function(object_URL) {
if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
real_revoke_object_URL.call(real_URL, object_URL);
}
};
FBB_proto.append = function(data/*, endings*/) {
var bb = this.data;
// decode data to a binary string
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
var
str = ""
, buf = new Uint8Array(data)
, i = 0
, buf_len = buf.length
;
for (; i < buf_len; i++) {
str += String.fromCharCode(buf[i]);
}
bb.push(str);
} else if (get_class(data) === "Blob" || get_class(data) === "File") {
if (FileReaderSync) {
var fr = new FileReaderSync;
bb.push(fr.readAsBinaryString(data));
} else {
// async FileReader won't work as BlobBuilder is sync
throw new FileException("NOT_READABLE_ERR");
}
} else if (data instanceof FakeBlob) {
if (data.encoding === "base64" && atob) {
bb.push(atob(data.data));
} else if (data.encoding === "URI") {
bb.push(decodeURIComponent(data.data));
} else if (data.encoding === "raw") {
bb.push(data.data);
}
} else {
if (typeof data !== "string") {
data += ""; // convert unsupported types to strings
}
// decode UTF-16 to binary string
bb.push(unescape(encodeURIComponent(data)));
}
};
FBB_proto.getBlob = function(type) {
if (!arguments.length) {
type = null;
}
return new FakeBlob(this.data.join(""), type, "raw");
};
FBB_proto.toString = function() {
return "[object BlobBuilder]";
};
FB_proto.slice = function(start, end, type) {
var args = arguments.length;
if (args < 3) {
type = null;
}
return new FakeBlob(
this.data.slice(start, args > 1 ? end : this.data.length)
, type
, this.encoding
);
};
FB_proto.toString = function() {
return "[object Blob]";
};
FB_proto.close = function() {
this.size = this.data.length = 0;
};
return FakeBlobBuilder;
}(view));
view.Blob = function Blob(blobParts, options) {
var type = options ? (options.type || "") : "";
var builder = new BlobBuilder();
if (blobParts) {
for (var i = 0, len = blobParts.length; i < len; i++) {
builder.append(blobParts[i]);
}
}
return builder.getBlob(type);
};
}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
/* eslint-disable */
require('script-loader!file-saver');
require('./Blob');
require('script-loader!xlsx/dist/xlsx.core.min');
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}});
}
;
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {v: data[R][C]};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({c: C, r: R});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
}
else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
console.log('a')
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
console.log(data);
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
}
function formatJson(jsonData) {
console.log(jsonData)
}
export function export_json_to_excel(th, jsonData, defaultTitle) {
/* original data */
var data = jsonData;
data.unshift(th);
var ws_name = "SheetJS";
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
var title = defaultTitle || '列表'
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
}
<template>
<div class="right-wrap">
</div>
</template>
<script>
import { getRequest } from '@/api/api';
export default {
name: "public_num_attention",
data() {
return {
baseUrl: '', // 域名
enterpriseId :'',
}
},
beforeMount() {
var that = this
var host = window.location.origin;
console.log("当前host:",host)
if (host.indexOf('localhost') != '-1') {
that.baseUrl = 'http://gicdev.demogic.com';
}else {
that.baseUrl = host
}
},
methods: {
// 跳转商户
redirect(enterpriseId){
var that = this
var para = {
eid: enterpriseId
}
getRequest('/api-auth/do-login-for-clique',para)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
var href = that.baseUrl + ''
window.location.href= href + "/report/#/memberSummary"
return;
}
// that.userFormVisible = false;
errMsg.errorMsg(resData)
})
.catch(function (error) {
console.log(error);
// that.toLogin()
// that.userFormVisible = false;
that.$message.error({
duration: 1000,
message: error.message
})
});
},
},
mounted() {
var that = this;
// var href = that.baseUrl + ''
// window.location.href= href + "/gic-web/#/login"
console.log("mounted",that.$route.query.gradeId)
that.enterpriseId = that.$route.query.enterpriseId
that.redirect(that.enterpriseId)
}
}
</script>
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<div class="right-wrap near-store-contain">
<topNav :navpath="navpath"></topNav>
<div class="right-content">
<div class="right-box">
<div class="attention-wrap">
<label class="near-store-tip">单商户小程序中附近门店是否展示集团其他商户门店</label>
<div class="item-label">
<span>展示</span>
<el-switch v-model="nearStoreSwithFlag" @change="nearStoreSwitch"></el-switch>
</div>
</div>
</div>
</div>
<vue-gic-footer></vue-gic-footer>
</div>
</template>
<script>
import topNav from 'components/nav/nav'
import { getRequest, postRequest, postForm } from '@/api/api';
export default {
name: "nearStoreSet",
data() {
return {
projectName: 'gic-clique', // 当前项目名
// 头部面包屑导航
navpath: [{
name: '首页',
path: '/'
},
{
name: '附近门店',
path: ''
}
],
// 附近门店
nearStoreSwithFlag: true
}
},
created() {
// this.selectReplayStyle()
},
methods: {
changeRoute(route) {
console.log("route-change")
this.$router.push(route);
},
// change 附近门店开启/关闭
nearStoreSwitch() {
var that = this;
console.log(that.nearStoreSwithFlag)
that.setNearStore()
},
// 设置附近门店开启/关闭
setNearStore() {
var that = this;
var param = {
requestProject: that.projectName,
isShowCliqueStore: that.nearStoreSwithFlag == true? 1: 0
}
postRequest('/api-admin/save-clique-show-store',param)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.$message({
message: '修改附近门店显示配置成功',
type: 'success'
});
return;
}
// that.userFormVisible = false;
that.nearStoreSwithFlag = false
that.$message.error({
duration: 1000,
message: resData.message
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
// that.userFormVisible = false;
that.nearStoreSwithFlag = false
that.$message.error({
duration: 1000,
message: error.message
})
});
},
// 获取附近门店开启值
getNearStore() {
var that = this;
var param = {
requestProject: that.projectName
}
postRequest('/api-admin/clique-show-store',param)
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.nearStoreSwithFlag = resData.result.isShowCliqueStore == 1? true: false;
return;
}
// that.userFormVisible = false;
that.$message.error({
duration: 1000,
message: error.message
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
// that.userFormVisible = false;
that.$message.error({
duration: 1000,
message: error.message
})
});
// // 提示信息
// that.$message.error({
// duration: 1000,
// message: '获取附近门店开启值'
// })
}
},
mounted(){
var that = this;
that.getNearStore()
},
components: {
topNav
}
}
</script>
<style lang="less" scoped>
.attention-wrap {
padding: 24px 33px;
background: #fff;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
.near-store-tip {
display: block;
font-size: 14px;
margin-bottom: 30px
}
.item-label {
font-size: 14px;
color: #606266;
margin-bottom: 30px;
span {
display: inline-block;
width: 80px;
}
}
.attention-content-wrap {}
}
</style>
<template>
<div class="errPage-container">
<el-button @click="back" icon='arrow-left' class="pan-back-btn">返回</el-button>
<el-row>
<el-col :span="12">
<h1 class="text-jumbo text-ginormous">你没有权限去该页面!</h1>
<h2></h2>
<h6></h6>
<ul class="list-unstyled">
<!-- <li>或者你可以去:</li>
<li class="link-type">
<router-link to="#/companyGroup">回首页</router-link>
</li> -->
<!-- <li class="link-type"><a href="https://www.taobao.com/">随便看看</a></li>
<li><a @click.prevent="dialogVisible=true" href="#">点我看图</a></li> -->
</ul>
</el-col>
<el-col :span="12">
<img :src="errGif" width="313" height="428" alt="Girl has dropped her ice cream.">
</el-col>
</el-row>
<el-dialog title="随便看" :visible.sync="dialogVisible">
<img class="pan-img" :src="ewizardClap">
</el-dialog>
</div>
</template>
<script>
import errGif from '@/assets/401_images/401.gif'
export default {
name: 'page401',
data() {
return {
errGif: errGif + '?' + +new Date(),
ewizardClap: 'https://wpimg.wallstcn.com/007ef517-bafd-4066-aae4-6883632d9646',
dialogVisible: false
}
},
methods: {
back() {
if (this.$route.query.noGoBack) {
this.$router.push({ path: '/companyGroup' })
} else {
this.$router.go(-1)
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.errPage-container {
width: 800px;
margin: 100px auto;
.pan-back-btn {
background: #008489;
color: #fff;
}
.pan-gif {
margin: 0 auto;
display: block;
}
.pan-img {
display: block;
margin: 0 auto;
width: 100%;
}
.text-jumbo {
font-size: 60px;
font-weight: 700;
color: #484848;
}
.list-unstyled {
font-size: 14px;
li {
padding-bottom: 5px;
}
a {
color: #008489;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
}
</style>
<template>
<div style="background:#f0f2f5;margin-top: -20px;height:100%;">
<div class="wscn-http404">
<div class="pic-404">
<img class="pic-404__parent" :src="img_404" alt="404">
<img class="pic-404__child left" :src="img_404_cloud" alt="404">
<img class="pic-404__child mid" :src="img_404_cloud" alt="404">
<img class="pic-404__child right" :src="img_404_cloud" alt="404">
</div>
<div class="bullshit">
<div class="bullshit__oops">OOPS!</div>
<div class="bullshit__info">版权所有
<a class='link-type' href='#/companyGroup' target='_blank'>达摩网络</a>
</div>
<div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告</div>
<a href="#/companyGroup" class="bullshit__return-home">返回</a>
</div>
</div>
</div>
</template>
<script>
import img_404 from '@/assets/404_images/404.png'
import img_404_cloud from '@/assets/404_images/404_cloud.png'
export default {
name: 'page404',
data() {
return {
img_404,
img_404_cloud
}
},
computed: {
message() {
return '页面不存在......'
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.wscn-http404 {
position: relative;
width: 1200px;
margin: 20px auto 60px;
padding: 0 100px;
overflow: hidden;
.pic-404 {
position: relative;
float: left;
width: 600px;
padding: 150px 0;
overflow: hidden;
&__parent {
width: 100%;
}
&__child {
position: absolute;
&.left {
width: 80px;
top: 17px;
left: 220px;
opacity: 0;
animation-name: cloudLeft;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1s;
}
&.mid {
width: 46px;
top: 10px;
left: 420px;
opacity: 0;
animation-name: cloudMid;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1.2s;
}
&.right {
width: 62px;
top: 100px;
left: 500px;
opacity: 0;
animation-name: cloudRight;
animation-duration: 2s;
animation-timing-function: linear;
animation-fill-mode: forwards;
animation-delay: 1s;
}
@keyframes cloudLeft {
0% {
top: 17px;
left: 220px;
opacity: 0;
}
20% {
top: 33px;
left: 188px;
opacity: 1;
}
80% {
top: 81px;
left: 92px;
opacity: 1;
}
100% {
top: 97px;
left: 60px;
opacity: 0;
}
}
@keyframes cloudMid {
0% {
top: 10px;
left: 420px;
opacity: 0;
}
20% {
top: 40px;
left: 360px;
opacity: 1;
}
70% {
top: 130px;
left: 180px;
opacity: 1;
}
100% {
top: 160px;
left: 120px;
opacity: 0;
}
}
@keyframes cloudRight {
0% {
top: 100px;
left: 500px;
opacity: 0;
}
20% {
top: 120px;
left: 460px;
opacity: 1;
}
80% {
top: 180px;
left: 340px;
opacity: 1;
}
100% {
top: 200px;
left: 300px;
opacity: 0;
}
}
}
}
.bullshit {
position: relative;
float: left;
width: 300px;
padding: 150px 0;
overflow: hidden;
&__oops {
font-size: 32px;
font-weight: bold;
line-height: 40px;
color: #1482f0;
opacity: 0;
margin-bottom: 20px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-fill-mode: forwards;
}
&__headline {
font-size: 20px;
line-height: 24px;
color: #1482f0;
opacity: 0;
margin-bottom: 10px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.1s;
animation-fill-mode: forwards;
}
&__info {
font-size: 13px;
line-height: 21px;
color: grey;
opacity: 0;
margin-bottom: 30px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.2s;
animation-fill-mode: forwards;
}
&__return-home {
display: block;
float: left;
width: 110px;
height: 36px;
background: #1482f0;
border-radius: 100px;
text-align: center;
color: #ffffff;
opacity: 0;
font-size: 14px;
line-height: 36px;
cursor: pointer;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}
@keyframes slideUp {
0% {
transform: translateY(60px);
opacity: 0;
}
100% {
transform: translateY(0);
opacity: 1;
}
}
}
}
</style>
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment