Commit 59d15c26 authored by FE-安焕焕's avatar FE-安焕焕 👣

Merge branch 'strate' into 'master'

Commit

See merge request !1
parents 5cdb0aec 16f655e1
决策引擎项目
\ No newline at end of file
# strategy-ui
> A Vue.js project
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
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'),
}
},
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'
}
}
'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)
}
})
})
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/gateway': {
target: 'https://s-engine-ai3.liangkebang.net',
changeOrigin: true,
pathRewrite: {'^/gateway' : ''}
}
},
// 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
}
}
'use strict'
module.exports = {
NODE_ENV: '"production"'
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>strategy-ui</title>
<script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.7.13/dingtalk.open.js"></script>
<script type="text/javascript" src="http://g.alicdn.com/dingding/dingtalk-pc-api/2.3.1/index.js"></script>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
This diff is collapsed.
{
"name": "strategy-ui",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "derong.zhang <derong.zhang@quantgroup.cn>",
"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.19.0",
"dingtalk-jsapi": "^2.8.33",
"iview": "^3.5.4",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuedraggable": "^2.23.2"
},
"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-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",
"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"
]
}
<template>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 14px;
width: 100%;
height: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
import axios from '../services/http.service'
export function getSoulSoother () {
return axios.get(`/gateway/api/sysStrategy/getTodaySoul`, {headers: {
'Content-Type': 'application/json'
}})
}
export function getlist () {
return axios.get(`/gateway/api/sysStrategy/query`, {headers: {
'Content-Type': 'application/json'
}})
}
export function addtitlelist (data) {
return axios.post(`/gateway/api/strategyObjectives/save`, data, {headers: {
'Content-Type': 'application/json'
}})
}
export function delatetitlelist (data) {
return axios.delete(`/gateway/api/strategyObjectives/delete/${data}`, {headers: {
'Content-Type': 'application/json'
}})
}
export function savechildput (data) {
return axios.post(`/gateway/api/keyresults/save`, data, {headers: {
'Content-Type': 'application/json'
}})
}
// 删除战略步骤
export function delatechildputchlid (data) {
return axios.delete(`/gateway/api/keyresults/delete/${data}`, {headers: {
'Content-Type': 'application/json'
}})
}
// 保存战略大标题
export function savehostTitle (data) {
return axios.post(`/gateway/api/sysStrategy/edit`, data, {headers: {
'Content-Type': 'application/json'
}})
}
// 排序战略
export function sortstrategy (arr, data) {
return axios.post(`/gateway/api/keyresults/${data}/order`, arr, {headers: {
'Content-Type': 'application/json'
}})
}
// 查询素材列表
export function getsourcelist (data) {
return axios.get(`/gateway/api/material/${data}/list`, {headers: {
'Content-Type': 'application/json'
}})
}
// 编辑素材
export function editsourceitem (data) {
return axios.post(`/gateway/api/material/save`, data, {headers: {
'Content-Type': 'application/json'
}})
}
// 删除素材
export function delatesourceitem (data) {
return axios.delete(`/gateway/api/material/delete/${data}`, {headers: {
'Content-Type': 'application/json'
}})
}
// 查询战略详细列表
export function getdetailList (data) {
return axios.post(`/gateway/api/keyresultsDetail/${data}/list`, {headers: {
'Content-Type': 'application/json'
}})
}
// 新增或修改战略详情
export function edutListitem (data) {
return axios.post(`/gateway/api/keyresultsDetail/save`, data, {headers: {
'Content-Type': 'application/json'
}})
}
// 删除战略详情
export function delateListitem (data) {
return axios.delete(`/gateway/api/keyresultsDetail/delete/${data}`, {headers: {
'Content-Type': 'application/json'
}})
}
// 获取钉钉员工列表
export function getname (data) {
return axios.get(`/gateway/api/dingdingUser/searchDingDingUserByKey?key=${data}`, {headers: {
'Content-Type': 'application/json'
}})
}
// 获取鉴权相关参数配置
export function getconfiglist () {
return axios.get(`/gateway/api/dingTalk/getDingTalkConfig`, {headers: {
'Content-Type': 'application/json'
}})
}
import axios from '../services/http.service'
// import {
// sapi
// } from '../config'
export function login (data) {
return axios.post(`/gateway/api/login/doLogin`, data, {headers: {
'Content-Type': 'application/json'
}})
}
export function loginout () {
return axios.get(`/gateway/api/login/loginOut`, {headers: {
'Content-Type': 'application/json'
}})
}
export function getmassage () {
return axios.get(`/gateway/api/login/me`, {headers: {
'Content-Type': 'application/json'
}})
}
<template>
<div class="layout">
<Layout class="layout_content">
<Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed">
<div class="title">
战略引擎
</div>
<Menu active-name="1-1" theme="dark" width="auto" :class="menuitemClasses">
<MenuItem name="1-1">
<Icon type="ios-navigate"></Icon>
<span @click="go">战略配置</span>
</MenuItem>
</Menu>
<div slot="trigger"></div>
</Sider>
<Layout>
<Header class="layout-header-bar">
<span class="signout" @click="logOut">退出</span>
<span class="message">{{me}}</span>
</Header>
<Content :style="{margin: '5px', background: '#fff', minHeight: '220px'}">
<router-view></router-view>
</Content>
</Layout>
</Layout>
</div>
</template>
<script>
import {loginout, getmassage} from '../api/user.serve'
export default {
data () {
return {
isCollapsed: false,
me: ''
}
},
computed: {
menuitemClasses: function () {
return [
'menu-item',
this.isCollapsed ? 'collapsed-menu' : ''
]
}
},
methods: {
go () {
this.$router.push('/strategymange')
},
logOut () {
loginout().then((data) => {
if (data.data.success === true) {
this.$router.push('/')
}
})
},
getmass () {
getmassage().then(data => {
this.me = data.data.userCode
})
}
},
mounted () {
this.getmass()
}
}
</script>
<style scoped>
.layout{
border: 1px solid #d7dde4;
background: #f5f7f9;
position: relative;
border-radius: 4px;
overflow: hidden;
height: 100%;
}
.layout_content{
height: 100%
}
.layout-header-bar{
background: #fff;
box-shadow: 0 1px 1px rgba(0,0,0,.1);
}
.menu-item span{
display: inline-block;
overflow: hidden;
width: 69px;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: bottom;
transition: width .2s ease .2s;
}
.menu-item i{
transform: translateX(0px);
transition: font-size .2s ease, transform .2s ease;
vertical-align: middle;
font-size: 16px;
}
.collapsed-menu span{
width: 0px;
transition: width .2s ease;
}
.collapsed-menu i{
transform: translateX(5px);
transition: font-size .2s ease .2s, transform .2s ease .2s;
vertical-align: middle;
font-size: 22px;
}
.signout{
font-size: 16px;
float: right;
margin-right: 10px;
color: #0092ff
}
.title{
width: 100%;
height: 60px;
line-height: 60px;
text-align: center;
color: #ffffff;
font-size: 20px;
font-weight: 900;
}
.message {
font-size: 16px;
float: right;
margin-right: 30px;
color: #0092ff
}
</style>
<template>
<div class="login">
<div class="logincontent">
<h2 class="title">战略引擎</h2>
<Form ref="loginForm" :model="loginForm" :rules="ruleLoginForm" style="margin-top:30px;">
<FormItem prop="loginName">
<Input v-model="loginForm.loginName" type="text" placeholder="Username">
<Icon type="ios-person-outline" slot="prepend"></Icon>
</Input>
</FormItem>
<FormItem prop="password">
<Input type="password" v-model="loginForm.password" placeholder="Password" @keyup.enter.native='login'>
<Icon type="ios-lock-outline" slot="prepend"></Icon>
</Input>
</FormItem>
<FormItem>
<Button @click="login()" type="primary" long>登录</Button>
</FormItem>
</Form>
</div>
</div>
</template>
<script>
import {login} from '../api/user.serve'
import localStorage from '../services/localStorage.service'
export default {
data () {
const validateMenuClassifyId = (rule, value, callback) => {
if (this.status) {
callback(new Error('用户名或密码错误'))
this.status = false
} else {
callback()
}
}
return {
error: '',
status: false,
loginForm: {
loginName: '',
password: ''
},
ruleLoginForm: {
loginName: [
{required: true, message: '请输入用户名', trigger: 'blur'}
],
password: [
{required: true, message: '请输入密码', trigger: 'blur'},
{ required: true, validator: validateMenuClassifyId, trigger: 'blur' }
]
}
}
},
methods: {
login () {
this.$refs['loginForm'].validate((valid) => {
if (valid) {
let params = {
userCode: this.loginForm.loginName,
password: this.loginForm.password
}
login(params).then(data => {
if (data.data.body.token) {
this.status = false
localStorage.set('token', data.data.body.token)
this.$router.push({path: '/strategymange'})
} else {
this.error = data.body
this.status = true
this.$refs['loginForm'].validate()
return false
}
})
}
})
}
}
}
</script>
<style scoped>
.login {
height: 100%;
width: 100%;
position: relative;
background: url("../../static/logo.jpg") repeat;
background-size: 100% 100%;
}
.logincontent{
width:300px;
height:300px;
position: absolute;
top:0;
left:0;
right:0;
bottom:200px;
margin:auto;
/* border: 1px solid black */
}
.title{
font-size: 48px;
text-align: center;
color: #A2825F;
font-weight: 900;
}
</style>
<style>
.logincontent .ivu-btn-primary{
background: #A2825F !important;
border-color: #A2825F;
color: white;
font-size: 16px;
font-weight: 900
}
</style>
const sapi = 'https://s-engine-ai3.liangkebang.net'
// const sapi = 'http://192.168.29.88:5555'
export {
sapi
}
module.exports = process.env.NODE_ENV === 'production' ? require('./prod.config.js') : require('./env.config.js')
const sapi = 'http://heimdallr-arch.liangkebang.net'
// const sapi = 'http://192.168.29.88:5555'
export {
sapi
}
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// import initRouter from './service/init.service.js'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import initRouter from './services/init.service'
Vue.use(iView)
initRouter.init(router)
// initRouter.init(router)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
<template>
<div class="detailstrategy">
<div class="detailstrategy_title">
<div class="detailstrategy_title_large">战略引擎</div>
<div class="detailstrategy_title_icon"><Icon type="ios-arrow-forward" /></div>
<div class="detailstrategy_title_content">{{twotitle}}</div>
</div>
<div class="detailstrategy_content" >
<div class="detailstrategy_content_warp" v-for="(item, index) in contentarr" :key="index" @mousemove="movedivhome(item)" @mouseleave="leavedivhome(item)">
<div class="content_warpleft">
<div class="content_warp_put">
<div class="warp_put_value">
<Input v-model="item.content" style="width:99%" type="textarea" v-show="item.showput" @on-blur="sele(item)"/>
<span v-show="item.showspan" class="valuespan" :class="{'listorvaluespan':item.showstatus}">{{item.content}}</span>
</div>
<div class="content_warp_remarks" v-for="(item, index1) in item.dingRecordList" :key="index1">
<p>
<span >{{item.dingDate}}</span>
<span style="margin-left:20px">已钉钉</span>
<span style="margin-left:20px">{{item.name}}</span>
</p>
</div>
</div>
</div>
<div class="content_warpright" v-show="item.showstatus">
<div class="warp_put_img">
<div class="imgdiv">
<p class="imglist">
<img src="../../static/bianji.png" @click="editinput(item)" title="编辑" >
<img src="../../static/shanchu.png" title="删除" @click="delateitem(item)" style="margin-left:20px">
<img src="../../static/dingding.png" alt="钉钉" @click="ding(item)" style="margin-left:20px">
</p>
<p v-show="item.showselect">
<Select v-model="item.dingNamearr" size="small" clearable style="width:100%" multiple filterable :remote-method="remoteMethod" remote>
<Option v-for="(item, index) in getNamearr" :value="item.userId" :key="index">{{item.name}}</Option>
</Select>
</p>
</div>
<div class="confirediv" v-show="item.showselect">
<p style="margin-top:22px">
<Button type="primary" size='small'>取消</Button>
<Button type="primary" size='small'>确认</Button>
</p>
</div>
</div>
</div>
</div>
<div class="classtitle_add">
<img src="../../static/tianjia.png" title="添加" @click="addchlidlist()">
</div>
</div>
<Modal
v-model="delatelefthostmodal"
:mask-closable='false'
:width='300'
footer-hide
>
<h1 class="textalign">提示</h1>
<div class="textalign_content">删除后不可恢复,是否确定删除?</div>
<div class="textalign_btn">
<Button type="primary" @click="delatelefthostmodal=false">取消</Button>
<Button type="primary" style="margin:0 20px" @click="confiredelatehostListleft">确认</Button>
</div>
</Modal>
</div>
</template>
<script>
// import dd from 'dingtalk-jsapi'
import {getdetailList, edutListitem, delateListitem, getname} from '../api/strategymange.serve'
export default {
data () {
return {
twotitle: '',
name: '',
showimginput: false,
showvalue2: true,
contentarr: [],
delateUid: '',
delatelefthostmodal: false,
dingNamearr: [],
getNamearr: []
}
},
methods: {
movedivhome (item) {
item.showstatus = true
this.contentarr = [...this.contentarr]
},
leavedivhome (item) {
item.showstatus = false
this.contentarr = [...this.contentarr]
},
sele (item) {
let data = {
keyResultsUid: this.$route.query.uid,
uid: item.uid === '' ? '' : item.uid,
content: item.content === '' ? '' : item.content,
orderNo: item.orderNo === '' ? '' : item.orderNo
}
edutListitem(data).then(data => {
if (data.data.success === true) {
this.$Message.success('保存成功')
this.getlist()
} else {
this.$Message.error(data.data.body.message)
this.getlist()
}
})
},
ding (item) {
item.showselect = true
this.contentarr = [...this.contentarr]
},
editinput (item) {
item.showput = true
item.showspan = false
this.contentarr = [...this.contentarr]
},
getlist () {
let data = this.$route.query.uid
getdetailList(data).then(data => {
this.contentarr = data.data.body
this.contentarr.map(item => {
item.showput = false
item.showspan = true
item.showselect = false
item.showstatus = false
item.dingNamearr = []
return item
})
})
},
// getnamelist () {
// dd.biz.ding.post({
// users: ['100', '101'], // 用户列表,userid
// corpId: 'dingcdf747c33620747835c2f4657eb6378f', // 加密的企业id
// type: 2, // 钉类型 1:image 2:link
// alertType: 2,
// alertDate: {'format': 'yyyy-MM-dd HH:mm', 'value': '2015-05-09 08:00'},
// attachment: {
// images: [''] // 只取第一个image
// }, // 附件信息
// text: '', // 消息体
// onSuccess: function () {},
// onFail: function () {}
// })
// },
async remoteMethod (query) {
if (query !== '') {
setTimeout(async () => {
query = query.split('(')[0]
const list = await getname(query)
this.getNamearr = list.data.body || []
}, 200)
console.log(this.getNamearr, 99)
} else {
this.getNamearr = []
}
},
addchlidlist () {
this.contentarr.push({
keyResultsUid: this.$route.query.uid,
uid: '',
content: '',
orderNo: this.contentarr.length + 1
})
},
delateitem (item) {
this.delateUid = item.uid
this.delatelefthostmodal = true
},
confiredelatehostListleft () {
delateListitem(this.delateUid).then(data => {
if (data.data.success === true) {
this.$Message.success('删除成功')
this.delatelefthostmodal = false
this.getlist()
} else {
this.$Message.error(data.data.body.message)
this.delatelefthostmodal = false
this.getlist()
}
})
}
},
mounted () {
this.twotitle = this.$route.query.userCode
this.getlist()
}
}
</script>
<style scoped>
.detailstrategy{
height: 100%;
width: 100%;
background: url('../../static/logo.jpg') repeat;
background-size: 100% 100%;
}
.detailstrategy_title{
height: 40px;
width: 100%;
float: left;
line-height: 40px
}
.detailstrategy_title_large{
width: 60px;
float: left;
margin-left: 20px
}
.detailstrategy_title_icon{
width: 20px;
float: left;
}
.detailstrategy_content{
height: 95%;
width: 100%;
float: left;
overflow-y: auto;
/* border: 1px solid black */
}
.detailstrategy_content_warp{
width: 85%;
margin: 0 11%;
min-height: 80px;
/* border: 1px solid yellow */
}
.content_warpleft{
min-height: 80px;
width: 80%;
float: left;
/* border: 1px solid black; */
margin-top:5px;
}
.content_warpright{
height: 80px;
width: 20%;
float: left;
/* border: #848484 1px solid; */
margin-top:5px;
}
.content_warp_remarks{
min-height:60px;
width: 100%;
height: 40px;
float: left;
line-height: 20px;
padding: 10px 0;
color: #848484;
/* border: 1px solid yellow */
}
.content_warp_put{
min-height:60px;
width: 100%;
float: left;
/* border: 1px solid yellow */
}
.warp_put_value{
min-height: 60px;
width: 100%;
float: left;
background: white;
/* margin-top:15px; */
/* border: 1px solid red */
}
.warp_put_img{
width: 100%;
min-height: 60px;
float: left;
}
.imgdiv{
height: 100%;
width: 50%;
/* border: 1px solid yellow; */
float: left;
}
.imglist {
width: 100%;
height: 20px;
display: flex
}
.confirediv{
height: 100%;
width: 50%;
/* border: 1PX solid red; */
float: left;
text-align: center
}
.listorvaluespan{
background: #e8e8e8 !important
}
.warp_put_img img {
height: 15px;
width: 15px;
}
.classtitle_add{
height: 40px;
width: 100%;
float: left;
text-align: center;
line-height: 40px;
}
.classtitle_add img{
height: 20px;
width: 20px;
}
.textalign{
text-align: center
}
.textalign_content{
height: 60px;
line-height: 60px;
text-align: center;
font-size: 16px
}
.textalign_btn{
text-align: center;
margin-top:20px;
}
.valuespan{
height: 100%;
min-height: 60px;
width: 100%;
font-size: 16px;
background: white;
display: flex;
justify-content:left;
align-items:Center;
padding: 5px 5px;
border: 1px solid #a2825f;
border-radius: 2px
}
.spansend{
display: inline-block;
/* position: relative;
top: -40px */
}
.detailstrategy_title_content{
font-size: 16px;
color: black;
font-weight: 900
}
</style>
This diff is collapsed.
This diff is collapsed.
import Vue from 'vue'
import Router from 'vue-router'
import login from '@/components/login'
import home from '@/components/home'
import strategymange from '../pages/strategymange.vue'
import detailstrategy from '../pages/detailstrategy.vue'
import sourcematerial from '../pages/sourcematerial.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'login',
component: login
},
{
path: '/home',
name: 'home',
component: home,
children: [
{
path: '/strategymange',
name: 'strategymange',
component: strategymange
},
{
path: '/detailstrategy',
name: 'detailstrategy',
component: detailstrategy
},
{
path: '/sourcematerial',
name: 'sourcematerial',
component: sourcematerial
}
]
}
]
})
import axios from 'axios'
import { Notice } from 'iview'
import localStorage from './localStorage.service'
// window.Promise = require('es6-promise').Promise
const config = {
timeout: 600000
// withCredentials: true // 允许携带cookie
}
const instance = axios.create(Object.assign({}, config))
instance._extend = {}
function requestInterceptor (config) {
config.headers['x-requested-with'] = 'XMLHttpRequest'
// if (!config.headers['Content-Type']) {
// config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
// }
if (!config.headers['token']) {
config.headers['token'] = localStorage.get('token') || ''
}
return config
}
function responseInterceptor (response) {
if (response.status < 200 || response.status > 300) {
Notice.error({
title: '请求发生错误',
desc: response && response.data && (response.data.errorMsg || '请联系系统管理员')
})
return Promise.reject(response && response.data)
}
// code是0000表示成功
if (response.status === 200 || response.status === 400) {
return Promise.resolve(response || null)
}
// Notice.error({
// title: '',
// desc: response.data.errorMsg || response.data.message || '请联系客服'
// })
return Promise.reject(response && response.data)
}
/**
* 不使用默认拦截器
* axios.interceptors.request.eject(0)
* axios.interceptors.response.eject(0)
*/
instance.interceptors.request.use(requestInterceptor, (error) => {
return Promise.reject(error)
})
instance.interceptors.response.use(responseInterceptor, error => {
if (error.response && error.response.status === 401) {
window.location.href = window.location.origin + '/login'
}
if (error.message.indexOf('timeout') !== -1) {
Notice.error({
title: '',
desc: '请求超时'
})
}
// return Promise.reject(error)
})
export default instance
import localStorage from '../services/localStorage.service'
export default{
init (router) {
router.beforeEach((to, form, next) => {
const token = localStorage.get('token')
if (to.meta && !to.meta.allowBack && window.history && window.history.pushState) {
history.pushState(null, null, document.URL)
}
if (to.name === 'login') {
next()
return
}
if (!token) {
window.location.href = `${window.location.origin}/login`
return
}
next()
})
}
}
export default{
get (key) {
let result = localStorage.getItem(key)
try {
result = JSON.parse(result)
} catch (e) {}
return result
},
set (key, value) {
let toString = Object.prototype.toString
if (toString.call(value) === '[object Array]' || toString.call(value) === '[object Object]') {
value = JSON.stringify(value)
}
return localStorage.setItem(key, value)
},
remove (key) {
return localStorage.removeItem(key)
},
clear () {
return localStorage.clear()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment