Compare commits

...

2 Commits

Author SHA1 Message Date
石超 26472c467e Merge branch 'main' of http://123.132.248.154:10000/shichao/PanDuWeb 2024-07-17 17:29:02 +08:00
石超 3fbe4e3f0a '用户登录' 2024-07-17 17:28:54 +08:00
5 changed files with 67 additions and 61 deletions

View File

@ -142,11 +142,11 @@ $(function () {
$('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1); $('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1);
//显示loading提示 //显示loading提示
// var loading = layer.load(); var loading = layer.load();
//
// $('.J_mainContent iframe:visible').load(function () { $('.J_mainContent iframe:visible').load(function () {
// //iframe加载完成后隐藏loading提示 //iframe加载完成后隐藏loading提示
// layer.close(loading); layer.close(loading);
// }); // });
// 添加选项卡 // 添加选项卡
$('.J_menuTabs .page-tabs-content').append(str); $('.J_menuTabs .page-tabs-content').append(str);

View File

@ -26,7 +26,7 @@
<span><img alt="image" class="img-circle" src="img/profile_small.jpg" /></span> <span><img alt="image" class="img-circle" src="img/profile_small.jpg" /></span>
<a data-toggle="dropdown" class="dropdown-toggle" href="#"> <a data-toggle="dropdown" class="dropdown-toggle" href="#">
<span class="clear"> <span class="clear">
<span class="block m-t-xs"><strong class="font-bold">Beaut-ruoyi</strong></span> <span class="block m-t-xs"><strong class="font-bold" id="user-name"></strong></span>
<span class="text-muted text-xs block">审核员<b class="caret"></b></span> <span class="text-muted text-xs block">审核员<b class="caret"></b></span>
</span> </span>
</a> </a>
@ -211,9 +211,12 @@
<!-- 自定义js --> <!-- 自定义js -->
<script src="js/hplus.js?v=4.1.0"></script> <script src="js/hplus.js?v=4.1.0"></script>
<script type="text/javascript" src="js/contabs.js"></script> <script type="text/javascript" src="js/contabs.js"></script>
<script src="js/request.js"></script>
<!-- 第三方插件 --> <!-- 第三方插件 -->
<script src="js/plugins/pace/pace.min.js"></script> <script src="js/plugins/pace/pace.min.js"></script>
<script src="js/plugins/toastr/toastr.min.js"></script>
<!-- 业务js --> <!-- 业务js -->
<script src="js/index.js"></script> <script src="js/index.js"></script>
</body> </body>

View File

@ -1,4 +1,27 @@
$(document).ready(function () { $(window).ready(function () {
let token = localStorage.getItem("token");
let url_path = window.location.pathname;
if (url_path.indexOf("login.html") == -1) {
if (token) {
getAjaxRequst("/api/Check/GetUserProfile",{}, function (res) {
console.log('res::: ', res);
console.log('res::: ', res);
if (res.code != 200) {
toastr.error("登录信息已过期,请重新登录");
localStorage.removeItem("token");
window.location.href = "login.html";
} else {
localStorage.setItem("account", res.result.account);
localStorage.setItem("name", res.result.name);
$("#user-name").text(res.result.name);
}
});
} else {
toastr.error("请先登录");
window.location.href = "login.html";
}
}
// Place JavaScript code here. // Place JavaScript code here.
$("#login-btn").click(function () { $("#login-btn").click(function () {
let account = $("#login-mobile").val(); let account = $("#login-mobile").val();

View File

@ -1,40 +1,37 @@
const baseURL = "http://192.168.10.102:9008";
const baseURL = 'http://192.168.10.102:9008';
const timeout = 3000; const timeout = 3000;
// requet ajax // requet ajax
function request (url, method, data={}, contentType, back){ function request(url, method, data = {}, contentType, back) {
console.log('data::: ', data); console.log("data::: ", data);
$.ajax({ $.ajax({
url: baseURL+url, url: baseURL + url,
type: method, type: method,
cache: false, cache: false,
timeout: timeout, timeout: timeout,
contentType: contentType, contentType: contentType,
headers:{ headers: {
"X-Token":localStorage.getItem('token') || '' "X-Token": localStorage.getItem("token") || "",
}, },
dataType: "json", dataType: "json",
data:JSON.stringify(data), data: JSON.stringify(data),
success: function(res){ success: function (res) {
console.log(res) return typeof back == "function" && back(res);
return typeof back == "function" && back(res); },
}, error: function (error) {
error: function(error) { console.log(error);
console.log(error) return typeof back == "function" && back(null);
return typeof back == "function" && back(null); },
} });
}); }
}; function getAjaxRequst(url, _data, callBack) {
function getAjaxRequst (url, _data, callBack) { request(url, "GET", _data, "application/json", function (res) {
request(url, "GET", _data, "application/json", function(res) { return typeof callBack == "function" && callBack(res);
return typeof callBack == "function" && callBack(res) });
}) }
}; function postAjaxRequst(url, _data, callBack) {
function postAjaxRequst (url, _data, callBack) { request(url, "POST", _data, "application/json", function (res) {
request(url, "POST", _data, "application/json", function(res) { return typeof callBack == "function" && callBack(res);
return typeof callBack == "function" && callBack(res) });
}) }
};

View File

@ -1,6 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -93,22 +92,6 @@
<input type="checkbox" value="张三">张三</label> <input type="checkbox" value="张三">张三</label>
<label class="checkbox-inline i-checks"> <label class="checkbox-inline i-checks">
<input type="checkbox" value="李四">李四</label> <input type="checkbox" value="李四">李四</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="王五">王五</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="赵六">赵六</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="钱七">钱七</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="张三">张三</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="李四">李四</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="王五">王五</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="赵六">赵六</label>
<label class="checkbox-inline i-checks">
<input type="checkbox" value="钱七">钱七</label>
</div> </div>
</div> </div>
<div class="modal-footer" style="border-top: 0px;position: absolute;bottom: 10px; right:10px;"> <div class="modal-footer" style="border-top: 0px;position: absolute;bottom: 10px; right:10px;">