From dc8bdf0992ef105e48b3ab19b1763c64e0a86d77 Mon Sep 17 00:00:00 2001 From: txy <421111298@qq.com> Date: Mon, 15 Jul 2019 10:42:16 +0800 Subject: [PATCH] '接口添加token' --- showPhotos/examine.html | 158 +++++++++----------------------------------------------------------------------------------------------------------------------------------------------------- showPhotos/js/page/common.js | 3 +++ showPhotos/js/page/examine.js | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ showPhotos/js/page/index.js | 6 ++++++ showPhotos/js/page/signup.js | 3 +++ showPhotos/js/page/user.js | 6 ++++++ 6 files changed, 186 insertions(+), 149 deletions(-) create mode 100644 showPhotos/js/page/examine.js diff --git a/showPhotos/examine.html b/showPhotos/examine.html index 34bc87f..543932f 100644 --- a/showPhotos/examine.html +++ b/showPhotos/examine.html @@ -16,7 +16,13 @@ <script type="text/javascript" src="https://space-api.check.icaremgt.com/ACTIVITY/gitlab-static?url=http://gitlab.icaremgt.com/tanxinyu/h5_activity/raw/master/showPhotos/js/examine/bootstrap.js"></script> <script type="text/javascript" src="https://space-api.check.icaremgt.com/ACTIVITY/gitlab-static?url=http://gitlab.icaremgt.com/tanxinyu/h5_activity/raw/master/showPhotos/js/examine/lightbox.min.js"></script> <script type="text/javascript" src="https://space-api.check.icaremgt.com/ACTIVITY/gitlab-static?url=http://gitlab.icaremgt.com/tanxinyu/h5_activity/raw/master/showPhotos/js/dialog.js"></script> - <script type="text/javascript" src="https://space-api.check.icaremgt.com/ACTIVITY/gitlab-static?url=http://gitlab.icaremgt.com/tanxinyu/h5_activity/raw/master/showPhotos/js/page/common.js"></script> + <!-- <script type="text/javascript" th:inline="javascript"> + var currentTime = [[${currentTime}]]; + var rules = JSON.parse([[${rules}]]); + var data = JSON.parse([[${data}]]); + var user = JSON.parse([[${user}]]); + var jsSdk = JSON.parse([[${jsSdk}]]); + </script> --> </head> <body> @@ -53,153 +59,7 @@ </div> </div> </div> - <script> - $(document).ready(function(){ - // 获取个人信息 - userTabInfo(); - // 获取活动名称 - getActivityTitle(); - }); - - function pass(){ - var activityCode = getQueryString('activityCode'); - var params = { - activityCode: activityCode, - reviewStatus: 1, - userId: getQueryString('UserId') - } - - $.ajax({ - type: 'PUT', - url: baseUrl + '/ACTIVITY/sz/review-user/' + activityCode, - data: params, - success: function(data) { - if(data.status == 200) { - $.dialog({ - type: "alert", - contentHtml: "<p style='text-align:center;'>操作成功</p>", - onClosed: function(){ - window.location.reload() - } - }); - } - }, - error: function() { - $.dialog({ - type : 'tips', - autoClose : 3000, - infoText : '请求超时,请尝试刷新页面!' - }); - } - }); - } - - function refuse(){ - var activityCode = getQueryString('activityCode'); - var params = { - activityCode: activityCode, - reviewStatus: 0, - userId: getQueryString('UserId') - } - - $.ajax({ - type: 'PUT', - url: baseUrl + '/ACTIVITY/sz/review-user/' + activityCode, - data: params, - success: function(data) { - if(data.status == 200) { - $.dialog({ - type: "alert", - contentHtml: "<p style='text-align:center;'>操作成功</p>", - onClosed: function(){ - window.location.reload() - } - }); - } - }, - error: function() { - $.dialog({ - type : 'tips', - autoClose : 3000, - infoText : '请求超时,请尝试刷新页面!' - }); - } - }); - } - - // 个人信息展示 - function userTabInfo() { - var id = getQueryString('UserId'); - var activityCode = getQueryString('activityCode'); - var params = { - id: id - } - $.ajax({ - type: 'GET', - url: baseUrl + '/ACTIVITY/sz/search/' + activityCode, - data: params, - success: function(data) { - if(data.status == 200) { - var userInfoObj = data.result && data.result.records && data.result.records[0]; - $("#userName").text(userInfoObj.name); - $("#voteCount").text(userInfoObj.voteNum); - $("#userPhone").text(userInfoObj.userPhone); - $("#orgName").text(userInfoObj.orgName); - $("#enounce").text(userInfoObj.declaration); - - $("#userImage img").attr("src", userInfoObj.imageUrl); - $("#userImage").attr("href", userInfoObj.imageUrl).show(); - - var reviewStatus = userInfoObj.reviewStatus; - // reviewStatus 0-待审核 1-审核通过 2-审核未通过 - if(reviewStatus == 1||reviewStatus == 2){ - $(".edit-btn").addClass("hide"); - if(reviewStatus == 1){ - $(".status-msg").addClass("text-success").html("已通过"); - }else if(reviewStatus == 2){ - $(".status-msg").addClass("text-danger").html("已驳回"); - } - }else if(reviewStatus == 0){ - $(".status-msg").hide(); - $(".edit-btn").removeClass("hide"); - } - } - }, - error: function() { - $.dialog({ - type : 'tips', - autoClose : 3000, - infoText : '请求超时,请尝试刷新页面!' - }); - } - }) - } - - // 获取活动名称 - function getActivityTitle() { - var activityCode = getQueryString('activityCode'); - var params = { - activityCode: activityCode - } - $.ajax({ - type: 'GET', - url: baseUrl + '/ACTIVITY/'+ activityCode +'/settings', - data: params, - success: function(data) { - if(data.status == 200) { - var title = data.result.settings.szText.h5Title; - $('#examineTitle').text(title); - } - }, - error: function() { - $.dialog({ - type : 'tips', - autoClose : 3000, - infoText : '请求超时,请尝试刷新页面!' - }); - } - }) - } - </script> </body> + <script type="text/javascript" src="https://space-api.check.icaremgt.com/ACTIVITY/gitlab-static?url=http://gitlab.icaremgt.com/tanxinyu/h5_activity/raw/master/showPhotos/js/page/common.js"></script> + <script type="text/javascript" src="https://space-api.check.icaremgt.com/ACTIVITY/gitlab-static?url=http://gitlab.icaremgt.com/tanxinyu/h5_activity/raw/master/showPhotos/js/page/examine.js"></script> </html> diff --git a/showPhotos/js/page/common.js b/showPhotos/js/page/common.js index ae17bbd..91afa19 100644 --- a/showPhotos/js/page/common.js +++ b/showPhotos/js/page/common.js @@ -202,6 +202,9 @@ function getActivityTitle() { type: 'GET', url: baseUrl + '/ACTIVITY/'+ activityCode +'/settings', data: params, + headers: { + 'x-token': getToken() + }, success: function(data) { if(data.status == 200) { var title = data.result.settings.szText.h5Title; diff --git a/showPhotos/js/page/examine.js b/showPhotos/js/page/examine.js new file mode 100644 index 0000000..35da5f8 --- /dev/null +++ b/showPhotos/js/page/examine.js @@ -0,0 +1,159 @@ +$(document).ready(function(){ + setToken(); + // 获取个人信息 + userTabInfo(); + // 获取活动名称 + getActivityTitle(); +}); + +function pass(){ + var activityCode = getQueryString('activityCode'); + var params = { + activityCode: activityCode, + reviewStatus: 1, + userId: getQueryString('UserId') + } + + $.ajax({ + type: 'PUT', + url: baseUrl + '/ACTIVITY/sz/review-user/' + activityCode, + headers: { + 'x-token': getToken() + }, + data: params, + success: function(data) { + if(data.status == 200) { + $.dialog({ + type: "alert", + contentHtml: "<p style='text-align:center;'>操作成功</p>", + onClosed: function(){ + window.location.reload() + } + }); + } + }, + error: function() { + $.dialog({ + type : 'tips', + autoClose : 3000, + infoText : '请求超时,请尝试刷新页面!' + }); + } + }); +} + +function refuse(){ + var activityCode = getQueryString('activityCode'); + var params = { + activityCode: activityCode, + reviewStatus: 0, + userId: getQueryString('UserId') + } + + $.ajax({ + type: 'PUT', + url: baseUrl + '/ACTIVITY/sz/review-user/' + activityCode, + data: params, + headers: { + 'x-token': getToken() + }, + success: function(data) { + if(data.status == 200) { + $.dialog({ + type: "alert", + contentHtml: "<p style='text-align:center;'>操作成功</p>", + onClosed: function(){ + window.location.reload() + } + }); + } + }, + error: function() { + $.dialog({ + type : 'tips', + autoClose : 3000, + infoText : '请求超时,请尝试刷新页面!' + }); + } + }); +} + +// 个人信息展示 +function userTabInfo() { + var id = getQueryString('UserId'); + var activityCode = getQueryString('activityCode'); + var params = { + id: id + } + $.ajax({ + type: 'GET', + url: baseUrl + '/ACTIVITY/sz/search/' + activityCode, + data: params, + headers: { + 'x-token': getToken() + }, + success: function(data) { + if(data.status == 200) { + var userInfoObj = data.result && data.result.records && data.result.records[0]; + $("#userName").text(userInfoObj.name); + $("#voteCount").text(userInfoObj.voteNum); + $("#userPhone").text(userInfoObj.userPhone); + $("#orgName").text(userInfoObj.orgName); + $("#enounce").text(userInfoObj.declaration); + + $("#userImage img").attr("src", userInfoObj.imageUrl); + $("#userImage").attr("href", userInfoObj.imageUrl).show(); + + var reviewStatus = userInfoObj.reviewStatus; + // reviewStatus 0-待审核 1-审核通过 2-审核未通过 + if(reviewStatus == 1||reviewStatus == 2){ + $(".edit-btn").addClass("hide"); + if(reviewStatus == 1){ + $(".status-msg").addClass("text-success").html("已通过"); + }else if(reviewStatus == 2){ + $(".status-msg").addClass("text-danger").html("已驳回"); + } + }else if(reviewStatus == 0){ + $(".status-msg").hide(); + $(".edit-btn").removeClass("hide"); + } + } + }, + error: function() { + $.dialog({ + type : 'tips', + autoClose : 3000, + infoText : '请求超时,请尝试刷新页面!' + }); + } + }) +} + +// 获取活动名称 +function getActivityTitle() { + var activityCode = getQueryString('activityCode'); + var params = { + activityCode: activityCode + } + $.ajax({ + type: 'GET', + url: baseUrl + '/ACTIVITY/'+ activityCode +'/settings', + data: params, + headers: { + 'x-token': getToken() + }, + success: function(data) { + if(data.status == 200) { + var title = data.result.settings.szText.h5Title; + $('#examineTitle').text(title); + } + }, + error: function() { + $.dialog({ + type : 'tips', + autoClose : 3000, + infoText : '请求超时,请尝试刷新页面!' + }); + } + }) +} \ No newline at end of file diff --git a/showPhotos/js/page/index.js b/showPhotos/js/page/index.js index a0a65d9..bd45893 100644 --- a/showPhotos/js/page/index.js +++ b/showPhotos/js/page/index.js @@ -189,6 +189,9 @@ function getAjaxListSearch(type,page,callback) { type: 'GET', url: baseUrl + '/ACTIVITY/sz/search/' + activityCode, data: params, + headers: { + 'x-token': getToken() + }, success: function(data) { if(data.status == 200) { if(type == 'player' || type == 'search') { @@ -324,6 +327,9 @@ function voteClickFn(){ type: 'PUT', url: baseUrl + '/ACTIVITY/sz/vote/' + activityCode, data: params, + headers: { + 'x-token': getToken() + }, success: function(data) { if(data.status == 200) { $('#act1185354268270 span').text(data.result.voteNumDay) diff --git a/showPhotos/js/page/signup.js b/showPhotos/js/page/signup.js index 7576c98..fe76a83 100644 --- a/showPhotos/js/page/signup.js +++ b/showPhotos/js/page/signup.js @@ -260,6 +260,9 @@ function getOrgNameFn() { $.ajax({ type: 'GET', url: baseUrl + '/ORG/hospital/community/hospitalInfo/' + orgId, + headers: { + 'x-token': getToken() + }, success: function(data) { if(data.code == 200) { $('#act11739232574395').val(data.records.orgName) diff --git a/showPhotos/js/page/user.js b/showPhotos/js/page/user.js index c950431..565d395 100644 --- a/showPhotos/js/page/user.js +++ b/showPhotos/js/page/user.js @@ -171,6 +171,9 @@ function userTabInfo() { type: 'GET', url: baseUrl + '/ACTIVITY/sz/search/' + activityCode, data: params, + headers: { + 'x-token': getToken() + }, success: function(data) { if(data.status == 200) { var userInfoObj = data.result && data.result.records && data.result.records[0] @@ -211,6 +214,9 @@ function voteClickFn(){ type: 'PUT', url: baseUrl + '/ACTIVITY/sz/vote/' + activityCode, data: params, + headers: { + 'x-token': getToken() + }, success: function(data) { gb_vote_loaded = false if(data.status == 200) { -- libgit2 0.27.0