Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
operation-web-project
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 54e762f4
authored
Sep 16, 2020
by
jack
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
test 部署
1 parent
8e7b5f73
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
235 additions
and
78 deletions
src/common/util.js
src/http/api.js
src/http/config.js
src/layout/header-aside/components/header-user/index.vue
src/router/index copy.js
src/router/index.js
src/store/modules/d2admin/modules/user.js
src/views/main/device.vue
src/views/system/login/index.vue
src/common/util.js
View file @
54e762f
...
...
@@ -139,13 +139,21 @@ export const Util = {
getUrlParams
:
function
(
name
)
{
let
vars
=
[],
hash
;
let
oParams
=
{};
let
hashes
=
window
.
location
.
href
.
slice
(
window
.
location
.
href
.
indexOf
(
'?'
)
+
1
).
split
(
'&'
);
for
(
let
i
=
0
;
i
<
hashes
.
length
;
i
++
)
{
hash
=
hashes
[
i
].
split
(
'='
);
vars
.
push
(
hash
[
0
]);
var
s
[
hash
[
0
]]
=
hash
[
1
];
oParam
s
[
hash
[
0
]]
=
hash
[
1
];
}
return
vars
[
name
];
console
.
log
(
vars
);
if
(
name
){
return
oParams
[
name
];
}
else
{
return
oParams
;
}
},
/**
...
...
src/http/api.js
View file @
54e762f
...
...
@@ -13,7 +13,7 @@ export default function $axios(options) {
const
instance
=
axios
.
create
({
baseURL
:
config
.
baseURL
,
headers
:
{},
transformResponse
:
[
function
(
data
)
{
}]
transformResponse
:
[
function
(
data
)
{
}]
})
/**
...
...
@@ -41,9 +41,9 @@ export default function $axios(options) {
/* config.headers['X-Requested-With'] = 'XMLHttpRequest' */
/* if (typeof config.data == 'string') {
(config.headers)['Content-Type'] = 'application/json';
(config.headers)['Content-Type'] = 'application/json';
} else {
config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
} */
//config.headers['Content-Type'] = 'multipart/form-data;boundary = ' + new Date().getTime();
...
...
@@ -72,26 +72,30 @@ export default function $axios(options) {
response
=>
{
let
data
;
// Util.closeLoading();
console
.
log
(
response
)
console
.
log
(
'sdjdwww'
)
// IE9时response.data是undefined,因此需要使用response.request.responseText(Stringify后的字符串)
if
(
response
.
data
==
undefined
)
{
data
=
JSON
.
parse
(
response
.
request
.
responseText
)
}
else
{
data
=
JSON
.
parse
(
response
.
data
)
if
(
response
)
{
if
(
response
.
data
==
undefined
)
{
data
=
JSON
.
parse
(
response
.
request
.
responseText
)
}
else
{
data
=
JSON
.
parse
(
response
.
data
)
}
}
// 根据返回的code值来做不同的处理(和后端约定)
/* if (data.code && data.code != 200 && data.code != 205 && data.code != 2005) {
Util.Info({
message: data.message || data.msg || '出错了,请联系管理员'
})
Util.Info({
message: data.message || data.msg || '出错了,请联系管理员'
})
}; */
switch
(
data
.
returnCode
)
{
case
'0'
:
//请求成功,不做处理
break
;
case
103
:
case
103
:
//特殊定义,不做处理
break
;
case
204
:
...
...
@@ -113,11 +117,22 @@ export default function $axios(options) {
case
0
:
//特殊定义,不做处理
break
;
case
'-1'
:
if
(
data
.
errId
==
'-200'
){
console
.
log
(
data
);
//window.refresh();
location
.
reload
();
//window.reload()
}
else
{
Util
.
Info
({
message
:
data
.
message
+
'5555555'
||
data
.
msg
||
'出错了,请联系管理员'
})
}
break
;
default
:
Util
.
Info
({
message
:
data
.
message
||
data
.
msg
||
'出错了,请联系管理员'
message
:
data
.
message
+
'5555555'
||
data
.
msg
||
'出错了,请联系管理员'
})
break
;
}
...
...
@@ -127,6 +142,7 @@ export default function $axios(options) {
//alert(JSON.stringify(err));
// Util.closeLoading();
console
.
log
(
err
);
if
(
err
&&
err
.
response
)
{
switch
(
err
.
response
.
status
)
{
...
...
@@ -172,7 +188,7 @@ export default function $axios(options) {
}
Util
.
Info
({
message
:
err
.
message
||
'出错了,请联系管理员'
message
:
err
.
message
+
'66666'
||
'出错了,请联系管理员'
})
return
Promise
.
reject
(
err
)
// 返回接口返回的错误信息
}
...
...
src/http/config.js
View file @
54e762f
let
host
=
window
.
location
.
host
let
url
=
{
'qcwx.glsx.com.cn'
:
'https://qcwx.glsx.com.cn/admin-supplychain/'
,
'wx.glsx.com.cn'
:
'https://wx.glsx.com.cn/cow/mini/'
,
'localhost:9528'
:
'https://mng.sztyzj.com/api/'
,
'devwx.glsx.com.cn'
:
'https://qcwx.glsx.com.cn/cow/mini/'
,
'192.168.2.167:8026'
:
'https://qcwx.glsx.com.cn/cow/mini/'
function
getUrl
()
{
let
host
=
window
.
location
.
host
;
let
url
=
''
;
switch
(
host
)
{
case
'sc.glsx.com.cn'
:
url
=
'http://sc.glsx.com.cn/admin-supplychain/'
break
;
default
:
url
=
'http://qcwx.glsx.com.cn/admin-supplychain/'
break
;
}
return
url
;
}
export
default
{
...
...
@@ -17,8 +22,8 @@ export default {
// baseURL: 'https://qcwx.glsx.com.cn/cow/mini/',
// baseURL: 'https://'+ baseUrl +'/cow/mini/',
baseURL
:
'/admin-supplychain'
,
//baseURL: url[host]
,
//
baseURL: '/admin-supplychain',
baseURL
:
getUrl
,
// 请求头信息
headers
:
{
...
...
src/layout/header-aside/components/header-user/index.vue
View file @
54e762f
<
template
>
<div>
<!--
<el-dropdown
size=
"small"
class=
"d2-mr"
>
<div>
<!--
<el-dropdown
size=
"small"
class=
"d2-mr"
>
<span
class=
"btn-text"
>
{{
info
.
name
?
`你好 ${info.name
}
`
:
'未登录'
}}
<
/span
>
<
el
-
dropdown
-
menu
slot
=
"dropdown"
>
<
el
-
dropdown
-
item
@
click
.
native
=
"logOff"
>
...
...
@@ -9,14 +8,17 @@
注销
<
/el-dropdown-item
>
<
/el-dropdown-menu
>
<
/el-dropdown>--
>
<
div
v
-
popover
:
popover
-
personal
class
=
"d2-mr personal-wrap"
>
<
span
class
=
"btn-text"
>
{{
info
&&
info
.
userName
?
`${info.userName
}
`
:
'未登录'
}}
<
d2
-
el
-
icon
name
=
"caret-bottom"
/><
/span
>
<
el
-
popover
ref
=
"popover-personal"
placement
=
"bottom-end"
trigger
=
"hover"
>
<
personal
-
panel
:
user
=
"info"
><
/personal-panel
>
<
/el-popover
>
<
/el-dropdown>--
>
<
div
v
-
popover
:
popover
-
personal
class
=
"d2-mr personal-wrap"
>
<
span
class
=
"btn-text"
>
{{
user
&&
user
.
userName
?
decodeURI
(
user
.
userName
)
:
'未登录'
}}
<
d2
-
el
-
icon
name
=
"caret-bottom"
/>
<
/span
>
<
el
-
popover
ref
=
"popover-personal"
placement
=
"bottom-end"
trigger
=
"hover"
>
<
personal
-
panel
:
user
=
"info"
><
/personal-panel
>
<
/el-popover
>
<
/div
>
<
/div
>
<
/div
>
<
/template
>
<
script
>
...
...
@@ -24,18 +26,28 @@ import { mapState } from 'vuex'
import
PersonalPanel
from
'../personal-panel'
export
default
{
components
:
{
PersonalPanel
PersonalPanel
,
}
,
data
()
{
return
{
user
:{
}
}
}
,
mounted
()
{
this
.
$event
.
$on
(
'e-password-dialog'
,
res
=>
(
this
.
passVisible
=
res
))
this
.
$event
.
$on
(
'e-password-dialog'
,
(
res
)
=>
(
this
.
passVisible
=
res
))
let
user
=
sessionStorage
.
getItem
(
'merchantInfo'
)
?
JSON
.
parse
(
sessionStorage
.
getItem
(
'merchantInfo'
))
:
{
}
this
.
user
=
user
}
,
computed
:
{
...
mapState
(
'd2admin/user'
,
[
'info'
])
}
...
mapState
(
'd2admin/user'
,
[
'info'
])
,
}
,
}
<
/script
>
<
style
lang
=
"scss"
scoped
>
.
personal
-
wrap
{
transform
:
translateY
(
-
3
px
);
}
.
personal
-
wrap
{
transform
:
translateY
(
-
3
px
);
}
<
/style
>
src/router/index copy.js
0 → 100644
View file @
54e762f
import
Vue
from
'vue'
import
VueRouter
from
'vue-router'
// 进度条
import
NProgress
from
'nprogress'
import
'nprogress/nprogress.css'
import
store
from
'@/store/index'
import
util
from
'@/libs/util.js'
// 路由数据
import
routes
from
'./routes'
const
originalPush
=
VueRouter
.
prototype
.
push
// 解决连续点击路由异常问题 limin
VueRouter
.
prototype
.
push
=
function
push
(
location
)
{
return
originalPush
.
call
(
this
,
location
)
&&
originalPush
.
call
(
this
,
location
).
catch
(
err
=>
err
)
}
Vue
.
use
(
VueRouter
)
// 导出路由 在 main.js 里使用
const
router
=
new
VueRouter
({
routes
})
const
setCurrent
=
path
=>
{
return
new
Promise
(
async
resolve
=>
{
path
!==
'/login'
&&
await
store
.
dispatch
(
'd2admin/page/currentSet'
,
path
)
resolve
()
})
}
/**
* 路由拦截
* 权限验证
*/
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
const
source
=
store
.
state
.
d2admin
.
auth
.
source
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
// await store.dispatch('d2admin/page/isLoaded')
// 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
// await store.dispatch('d2admin/size/isLoaded')
// 设置当前页 下次登录 默认打开此页面
await
setCurrent
(
to
.
fullPath
)
// 进度条
NProgress
.
start
()
// 关闭搜索面板
store
.
commit
(
'd2admin/search/set'
,
false
)
//暂时屏蔽掉登录页面
//store.dispatch('d2admin/account/login',{loginName:'155454',password:'5541514',method:'fims.user.loginTem'});
store
.
dispatch
(
'd2admin/user/set'
,{})
if
(
from
.
name
===
null
&&
to
.
path
!==
'/login'
&&
!
source
)
{
// 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
await
store
.
dispatch
(
'd2admin/auth/init'
)
await
store
.
dispatch
(
'd2admin/account/load'
)
next
(
to
.
path
)
}
else
{
if
(
store
.
state
.
d2admin
.
user
.
info
)
{
// sessionstorage 用户存在继续当前路由 不存在 跳转登录 防止页面关闭还可以打开页面
next
()
}
else
{
if
(
to
.
path
===
'/login'
)
{
// 如果是登录页面路径,就直接next()
next
()
}
else
{
// 不然就跳转到登录;
await
store
.
dispatch
(
'd2admin/account/logout'
)
next
(
'/login'
)
}
}
}
})
router
.
afterEach
(
to
=>
{
// 进度条
NProgress
.
done
()
// 多页控制 打开新的页面
store
.
dispatch
(
'd2admin/page/open'
,
to
)
// 更改标题
util
.
title
(
to
.
meta
.
title
)
// 保存当前页面meta信息
store
.
dispatch
(
'd2admin/auth/setCurrentPageMeta'
,
to
.
meta
)
})
export
const
ResetRouter
=
()
=>
new
VueRouter
({
mode
:
'history'
,
base
:
'operation-web'
,
routes
})
export
default
router
src/router/index.js
View file @
54e762f
...
...
@@ -47,8 +47,8 @@ router.beforeEach(async(to, from, next) => {
// 关闭搜索面板
store
.
commit
(
'd2admin/search/set'
,
false
)
//暂时屏蔽掉登录页面
store
.
dispatch
(
'd2admin/account/login'
,{
loginName
:
'155454'
,
password
:
'5541514'
,
method
:
'fims.user.loginTem'
});
//
store.dispatch('d2admin/account/login',{loginName:'155454',password:'5541514',method:'fims.user.loginTem'});
store
.
dispatch
(
'd2admin/user/set'
,{})
if
(
from
.
name
===
null
&&
to
.
path
!==
'/login'
&&
!
source
)
{
// 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
await
store
.
dispatch
(
'd2admin/auth/init'
)
await
store
.
dispatch
(
'd2admin/account/load'
)
...
...
src/store/modules/d2admin/modules/user.js
View file @
54e762f
...
...
@@ -23,6 +23,7 @@ export default {
// value: info,
// user: true
// }, { root: true })
console
.
log
(
info
);
sessionStorage
.
setItem
(
SESSION_NAME
,
escape
(
JSON
.
stringify
(
info
)))
// end
resolve
()
...
...
src/views/main/device.vue
View file @
54e762f
...
...
@@ -178,6 +178,7 @@ export default {
mounted
:
function
()
{
this
.
getList
()
this
.
getDeviceList
()
},
methods
:
{
/**
...
...
@@ -190,6 +191,7 @@ export default {
_this
.
tableLoading
=
true
GETLISTDEVICECODE
(
oParams
).
then
((
res
)
=>
{
_this
.
tableLoading
=
false
console
.
log
(
res
);
if
(
res
.
returnCode
==
0
)
{
const
{
data
}
=
res
const
{
total
,
list
}
=
data
...
...
src/views/system/login/index.vue
View file @
54e762f
<
template
>
<div
class=
"page-login"
>
<
dialog-reg
:isVisible=
"registerDialogVisible"
/
>
<
!--
<dialog-reg
:isVisible=
"registerDialogVisible"
/>
--
>
<div
class=
"page-login--layer page-login--layer-area"
>
<ul
class=
"circles"
>
<li
v-for=
"n in 10"
:key=
"n"
></li>
...
...
@@ -47,19 +47,24 @@
v-model=
"formLogin.password"
v-on:keyup
.
native
.
13=
"submit"
clearable
maxlength=
"12"
maxlength=
"12"
placeholder=
"请输入密码"
>
<d2-el-icon
slot=
"prepend"
name=
"key"
/>
<d2-el-icon
slot=
"prepend"
name=
"key"
/>
</el-input>
</el-form-item>
<el-form-item
class=
"form-action"
>
<el-button
@
click=
"submit"
type=
"primary"
:loading=
"$store.state.d2admin.loading.value"
class=
"button-login"
>
登录
</el-button>
<el-button
@
click=
"submit"
type=
"primary"
:loading=
"$store.state.d2admin.loading.value"
class=
"button-login"
>
登录
</el-button>
<!--
<el-button
@
click
.
prevent=
"registerDialogVisible = true"
plain
class=
"button-reg"
>
注册
</el-button>
-->
>
注册
</el-button>
-->
</el-form-item>
</div>
</el-form>
...
...
@@ -79,6 +84,9 @@
</div>
</div>
</div>
<!-- 遮罩层 开始 -->
<div
class=
"blk"
v-loading=
"loading"
></div>
</div>
</
template
>
...
...
@@ -87,9 +95,7 @@ import dayjs from 'dayjs'
import
{
mapActions
}
from
'vuex'
import
{
LOGIN_TYPE
}
from
'@/common/constants'
export
default
{
components
:
{
},
components
:
{},
data
()
{
return
{
registerDialogVisible
:
false
,
...
...
@@ -97,30 +103,36 @@ export default {
time
:
dayjs
().
format
(
'HH:mm:ss'
),
// 表单
formLogin
:
{
loginName
:
''
,
password
:
''
,
loginType
:
LOGIN_TYPE
loginName
:
'
555555
'
,
password
:
'
666666
'
,
loginType
:
LOGIN_TYPE
,
},
// 表单校验
rules
:
Object
.
freeze
({
loginName
:
[{
required
:
true
,
message
:
'请输入用户名'
,
trigger
:
'submit'
}
loginName
:
[
{
required
:
true
,
message
:
'请输入用户名'
,
trigger
:
'submit'
,
},
],
password
:
[{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'submit'
}
]
})
password
:
[
{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'submit'
,
},
],
}),
loading
:
true
,
}
},
created
()
{},
mounted
()
{
this
.
timeInterval
=
setInterval
(()
=>
this
.
refreshTime
(),
1000
)
this
.
$event
.
$on
(
'e-reg-dialog'
,
res
=>
(
this
.
registerDialogVisible
=
res
))
this
.
$event
.
$on
(
'e-reg-dialog'
,
(
res
)
=>
(
this
.
registerDialogVisible
=
res
))
let
_this
=
this
_this
.
submit
()
},
beforeDestroy
()
{
clearInterval
(
this
.
timeInterval
)
...
...
@@ -128,7 +140,7 @@ export default {
methods
:
{
...
mapActions
({
login
:
'd2admin/account/login'
,
current
:
'd2admin/page/currentGet'
current
:
'd2admin/page/currentGet'
,
}),
// ...mapActions('d2admin/account', ['login']),
refreshTime
()
{
...
...
@@ -137,11 +149,16 @@ export default {
// 提交登录信息
submit
()
{
// console.log(navigator.userAgent.toLocaleLowerCase())
this
.
$refs
.
loginForm
.
validate
(
valid
=>
{
let
Util
=
this
.
$Util
let
op
=
Util
.
getUrlParams
()
console
.
log
(
op
)
let
mm
=
encodeURI
(
JSON
.
stringify
(
op
),
"utf-8"
)
sessionStorage
.
setItem
(
'merchantInfo'
,
JSON
.
stringify
(
op
))
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
// const { browser, os } = this.$store.state.d2admin.ua.data
const
_p
=
{
...
this
.
formLogin
...
this
.
formLogin
,
// deviceCode: `${os.name}${os.version}-${browser.name}${browser.version}`
}
//this.$router.replace(this.$route.query.redirect || _current)
...
...
@@ -150,16 +167,16 @@ export default {
// 具体需要传递的数据请自行修改代码
this
.
login
(
_p
)
// .then(() => this.$store.dispatch('d2admin/auth/init'))
.
then
(
async
_
=>
{
.
then
(
async
(
_
)
=>
{
const
_current
=
await
this
.
current
()
console
.
log
(
this
.
current
)
;
console
.
log
(
this
.
current
)
console
.
log
(
this
.
$route
.
query
.
redirect
)
this
.
$router
.
replace
(
this
.
$route
.
query
.
redirect
||
_current
)
})
}
})
}
}
}
,
}
,
}
</
script
>
...
...
@@ -319,13 +336,13 @@ export default {
.img-top
{
width
:
364px
;
height
:
24px
;
background
:
url(
"./image/bz.png"
)
;
background
:
url(
'./image/bz.png'
)
;
margin-bottom
:
53px
;
transform
:
translateX
(
-20px
);
}
.img-bg
{
//
box-sizing
:
border-box
;
background
:
url(
"./image/bg.png"
)
;
background
:
url(
'./image/bg.png'
)
;
width
:
322px
;
height
:
276px
;
//
border
:
6px
solid
#F4F9FF
;
...
...
@@ -444,4 +461,13 @@ export default {
}
}
}
.blk
{
position
:
fixed
;
background
:
#fff
;
top
:
0px
;
right
:
0px
;
bottom
:
0px
;
left
:
0px
;
z-index
:
999
;
}
</
style
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment