Commit b4193488 authored by 黄奎's avatar 黄奎

页面修改

parent eb37462e
...@@ -13,6 +13,54 @@ namespace Mall.Common ...@@ -13,6 +13,54 @@ namespace Mall.Common
public class ConvertHelper public class ConvertHelper
{ {
/// <summary>
/// json字符串将属性值中的英文双引号变成中文双引号
/// </summary>
/// <param name="strJson">json字符串</param>
/// <returns></returns>
public static string JsonReplaceSign(string strJson)
{
//获取每个字符
char[] temp = strJson.ToCharArray();
//获取字符数组长度
int n = temp.Length;
//循环整个字符数组
for (int i = 0; i < n; i++)
{
//查找json属性值(:+" )
if (temp[i] == ':' && temp[i + 1] == '"')
{
//循环属性值内的字符(:+2 推算到value值)
for (int j = i + 2; j < n; j++)
{
//判断是否是英文双引号
if (temp[j] == '"')
{
//排除json属性的双引号
if (temp[j + 1] != ',' && temp[j + 1] != '}')
{
//替换成中文双引号
temp[j] = '”';
}
else if (temp[j + 1] == ',' || temp[j + 1] == '}')
{
break;
}
}
else if (temp[j] == '-')
{
temp[j] = ' ';
}
else if (true)
{
// 要过虑其他字符,继续添加判断就可以
}
}
}
}
return new String(temp);
}
/// <summary> /// <summary>
/// 转换字符流成字符串 /// 转换字符流成字符串
/// </summary> /// </summary>
...@@ -45,7 +93,7 @@ namespace Mall.Common ...@@ -45,7 +93,7 @@ namespace Mall.Common
return data; return data;
} }
/// <summary> /// <summary>
/// 类型转换 /// 类型转换
/// </summary> /// </summary>
...@@ -103,7 +151,7 @@ namespace Mall.Common ...@@ -103,7 +151,7 @@ namespace Mall.Common
/// <param name="obj"></param> /// <param name="obj"></param>
/// <param name="defaultValue">默认值</param> /// <param name="defaultValue">默认值</param>
/// <returns></returns> /// <returns></returns>
public static int ToInt(object obj,int defaultValue=0) public static int ToInt(object obj, int defaultValue = 0)
{ {
int result = defaultValue; int result = defaultValue;
if (obj != null) if (obj != null)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" /> <ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" /> <ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
</ItemGroup> </ItemGroup>
......
...@@ -55,7 +55,7 @@ namespace Mall.Module.MarketingCenter ...@@ -55,7 +55,7 @@ namespace Mall.Module.MarketingCenter
{ {
if (item.TemplateData != null && !string.IsNullOrEmpty(item.TemplateData)) if (item.TemplateData != null && !string.IsNullOrEmpty(item.TemplateData))
{ {
item.ComponentDataList = JsonHelper.DeserializeObject<List<ComponentItem>>(item.TemplateData); item.ComponentDataList = JsonHelper.DeserializeObject<List<ComponentItem>>(Mall.Common.ConvertHelper.JsonReplaceSign(item.TemplateData));
if (item.ComponentDataList != null && item.ComponentDataList.Count > 0) if (item.ComponentDataList != null && item.ComponentDataList.Count > 0)
{ {
foreach (var subItem in item.ComponentDataList) foreach (var subItem in item.ComponentDataList)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment