Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
htoooth
6 years ago
Commit
43c2ce24227d253ae8af02c245d8b616e9df8300
1 parent
50146ea3
master
...
develop
feature/6.9.12_share
feature/accessLog
feature/add-alipay-register-count-to-grafana
feature/add-dingtalk-alert-for-alipay
feature/alipay_newimage
feature/alipayfix
feature/fixupload
feature/hideUfo
feature/invite2
feature/new
feature/share-link
hotfix/alipay-username-emoji
hotfix/api
hotfix/fixinput
hotfix/replace-activity-img
hotfix/sigin
hotfix/ssrApiReport
release/1.0.2
add request login
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
46 additions
and
18 deletions
apps/app.vue
apps/common/create-api-client.js
apps/entry-client.js
apps/entry-server.js
apps/pages/single/license/form/form.vue
apps/store/index.js
apps/store/license/form/actions.js
apps/store/yoho/index.js
apps/store/yoho/types.js
package.json
yarn.lock
apps/app.vue
View file @
43c2ce2
...
...
@@ -14,6 +14,20 @@ export default {
name: 'App',
computed: {
...mapState(['yoho'])
},
mounted() {
if (this.yoho.context.needLogin) {
this.$yoho.ready(() => {
this.$sdk.goLogin();
});
}
},
watch: {
'yoho.context.needLogin': function(newVal) {
if (newVal) {
this.$sdk.goLogin();
}
},
}
};
</script>
...
...
apps/common/create-api-client.js
View file @
43c2ce2
...
...
@@ -14,25 +14,31 @@ const errHandle = (error) => {
message
:
'服务器开小差了~'
});
};
const
request
=
(
options
)
=>
{
return
axios
(
options
).
then
(
res
=>
res
.
data
,
errHandle
);
const
request
=
(
options
,
store
)
=>
{
return
axios
(
options
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
401
)
{
store
&&
store
.
commit
(
'needLogin'
,
{
needLogin
:
true
});
return
Promise
.
reject
(
res
.
data
);
}
return
res
.
data
;
},
errHandle
);
};
export
const
createApi
=
()
=>
{
export
const
createApi
=
(
context
,
store
)
=>
{
return
{
get
(
url
,
params
,
options
)
{
return
request
(
Object
.
assign
({
url
,
params
,
method
:
'get'
,
}),
options
);
}),
options
,
store
);
},
post
(
url
,
data
,
options
)
{
return
request
(
Object
.
assign
({
url
,
data
,
method
:
'post'
,
},
options
));
},
options
)
,
store
);
}
};
};
...
...
apps/entry-client.js
View file @
43c2ce2
...
...
@@ -8,6 +8,7 @@ import {Style, Toast, Dialog, DatePicker} from 'cube-ui'; //eslint-disable-line
import
{
get
}
from
'lodash'
;
import
Lazy
from
'vue-lazyload'
;
import
yoho
from
'common/yoho'
;
import
sdk
from
'yoho-activity-sdk'
;
import
'statics/scss/common.scss'
;
import
'statics/font/iconfont.css'
;
import
'statics/font/ufofont.css'
;
...
...
@@ -25,6 +26,7 @@ if (window.__INITIAL_STATE__) {
window
.
_router
=
get
(
store
,
'state.yoho.context.route'
);
Vue
.
prop
(
'yoho'
,
yoho
);
Vue
.
prop
(
'sdk'
,
sdk
);
Vue
.
use
(
Toast
);
Vue
.
use
(
DatePicker
);
Vue
.
use
(
Dialog
);
...
...
apps/entry-server.js
View file @
43c2ce2
...
...
@@ -40,6 +40,10 @@ export default context => {
return
resolve
(
app
);
}).
catch
(
e
=>
{
reportError
(
e
);
if
(
e
.
code
===
401
)
{
store
.
commit
(
'needLogin'
,
{
needLogin
:
true
});
}
context
.
state
=
store
.
state
;
return
resolve
(
app
);
});
});
...
...
apps/pages/single/license/form/form.vue
View file @
43c2ce2
...
...
@@ -131,7 +131,7 @@ export default {
methods: {
async onSubmit() {
if (!this.$yoho.isLogin()) {
this.$
yoho
.goLogin();
this.$
sdk
.goLogin();
return;
}
...
...
apps/store/index.js
View file @
43c2ce2
...
...
@@ -18,7 +18,7 @@ export function createStore(context) {
strict
:
process
.
env
.
NODE_ENV
!==
'production'
});
const
api
=
createApi
(
context
);
const
api
=
createApi
(
context
,
store
);
store
.
$api
=
api
;
store
.
$context
=
context
;
...
...
apps/store/license/form/actions.js
View file @
43c2ce2
...
...
@@ -39,16 +39,7 @@ export default {
},
async
licenseStatus
({
commit
})
{
let
result
=
{};
try
{
result
=
await
this
.
$api
.
get
(
'/api/ufo/license/status'
);
}
catch
(
e
)
{
if
(
e
.
code
===
401
)
{
commit
(
Types
.
FETCH_UFO_NEED_LOGIN
,
true
);
return
;
}
}
let
result
=
await
this
.
$api
.
get
(
'/api/ufo/license/status'
);
if
(
result
.
code
===
200
)
{
commit
(
Types
.
FETCH_UFO_STATUS_SUCCESS
,
{
status
:
result
.
data
,
message
:
result
.
message
});
...
...
apps/store/yoho/index.js
View file @
43c2ce2
...
...
@@ -15,7 +15,8 @@ export default function() {
fs
:
true
,
},
route
:
''
,
path
:
''
path
:
''
,
needLogin
:
false
},
historys
:
[],
visible
:
true
,
...
...
@@ -51,6 +52,9 @@ export default function() {
});
state
.
direction
=
'forword'
;
}
},
[
Types
.
NEED_LOGIN
](
state
,
{
needLogin
})
{
state
.
context
.
needLogin
=
needLogin
;
}
},
actions
:
{
...
...
apps/store/yoho/types.js
View file @
43c2ce2
...
...
@@ -4,3 +4,4 @@ export const ROUTE_CHANGE = 'ROUTE_CHANGE';
export
const
PAGE_INIT_VISIBLE
=
'PAGE_INIT_VISIBLE'
;
export
const
YOHO_PAGE_VISIBLE
=
'YOHO_PAGE_VISIBLE'
;
export
const
REPORT_YAS
=
'REPORT_YAS'
;
export
const
NEED_LOGIN
=
'needLogin'
;
...
...
package.json
View file @
43c2ce2
...
...
@@ -62,6 +62,7 @@
"vue-virtual-scroll-list"
:
"^1.2.8"
,
"vuex"
:
"^3.0.1"
,
"winston"
:
"^3.1.0"
,
"yoho-activity-sdk"
:
"^1.1.3"
,
"yoho-cookie"
:
"^1.2.0"
,
"yoho-express-session"
:
"^2.0.0"
,
"yoho-md5"
:
"^2.1.0"
,
...
...
yarn.lock
View file @
43c2ce2
...
...
@@ -9357,6 +9357,11 @@ yargs@^7.0.0:
y18n "^3.2.1"
yargs-parser "^5.0.0"
yoho-activity-sdk@^1.1.3:
version "1.1.3"
resolved "http://npm.yohops.com/yoho-activity-sdk/-/yoho-activity-sdk-1.1.3.tgz#14a8a952e1fd68cc7c167f1e6336d67262d55ba6"
integrity sha512-XbE6K/Ioid0Uguyf+2zdmFPgVALB9Ozsei1JLpp7MZhZNlVALQ0sER/L5sOQdZqIrtBmTiplur7u2pgaXl374g==
yoho-cookie@^1.2.0:
version "1.2.0"
resolved "http://npm.yohops.com/yoho-cookie/-/yoho-cookie-1.2.0.tgz#e8600ff0fcf316e8a9f88d32cd263396dc7e5f22"
...
...
Please
register
or
login
to post a comment