😎1、修复刷新页面后个人中心密码修改无效问题 2、修改小程序二维码生成功能路径配置,增加相对路径的适配,并且返回相对路径 3、代码清理
This commit is contained in:
parent
fb4e0d1de5
commit
caf2abd9bf
@ -249,7 +249,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
foreach (var column in columnList)
|
foreach (var column in columnList)
|
||||||
{
|
{
|
||||||
var property = properties.First(u => u.ColumnName == column.ColumnName);
|
var property = properties.FirstOrDefault(u => u.ColumnName == column.ColumnName);
|
||||||
column.ColumnComment ??= property?.ColumnComment;
|
column.ColumnComment ??= property?.ColumnComment;
|
||||||
column.PropertyName = property?.PropertyName;
|
column.PropertyName = property?.PropertyName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -261,6 +261,15 @@ public class SysConfigService : IDynamicApiController, ITransient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取密码加解密公钥
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetSmPublicKey()
|
||||||
|
{
|
||||||
|
return App.GetConfig<string>("Cryptogram:PublicKey", true);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清除配置缓存
|
/// 清除配置缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public class SysUserLdapService : ITransient
|
|||||||
await _sysUserLdapRep.AsUpdateable()
|
await _sysUserLdapRep.AsUpdateable()
|
||||||
.InnerJoin<SysUser>((l, u) => l.EmployeeId == u.Account)
|
.InnerJoin<SysUser>((l, u) => l.EmployeeId == u.Account)
|
||||||
.SetColumns((l, u) => new SysUserLdap { UserId = u.Id })
|
.SetColumns((l, u) => new SysUserLdap { UserId = u.Id })
|
||||||
.Where((l, u) => l.TenantId == tenantId && u.Status == StatusEnum.Enable && u.IsDelete == false)
|
.Where((l, u) => l.TenantId == tenantId && u.Status == StatusEnum.Enable)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,23 @@ public class WxPhoneOutput
|
|||||||
|
|
||||||
public class GenerateQRImageOutput
|
public class GenerateQRImageOutput
|
||||||
{
|
{
|
||||||
public bool Success { get; set; }
|
/// <summary>
|
||||||
public string ImgPath { get; set; }
|
/// 生成状态
|
||||||
public string Message { get; set; }
|
/// </summary>
|
||||||
|
public bool Success { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成图片的绝对路径
|
||||||
|
/// </summary>
|
||||||
|
public string ImgPath { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成图片的相对路径
|
||||||
|
/// </summary>
|
||||||
|
public string RelativeImgPath { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成图片的错误信息
|
||||||
|
/// </summary>
|
||||||
|
public string Message { get; set; } = "";
|
||||||
}
|
}
|
||||||
@ -274,8 +274,6 @@ public class SysWxOpenService : IDynamicApiController, ITransient
|
|||||||
GenerateQRImageOutput generateQRImageOutInput = new();
|
GenerateQRImageOutput generateQRImageOutInput = new();
|
||||||
if (input.PagePath.IsNullOrEmpty())
|
if (input.PagePath.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
generateQRImageOutInput.Success = false;
|
|
||||||
generateQRImageOutInput.ImgPath = "";
|
|
||||||
generateQRImageOutInput.Message = $"生成失败 页面路径不能为空";
|
generateQRImageOutInput.Message = $"生成失败 页面路径不能为空";
|
||||||
return generateQRImageOutInput;
|
return generateQRImageOutInput;
|
||||||
}
|
}
|
||||||
@ -297,27 +295,39 @@ public class SysWxOpenService : IDynamicApiController, ITransient
|
|||||||
if (response.IsSuccessful())
|
if (response.IsSuccessful())
|
||||||
{
|
{
|
||||||
var QRImagePath = App.GetConfig<string>("Wechat:QRImagePath");
|
var QRImagePath = App.GetConfig<string>("Wechat:QRImagePath");
|
||||||
QRImagePath = string.IsNullOrEmpty(QRImagePath) ? Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "QRImage") : QRImagePath;
|
var relativeImgPath = string.Empty;
|
||||||
// 判断文件存放路径是否存在
|
|
||||||
|
// 判断路径是绝对路径还是相对路径
|
||||||
|
var isPathRooted = Path.IsPathRooted(QRImagePath);
|
||||||
|
if (!isPathRooted)
|
||||||
|
{
|
||||||
|
// 相对路径
|
||||||
|
relativeImgPath = string.IsNullOrEmpty(QRImagePath) ? Path.Combine("upload", "QRImage") : QRImagePath;
|
||||||
|
QRImagePath = Path.Combine(App.WebHostEnvironment.WebRootPath, relativeImgPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断文件存放路径是否存在
|
||||||
if (!Directory.Exists(QRImagePath))
|
if (!Directory.Exists(QRImagePath))
|
||||||
|
{
|
||||||
Directory.CreateDirectory(QRImagePath);
|
Directory.CreateDirectory(QRImagePath);
|
||||||
|
}
|
||||||
// 将二维码图片数据保存为文件
|
// 将二维码图片数据保存为文件
|
||||||
var filePath = Path.Combine(QRImagePath, $"{input.ImageName.ToUpper()}.png");
|
var fileName = $"{input.ImageName.ToUpper()}.png";
|
||||||
|
var filePath = Path.Combine(QRImagePath, fileName);
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
File.Delete(filePath);
|
File.Delete(filePath);
|
||||||
|
}
|
||||||
File.WriteAllBytes(filePath, response.GetRawBytes());
|
File.WriteAllBytes(filePath, response.GetRawBytes());
|
||||||
|
|
||||||
generateQRImageOutInput.Success = true;
|
generateQRImageOutInput.Success = true;
|
||||||
generateQRImageOutInput.ImgPath = filePath;
|
generateQRImageOutInput.ImgPath = filePath;
|
||||||
|
generateQRImageOutInput.RelativeImgPath = Path.Combine(relativeImgPath, fileName);
|
||||||
generateQRImageOutInput.Message = "生成成功";
|
generateQRImageOutInput.Message = "生成成功";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 处理错误情况
|
// 处理错误情况
|
||||||
generateQRImageOutInput.Success = false;
|
|
||||||
generateQRImageOutInput.ImgPath = "";
|
|
||||||
generateQRImageOutInput.Message = $"生成失败 错误代码:{response.ErrorCode} 错误描述:{response.ErrorMessage}";
|
generateQRImageOutInput.Message = $"生成失败 错误代码:{response.ErrorCode} 错误描述:{response.ErrorMessage}";
|
||||||
}
|
}
|
||||||
return generateQRImageOutInput;
|
return generateQRImageOutInput;
|
||||||
|
|||||||
@ -465,6 +465,49 @@ export const SysConfigApiAxiosParamCreator = function (configuration?: Configura
|
|||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取密码加解密公钥
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiSysConfigSmPublicKeyGet: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
const localVarPath = `/api/sysConfig/smPublicKey`;
|
||||||
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
|
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||||
|
let baseOptions;
|
||||||
|
if (configuration) {
|
||||||
|
baseOptions = configuration.baseOptions;
|
||||||
|
}
|
||||||
|
const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication Bearer required
|
||||||
|
// http bearer authentication required
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = new URLSearchParams(localVarUrlObj.search);
|
||||||
|
for (const key in localVarQueryParameter) {
|
||||||
|
query.set(key, localVarQueryParameter[key]);
|
||||||
|
}
|
||||||
|
for (const key in options.params) {
|
||||||
|
query.set(key, options.params[key]);
|
||||||
|
}
|
||||||
|
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新配置参数 🔖
|
* @summary 更新配置参数 🔖
|
||||||
@ -647,6 +690,19 @@ export const SysConfigApiFp = function(configuration?: Configuration) {
|
|||||||
return axios.request(axiosRequestArgs);
|
return axios.request(axiosRequestArgs);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取密码加解密公钥
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysConfigSmPublicKeyGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultString>>> {
|
||||||
|
const localVarAxiosArgs = await SysConfigApiAxiosParamCreator(configuration).apiSysConfigSmPublicKeyGet(options);
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新配置参数 🔖
|
* @summary 更新配置参数 🔖
|
||||||
@ -759,6 +815,15 @@ export const SysConfigApiFactory = function (configuration?: Configuration, base
|
|||||||
async apiSysConfigPagePost(body?: PageConfigInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultSqlSugarPagedListSysConfig>> {
|
async apiSysConfigPagePost(body?: PageConfigInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultSqlSugarPagedListSysConfig>> {
|
||||||
return SysConfigApiFp(configuration).apiSysConfigPagePost(body, options).then((request) => request(axios, basePath));
|
return SysConfigApiFp(configuration).apiSysConfigPagePost(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取密码加解密公钥
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysConfigSmPublicKeyGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultString>> {
|
||||||
|
return SysConfigApiFp(configuration).apiSysConfigSmPublicKeyGet(options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新配置参数 🔖
|
* @summary 更新配置参数 🔖
|
||||||
@ -877,6 +942,16 @@ export class SysConfigApi extends BaseAPI {
|
|||||||
public async apiSysConfigPagePost(body?: PageConfigInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultSqlSugarPagedListSysConfig>> {
|
public async apiSysConfigPagePost(body?: PageConfigInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultSqlSugarPagedListSysConfig>> {
|
||||||
return SysConfigApiFp(this.configuration).apiSysConfigPagePost(body, options).then((request) => request(this.axios, this.basePath));
|
return SysConfigApiFp(this.configuration).apiSysConfigPagePost(body, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取密码加解密公钥
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof SysConfigApi
|
||||||
|
*/
|
||||||
|
public async apiSysConfigSmPublicKeyGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultString>> {
|
||||||
|
return SysConfigApiFp(this.configuration).apiSysConfigSmPublicKeyGet(options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新配置参数 🔖
|
* @summary 更新配置参数 🔖
|
||||||
|
|||||||
@ -21,18 +21,32 @@
|
|||||||
export interface GenerateQRImageOutput {
|
export interface GenerateQRImageOutput {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 生成状态
|
||||||
|
*
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @memberof GenerateQRImageOutput
|
* @memberof GenerateQRImageOutput
|
||||||
*/
|
*/
|
||||||
success?: boolean;
|
success?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 生成图片的绝对路径
|
||||||
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof GenerateQRImageOutput
|
* @memberof GenerateQRImageOutput
|
||||||
*/
|
*/
|
||||||
imgPath?: string | null;
|
imgPath?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 生成图片的相对路径
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof GenerateQRImageOutput
|
||||||
|
*/
|
||||||
|
relativeImgPath?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成图片的错误信息
|
||||||
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof GenerateQRImageOutput
|
* @memberof GenerateQRImageOutput
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -33,10 +33,6 @@ import 'vue3-flag-icons/styles';
|
|||||||
|
|
||||||
disAutoConnect();
|
disAutoConnect();
|
||||||
|
|
||||||
// // 加载系统信息
|
|
||||||
// import { loadSysInfo } from '/@/utils/sysInfo';
|
|
||||||
// loadSysInfo();
|
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
directive(app);
|
directive(app);
|
||||||
other.elSvg(app);
|
other.elSvg(app);
|
||||||
|
|||||||
@ -183,7 +183,7 @@ import { sm2 } from 'sm-crypto-v2';
|
|||||||
import { clearAccessTokens, getAPI } from '/@/utils/axios-utils';
|
import { clearAccessTokens, getAPI } from '/@/utils/axios-utils';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import { SysFileApi, SysUserApi } from '/@/api-services/api';
|
import { SysConfigApi, SysFileApi, SysUserApi } from '/@/api-services/api';
|
||||||
import { ChangePwdInput, SysUser, SysFile } from '/@/api-services/models';
|
import { ChangePwdInput, SysUser, SysFile } from '/@/api-services/models';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@ -312,8 +312,12 @@ const submitPassword = () => {
|
|||||||
if (!valid) return;
|
if (!valid) return;
|
||||||
|
|
||||||
// SM2加密密码
|
// SM2加密密码
|
||||||
const cpwd: ChangePwdInput = { passwordOld: '', passwordNew: '' };
|
var cpwd: ChangePwdInput = { passwordOld: '', passwordNew: '' };
|
||||||
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
|
var publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
|
||||||
|
if (publicKey == '') {
|
||||||
|
var res = await getAPI(SysConfigApi).apiSysConfigSmPublicKeyGet();
|
||||||
|
publicKey = window.__env__.VITE_SM_PUBLIC_KEY = res.data.result ?? '';
|
||||||
|
}
|
||||||
cpwd.passwordOld = sm2.doEncrypt(state.ruleFormPassword.passwordOld, publicKey, 1);
|
cpwd.passwordOld = sm2.doEncrypt(state.ruleFormPassword.passwordOld, publicKey, 1);
|
||||||
cpwd.passwordNew = sm2.doEncrypt(state.ruleFormPassword.passwordNew, publicKey, 1);
|
cpwd.passwordNew = sm2.doEncrypt(state.ruleFormPassword.passwordNew, publicKey, 1);
|
||||||
await getAPI(SysUserApi).apiSysUserChangePwdPost(cpwd);
|
await getAPI(SysUserApi).apiSysUserChangePwdPost(cpwd);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user