提交代码

dev_xd
姜玉琦 2024-10-18 14:19:59 +08:00
parent c55ea4a88e
commit 6fa3c1aed7
4 changed files with 23 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yanzhu.common.core.constant.Constants; import com.yanzhu.common.core.constant.Constants;
import com.yanzhu.system.api.domain.SysUser;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -75,8 +76,9 @@ public class TokenService
public Map<String, Object> createMobileToken(LoginUser loginUser) public Map<String, Object> createMobileToken(LoginUser loginUser)
{ {
String token = IdUtils.fastUUID(); String token = IdUtils.fastUUID();
Long userId = loginUser.getSysUser().getUserId(); SysUser user = loginUser.getSysUser();
String userName = loginUser.getSysUser().getUserName(); Long userId = user.getUserId();
String userName = user.getUserName();
loginUser.setToken(token); loginUser.setToken(token);
loginUser.setUserid(userId); loginUser.setUserid(userId);
loginUser.setUsername(userName); loginUser.setUsername(userName);
@ -91,6 +93,8 @@ public class TokenService
// 接口返回信息 // 接口返回信息
Map<String, Object> rspMap = new HashMap<String, Object>(); Map<String, Object> rspMap = new HashMap<String, Object>();
rspMap.put("access_type", user.getUserType());
rspMap.put("access_role", user.getRoles());
rspMap.put("access_token", JwtUtils.createToken(claimsMap)); rspMap.put("access_token", JwtUtils.createToken(claimsMap));
rspMap.put("expires_in", expireTime); rspMap.put("expires_in", expireTime);
return rspMap; return rspMap;

View File

@ -52,12 +52,12 @@ App({
}) })
} }
this.autoUpdate(); this.autoUpdate();
/** /**
* 初始化页面未登录时跳转到登录页 * 初始化页面未登录时跳转到登录页
*/ */
if(options && options.proId){ if(options && options.query && options.query.proId){
//扫码进入时不效验登录...跳转授权登录页 //扫码进入时不效验登录...跳转授权登录页
console.log("扫码进入时不效验登录...跳转授权登录页");
}else{ }else{
if (!getToken()) { if (!getToken()) {
// setTimeout(() => { // setTimeout(() => {

View File

@ -16,7 +16,8 @@
"pages/project_info/edit/index", "pages/project_info/edit/index",
"pages/project_check/list/index", "pages/project_check/list/index",
"pages/project_check/edit/index", "pages/project_check/edit/index",
"pages/project_check/info/index" "pages/project_check/info/index",
"pages/project_qr/index"
], ],
"usingComponents": { "usingComponents": {
"van-row": "@vant/weapp/row", "van-row": "@vant/weapp/row",

View File

@ -4,5 +4,18 @@
"setting": { "setting": {
"compileHotReLoad": true, "compileHotReLoad": true,
"urlCheck": false "urlCheck": false
},
"condition": {
"miniprogram": {
"list": [
{
"name": "",
"pathName": "pages/login/login",
"query": "proId=111",
"launchMode": "default",
"scene": null
}
]
}
} }
} }