Commit 327ad411 by 高淑倩

add:buildconf_path

parents a4bcbe3f 245bd18f
...@@ -15,6 +15,9 @@ module.exports = { ...@@ -15,6 +15,9 @@ module.exports = {
// https://github.com/standard/standard/blob/master/docs/RULES-en.md // https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard', 'standard',
], ],
globals: {
$: true
},
// required to lint *.vue files // required to lint *.vue files
plugins: ['vue'], plugins: ['vue'],
// add your custom rules here // add your custom rules here
......
...@@ -48,6 +48,10 @@ const devWebpackConfig = merge(baseWebpackConfig, { ...@@ -48,6 +48,10 @@ const devWebpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': require('../config/dev.env') 'process.env': require('../config/dev.env')
}), }),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(), new webpack.NoEmitOnErrorsPlugin(),
...@@ -85,8 +89,8 @@ module.exports = new Promise((resolve, reject) => { ...@@ -85,8 +89,8 @@ module.exports = new Promise((resolve, reject) => {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
}, },
onErrors: config.dev.notifyOnErrors onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback() ? utils.createNotifierCallback()
: undefined : undefined
})) }))
resolve(devWebpackConfig) resolve(devWebpackConfig)
......
...@@ -11,7 +11,9 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin') ...@@ -11,7 +11,9 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env') const env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, { const webpackConfig = merge(baseWebpackConfig, {
module: { module: {
...@@ -23,8 +25,9 @@ const webpackConfig = merge(baseWebpackConfig, { ...@@ -23,8 +25,9 @@ const webpackConfig = merge(baseWebpackConfig, {
}, },
devtool: config.build.productionSourceMap ? config.build.devtool : false, devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: { output: {
path: config.build.assetsRoot, path: path.resolve(__dirname, `../dist/${env.project.replace(/['"]/g, "")}`),//config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'), filename: utils.assetsPath('js/[name].[chunkhash].js'),
publicPath: ['', env.project.replace(/['"]/g, ""), ''].join('/'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
}, },
plugins: [ plugins: [
...@@ -32,6 +35,10 @@ const webpackConfig = merge(baseWebpackConfig, { ...@@ -32,6 +35,10 @@ const webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': env 'process.env': env
}), }),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new UglifyJsPlugin({ new UglifyJsPlugin({
uglifyOptions: { uglifyOptions: {
compress: { compress: {
...@@ -61,7 +68,9 @@ const webpackConfig = merge(baseWebpackConfig, { ...@@ -61,7 +68,9 @@ const webpackConfig = merge(baseWebpackConfig, {
// you can customize output by editing /index.html // you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin // see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: config.build.index, filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: path.resolve(__dirname, `../dist/${env.project.replace(/['"]/g, "")}/index.html`),
template: 'index.html', template: 'index.html',
inject: true, inject: true,
minify: { minify: {
...@@ -81,7 +90,7 @@ const webpackConfig = merge(baseWebpackConfig, { ...@@ -81,7 +90,7 @@ const webpackConfig = merge(baseWebpackConfig, {
// split vendor js into its own file // split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
name: 'vendor', name: 'vendor',
minChunks (module) { minChunks(module) {
// any required modules inside node_modules are extracted to vendor // any required modules inside node_modules are extracted to vendor
return ( return (
module.resource && module.resource &&
......
module.exports = {
config: [{
project: '',
requestUrl: ''
}]
}
\ No newline at end of file
...@@ -3,5 +3,8 @@ const merge = require('webpack-merge') ...@@ -3,5 +3,8 @@ const merge = require('webpack-merge')
const prodEnv = require('./prod.env') const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, { module.exports = merge(prodEnv, {
NODE_ENV: '"development"' 'NODE_ENV': "'development'",
'host': "'//localhost'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
}) })
...@@ -10,26 +10,28 @@ module.exports = { ...@@ -10,26 +10,28 @@ module.exports = {
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '/', assetsPublicPath: '/',
proxyTable: { proxyTable: {
'/materials-list': { '/api': {
changeOrigin: true, // 是否跨域 target: 'http://wxapp.hotwind.net', // 接口的域名
target: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/materials-list', // secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: { pathRewrite: {
'^/materials-list': '/', '^/api': '',
}, },
}, },
'/getarticlesummary': { '/hot': {
changeOrigin: true, // 是否跨域 target: 'http://10.0.19.146:8080', // 接口的域名
target: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/getarticlesummary', // secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: { pathRewrite: {
'^/getarticlesummary': '/', '^/hot': '',
}, },
}, },
}, },
// Various Dev Server settings // Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST host: 'localhost', // 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 port: 8081, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: true, autoOpenBrowser: false,
errorOverlay: true, errorOverlay: true,
notifyOnErrors: true, notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
...@@ -64,7 +66,9 @@ module.exports = { ...@@ -64,7 +66,9 @@ module.exports = {
// Paths // Paths
assetsRoot: path.resolve(__dirname, '../dist'), assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: './',
// assetsPublicPath: '/minapro/vue/', // '/minapro/vue/'
assetsPublicPath: '',
/** /**
* Source Maps * Source Maps
......
module.exports = {
"host": "'//wxapp.hotwind.net'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
}
'use strict' 'use strict'
const yargs = require('yargs').argv
const env = yargs.env
let path = './prod.prod.env'
if (env === 'dev') {
path = './prod.dev.env'
} else if (env === 'uat') {
path = './prod.uat.env'
}
const envConfig = require(path)
module.exports = { module.exports = {
NODE_ENV: '"production"' NODE_ENV: '"production"',
...envConfig
} }
module.exports = {
"host": "'//wxapp.hotwind.net'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
}
module.exports = {
"host": "'//10.0.16.178:8080'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
}
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev", "start": "npm run dev",
"lint": "eslint --fix --ext .js,.vue src", "lint": "eslint --fix --ext .js,.vue src",
"build": "node build/build.js" "build:dev": "node build/build.js --env=dev",
"build:uat": "node build/build.js --env=uat",
"build": "node build/build.js --env=prod"
}, },
"dependencies": { "dependencies": {
"animate.css": "^3.7.0", "animate.css": "^3.7.0",
...@@ -16,6 +18,7 @@ ...@@ -16,6 +18,7 @@
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"echarts": "^4.2.0-rc.2", "echarts": "^4.2.0-rc.2",
"element-ui": "^2.4.9", "element-ui": "^2.4.9",
"jquery": "^3.3.1",
"moment": "^2.22.2", "moment": "^2.22.2",
"underscore": "^1.9.1", "underscore": "^1.9.1",
"v-charts": "^1.19.0", "v-charts": "^1.19.0",
...@@ -80,7 +83,8 @@ ...@@ -80,7 +83,8 @@
"webpack": "^3.6.0", "webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0", "webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1", "webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0" "webpack-merge": "^4.1.0",
"yargs": "^12.0.1"
}, },
"engines": { "engines": {
"node": ">= 6.0.0", "node": ">= 6.0.0",
......
...@@ -244,49 +244,50 @@ ...@@ -244,49 +244,50 @@
</style> </style>
<style lang="scss"> <style lang="scss">
.message-panel { .message-panel {
top:70px !important; top: 70px !important;
padding-top: 0; padding-top: 0;
&.el-notification { &.el-notification {
height: 864px; height: 864px;
width: 420px; width: 420px;
overflow: hidden; overflow: hidden;
overflow-y: scroll; }
} &.el-message-box {
&.el-message-box { width: auto;
width: auto; }
} .el-notification__group {
.el-notification__group { width: 100%;
width: 100%; }
}
.el-notification__title { .el-notification__title {
height: 40px; height: 40px;
box-sizing: border-box; box-sizing: border-box;
line-height: 1; line-height: 1;
position: relative; position: relative;
background: #ffffff; background: #ffffff;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
z-index: 2; z-index: 2;
padding: 10px 20px; padding: 10px 20px;
font-weight: bold; font-weight: bold;
font-size: 16px; font-size: 16px;
} }
.el-notification__closeBtn { .el-notification__closeBtn {
z-index: 9; z-index: 9;
}
} }
}
</style> </style>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import message from './message' import message from './message'
require('@/lib/slimscroll/slimscroll')
export default { export default {
name: 'headerNav', name: 'headerNav',
data () { data () {
return { return {
showMenusPanel: false, showMenusPanel: false,
showEditMenusPanel: false, showEditMenusPanel: false,
showMessagePanelcontrol: null,
currentSelectIndex: -1, currentSelectIndex: -1,
oprations: [{name: '修改密码', link: 'http://www.baidu.com'}, {name: '安全退出', link: 'http://www.baidu.com'}], oprations: [{name: '修改密码', link: 'http://www.baidu.com'}, {name: '安全退出', link: 'http://www.baidu.com'}],
helpers: [{ helpers: [{
...@@ -336,22 +337,61 @@ export default { ...@@ -336,22 +337,61 @@ export default {
components: { components: {
message message
}, },
mounted () {
this.$nextTick(() => {
this.initSlimscroll()
})
},
methods: { methods: {
...mapActions([ ...mapActions([
'showEditMenus', 'showEditMenus',
'hideEditMenus' 'hideEditMenus'
]), ]),
initSlimscroll () {
$('.message-panel.el-notification').slimScroll({
width: '100%', // 可滚动区域宽度
height: '100%', // 可滚动区域高度
size: '10px', // 滚动条宽度,即组件宽度
color: '#000', // 滚动条颜色
position: 'right', // 组件位置:left/right
distance: '0px', // 组件与侧边之间的距离
start: 'top', // 默认滚动位置:top/bottom
opacity: 0.4, // 滚动条透明度
alwaysVisible: true, // 是否 始终显示组件
disableFadeOut: false, // 是否 鼠标经过可滚动区域时显示组件,离开时隐藏组件
railVisible: true, // 是否 显示轨道
railColor: '#333', // 轨道颜色
railOpacity: 0.2, // 轨道透明度
railDraggable: true, // 是否 滚动条可拖动
railClass: 'slimScrollRail', // 轨道div类名
barClass: 'slimScrollBar', // 滚动条div类名
wrapperClass: 'slimScrollDiv', // 外包div类名
allowPageScroll: true, // 是否 使用滚轮到达顶端/底端时,滚动窗口
wheelStep: 20, // 滚轮滚动量
touchScrollStep: 200, // 滚动量当用户使用手势
borderRadius: '7px', // 滚动条圆角
railBorderRadius: '7px' // 轨道圆角
})
},
clickItem () { clickItem () {
console.log(this) console.log('this is header index %o', this)
}, },
showMessage () { showMessage () {
const h = this.$createElement if (this.showMessagePanelcontrol) {
this.$notify({ this.showMessagePanelcontrol.close()
title: '消息中心', this.showMessagePanelcontrol = null
message: h('message'), } else {
duration: 0, const h = this.$createElement
customClass: 'message-panel' this.showMessagePanelcontrol = this.$notify({
}) title: '消息中心',
message: h('message'),
duration: 0,
onClose: () => {
this.showMessagePanelcontrol = null
},
customClass: 'message-panel'
})
}
}, },
handleOpen () {}, handleOpen () {},
handleClose () {}, handleClose () {},
...@@ -359,7 +399,7 @@ export default { ...@@ -359,7 +399,7 @@ export default {
this.showMenusPanel = !this.showMenusPanel this.showMenusPanel = !this.showMenusPanel
}, },
toggleMenus (...args) { toggleMenus (...args) {
console.log(args) console.log('this is header toggleMenus %o', args)
}, },
handleEditMenus () { handleEditMenus () {
if (!this.editMenus) { if (!this.editMenus) {
...@@ -370,7 +410,7 @@ export default { ...@@ -370,7 +410,7 @@ export default {
}, },
setActiveStyle (item, ev) { setActiveStyle (item, ev) {
this.currentSelectIndex = ev.index this.currentSelectIndex = ev.index
console.log(item) console.log('this is header setActiveStyle %o', item)
}, },
formatPathString (...args) { formatPathString (...args) {
return args.join('-') return args.join('-')
......
...@@ -4,25 +4,28 @@ ...@@ -4,25 +4,28 @@
<div id="pullDown"> <div id="pullDown">
<span class="pullDownIcon" style="display: none"></span><span class="pullDownLabel">释放刷新</span> <span class="pullDownIcon" style="display: none"></span><span class="pullDownLabel">释放刷新</span>
</div> </div>
<ul id="thelist"> <ul id="thelist"
<li v-for="(item, index) in items" class="message-item" :key="index" @click="openMessageContent(item)"> @mouseup="handlerMouseUp($event)"
@mousedown="handlerMousedown($event)"
>
<li v-for="(item, index) in items" class="message-item"
:key="index" @click="openMessageContent(item,$event)">
<div class="message-item-title">{{item.title}}</div> <div class="message-item-title">{{item.title}}</div>
<div class="message-desc">{{item.content_text}}</div> <div class="message-desc">{{item.content_text}}</div>
<div class="message-desc">{{item.push_time | fomatDate}}</div> <div class="message-desc">{{item.push_time | fomatDate}}</div>
</li> </li>
</ul> </ul>
<div id="pullUp"> <div id="pullUp">
<span class="pullUpIcon" style="display: none"></span><span class="pullUpLabel">释放加载</span> <span class="pullUpIcon" style="display: none"></span><span class="pullUpLabel">上拉加载更多</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
require('@/lib/iscroll/iscroll.js') require('@/lib/iscroll/iscroll')
const IScroll = window.iScroll const IScroll = window.iScroll
let pullDownEl, pullDownOffset, let pullDownEl, pullDownOffset, pullUpEl, pullUpOffset
pullUpEl, pullUpOffset
export default { export default {
name: 'message', name: 'message',
data () { data () {
...@@ -30,21 +33,19 @@ export default { ...@@ -30,21 +33,19 @@ export default {
items: [], items: [],
myScroll: null, myScroll: null,
pageNo: 0, pageNo: 0,
isLastPage: false isLastPage: false,
eventType: '',
eventMouseStarEl: null,
eventMouseEndEl: null
} }
}, },
components: { components: {},
},
created () { created () {
this.getListDataFromNet(1, 10) this.getListDataFromNet(1, 10)
}, },
watch: { watch: {},
computed: {},
},
computed: {
},
mounted () { mounted () {
this.$nextTick(() => { this.$nextTick(() => {
this.loaded() this.loaded()
...@@ -63,7 +64,7 @@ export default { ...@@ -63,7 +64,7 @@ export default {
{ {
params: { params: {
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: 10, pageSize: 20,
push_state: 2 push_state: 2
} }
} }
...@@ -85,8 +86,8 @@ export default { ...@@ -85,8 +86,8 @@ export default {
pullUpEl = document.getElementById('pullUp') pullUpEl = document.getElementById('pullUp')
pullUpOffset = pullUpEl.offsetHeight pullUpOffset = pullUpEl.offsetHeight
this.myScroll = new IScroll('wrapper', { this.myScroll = new IScroll('wrapper', {
scrollbarClass: 'myScrollbar', /* 重要样式 */ scrollbarClass: 'myScrollbar' /* 重要样式 */,
useTransition: false, /* 此属性不知用意,本人从true改为false */ useTransition: false /* 此属性不知用意,本人从true改为false */,
topOffset: pullDownOffset, topOffset: pullDownOffset,
onRefresh: () => { onRefresh: () => {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -95,7 +96,9 @@ export default { ...@@ -95,7 +96,9 @@ export default {
pullDownEl.querySelector('.pullDownLabel').innerHTML = '释放刷新' pullDownEl.querySelector('.pullDownLabel').innerHTML = '释放刷新'
} else if (pullUpEl.className.match('loading')) { } else if (pullUpEl.className.match('loading')) {
pullUpEl.className = '' pullUpEl.className = ''
pullUpEl.querySelector('.pullUpLabel').innerHTML = this.isLastPage ? '没有更多数据' : '释放加载' pullUpEl.querySelector('.pullUpLabel').innerHTML = this.isLastPage
? '没有更多数据'
: '释放加载'
} }
}) })
}, },
...@@ -108,11 +111,17 @@ export default { ...@@ -108,11 +111,17 @@ export default {
pullDownEl.className = '' pullDownEl.className = ''
pullDownEl.querySelector('.pullDownLabel').innerHTML = '释放刷新' pullDownEl.querySelector('.pullDownLabel').innerHTML = '释放刷新'
this.minScrollY = -pullDownOffset this.minScrollY = -pullDownOffset
} else if (this.y < (this.maxScrollY - 5) && !pullUpEl.className.match('flip')) { } else if (
this.y < this.maxScrollY - 5 &&
!pullUpEl.className.match('flip')
) {
pullUpEl.className = 'flip' pullUpEl.className = 'flip'
pullUpEl.querySelector('.pullUpLabel').innerHTML = '释放加载' pullUpEl.querySelector('.pullUpLabel').innerHTML = '释放加载'
this.maxScrollY = this.maxScrollY this.maxScrollY = this.maxScrollY
} else if (this.y > (this.maxScrollY + 5) && pullUpEl.className.match('flip')) { } else if (
this.y > this.maxScrollY + 5 &&
pullUpEl.className.match('flip')
) {
pullUpEl.className = '' pullUpEl.className = ''
pullUpEl.querySelector('.pullUpLabel').innerHTML = '释放刷新' pullUpEl.querySelector('.pullUpLabel').innerHTML = '释放刷新'
this.maxScrollY = pullUpOffset this.maxScrollY = pullUpOffset
...@@ -122,7 +131,8 @@ export default { ...@@ -122,7 +131,8 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
if (pullDownEl.className.match('flip')) { if (pullDownEl.className.match('flip')) {
pullDownEl.className = 'loading' pullDownEl.className = 'loading'
pullDownEl.querySelector('.pullDownLabel').innerHTML = '加载中...' pullDownEl.querySelector('.pullDownLabel').innerHTML =
'加载中...'
this.pullDownAction() this.pullDownAction()
} else if (pullUpEl.className.match('flip')) { } else if (pullUpEl.className.match('flip')) {
pullUpEl.className = 'loading' pullUpEl.className = 'loading'
...@@ -132,9 +142,29 @@ export default { ...@@ -132,9 +142,29 @@ export default {
}) })
} }
}) })
document.addEventListener('touchmove', function (e) { e.preventDefault() }, false) document.addEventListener(
'touchmove',
function (e) {
e.preventDefault()
},
false
)
},
handlerMouseUp(event) {
this.eventMouseStarEl = event.target
this.eventType = ''
console.log(event)
},
handlerMousedown(event) {
this.eventMouseEndEl = event.target
console.log(event)
if (this.eventMouseStarEl && this.eventMouseStarEl === this.eventMouseEndEl) {
this.eventType = 'click'
} else {
this.eventType = 'mousemove'
}
this.eventMouseStarEl = this.eventMouseEndEl = null
}, },
pullDownAction () { pullDownAction () {
this.items = [] this.items = []
this.pageNo = 0 this.pageNo = 0
...@@ -147,55 +177,59 @@ export default { ...@@ -147,55 +177,59 @@ export default {
}, },
openMessageContent (item) { openMessageContent (item) {
this.$alert(`${item.content}`, '', { console.log(arguments)
dangerouslyUseHTMLString: true, if (this.eventType === 'click') {
customClass: 'message-panel' this.$alert(`${item.content}`, '', {
}) dangerouslyUseHTMLString: true,
customClass: 'message-panel'
})
}
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
#wrapper { #wrapper {
width: 100%; width: 100%;
position: absolute; position: absolute;
top: 18px; top: 18px;
bottom: 0; bottom: 0;
} overflow: hidden;
#pullDown,#pullUp { }
border-bottom: none; #pullDown,
text-align: center; #pullUp {
height: 40px; border-bottom: none;
box-sizing: border-box; text-align: center;
line-height: 1; height: 40px;
display: flex; box-sizing: border-box;
justify-content: center; line-height: 1;
align-items: center; display: flex;
} justify-content: center;
align-items: center;
}
#pullUp { #pullUp {
border-top: solid 1px #d7d7d7; border-top: solid 1px #d7d7d7;
text-align: center; text-align: center;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.message-item { .message-item {
border-top: 1px dashed #ddd; border-top: 1px dashed #ddd;
padding: 5px 20px; padding: 5px 20px;
cursor: pointer; cursor: pointer;
&:first-child { &:first-child {
border-top:none; border-top: none;
}
}
.message-item-title {
font-size: 15px;
} }
}
.message-desc { .message-item-title {
font-size: 13px; font-size: 15px;
} }
.message-desc {
font-size: 13px;
}
</style> </style>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
':sort':'item.sort' ':sort':'item.sort'
}) })
transition(name="fade",mode="out-in",appear) transition(name="fade",mode="out-in",appear)
.childrens-meuns('v-show'="unfold",'v-if'="currentMenus") .childrens-meuns('v-show'="sidebarUnfoldInfo",'v-if'="currentMenus")
.children-item('v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)") .children-item('v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)")
el-menu&attributes({ el-menu&attributes({
'default-active':"2", 'default-active':"2",
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
template template
el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",'@click'="choseSubChildren(i)") el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",'@click'="choseSubChildren(i)")
span.menu-item-name {{i.name}} span.menu-item-name {{i.name}}
.arrow-tip(':class'="{'left-l':!unfold,'left-ll':unfold}",'@click'="toggleUnfold()",'v-show'="unfoldBtn") .arrow-tip(':class'="{'left-l':!sidebarUnfoldInfo,'left-ll':sidebarUnfoldInfo}",'@click'="toggleUnfold()",'v-show'="unfoldBtn")
img(class='icon-arrow',':class'="{right:!unfold}","src"='@/assets/images/sidebar/left-arrow-gray.png') img(class='icon-arrow',':class'="{right:!sidebarUnfoldInfo}","src"='@/assets/images/sidebar/left-arrow-gray.png')
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
}, },
mounted () {}, mounted () {},
computed: { computed: {
...mapGetters({menus: 'getMenus'}), ...mapGetters({menus: 'getMenus', sidebarUnfoldInfo: 'getSidebarUnfoldInfo'}),
currentMenus: { currentMenus: {
get () { get () {
const currentIndex = this.currentMenusIndex const currentIndex = this.currentMenusIndex
...@@ -88,14 +88,14 @@ export default { ...@@ -88,14 +88,14 @@ export default {
* 二级菜单 * 二级菜单
**/ **/
choseChildrenItem (...args) { choseChildrenItem (...args) {
console.log(args) console.log('this is sidebar 二级菜单 %o', args)
}, },
/** /**
* 三级菜单 * 三级菜单
* @param args * @param args
**/ **/
selectItemMenu (...args) { selectItemMenu (item) {
console.log(args) console.log('this is sidebar 三级菜单 %o', item)
}, },
toggleUnfold (...args) { toggleUnfold (...args) {
if (!args.length) { if (!args.length) {
...@@ -111,8 +111,10 @@ export default { ...@@ -111,8 +111,10 @@ export default {
showUnfoldBtn () { showUnfoldBtn () {
this.unfoldBtn = true this.unfoldBtn = true
}, },
choseSubChildren (...args) { choseSubChildren (item) {
console.log(args) this.$router.push({
path: `/${item.link}`
})
}, },
getCurrentMenus (index) { getCurrentMenus (index) {
return this.menus[index] return this.menus[index]
......
...@@ -13,21 +13,31 @@ export default { ...@@ -13,21 +13,31 @@ export default {
props: ['icon', 'link', 'type', 'id', 'sort', 'name', 'pid', 'grade'], props: ['icon', 'link', 'type', 'id', 'sort', 'name', 'pid', 'grade'],
methods: { methods: {
clickItem () { clickItem () {
console.log(this) console.log('this is sidebar item %o', this)
if (this.link) {
this.$router.push({
path: `${this.link}`
})
}
} }
} }
} }
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.sidebar-item .sidebar-item {
display block display: block;
color: #fff color: #fff;
/*text-align center*/ /* text-align center */
font-weight 400 font-weight: 400;
font-size 10px font-size: 10px;
padding 10px 5px padding: 10px 5px;
i
margin-bottom 5px i {
.fa margin-bottom: 5px;
font-size 25px }
}
.fa {
font-size: 25px;
}
</style> </style>
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import config from '../config'
Vue.use(Router) Vue.use(Router)
export default new Router({ export default new Router({
mode: 'history', mode: 'history',
base: `/${config.project}/`,
routes: [ routes: [
{ {
path: '/', path: '/',
......
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