feat(invite): 规则说明弹窗改为动态内容,从后端配置读取
- 新增invite_rule业务配置项 - ISystemService/SystemService新增GetInviteRuleAsync方法 - SystemController新增getInviteRule接口 - 前端规则说明弹窗改为纯文本展示,匹配设计图样式
This commit is contained in:
parent
6e19d3c821
commit
c4a3d5d5a2
|
|
@ -141,13 +141,6 @@ public class SystemController : ControllerBase
|
|||
/// <summary>
|
||||
/// 获取小程序信息
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// GET /api/system/getMiniappInfo
|
||||
///
|
||||
/// 从配置表读取小程序名称和简介
|
||||
/// 不需要用户登录认证
|
||||
/// </remarks>
|
||||
/// <returns>小程序名称和简介</returns>
|
||||
[HttpGet("getMiniappInfo")]
|
||||
[ProducesResponseType(typeof(ApiResponse<MiniappInfoDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<MiniappInfoDto>> GetMiniappInfo()
|
||||
|
|
@ -163,4 +156,29 @@ public class SystemController : ControllerBase
|
|||
return ApiResponse<MiniappInfoDto>.Fail("获取小程序信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取邀请规则说明
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// GET /api/system/getInviteRule
|
||||
///
|
||||
/// 从配置表读取邀请规则说明内容
|
||||
/// 不需要用户登录认证
|
||||
/// </remarks>
|
||||
/// <returns>邀请规则说明内容</returns>
|
||||
[HttpGet("getInviteRule")]
|
||||
public async Task<ApiResponse<string>> GetInviteRule()
|
||||
{
|
||||
try
|
||||
{
|
||||
var content = await _systemService.GetInviteRuleAsync();
|
||||
return ApiResponse<string>.Success(content);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to get invite rule");
|
||||
return ApiResponse<string>.Fail("获取邀请规则失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,4 +51,13 @@ public interface ISystemService
|
|||
/// </remarks>
|
||||
/// <returns>小程序信息数据</returns>
|
||||
Task<MiniappInfoDto> GetMiniappInfoAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 获取邀请规则说明
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 从配置表读取邀请规则说明内容(config_key: invite_rule)
|
||||
/// </remarks>
|
||||
/// <returns>邀请规则说明内容</returns>
|
||||
Task<string> GetInviteRuleAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class SystemService : ISystemService
|
|||
private const string ServiceQrcodeKey = "service_qrcode";
|
||||
private const string MiniappNameKey = "miniapp_name";
|
||||
private const string MiniappIntroKey = "miniapp_intro";
|
||||
private const string InviteRuleKey = "invite_rule";
|
||||
|
||||
// 默认版本号
|
||||
private const string DefaultVersion = "1.0.0";
|
||||
|
|
@ -127,4 +128,15 @@ public class SystemService : ISystemService
|
|||
Intro = intro ?? string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> GetInviteRuleAsync()
|
||||
{
|
||||
_logger.LogDebug("获取邀请规则说明");
|
||||
|
||||
var content = await _configService.GetConfigValueAsync(InviteRuleKey);
|
||||
|
||||
return content ?? string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,10 +44,19 @@ export function getMiniappInfo() {
|
|||
return get('/system/getMiniappInfo')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取邀请规则说明
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
export function getInviteRule() {
|
||||
return get('/system/getInviteRule')
|
||||
}
|
||||
|
||||
export default {
|
||||
getAgreement,
|
||||
getPrivacy,
|
||||
getAbout,
|
||||
getContactInfo,
|
||||
getMiniappInfo
|
||||
getMiniappInfo,
|
||||
getInviteRule
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
applyWithdraw,
|
||||
getWithdrawList
|
||||
} from '@/api/invite.js'
|
||||
import { getMiniappInfo } from '@/api/system.js'
|
||||
import { getMiniappInfo, getInviteRule } from '@/api/system.js'
|
||||
import Empty from '@/components/Empty/index.vue'
|
||||
import Loading from '@/components/Loading/index.vue'
|
||||
|
||||
|
|
@ -64,6 +64,9 @@ const qrcodeLoading = ref(false)
|
|||
const miniappName = ref('')
|
||||
const miniappIntro = ref('')
|
||||
|
||||
// 规则说明内容
|
||||
const ruleContent = ref('')
|
||||
|
||||
// 提现表单
|
||||
const withdrawAmount = ref('')
|
||||
const withdrawLoading = ref(false)
|
||||
|
|
@ -150,6 +153,20 @@ async function loadMiniappInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载邀请规则说明
|
||||
*/
|
||||
async function loadInviteRule() {
|
||||
try {
|
||||
const res = await getInviteRule()
|
||||
if (res.code === 0 && res.data) {
|
||||
ruleContent.value = res.data
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取邀请规则失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载邀请记录列表
|
||||
*/
|
||||
|
|
@ -361,6 +378,7 @@ onShow(() => {
|
|||
loadRecordList(true)
|
||||
loadMiniappInfo()
|
||||
loadQrcodeUrl()
|
||||
loadInviteRule()
|
||||
})
|
||||
|
||||
onMounted(() => { userStore.restoreFromStorage() })
|
||||
|
|
@ -463,16 +481,7 @@ onMounted(() => { userStore.restoreFromStorage() })
|
|||
</view>
|
||||
<scroll-view class="popup-body" scroll-y>
|
||||
<view class="rule-content">
|
||||
<view class="rule-item" v-for="(rule, idx) in [
|
||||
'合伙人及以上用户可通过专属链接或二维码邀请新用户注册。',
|
||||
'被邀请用户通过您的链接注册后,将自动绑定为您的下级用户。',
|
||||
'下级用户在小程序内成功支付后,您可获得每笔订单40%的佣金。',
|
||||
'若您有上级用户,每笔订单您获得30%佣金,您的上级获得10%佣金。',
|
||||
'佣金可申请提现,最低提现金额为1元,仅支持整数金额。',
|
||||
'提现申请提交后,将在1-3个工作日内处理。'
|
||||
]" :key="idx">
|
||||
<text class="rule-text">{{ idx + 1 }}. {{ rule }}</text>
|
||||
</view>
|
||||
<text class="rule-text">{{ ruleContent || '暂无规则说明' }}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
|
@ -908,18 +917,10 @@ onMounted(() => { userStore.restoreFromStorage() })
|
|||
}
|
||||
|
||||
.rule-content {
|
||||
.rule-item {
|
||||
margin-bottom: $spacing-md;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.rule-text {
|
||||
font-size: $font-size-md;
|
||||
color: $text-color;
|
||||
line-height: 1.6;
|
||||
}
|
||||
line-height: 1.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user