init
27
.babelrc
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
||||
}
|
||||
}],
|
||||
"stage-2"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-vue-jsx",
|
||||
"transform-runtime",
|
||||
[
|
||||
"component",
|
||||
{
|
||||
"libraryName": "element-ui",
|
||||
"styleLibraryName": "theme-chalk"
|
||||
},
|
||||
"import",
|
||||
{
|
||||
"libraryName": "vant",
|
||||
"libraryDirectory": "es",
|
||||
"style": true
|
||||
}
|
||||
]]
|
||||
}
|
||||
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
4
.eslintignore
Normal file
@@ -0,0 +1,4 @@
|
||||
/build/
|
||||
/config/
|
||||
/dist/
|
||||
/*.js
|
||||
29
.eslintrc.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// https://eslint.org/docs/user-guide/configuring
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
extends: [
|
||||
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
|
||||
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
|
||||
'plugin:vue/essential',
|
||||
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
|
||||
'standard'
|
||||
],
|
||||
// required to lint *.vue files
|
||||
plugins: [
|
||||
'vue'
|
||||
],
|
||||
// add your custom rules here
|
||||
rules: {
|
||||
// allow async-await
|
||||
'generator-star-spacing': 'off',
|
||||
// allow debugger during development
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
||||
}
|
||||
}
|
||||
14
.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
/dist/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
10
.postcssrc.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// 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": {}
|
||||
}
|
||||
}
|
||||
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# nl-mb-lx
|
||||
|
||||
> 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).
|
||||
41
build/build.js
Normal file
@@ -0,0 +1,41 @@
|
||||
'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'
|
||||
))
|
||||
})
|
||||
})
|
||||
54
build/check-versions.js
Normal file
@@ -0,0 +1,54 @@
|
||||
'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)
|
||||
}
|
||||
}
|
||||
BIN
build/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
102
build/utils.js
Normal file
@@ -0,0 +1,102 @@
|
||||
'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')
|
||||
})
|
||||
}
|
||||
}
|
||||
22
build/vue-loader.conf.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'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'
|
||||
}
|
||||
}
|
||||
107
build/webpack.base.conf.js
Normal file
@@ -0,0 +1,107 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
const webpack = require("webpack")
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
}
|
||||
|
||||
const createLintingRule = () => ({
|
||||
test: /\.(js|vue)$/,
|
||||
loader: 'eslint-loader',
|
||||
enforce: 'pre',
|
||||
include: [resolve('src'), resolve('test')],
|
||||
options: {
|
||||
formatter: require('eslint-friendly-formatter'),
|
||||
emitWarning: !config.dev.showEslintErrorsInOverlay
|
||||
}
|
||||
})
|
||||
|
||||
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',
|
||||
'@style': resolve('src') + '/style',
|
||||
'@images': resolve('src') + '/images',
|
||||
'common': resolve('src') + '/common',
|
||||
'@config': resolve('src') + '/config'
|
||||
// 'jquery': resolve('../node_modules/jquery/src/jquery')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
...(config.dev.useEslint ? [createLintingRule()] : []),
|
||||
{
|
||||
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: /\.(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'
|
||||
},
|
||||
// add jquery peizhi
|
||||
plugins: [
|
||||
new webpack.optimize.CommonsChunkPlugin('common.js'),
|
||||
new webpack.ProvidePlugin({
|
||||
jQuery: "jquery",
|
||||
$: "jquery"
|
||||
})
|
||||
]
|
||||
}
|
||||
95
build/webpack.dev.conf.js
Normal file
@@ -0,0 +1,95 @@
|
||||
'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
|
||||
}),
|
||||
// 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)
|
||||
}
|
||||
})
|
||||
})
|
||||
145
build/webpack.prod.conf.js
Normal file
@@ -0,0 +1,145 @@
|
||||
'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
|
||||
7
config/dev.env.js
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
})
|
||||
76
config/index.js
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict'
|
||||
// Template version: 1.3.1
|
||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
dev: {
|
||||
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: '0.0.0.0', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: true,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
|
||||
// Use Eslint Loader?
|
||||
// If true, your code will be linted during bundling and
|
||||
// linting errors and warnings will be shown in the console.
|
||||
useEslint: true,
|
||||
// If true, eslint errors and warnings will also be shown in the error overlay
|
||||
// in the browser.
|
||||
showEslintErrorsInOverlay: false,
|
||||
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
}
|
||||
4
config/prod.env.js
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"'
|
||||
}
|
||||
46
index.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,user-scalable=no">
|
||||
<title>永裕</title>
|
||||
<script src="../../common/js/appmui.js"></script>
|
||||
<!-- <script src="http://192.168.81.82:8000/CLodopfuncs.js" id='printid'></script> -->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
var event = document.createEvent('HTMLEvents');
|
||||
event.initEvent('qrcodeEvent', false, true);
|
||||
//提供给Android调用的方法
|
||||
function qrcodeCallback(result){
|
||||
event.data = {lxqrcode: result};
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
function barcodeCallback(result){
|
||||
window.lxqrcode = result
|
||||
// event.data = {lxqrcode: result};
|
||||
// window.dispatchEvent(event);
|
||||
}
|
||||
function imgUploadCallback(result){
|
||||
window.upimgres = result
|
||||
}
|
||||
// window.onload=function(){
|
||||
// document.onkeydown=function(ev){
|
||||
// var event=ev ||event
|
||||
// if(event.keyCode==13){
|
||||
// imgUploadCallback('{"code":"1","desc":"上传成功","fileid":"6042511C35AF4B258045196D19DF9CA0"}')
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// enter键测试调用扫码函数
|
||||
// window.onload=function(){
|
||||
// document.onkeydown=function(ev){
|
||||
// var event=ev ||event
|
||||
// if(event.keyCode==13){
|
||||
// barcodeCallback('04#T0001')
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
</html>
|
||||
11968
package-lock.json
generated
Normal file
90
package.json
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"name": "nl-mb-lx",
|
||||
"version": "1.0.0",
|
||||
"description": "A Vue.js project",
|
||||
"author": "xxy",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
||||
"start": "npm run dev",
|
||||
"lint": "eslint --ext .js,.vue src",
|
||||
"build": "node build/build.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"element-ui": "^2.15.5",
|
||||
"fastclick": "^1.0.6",
|
||||
"jsencrypt": "^3.2.1",
|
||||
"lodash": "^4.17.11",
|
||||
"stylus": "^0.54.5",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"vant": "^2.2.16",
|
||||
"vue": "^2.5.2",
|
||||
"vue-infinite-scroll": "^2.0.2",
|
||||
"vue-print-nb": "^1.0.3",
|
||||
"vue-qrcode-reader": "^1.2.2",
|
||||
"vue-router": "^3.0.1",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuex": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^7.1.2",
|
||||
"babel-core": "^6.22.1",
|
||||
"babel-eslint": "^8.2.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-component": "^1.1.1",
|
||||
"babel-plugin-import": "^1.9.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.0",
|
||||
"eslint": "^4.15.0",
|
||||
"eslint-config-standard": "^10.2.1",
|
||||
"eslint-friendly-formatter": "^3.0.0",
|
||||
"eslint-loader": "^1.7.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-plugin-node": "^5.2.0",
|
||||
"eslint-plugin-promise": "^3.4.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"eslint-plugin-vue": "^4.0.0",
|
||||
"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",
|
||||
"node-notifier": "^5.1.2",
|
||||
"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",
|
||||
"semver": "^5.3.0",
|
||||
"shelljs": "^0.7.6",
|
||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||
"url-loader": "^0.5.8",
|
||||
"vconsole": "^3.3.4",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-style-loader": "^3.0.1",
|
||||
"vue-template-compiler": "^2.5.2",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
40
src/App.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<v-toast v-show="showToast"></v-toast>
|
||||
<v-alert v-show="showAlert"></v-alert>
|
||||
<v-loading v-show="loading"></v-loading>
|
||||
<keep-alive :include="keepAlive" >
|
||||
<router-view/>
|
||||
</keep-alive>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '@/components/toast'
|
||||
import alert from '@/components/alert'
|
||||
import loading from '@/components/loading'
|
||||
// import { isOperateFun } from '@/config/isOperate.js'
|
||||
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
'v-toast': toast,
|
||||
'v-alert': alert,
|
||||
'v-loading': loading
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['showToast', 'showAlert', 'loading', 'keepAlive'])
|
||||
},
|
||||
created () {
|
||||
// isOperateFun()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '~@style/common'
|
||||
</style>
|
||||
18
src/common/comps/LoadingIndicator.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<div class="loading-indicator">
|
||||
Loading...
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="css">
|
||||
.loading-indicator {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
font-weight: bold;
|
||||
font-size: 2rem;
|
||||
|
||||
transform: translate(-50%, -50%)
|
||||
}
|
||||
</style>
|
||||
18
src/common/fade/FadeAnimation.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<transition>
|
||||
<slot></slot>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'FadeAnimation'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.v-enter, .v-leave-to
|
||||
opacity: 0
|
||||
.v-enter-active, .v-leave-active
|
||||
transition: opacity .5s
|
||||
</style>
|
||||
212
src/components/DropdownMenu.vue
Normal file
@@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div class="dropdown-menu" :class="{'toggle_disabled': disabled === true}" ref="elemId">
|
||||
<div v-if="inputed === false" class="fxrow dropdown-menu__item" @click="toggleItem">
|
||||
<span class="dropdown-menu__title" :class="{'dropdown-menu__title_up': up === true,'dropdown-menu__title--active': open === true,'dropdown-menu__title--active_up': up === true && open === true}"><div class="ellipsis chose_T">{{active === '' ? '请选择' : option[active].label}}</div></span>
|
||||
</div>
|
||||
<div v-if="inputed === true" class="fxrow dropdown-menu__item dropdown-menu__item_2">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="请输入"
|
||||
class="fxcol drop_input"
|
||||
:value="value"
|
||||
@input="handleChange($event)">
|
||||
<span class="fxcol dropdown-menu__title dropdown-menu__title_2" :class="{'dropdown-menu__title_up': up === true,'dropdown-menu__title--active': open === true,'dropdown-menu__title--active_up': up === true && open === true}" @click="toggleItem"><div class="ellipsis"> </div></span>
|
||||
</div>
|
||||
<div v-show="open" class="dropdown-item" :style="up === false ? 'top: .9rem' : 'bottom: .9rem'">
|
||||
<div ref="dropdown" class="dropdown-item__content">
|
||||
<div v-show="option.length > 0" v-for="(e, i) in option" :key="e.value" @click="$emit('dropdownMenu', i)" class="fxrow dropdown-item__option dropdown-item__option--active">
|
||||
<div class="cell__title" :class="{'cell__title--active': i + '' === active}"><span>{{e.label}}</span></div>
|
||||
<div class="iconfont check_icon" :class="{'check_icon--checked': i + '' === active}"></div>
|
||||
</div>
|
||||
<div v-show="option.length === 0" class="fxrow dropdown-item__option dropdown-item__option--active" @click="handleBlur">
|
||||
<div class="cell__title"><span>无匹配数据</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DropdownMenu',
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'input'
|
||||
},
|
||||
props: {
|
||||
value: String,
|
||||
option: Array,
|
||||
active: String,
|
||||
open: Boolean,
|
||||
up: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
inputed: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleItem () {
|
||||
let cheight = document.body.clientHeight
|
||||
let bottom = this.$refs.elemId.getBoundingClientRect().bottom
|
||||
this.$refs.dropdown.style.maxHeight = (cheight - bottom - 20) + 'px'
|
||||
this.$emit('toggleItem')
|
||||
},
|
||||
handleChange ($event) {
|
||||
let cheight = document.body.clientHeight
|
||||
let bottom = this.$refs.elemId.getBoundingClientRect().bottom
|
||||
this.$refs.dropdown.style.maxHeight = (cheight - bottom - 20) + 'px'
|
||||
this.$emit('input', $event.target.value)
|
||||
this.$emit('handleChange', $event.target.value)
|
||||
},
|
||||
handleBlur () {
|
||||
this.$emit('handleBlur')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~@style/mixin'
|
||||
.dropdown-menu
|
||||
position relative
|
||||
height .9rem
|
||||
border .02rem solid #dcdfe6
|
||||
border-radius 4px
|
||||
background-color #fff
|
||||
user-select none
|
||||
width 100%
|
||||
// padding 0 .15rem
|
||||
.selectopt
|
||||
// _font(.3rem, .9rem, #606266)
|
||||
.selectbtn
|
||||
position relative
|
||||
flex 0 0 1rem
|
||||
_wh(.8rem, .8rem)
|
||||
vertical-align top
|
||||
background-color #cccccc
|
||||
&::before
|
||||
content ''
|
||||
width 0
|
||||
height 0
|
||||
border-left .5rem solid transparent
|
||||
border-right .5rem solid transparent
|
||||
border-top .5rem solid white
|
||||
position absolute
|
||||
right .15rem
|
||||
top .15rem
|
||||
pointer-events none
|
||||
z-index 3
|
||||
.options
|
||||
position absolute
|
||||
z-index 100000
|
||||
top .9rem
|
||||
width 100%
|
||||
li
|
||||
width 100%
|
||||
_font(.12rem, .35rem, #000000)
|
||||
background-color #cccccc
|
||||
border-top 1px solid #ffffff
|
||||
padding 0 .3rem 0 .1rem
|
||||
user-select none
|
||||
&:hover
|
||||
background:#999
|
||||
.dropdown-menu__item
|
||||
justify-content center
|
||||
height inherit
|
||||
width 100%
|
||||
.dropdown-menu__item_2
|
||||
align-items flex-start
|
||||
.drop_input
|
||||
height .86rem
|
||||
width calc(100% - 3rem)
|
||||
padding 0 .15rem
|
||||
color #606266
|
||||
font-size .3rem
|
||||
line-height .86rem
|
||||
.dropdown-menu__title
|
||||
position relative
|
||||
width 100%
|
||||
padding 0 .15rem
|
||||
color #606266
|
||||
font-size .3rem
|
||||
line-height .44rem
|
||||
width 100%
|
||||
display block
|
||||
&::after
|
||||
position absolute
|
||||
top 50%
|
||||
right .16rem
|
||||
margin-top -.1rem
|
||||
border .06rem solid
|
||||
border-color transparent transparent #606266 #606266
|
||||
transform rotate(-45deg)
|
||||
opacity 0.8
|
||||
content ''
|
||||
.dropdown-menu__title_2
|
||||
line-height .9rem
|
||||
max-width 1.4rem
|
||||
background-color #e5e5e5
|
||||
&::after
|
||||
right .16rem
|
||||
.dropdown-menu__title_up
|
||||
&::after
|
||||
transform rotate(135deg)
|
||||
top calc(50% + .06rem)
|
||||
.dropdown-menu__title--active, .dropdown-menu__title--active div
|
||||
color $red !important
|
||||
&::after
|
||||
border-color transparent transparent currentColor currentColor
|
||||
margin-top -.02rem
|
||||
transform rotate(135deg)
|
||||
.dropdown-menu__title--active_up, .dropdown-menu__title--active_up div
|
||||
&::after
|
||||
transform rotate(-45deg)
|
||||
top calc(50% - .06rem)
|
||||
.dropdown-item
|
||||
position absolute
|
||||
left 0
|
||||
width 100%
|
||||
z-index 10
|
||||
border-radius 4px
|
||||
overflow hidden
|
||||
box-shadow 0 0 .08rem 0.02rem rgba(160,160,160,0.9)
|
||||
.dropdown-item__content
|
||||
position relative
|
||||
width 100%
|
||||
height auto
|
||||
z-index 2047
|
||||
overflow-y auto
|
||||
background-color #fff
|
||||
transition transform 0.3s
|
||||
.dropdown-item__option
|
||||
width 100%
|
||||
height .9rem
|
||||
padding 0 .15rem
|
||||
overflow hidden
|
||||
.cell__title
|
||||
height .9rem
|
||||
overflow hidden
|
||||
span
|
||||
_font(.3rem, .9rem, #606266)
|
||||
.cell__title--active span
|
||||
color $red
|
||||
.toggle_disabled
|
||||
background-color #f5f7fa
|
||||
border 0.02rem solid #e4e7ed
|
||||
cursor not-allowed
|
||||
.dropdown-menu__title
|
||||
div
|
||||
color #929292
|
||||
&::after
|
||||
border-color transparent transparent #929292 #929292
|
||||
.chose_T
|
||||
width 100%
|
||||
overflow hidden
|
||||
</style>
|
||||
52
src/components/InputNumber.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div>
|
||||
<input
|
||||
type="number"
|
||||
class="sin_input"
|
||||
:value="value"
|
||||
:disabled = "disabled"
|
||||
@focus="handleFocus($event)"
|
||||
@blur="handleBlur($event)"
|
||||
@input="handleInput($event)"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'input-number',
|
||||
props: {
|
||||
value: String,
|
||||
disabled: {type: Boolean, default: false},
|
||||
min: {type: String, default: '0.000'},
|
||||
max: {type: String}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
cur: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleFocus ($event) {
|
||||
this.cur = $event.target.value
|
||||
$event.target.value = ''
|
||||
this.$emit('input', $event.target.value)
|
||||
},
|
||||
handleBlur ($event) {
|
||||
if ($event.target.value === '') {
|
||||
$event.target.value = this.cur
|
||||
}
|
||||
if (Number($event.target.value) < Number(this.min)) {
|
||||
$event.target.value = Number(this.min).toFixed(3)
|
||||
}
|
||||
this.$emit('input', $event.target.value)
|
||||
},
|
||||
handleInput ($event) {
|
||||
$event.target.value = ($event.target.value.match(/^\d*(\.?\d{0,3})/g)[0]) || null
|
||||
if (Number($event.target.value) > Number(this.max)) {
|
||||
$event.target.value = Number(this.max).toFixed(3)
|
||||
}
|
||||
this.$emit('input', $event.target.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
85
src/components/LimitInput.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div class="fxcol">
|
||||
<input
|
||||
class="filter-input i-border"
|
||||
:disabled="disabled"
|
||||
:type="type"
|
||||
ref="input"
|
||||
:value="numberValue"
|
||||
:placeholder="placeholder"
|
||||
oninput="value=value.replace(/[^\d.]/g,'')"
|
||||
@input="handleChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'limitInput',
|
||||
props: {
|
||||
disabled: Boolean,
|
||||
type: String,
|
||||
placeholder: String,
|
||||
value: '', // 传过来的值
|
||||
max: Number,
|
||||
min: Number,
|
||||
defaultValue: '' // 默认值
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
numberValue: this.value
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value (val) { // 监听传来的value值,并传递给新定义的值
|
||||
// debugger
|
||||
this.numberValue = Number(val)
|
||||
},
|
||||
max (val) { // 因为最大值是根据上个值输入而变化的,所以要监听相应变化
|
||||
this.max = val
|
||||
},
|
||||
min (val) { // 因为最小值是根据上个值输入而变化的,所以要监听相应变化
|
||||
this.min = val
|
||||
},
|
||||
numberValue (val) { // emit input事件,可令父组件进行v-model绑定
|
||||
this.$emit('input', val)
|
||||
},
|
||||
disabled (val) {
|
||||
this.disabled = val
|
||||
},
|
||||
defaultValue (val) { // 要根据上面的值变化而相应变化,所以要监听
|
||||
this.numberValue = val
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleChange (event) {
|
||||
let val = event.target.value.trim()
|
||||
if (val < 0 || isNaN(val)) {
|
||||
this.numberValue = 0
|
||||
return
|
||||
}
|
||||
if (val) {
|
||||
val = Number(val)
|
||||
this.numberValue = val
|
||||
if (val > Number(this.max)) this.numberValue = this.max
|
||||
if (val < Number(this.min)) this.numberValue = this.min
|
||||
} else {
|
||||
this.numberValue = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (this.defaultValue) {
|
||||
this.numberValue = this.defaultValue
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="stylus" scoped>
|
||||
// input
|
||||
// width 100%
|
||||
.i-border
|
||||
border 1px solid #a1a1a1
|
||||
border-radius 3px
|
||||
text-align center
|
||||
</style>
|
||||
69
src/components/Modal.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<div class="md-modal" v-if="mdShow">
|
||||
<transition name="bounce">
|
||||
<div class="modal-inner">
|
||||
<div class="modal-content">
|
||||
<!-- <div class="modal-message">{{question}}</div> -->
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div class="mgt15 fxrow">
|
||||
<button class="fxcol btn btn-disabled submit-button" @click="closeModal">取消</button>
|
||||
<button class="btn btn-disabled submit-button bl1px" v-if="comfirmDisable">确认</button>
|
||||
<button class="btn submit-button" v-if="!comfirmDisable" @click="comfirm">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
<transition name="fade">
|
||||
<div class="overlay"></div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Modal',
|
||||
props: {
|
||||
// question: String,
|
||||
mdShow: Boolean,
|
||||
comfirmDisable: Boolean,
|
||||
type: String
|
||||
},
|
||||
methods: {
|
||||
closeModal () {
|
||||
this.$emit('closeModalCallback')
|
||||
},
|
||||
comfirm () {
|
||||
this.$emit('comfirmCallback', this.type)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.modal-inner
|
||||
position fixed
|
||||
top 50%
|
||||
left 50%
|
||||
width 80%
|
||||
font-size .28rem
|
||||
overflow hidden
|
||||
transition .3s
|
||||
border-radius 4px
|
||||
background-color #fff
|
||||
transform translate3d(-50%, -50%, 0)
|
||||
z-index 2018
|
||||
.overlay
|
||||
position fixed
|
||||
top 0
|
||||
left 0
|
||||
width 100%
|
||||
height 100%
|
||||
background-color rgba(0, 0, 0, .7)
|
||||
z-index 11
|
||||
>>>.btn
|
||||
border-radius 0
|
||||
>>>.submit-button
|
||||
margin 0
|
||||
.bl1px
|
||||
border-left 1px solid #fff
|
||||
</style>
|
||||
53
src/components/NavBar.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<header>
|
||||
<span @click="goBack" class="icon-back"></span>
|
||||
<span class="fxcol">{{title}}</span>
|
||||
<div class="icon-home" @click="goHome"></div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'NavBar',
|
||||
props: {
|
||||
title: String,
|
||||
path: String,
|
||||
inner: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
inner2: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack () {
|
||||
if (this.inner) {
|
||||
this.$router.back()
|
||||
} else if (this.inner2) {
|
||||
this.$emit('goIn')
|
||||
} else {
|
||||
this.$router.push('/home')
|
||||
}
|
||||
},
|
||||
goHome () {
|
||||
this.$store.dispatch('setKeepAlive', [])
|
||||
this.$router.push('/home')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
@import '~@style/mixin'
|
||||
.icon-back
|
||||
flex 0 0 .42rem
|
||||
height .86rem
|
||||
_bis('../images/back.png',.42rem)
|
||||
.icon-home
|
||||
cursor pointer
|
||||
flex 0 0 .4rem
|
||||
height .86rem
|
||||
_bis('../images/home.png', .4rem)
|
||||
</style>
|
||||
137
src/components/SearchBox.vue
Normal file
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<div class="bottom-filter-tip">
|
||||
<div class="filter-label txtjustify">{{label}}</div>
|
||||
<div class="fxcol mgl20 relative">
|
||||
<input
|
||||
type="text"
|
||||
class="filter-input filter-scan-input search_input"
|
||||
ref="scaninput"
|
||||
:placeholder="keyCode === '' ? placeholder : keyCode"
|
||||
:disabled="disabled"
|
||||
:value="value"
|
||||
@focus="handleFocus($event)"
|
||||
@blur="handleBlur($event)"
|
||||
@input="handleChange($event)">
|
||||
<div class="button_box">
|
||||
<button class="search_box_icon fxcol" @click="handleScan">
|
||||
<span class="iconfont scan_icon" :class="{'scan_icon_checked': type === true}"></span>
|
||||
</button>
|
||||
<button class="search_box_icon fxcol" @click="handleKey">
|
||||
<span class="iconfont key_icon" :class="{'key_icon_checked': type === false}"></span>
|
||||
</button>
|
||||
<button v-show="seaShow === true" class="search_box_icon fxcol" @click="handleSearch">
|
||||
<span class="iconfont search_icon" :class="{'key_icon_checked': type === false}"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SearchBox',
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'input'
|
||||
},
|
||||
props: {
|
||||
value: String,
|
||||
label: String,
|
||||
focused: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
seaShow: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
keyCode: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
placeholder: '',
|
||||
type: '',
|
||||
cur: ''
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (!this.focused) this.handleScan()
|
||||
},
|
||||
methods: {
|
||||
handleScan () {
|
||||
this.$refs.scaninput.focus()
|
||||
this.placeholder = '请扫码键输入'
|
||||
this.type = true
|
||||
this.$emit('input', '')
|
||||
},
|
||||
handleKey () {
|
||||
this.$refs.scaninput.focus()
|
||||
this.placeholder = '请键盘输入'
|
||||
this.type = false
|
||||
// this.$emit('input', this.cur)
|
||||
},
|
||||
handleFocus ($event) {
|
||||
this.cur = $event.target.value
|
||||
this.placeholder = '请扫码键输入'
|
||||
this.type = false
|
||||
// $event.target.value = ''
|
||||
// this.$emit('input', $event.target.value)
|
||||
},
|
||||
handleBlur ($event) {
|
||||
this.type = ''
|
||||
this.placeholder = ''
|
||||
// if ($event.target.value === '') {
|
||||
// $event.target.value = this.cur
|
||||
// }
|
||||
this.$emit('input', $event.target.value)
|
||||
},
|
||||
handleChange ($event) {
|
||||
if ($event.target.value) {
|
||||
if (this.type) {
|
||||
this.cur = $event.target.value.split('##')[0]
|
||||
let _this = this
|
||||
setTimeout(() => {
|
||||
_this.$emit('input', this.cur)
|
||||
_this.$emit('handleChange', this.cur, true)
|
||||
_this.$emit('getScanTxt', $event.target.value)
|
||||
}, 20)
|
||||
this.$refs.scaninput.blur()
|
||||
} else if (!this.type) {
|
||||
this.cur = $event.target.value
|
||||
this.$emit('input', this.cur)
|
||||
this.$emit('handleChange', this.cur, false)
|
||||
} else {
|
||||
this.cur = $event.target.value
|
||||
}
|
||||
}
|
||||
},
|
||||
handleSearch () {
|
||||
this.$emit('handleChange', this.cur, true)
|
||||
this.$refs.scaninput.blur()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~@style/mixin'
|
||||
.search_input
|
||||
padding-right 2.1rem
|
||||
.button_box
|
||||
_fj()
|
||||
position absolute
|
||||
top 50%
|
||||
transform translateY(-50%)
|
||||
right 1px
|
||||
// height .9rem
|
||||
.search_box_icon
|
||||
_wh(.7rem, 100%)
|
||||
background-color #fff
|
||||
</style>
|
||||
114
src/components/alert.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
<transition name="bounce">
|
||||
<div class="alert-wrap">
|
||||
<div class="text">{{alertMsg}}</div>
|
||||
<div class="hairline--top">
|
||||
<button class="button--large" @click="onClose"><span>确认</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
<transition name="fade">
|
||||
<div class="overlay"></div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: mapState({
|
||||
alertMsg: state => state.com.alertMsg
|
||||
}),
|
||||
methods: {
|
||||
onClose () {
|
||||
this.$store.dispatch('showAlert', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes fade-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.bounce-enter {
|
||||
opacity 0
|
||||
transform translate3d(-50%, -50%, 0) scale(0.7)
|
||||
}
|
||||
.bounce-leave-active {
|
||||
opacity 0
|
||||
transform translate3d(-50%, -50%, 0) scale(0.9)
|
||||
}
|
||||
.fade-enter-active
|
||||
animation 0.3s fade-in
|
||||
.fade-leave-active
|
||||
animation 0.3s fade-out
|
||||
.overlay
|
||||
position fixed
|
||||
top 0
|
||||
left 0
|
||||
width 100%
|
||||
height 100%
|
||||
background-color rgba(0, 0, 0, 0.7)
|
||||
z-index 2012
|
||||
.alert-wrap
|
||||
position fixed
|
||||
top 50%
|
||||
left 50%
|
||||
width 80%
|
||||
transition .3s
|
||||
transform translate3d(-50%, -50%, 0)
|
||||
overflow hidden
|
||||
border-radius 4px
|
||||
border 1px solid #ebeef5
|
||||
background-color #fff
|
||||
box-shadow 0 2px 12px 0 rgba(0,0,0,.3)
|
||||
font-size .28rem
|
||||
line-height .42rem
|
||||
color #929292
|
||||
z-index 2019
|
||||
.text
|
||||
padding .5rem
|
||||
max-height 60vh
|
||||
overflow-y auto
|
||||
text-align center
|
||||
-webkit-overflow-scrolling touch
|
||||
white-space pre-wrap
|
||||
[class*='hairline']
|
||||
position relative
|
||||
[class*='hairline']::after
|
||||
content ' '
|
||||
position absolute
|
||||
pointer-events none
|
||||
box-sizing border-box
|
||||
top -50%
|
||||
left -50%
|
||||
right -50%
|
||||
bottom -50%
|
||||
transform scale(0.5)
|
||||
border 0 solid #ebedf0
|
||||
.hairline--top::after
|
||||
border-top-width 1px
|
||||
.button--large
|
||||
width 100%
|
||||
height 1rem
|
||||
line-height 1rem
|
||||
color #e74f1a
|
||||
</style>
|
||||
30
src/components/loading.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<div class="loading">
|
||||
<div class="loader-inner">
|
||||
<img src="../images/oval-white.svg">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.loading
|
||||
position fixed
|
||||
width 100%
|
||||
height 100%
|
||||
z-index 100000
|
||||
.loader-inner
|
||||
position absolute
|
||||
z-index 100000
|
||||
height 50px
|
||||
width 50px
|
||||
padding 10px
|
||||
transform translate(-25px, -25px)
|
||||
left 50%
|
||||
top 50%
|
||||
overflow hidden
|
||||
background-color rgba(0, 0, 0, .5)
|
||||
border-radius 3px
|
||||
img
|
||||
width 100%
|
||||
height 100%
|
||||
</style>
|
||||
43
src/components/toast.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div class="toast">
|
||||
<div class="toast-wrap">
|
||||
<div class="text">
|
||||
{{toastMsg}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: mapState({
|
||||
toastMsg: state => state.com.toastMsg
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.toast
|
||||
.toast-wrap
|
||||
position fixed
|
||||
z-index 10000
|
||||
width 100%
|
||||
height .64rem
|
||||
line-height .64rem
|
||||
text-align center
|
||||
left 50%
|
||||
top 50%
|
||||
transform translate(-50%, -50%)
|
||||
.text
|
||||
display inline-block
|
||||
width auto
|
||||
padding 0 10px
|
||||
border-radius 10px
|
||||
background rgba(0, 0, 0, 0.6)
|
||||
font-size .28rem
|
||||
color #fff
|
||||
</style>
|
||||
162
src/config/LodopFuncs.js
Executable file
@@ -0,0 +1,162 @@
|
||||
/* eslint-disable */
|
||||
import store from '../vuex/store'
|
||||
var CreatedOKLodop7766=null;
|
||||
|
||||
/****************************************
|
||||
*
|
||||
* 系统加载初始化
|
||||
*
|
||||
*/
|
||||
var js=document.scripts;
|
||||
var jsRoot;
|
||||
var jsversion="";
|
||||
for(var i=0;i<js.length;i++){
|
||||
if(js[i].src.indexOf("wdk.js")>-1){
|
||||
jsRoot=js[i].src.substring(0,js[i].src.lastIndexOf("/")+1);
|
||||
if(js[i].src.lastIndexOf("?")>-1){
|
||||
jsversion=js[i].src.substr(js[i].src.lastIndexOf("?"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//====判断是否需要安装CLodop云打印服务器:====
|
||||
export function needCLodop(){
|
||||
try{
|
||||
var ua=navigator.userAgent;
|
||||
if (ua.match(/Windows\sPhone/i) !=null) return true;
|
||||
if (ua.match(/iPhone|iPod/i) != null) return true;
|
||||
if (ua.match(/Android/i) != null) return true;
|
||||
if (ua.match(/Edge\D?\d+/i) != null) return true;
|
||||
|
||||
var verTrident=ua.match(/Trident\D?\d+/i);
|
||||
var verIE=ua.match(/MSIE\D?\d+/i);
|
||||
var verOPR=ua.match(/OPR\D?\d+/i);
|
||||
var verFF=ua.match(/Firefox\D?\d+/i);
|
||||
var x64=ua.match(/x64/i);
|
||||
if ((verTrident==null)&&(verIE==null)&&(x64!==null))
|
||||
return true; else
|
||||
if ( verFF !== null) {
|
||||
verFF = verFF[0].match(/\d+/);
|
||||
if ((verFF[0]>= 41)||(x64!==null)) return true;
|
||||
} else
|
||||
if ( verOPR !== null) {
|
||||
verOPR = verOPR[0].match(/\d+/);
|
||||
if ( verOPR[0] >= 32 ) return true;
|
||||
} else
|
||||
if ((verTrident==null)&&(verIE==null)) {
|
||||
var verChrome=ua.match(/Chrome\D?\d+/i);
|
||||
if ( verChrome !== null ) {
|
||||
verChrome = verChrome[0].match(/\d+/);
|
||||
if (verChrome[0]>=41) return true;
|
||||
};
|
||||
};
|
||||
return false;
|
||||
} catch(err) {return true;};
|
||||
};
|
||||
|
||||
//====页面引用CLodop云打印必须的JS文件:====
|
||||
// if (needCLodop()) {
|
||||
// var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
||||
// var oscript = document.createElement("script");
|
||||
// oscript.src =store.getters.printUrl + "/CLodopfuncs.js?name=LODOP1";
|
||||
// head.insertBefore( oscript,head.firstChild );
|
||||
|
||||
// //引用双端口(8000和18000)避免其中某个被占用:
|
||||
// oscript = document.createElement("script");
|
||||
// oscript.src =store.getters.billPrintUrl + "/CLodopfuncs.js?name=LODOP2";
|
||||
// head.insertBefore( oscript,head.firstChild );
|
||||
// };
|
||||
|
||||
export function addCLodop () {
|
||||
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
||||
var oscript = document.createElement("script");
|
||||
oscript.src =store.getters.printUrl + "/CLodopfuncs.js?name=LODOP1";
|
||||
head.insertBefore( oscript,head.firstChild );
|
||||
|
||||
//引用双端口(8000和18000)避免其中某个被占用:
|
||||
oscript = document.createElement("script");
|
||||
oscript.src =store.getters.billPrintUrl + "/CLodopfuncs.js?name=LODOP2";
|
||||
head.insertBefore( oscript,head.firstChild );
|
||||
}
|
||||
|
||||
//====获取LODOP对象的主过程:====
|
||||
export function getLodop(oOBJECT,oEMBED){
|
||||
var strHtmInstall="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='"+jsRoot+"lib/lodop/install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
|
||||
var strHtmUpdate="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='"+jsRoot+"lib/lodop/install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
|
||||
var strHtm64_Install="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='"+jsRoot+"lib/lodop/install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
|
||||
var strHtm64_Update="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='"+jsRoot+"lib/lodop/install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
|
||||
var strHtmFireFox="<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
|
||||
var strHtmChrome="<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
|
||||
var strCLodopInstall="<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='"+jsRoot+"lib/lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行安装</a>,安装后请刷新页面。</font>";
|
||||
var strCLodopUpdate="<br><font color='#FF00FF'>CLodop云打印服务需升级!点击这里<a href='"+jsRoot+"lib/lodop/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
|
||||
var LODOP;
|
||||
try{
|
||||
var isIE = (navigator.userAgent.indexOf('MSIE')>=0) || (navigator.userAgent.indexOf('Trident')>=0);
|
||||
if (needCLodop()) {
|
||||
try{ LODOP=getCLodop();} catch(err) {};
|
||||
if (!LODOP && document.readyState!=="complete") {alert("C-Lodop没准备好,请稍后再试!"); return;};
|
||||
if (!LODOP) {
|
||||
if (isIE) document.write(strCLodopInstall); else
|
||||
alert(strCLodopInstall);
|
||||
return;
|
||||
} else {
|
||||
|
||||
if (CLODOP.CVERSION<"3.0.2.5") {
|
||||
if (isIE) document.write(strCLodopUpdate); else
|
||||
alert(strCLodopUpdate);
|
||||
};
|
||||
if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED);
|
||||
if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT);
|
||||
};
|
||||
} else {
|
||||
var is64IE = isIE && (navigator.userAgent.indexOf('x64')>=0);
|
||||
//=====如果页面有Lodop就直接使用,没有则新建:==========
|
||||
if (oOBJECT!=undefined || oEMBED!=undefined) {
|
||||
if (isIE) LODOP=oOBJECT; else LODOP=oEMBED;
|
||||
} else if (CreatedOKLodop7766==null){
|
||||
LODOP=document.createElement("object");
|
||||
LODOP.setAttribute("width",0);
|
||||
LODOP.setAttribute("height",0);
|
||||
LODOP.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;");
|
||||
if (isIE) LODOP.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
|
||||
else LODOP.setAttribute("type","application/x-print-lodop");
|
||||
document.documentElement.appendChild(LODOP);
|
||||
CreatedOKLodop7766=LODOP;
|
||||
} else LODOP=CreatedOKLodop7766;
|
||||
//=====Lodop插件未安装时提示下载地址:==========
|
||||
if ((LODOP==null)||(typeof(LODOP.VERSION)=="undefined")) {
|
||||
if (navigator.userAgent.indexOf('Chrome')>=0)
|
||||
alert(strHtmChrome);
|
||||
if (navigator.userAgent.indexOf('Firefox')>=0)
|
||||
alert(strHtmFireFox);
|
||||
if (is64IE) document.write(strHtm64_Install); else
|
||||
if (isIE) document.write(strHtmInstall); else
|
||||
alert(strHtmInstall);
|
||||
return LODOP;
|
||||
};
|
||||
};
|
||||
if (LODOP.VERSION<"6.2.2.0") {
|
||||
if (needCLodop())
|
||||
alert(strCLodopUpdate); else
|
||||
if (is64IE) document.write(strHtm64_Update); else
|
||||
if (isIE) document.write(strHtmUpdate); else
|
||||
alert(strHtmUpdate);
|
||||
return LODOP;
|
||||
};
|
||||
//===如下空白位置适合调用统一功能(如注册语句、语言选择等):===
|
||||
|
||||
//===========================================================
|
||||
return LODOP;
|
||||
} catch(err) {alert("getLodop出错:"+err);};
|
||||
};
|
||||
|
||||
export function urlEncode(){
|
||||
var url = store.getters.imgip + 'wdk?action=wdk.pub&method=attachment_upload&catacode=temp'
|
||||
var url_encode = escape(url)
|
||||
return url_encode
|
||||
};
|
||||
|
||||
// export function getSystemInfoCallback(result){
|
||||
// alert(result)
|
||||
// window.localStorage.setItem('hhtId', result)
|
||||
// }
|
||||
23
src/config/env.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 配置编译环境和线上环境之间的切换
|
||||
*
|
||||
* baseUrl: 域名地址
|
||||
* imgBaseUrl: 图片所在域名地址
|
||||
*
|
||||
*/
|
||||
|
||||
let baseUrl = ''
|
||||
let imgBaseUrl = ''
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = 'http://192.168.81.107:8080'
|
||||
imgBaseUrl = 'http://192.168.81.156:8081/hl_nlapp/'
|
||||
} else if (process.env.NODE_ENV === 'production') {
|
||||
baseUrl = 'http://192.168.81.138:8080'
|
||||
imgBaseUrl = 'http://192.168.81.156:8081/hl_nlapp/'
|
||||
}
|
||||
|
||||
export {
|
||||
baseUrl,
|
||||
imgBaseUrl
|
||||
}
|
||||
8
src/config/filter.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const filter = {
|
||||
numeric (value, bit) {
|
||||
if (!value) return ''
|
||||
return Number(value).toFixed(bit)
|
||||
}
|
||||
}
|
||||
|
||||
export default filter
|
||||
79
src/config/getData1.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import {post, post2} from '@config/http.js'
|
||||
// import store from '../vuex/store'
|
||||
|
||||
// 指令管理
|
||||
// 1.1 查询未完成指令
|
||||
export const queryInstraction = (keyword, scode, ncode) => post2('api/hand/insts', {
|
||||
keyword: keyword,
|
||||
start_devicecode: scode,
|
||||
next_devicecode: ncode
|
||||
})
|
||||
// 1.2 指令操作
|
||||
export const instOperation = (uuid, type) => post2('api/hand/inst', {
|
||||
inst_uuid: uuid,
|
||||
type: type
|
||||
})
|
||||
|
||||
// 任务管理
|
||||
// 1.1 查询未完成指令
|
||||
export const queryTask = (keyword, scode, ncode) => post2('api/hand/tasks', {
|
||||
keyword: keyword,
|
||||
start_devicecode: scode,
|
||||
next_devicecode: ncode
|
||||
})
|
||||
// 1.2 指令操作
|
||||
export const taskOperation = (uuid, type) => post2('api/hand/taskoperation', {
|
||||
inst_uuid: uuid,
|
||||
type: type
|
||||
})
|
||||
|
||||
// 送料
|
||||
// 1.1查询区域点位
|
||||
export const sendMaterialqueryPoint = () => post('api/pda/sendMaterial/queryPoint', {})
|
||||
// 1.2送料确定
|
||||
export const sendMaterialconfirm = (rid, pid, pcode, qty) => post('api/pda/sendMaterial/confirm', {
|
||||
region_id: rid,
|
||||
point_id: pid,
|
||||
point_code: pcode,
|
||||
qty: qty
|
||||
})
|
||||
|
||||
// 叫料
|
||||
// 1.1查询区域点位
|
||||
export const callMaterialqueryPoint = () => post('api/pda/callMaterial/queryPoint', {})
|
||||
// 1.2叫料确定
|
||||
export const callMaterialconfirm = (rid, pid, pcode) => post('api/pda/callMaterial/confirm', {
|
||||
region_id: rid,
|
||||
point_id: pid,
|
||||
point_code: pcode
|
||||
})
|
||||
|
||||
// 送空托盘
|
||||
// 1.1查询区域点位
|
||||
export const sendEmptyqueryPoint = () => post('api/pda/sendEmpty/queryPoint', {})
|
||||
// 1.2送托盘确认
|
||||
export const sendEmptyconfirm = (rid, pid, pcode, vcode, qty) => post('api/pda/sendEmpty/confirm', {
|
||||
region_id: rid,
|
||||
point_id: pid,
|
||||
point_code: pcode,
|
||||
vehicle_code: vcode,
|
||||
qty: qty
|
||||
})
|
||||
|
||||
// 呼叫空托盘
|
||||
// 1.1查询区域点位
|
||||
export const callEmptyqueryPoint = () => post('api/pda/callEmpty/queryPoint', {})
|
||||
// 1.2送料确定
|
||||
export const callEmptyconfirm = (rid, pid, pcode, qty) => post('api/pda/callEmpty/confirm', {
|
||||
region_id: rid,
|
||||
point_id: pid,
|
||||
point_code: pcode,
|
||||
qty: qty
|
||||
})
|
||||
|
||||
// 组盘-托盘数量绑定
|
||||
// 1.1托盘数量绑定确认
|
||||
export const emptyAndQtyconfirm = (vcode, qty) => post('api/pda/emptyAndQty/confirm', {
|
||||
vehicle_code: vcode,
|
||||
qty: qty
|
||||
})
|
||||
122
src/config/getData2.js
Normal file
@@ -0,0 +1,122 @@
|
||||
import {post, post2} from '@config/http.js'
|
||||
|
||||
// 测试接口返回结果
|
||||
export const test = () => post('test/1', {})
|
||||
|
||||
// 手持登录
|
||||
export const loginApi = (user, password) => post('api/pda/login', {
|
||||
username: user,
|
||||
password: password
|
||||
})
|
||||
// 手持登陆查询菜单权限
|
||||
export const authority = (id) => post('api/pda/authority', {
|
||||
accountId: id
|
||||
})
|
||||
// 修改密码
|
||||
export const updatePass = (Rfold, Rfnew) => post('api/pda/updatePass', {
|
||||
RfoldPass: Rfold,
|
||||
RfnewPass: Rfnew
|
||||
})
|
||||
|
||||
/** 呼叫空托盘 */
|
||||
// 1.1查询区域
|
||||
export const queryArea = () => post('api/pda/callEmpty/queryArea', {})
|
||||
// 1.2根据区域查询点位
|
||||
export const queryPointByArea = (code) => post('api/pda/callEmpty/queryPointByArea', {
|
||||
area_code: code
|
||||
})
|
||||
// 1.3 呼叫空托盘确定
|
||||
export const callEmptyConfirm = (id, code, pname, acode) => post('api/pda/callEmpty/confirm', {
|
||||
point_id: id,
|
||||
point_code: code,
|
||||
point_name: pname,
|
||||
area_code: acode
|
||||
})
|
||||
|
||||
/** 托盘点位绑定 */
|
||||
// 1.1查询区域
|
||||
export const queryArea1 = () => post('api/pda/sendEmpty/queryArea', {})
|
||||
// 1.2根据区域查询点位
|
||||
export const queryPointByArea1 = (code) => post('api/pda/sendEmpty/queryPointByArea', {
|
||||
area_code: code
|
||||
})
|
||||
// 1.2托盘点位绑定确认
|
||||
export const bindingConfirm = (code, vcode, status, is) => post('api/pda/binding/confirm', {
|
||||
point_code: code,
|
||||
vehicle_code: vcode,
|
||||
point_status: status,
|
||||
is_lock: is
|
||||
})
|
||||
|
||||
/** 盘点管理 */
|
||||
// 1.1查询物料
|
||||
export const queryMaterial = (page, size) => post('api/pda/check/queryMaterial', {
|
||||
page: page,
|
||||
size: size
|
||||
})
|
||||
// 1.2查询盘点单据
|
||||
export const queryIvt = (suuid, tuuid, page, size) => post('api/pda/check/queryIvt', {
|
||||
sect_uuid: suuid,
|
||||
struct_uuid: tuuid,
|
||||
page: page,
|
||||
size: size
|
||||
})
|
||||
// 1.3盘点确定
|
||||
export const checkConfirm = (arr) => post('api/pda/check/confirm', {
|
||||
JSONarray: arr
|
||||
})
|
||||
// 1.4查询库区
|
||||
export const querySectCode = () => post('api/pda/check/querySectCode', {})
|
||||
// 1.5查询仓位
|
||||
export const queryStructCode = (uuid) => post('api/pda/check/queryStructCode', {
|
||||
sect_uuid: uuid
|
||||
})
|
||||
|
||||
/** 入窑输送线规则 */
|
||||
// 1.1根据规则模式查询信息
|
||||
export const queryInfo = (mode) => post('api/pda/ruleSetting/queryInfo', {
|
||||
mode: mode
|
||||
})
|
||||
export const ruleSettingConfirm = (mode, is, JSONArray) => post('api/pda/ruleSetting/confirm', {
|
||||
mode: mode,
|
||||
is_used: is,
|
||||
JSONArray: JSONArray
|
||||
})
|
||||
|
||||
/** 托盘物料绑定 */
|
||||
// 1.1根据托盘查询信息
|
||||
export const queryInfoByVehicle = (code) => post('api/pda/bindingMaterial/queryInfoByVehicle', {
|
||||
vehicle_code: code
|
||||
})
|
||||
// 1.2确定
|
||||
export const bindingMaterialConfirm = (id, code, mname, pcsn, qty, vcode) => post('api/pda/bindingMaterial/confirm', {
|
||||
material_id: id,
|
||||
material_code: code,
|
||||
material_name: mname,
|
||||
pcsn: pcsn,
|
||||
qty: qty,
|
||||
vehicle_code: vcode
|
||||
})
|
||||
|
||||
/** 定点任务 */
|
||||
// 1.1查询设备起点和终点
|
||||
export const queryDevice = () => post2('api/hand/queryDevice', {
|
||||
})
|
||||
// 1.2任务生成
|
||||
export const handTask = (type, num, scode, fy, fz, ncode, ty, tz) => post2('api/hand/task', {
|
||||
task_type: type,
|
||||
emptypallet_num: num,
|
||||
start_devicecode: scode,
|
||||
form_y: fy,
|
||||
form_z: fz,
|
||||
next_devicecode: ncode,
|
||||
to_y: ty,
|
||||
to_z: tz
|
||||
})
|
||||
// 1.3查询任务类型
|
||||
export const taskType = () => post2('api/hand/task_type', {
|
||||
})
|
||||
// 1.4查询货架点位的列、层
|
||||
export const storageCode = (code) => post2('api/hand/queryStorageExtra', {
|
||||
storage_code: code
|
||||
})
|
||||
80
src/config/http.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import axios from 'axios'
|
||||
import { Dialog } from './mUtils.js'
|
||||
import store from '../vuex/store'
|
||||
import router from '@/router'
|
||||
|
||||
axios.defaults.timeout = 50000
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
||||
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
let token = ''
|
||||
if (store.getters.userInfo !== '') {
|
||||
token = JSON.parse(store.getters.userInfo).token
|
||||
}
|
||||
token && (config.headers.Authorization = token)
|
||||
if (config.method === 'post') {
|
||||
if (!config.data.flag) {
|
||||
config.data = config.data
|
||||
} else {
|
||||
config.data = config.data.formData
|
||||
}
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
Dialog('错误的传参')
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
return Promise.resolve(response)
|
||||
},
|
||||
error => {
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 400:
|
||||
break
|
||||
case 401:
|
||||
store.dispatch('setSignOut')
|
||||
router.push('/login')
|
||||
break
|
||||
}
|
||||
return Promise.reject(error.response.data)
|
||||
} else {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
export const post = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, error => {
|
||||
Dialog(error.message)
|
||||
reject(error.message)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const post2 = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(`${store.getters.acsUrl}/` + sevmethod, params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, error => {
|
||||
Dialog(error.message)
|
||||
reject(error.message)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
46
src/config/http1.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import axios from 'axios'
|
||||
import { Dialog } from './mUtils.js'
|
||||
import store from '../vuex/store'
|
||||
|
||||
axios.defaults.timeout = 50000
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
||||
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
if (config.method === 'post') {
|
||||
if (!config.data.flag) {
|
||||
config.data = config.data
|
||||
} else {
|
||||
config.data = config.data.formData
|
||||
}
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
Dialog('错误的传参')
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
return Promise.resolve(response)
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export const post = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(`${store.getters.acsUrl}/` + sevmethod, params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, error => {
|
||||
reject(error.message)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
114
src/config/isOperate.js
Normal file
@@ -0,0 +1,114 @@
|
||||
// 用户长时间未操作 退出登录
|
||||
import store from '../vuex/store'
|
||||
import router from '@/router'
|
||||
var timer = null
|
||||
|
||||
clearInterval(timer)
|
||||
|
||||
export function isOperateFun () {
|
||||
var lastTime = new Date().getTime() // 最后一次点击时间
|
||||
var currentTime = new Date().getTime() // 当前时间
|
||||
var timeOut = 10 * 60 * 1000 // 允许最长未操作时间
|
||||
// var i = 1 // 辅助作用
|
||||
|
||||
function handleReset () { // 重新赋值最后一次点击时间,清除定时器,重新开始定时器
|
||||
// console.log('又点击了!!!!!!')
|
||||
// i = 1
|
||||
|
||||
lastTime = new Date().getTime()
|
||||
|
||||
if (timer) {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
|
||||
if (!timer) {
|
||||
// console.log('真好!重新开始')
|
||||
handleInterval()
|
||||
}
|
||||
}
|
||||
|
||||
// document.onclick = () => { // 单击事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.ondblclick = () => { // 双击事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmousedown = () => { // 按下鼠标键时触发
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmouseup = () => { // 释放按下的鼠标键时触发
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmousemove = () => { // 鼠标移动事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmouseover = () => { // 移入事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmouseout = () => { // 移出事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmouseenter = () => { // 移入事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.onmouseleave = () => { // 移出事件
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.touchstart = () => {
|
||||
// alert('touchstart')
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.touchend = () => {
|
||||
// alert('touchend')
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
// document.touchmove = () => {
|
||||
// alert('touchend')
|
||||
// handleReset()
|
||||
// }
|
||||
|
||||
window.onload = function startup () {
|
||||
document.addEventListener('touchstart', handleReset, false)
|
||||
document.addEventListener('touchend', handleReset, false)
|
||||
document.addEventListener('touchmove', handleReset, false)
|
||||
}
|
||||
|
||||
function handleInterval () { // 定时器
|
||||
timer = setInterval(() => {
|
||||
currentTime = new Date().getTime() // 当前时间
|
||||
|
||||
// console.log(`${i++}-currentTime`, currentTime)
|
||||
// console.log('最后一次点击时间', lastTime)
|
||||
|
||||
if (currentTime - lastTime > timeOut) {
|
||||
// console.log('长时间未操作')
|
||||
|
||||
clearInterval(timer) // 清除定时器
|
||||
|
||||
store.dispatch('setSignOut').then(() => { // 执行退出并跳转到首页
|
||||
const path = window.location.href.split('#')[1]
|
||||
|
||||
if (path !== '/login') { // 判断当前路由不是首页 则跳转至首页
|
||||
router.push('/login')
|
||||
}
|
||||
|
||||
// window.AndroidWebView.loginOut() // 执行安卓退出方法
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
handleInterval() // 一开始程序 默认执行定制器
|
||||
}
|
||||
137
src/config/mUtils.js
Normal file
@@ -0,0 +1,137 @@
|
||||
import store from '../vuex/store'
|
||||
|
||||
/**
|
||||
* 弹出框
|
||||
*/
|
||||
export const Dialog = (str) => {
|
||||
store.dispatch('showAlert', true)
|
||||
store.dispatch('alertMsg', str)
|
||||
// setTimeout(() => {
|
||||
// store.dispatch('showAlert', false)
|
||||
// }, 30000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 提示框
|
||||
*/
|
||||
export const toast = (str) => {
|
||||
store.dispatch('showToast', true)
|
||||
store.dispatch('toastMsg', str)
|
||||
setTimeout(() => {
|
||||
store.dispatch('showToast', false)
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储localStorage
|
||||
*/
|
||||
export const setStore = (name, content) => {
|
||||
if (!name) return
|
||||
if (typeof content !== 'string') {
|
||||
content = JSON.stringify(content)
|
||||
}
|
||||
window.localStorage.setItem(name, content)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取localStorage
|
||||
*/
|
||||
export const getStore = name => {
|
||||
if (!name) return
|
||||
return window.localStorage.getItem(name)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取style样式
|
||||
*/
|
||||
export const getStyle = (element, attr, NumberMode = 'int') => {
|
||||
let target
|
||||
// scrollTop 获取方式不同,没有它不属于style,而且只有document.body才能用
|
||||
if (attr === 'scrollTop') {
|
||||
target = element.scrollTop
|
||||
} else if (element.currentStyle) {
|
||||
target = element.currentStyle[attr]
|
||||
} else {
|
||||
target = document.defaultView.getComputedStyle(element, null)[attr]
|
||||
}
|
||||
// 在获取 opactiy 时需要获取小数 parseFloat
|
||||
return NumberMode === 'float' ? parseFloat(target) : parseInt(target)
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数加法
|
||||
*/
|
||||
export const accAdd = (arg1, arg2) => {
|
||||
var r1, r2, m, c
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
c = Math.abs(r1 - r2)
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c)
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
return (arg1 + arg2) / m
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数减法
|
||||
*/
|
||||
export const accSubtract = (arg1, arg2) => {
|
||||
var r1, r2, m, c
|
||||
try {
|
||||
r1 = arg1.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r1 = 0
|
||||
}
|
||||
try {
|
||||
r2 = arg2.toString().split('.')[1].length
|
||||
} catch (e) {
|
||||
r2 = 0
|
||||
}
|
||||
c = Math.abs(r1 - r2)
|
||||
m = Math.pow(10, Math.max(r1, r2))
|
||||
if (c > 0) {
|
||||
var cm = Math.pow(10, c)
|
||||
if (r1 > r2) {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', '')) * cm
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', '')) * cm
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
} else {
|
||||
arg1 = Number(arg1.toString().replace('.', ''))
|
||||
arg2 = Number(arg2.toString().replace('.', ''))
|
||||
}
|
||||
return (arg1 - arg2) / m
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数乘法
|
||||
*/
|
||||
export const accMul = (arg1, arg2) => {
|
||||
var m = 0
|
||||
var s1 = arg1.toString()
|
||||
var s2 = arg2.toString()
|
||||
try { m += s1.split('.')[1].length } catch (e) {}
|
||||
try { m += s2.split('.')[1].length } catch (e) {}
|
||||
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
|
||||
}
|
||||
88
src/config/print.js
Normal file
@@ -0,0 +1,88 @@
|
||||
export const initPrint = jparam => {
|
||||
var LODOP = this.LODOP
|
||||
console.log(LODOP, 'LODOP')
|
||||
// var LODOP=getLodop()
|
||||
if (typeof (LODOP) === 'undefined') {
|
||||
return null
|
||||
}
|
||||
LODOP.PRINT_INITA(0, 0, jparam.width, jparam.height, jparam.name)
|
||||
// LODOP.PRINT_INIT(jparam.name)
|
||||
LODOP.SET_LICENSES('浙江省烟草专卖局(公司)', 'C0C4A46A3A0D1F526D426018D9F11921', '', '')
|
||||
// LODOP.SET_PRINT_PAGESIZE(1, jparam.width/*0.1mm为单位*/, jparam.height, 'A4')
|
||||
// LODOP.SET_PRINT_MODE('POS_BASEON_PAPER', true)
|
||||
if (jparam.background) {
|
||||
LODOP.ADD_PRINT_SETUP_BKIMG("<img border='0' src='" + jparam.background + "'>")
|
||||
LODOP.SET_SHOW_MODE('BKIMG_IN_PREVIEW', 1) // 注:"BKIMG_IN_PREVIEW"-预览包含背景图 "BKIMG_IN_FIRSTPAGE"- 仅首页包含背景图
|
||||
}
|
||||
LODOP.SET_SHOW_MODE('SETUP_ENABLESS', '10000000000000')
|
||||
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
|
||||
return LODOP
|
||||
}
|
||||
|
||||
export const print = data => {
|
||||
var LODOP = this.LODOP
|
||||
// alert(1)
|
||||
// LODOP.PRINT_INIT("打印任务名"); // 首先一个初始化语句
|
||||
// LODOP.ADD_PRINT_TEXT(0,0,100,20,"文本内容一");// 然后多个ADD语句及SET语句
|
||||
// LODOP.PRINT(); // 最后一个打印(或预览、维护、设计)语句
|
||||
// debugger
|
||||
// var data = {
|
||||
// param1: 'BGH00015',
|
||||
// param2: '8月',
|
||||
// param3: '马达,TE3-132S-4 5.5KW B3',
|
||||
// param4: '03049',
|
||||
// param5: '10',
|
||||
// // param6:'01#BGH00015', // 二维码
|
||||
// param6: '这个是二维码的内容。。哈哈哈', // 二维码
|
||||
// param7: '1002:大立库',
|
||||
// param8: '2018-08-18'
|
||||
// }
|
||||
// var LODOP = this.init_Print({
|
||||
// name: '打印模板1',
|
||||
// width: '80mm',
|
||||
// height: '60mm'
|
||||
// })
|
||||
initPrint({
|
||||
name: '打印模板1',
|
||||
width: '80mm',
|
||||
height: '60mm'
|
||||
})
|
||||
console.log('LODOP1', LODOP)
|
||||
if (!LODOP) {
|
||||
this.toast('未连接到打印机')
|
||||
return
|
||||
}
|
||||
// LODOP.PRINT_INITA(0,0,'80mm','60mm','打印模板1')
|
||||
LODOP.ADD_PRINT_RECT(0, 0, '80mm', '60mm', 0, 1)
|
||||
// 第一行 第一个参数
|
||||
// LODOP.SET_PRINT_STYLEA(2, 'FontName', '隶书')
|
||||
LODOP.SET_PRINT_STYLE('FontSize', 25)
|
||||
LODOP.SET_PRINT_STYLE('Bold', 1)
|
||||
LODOP.ADD_PRINT_TEXT('5mm', '5mm', '50mm', '20mm', data.param1)
|
||||
// 第一行 第二个参数
|
||||
LODOP.ADD_PRINT_TEXT('5mm', '60mm', '50mm', '20mm', data.param2)
|
||||
// 第二行 第一个参数
|
||||
LODOP.SET_PRINT_STYLE('FontSize', 13)
|
||||
LODOP.SET_PRINT_STYLE('Bold', 0)
|
||||
LODOP.ADD_PRINT_TEXT('17mm', '5mm', '80mm', '20mm', data.param3)
|
||||
// 第二行 第二个参数
|
||||
LODOP.ADD_PRINT_TEXT('25mm', '15mm', '50mm', '20mm', data.param4)
|
||||
// 第三行 第一个参数
|
||||
LODOP.SET_PRINT_STYLE('FontSize', 20)
|
||||
LODOP.SET_PRINT_STYLE('Bold', 0)
|
||||
LODOP.ADD_PRINT_TEXT('33mm', '10mm', '50mm', '20mm', data.param5)
|
||||
// LODOP.ADD_PRINT_TEXT('33mm', '25mm', '20mm', '20mm', '台')
|
||||
// 第四行 第一个参数
|
||||
LODOP.SET_PRINT_STYLE('FontSize', 15)
|
||||
LODOP.SET_PRINT_STYLE('Bold', 0)
|
||||
LODOP.ADD_PRINT_TEXT('43mm', '5mm', '60mm', '20mm', data.param7)
|
||||
// 第五行 第一个参数
|
||||
LODOP.ADD_PRINT_TEXT('53mm', '5mm', '60mm', '20mm', data.param8)
|
||||
// 打印二维码
|
||||
LODOP.ADD_PRINT_BARCODE('25mm', '45mm', '35mm', '35mm', 'QRCode', data.param6)
|
||||
// LODOP.SET_PRINT_STYLEA(0, 'GroundColor', '#0080FF')
|
||||
console.log('LODOP2', LODOP)
|
||||
LODOP.PRINT()
|
||||
console.log('LODOP3', LODOP)
|
||||
this.toast('打印成功!')
|
||||
}
|
||||
12
src/config/rem.js
Normal file
@@ -0,0 +1,12 @@
|
||||
(function (doc, win) {
|
||||
var docEl = doc.documentElement
|
||||
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
|
||||
var recalc = function () {
|
||||
var clientWidth = docEl.clientWidth
|
||||
if (!clientWidth) return
|
||||
docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'
|
||||
}
|
||||
if (!doc.addEventListener) return
|
||||
win.addEventListener(resizeEvt, recalc, false)
|
||||
doc.addEventListener('DOMContentLoaded', recalc, false)
|
||||
})(document, window)
|
||||
50
src/fetch/apiAgv.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
// import * as _ from '../util/tool'
|
||||
|
||||
// axios 配置
|
||||
axios.defaults.timeout = 30000
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
|
||||
axios.defaults.baseURL = 'http://192.168.81.107:8080'
|
||||
|
||||
// POST传参序列化
|
||||
axios.interceptors.request.use((config) => {
|
||||
if (config.method === 'post') {
|
||||
config.data = qs.stringify(config.data)
|
||||
}
|
||||
return config
|
||||
}, (error) => {
|
||||
// this.toast('错误的传参', 'fail')
|
||||
return Promise.reject(error)
|
||||
})
|
||||
|
||||
// 返回状态判断
|
||||
axios.interceptors.response.use((res) => {
|
||||
if (!res.data.code) {
|
||||
return Promise.reject(res)
|
||||
}
|
||||
return res
|
||||
}, (error) => {
|
||||
// _.alert('网络异常', 'fail')
|
||||
return Promise.reject(error)
|
||||
})
|
||||
|
||||
export function fetch (params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post('/get_all_agv_position' + new Date().getTime(), params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
}, err => {
|
||||
reject(err)
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
$post (params) {
|
||||
return fetch(params)
|
||||
}
|
||||
}
|
||||
BIN
src/images/add.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/images/back.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/images/bg.png
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
src/images/bg2.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/images/bg3.png
Normal file
|
After Width: | Height: | Size: 159 KiB |
BIN
src/images/bg4.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
src/images/bind2.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src/images/close.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/images/del.png
Normal file
|
After Width: | Height: | Size: 831 B |
BIN
src/images/delred.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/images/ewm.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/images/exit.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/images/eyeclose.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/images/eyeopen.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/images/home.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/images/icon-key.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/images/icon-phone.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/images/logo.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
src/images/menu/agvError.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
src/images/menu/carrierCheck.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/images/menu/carrierInSect.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/images/menu/damaged.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/images/menu/dealOutSect.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/images/menu/directOutbound.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/images/menu/feedingDelivery.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/images/menu/issuelDeliver.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src/images/menu/jobManage.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/images/menu/knCheck.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
src/images/menu/kwCheck.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/images/menu/materChange.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src/images/menu/materCheck.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/images/menu/materManage.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
src/images/menu/passwordManage.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src/images/menu/pointSet.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
src/images/menu/pointTask.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src/images/menu/qcInSect.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/images/menu/qcPersonLogin.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src/images/menu/receivePlate.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src/images/menu/shelfBinding.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/images/menu/sortorOut.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/images/menu/sortorSet.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/images/menu/stockQuery.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/images/menu/sweepReceive.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/images/more.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/images/noimg.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/images/open.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
17
src/images/oval-black.svg
Executable file
@@ -0,0 +1,17 @@
|
||||
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
|
||||
<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#000">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<g transform="translate(1 1)" stroke-width="2">
|
||||
<circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
|
||||
<path d="M36 18c0-9.94-8.06-18-18-18">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
from="0 18 18"
|
||||
to="360 18 18"
|
||||
dur="1s"
|
||||
repeatCount="indefinite"/>
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 694 B |
17
src/images/oval-white.svg
Executable file
@@ -0,0 +1,17 @@
|
||||
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
|
||||
<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<g transform="translate(1 1)" stroke-width="2">
|
||||
<circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
|
||||
<path d="M36 18c0-9.94-8.06-18-18-18">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
type="rotate"
|
||||
from="0 18 18"
|
||||
to="360 18 18"
|
||||
dur="1s"
|
||||
repeatCount="indefinite"/>
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 694 B |
BIN
src/images/pcloginbg.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
src/images/saoma.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/images/search.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/images/select.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/images/triangle-gray.png
Normal file
|
After Width: | Height: | Size: 760 B |
BIN
src/images/triangle.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/images/unselect.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |