Pārlūkot izejas kodu

'添加后端代码'

master
刘冬煜 pirms 3 gadiem
vecāks
revīzija
d1c93ce2a2
9 mainītis faili ar 28 papildinājumiem un 0 dzēšanām
  1. Binārs
      style-transform-master/.vs/style-transform-master/v16/.suo
  2. Binārs
      style-transform-master/.vs/style-transform-master/v16/Browse.VC.db
  3. Binārs
      style-transform-master/style-transform-master/bin/Microsoft.NodejsTools.WebRole.dll
  4. +1
    -0
      style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsproj.CoreCompileInputs.cache
  5. +3
    -0
      style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsproj.FileListAbsolute.txt
  6. Binārs
      style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsprojAssemblyReference.cache
  7. +12
    -0
      style-transform-master/style-transform-master/public/js/getImage.js
  8. Binārs
      style-transform-master/style-transform-master/public/tmp/16.jpg
  9. +12
    -0
      style-transform-master/style-transform-master/server.js

Binārs
style-transform-master/.vs/style-transform-master/v16/.suo Parādīt failu


Binārs
style-transform-master/.vs/style-transform-master/v16/Browse.VC.db Parādīt failu


Binārs
style-transform-master/style-transform-master/bin/Microsoft.NodejsTools.WebRole.dll Parādīt failu


+ 1
- 0
style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsproj.CoreCompileInputs.cache Parādīt failu

@ -0,0 +1 @@
a006da68cee2e5948f791e89043c9fd33dcfa03a

+ 3
- 0
style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsproj.FileListAbsolute.txt Parādīt failu

@ -0,0 +1,3 @@
C:\作业\云计算\大作业\style-transform-master\style-transform-master\style-transform-master\obj\Debug\style-transform-master.njsprojAssemblyReference.cache
C:\作业\云计算\大作业\style-transform-master\style-transform-master\style-transform-master\obj\Debug\style-transform-master.njsproj.CoreCompileInputs.cache
C:\作业\云计算\大作业\style-transform-master\style-transform-master\style-transform-master\bin\Microsoft.NodejsTools.WebRole.dll

Binārs
style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsprojAssemblyReference.cache Parādīt failu


+ 12
- 0
style-transform-master/style-transform-master/public/js/getImage.js Parādīt failu

@ -0,0 +1,12 @@
var xmlhttp = new XMLHttpRequest();
function detectImage(taskID) {
xmlhttp.open("GET","tmp\\"+taskID+".jpg",false);
xmlhttp.send();
if(xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
location.replace("./success?taskID=" + taskID);
}
}
}

Binārs
style-transform-master/style-transform-master/public/tmp/16.jpg Parādīt failu

Pirms Pēc
Platums: 512  |  Augstums: 512  |  Izmērs: 8.1 KiB

+ 12
- 0
style-transform-master/style-transform-master/server.js Parādīt failu

@ -14,7 +14,19 @@ server.use(cookieParser());
const port = process.env.PORT || 1337;
server.get('/', function (req, res) {
});
server.post('/generate', function (req, res) {
let taskID = Date.now.toString(16);
res.cookie("taskID", taskID, {maxAge: 900000, httpOnly: true});
res.end('<script src="./js/getImage.js"></script><script>setInterval(function() {detectImage("16");}, 5000);</script>');
});
server.get('/success', function (req, res) {
let taskID = req.query.taskID;
res.end();
});
server.listen(port);

Notiek ielāde…
Atcelt
Saglabāt