72e555a7 by 任超

style:cookie修改

1 parent 73cd4304
1 <!DOCTYPE html 1 <!DOCTYPE html
2 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <html xmlns="http://www.w3.org/1999/xhtml">
4
4 <head> 5 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <title>网上“一窗办事”登记系统</title> 7 <title>网上“一窗办事”登记系统</title>
...@@ -39,7 +40,8 @@ ...@@ -39,7 +40,8 @@
39 </a> 40 </a>
40 </li> 41 </li>
41 <li> 42 <li>
42 <a class="cardItem" href="./staticViews/convenienceService/certificateVerification.html" title="证书核验"> 43 <a class="cardItem" href="./staticViews/convenienceService/certificateVerification.html"
44 title="证书核验">
43 <img src="./staticImages/zshy.png" alt="证书核验"> 45 <img src="./staticImages/zshy.png" alt="证书核验">
44 证书核验 46 证书核验
45 </a> 47 </a>
...@@ -369,10 +371,9 @@ ...@@ -369,10 +371,9 @@
369 </ul> 371 </ul>
370 </div> 372 </div>
371 </div> 373 </div>
372 </div> 374 </div>
373 </body> 375 </body>
374 <script type="text/javascript" src="./staticJs/down.js"></script> 376 <script type="text/javascript" src="./staticJs/down.js"></script>
375 <script type="text/javascript" src="./staticJs/common.js"></script> 377 <script type="text/javascript" src="./staticJs/common.js"></script>
376 <script type="text/javascript" src="./staticJs/pageHome.js"></script> 378 <script type="text/javascript" src="./staticJs/pageHome.js"></script>
377
378 </html>
...\ No newline at end of file ...\ No newline at end of file
379 </html>
......
...@@ -38,24 +38,44 @@ function GetQueryString(name) { ...@@ -38,24 +38,44 @@ function GetQueryString(name) {
38 var r = window.location.search.substr(1).match(reg); 38 var r = window.location.search.substr(1).match(reg);
39 if (r != null) return (r[2]); return null; 39 if (r != null) return (r[2]); return null;
40 } 40 }
41 // 存储cookie 41 // function setCookie(name, resdata, duration) {
42 function setCookie(name, resdata, duration) { 42 // var date = new Date();
43 var date = new Date(); 43 // date.setTime(date.getTime() + duration * 12 * 3600 * 1000);
44 date.setTime(date.getTime() + duration * 12 * 3600 * 1000); 44 // document.cookie = name + "=" + JSON.stringify(resdata) + ";expires=" + date.toGMTString() + "; path=/";
45 document.cookie = name + "=" + JSON.stringify(resdata) + ";expires=" + date.toGMTString() + "; path=/"; 45 // };
46 }; 46
47 // function getCookie() {
48 // var str = document.cookie;
49 // if (str == '') {
50 // return false
51 // } else {
52 // var arr = str.split(';')
53 // var arr1 = arr[0].replace(/(\s)+/g, '').split('=');
54 // return JSON.parse(arr1[1]);
55 // }
56 // };
47 57
48 //获取cookie 58 // sessionStorage
49 function getCookie() { 59 function getItem(key) {
50 var str = document.cookie; 60 let item = sessionStorage.getItem(key)
51 if (str == '') { 61 // 这点要判断是字符串还是对象
52 return false 62 let result = /^[{\[].*[}\]]$/g.test(item)
63 if (result) {
64 return JSON.parse(item)
53 } else { 65 } else {
54 var arr = str.split(';') 66 return item
55 var arr1 = arr[0].replace(/(\s)+/g, '').split('=');
56 return JSON.parse(arr1[1]);
57 } 67 }
58 }; 68 }
69 function setItem(key, value) {
70 // 这点要判断是字符串还是对象
71 if (typeof value == "string") {
72 sessionStorage.setItem(key, value)
73 } else {
74 let item = JSON.stringify(value)
75 sessionStorage.setItem(key, item)
76 }
77 }
78
59 /* 79 /*
60 * 验证手机号码 80 * 验证手机号码
61 */ 81 */
......
...@@ -7,10 +7,10 @@ layui.use('element', function () { ...@@ -7,10 +7,10 @@ layui.use('element', function () {
7 }); 7 });
8 }); 8 });
9 $(function(){ 9 $(function(){
10 $('#username').text(getCookie().username) 10 $('#username').text(getItem('myCookie').username)
11 $('#phone').text(getCookie().phone) 11 $('#phone').text(getItem('myCookie').phone)
12 $('#zjhm').text(getCookie().zjhm) 12 $('#zjhm').text(getItem('myCookie').zjhm)
13 $('#recordtime').text(getCookie().recordtime) 13 $('#recordtime').text(getItem('myCookie').recordtime)
14 $('#hellotime').text(getTimeState()) 14 $('#hellotime').text(getTimeState())
15 }) 15 })
16 function getTimeState(){ 16 function getTimeState(){
......
...@@ -30,7 +30,6 @@ $(document).on('click', '#loginButton', function () { ...@@ -30,7 +30,6 @@ $(document).on('click', '#loginButton', function () {
30 var password = $('#IDcard').val(); 30 var password = $('#IDcard').val();
31 userLoginRequest.phone = username; 31 userLoginRequest.phone = username;
32 userLoginRequest.password = password; 32 userLoginRequest.password = password;
33 delCookie();
34 clicklogin(userLoginRequest); 33 clicklogin(userLoginRequest);
35 }); 34 });
36 function fetchDataReview() { 35 function fetchDataReview() {
...@@ -40,7 +39,6 @@ function fetchDataReview() { ...@@ -40,7 +39,6 @@ function fetchDataReview() {
40 layer.confirm('此操作将进行注销', { 39 layer.confirm('此操作将进行注销', {
41 btn: ['是', '否'] //按钮 40 btn: ['是', '否'] //按钮
42 }, function () { 41 }, function () {
43 delCookie();
44 $('.loginButton').addClass('PersonLogin'); 42 $('.loginButton').addClass('PersonLogin');
45 window.open('' + localhostPaht + '/index.html', '_self'); 43 window.open('' + localhostPaht + '/index.html', '_self');
46 $('.loginAfter').hide(); 44 $('.loginAfter').hide();
...@@ -55,8 +53,8 @@ function fetchDataReview() { ...@@ -55,8 +53,8 @@ function fetchDataReview() {
55 53
56 $(function () { 54 $(function () {
57 fetchDataReview(); 55 fetchDataReview();
58 if (getCookie('myCookie').username) { 56 if (getItem('myCookie') && getItem('myCookie').username) {
59 $('.loginButton').html(getCookie('myCookie').username); 57 $('.loginButton').html(getItem('myCookie').username);
60 $('.loginButton').removeClass('PersonLogin') 58 $('.loginButton').removeClass('PersonLogin')
61 $('.personalCenter').addClass('show'); 59 $('.personalCenter').addClass('show');
62 $('.loginAfter').show(); 60 $('.loginAfter').show();
...@@ -79,9 +77,9 @@ function delCookie() { ...@@ -79,9 +77,9 @@ function delCookie() {
79 77
80 function clicklogin(data) { 78 function clicklogin(data) {
81 $.ajax({ 79 $.ajax({
82 type: "post", //提交方式 80 type: "post",
83 url: portal.api_url + "/protal/users/login",//路径 81 url: portal.api_url + "/protal/users/login",//路径
84 headers: {//***关键****** 82 headers: {
85 'Content-Type': 'application/json;charset=UTF-8', 83 'Content-Type': 'application/json;charset=UTF-8',
86 }, 84 },
87 dataType: "json", 85 dataType: "json",
...@@ -90,10 +88,10 @@ function clicklogin(data) { ...@@ -90,10 +88,10 @@ function clicklogin(data) {
90 if (result.code == 200 && result.data !== null) { 88 if (result.code == 200 && result.data !== null) {
91 $('.loginAfter').show(); 89 $('.loginAfter').show();
92 $('.isLogin').hide(); 90 $('.isLogin').hide();
93 setCookie('myCookie', result.data, 0.05); 91 setItem('myCookie', result.data)
94 $('.loginButton').removeClass('PersonLogin') 92 $('.loginButton').removeClass('PersonLogin')
95 $('.personalCenter').addClass('show'); 93 $('.personalCenter').addClass('show');
96 $('.loginButton').html(getCookie('myCookie').username); 94 $('.loginButton').html(result.data.username);
97 layer.closeAll(); 95 layer.closeAll();
98 } else if (result.code == 210) { 96 } else if (result.code == 210) {
99 layer.msg(result.message); 97 layer.msg(result.message);
...@@ -109,7 +107,7 @@ $(document).on('click', '#registerButton', function () { ...@@ -109,7 +107,7 @@ $(document).on('click', '#registerButton', function () {
109 // 点击判断是否登录 107 // 点击判断是否登录
110 function isLogin() { 108 function isLogin() {
111 let login1; 109 let login1;
112 if (getCookie('myCookie').username) { 110 if (getItem('myCookie') && getItem('myCookie').username) {
113 login1 = true; 111 login1 = true;
114 } else { 112 } else {
115 login(); 113 login();
......
...@@ -32,8 +32,8 @@ function bugSearch() { ...@@ -32,8 +32,8 @@ function bugSearch() {
32 } 32 }
33 // 初始化数据 33 // 初始化数据
34 function fetchDataReview(){ 34 function fetchDataReview(){
35 console.log(getCookie('myCookie')) 35 console.log(getItem('myCookie'))
36 let userInfo = getCookie('myCookie'); 36 let userInfo = getItem('myCookie');
37 $('#sqrxm').text(userInfo.username); 37 $('#sqrxm').text(userInfo.username);
38 if(userInfo.zjzl=='1') { 38 if(userInfo.zjzl=='1') {
39 $('#zjzl').text('身份证'); 39 $('#zjzl').text('身份证');
...@@ -172,7 +172,7 @@ function addCreatSLSQ(jsondata) { ...@@ -172,7 +172,7 @@ function addCreatSLSQ(jsondata) {
172 "bsmQl": jsondata.bsm_ql, 172 "bsmQl": jsondata.bsm_ql,
173 "ywid": business.ywid, 173 "ywid": business.ywid,
174 "businessNo": business.businessno, 174 "businessNo": business.businessno,
175 "userid": getCookie().userid 175 "userid": getItem('myCookie').userid
176 }; 176 };
177 $.ajax({ 177 $.ajax({
178 type: "post", //提交方式 178 type: "post", //提交方式
......
...@@ -25,7 +25,7 @@ $(function () { ...@@ -25,7 +25,7 @@ $(function () {
25 // 买方信息 25 // 买方信息
26 var listItem; 26 var listItem;
27 let userInfo = []; 27 let userInfo = [];
28 userInfo.push(getCookie('myCookie')); 28 userInfo.push(getItem('myCookie'));
29 if(list.sqrList && list.sqrList.length>0) { 29 if(list.sqrList && list.sqrList.length>0) {
30 for (var i = 0; i < list.sqrList.length; i++) { 30 for (var i = 0; i < list.sqrList.length; i++) {
31 listItem = '<li>' 31 listItem = '<li>'
......
...@@ -26,7 +26,7 @@ function fetchDataReview() { ...@@ -26,7 +26,7 @@ function fetchDataReview() {
26 // 买方信息 26 // 买方信息
27 var listItem; 27 var listItem;
28 let userInfo = []; 28 let userInfo = [];
29 userInfo.push(getCookie('myCookie')); 29 userInfo.push(getItem('myCookie'));
30 $('#informationList').empty(); 30 $('#informationList').empty();
31 if (list.sqrList && list.sqrList.length > 0) { 31 if (list.sqrList && list.sqrList.length > 0) {
32 for (var i = 0; i < list.sqrList.length; i++) { 32 for (var i = 0; i < list.sqrList.length; i++) {
......
...@@ -137,7 +137,7 @@ function loadSqrDetail() { ...@@ -137,7 +137,7 @@ function loadSqrDetail() {
137 } 137 }
138 138
139 } else { 139 } else {
140 let userInfo = getCookie('myCookie'); 140 let userInfo = getItem('myCookie');
141 $('#userName').text(userInfo.username); 141 $('#userName').text(userInfo.username);
142 $('#idCard').text(userInfo.zjhm); 142 $('#idCard').text(userInfo.zjhm);
143 $('#phone').text(userInfo.phone); 143 $('#phone').text(userInfo.phone);
...@@ -432,7 +432,7 @@ function _saveSQR() { ...@@ -432,7 +432,7 @@ function _saveSQR() {
432 // 申请人信息 432 // 申请人信息
433 var d = {}, sqrList = [], tobj = {} , tLists = []; 433 var d = {}, sqrList = [], tobj = {} , tLists = [];
434 var t = $('.sqrList').serializeArray(); 434 var t = $('.sqrList').serializeArray();
435 d.userid = getCookie('myCookie').userid; 435 d.userid = getItem('myCookie').userid;
436 sqrList.push(d); 436 sqrList.push(d);
437 t.forEach((item, index) => { 437 t.forEach((item, index) => {
438 console.log(item) 438 console.log(item)
......
...@@ -41,7 +41,7 @@ function _taxVerification(bsm_slsq, businessno) { ...@@ -41,7 +41,7 @@ function _taxVerification(bsm_slsq, businessno) {
41 } 41 }
42 // 买方信息 42 // 买方信息
43 let userInfo = []; 43 let userInfo = [];
44 userInfo.push(getCookie('myCookie')); 44 userInfo.push(getItem('myCookie'));
45 if(data.sqrList && data.sqrList.length>0) { 45 if(data.sqrList && data.sqrList.length>0) {
46 for (var i = 0; i < data.sqrList.length; i++) { 46 for (var i = 0; i < data.sqrList.length; i++) {
47 listItem = '<li>' 47 listItem = '<li>'
......
...@@ -56,8 +56,8 @@ $(function () { ...@@ -56,8 +56,8 @@ $(function () {
56 }); 56 });
57 }); 57 });
58 }) 58 })
59 $('#zjhm').text(getCookie().zjhm) 59 $('#zjhm').text(getItem('myCookie').zjhm)
60 $('#username').text(getCookie().username ) 60 $('#username').text(getItem('myCookie').username )
61 }) 61 })
62 62
63 // 列表操作 63 // 列表操作
...@@ -88,7 +88,7 @@ function _applyBusinessWiat(currentPage = 1) { ...@@ -88,7 +88,7 @@ function _applyBusinessWiat(currentPage = 1) {
88 url: portal.api_url + "/portal/WorkBoxService/applyBusinessWait",//路径 88 url: portal.api_url + "/portal/WorkBoxService/applyBusinessWait",//路径
89 dataType: "json", 89 dataType: "json",
90 data: { 90 data: {
91 "userId": getCookie().userid, 91 "userId": getItem('myCookie').userid,
92 "currentPage": currentPage, 92 "currentPage": currentPage,
93 "pageSize": 10 93 "pageSize": 10
94 }, 94 },
...@@ -111,7 +111,7 @@ function _applyBusinessIn(currentPage = 1) { ...@@ -111,7 +111,7 @@ function _applyBusinessIn(currentPage = 1) {
111 url: portal.api_url + "/portal/WorkBoxService/applyBusinessIn",//路径 111 url: portal.api_url + "/portal/WorkBoxService/applyBusinessIn",//路径
112 dataType: "json", 112 dataType: "json",
113 data: { 113 data: {
114 "userId": getCookie().userid, 114 "userId": getItem('myCookie').userid,
115 "currentPage": currentPage, 115 "currentPage": currentPage,
116 "pageSize": 10 116 "pageSize": 10
117 }, 117 },
...@@ -135,7 +135,7 @@ function _applyBusinessEnd(currentPage = 1) { ...@@ -135,7 +135,7 @@ function _applyBusinessEnd(currentPage = 1) {
135 url: portal.api_url + "/portal/WorkBoxService/applyBusinessEnd",//路径 135 url: portal.api_url + "/portal/WorkBoxService/applyBusinessEnd",//路径
136 dataType: "json", 136 dataType: "json",
137 data: { 137 data: {
138 "userId": getCookie().userid, 138 "userId": getItem('myCookie').userid,
139 "currentPage": currentPage, 139 "currentPage": currentPage,
140 "pageSize": 10 140 "pageSize": 10
141 }, 141 },
...@@ -159,7 +159,7 @@ function _applyBusinessRecord(currentPage = 1) { ...@@ -159,7 +159,7 @@ function _applyBusinessRecord(currentPage = 1) {
159 url: portal.api_url + "/portal/WorkBoxService/applyBusinessRecord",//路径 159 url: portal.api_url + "/portal/WorkBoxService/applyBusinessRecord",//路径
160 dataType: "json", 160 dataType: "json",
161 data: { 161 data: {
162 "userId": getCookie().userid, 162 "userId": getItem('myCookie').userid,
163 "currentPage": currentPage, 163 "currentPage": currentPage,
164 "pageSize": 10 164 "pageSize": 10
165 }, 165 },
...@@ -206,7 +206,6 @@ function paged(pageCount, curr) { ...@@ -206,7 +206,6 @@ function paged(pageCount, curr) {
206 , theme: '#0091FF' 206 , theme: '#0091FF'
207 , jump: function (obj, first) { 207 , jump: function (obj, first) {
208 if (!first) { 208 if (!first) {
209 console.log(obj.curr)
210 _applyBusinessRecord(obj.curr); 209 _applyBusinessRecord(obj.curr);
211 } 210 }
212 } 211 }
...@@ -299,5 +298,5 @@ function getTimeState(){ ...@@ -299,5 +298,5 @@ function getTimeState(){
299 298
300 var dataList = { 299 var dataList = {
301 "list": [], 300 "list": [],
302 "userid": getCookie().userid 301 "userid": getItem('myCookie').userid
303 }; 302 };
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,8 +3,8 @@ layui.use('element', function () { ...@@ -3,8 +3,8 @@ layui.use('element', function () {
3 }); 3 });
4 $(function () { 4 $(function () {
5 _initData(); 5 _initData();
6 $('#zjhm').text(getCookie().zjhm); 6 $('#zjhm').text(getItem('myCookie').zjhm);
7 $('#username').text(getCookie().username); 7 $('#username').text(getItem('myCookie').username);
8 8
9 $(document).on("click", ".business", function (e) { 9 $(document).on("click", ".business", function (e) {
10 window.open("./businessGuideDeatil.html?ywid=" + $(this).attr('ywid') + "") 10 window.open("./businessGuideDeatil.html?ywid=" + $(this).attr('ywid') + "")
...@@ -77,7 +77,7 @@ $(document).on("click", ".cancel_reservation", function (e) { ...@@ -77,7 +77,7 @@ $(document).on("click", ".cancel_reservation", function (e) {
77 layer.confirm('此操作将取消预约', { 77 layer.confirm('此操作将取消预约', {
78 btn: ['是', '否'] //按钮 78 btn: ['是', '否'] //按钮
79 }, function () { 79 }, function () {
80 _cancleAppointment($(that).attr('appointmentId'), $(that).attr('jgid'), $(that).attr('periodRulesId'), getCookie('myCookie').userid) 80 _cancleAppointment($(that).attr('appointmentId'), $(that).attr('jgid'), $(that).attr('periodRulesId'), getItem('myCookie').userid)
81 }, function () { 81 }, function () {
82 layer.msg('已取消'); 82 layer.msg('已取消');
83 }); 83 });
...@@ -140,5 +140,5 @@ function paged(pageCount, curr) { ...@@ -140,5 +140,5 @@ function paged(pageCount, curr) {
140 } 140 }
141 141
142 var dataList = { 142 var dataList = {
143 "userid": getCookie().userid 143 "userid": getItem('myCookie').userid
144 }; 144 };
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -74,7 +74,7 @@ function getAppointmentPeriodAndBusiness(bookingDate) { ...@@ -74,7 +74,7 @@ function getAppointmentPeriodAndBusiness(bookingDate) {
74 portal.api_url + "/portal/appointmentmh/getAppointmentPeriodAndBusiness", // 74 portal.api_url + "/portal/appointmentmh/getAppointmentPeriodAndBusiness", //
75 data: { 75 data: {
76 jgid: GetQueryString("jgid"), 76 jgid: GetQueryString("jgid"),
77 userid: getCookie().userid, 77 userid: getItem('myCookie').userid,
78 bookingDate: bookingDate, 78 bookingDate: bookingDate,
79 }, 79 },
80 dataType: "json", 80 dataType: "json",
...@@ -161,7 +161,7 @@ function checkAppointment() { ...@@ -161,7 +161,7 @@ function checkAppointment() {
161 portal.api_url + "/portal/appointmentmh/checkAppointment", 161 portal.api_url + "/portal/appointmentmh/checkAppointment",
162 data: { 162 data: {
163 jgid: GetQueryString("jgid"), 163 jgid: GetQueryString("jgid"),
164 userid: getCookie().userid, 164 userid: getItem('myCookie').userid,
165 }, 165 },
166 dataType: "json", 166 dataType: "json",
167 //数据,这里使用的是Json格式进行传输 167 //数据,这里使用的是Json格式进行传输
...@@ -200,9 +200,9 @@ function handle(id) { ...@@ -200,9 +200,9 @@ function handle(id) {
200 content: 200 content:
201 '<div class="infoContent">' + 201 '<div class="infoContent">' +
202 "<ul>" + 202 "<ul>" +
203 "<li><span>姓名</span>:" + getCookie().username + "</li>" + 203 "<li><span>姓名</span>:" + getItem('myCookie').username + "</li>" +
204 "<li><span>身份证号</span>:" + getCookie().zjhm + "</li>" + 204 "<li><span>身份证号</span>:" + getItem('myCookie').zjhm + "</li>" +
205 "<li><span>联系电话</span>:" + getCookie().phone + "</li>" + 205 "<li><span>联系电话</span>:" + getItem('myCookie').phone + "</li>" +
206 "</ul>" + 206 "</ul>" +
207 '<div class="listItem"><h3>大厅名称:</h3>' + 207 '<div class="listItem"><h3>大厅名称:</h3>' +
208 hallname + 208 hallname +
...@@ -226,7 +226,7 @@ function makeAppointment(id) { ...@@ -226,7 +226,7 @@ function makeAppointment(id) {
226 var paramsobj = {} 226 var paramsobj = {}
227 paramsobj.jgid = GetQueryString("jgid"); 227 paramsobj.jgid = GetQueryString("jgid");
228 paramsobj.periodRulesId = id; 228 paramsobj.periodRulesId = id;
229 paramsobj.userid = getCookie().userid; 229 paramsobj.userid = getItem('myCookie').userid;
230 $.ajax({ 230 $.ajax({
231 type: "post", //提交方式 231 type: "post", //提交方式
232 async: false, 232 async: false,
......