git: init+修改node版本
14
.babelrc
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
["env", { "modules": false }],
|
||||||
|
"stage-2"
|
||||||
|
],
|
||||||
|
"plugins": ["transform-runtime"],
|
||||||
|
"comments": false,
|
||||||
|
"env": {
|
||||||
|
"test": {
|
||||||
|
"presets": ["env", "stage-2"],
|
||||||
|
"plugins": [ "istanbul" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
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
|
||||||
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
build/*.js
|
||||||
|
config/*.js
|
||||||
29
.eslintrc.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// http://eslint.org/docs/user-guide/configuring
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
parser: 'babel-eslint',
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
},
|
||||||
|
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
|
||||||
|
extends: 'standard',
|
||||||
|
// required to lint *.vue files
|
||||||
|
plugins: [
|
||||||
|
'html'
|
||||||
|
],
|
||||||
|
// add your custom rules here
|
||||||
|
'rules': {
|
||||||
|
// allow paren-less arrow functions
|
||||||
|
'arrow-parens': 0,
|
||||||
|
// allow async-await
|
||||||
|
'generator-star-spacing': 0,
|
||||||
|
// allow debugger during development
|
||||||
|
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||||
|
'eol-last': 0,
|
||||||
|
'space-before-function-paren': 0
|
||||||
|
}
|
||||||
|
}
|
||||||
22
.gitignore
vendored
@@ -1,11 +1,15 @@
|
|||||||
# ---> Vue
|
|
||||||
# gitignore template for Vue.js projects
|
|
||||||
#
|
|
||||||
# Recommended template: Node.gitignore
|
|
||||||
|
|
||||||
# TODO: where does this rule come from?
|
.idea/
|
||||||
docs/_book
|
.web/
|
||||||
|
.tmp/
|
||||||
# TODO: where does this rule come from?
|
.node_modules/
|
||||||
test/
|
node_modules
|
||||||
|
.DS_Store/
|
||||||
|
.DS_Store
|
||||||
|
src/.DS_Store
|
||||||
|
*/.DS_Store
|
||||||
|
web/
|
||||||
|
web
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
web.zip
|
||||||
|
|||||||
8
.postcssrc.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"plugins": {
|
||||||
|
// to edit target browsers: use "browserlist" field in package.json
|
||||||
|
"autoprefixer": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
build/build.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
require('./check-versions')()
|
||||||
|
|
||||||
|
// process.env.NODE_ENV = 'production'
|
||||||
|
|
||||||
|
var ora = require('ora')
|
||||||
|
var rm = require('rimraf')
|
||||||
|
var path = require('path')
|
||||||
|
var chalk = require('chalk')
|
||||||
|
var webpack = require('webpack')
|
||||||
|
var config = require('../config')
|
||||||
|
var webpackConfig = require('./webpack.prod.conf')
|
||||||
|
|
||||||
|
var spinner = ora('building for production...')
|
||||||
|
spinner.start()
|
||||||
|
|
||||||
|
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||||
|
if (err) throw err
|
||||||
|
webpack(webpackConfig, function (err, stats) {
|
||||||
|
spinner.stop()
|
||||||
|
if (err) throw err
|
||||||
|
process.stdout.write(stats.toString({
|
||||||
|
colors: true,
|
||||||
|
modules: false,
|
||||||
|
children: false,
|
||||||
|
chunks: false,
|
||||||
|
chunkModules: false
|
||||||
|
}) + '\n\n')
|
||||||
|
|
||||||
|
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'
|
||||||
|
))
|
||||||
|
})
|
||||||
|
})
|
||||||
48
build/check-versions.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
var chalk = require('chalk')
|
||||||
|
var semver = require('semver')
|
||||||
|
var packageConfig = require('../package.json')
|
||||||
|
var shell = require('shelljs')
|
||||||
|
function exec (cmd) {
|
||||||
|
return require('child_process').execSync(cmd).toString().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
var 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 () {
|
||||||
|
var warnings = []
|
||||||
|
for (var i = 0; i < versionRequirements.length; i++) {
|
||||||
|
var 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 (var i = 0; i < warnings.length; i++) {
|
||||||
|
var warning = warnings[i]
|
||||||
|
console.log(' ' + warning)
|
||||||
|
}
|
||||||
|
console.log()
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
9
build/dev-client.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
require('eventsource-polyfill')
|
||||||
|
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
|
||||||
|
|
||||||
|
hotClient.subscribe(function (event) {
|
||||||
|
if (event.action === 'reload') {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
})
|
||||||
101
build/dev-server.js
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
require('./check-versions')()
|
||||||
|
|
||||||
|
var config = require('../config')
|
||||||
|
if (!process.env.NODE_ENV) {
|
||||||
|
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
|
||||||
|
}
|
||||||
|
|
||||||
|
var opn = require('opn')
|
||||||
|
var path = require('path')
|
||||||
|
var express = require('express')
|
||||||
|
var webpack = require('webpack')
|
||||||
|
var proxyMiddleware = require('http-proxy-middleware')
|
||||||
|
var webpackConfig = require('./webpack.dev.conf')
|
||||||
|
var axios = require('axios')
|
||||||
|
|
||||||
|
// default port where dev server listens for incoming traffic
|
||||||
|
var port = process.env.PORT || config.dev.port
|
||||||
|
// automatically open browser, if not set will be false
|
||||||
|
var autoOpenBrowser = !!config.dev.autoOpenBrowser
|
||||||
|
// Define HTTP proxies to your custom API backend
|
||||||
|
// https://github.com/chimurai/http-proxy-middleware
|
||||||
|
var proxyTable = config.dev.proxyTable
|
||||||
|
|
||||||
|
var app = express()
|
||||||
|
|
||||||
|
let dev = "http://127.0.0.1:8080"
|
||||||
|
let site = "http://127.0.0.1:8080"
|
||||||
|
app.middleware = [
|
||||||
|
proxyMiddleware(['/v2'], { target: site, changeOrigin: true }),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app.use(app.middleware);
|
||||||
|
|
||||||
|
var compiler = webpack(webpackConfig)
|
||||||
|
|
||||||
|
var devMiddleware = require('webpack-dev-middleware')(compiler, {
|
||||||
|
publicPath: webpackConfig.output.publicPath,
|
||||||
|
quiet: true
|
||||||
|
})
|
||||||
|
|
||||||
|
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
|
||||||
|
log: () => { }
|
||||||
|
})
|
||||||
|
// force page reload when html-webpack-plugin template changes
|
||||||
|
compiler.plugin('compilation', function (compilation) {
|
||||||
|
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
|
||||||
|
hotMiddleware.publish({ action: 'reload' })
|
||||||
|
cb()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// proxy api requests
|
||||||
|
Object.keys(proxyTable).forEach(function (context) {
|
||||||
|
var options = proxyTable[context]
|
||||||
|
if (typeof options === 'string') {
|
||||||
|
options = { target: options }
|
||||||
|
}
|
||||||
|
app.use(proxyMiddleware(options.filter || context, options))
|
||||||
|
})
|
||||||
|
|
||||||
|
// handle fallback for HTML5 history API
|
||||||
|
app.use(require('connect-history-api-fallback')())
|
||||||
|
|
||||||
|
// serve webpack bundle output
|
||||||
|
app.use(devMiddleware)
|
||||||
|
|
||||||
|
// enable hot-reload and state-preserving
|
||||||
|
// compilation error display
|
||||||
|
app.use(hotMiddleware)
|
||||||
|
|
||||||
|
// serve pure static assets
|
||||||
|
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
|
||||||
|
app.use(staticPath, express.static('./static'))
|
||||||
|
|
||||||
|
var uri = 'http://localhost:' + port
|
||||||
|
|
||||||
|
var _resolve
|
||||||
|
var readyPromise = new Promise(resolve => {
|
||||||
|
_resolve = resolve
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('> Starting dev server...')
|
||||||
|
devMiddleware.waitUntilValid(() => {
|
||||||
|
console.log('> Listening at ' + uri + '\n')
|
||||||
|
// when env is testing, don't need open it
|
||||||
|
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
|
||||||
|
opn(uri)
|
||||||
|
}
|
||||||
|
_resolve()
|
||||||
|
})
|
||||||
|
|
||||||
|
var server = app.listen(port)
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
ready: readyPromise,
|
||||||
|
close: () => {
|
||||||
|
server.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
72
build/utils.js
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
var path = require('path')
|
||||||
|
var config = require('../config')
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
|
|
||||||
|
exports.assetsPath = function (_path) {
|
||||||
|
var assetsSubDirectory = process.env.NODE_ENV === 'production'
|
||||||
|
? config.build.assetsSubDirectory
|
||||||
|
: config.dev.assetsSubDirectory
|
||||||
|
console.log("prod?",process.env.NODE_ENV === 'production',"打包路径-------:",assetsSubDirectory,_path);
|
||||||
|
return path.posix.join(assetsSubDirectory, _path)
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.cssLoaders = function (options) {
|
||||||
|
options = options || {}
|
||||||
|
|
||||||
|
var cssLoader = {
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
minimize: process.env.NODE_ENV === 'production',
|
||||||
|
sourceMap: options.sourceMap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// generate loader string to be used with extract text plugin
|
||||||
|
function generateLoaders (loader, loaderOptions) {
|
||||||
|
var loaders = [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,
|
||||||
|
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) {
|
||||||
|
var output = []
|
||||||
|
var loaders = exports.cssLoaders(options)
|
||||||
|
for (var extension in loaders) {
|
||||||
|
var loader = loaders[extension]
|
||||||
|
output.push({
|
||||||
|
test: new RegExp('\\.' + extension + '$'),
|
||||||
|
use: loader
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
}
|
||||||
17
build/vue-loader.conf.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
var utils = require('./utils')
|
||||||
|
var config = require('../config')
|
||||||
|
var isProduction = process.env.NODE_ENV === 'production'
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
loaders: utils.cssLoaders({
|
||||||
|
sourceMap: isProduction
|
||||||
|
? config.build.productionSourceMap
|
||||||
|
: config.dev.cssSourceMap,
|
||||||
|
extract: isProduction
|
||||||
|
}),
|
||||||
|
postcss: [
|
||||||
|
require('autoprefixer')({
|
||||||
|
browsers: ['iOS>=7', 'Android>= 4.1',' ie>=8']
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
75
build/webpack.base.conf.js
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
var path = require('path')
|
||||||
|
var utils = require('./utils')
|
||||||
|
var config = require('../config')
|
||||||
|
var vueLoaderConfig = require('./vue-loader.conf')
|
||||||
|
|
||||||
|
function resolve(dir) {
|
||||||
|
return path.join(__dirname, '..', dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
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: {
|
||||||
|
'@': resolve('src'),
|
||||||
|
'common': resolve('src/common'),
|
||||||
|
'components': resolve('src/components'),
|
||||||
|
'base': resolve('src/base'),
|
||||||
|
'api': resolve('src/api'),
|
||||||
|
'assets': resolve('src/assets')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
// {
|
||||||
|
// test: /\.(js|vue)$/,
|
||||||
|
// loader: 'eslint-loader',
|
||||||
|
// enforce: 'pre',
|
||||||
|
// include: [resolve('src'), resolve('test')],
|
||||||
|
// options: {
|
||||||
|
// formatter: require('eslint-friendly-formatter')
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
test: /\.sass$/,
|
||||||
|
loaders: ['style', 'css', 'sass']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: vueLoaderConfig
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
include: [resolve('src'), resolve('test')]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
36
build/webpack.dev.conf.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
var utils = require('./utils')
|
||||||
|
var webpack = require('webpack')
|
||||||
|
var config = require('../config')
|
||||||
|
var merge = require('webpack-merge')
|
||||||
|
var baseWebpackConfig = require('./webpack.base.conf')
|
||||||
|
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
|
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||||
|
|
||||||
|
// add hot-reload related code to entry chunks
|
||||||
|
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
|
||||||
|
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = merge(baseWebpackConfig, {
|
||||||
|
module: {
|
||||||
|
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
|
||||||
|
},
|
||||||
|
// cheap-module-eval-source-map is faster for development
|
||||||
|
devtool: '#cheap-module-eval-source-map',
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': config.dev.env
|
||||||
|
}),
|
||||||
|
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
|
// https://github.com/ampedandwired/html-webpack-plugin
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: 'index.html',
|
||||||
|
template: 'index.html',
|
||||||
|
favicon: 'favicon.ico',
|
||||||
|
inject: true
|
||||||
|
}),
|
||||||
|
new FriendlyErrorsPlugin()
|
||||||
|
]
|
||||||
|
})
|
||||||
140
build/webpack.prod.conf.js
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
var path = require('path')
|
||||||
|
var utils = require('./utils')
|
||||||
|
var webpack = require('webpack')
|
||||||
|
var config = require('../config')
|
||||||
|
var merge = require('webpack-merge')
|
||||||
|
var baseWebpackConfig = require('./webpack.base.conf')
|
||||||
|
var CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
|
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
|
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||||
|
const FileManagerPlugin = require('filemanager-webpack-plugin');
|
||||||
|
function resolve(dir) {
|
||||||
|
return path.join(__dirname, '..', dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
var env = config.build.env
|
||||||
|
|
||||||
|
var webpackConfig = merge(baseWebpackConfig, {
|
||||||
|
module: {
|
||||||
|
rules: utils.styleLoaders({
|
||||||
|
sourceMap: config.build.productionSourceMap,
|
||||||
|
extract: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
devtool: config.build.productionSourceMap ? '#source-map' : 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 webpack.optimize.UglifyJsPlugin({
|
||||||
|
compress: {
|
||||||
|
warnings: false,
|
||||||
|
drop_debugger: true,
|
||||||
|
drop_console: true
|
||||||
|
},
|
||||||
|
sourceMap: true
|
||||||
|
}),
|
||||||
|
// extract css into its own file
|
||||||
|
new ExtractTextPlugin({
|
||||||
|
filename: utils.assetsPath('css/[name].[contenthash].css')
|
||||||
|
}),
|
||||||
|
// Compress extracted CSS. We are using this plugin so that possible
|
||||||
|
// duplicated CSS from different components can be deduped.
|
||||||
|
new OptimizeCSSPlugin({
|
||||||
|
cssProcessorOptions: {
|
||||||
|
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',
|
||||||
|
favicon: 'favicon.ico',
|
||||||
|
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'
|
||||||
|
}),
|
||||||
|
// split vendor js into its own file
|
||||||
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
|
name: 'vendor',
|
||||||
|
minChunks: function (module, count) {
|
||||||
|
// 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',
|
||||||
|
chunks: ['vendor']
|
||||||
|
}),
|
||||||
|
// copy custom static assets
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, '../static'),
|
||||||
|
to: config.build.assetsSubDirectory,
|
||||||
|
ignore: ['.*']
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
new FileManagerPlugin({
|
||||||
|
onEnd: {
|
||||||
|
archive: [
|
||||||
|
{
|
||||||
|
source: 'web',
|
||||||
|
destination: 'web.zip',
|
||||||
|
format: 'zip',
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
if (config.build.productionGzip) {
|
||||||
|
var 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) {
|
||||||
|
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||||
|
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = webpackConfig
|
||||||
BIN
coin-portal.7z
Normal file
7
config/dev.env.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
//开发环境
|
||||||
|
module.exports = {
|
||||||
|
NODE_ENV: '"development"',
|
||||||
|
BASE_API: '"http://127.0.0.1"',
|
||||||
|
DOMAIN: '"http://localhost:8081"',
|
||||||
|
SOCKET_URL:'"ws://127.0.0.1:8326/"'
|
||||||
|
}
|
||||||
44
config/index.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||||
|
var path = require('path')
|
||||||
|
let env;
|
||||||
|
if(process.env.NODE_ENV == 'production'){
|
||||||
|
env = require('./prod.env');
|
||||||
|
}else if(process.env.NODE_ENV == 'sit'){
|
||||||
|
env = require('./sit.env');
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
build: {
|
||||||
|
env: env,
|
||||||
|
port: 9000,
|
||||||
|
index: path.resolve(__dirname, '../web/index.html'),
|
||||||
|
assetsRoot: path.resolve(__dirname, '../web'),
|
||||||
|
assetsSubDirectory: 'static',
|
||||||
|
assetsPublicPath: '',
|
||||||
|
productionSourceMap: true,
|
||||||
|
// 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
|
||||||
|
},
|
||||||
|
dev: {
|
||||||
|
env: require('./dev.env'),
|
||||||
|
port: 8081,
|
||||||
|
autoOpenBrowser: true,
|
||||||
|
assetsSubDirectory: 'static',
|
||||||
|
assetsPublicPath: '/',
|
||||||
|
proxyTable: {},
|
||||||
|
// CSS Sourcemaps off by default because relative paths are "buggy"
|
||||||
|
// with this option, according to the CSS-Loader README
|
||||||
|
// (https://github.com/webpack/css-loader#sourcemaps)
|
||||||
|
// In our experience, they generally work as expected,
|
||||||
|
// just be aware of this issue when enabling this option.
|
||||||
|
cssSourceMap: false
|
||||||
|
}
|
||||||
|
}
|
||||||
7
config/prod.env.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
//测试环境
|
||||||
|
module.exports = {
|
||||||
|
NODE_ENV: '"production"',
|
||||||
|
BASE_API:'"http://47.75.125.96"',
|
||||||
|
DOMAIN: '"http://47.75.125.96"',
|
||||||
|
SOCKET_URL:'"ws://47.75.47.120:8326"'
|
||||||
|
}
|
||||||
7
config/sit.env.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
//压力测试环境
|
||||||
|
module.exports = {
|
||||||
|
NODE_ENV: '"site"',
|
||||||
|
BASE_API: '"http://www.pcn.li"',
|
||||||
|
DOMAIN: '"http://pcn.li"',
|
||||||
|
SOCKET_URL:'"ws://ws.pcn.li/"'
|
||||||
|
}
|
||||||
BIN
favicon.ico
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
47
index.html
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<!--<meta name="viewport"-->
|
||||||
|
<!--content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">-->
|
||||||
|
<!--<meta name="viewport" content="width=980,user-scalable=yes">-->
|
||||||
|
<!--<meta-->
|
||||||
|
<!--content="yes"-->
|
||||||
|
<!--name="apple-mobile-web-app-capable">-->
|
||||||
|
<!--<meta-->
|
||||||
|
<!--name="viewport"-->
|
||||||
|
<!--content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=yes;">-->
|
||||||
|
<meta name="keywords" content="">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<title></title>
|
||||||
|
<script src="<%=htmlWebpackPlugin.files.publicPath%>static/config.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
<!--<script src="https://www.sobot.com/chat/frame/js/entrance.js?sysNum=81fd739fd2d44937b31fa6b0ccb4a305"-->
|
||||||
|
<!--class="zhiCustomBtn" id="zhichiScript" data-args="属性名1=属性值1&属性名2=属性值2" data-args="manual=true"-->
|
||||||
|
<!--></script>-->
|
||||||
|
<script>
|
||||||
|
//初始化智齿咨询组件实例
|
||||||
|
// var zhiManager = (getzhiSDKInstance());
|
||||||
|
// //再调用load方法
|
||||||
|
// zhiManager.on("load", function() {
|
||||||
|
// zhiManager.initBtnDOM();
|
||||||
|
// });
|
||||||
|
// zhiManager.set('location', 3);
|
||||||
|
// zhiManager.set('vertical', 100);
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
// var _hmt = _hmt || [];
|
||||||
|
// (function() {
|
||||||
|
// var hm = document.createElement("script");
|
||||||
|
// hm.src = "https://hm.baidu.com/hm.js?b4837d50cf55e64e8da2130f1ae8e997";
|
||||||
|
// var s = document.getElementsByTagName("script")[0];
|
||||||
|
// s.parentNode.insertBefore(hm, s);
|
||||||
|
// })();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
9604
package-lock.json
generated
Normal file
110
package.json
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"name": "vue-hht",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "交易所",
|
||||||
|
"author": "qt",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "node build/dev-server.js",
|
||||||
|
"start": "node build/dev-server.js",
|
||||||
|
"build:prod": "cross-env NODE_ENV=production node build/build.js",
|
||||||
|
"build:sit": "cross-env NODE_ENV=sit node build/build.js",
|
||||||
|
"lint": "eslint --ext .js,.vue src"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.16.1",
|
||||||
|
"babel-runtime": "^6.0.0",
|
||||||
|
"better-scroll": "^0.1.15",
|
||||||
|
"bootstrap-vue": "^2.0.0-rc.6",
|
||||||
|
"canvas-nest.js": "^2.0.4",
|
||||||
|
"create-keyframe-animation": "^0.1.0",
|
||||||
|
"echarts": "^4.0.4",
|
||||||
|
"element-ui": "^2.0.11",
|
||||||
|
"fastclick": "^1.0.6",
|
||||||
|
"good-storage": "^1.0.1",
|
||||||
|
"js-base64": "^2.1.9",
|
||||||
|
"js-md5": "^0.7.3",
|
||||||
|
"jsonp": "0.2.1",
|
||||||
|
"lyric-parser": "^1.0.1",
|
||||||
|
"net": "^1.0.2",
|
||||||
|
"qrcodejs2": "0.0.2",
|
||||||
|
"qs": "^6.14.0",
|
||||||
|
"sockjs-client": "^1.1.4",
|
||||||
|
"stompjs": "^2.3.3",
|
||||||
|
"swiper": "^4.5.0",
|
||||||
|
"vodal": "^2.3.3",
|
||||||
|
"vue": "^2.3.3",
|
||||||
|
"vue-area-linkage": "^1.2.6",
|
||||||
|
"vue-awesome-swiper": "^3.1.2",
|
||||||
|
"vue-clipboard2": "0.0.8",
|
||||||
|
"vue-hot-reload-api": "^2.3.4",
|
||||||
|
"vue-i18n": "^7.4.2",
|
||||||
|
"vue-js-modal": "^1.3.12",
|
||||||
|
"vue-js-toggle-button": "^1.2.2",
|
||||||
|
"vue-lazyload": "1.0.3",
|
||||||
|
"vue-pdf": "^3.2.2",
|
||||||
|
"vue-router": "^2.5.3",
|
||||||
|
"vue-wechat-title": "^2.0.4",
|
||||||
|
"vuex": "^2.3.1",
|
||||||
|
"zip": "^1.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"autoprefixer": "^7.1.0",
|
||||||
|
"babel-core": "^6.22.1",
|
||||||
|
"babel-eslint": "^7.1.1",
|
||||||
|
"babel-loader": "^6.2.10",
|
||||||
|
"babel-plugin-transform-runtime": "^6.22.0",
|
||||||
|
"babel-polyfill": "^6.2.0",
|
||||||
|
"babel-preset-env": "^1.3.2",
|
||||||
|
"babel-preset-stage-2": "^6.22.0",
|
||||||
|
"babel-register": "^6.22.0",
|
||||||
|
"chalk": "^1.1.3",
|
||||||
|
"connect-history-api-fallback": "^1.3.0",
|
||||||
|
"copy-webpack-plugin": "^4.0.1",
|
||||||
|
"cross-env": "^5.1.6",
|
||||||
|
"css-loader": "^0.28.0",
|
||||||
|
"eslint": "^3.19.0",
|
||||||
|
"eslint-config-standard": "^6.2.1",
|
||||||
|
"eslint-friendly-formatter": "^2.0.7",
|
||||||
|
"eslint-loader": "^1.7.1",
|
||||||
|
"eslint-plugin-html": "^2.0.0",
|
||||||
|
"eslint-plugin-promise": "^3.4.0",
|
||||||
|
"eslint-plugin-standard": "^2.0.1",
|
||||||
|
"eventsource-polyfill": "^0.9.6",
|
||||||
|
"express": "^4.14.1",
|
||||||
|
"extract-text-webpack-plugin": "^2.0.0",
|
||||||
|
"file-loader": "^0.11.1",
|
||||||
|
"filemanager-webpack-plugin": "^1.0.27",
|
||||||
|
"friendly-errors-webpack-plugin": "^1.1.3",
|
||||||
|
"html-webpack-plugin": "^2.28.0",
|
||||||
|
"http-proxy-middleware": "^0.17.3",
|
||||||
|
"js-md5": "^0.7.3",
|
||||||
|
"opn": "^4.0.2",
|
||||||
|
"optimize-css-assets-webpack-plugin": "^1.3.0",
|
||||||
|
"ora": "^1.2.0",
|
||||||
|
"rimraf": "^2.6.0",
|
||||||
|
"semver": "^5.3.0",
|
||||||
|
"shelljs": "^0.7.6",
|
||||||
|
"stylus": "^0.54.5",
|
||||||
|
"stylus-loader": "^2.1.1",
|
||||||
|
"url-loader": "^0.5.8",
|
||||||
|
"vconsole": "^2.5.2",
|
||||||
|
"vue-loader": "^11.3.4",
|
||||||
|
"vue-style-loader": "^2.0.5",
|
||||||
|
"vue-template-compiler": "^2.3.3",
|
||||||
|
"webpack": "^2.3.3",
|
||||||
|
"webpack-bundle-analyzer": "^2.2.1",
|
||||||
|
"webpack-dev-middleware": "^1.10.0",
|
||||||
|
"webpack-hot-middleware": "^2.18.0",
|
||||||
|
"webpack-merge": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4.0.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not ie <= 8"
|
||||||
|
]
|
||||||
|
}
|
||||||
9047
pnpm-lock.yaml
generated
Normal file
81
src/App.vue
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<demo-error-modal/>
|
||||||
|
<demo-conditional-modal/>
|
||||||
|
<v-dialog/>
|
||||||
|
<router-view></router-view>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script type="text/ecmascript-6">
|
||||||
|
import DemoErrorModal from "./components/vote/comportents/DemoErrorModal";
|
||||||
|
import DemoConditionalModal from "./components/vote/comportents/ConditionalModal";
|
||||||
|
import VModal from "vue-js-modal";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
DemoErrorModal,
|
||||||
|
DemoConditionalModal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" rel="stylesheet/stylus">
|
||||||
|
html{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
html, body , #app{
|
||||||
|
height: auto;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 重定义element UI 表单placeholder样式 */
|
||||||
|
.el-input__inner::-webkit-input-placeholder {
|
||||||
|
color #aaabb1
|
||||||
|
}
|
||||||
|
.el-input__inner:-ms-input-placeholder { // IE10+
|
||||||
|
color #aaabb1
|
||||||
|
}
|
||||||
|
.el-input__inner:-moz-placeholder { // Firefox4-18
|
||||||
|
color #aaabb1
|
||||||
|
}
|
||||||
|
.el-input__inner::-moz-placeholder { // Firefox19+
|
||||||
|
color #aaabb1
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dropdown-menu__item:focus,
|
||||||
|
.el-dropdown-menu__item:not(.is-disabled):hover {
|
||||||
|
background-color #e9eeff !important
|
||||||
|
color #7392FF !important
|
||||||
|
}
|
||||||
|
|
||||||
|
.flip-list-item {
|
||||||
|
list-style-type: none;
|
||||||
|
/**
|
||||||
|
* 可以在v-enter-active和v-move中分别用transition过渡,也可以在item中用transition,包含了这两项
|
||||||
|
* 要用all不用transform,有可能是因为splice删除效果不是transform
|
||||||
|
*/
|
||||||
|
/* transition: all 1s; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.flip-list-enter-active, .flip-list-leave-active {
|
||||||
|
transition: all 1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flip-list-move {
|
||||||
|
transition: all 1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flip-list-enter, .flip-list-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(50px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 要让删除的元素先脱离文档流,旁边的元素才能过渡过来
|
||||||
|
*/
|
||||||
|
.flip-list-leave-active {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
137
src/api/common.js
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
import request from "./request";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 公共接口 V3
|
||||||
|
*/
|
||||||
|
export const commonApi = {
|
||||||
|
SMS_TYPE: {
|
||||||
|
//修改手机号码
|
||||||
|
CHANGE_PHONE_VERIFY: "CHANGE_PHONE_VERIFY",
|
||||||
|
//修改登录密码
|
||||||
|
CHANGE_LOGIN_PWD_VERIFY: "CHANGE_LOGIN_PWD_VERIFY",
|
||||||
|
//修改交易密码
|
||||||
|
CHANGE_PAY_PWD_VERIFY: "CHANGE_PAY_PWD_VERIFY",
|
||||||
|
//用户手机注册验证
|
||||||
|
REGISTER_VERIFY: "REGISTER_VERIFY",
|
||||||
|
// 用户找回密码验证
|
||||||
|
FORGOT_VERIFY: "FORGOT_VERIFY",
|
||||||
|
// 用户找回交易密码
|
||||||
|
FORGOT_PAY_PWD_VERIFY: "FORGOT_PAY_PWD_VERIFY",
|
||||||
|
// 注册成为代理商用户
|
||||||
|
REGISTER_AGENT: "REGISTER_AGENT",
|
||||||
|
// 线下充值拒绝短信
|
||||||
|
UNDER_LINE_REFUSE: "UNDER_LINE_REFUSE",
|
||||||
|
// 线下充值成功短信
|
||||||
|
UNDER_LINE_SUCCESS: "UNDER_LINE_SUCCESS",
|
||||||
|
// 提币申请
|
||||||
|
WITHDRAW_APPLY: "WITHDRAW_APPLY",
|
||||||
|
// 提币成功
|
||||||
|
WITHDRAW_SUCCESS: "WITHDRAW_SUCCESS",
|
||||||
|
// 提现申请
|
||||||
|
CASH_WITHDRAWS: "CASH_WITHDRAWS",
|
||||||
|
// 登录
|
||||||
|
LOGIN: "LOGIN",
|
||||||
|
// 验证老手机或 邮箱
|
||||||
|
VERIFY_OLD_PHONE:"VERIFY_OLD_PHONE"
|
||||||
|
|
||||||
|
},
|
||||||
|
checkMobile(mobile, countryCode) {
|
||||||
|
return request({
|
||||||
|
url: '/user/users/checkTel',
|
||||||
|
method: 'get',
|
||||||
|
params: {mobile, countryCode}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
checkEmail(email) {
|
||||||
|
return request({
|
||||||
|
url: '/user/user/checkEmail',
|
||||||
|
method: 'get',
|
||||||
|
params: {email}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
serverUserinfo(token) {
|
||||||
|
return request({
|
||||||
|
url: '/user/users/current/info',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 刷新token
|
||||||
|
refreshToken(token) {
|
||||||
|
return request({
|
||||||
|
url: '/user/refreshToken',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 改变语言
|
||||||
|
changeLanguage(lang) {
|
||||||
|
return request({
|
||||||
|
url: '/user/user/lang?lang=' + lang
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
sendSms(mobile, templateCode, countryCode = '+86', validateType) {
|
||||||
|
let data = {}
|
||||||
|
if (validateType === 1) {
|
||||||
|
data = {email: mobile, templateCode}
|
||||||
|
} else {
|
||||||
|
data = {mobile, templateCode, countryCode}
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: '/user/sms/sendTo',
|
||||||
|
method: "post",
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 提交工单
|
||||||
|
addWorkIssue(question, token) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/workIssues/addWorkIssue',
|
||||||
|
method: "post",
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
question
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取工单列表
|
||||||
|
getWorkIssueList(current, size, token) {
|
||||||
|
return request({
|
||||||
|
url: `/admin/workIssues/issueList`,
|
||||||
|
params: {
|
||||||
|
current: current,
|
||||||
|
size: size
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
uuid(){
|
||||||
|
var s = [];
|
||||||
|
var hexDigits = "0123456789abcdef";
|
||||||
|
for (var i = 0; i < 36; i++) {
|
||||||
|
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
||||||
|
}
|
||||||
|
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
||||||
|
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
||||||
|
s[8] = s[13] = s[18] = s[23] = "-";
|
||||||
|
|
||||||
|
var uuid = s.join("");
|
||||||
|
return uuid;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
16
src/api/config.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export const commonParams = {
|
||||||
|
g_tk: 1928093487,
|
||||||
|
inCharset: 'utf-8',
|
||||||
|
outCharset: 'utf-8',
|
||||||
|
notice: 0,
|
||||||
|
format: 'jsonp'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const options = {
|
||||||
|
param: 'jsonpCallback'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ERR_OK = 0
|
||||||
|
export const OK = 0
|
||||||
|
export const STATUSCODE = 'statuscode'
|
||||||
|
|
||||||
119
src/api/exchange.js
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
let qs = require('qs')
|
||||||
|
import request from './request'
|
||||||
|
|
||||||
|
//创新交易
|
||||||
|
export const exchangeApi = {
|
||||||
|
|
||||||
|
// 资金账户
|
||||||
|
accountFunds(coinId,token) {
|
||||||
|
return request({
|
||||||
|
url: `/v2/s/account/funds/${coinId}`,
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
forexMarketList() {
|
||||||
|
const url = '/v2/s/forex/market'
|
||||||
|
return axios({
|
||||||
|
url : url,
|
||||||
|
method: 'get'
|
||||||
|
}).then((res) => {
|
||||||
|
return Promise.resolve(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
forexMarketArea(){
|
||||||
|
return request({
|
||||||
|
url : '/v2/s/forex_area',
|
||||||
|
method : 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 委托下单
|
||||||
|
entrustOrder(data, token) {
|
||||||
|
return request({
|
||||||
|
url : '/v2/s/forex/order/entrusts',
|
||||||
|
method: 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data : data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 撤销委托
|
||||||
|
entrustCancel(orderId, token) {
|
||||||
|
return request({
|
||||||
|
url : `/v2/s/forex/order/entrusts/${orderId}`,
|
||||||
|
method: 'delete',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
serverFavorite(token) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/forex/market/favorite',
|
||||||
|
method: 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 持仓明细
|
||||||
|
orderHolds(token) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/forex/order/holds',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 持仓汇总
|
||||||
|
orderGathers(token) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/forex/order/gathers',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 今日平仓
|
||||||
|
todayCloseout(token) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/forex/order/today_closeout',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 今日委托
|
||||||
|
todayEntrusts(token) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/forex/order/today_entrusts',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 今日成交
|
||||||
|
todayTurnovers(token) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/forex/order/today_turnovers',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
332
src/api/finance.js
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
import request from "./request";
|
||||||
|
let qs = require('qs');
|
||||||
|
import md5 from 'js-md5';
|
||||||
|
|
||||||
|
export const financeApi = {
|
||||||
|
/**
|
||||||
|
* 获取银行卡列表
|
||||||
|
*/
|
||||||
|
serverUserBank(token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/userBanks/current',
|
||||||
|
method : 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取cny充值记录
|
||||||
|
*/
|
||||||
|
serverSearchPaymentList(size, current, status, token) {
|
||||||
|
if(status == 4){
|
||||||
|
status = null ;
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/finance/cashRecharges/user/records',
|
||||||
|
method : 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'size': size ,
|
||||||
|
'current': current ,
|
||||||
|
'status': status
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户资产
|
||||||
|
*/
|
||||||
|
getUserAssets(data, token) {
|
||||||
|
let url = '/finance/account/asset';
|
||||||
|
if(data) {
|
||||||
|
url = '?'+qs.stringify(data)
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: url,
|
||||||
|
method: 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取cny提现记录
|
||||||
|
*/
|
||||||
|
serverSearchWithdrawalsList(size, current, status, token) {
|
||||||
|
if(status==4){
|
||||||
|
status = null ;
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/finance/cashWithdrawals/user/records',
|
||||||
|
method : 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'size': size ,
|
||||||
|
'current': current ,
|
||||||
|
'status': status
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getCoinAsset (coinName, token) {
|
||||||
|
return request({
|
||||||
|
url : `/finance/account/${coinName}`,
|
||||||
|
method : 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卖出
|
||||||
|
*
|
||||||
|
* coinId 卖出币种
|
||||||
|
* mum 提现金额
|
||||||
|
* num 卖出数量
|
||||||
|
* payPassword 支付密码
|
||||||
|
* validateCode 验证码
|
||||||
|
*/
|
||||||
|
serverCreateWithdrawals(coinId, mum, num, payPassword, validateCode, token) {
|
||||||
|
let data = {
|
||||||
|
coinId,
|
||||||
|
mum,
|
||||||
|
num,
|
||||||
|
payPassword : md5(payPassword),
|
||||||
|
validateCode
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : '/finance/cashWithdrawals/sell',
|
||||||
|
method : 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取充值备注信息
|
||||||
|
*/
|
||||||
|
serverRecharge(coinId, mum, num, token) {
|
||||||
|
let data = {
|
||||||
|
coinId,
|
||||||
|
mum,
|
||||||
|
num,
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : '/finance/cashRecharges/buy',
|
||||||
|
method : 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
serverAccount(token) {
|
||||||
|
return request({
|
||||||
|
url : '/finance/account/total',
|
||||||
|
method : 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加银行卡
|
||||||
|
* bankCard 银行开号
|
||||||
|
* bankName 开户银行
|
||||||
|
* branchName 支行
|
||||||
|
* city 开户行所在城市
|
||||||
|
* name 开户名
|
||||||
|
* address 银行地址
|
||||||
|
* privince 开户行所在省
|
||||||
|
*/
|
||||||
|
serverCreateUserBank(id, realName, remark, bank, bankCard, payPassword, token) {
|
||||||
|
let data = {
|
||||||
|
id : id,
|
||||||
|
realName : realName,
|
||||||
|
remark : remark,
|
||||||
|
bank : bank,
|
||||||
|
/* bankProv : bankProv,
|
||||||
|
bankCity : bankCity,
|
||||||
|
bankAddr : bankAddr,*/
|
||||||
|
bankCard : bankCard,
|
||||||
|
payPassword: md5(payPassword),
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/user/userBanks/bind',
|
||||||
|
method : 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 充值钱包地址
|
||||||
|
serverRechargeAddress(coidId, token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/userAddress/getCoinAddress/'+coidId,
|
||||||
|
method : 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包币列表
|
||||||
|
*/
|
||||||
|
getWalletCoinList() {
|
||||||
|
return request({
|
||||||
|
url : '/v2/s/coin/trade/wallet',
|
||||||
|
method : 'get',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 基础币列表
|
||||||
|
getBaseCoinList() {
|
||||||
|
return request({
|
||||||
|
url : '/finance/coins/all?status=1',
|
||||||
|
method : 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包币地址列表
|
||||||
|
*/
|
||||||
|
walletList(coinId, token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/userWallets/getCoinAddress/'+coinId,
|
||||||
|
method : 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加钱包地址
|
||||||
|
*/
|
||||||
|
serverAddWallet(coinId, name, addr, payPassword, token) {
|
||||||
|
let data = {
|
||||||
|
coinId,
|
||||||
|
name,
|
||||||
|
addr,
|
||||||
|
payPassword : md5(payPassword)
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/user/userWallets',
|
||||||
|
method : 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
//资产管理 充值记录
|
||||||
|
serverInWalletRecord(size, current, coinId, token) {
|
||||||
|
if(coinId == 0){
|
||||||
|
coinId = null ;
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
size,
|
||||||
|
current,
|
||||||
|
coinId
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/finance/coinRecharges/user/record?'+qs.stringify(data),
|
||||||
|
method : 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
//资产管理 提现记录
|
||||||
|
serverOutWalletRecord(size, current, coinId, token) {
|
||||||
|
if(coinId==0){
|
||||||
|
coinId = null ;
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
size,
|
||||||
|
current,
|
||||||
|
coinId
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/finance/coinWithdraws/user/record?'+qs.stringify(data),
|
||||||
|
method : 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除钱包地址
|
||||||
|
*/
|
||||||
|
serverdeleteWalletAddress(addressId, payPassword, token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/userWallets/deleteAddress',
|
||||||
|
method : 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params:{
|
||||||
|
addressId: addressId ,
|
||||||
|
payPassword: md5(payPassword)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 提现
|
||||||
|
serverWithdraw (addressId, amount, coinId, payPassword, verifyCode, token) {
|
||||||
|
let data = {
|
||||||
|
addressId,
|
||||||
|
amount,
|
||||||
|
coinId,
|
||||||
|
payPassword : md5(payPassword),
|
||||||
|
verifyCode
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/v2/s/withdraw',
|
||||||
|
method : 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取矿池资产 /reward/info
|
||||||
|
/**
|
||||||
|
user_id
|
||||||
|
amount 总冻结
|
||||||
|
thawed 已经解冻量
|
||||||
|
freeze 冻结奖励
|
||||||
|
can_defrost 可解冻奖励
|
||||||
|
*/
|
||||||
|
getRewardInfo() {
|
||||||
|
return request({
|
||||||
|
url : '/v2/s/reward/info',
|
||||||
|
method : 'get'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 解冻资金
|
||||||
|
unfreezeReward() {
|
||||||
|
return request({
|
||||||
|
url : '/v2/s/reward/unfreeze',
|
||||||
|
method : 'post'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
353
src/api/geetest.gt.js
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
"v0.4.8 Geetest Inc.";
|
||||||
|
|
||||||
|
(function (window) {
|
||||||
|
"use strict";
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
throw new Error('Geetest requires browser environment');
|
||||||
|
}
|
||||||
|
|
||||||
|
var document = window.document;
|
||||||
|
var Math = window.Math;
|
||||||
|
var head = document.getElementsByTagName("head")[0];
|
||||||
|
|
||||||
|
function _Object(obj) {
|
||||||
|
this._obj = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Object.prototype = {
|
||||||
|
_each: function (process) {
|
||||||
|
var _obj = this._obj;
|
||||||
|
for (var k in _obj) {
|
||||||
|
if (_obj.hasOwnProperty(k)) {
|
||||||
|
process(k, _obj[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function Config(config) {
|
||||||
|
var self = this;
|
||||||
|
new _Object(config)._each(function (key, value) {
|
||||||
|
self[key] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Config.prototype = {
|
||||||
|
api_server: 'api.geetest.com',
|
||||||
|
protocol: 'http://',
|
||||||
|
typePath: '/gettype.php',
|
||||||
|
fallback_config: {
|
||||||
|
slide: {
|
||||||
|
static_servers: ["static.geetest.com", "dn-staticdown.qbox.me"],
|
||||||
|
type: 'slide',
|
||||||
|
slide: '/static/js/geetest.0.0.0.js'
|
||||||
|
},
|
||||||
|
fullpage: {
|
||||||
|
static_servers: ["static.geetest.com", "dn-staticdown.qbox.me"],
|
||||||
|
type: 'fullpage',
|
||||||
|
fullpage: '/static/js/fullpage.0.0.0.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_get_fallback_config: function () {
|
||||||
|
var self = this;
|
||||||
|
if (isString(self.type)) {
|
||||||
|
return self.fallback_config[self.type];
|
||||||
|
} else if (self.new_captcha) {
|
||||||
|
return self.fallback_config.fullpage;
|
||||||
|
} else {
|
||||||
|
return self.fallback_config.slide;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_extend: function (obj) {
|
||||||
|
var self = this;
|
||||||
|
new _Object(obj)._each(function (key, value) {
|
||||||
|
self[key] = value;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var isNumber = function (value) {
|
||||||
|
return (typeof value === 'number');
|
||||||
|
};
|
||||||
|
var isString = function (value) {
|
||||||
|
return (typeof value === 'string');
|
||||||
|
};
|
||||||
|
var isBoolean = function (value) {
|
||||||
|
return (typeof value === 'boolean');
|
||||||
|
};
|
||||||
|
var isObject = function (value) {
|
||||||
|
return (typeof value === 'object' && value !== null);
|
||||||
|
};
|
||||||
|
var isFunction = function (value) {
|
||||||
|
return (typeof value === 'function');
|
||||||
|
};
|
||||||
|
var MOBILE = /Mobi/i.test(navigator.userAgent);
|
||||||
|
var pt = MOBILE ? 3 : 0;
|
||||||
|
|
||||||
|
var callbacks = {};
|
||||||
|
var status = {};
|
||||||
|
|
||||||
|
var nowDate = function () {
|
||||||
|
var date = new Date();
|
||||||
|
var year = date.getFullYear();
|
||||||
|
var month = date.getMonth() + 1;
|
||||||
|
var day = date.getDate();
|
||||||
|
var hours = date.getHours();
|
||||||
|
var minutes = date.getMinutes();
|
||||||
|
var seconds = date.getSeconds();
|
||||||
|
|
||||||
|
if (month >= 1 && month <= 9) {
|
||||||
|
month = '0' + month;
|
||||||
|
}
|
||||||
|
if (day >= 0 && day <= 9) {
|
||||||
|
day = '0' + day;
|
||||||
|
}
|
||||||
|
if (hours >= 0 && hours <= 9) {
|
||||||
|
hours = '0' + hours;
|
||||||
|
}
|
||||||
|
if (minutes >= 0 && minutes <= 9) {
|
||||||
|
minutes = '0' + minutes;
|
||||||
|
}
|
||||||
|
if (seconds >= 0 && seconds <= 9) {
|
||||||
|
seconds = '0' + seconds;
|
||||||
|
}
|
||||||
|
var currentdate = year + '-' + month + '-' + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
|
return currentdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
var random = function () {
|
||||||
|
return parseInt(Math.random() * 10000) + (new Date()).valueOf();
|
||||||
|
};
|
||||||
|
|
||||||
|
var loadScript = function (url, cb) {
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.charset = "UTF-8";
|
||||||
|
script.async = true;
|
||||||
|
|
||||||
|
// 瀵筭eetest鐨勯潤鎬佽祫婧愭坊鍔<E59D8A> crossOrigin
|
||||||
|
if ( /static\.geetest\.com/g.test(url)) {
|
||||||
|
script.crossOrigin = "anonymous";
|
||||||
|
}
|
||||||
|
|
||||||
|
script.onerror = function () {
|
||||||
|
cb(true);
|
||||||
|
};
|
||||||
|
var loaded = false;
|
||||||
|
script.onload = script.onreadystatechange = function () {
|
||||||
|
if (!loaded &&
|
||||||
|
(!script.readyState ||
|
||||||
|
"loaded" === script.readyState ||
|
||||||
|
"complete" === script.readyState)) {
|
||||||
|
|
||||||
|
loaded = true;
|
||||||
|
setTimeout(function () {
|
||||||
|
cb(false);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
script.src = url;
|
||||||
|
head.appendChild(script);
|
||||||
|
};
|
||||||
|
|
||||||
|
var normalizeDomain = function (domain) {
|
||||||
|
// special domain: uems.sysu.edu.cn/jwxt/geetest/
|
||||||
|
// return domain.replace(/^https?:\/\/|\/.*$/g, ''); uems.sysu.edu.cn
|
||||||
|
return domain.replace(/^https?:\/\/|\/$/g, ''); // uems.sysu.edu.cn/jwxt/geetest
|
||||||
|
};
|
||||||
|
var normalizePath = function (path) {
|
||||||
|
path = path.replace(/\/+/g, '/');
|
||||||
|
if (path.indexOf('/') !== 0) {
|
||||||
|
path = '/' + path;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
var normalizeQuery = function (query) {
|
||||||
|
if (!query) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
var q = '?';
|
||||||
|
new _Object(query)._each(function (key, value) {
|
||||||
|
if (isString(value) || isNumber(value) || isBoolean(value)) {
|
||||||
|
q = q + encodeURIComponent(key) + '=' + encodeURIComponent(value) + '&';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (q === '?') {
|
||||||
|
q = '';
|
||||||
|
}
|
||||||
|
return q.replace(/&$/, '');
|
||||||
|
};
|
||||||
|
var makeURL = function (protocol, domain, path, query) {
|
||||||
|
domain = normalizeDomain(domain);
|
||||||
|
|
||||||
|
var url = normalizePath(path) + normalizeQuery(query);
|
||||||
|
if (domain) {
|
||||||
|
url = protocol + domain + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
|
||||||
|
var load = function (config, send, protocol, domains, path, query, cb) {
|
||||||
|
var tryRequest = function (at) {
|
||||||
|
|
||||||
|
var url = makeURL(protocol, domains[at], path, query);
|
||||||
|
loadScript(url, function (err) {
|
||||||
|
if (err) {
|
||||||
|
if (at >= domains.length - 1) {
|
||||||
|
cb(true);
|
||||||
|
// report gettype error
|
||||||
|
if (send) {
|
||||||
|
config.error_code = 508;
|
||||||
|
var url = protocol + domains[at] + path;
|
||||||
|
reportError(config, url);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tryRequest(at + 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cb(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
tryRequest(0);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var jsonp = function (domains, path, config, callback) {
|
||||||
|
if (isObject(config.getLib)) {
|
||||||
|
config._extend(config.getLib);
|
||||||
|
callback(config);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (config.offline) {
|
||||||
|
callback(config._get_fallback_config());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cb = "geetest_" + random();
|
||||||
|
window[cb] = function (data) {
|
||||||
|
if (data.status == 'success') {
|
||||||
|
callback(data.data);
|
||||||
|
} else if (!data.status) {
|
||||||
|
callback(data);
|
||||||
|
} else {
|
||||||
|
callback(config._get_fallback_config());
|
||||||
|
}
|
||||||
|
window[cb] = undefined;
|
||||||
|
try {
|
||||||
|
delete window[cb];
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
load(config, true, config.protocol, domains, path, {
|
||||||
|
gt: config.gt,
|
||||||
|
callback: cb
|
||||||
|
}, function (err) {
|
||||||
|
if (err) {
|
||||||
|
callback(config._get_fallback_config());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var reportError = function (config, url) {
|
||||||
|
load(config, false, config.protocol, ['monitor.geetest.com'], '/monitor/send', {
|
||||||
|
time: nowDate(),
|
||||||
|
captcha_id: config.gt,
|
||||||
|
challenge: config.challenge,
|
||||||
|
pt: pt,
|
||||||
|
exception_url: url,
|
||||||
|
error_code: config.error_code
|
||||||
|
}, function (err) {})
|
||||||
|
}
|
||||||
|
|
||||||
|
var throwError = function (errorType, config) {
|
||||||
|
var errors = {
|
||||||
|
networkError: '缃戠粶閿欒',
|
||||||
|
gtTypeError: 'gt瀛楁涓嶆槸瀛楃涓茬被鍨<E8A2AB>'
|
||||||
|
};
|
||||||
|
if (typeof config.onError === 'function') {
|
||||||
|
config.onError(errors[errorType]);
|
||||||
|
} else {
|
||||||
|
throw new Error(errors[errorType]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var detect = function () {
|
||||||
|
return window.Geetest || document.getElementById("gt_lib");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (detect()) {
|
||||||
|
status.slide = "loaded";
|
||||||
|
}
|
||||||
|
|
||||||
|
window.initGeetest = function (userConfig, callback) {
|
||||||
|
|
||||||
|
var config = new Config(userConfig);
|
||||||
|
|
||||||
|
if (userConfig.https) {
|
||||||
|
config.protocol = 'https://';
|
||||||
|
} else if (!userConfig.protocol) {
|
||||||
|
config.protocol = window.location.protocol + '//';
|
||||||
|
}
|
||||||
|
|
||||||
|
// for KFC
|
||||||
|
if (userConfig.gt === '050cffef4ae57b5d5e529fea9540b0d1' ||
|
||||||
|
userConfig.gt === '3bd38408ae4af923ed36e13819b14d42') {
|
||||||
|
config.apiserver = 'yumchina.geetest.com/'; // for old js
|
||||||
|
config.api_server = 'yumchina.geetest.com';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(userConfig.gt){
|
||||||
|
window.GeeGT = userConfig.gt
|
||||||
|
}
|
||||||
|
|
||||||
|
if(userConfig.challenge){
|
||||||
|
window.GeeChallenge = userConfig.challenge
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isObject(userConfig.getType)) {
|
||||||
|
config._extend(userConfig.getType);
|
||||||
|
}
|
||||||
|
jsonp([config.api_server || config.apiserver], config.typePath, config, function (newConfig) {
|
||||||
|
var type = newConfig.type;
|
||||||
|
var init = function () {
|
||||||
|
config._extend(newConfig);
|
||||||
|
callback(new window.Geetest(config));
|
||||||
|
};
|
||||||
|
|
||||||
|
callbacks[type] = callbacks[type] || [];
|
||||||
|
var s = status[type] || 'init';
|
||||||
|
if (s === 'init') {
|
||||||
|
status[type] = 'loading';
|
||||||
|
|
||||||
|
callbacks[type].push(init);
|
||||||
|
|
||||||
|
load(config, true, config.protocol, newConfig.static_servers || newConfig.domains, newConfig[type] || newConfig.path, null, function (err) {
|
||||||
|
if (err) {
|
||||||
|
status[type] = 'fail';
|
||||||
|
throwError('networkError', config);
|
||||||
|
} else {
|
||||||
|
status[type] = 'loaded';
|
||||||
|
var cbs = callbacks[type];
|
||||||
|
for (var i = 0, len = cbs.length; i < len; i = i + 1) {
|
||||||
|
var cb = cbs[i];
|
||||||
|
if (isFunction(cb)) {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callbacks[type] = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (s === "loaded") {
|
||||||
|
init();
|
||||||
|
} else if (s === "fail") {
|
||||||
|
throwError('networkError', config);
|
||||||
|
} else if (s === "loading") {
|
||||||
|
callbacks[type].push(init);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
})(window);
|
||||||
16
src/api/geetest.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import gtInit from './geetest.gt'
|
||||||
|
import request from "./request";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getGtCaptcha (uuid) {
|
||||||
|
if(!uuid){
|
||||||
|
uuid = 'liang'
|
||||||
|
}
|
||||||
|
let url = '/user/gt/register';
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
params: {uuid}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
52
src/api/home.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import request from "./request";
|
||||||
|
import axios from 'axios'
|
||||||
|
let qs = require('qs')
|
||||||
|
|
||||||
|
export const homeApi = {
|
||||||
|
// 新的首页 包含交易区的market接口
|
||||||
|
getMarketListNew(){
|
||||||
|
return request({
|
||||||
|
url : '/exchange/tradeAreas/markets',
|
||||||
|
method : 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getMarketList(){
|
||||||
|
return request({
|
||||||
|
// url : '/v2/s/trade/market/all',
|
||||||
|
url : '/exchange/markets/all',
|
||||||
|
method : 'get',
|
||||||
|
}).then((res) => {
|
||||||
|
return Promise.resolve(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取banner
|
||||||
|
getBanner(){
|
||||||
|
return request({
|
||||||
|
url : '/admin/webConfigs/banners',
|
||||||
|
method : 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getDoucments(){
|
||||||
|
return request({
|
||||||
|
url : '/admin/webConfigs/documents',
|
||||||
|
method : 'get'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getNoticeList (current,size) {
|
||||||
|
return request({
|
||||||
|
url : `/admin/notices/simple`,
|
||||||
|
method : 'get',
|
||||||
|
params:{
|
||||||
|
current: current ,
|
||||||
|
size: size
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getNoticeDetail (noticeId) {
|
||||||
|
return request({
|
||||||
|
url : `/admin/notices/simple/${noticeId}`,
|
||||||
|
method : 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
97
src/api/loginRegist.js
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import request from "./request";
|
||||||
|
import md5 from 'js-md5';
|
||||||
|
/*
|
||||||
|
* 注册登录
|
||||||
|
*/
|
||||||
|
export const loginRegist = {
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
*/
|
||||||
|
login(data) {
|
||||||
|
data.password = md5(data.password);
|
||||||
|
return request({
|
||||||
|
url: '/user/login',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*/
|
||||||
|
register(data, geetest_challenge,uuid, geetest_validate, geetest_seccode ,registType) {
|
||||||
|
let {countryCode, password, invitationCode, validateCode,email,mobile} = data;
|
||||||
|
alert(uuid)
|
||||||
|
let reqData = {
|
||||||
|
countryCode,
|
||||||
|
password : md5(password),
|
||||||
|
invitionCode: invitationCode,
|
||||||
|
validateCode,
|
||||||
|
geetest_challenge,
|
||||||
|
geetest_validate,
|
||||||
|
uuid,
|
||||||
|
geetest_seccode
|
||||||
|
}
|
||||||
|
if(registType === 0 ){
|
||||||
|
reqData.mobile = mobile
|
||||||
|
}else{
|
||||||
|
reqData.email = email
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: '/user/users/register',
|
||||||
|
method: 'post',
|
||||||
|
data: reqData
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取图片验证码
|
||||||
|
*/
|
||||||
|
getValidateCodeImg() {
|
||||||
|
console.log('getValidateCodeImg')
|
||||||
|
const url = '/platform/user/getValidateCodeImg.m?t=' + Math.random()
|
||||||
|
return axios.get(url).then((res) => {
|
||||||
|
return Promise.resolve(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取usessionid
|
||||||
|
*/
|
||||||
|
getUsessionId() {
|
||||||
|
console.log('getUsessionId')
|
||||||
|
const url = '/platform/user/getUsessionId.m'
|
||||||
|
return axios.get(url).then((res) => {
|
||||||
|
return Promise.resolve(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*获取用户信息
|
||||||
|
*/
|
||||||
|
serverGetUser() {
|
||||||
|
console.log('serverGetUser')
|
||||||
|
const url = '/trade/home/serverGetUser.o'
|
||||||
|
return axios.get(url).then((res) => {
|
||||||
|
return Promise.resolve(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*退出登录
|
||||||
|
*/
|
||||||
|
logout() {
|
||||||
|
return request({
|
||||||
|
url: '/user/logout',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 设置新的登录密码
|
||||||
|
setPassword(data){
|
||||||
|
data.password = md5(data.password);
|
||||||
|
return request({
|
||||||
|
url: '/user/users/setPassword',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
57
src/api/order.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import request from "./request";
|
||||||
|
let qs = require('qs');
|
||||||
|
|
||||||
|
export const orderApi = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取成交记录
|
||||||
|
* type 0 全部
|
||||||
|
* 1 买入
|
||||||
|
* 2 卖出
|
||||||
|
* 3 自买自卖
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
serverGetTurnoverOrderList(size, current, symbol, type, token) {
|
||||||
|
let data = {
|
||||||
|
size,
|
||||||
|
current,
|
||||||
|
symbol,
|
||||||
|
type,
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url: '/exchange/turnoverOrders',
|
||||||
|
method: 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params: data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取委托记录
|
||||||
|
*/
|
||||||
|
serverGetEntrustOrderList(size, current, symbol, type, token)
|
||||||
|
{
|
||||||
|
let data = {
|
||||||
|
size,
|
||||||
|
current,
|
||||||
|
symbol,
|
||||||
|
type
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url : '/exchange/entrustOrders',
|
||||||
|
method : 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params: data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
105
src/api/request.js
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import {Message} from 'element-ui'
|
||||||
|
import {errorCodeMap} from "../common/js/errorCodeMap";
|
||||||
|
import {commonApi} from "./common";
|
||||||
|
import store from "../store";
|
||||||
|
import router from '../router'
|
||||||
|
|
||||||
|
// create an axios instance
|
||||||
|
const service = axios.create({
|
||||||
|
baseURL: process.env.BASE_API, // api的base_url
|
||||||
|
timeout: 10000 // request timeout
|
||||||
|
})
|
||||||
|
// 刷新token的url
|
||||||
|
const refreshTokenUrl = "/user/login/refreshToken";
|
||||||
|
// 请求创新交易资金的url
|
||||||
|
const requestForexFunds = "/v2/s/account/funds/"
|
||||||
|
// request interceptor
|
||||||
|
service.interceptors.request.use(config => {
|
||||||
|
const data = getExpireTime();
|
||||||
|
if (data) {
|
||||||
|
let {expire, updateTime} = data;
|
||||||
|
|
||||||
|
let nowTime = +new Date();
|
||||||
|
let activeTime = (nowTime - updateTime);
|
||||||
|
// console.log("activeTime", activeTime,expire,new Date(nowTime),new Date(updateTime));
|
||||||
|
// 如果当前活跃时间减去令牌更新时间小于过期时间(毫秒)
|
||||||
|
if (activeTime < expire) {
|
||||||
|
// 避免频繁调用接口 当快过期的时候刷新
|
||||||
|
if(activeTime>=(4*expire/5)){
|
||||||
|
let token = store.getters.refreshToken
|
||||||
|
// 当前接口不是刷新token 和轮训资产的接口 ,且token不为空
|
||||||
|
if (config.url.indexOf(refreshTokenUrl) ===-1 &&config.url.indexOf(requestForexFunds)===-1 && token !== "") {
|
||||||
|
refreshToken(token)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 在刷新之前需要先清空token
|
||||||
|
store.commit('SET_EXPIRE_TIME', '')
|
||||||
|
store.comiit("SET_TOKEN",'')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Do something before request is sent
|
||||||
|
if (store.getters.token) {
|
||||||
|
config.headers['Authorization'] = store.getters.token // 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return config
|
||||||
|
}, error => {
|
||||||
|
// Do something with request error
|
||||||
|
console.log("interceptor", error) // for debug
|
||||||
|
Promise.reject(error)
|
||||||
|
})
|
||||||
|
// respone interceptor
|
||||||
|
service.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
const res = response.data;
|
||||||
|
let currentLang = localStorage.getItem("lang") || "zh-CN"
|
||||||
|
let errMsg = errorCodeMap[currentLang][res.code]
|
||||||
|
if (res.code !== 200) {
|
||||||
|
Message({
|
||||||
|
message: errMsg ? errMsg : res.errmsg,
|
||||||
|
type: 'error',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
if (res.errcode === 40001) {
|
||||||
|
router.push("/login")
|
||||||
|
}
|
||||||
|
return Promise.reject(res);
|
||||||
|
} else {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log('请求失败:' , error)// for debug
|
||||||
|
if(error.response.status === 429){
|
||||||
|
Message({
|
||||||
|
message: "请求太频繁,请稍后再试!",
|
||||||
|
type: 'error',
|
||||||
|
duration: 1 * 1000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return Promise.reject(error)
|
||||||
|
})
|
||||||
|
|
||||||
|
function getExpireTime() {
|
||||||
|
let data = store.getters.expireTime
|
||||||
|
return (data) ? JSON.parse(data) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshToken(token) {
|
||||||
|
commonApi.refreshToken(token).then(res => {
|
||||||
|
let data = res.data;
|
||||||
|
let expireTime = JSON.stringify({
|
||||||
|
updateTime: +new Date(),
|
||||||
|
// expire:5*1000
|
||||||
|
expire: data.expire * 1000
|
||||||
|
});
|
||||||
|
store.commit('SET_EXPIRE_TIME', expireTime)
|
||||||
|
store.commit('SET_TOKEN', data.access_token)
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default service
|
||||||
96
src/api/trade.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import request from './request'
|
||||||
|
|
||||||
|
export const tradeApi = {
|
||||||
|
// 未完成委托
|
||||||
|
serverGetEntrustOrderList(current, size, symbol, token) {
|
||||||
|
return request({
|
||||||
|
url: `/exchange/entrustOrders/${symbol}`,
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params:{
|
||||||
|
current: current ,
|
||||||
|
size: size
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 历史委托订单
|
||||||
|
serverGetTurnoverOrderList(current, size, symbol, token) {
|
||||||
|
return request({
|
||||||
|
url: `/exchange/entrustOrders/history/${symbol}`,
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
params:{
|
||||||
|
current: current ,
|
||||||
|
size: size
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 币币交易 委托下单
|
||||||
|
serverCreateOrder(price, symbol, type, volume, token) {
|
||||||
|
let data = {
|
||||||
|
price,
|
||||||
|
symbol,
|
||||||
|
type,
|
||||||
|
volume,
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url: '/exchange/entrustOrders',
|
||||||
|
method: 'post',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//撤销委托
|
||||||
|
serverCancelOrder(orderId, token) {
|
||||||
|
return request({
|
||||||
|
url: `/exchange/entrustOrders/${orderId}`,
|
||||||
|
method: 'delete',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//获取当前用户当前市场 可交易额度
|
||||||
|
getUserAccount(symbol, token) {
|
||||||
|
return request({
|
||||||
|
url: '/finance/account/asset/' + symbol,
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//个人收藏交易市场信息
|
||||||
|
serverFavorite(token) {
|
||||||
|
return request({
|
||||||
|
url: '/exchange/tradeAreas/market/favorite',
|
||||||
|
method: 'get',
|
||||||
|
headers: {
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//获取深度数据
|
||||||
|
getDepth(symbol,mergeType) {
|
||||||
|
return request({
|
||||||
|
url: `/exchange/markets/depth/${symbol}/${mergeType}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取最新成交列表
|
||||||
|
getTrades(symbol) {
|
||||||
|
return request({
|
||||||
|
url: `/exchange/markets/trades/${symbol}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
13
src/api/uploadApi.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import request from './request'
|
||||||
|
|
||||||
|
export const uploadApi = {
|
||||||
|
aliyunUrl: process.env.BASE_API + "/v2/s/image/AliYunImgUpload",
|
||||||
|
normalUrl: process.env.BASE_API + "/v2/s/image/commonImgUpload",
|
||||||
|
aliyunFileUrl:'https://coin-exchange-imgs.oss-cn-beijing.aliyuncs.com/',
|
||||||
|
getPreUpload() {
|
||||||
|
return request({
|
||||||
|
url: `/admin/image/pre/upload`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
234
src/api/usercenter.js
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
import request from "./request";
|
||||||
|
import md5 from 'js-md5';
|
||||||
|
import axios from "axios"
|
||||||
|
/*
|
||||||
|
* 用户中心
|
||||||
|
*/
|
||||||
|
|
||||||
|
//修改绑定手机
|
||||||
|
export function serverBindMobile(countryCode, newMobilePhone, validateCode,oldValidateCode) {
|
||||||
|
const url = '/user/users/updatePhone';
|
||||||
|
let data = {
|
||||||
|
countryCode,
|
||||||
|
newMobilePhone,
|
||||||
|
validateCode,
|
||||||
|
oldValidateCode,
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : url,
|
||||||
|
method : 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//修改绑定邮箱
|
||||||
|
export function updateEmail(oldEmail, newEmail, validateCode) {
|
||||||
|
const url = '/user/users/updateEmail';
|
||||||
|
let data = {
|
||||||
|
oldEmail,
|
||||||
|
newEmail,
|
||||||
|
validateCode
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : url,
|
||||||
|
method : 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//验证老手机
|
||||||
|
export function verifyOldPhone(oldPhone, newPhone, validateCode) {
|
||||||
|
const url = '/user/verify/old/phone';
|
||||||
|
let data = {
|
||||||
|
oldPhone,
|
||||||
|
newPhone,
|
||||||
|
validateCode
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : url,
|
||||||
|
method : 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//验证老邮箱
|
||||||
|
export function verifyOldEmail(oldEmail, newEmail, validateCode) {
|
||||||
|
const url = '/user/verify/old/email';
|
||||||
|
let data = {
|
||||||
|
oldEmail,
|
||||||
|
newEmail,
|
||||||
|
validateCode
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : url,
|
||||||
|
method : 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getchilds (token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/users/invites',
|
||||||
|
method: 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改登录密码
|
||||||
|
export function updateUserPassword(data, token,countryCode) {
|
||||||
|
data.oldpassword = md5(data.oldpassword);
|
||||||
|
data.newpassword = md5(data.newpassword);
|
||||||
|
return request({
|
||||||
|
url : '/user/users/updateLoginPassword',
|
||||||
|
method:'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改交易密码
|
||||||
|
export function updatePayPassword(data, token) {
|
||||||
|
data.oldpassword = md5(data.oldpassword);
|
||||||
|
data.newpassword = md5(data.newpassword);
|
||||||
|
return request({
|
||||||
|
url : '/user/users/updatePayPassword',
|
||||||
|
method:'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//实名认证
|
||||||
|
export function setAuth(data, token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/users/authAccount',
|
||||||
|
method : 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//高级认证
|
||||||
|
export function seniorAuth(data, token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/users/authUser',
|
||||||
|
method : 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setUserBaseInfo(email, payPassword, username, token) {
|
||||||
|
let data = {
|
||||||
|
email,
|
||||||
|
payPassword : md5(payPassword),
|
||||||
|
username
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : '/user/user/userBase',
|
||||||
|
method : 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setPayPassword(data, token) {
|
||||||
|
data.payPassword = md5(data.payPassword);
|
||||||
|
return request({
|
||||||
|
url : '/user/users/setPayPassword',
|
||||||
|
method : 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加自选
|
||||||
|
export function serverAddFavorite(symbol, type, token) {
|
||||||
|
let data = {
|
||||||
|
symbol,
|
||||||
|
type
|
||||||
|
};
|
||||||
|
return request({
|
||||||
|
url : '/exchange/userFavorites/addFavorite',
|
||||||
|
method: 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function serverDeleteFavorite(symbol, type, token) {
|
||||||
|
return request({
|
||||||
|
url : '/exchange/userFavorites/'+ symbol,
|
||||||
|
method: 'delete',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function gaGenerate(token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/user/ga/generate',
|
||||||
|
method: 'get',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function gaVerify(code,secret,token) {
|
||||||
|
return request({
|
||||||
|
url : '/user/user/ga/verify',
|
||||||
|
method: 'post',
|
||||||
|
headers:{
|
||||||
|
'Authorization': token,
|
||||||
|
},
|
||||||
|
data:{code,secret}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭google 验证
|
||||||
|
export function closeGaVerify(code) {
|
||||||
|
return request({
|
||||||
|
url : '/user/user/ga/cancel',
|
||||||
|
method: 'post',
|
||||||
|
data:{code}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 创建矿池
|
||||||
|
*/
|
||||||
|
export function createPool(data) {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/mine/pool',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 矿池列表
|
||||||
|
*/
|
||||||
|
export function minePool() {
|
||||||
|
return request({
|
||||||
|
url: '/v2/s/mine/pool',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
src/assets/exchange/down-color.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/exchange/down.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
5
src/assets/exchange/echarts-data.js
Normal file
5
src/assets/exchange/echarts-data2.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* Created by zhouqt on 2018/4/14.
|
||||||
|
*/
|
||||||
|
export const rawData2 = [['2015/12/31','3570.47','3539.18','-33.69','-0.94%','3538.35','3580.6','176963664','25403106','-'],['2015/12/30','3566.73','3572.88','9.14','0.26%','3538.11','3573.68','187889600','26778766','-'],['2015/12/29','3528.4','3563.74','29.96','0.85%','3515.52','3564.17','182551920','25093890','-'],['2015/12/28','3635.77','3533.78','-94.13','-2.59%','3533.78','3641.59','269983264','36904280','-'],['2015/12/25','3614.05','3627.91','15.43','0.43%','3601.74','3635.26','198451120','27466004','-'],['2015/12/24','3631.31','3612.49','-23.6','-0.65%','3572.28','3640.22','227785216','31542126','-'],['2015/12/23','3653.28','3636.09','-15.68','-0.43%','3633.03','3684.57','298201792','41990292','-'],['2015/12/22','3645.99','3651.77','9.3','0.26%','3616.87','3652.63','261178752','36084604','-'],['2015/12/21','3568.58','3642.47','63.51','1.77%','3565.75','3651.06','299849280','39831696','-'],['2015/12/18','3574.94','3578.96','-1.03','-0.03%','3568.16','3614.7','273707904','36538580','-'],['2015/12/17','3533.63','3580','63.81','1.81%','3533.63','3583.41','283856480','38143960','-'],['2015/12/16','3522.09','3516.19','5.83','0.17%','3506.29','3538.69','193482304','26528864','-'],['2015/12/15','3518.13','3510.35','-10.31','-0.29%','3496.85','3529.96','200471344','27627494','-'],['2015/12/14','3403.51','3520.67','86.09','2.51%','3399.28','3521.78','215374624','27921354','-'],['2015/12/11','3441.6','3434.58','-20.91','-0.61%','3410.92','3455.55','182908880','24507642','-']].reverse();
|
||||||
|
|
||||||
12
src/assets/exchange/echarts-data3.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Created by zhouqt on 2018/4/14.
|
||||||
|
*/
|
||||||
|
export const rawData3 = [[1524033690000,'3570.47','3539.18','3539.18','3539.18'],[1524033590000,'3570.47','3539.18','3539.18','3539.18'],
|
||||||
|
[1524033440000,'3570.47','3539.18','3539.18','3539.18'],
|
||||||
|
[1524033340000,'3570.47','3539.18','3539.18','3539.18'],
|
||||||
|
[1524033240000,'3570.47','3539.18','3539.18','3539.18'],
|
||||||
|
[1524033140000,'3570.47','3539.18','3539.18','3539.18'],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
BIN
src/assets/exchange/up-color.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/exchange/up.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/assets/header/logo.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/assets/help/1.png
Normal file
|
After Width: | Height: | Size: 398 KiB |
BIN
src/assets/help/10.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
src/assets/help/11.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
src/assets/help/12.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
src/assets/help/13.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
src/assets/help/14.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
src/assets/help/15.png
Normal file
|
After Width: | Height: | Size: 229 KiB |
BIN
src/assets/help/16.png
Normal file
|
After Width: | Height: | Size: 153 KiB |
BIN
src/assets/help/17.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
src/assets/help/18.png
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
src/assets/help/19.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
src/assets/help/2.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
src/assets/help/20.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
src/assets/help/21.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
src/assets/help/22.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/help/23.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/assets/help/24.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
src/assets/help/25.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
src/assets/help/26.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src/assets/help/27.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
src/assets/help/28.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
src/assets/help/29.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
src/assets/help/3.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
src/assets/help/30.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
src/assets/help/4.png
Normal file
|
After Width: | Height: | Size: 301 KiB |
BIN
src/assets/help/5.png
Normal file
|
After Width: | Height: | Size: 538 KiB |
BIN
src/assets/help/6.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
src/assets/help/7.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
src/assets/help/8.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
src/assets/help/9.png
Normal file
|
After Width: | Height: | Size: 65 KiB |
BIN
src/assets/help/tab-1-1.png
Normal file
|
After Width: | Height: | Size: 311 KiB |
BIN
src/assets/help/tab-1-2.png
Normal file
|
After Width: | Height: | Size: 691 KiB |
BIN
src/assets/help/tab-1-3.png
Normal file
|
After Width: | Height: | Size: 472 KiB |
BIN
src/assets/help/tab-1-4.png
Normal file
|
After Width: | Height: | Size: 354 KiB |
BIN
src/assets/help/tab-1-5.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
src/assets/help/tab-1-6.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
src/assets/help/tab-2-1.png
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
src/assets/help/tab-2-2.png
Normal file
|
After Width: | Height: | Size: 156 KiB |
BIN
src/assets/help/tab-2-3.png
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
src/assets/help/tab-2-4.png
Normal file
|
After Width: | Height: | Size: 181 KiB |
BIN
src/assets/help/tab-2-5.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
src/assets/help/tab-2-6.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
src/assets/home/BFWlogo.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/assets/home/BTC.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
src/assets/home/EOS.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/assets/home/ETH.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
src/assets/home/IOS.png
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
src/assets/home/android-i.png
Normal file
|
After Width: | Height: | Size: 850 B |
BIN
src/assets/home/android.png
Normal file
|
After Width: | Height: | Size: 421 B |
BIN
src/assets/home/android_qrcode.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
src/assets/home/app-close.png
Normal file
|
After Width: | Height: | Size: 591 B |