Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
haoban-3
Commits
74f33746
Commit
74f33746
authored
May 07, 2022
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 切换商户
parent
22731cf5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
155 additions
and
154 deletions
+155
-154
api.js
src/api/api.js
+4
-14
expired-dialog.vue
src/components/company/expired-dialog.vue
+12
-28
change-store.vue
src/components/layout/components/change-store.vue
+106
-76
index.vue
src/components/layout/index.vue
+4
-3
main-menu.vue
src/components/layout/main-menu.vue
+1
-1
main.js
src/main.js
+28
-32
No files found.
src/api/api.js
View file @
74f33746
...
...
@@ -7,17 +7,14 @@
* @LastEditTime: 2020-11-16 09:28:03
*/
import
Vue
from
'vue'
;
import
VueAxios
from
'vue-axios'
;
import
axios
from
'axios'
;
// import axios from 'axios';
import
qs
from
'qs'
;
import
{
Message
}
from
'element-ui'
;
/**
* 获取好办 企业 id
*/
if
(
!!
localStorage
.
getItem
(
'userInfos'
))
{
let
haobanSign
=
JSON
.
parse
(
localStorage
.
getItem
(
'userInfos'
)).
enterpriseId
;
haobanSign
?
(
Vue
.
axios
.
defaults
.
headers
.
common
[
'enterpriseId'
]
=
haobanSign
)
:
''
;
}
Vue
.
use
(
VueAxios
,
axios
);
Vue
.
axios
.
defaults
.
withCredentials
=
true
;
// cookie访问
Vue
.
axios
.
defaults
.
timeout
=
500000
;
let
local
=
window
.
location
.
origin
;
...
...
@@ -52,13 +49,6 @@ Vue.axios.interceptors.request.use(
cancel
});
});
/**
* 获取好办 企业 id
*/
if
(
!!
sessionStorage
.
getItem
(
'userInfoBrandId'
))
{
let
haobanSign
=
sessionStorage
.
getItem
(
'userInfoBrandId'
);
haobanSign
?
(
config
.
headers
.
enterpriseId
=
haobanSign
)
:
''
;
}
return
config
;
},
err
=>
{
...
...
src/components/company/expired-dialog.vue
View file @
74f33746
...
...
@@ -11,48 +11,32 @@
import expiredDialog from '@/components/company/expired-dialog.vue';
-->
<
template
>
<el-dialog
class=
"hide-close-dialog"
style=
"top:88px;"
title=
"到期提醒"
:visible
.
sync=
"dialogVisible"
width=
"600px"
:before-close=
"handle
Close"
>
<el-dialog
title=
"到期提醒"
:visible=
"visible"
width=
"600px"
@
close=
"on
Close"
>
<div
class=
"m-b-20 text-center"
>
<div
class=
"img-tip-wrap text-center"
><img
src=
"../../assets/expired.png"
alt=
""
/></div>
<div
class=
"font-18 color-303133 m-t-17 text-center"
>
使用已到期
</div>
<div
class=
"font-14 color-909399 m-t-10 line-h-20 text-center"
><span
class=
"font-14 color-909399"
>
服务已到使用期限,请升级
</span><span
class=
"color-2f54eb cursor-pointer"
@
click=
"toDamo"
>
达摩服务
</span></div>
<div
class=
"img-tip-wrap"
><img
src=
"../../assets/expired.png"
alt=
""
/></div>
<div
class=
"font-18 color-303133 m-t-17"
>
使用已到期
</div>
<div
class=
"font-14 color-909399 m-t-10 line-h-20"
>
<span
class=
"font-14 color-909399"
>
服务已到使用期限,请升级
</span>
<span
class=
"color-2f54eb cursor-pointer"
@
click=
"toDamo"
>
达摩服务
</span>
</div>
</div>
</el-dialog>
</
template
>
<
script
>
export
default
{
props
:
{
syncData
:
{
type
:
Object
,
default
()
{
return
{
syncStatus
:
'0'
};
}
visible
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
dialogVisible
:
true
};
},
methods
:
{
handleClose
(
done
)
{
const
that
=
this
;
that
.
dialogVisible
=
true
;
onClose
()
{
this
.
$emit
(
'update:visible'
,
false
);
},
toDamo
()
{
window
.
open
(
'https://www.demogic.com/'
);
}
},
mounted
()
{
const
that
=
this
;
that
.
$nextTick
(()
=>
{
document
.
querySelector
(
'.v-modal'
).
style
.
top
=
'88px'
;
});
},
beforeDestroy
()
{
document
.
querySelector
(
'.v-modal'
).
style
.
top
=
'0px'
;
}
};
</
script
>
...
...
src/components/layout/components/change-store.vue
View file @
74f33746
<
template
>
<div>
<el-
popover
placement=
"top"
popper-class=
"change-store-popper"
trigger=
"hover
"
>
<span
class=
"change-store-btn"
slot=
"reference"
>
<div
v-if=
"storeList.length > 0"
>
<el-
dropdown
@
command=
"onChangeStore
"
>
<span
class=
"change-store-btn"
>
切换商户
<i
class=
"iconfont-hb3 iconxiajiantou change-store-icon"
></i>
</span>
<
div
class=
"change-store
"
>
<
div
class=
"store-item active
d"
>
<
el-dropdown-menu
slot=
"dropdown"
class=
"change-store-popper
"
>
<
el-dropdown-item
v-for=
"el in storeList"
:key=
"el.enterpriseId"
:class=
"['store-item',
{ actived: el.enterpriseId == activedStoreId }]" :command="el.enterpriseI
d">
<div>
<div
class=
"store-name"
>
金华达摩
</div>
<div
class=
"default-store-tag"
>
默认商户
</div>
<div
class=
"store-name"
>
{{
el
.
brandName
}}
</div>
<div
class=
"default-store-tag"
v-if=
"el.enterpriseId == defaultStoreId"
>
默认商户
</div>
</div>
<i
class=
"el-icon-check checked"
></i>
</div>
<div
class=
"store-item"
>
<div
class=
"store-name"
>
达摩演示
</div>
</div>
<div
class=
"store-item"
>
<div
class=
"store-name"
>
金华达摩代理商
</div>
</div>
<div
class=
"change-default-store"
>
<i
class=
"el-icon-check checked"
v-if=
"el.enterpriseId == activedStoreId"
></i>
</el-dropdown-item>
<el-dropdown-item
class=
"change-default-store"
>
<div
class=
"change-default-store-btn"
@
click=
"onShow"
>
更改默认商户
</div>
</
div
>
</
div
>
</el-
popover
>
</
el-dropdown-item
>
</
el-dropdown-menu
>
</el-
dropdown
>
<el-dialog
:visible
.
sync=
"changeStore.show"
title=
"更改默认商户"
width=
"600px"
@
closed=
"onClosed"
>
<div
class=
"change-store-title"
>
选择商户
</div>
<el-select
class=
"change-store-selector"
v-show=
"changeStore.selectShow"
>
<el-option
label=
"金华达摩"
value=
"1
"
></el-option>
<el-select
class=
"change-store-selector"
v-show=
"changeStore.selectShow"
v-model=
"changeStore.storeId"
>
<el-option
v-for=
"el in storeList"
:key=
"el.enterpriseId"
:label=
"el.brandName"
:value=
"el.enterpriseId
"
></el-option>
</el-select>
<div
slot=
"footer"
>
<el-button
@
click=
"changeStore.show = false"
>
取消
</el-button>
<el-button
type=
"primary"
:loading=
"changeStore.loading"
@
click=
"onSave"
>
确定
</el-button>
</div>
</el-dialog>
<expired-dialog
:visible
.
sync=
"isExpired"
></expired-dialog>
</div>
</
template
>
<
script
>
// 获取商户列表
// 切换商户
// 更改默认商户
// 更改默认商户 接口联调
import
{
getRequest
}
from
'@/api/api.js'
;
import
errorMsg
from
'@/common/js/error.js'
;
import
expiredDialog
from
'@/components/company/expired-dialog.vue'
;
export
default
{
name
:
'ChangeStore'
,
components
:
{
expiredDialog
},
data
()
{
return
{
changeStore
:
{
show
:
false
,
selectShow
:
false
,
loading
:
false
}
loading
:
false
,
storeId
:
''
},
storeList
:
[],
activedStoreId
:
''
,
defaultStoreId
:
''
,
isExpired
:
false
};
},
created
()
{
// this.getStoreList();
this
.
getStoreList
();
this
.
activedStoreId
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'userInfos'
)
||
'{}'
).
enterpriseId
;
},
methods
:
{
getStoreList
()
{
getRequest
(
'/haoban-manage3-web/login-wx-enterprise-list'
,
{
requestProject
:
'haoban-manage-web'
}).
then
(
resp
=>
{
console
.
log
(
resp
);
getRequest
(
'/haoban-manage3-web/wx-enterprise-list'
,
{}).
then
(
resp
=>
{
const
{
errorCode
,
result
}
=
resp
.
data
||
{};
if
(
errorCode
!=
1
)
{
errorMsg
.
errorMsg
(
resp
.
data
);
return
;
}
this
.
storeList
=
Array
.
isArray
(
result
)
?
result
:
[];
});
},
onChangeStore
(
enterpriseId
)
{
if
(
enterpriseId
==
this
.
activedStoreId
)
return
;
this
.
$emit
(
'changeStore'
,
true
);
getRequest
(
'/haoban-manage3-web/enterprise-is-over'
,
{
enterpriseId
})
.
then
(
res
=>
{
let
resData
=
res
.
data
;
const
{
errorCode
,
result
}
=
res
.
data
||
{};
if
(
errorCode
!=
1
)
{
errorMsg
.
errorMsg
(
resData
);
return
;
}
this
.
isExpired
=
result
;
if
(
!
result
)
{
location
.
reload
();
}
})
.
finally
(()
=>
{
setTimeout
(()
=>
{
this
.
$emit
(
'changeStore'
,
false
);
},
500
);
});
},
onShow
()
{
this
.
changeStore
.
show
=
true
;
this
.
changeStore
.
selectShow
=
false
;
...
...
@@ -120,59 +149,60 @@ export default {
padding
:
7px
0
0
!important
;
width
:
200px
;
box-sizing
:
border-box
;
.change-store
{
.store-item
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
7px
12px
;
+
.store-item
{
margin-top
:
4px
;
}
&
.actived
{
background
:
#f7f8fa
;
.store-name
{
color
:
#2f54eb
;
font-weight
:
500
;
}
.checked
{
color
:
#2f54eb
;
}
}
&
:hover
{
background
:
#f7f8fa
;
}
.el-dropdown-menu__item
{
padding
:
0
;
}
.store-item
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
7px
12px
;
+
.store-item
{
margin-top
:
4px
;
}
&
.actived
{
background
:
#f7f8fa
;
.store-name
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#303133
;
line-height
:
20px
;
}
.default-store-tag
{
height
:
18px
;
text-align
:
center
;
line-height
:
18px
;
font-size
:
12px
;
font-weight
:
400
;
color
:
#2f54eb
;
background
:
#dee3fc
;
border-radius
:
2px
;
font-weight
:
500
;
}
}
.change-default-store
{
margin-top
:
7px
;
padding
:
0
12px
;
.change-default-store-btn
{
width
:
100%
;
height
:
36px
;
font-size
:
14px
;
font-weight
:
400
;
.checked
{
color
:
#2f54eb
;
line-height
:
36px
;
border-top
:
1px
solid
#e4e7ed
;
cursor
:
pointer
;
}
}
&
:hover
{
background
:
#f7f8fa
;
}
.store-name
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#303133
;
line-height
:
20px
;
}
.default-store-tag
{
height
:
18px
;
text-align
:
center
;
line-height
:
18px
;
font-size
:
12px
;
font-weight
:
400
;
color
:
#2f54eb
;
background
:
#dee3fc
;
border-radius
:
2px
;
}
}
.change-default-store
{
margin-top
:
7px
;
padding
:
0
12px
;
.change-default-store-btn
{
width
:
100%
;
height
:
36px
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#2f54eb
;
line-height
:
36px
;
border-top
:
1px
solid
#e4e7ed
;
cursor
:
pointer
;
}
}
}
</
style
>
src/components/layout/index.vue
View file @
74f33746
<
template
>
<div
class=
"hb-layout"
>
<main-menu
:menu-list=
"menuList"
:actived-code=
"activedMenu.length > 0 ? activedMenu[0].menuCode : ''"
></main-menu>
<div
class=
"hb-layout"
v-loading=
"changeStoreLoading"
>
<main-menu
:menu-list=
"menuList"
:actived-code=
"activedMenu.length > 0 ? activedMenu[0].menuCode : ''"
@
changeStore=
"loading => (changeStoreLoading = loading)"
></main-menu>
<aside-menu
:menu-list=
"activedMenu.length > 0 ? activedMenu[0].childList : []"
:actived-code=
"activedMenu.length > 2 ? activedMenu[2].menuCode : ''"
></aside-menu>
<div
class=
"hb-layout-content"
>
<bread-menu
v-if=
"activedMenu.length > 3"
:menu-list=
"activedMenu.slice(2)"
></bread-menu>
...
...
@@ -33,7 +33,8 @@ export default {
// 侧边栏菜单数据
asideMenu
:
[],
// 激活的菜单
activedMenu
:
[]
activedMenu
:
[],
changeStoreLoading
:
false
};
},
created
()
{
...
...
src/components/layout/main-menu.vue
View file @
74f33746
...
...
@@ -7,7 +7,7 @@
</div>
</div>
<div
class=
"main-info"
>
<change-store></change-store>
<change-store
@
changeStore=
"loading => $emit('changeStore', loading)"
></change-store>
<div>
消息中心
</div>
<dm-user-info
user-name-class=
"hb-layout-user-name"
></dm-user-info>
</div>
...
...
src/main.js
View file @
74f33746
...
...
@@ -11,8 +11,6 @@ import promise from 'es6-promise';
promise
.
polyfill
();
import
App
from
'./App'
;
import
router
from
'./router'
;
import
VueAxios
from
'vue-axios'
;
import
axios
from
'axios'
;
import
store
from
'./store/store'
;
/* eslint-disable */
import
'../static/css/index.less'
;
...
...
@@ -32,6 +30,8 @@ import vueOfficeUploadImage from '@gic-test/vue-office-upload-image';
import
htmlToPdf
from
'@/components/utils/htmlToPdf'
;
import
VueAMap
from
'vue-amap'
;
import
Vue
from
'vue'
;
import
{
postRequest
}
from
'@/api/api.js'
;
import
errorMsg
from
'@/common/js/error.js'
;
// Vue.use(contentmenu);
Vue
.
use
(
VueAMap
);
...
...
@@ -50,9 +50,7 @@ Vue.use(vueOfficeHeader);
Vue
.
config
.
productionTip
=
false
;
// Vue.use(ElementUI, { size: 'large' });
Vue
.
use
(
VueAxios
,
axios
);
Vue
.
axios
.
defaults
.
withCredentials
=
true
;
// cookie访问
// 全局注册过滤器
Object
.
keys
(
filters
).
forEach
(
key
=>
{
Vue
.
filter
(
key
,
filters
[
key
]);
...
...
@@ -76,27 +74,6 @@ router.beforeEach((to, from, next) => {
}
else
{
baseUrl
=
host
;
}
if
(
!
localStorage
.
getItem
(
'userInfos'
))
{
// axios
// .get(`${baseUrl}/haoban-manage-web/emp/get-user-info`, {})
// .then(res => {
// let resData = res.data;
// if (resData.errorCode == 1) {
// localStorage.setItem('userInfos', JSON.stringify(resData.result));
// return;
// }
// // Message.error({
// // duration: 1000,
// // message: resData.message
// // })
// })
// .catch(function(error) {
// Message.error({
// duration: 1000,
// message: error.message
// });
// });
}
if
(
to
.
path
==
'/'
)
{
next
({
path
:
'/login'
});
}
else
{
...
...
@@ -203,11 +180,30 @@ Vue.prototype.$getButtonLimit = (code) => {
return
!!
Vue
.
prototype
.
$buttonCode
[
code
];
}
/* eslint-disable no-new */
new
Vue
({
el
:
'#app'
,
router
,
store
,
components
:
{
App
},
template
:
'<App/>'
postRequest
(
'/haoban-manage3-web/get-login-info'
,
{}).
then
(
resp
=>
{
// 正常情况下enterpriseId必定存在
// superManagerFlag 1:超管
// 如果enterpriseId不存在,而且不是超管,弹窗报错并且不进入页面
const
{
errorCode
,
result
}
=
resp
.
data
||
{};
if
(
errorCode
!=
1
)
{
errorMsg
.
errorMsg
(
resp
.
data
);
return
;
}
sessionStorage
.
setItem
(
'userInfos'
,
JSON
.
stringify
(
result
));
/**
* 获取好办 企业 id
*/
if
(
!!
sessionStorage
.
getItem
(
'userInfos'
))
{
let
haobanSign
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'userInfos'
)).
enterpriseId
;
haobanSign
?
(
Vue
.
axios
.
defaults
.
headers
.
common
[
'enterpriseId'
]
=
haobanSign
)
:
''
;
}
}).
finally
(()
=>
{
/* eslint-disable no-new */
new
Vue
({
el
:
'#app'
,
router
,
store
,
components
:
{
App
},
template
:
'<App/>'
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment