Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tools
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
tools
Commits
909bf717
Commit
909bf717
authored
Jan 28, 2023
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok
parent
995a2ea7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
40 deletions
+9
-40
mp-remark-v4/js/service.js
+9
-40
No files found.
mp-remark-v4/js/service.js
View file @
909bf717
...
...
@@ -132,7 +132,9 @@ function getReadingIdByBase64(url) {
show
();
}
function
getUserIdFromAvatar
(
avatar
)
{
function
getUserIdFromAvatar
(
callback
)
{
let
img
=
$
(
".container"
).
find
(
".user-portrait"
).
children
(
"img"
);
var
avatar
=
img
.
attr
(
"src"
);
var
uid
=
""
;
var
medaInfo
=
$
(
"meta[name=sn]"
);
if
(
medaInfo
.
length
>
0
)
{
...
...
@@ -162,32 +164,19 @@ function getUserIdFromAvatar(avatar) {
if
(
isNaN
(
Manager
.
userId
)
||
Manager
.
userId
<=
0
)
{
showToast
(
"暂时不能获取用户信息"
);
}
show
();
callback
();
return
;
})
}
else
{
Manager
.
userId
=
uid
;
show
();
callback
();
}
}
function
getAuth
()
{
getData
(
API
.
auth
,
{},
(
res
)
=>
{
if
(
res
.
code
.
toString
()
===
"100001"
)
{
Manager
.
isAuth
=
true
;
}
if
(
res
.
code
.
toString
()
===
"100002"
)
{
Manager
.
isAuth
=
false
;
}
});
}
function
assertIn
()
{
let
url
=
window
.
location
.
href
;
let
avatar
=
$
(
".container"
).
find
(
".user-portrait"
).
children
(
"img"
);
let
canOpen
=
false
;
if
(
url
.
indexOf
(
"article"
)
>
-
1
&&
url
.
indexOf
(
"list"
)
===
-
1
)
{
Manager
.
isReading
=
true
;
Manager
.
isUserInfo
=
true
;
getReadingIdByBase64
(
url
);
}
if
(
url
.
indexOf
(
"works"
)
>
-
1
&&
url
.
indexOf
(
"list"
)
===
-
1
)
{
...
...
@@ -195,28 +184,11 @@ function assertIn() {
Manager
.
isUserInfo
=
true
;
getWorksIdByBase64
(
url
);
}
if
(
url
.
indexOf
(
"photographyer"
)
>
-
1
)
{
Manager
.
isUserInfo
=
true
;
getUserIdFromAvatar
(
$
(
avatar
).
attr
(
"src"
));
}
if
(
!
Manager
.
isUserInfo
&&
avatar
!==
undefined
&&
$
(
"title"
).
text
().
indexOf
(
"米拍摄影社区"
)
>
-
1
)
{
Manager
.
isUserInfo
=
true
;
canOpen
=
true
;
}
else
{
canOpen
=
true
;
}
if
(
Manager
.
isUserInfo
)
{
getUserIdFromAvatar
(
$
(
avatar
).
attr
(
"src"
));
}
return
canOpen
;
}
function
openUi
()
{
let
canOpen
=
assertIn
();
Manager
.
canOpen
=
canOpen
;
if
(
canOpen
)
{
//获取基本信息并显示在编辑框
assertIn
();
getUserIdFromAvatar
(
function
()
{
getData
(
API
.
getUserInfo
,
{
uid
:
Manager
.
userId
},
data
=>
{
...
...
@@ -229,6 +201,7 @@ function openUi() {
Manager
.
user
.
nickname
=
res
.
nickname
;
showUserInfo
(
Manager
.
user
);
});
});
getData
(
API
.
getRemark
,
{
object_id
:
Manager
.
userId
,
type
:
TYPE_USER
...
...
@@ -312,10 +285,6 @@ function openUi() {
show
();
})
}
}
else
{
Manager
.
err
=
"不在个人中心或作品详情或文章详情页"
;
show
();
}
}
function
setUserPermission
(
value
)
{
...
...
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