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
57a0ea77
Commit
57a0ea77
authored
Nov 25, 2022
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok
parent
6a06bcb2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
26 deletions
+65
-26
mp-fastquote/background.js
+5
-1
mp-fastquote/css/main.css
+15
-2
mp-fastquote/html/index.html
+10
-6
mp-fastquote/js/main.js
+35
-17
No files found.
mp-fastquote/background.js
View file @
57a0ea77
chrome
.
runtime
.
onMessage
.
addListener
(
chrome
.
runtime
.
onMessage
.
addListener
(
function
(
request
,
sender
,
sendResponse
)
{
function
(
request
,
sender
,
sendResponse
)
{
switch
(
request
.
action
)
{
switch
(
request
[
'action'
]
)
{
case
"getAccessToken"
:
case
"getAccessToken"
:
chrome
.
cookies
.
get
({
chrome
.
cookies
.
get
({
url
:
"https://www.mepai.me/"
,
url
:
"https://www.mepai.me/"
,
name
:
"auth"
name
:
"auth"
},
function
(
cookies
)
{
},
function
(
cookies
)
{
if
(
cookies
==
null
)
{
sendResponse
({
value
:
null
});
return
true
;
}
var
token
=
{
value
:
cookies
.
value
};
var
token
=
{
value
:
cookies
.
value
};
sendResponse
(
token
);
sendResponse
(
token
);
return
true
;
return
true
;
...
...
mp-fastquote/css/main.css
View file @
57a0ea77
...
@@ -98,4 +98,18 @@
...
@@ -98,4 +98,18 @@
border-radius
:
4px
;
border-radius
:
4px
;
color
:
#ffffff
;
color
:
#ffffff
;
margin-bottom
:
20px
;
margin-bottom
:
20px
;
}
}
\ No newline at end of file
#__extend_fast_quote
#__extend_fastquote_container
#_____mp_fastquote
.error
{
color
:
#ff2e2e
;
font-size
:
20px
;
padding-left
:
10px
;
margin-bottom
:
20px
;
}
#__extend_fast_quote
#__extend_fastquote_container
#_____mp_fastquote
.success
{
color
:
#004cbc
;
font-size
:
20px
;
padding-left
:
10px
;
}
mp-fastquote/html/index.html
View file @
57a0ea77
...
@@ -4,10 +4,13 @@
...
@@ -4,10 +4,13 @@
<img
id=
"closeBtn"
style=
"width: 48px;height: 48px;"
>
<img
id=
"closeBtn"
style=
"width: 48px;height: 48px;"
>
</div>
</div>
<div
class=
"col-12"
style=
"padding-left: 10px"
>
<div
class=
"error"
id=
"error"
></div>
<h4>
添加有米使用记录
</h4>
<div
class=
"success"
id=
"success"
></div>
<h6>
(有中台的请在中台标注)
</h6>
<div
id=
"main-ui"
>
</div>
<div
class=
"col-12"
style=
"padding-left: 10px"
>
<h4>
添加有米使用记录
</h4>
<h6>
(有中台的请在中台标注)
</h6>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label>
作品id
</label>
<label>
作品id
</label>
<input
type=
"text"
disabled
id=
"worksId"
class=
"form-control"
/>
<input
type=
"text"
disabled
id=
"worksId"
class=
"form-control"
/>
...
@@ -34,7 +37,8 @@
...
@@ -34,7 +37,8 @@
<label>
过审情况
</label>
<label>
过审情况
</label>
<select
class=
"form-control"
id=
"status"
>
<select
class=
"form-control"
id=
"status"
>
<option
value=
"0"
>
待审核
</option>
<option
value=
"0"
>
待审核
</option>
<option
value=
"1"
selected
>
已审核
</option>
<option
value=
"1"
selected
>
已过审
</option>
<option
value=
"2"
selected
>
被拒绝
</option>
</select>
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
@@ -46,5 +50,5 @@
...
@@ -46,5 +50,5 @@
<div
class=
"buttons form-group"
>
<div
class=
"buttons form-group"
>
<button
class=
"btn btn-primary"
id=
"send"
>
提交
</button>
<button
class=
"btn btn-primary"
id=
"send"
>
提交
</button>
</div>
</div>
</div>
</div>
</div>
mp-fastquote/js/main.js
View file @
57a0ea77
...
@@ -74,17 +74,31 @@ function base64Decode(data) {
...
@@ -74,17 +74,31 @@ function base64Decode(data) {
}
}
var
getChannels
=
(
callback
)
=>
{
var
getChannels
=
(
callback
)
=>
{
this
.
getData
(
host
+
"/works/channels"
,
{},
(
res
)
=>
{
getData
(
host
+
"/works/channels"
,
{},
(
res
)
=>
{
callback
(
res
.
data
);
callback
(
res
.
data
);
});
});
}
}
var
getManagers
=
(
callback
)
=>
{
var
getManagers
=
(
callback
)
=>
{
this
.
getData
(
host
+
"/user/managers"
,
{},
(
res
)
=>
{
getData
(
host
+
"/user/managers"
,
{},
(
res
)
=>
{
callback
(
res
.
data
);
callback
(
res
.
data
);
})
})
}
}
var
addError
=
function
(
error
,
showUi
)
{
var
errorDom
=
document
.
getElementById
(
"error"
);
errorDom
.
innerHTML
=
error
;
if
(
!
showUi
)
{
var
main
=
document
.
getElementById
(
"main-ui"
);
main
.
style
.
display
=
"none"
;
}
}
var
addSuccess
=
function
(
msg
)
{
var
okDom
=
document
.
getElementById
(
"success"
);
okDom
.
innerHTML
=
msg
;
}
var
getData
=
(
api
,
data
,
callback
)
=>
{
var
getData
=
(
api
,
data
,
callback
)
=>
{
api
=
api
+
"?"
;
api
=
api
+
"?"
;
for
(
var
i
in
data
)
{
for
(
var
i
in
data
)
{
...
@@ -100,7 +114,7 @@ var getData = (api, data, callback) => {
...
@@ -100,7 +114,7 @@ var getData = (api, data, callback) => {
return
res
.
json
()
return
res
.
json
()
}).
then
(
final
=>
{
}).
then
(
final
=>
{
if
(
final
.
code
.
toString
()
===
"100002"
)
{
if
(
final
.
code
.
toString
()
===
"100002"
)
{
alert
(
"请先登录,若登录账号没有操作权限,请向公司管理员申请"
);
addError
(
"请先登录,若登录账号没有操作权限,请向公司管理员申请"
,
false
);
return
return
}
}
return
callback
(
final
);
return
callback
(
final
);
...
@@ -109,7 +123,6 @@ var getData = (api, data, callback) => {
...
@@ -109,7 +123,6 @@ var getData = (api, data, callback) => {
});
});
}
}
var
sendData
=
(
api
,
data
,
callback
)
=>
{
var
sendData
=
(
api
,
data
,
callback
)
=>
{
var
$this
=
this
;
var
header
=
{
var
header
=
{
method
:
"POST"
,
method
:
"POST"
,
headers
:
{
headers
:
{
...
@@ -121,14 +134,12 @@ var sendData = (api, data, callback) => {
...
@@ -121,14 +134,12 @@ var sendData = (api, data, callback) => {
body
:
JSON
.
stringify
(
data
)
body
:
JSON
.
stringify
(
data
)
};
};
fetch
(
api
,
header
).
then
(
res
=>
{
fetch
(
api
,
header
).
then
(
res
=>
{
$this
.
loading
=
false
;
return
res
.
json
()
return
res
.
json
()
}).
then
(
final
=>
{
}).
then
(
final
=>
{
return
callback
(
final
);
return
callback
(
final
);
})
})
}
}
var
getToday
=
()
=>
{
var
getToday
=
()
=>
{
var
dt
=
new
Date
();
var
dt
=
new
Date
();
var
month
=
dt
.
getMonth
()
+
1
;
var
month
=
dt
.
getMonth
()
+
1
;
...
@@ -146,6 +157,10 @@ window.onload = function () {
...
@@ -146,6 +157,10 @@ window.onload = function () {
chrome
.
runtime
.
sendMessage
({
chrome
.
runtime
.
sendMessage
({
"action"
:
"getAccessToken"
"action"
:
"getAccessToken"
},
function
(
response
)
{
},
function
(
response
)
{
if
(
response
==
null
||
response
.
value
==
null
)
{
addError
(
"请先登录,若登录账号没有操作权限,请向公司管理员申请"
,
false
);
return
}
ACCESS_TOKEN
=
response
.
value
;
ACCESS_TOKEN
=
response
.
value
;
goNext
()
goNext
()
});
});
...
@@ -171,7 +186,6 @@ function removeLoading() {
...
@@ -171,7 +186,6 @@ function removeLoading() {
}
}
function
goNext
()
{
function
goNext
()
{
var
todayInput
=
document
.
getElementById
(
"today"
);
var
todayInput
=
document
.
getElementById
(
"today"
);
var
channelDom
=
document
.
getElementById
(
"channelId"
);
var
channelDom
=
document
.
getElementById
(
"channelId"
);
var
adminDom
=
document
.
getElementById
(
"admins"
);
var
adminDom
=
document
.
getElementById
(
"admins"
);
...
@@ -186,6 +200,11 @@ function goNext() {
...
@@ -186,6 +200,11 @@ function goNext() {
d
.
value
=
channels
[
i
].
channel_id
;
d
.
value
=
channels
[
i
].
channel_id
;
d
.
innerHTML
=
channels
[
i
].
name
;
d
.
innerHTML
=
channels
[
i
].
name
;
channelDom
.
appendChild
(
d
)
channelDom
.
appendChild
(
d
)
getCookie
(
"default_channel"
,
function
(
res
)
{
if
(
res
.
value
!=
null
)
{
channelDom
.
value
=
res
.
value
;
}
});
}
}
});
});
getManagers
(
function
(
res
)
{
getManagers
(
function
(
res
)
{
...
@@ -195,16 +214,15 @@ function goNext() {
...
@@ -195,16 +214,15 @@ function goNext() {
d
.
value
=
managers
[
i
].
id
;
d
.
value
=
managers
[
i
].
id
;
d
.
innerHTML
=
managers
[
i
].
name
;
d
.
innerHTML
=
managers
[
i
].
name
;
adminDom
.
appendChild
(
d
)
adminDom
.
appendChild
(
d
)
getCookie
(
"default_admin"
,
function
(
res
)
{
if
(
res
.
value
!=
null
)
{
adminDom
.
value
=
res
.
value
;
}
});
}
}
});
});
todayInput
.
value
=
getToday
();
todayInput
.
value
=
getToday
();
worksDom
.
value
=
getWorksId
();
worksDom
.
value
=
getWorksId
();
getCookie
(
"default_admin"
,
function
(
res
)
{
if
(
res
.
value
!=
null
)
{
adminDom
.
value
=
res
.
value
;
}
});
getCookie
(
"default_status"
,
function
(
res
)
{
getCookie
(
"default_status"
,
function
(
res
)
{
if
(
res
.
value
!=
null
)
{
if
(
res
.
value
!=
null
)
{
statusDom
.
value
=
res
.
value
;
statusDom
.
value
=
res
.
value
;
...
@@ -223,20 +241,20 @@ function goNext() {
...
@@ -223,20 +241,20 @@ function goNext() {
"works_id"
:
worksDom
.
value
,
"works_id"
:
worksDom
.
value
,
};
};
if
(
isNaN
(
postData
[
'works_id'
])
||
postData
[
'works_id'
]
<=
0
)
{
if
(
isNaN
(
postData
[
'works_id'
])
||
postData
[
'works_id'
]
<=
0
)
{
a
lert
(
"作品id解析失败"
)
a
ddError
(
"作品id解析失败"
,
true
)
return
return
}
}
sendData
(
host
+
"/works/pushrecord"
,
postData
,
(
res
)
=>
{
sendData
(
host
+
"/works/pushrecord"
,
postData
,
(
res
)
=>
{
if
(
res
.
code
.
toString
()
!==
"100001"
)
{
if
(
res
.
code
.
toString
()
!==
"100001"
)
{
a
lert
(
res
.
messag
e
);
a
ddError
(
res
.
message
,
tru
e
);
removeLoading
();
removeLoading
();
return
;
return
;
}
}
a
lert
(
"操作成功
"
);
a
ddSuccess
(
"操作成功,已添加到后台推送记录
"
);
removeLoading
();
removeLoading
();
setCookie
(
"default_admin"
,
postData
[
'admin_id'
]);
setCookie
(
"default_admin"
,
postData
[
'admin_id'
]);
setCookie
(
"default_status"
,
postData
[
'status'
]);
setCookie
(
"default_status"
,
postData
[
'status'
]);
prop
(
);
setCookie
(
"default_channel"
,
postData
[
'channel_id'
]
);
return
;
return
;
});
});
}
}
...
...
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