Showing
11 changed files
with
273 additions
and
105 deletions
code/apps/common/views/Vue.html
0 → 100644
code/apps/shop/client/ShopCategory/app.vue
0 → 100644
code/apps/shop/client/ShopCategory/index.js
0 → 100644
1 | module.exports = function (app){ | 1 | module.exports = function (app){ |
2 | - app.get("/shop/shopCategory/index", "shop.ShopCategory.Index", function (req,res){ | 2 | + app.get("/shop/shopCategory/index222", "shop.ShopCategory.Index", function (req,res){ |
3 | this.$extend={ | 3 | this.$extend={ |
4 | moduleName:"店铺管理", | 4 | moduleName:"店铺管理", |
5 | pageName:"店铺销售类目管理" | 5 | pageName:"店铺销售类目管理" |
6 | } | 6 | } |
7 | }); | 7 | }); |
8 | 8 | ||
9 | - app.get("/shop/shopCategory/info", "shop.ShopCategory.Info", function (rs,req,res){ | 9 | + app.vue("/shop/shopCategory/index", "shop.ShopCategory", function (req,res){ |
10 | + this.$extend={ | ||
11 | + moduleName:"店铺管理", | ||
12 | + pageName:"店铺销售类目管理" | ||
13 | + } | ||
14 | + }); | ||
15 | + | ||
16 | + app.get("/shop/shopCategory/add", "shop.ShopCategory.Info", function (rs,req,res){ | ||
17 | + this.$extend={ | ||
18 | + moduleName:"店铺管理", | ||
19 | + pageName:"店铺销售类目管理", | ||
20 | + subPageName:"新增店铺销售类目" | ||
21 | + } | ||
22 | + }); | ||
23 | + | ||
24 | + app.get("/shop/shopCategory/info/:shopId", "shop.ShopCategory.Info", function (rs,req,res){ | ||
10 | this.$extend={ | 25 | this.$extend={ |
11 | moduleName:"店铺管理", | 26 | moduleName:"店铺管理", |
12 | pageName:"店铺销售类目管理", | 27 | pageName:"店铺销售类目管理", |
@@ -14,7 +29,7 @@ module.exports = function (app){ | @@ -14,7 +29,7 @@ module.exports = function (app){ | ||
14 | } | 29 | } |
15 | }); | 30 | }); |
16 | 31 | ||
17 | - app.get("/shop/shopCategory/edit", "shop.ShopCategory.Edit", function (rs,req,res){ | 32 | + app.get("/shop/shopCategory/edit/:shopId", "shop.ShopCategory.Edit", function (rs,req,res){ |
18 | this.$extend={ | 33 | this.$extend={ |
19 | moduleName:"店铺管理", | 34 | moduleName:"店铺管理", |
20 | pageName:"店铺销售类目管理", | 35 | pageName:"店铺销售类目管理", |
@@ -2,21 +2,65 @@ | @@ -2,21 +2,65 @@ | ||
2 | <%include '../../../common/views/__partail/ListHeader'%> | 2 | <%include '../../../common/views/__partail/ListHeader'%> |
3 | 3 | ||
4 | <div class="contentpanel"> | 4 | <div class="contentpanel"> |
5 | - <div style="margin-bottom: 20px"> | ||
6 | - <div class="form-group"> | ||
7 | - <select id="shop-select" name="shop-select" style="width: 300px;" class="form-control"> | ||
8 | - <option value="-1">请选择店铺</option> | ||
9 | - </select> | 5 | + <div class="panel"> |
6 | + <div class="selectShop"> | ||
7 | + <div class="form-group" style="float: left"> | ||
8 | + <select id="shop-select" name="shop-select" style="width: 320px;" class="form-control"> | ||
9 | + <option value="-1">请选择店铺</option> | ||
10 | + </select> | ||
11 | + </div> | ||
12 | + <div id="shopInfo" style="font-family:'microsoft yahei';font-size: 18px;line-height: 40px;float: left;margin-left: 40px"> | ||
13 | + <span id="shopId"><font color="#999">店铺ID:</font><b>--</b></span> | ||
14 | + <span id="shopName" style="margin-left: 20px"><font color="#999">店铺名称:</font><b>--</b></span> | ||
15 | + </div> | ||
16 | + <div class="clearfix"></div> | ||
10 | </div> | 17 | </div> |
11 | - </div> | ||
12 | 18 | ||
13 | - <div style="margin-bottom: 20px"> | ||
14 | - <a class="add btn btn-success"><i class="fa fa-plus"></i> 新增销售类目</a> | ||
15 | - </div> | ||
16 | 19 | ||
17 | - <div style="margin-bottom: 20px"> | 20 | + <div class="panel-body" style="background: #eeeeee"> |
21 | + <div id="showCategory" style="display: none"></div> | ||
22 | + <h1 id="initCategory" style="height: 500px;text-align: center;line-height: 500px;color: #999999">请先选择相关店铺!</h1> | ||
23 | + </div> | ||
18 | </div> | 24 | </div> |
19 | - | ||
20 | </div> | 25 | </div> |
21 | 26 | ||
27 | +<script type="text/template" id="listTemplate"> | ||
28 | + <div class="addCategory" style="margin-bottom: 20px"> | ||
29 | + <a class="btn btn-success addBtn"><i class="fa fa-plus"></i> 新增销售类目</a> | ||
30 | + <span style="float: right;font-size: 16px;line-height:37px;font-family:'simhei'"> | ||
31 | + 当前店铺共有:<b style="color: #5cb85c;font-size: 20px">[[data.length]]</b> 条销售类目,<font color="#f0ad4e">最多可以添加20条</font> | ||
32 | + </span> | ||
33 | + </div> | ||
34 | + <table class="table table-striped table-bordered responsive dataTable no-footer" style="text-align: center"> | ||
35 | + <thead> | ||
36 | + <tr> | ||
37 | + <th style="text-align: center">类目ID</th> | ||
38 | + <th style="text-align: center">类目名称</th> | ||
39 | + <th style="text-align: center">创建时间</th> | ||
40 | + <th style="text-align: center">已关联商品数量</th> | ||
41 | + <th style="text-align: center">操作</th> | ||
42 | + </tr> | ||
43 | + </thead> | ||
44 | + <tbody style="line-height: 27px"> | ||
45 | + [[if data.length > 0]] | ||
46 | + [[each data as item _index]] | ||
47 | + <tr> | ||
48 | + <td style="line-height: 27px">[[item.id]]</td> | ||
49 | + <td style="line-height: 27px">[[item.name]]</td> | ||
50 | + <td style="line-height: 27px">[[item.date]]</td> | ||
51 | + <td style="line-height: 27px">[[item.num]]</td> | ||
52 | + <td style="line-height: 27px"> | ||
53 | + <a href='/shop/shopCategory/edit/[[item.id]]' class='btn btn-xs btn-primary'>编辑</a> | ||
54 | + <a href='/shop/shopCategory/info/[[item.id]]' class='btn btn-xs btn-info'>查看</a> | ||
55 | + <a href='javascript:' class='btn btn-xs btn-danger deleteBtn' data-index='"+_index+"'>删除</a> | ||
56 | + </td> | ||
57 | + </tr> | ||
58 | + [[/each]] | ||
59 | + [[else]] | ||
60 | + <tr><td colspan="6">当前店铺暂无销售类目!</td></tr> | ||
61 | + [[/if]] | ||
62 | + </tbody> | ||
63 | + </table> | ||
64 | +</script> | ||
65 | + | ||
22 | <%include '../../../common/views/__ui/footer'%> | 66 | <%include '../../../common/views/__ui/footer'%> |
1 | <template> | 1 | <template> |
2 | <div class="pageheader"> | 2 | <div class="pageheader"> |
3 | - <ul class="breadcrumb"> | ||
4 | - <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li> | ||
5 | - <li><a href="">{{title}}</a></li> | ||
6 | - <li>{{subTitle}}</li> | ||
7 | - </ul> | 3 | + <div class="media"> |
4 | + <div class="pageicon pull-left"> | ||
5 | + <i class="fa fa-th-list"></i> | ||
6 | + </div> | ||
7 | + <div class="media-body" style="font-family: 'microsoft yahei'"> | ||
8 | + <ul class="breadcrumb"> | ||
9 | + <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li> | ||
10 | + <li><a href="">{{moduleName}}</a></li> | ||
11 | + <li>{{pageName}}</li> | ||
12 | + </ul> | ||
13 | + <div style="margin-top: 4px"> | ||
14 | + <h4 v-if="subPageName" style="line-height: 30px;font-size: 24px">{{subPageName}}</h4> | ||
15 | + <h4 v-else style="line-height: 30px;font-size: 24px">{{pageName}}</h4> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + </div> | ||
8 | </div> | 19 | </div> |
9 | </template> | 20 | </template> |
10 | 21 | ||
11 | <script> | 22 | <script> |
12 | export default{ | 23 | export default{ |
13 | props:{ | 24 | props:{ |
14 | - title:{type:String, default:""}, | ||
15 | - subTitle:{type:String, default:""} | 25 | + moduleName:{type:String, default:""}, |
26 | + pageName:{type:String, default:""}, | ||
27 | + subPageName:{type:String, default:""} | ||
16 | } | 28 | } |
17 | } | 29 | } |
18 | -</script> | ||
19 | - | ||
20 | -<style> | ||
21 | - .pageheader{ margin-bottom: 8px} | ||
22 | - .pageheader .breadcrumb {font-family: 'microsoft yahei'} | ||
23 | -</style> | ||
30 | +</script> |
@@ -234,4 +234,4 @@ gulp.task('vue',["vue-gulp"], function (cb) { | @@ -234,4 +234,4 @@ gulp.task('vue',["vue-gulp"], function (cb) { | ||
234 | }); | 234 | }); |
235 | 235 | ||
236 | gulp.task("default",["jquery","assets","sass"]); | 236 | gulp.task("default",["jquery","assets","sass"]); |
237 | -gulp.task('start', ["default", "static", "server"]);//"vue" | ||
237 | +gulp.task('start', ["default", "static", "server", "vue"]);//"vue" |
@@ -26,7 +26,7 @@ Controller.prototype.__parseReq=function(req){ | @@ -26,7 +26,7 @@ Controller.prototype.__parseReq=function(req){ | ||
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | -Controller.prototype.__define=function(method,router,view,apis,callback,clientmodel){ | 29 | +Controller.prototype.__define=function(method,router,view,apis,callback,clientmodel,clientsrc){ |
30 | var me=this,isObj=false; | 30 | var me=this,isObj=false; |
31 | if(typeof apis=="string"){ | 31 | if(typeof apis=="string"){ |
32 | apis=[apis]; | 32 | apis=[apis]; |
@@ -34,34 +34,34 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | @@ -34,34 +34,34 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | ||
34 | } | 34 | } |
35 | /*参数验证*/ | 35 | /*参数验证*/ |
36 | var guid=md5(router+":"+method) | 36 | var guid=md5(router+":"+method) |
37 | - | 37 | + |
38 | me.on(guid,function(){ | 38 | me.on(guid,function(){ |
39 | var args=[].slice.call(arguments, 0); | 39 | var args=[].slice.call(arguments, 0); |
40 | - var req = args[0], res = args[1]; | 40 | + var req = args[0], res = args[1]; |
41 | + | ||
41 | 42 | ||
42 | - | ||
43 | - | ||
44 | - var local = { __session__: req.session, $extend: {} }; | 43 | + |
44 | + var local = { __session__: req.session, $extend: {} }; | ||
45 | /*如果接口不存在 就实现express 原来的方法*/ | 45 | /*如果接口不存在 就实现express 原来的方法*/ |
46 | if(!apis.length){ | 46 | if(!apis.length){ |
47 | var model={}; | 47 | var model={}; |
48 | if(callback){ | 48 | if(callback){ |
49 | - model=callback.apply(local, args); | 49 | + model=callback.apply(local, args); |
50 | } | 50 | } |
51 | if(view){ | 51 | if(view){ |
52 | - res.render(view,local,me.client(res,view,model,clientmodel)); | 52 | + res.render(view,local,me.client(res,clientsrc,model,clientmodel)); |
53 | } | 53 | } |
54 | - | 54 | + |
55 | return; | 55 | return; |
56 | } | 56 | } |
57 | - args.push(function (err, interfaces, names){ | ||
58 | - if (err) { | ||
59 | - res.json({code:500,message:"接口异常"}); | ||
60 | - return; | ||
61 | - } | 57 | + args.push(function (err, interfaces, names){ |
58 | + if (err) { | ||
59 | + res.json({code:500,message:err.message||'接口异常'}); | ||
60 | + return; | ||
61 | + } | ||
62 | //callback | 62 | //callback |
63 | var model={}; | 63 | var model={}; |
64 | - if (typeof callback == "function") { | 64 | + if (typeof callback == "function") { |
65 | model=callback.apply(local,interfaces.concat(args)); | 65 | model=callback.apply(local,interfaces.concat(args)); |
66 | }else{ | 66 | }else{ |
67 | interfaces.forEach(function(item,index){ | 67 | interfaces.forEach(function(item,index){ |
@@ -70,18 +70,18 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | @@ -70,18 +70,18 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | ||
70 | }else{ | 70 | }else{ |
71 | model[names[index]]=item; | 71 | model[names[index]]=item; |
72 | } | 72 | } |
73 | - }); | ||
74 | - } | ||
75 | - if(res.__complete__){ | ||
76 | - return; | ||
77 | - } | ||
78 | - if (model&&model.readable) { | ||
79 | - model.pipe(res); | ||
80 | - }else if (view && method == "get" && !req.xhr) { | ||
81 | - res.render(view, local, me.client(res, view, model,clientmodel)); | ||
82 | - } else { | ||
83 | - res.json(model); | ||
84 | - } | 73 | + }); |
74 | + } | ||
75 | + if(res.__complete__){ | ||
76 | + return; | ||
77 | + } | ||
78 | + if (model&&model.readable) { | ||
79 | + model.pipe(res); | ||
80 | + }else if (view && method == "get" && !req.xhr) { | ||
81 | + res.render(view, local, me.client(res, clientsrc, model,clientmodel)); | ||
82 | + } else { | ||
83 | + res.json(model); | ||
84 | + } | ||
85 | }); | 85 | }); |
86 | //调用接口获取数据 | 86 | //调用接口获取数据 |
87 | me.interfaces.require.apply(me.interfaces,[apis].concat(args)); | 87 | me.interfaces.require.apply(me.interfaces,[apis].concat(args)); |
@@ -91,8 +91,8 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | @@ -91,8 +91,8 @@ Controller.prototype.__define=function(method,router,view,apis,callback,clientmo | ||
91 | guid:guid, | 91 | guid:guid, |
92 | url:router, | 92 | url:router, |
93 | method:method | 93 | method:method |
94 | - }); | ||
95 | - //console.log(me.routers); | 94 | + }); |
95 | + //console.log(me.routers); | ||
96 | } | 96 | } |
97 | Controller.prototype.vue=function(router,views,apis,callback){ | 97 | Controller.prototype.vue=function(router,views,apis,callback){ |
98 | var me=this; | 98 | var me=this; |
@@ -106,7 +106,7 @@ Controller.prototype.vue=function(router,views,apis,callback){ | @@ -106,7 +106,7 @@ Controller.prototype.vue=function(router,views,apis,callback){ | ||
106 | apis=[]; | 106 | apis=[]; |
107 | } | 107 | } |
108 | apis=apis||[]; | 108 | apis=apis||[]; |
109 | - me.__define("get",router,views,apis,callback,"vue"); | 109 | + me.__define("get",router,"common.Vue",apis,callback,"vue",views); |
110 | } | 110 | } |
111 | Controller.prototype.get=function(router,views,apis,callback){ | 111 | Controller.prototype.get=function(router,views,apis,callback){ |
112 | var me=this; | 112 | var me=this; |
@@ -120,7 +120,7 @@ Controller.prototype.get=function(router,views,apis,callback){ | @@ -120,7 +120,7 @@ Controller.prototype.get=function(router,views,apis,callback){ | ||
120 | apis=[]; | 120 | apis=[]; |
121 | } | 121 | } |
122 | apis=apis||[]; | 122 | apis=apis||[]; |
123 | - me.__define("get",router,views,apis,callback,"jquery"); | 123 | + me.__define("get",router,views,apis,callback,"jquery",views); |
124 | } | 124 | } |
125 | Controller.prototype.post=function(router,apis,callback){ | 125 | Controller.prototype.post=function(router,apis,callback){ |
126 | var me=this; | 126 | var me=this; |
@@ -2,7 +2,92 @@ | @@ -2,7 +2,92 @@ | ||
2 | var $ = require('jquery'), | 2 | var $ = require('jquery'), |
3 | common = require('../../../common/common'); | 3 | common = require('../../../common/common'); |
4 | 4 | ||
5 | +var loadModal = null, | ||
6 | + currentShopId = -1, | ||
7 | + currentShopCategoryNum = 0; | ||
8 | + | ||
5 | new common.dropDown({ | 9 | new common.dropDown({ |
10 | + hash:true, | ||
6 | el: "#shop-select", | 11 | el: "#shop-select", |
7 | ajax: "shopsRest" | 12 | ajax: "shopsRest" |
8 | }); | 13 | }); |
14 | + | ||
15 | +var Bill = { | ||
16 | + //初始化页面 | ||
17 | + init: function () { | ||
18 | + currentShopId = -1; | ||
19 | + currentShopCategoryNum = 0; | ||
20 | + $('#shopId b').text('--'); | ||
21 | + $('#shopName b').text('--'); | ||
22 | + $('#showCategory').hide(); | ||
23 | + $('#initCategory').show(); | ||
24 | + }, | ||
25 | + //展示销售类目列表 | ||
26 | + showList: function (shopId,isLoading) { | ||
27 | + if(isLoading==1) loadModal = common.dialog.load(); | ||
28 | + | ||
29 | + common.util.__ajax({ | ||
30 | + url:'', | ||
31 | + data: {shopId:shopId} | ||
32 | + }, function (res) { | ||
33 | + if(isLoading==1 && loadModal) loadModal.close(); | ||
34 | + | ||
35 | + var data = res.data; | ||
36 | + currentShopCategoryNum = data.length; | ||
37 | + $('#initCategory').hide(); | ||
38 | + $('#showCategory').html(common.util.__template2($("#listTemplate").html(),data)).show(); | ||
39 | + },true) | ||
40 | + }, | ||
41 | + //删除销售类目 | ||
42 | + deleteCategory: function (shopId,categoryId) { | ||
43 | + common.util.__ajax({ | ||
44 | + url:'', | ||
45 | + data: { | ||
46 | + shopId:shopId, | ||
47 | + categoryId:categoryId | ||
48 | + } | ||
49 | + }, function (res) { | ||
50 | + this.showList(shopId,0); | ||
51 | + }) | ||
52 | + } | ||
53 | +}; | ||
54 | + | ||
55 | +//选择店铺 | ||
56 | +$(document).on('change', '#shop-select', function () { | ||
57 | + var shopId = $(this).val(); | ||
58 | + if(shopId > 0){ | ||
59 | + currentShopId = shopId; | ||
60 | + var shopName = this.options[this.selectedIndex].text; | ||
61 | + | ||
62 | + $('#shopId b').text(shopId); | ||
63 | + $('#shopName b').text(shopName); | ||
64 | + | ||
65 | + //Bill.showList(shopId,1); | ||
66 | + $('#initCategory').hide(); | ||
67 | + $('#showCategory').html(common.util.__template2($("#listTemplate").html(),{data:[{id:'1',name:'dada',date:'ff',num:'23'}]})).show(); | ||
68 | + | ||
69 | + }else{ | ||
70 | + Bill.init(); | ||
71 | + } | ||
72 | +}); | ||
73 | + | ||
74 | +//新增类目 | ||
75 | +$(document).on('click', '.addBtn', function () { | ||
76 | + if(currentShopCategoryNum < 20){ | ||
77 | + location.href = '/shop/shopCategory/add'; | ||
78 | + }else { | ||
79 | + common.util.__tip('店铺最多添加只能添加20个销售类目!'); | ||
80 | + } | ||
81 | +}); | ||
82 | + | ||
83 | +//删除类目 | ||
84 | +$(document).on('click', '.deleteBtn', function () { | ||
85 | + var categoryName = $(this).parent().parent().find('td').eq(1).text(); | ||
86 | + common.dialog.confirm( | ||
87 | + "删除店铺销售类目", | ||
88 | + "你确定<b style='color: #ff0000'> 删除 </b>销售类目<b style='color:#428bca'> "+categoryName+" </b>么?", | ||
89 | + function () { | ||
90 | + Bill.deleteCategory(); | ||
91 | + } | ||
92 | + ) | ||
93 | +}); |
@@ -3,69 +3,66 @@ | @@ -3,69 +3,66 @@ | ||
3 | * 默认依赖 | 3 | * 默认依赖 |
4 | */ | 4 | */ |
5 | 'use strict'; | 5 | 'use strict'; |
6 | - | ||
7 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
8 | 7 | ||
9 | var isMenuShow = false; | 8 | var isMenuShow = false; |
10 | var localStorage = window.localStorage; | 9 | var localStorage = window.localStorage; |
11 | 10 | ||
12 | -/** | ||
13 | - * 左侧导航 | ||
14 | - */ | ||
15 | -$('#sidebar .nav .has-sub>a').click(function() { | ||
16 | - var child = $(this).parent().find('.sub-menu'); | 11 | +/*左侧导航*/ |
12 | +$('.leftpanel .nav .parent>a').click(function() { | ||
13 | + var parent = $(this).parent(), | ||
14 | + child = parent.find('.children'); | ||
17 | 15 | ||
18 | - $('#sidebar .nav .has-sub>a').each(function() { | ||
19 | - $(this).find('.sub-menu').slideUp('fast'); | ||
20 | - $(this).removeClass('active'); | ||
21 | - }); | 16 | + parent.siblings('.active').find('.children').removeClass("active").slideUp('fast'); |
17 | + parent.siblings('.active').removeClass("active"); | ||
22 | 18 | ||
23 | - if (!child.is(':visible')) { | ||
24 | - child.slideDown('fast'); | ||
25 | - if (!child.parent().hasClass('active')) | ||
26 | - child.parent().addClass('active'); | ||
27 | - } else { | ||
28 | - child.slideUp('fast'); | ||
29 | - child.parent().removeClass('active'); | 19 | + if(parent.hasClass('active')){ |
20 | + $(".parent ").removeClass("active"); | ||
21 | + $('.children').removeClass("active").slideUp('fast'); | ||
22 | + isMenuShow = false; | ||
23 | + }else{ | ||
24 | + $(this).parent(".parent ").addClass("active"); | ||
25 | + child.slideDown('fast').addClass("active"); | ||
26 | + isMenuShow = true; | ||
30 | } | 27 | } |
31 | - isMenuShow = true; | ||
32 | return false; | 28 | return false; |
33 | }); | 29 | }); |
34 | 30 | ||
35 | -$("#sidebar .nav .sub-menu a").each(function() { | 31 | +/*菜单*/ |
32 | +$(".leftpanel .nav .children a").each(function() { | ||
36 | var attr = $(this).attr('href'); | 33 | var attr = $(this).attr('href'); |
34 | + | ||
37 | if (!isMenuShow && attr == window.location.pathname + window.location.search) { | 35 | if (!isMenuShow && attr == window.location.pathname + window.location.search) { |
38 | - $(this).parents(".sub-menu").show(); | 36 | + $(this).parents(".children").show(); |
39 | $(this).parent("li").addClass("active"); | 37 | $(this).parent("li").addClass("active"); |
40 | - $(this).parents(".has-sub ").addClass("active"); | 38 | + $(this).parents(".parent").addClass("active"); |
41 | localStorage.setItem("router", attr); | 39 | localStorage.setItem("router", attr); |
42 | localStorage.getItem("router"); | 40 | localStorage.getItem("router"); |
43 | isMenuShow = true; | 41 | isMenuShow = true; |
44 | } | 42 | } |
45 | }); | 43 | }); |
46 | 44 | ||
47 | -/** | ||
48 | - * 左侧最小化 | ||
49 | - */ | ||
50 | -$(".sidebar-minify-btn").click(function(){ | ||
51 | - $("#page-container").toggleClass("page-sidebar-minified"); | ||
52 | -}); | ||
53 | -$(".dropdown").hover(function () { | ||
54 | - $(".dropdown-menu").show(); | ||
55 | -}, function () { | ||
56 | - $(".dropdown-menu").hide(); | ||
57 | -}); | 45 | +if (!isMenuShow && localStorage.getItem("router")) { |
46 | + $(".leftpanel .nav .children a").each(function() { | ||
47 | + var attr = $(this).attr('href'); | ||
58 | 48 | ||
59 | -/** | ||
60 | - * 切换店铺 | ||
61 | - */ | ||
62 | -$('.shops_id').click(function (){ | ||
63 | - var shop_id = $(this).attr('data-shopid'); | ||
64 | - $.getJSON('/index/ajaxshop?shops_id='+shop_id, function (data){ | ||
65 | - if(data.code == 200){ | ||
66 | - window.location.href="/"; | ||
67 | - }else{ | ||
68 | - alert(data.message); | 49 | + if (localStorage.getItem("router") == attr) { |
50 | + $(this).parents(".children").show(); | ||
51 | + $(this).parent("li").addClass("active"); | ||
52 | + $(this).parents(".parent").addClass("active"); | ||
53 | + isMenuShow = true; | ||
69 | } | 54 | } |
70 | - }) | 55 | + }); |
56 | +} | ||
57 | + | ||
58 | +// LocalStorage.setItem("router",); | ||
59 | +$('.panel-heading').hover(function() { | ||
60 | + $(this).find('.panel-btns').fadeIn('fast'); | ||
61 | +}, function() { | ||
62 | + $(this).find('.panel-btns').fadeOut('fast'); | ||
71 | }); | 63 | }); |
64 | + | ||
65 | +$('.panel .panel-close').click(function() { | ||
66 | + $(this).closest('.panel').fadeOut(200); | ||
67 | + return false; | ||
68 | +}); |
@@ -11,9 +11,7 @@ module.exports = { | @@ -11,9 +11,7 @@ module.exports = { | ||
11 | resolve: { | 11 | resolve: { |
12 | alias: { | 12 | alias: { |
13 | jquery: path.resolve(baseName, './jquery.js'), | 13 | jquery: path.resolve(baseName, './jquery.js'), |
14 | - vue: path.resolve(baseName, './vue.min.js'), | ||
15 | - echarts:path.resolve(baseName, './echarts.simple.min.js'), | ||
16 | - util:path.resolve(baseName, './util.js') | 14 | + vue: path.resolve(baseName, './vue.min.js') |
17 | }, | 15 | }, |
18 | extensions: ['', '.js', '.vue', '.scss'] | 16 | extensions: ['', '.js', '.vue', '.scss'] |
19 | }, | 17 | }, |
-
Please register or login to post a comment