-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 顯示沒課資訊 fix: 真的更改視窗size才更改顯示模式 於手機話下滑時會觸發onresize事件 改為與一開始size不同時才會更改顯示模式 refactor: use nginclude and directive 使用此兩個引入navbar的html refactor: Remove updatedata refactor: Remove getUser style: 增加暗黑模式
- Loading branch information
1 parent
a6d28a7
commit 22b8b02
Showing
2 changed files
with
53 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,55 @@ | ||
var TSApp = angular.module("TSApp" ,[]); | ||
TSApp.controller("TSCtrl" , function($scope , TSService) | ||
{ | ||
var TSApp = angular.module("TSApp", ["commonApp"]); | ||
TSApp.controller("TSCtrl", function ($scope, TSService , commonService) { | ||
$scope.DataList = []; | ||
$scope.DataListLen = 0; | ||
$scope.Currentuser = ""; | ||
TSService.Get_User($scope); | ||
$scope.Query = function (day) | ||
{ | ||
TSService.Get_User($scope); | ||
TSService.Get_data($scope.Currentuser , day).then((function(res) | ||
{ | ||
if (res.data == "NoData" || res.data == null || res.data == undefined) | ||
{ | ||
commonService.user.getStuInfo().then(function (res) { | ||
$scope.Currentuser = res.data; | ||
}) | ||
$scope.Query = function (day) { | ||
//TSService.Get_User($scope); | ||
TSService.Get_data($scope.Currentuser, day).then((function (res) { | ||
if (res.data == "NoData" || res.data == null || res.data == undefined) { | ||
$scope.DataList = []; | ||
$scope.Get_New_Data(); | ||
$scope.DataListLen = 0; | ||
} | ||
else | ||
{ | ||
else { | ||
var Today_Schedule = res.data; | ||
$scope.DataList = Today_Schedule; | ||
$scope.DataListLen = $scope.DataList.length; | ||
console.log($scope.DataListLen); | ||
} | ||
})); | ||
} | ||
|
||
$scope.Get_New_Data = function() | ||
{ | ||
TSService.Get_New_Data($scope.Currentuser).then(function (res) | ||
{ | ||
if (res.data == "success") | ||
{ | ||
alert ("更新成功"); | ||
window.location.href = "/Today_Schedule"; | ||
} | ||
else | ||
{ | ||
alert("更新失敗"); | ||
} | ||
}); | ||
} | ||
|
||
$scope.phpupdate = function() | ||
{ | ||
var pwd = $scope.password; | ||
TSService.gotophp($scope.Currentuser , pwd).then(function (res) | ||
{ | ||
if (res.data =="error pwd") | ||
{ | ||
alert("密碼錯誤"); | ||
} | ||
else if (res.data.user !=null) | ||
{ | ||
document.location.href="https://www.chinstudio.icu/1081New_Project/Stu_Login.php?stu_id=" + res.data.user + "&stu_pwd=" + res.data.pwd; | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
TSApp.service("TSService" , function($http) | ||
{ | ||
TSApp.service("TSService", function ($http) { | ||
return ( | ||
{ | ||
Get_User : Get_User , | ||
Get_data : Get_data , | ||
Get_New_Data : Get_New_Data , | ||
gotophp : gotophp | ||
Get_data: Get_data | ||
} | ||
); | ||
function Get_User($scope) | ||
{ | ||
var request =$http.get('/api/user').then(function(result) | ||
{ | ||
$scope.Currentuser = result.data; | ||
}); | ||
return request.then(handleSuccess , handleError); | ||
} | ||
function Get_data(Querykey , weekday) | ||
{ | ||
function Get_data(Querykey, weekday) { | ||
var request = $http( | ||
{ | ||
method: "GET", | ||
url : "api/Today_Schedule", | ||
params : | ||
url: "api/Today_Schedule", | ||
params: | ||
{ | ||
User : Querykey, | ||
day : weekday | ||
User: Querykey, | ||
day: weekday | ||
} | ||
} | ||
); | ||
return (request.then(handleSuccess , handleError)); | ||
} | ||
function Get_New_Data(user) | ||
{ | ||
var request = $http( | ||
{ | ||
method: "POST" , | ||
url : "/api/log", | ||
params: | ||
{ | ||
User : user, | ||
method : "getnewdata" | ||
} | ||
} | ||
); | ||
return (request.then(handleSuccess , handleError)); | ||
} | ||
function gotophp(user ,pwd) | ||
{ | ||
var request = $http( | ||
{ | ||
method: "POST" , | ||
url : "/api/log", | ||
params: | ||
{ | ||
User : user, | ||
userpwd : pwd, | ||
method : "updatedata" | ||
} | ||
} | ||
); | ||
return (request.then(handleSuccess , handleError)); | ||
return (request.then(handleSuccess, handleError)); | ||
} | ||
function handleSuccess(response) { | ||
return (response); | ||
} | ||
function handleError(response) { | ||
|
||
function handleError(response) { | ||
return (response); | ||
} | ||
}); | ||
|
||
|