sql数据流,amdin业务逻辑接入

This commit is contained in:
comlibmb
2026-02-15 16:37:37 +08:00
parent ec636dc703
commit e648ff0c22
43 changed files with 5412 additions and 1024 deletions

View File

@@ -6,6 +6,11 @@
</view>
<view class="config-body">
<!-- 加载遮罩 -->
<view v-if="isLoading" class="loading-mask">
<text class="loading-text">加载中...</text>
</view>
<view class="config-item">
<view class="item-label">
<text class="label-txt">签到开关:</text>
@@ -88,7 +93,7 @@
</view>
<view class="config-footer">
<button class="btn-submit" @click="handleSave">提交</button>
<button class="btn-submit" @click="handleSave" :loading="isSaving">提交</button>
</view>
</view>
</view>
@@ -96,7 +101,11 @@
</template>
<script setup lang="uts">
import { reactive } from 'vue'
import { reactive, onMounted, ref } from 'vue'
import { fetchCheckinConfig, saveCheckinConfig, CheckinConfig } from '@/services/admin/marketingService.uts'
const isLoading = ref(false)
const isSaving = ref(false)
const config = reactive({
is_open: true,
@@ -106,8 +115,52 @@ const config = reactive({
exp: 1
})
const handleSave = () => {
uni.showToast({ title: '保存成功', icon: 'success' })
onMounted(() => {
loadConfig()
})
async function loadConfig() {
isLoading.value = true
try {
const res = await fetchCheckinConfig()
if (res != null) {
config.is_open = res.is_open
config.mode = res.mode
config.notice_enabled = res.notice_enabled
config.integral = res.integral_reward
config.exp = res.exp_reward
}
} catch (e) {
uni.showToast({ title: '加载配置失败', icon: 'none' })
} finally {
isLoading.value = false
}
}
async function handleSave() {
if (isSaving.value) return
isSaving.value = true
const payload : CheckinConfig = {
is_open: config.is_open,
mode: config.mode,
notice_enabled: config.notice_enabled,
integral_reward: config.integral,
exp_reward: config.exp
}
try {
const success = await saveCheckinConfig(payload)
if (success) {
uni.showToast({ title: '保存成功', icon: 'success' })
} else {
uni.showToast({ title: '保存失败', icon: 'none' })
}
} catch (e) {
uni.showToast({ title: '系统异常', icon: 'none' })
} finally {
isSaving.value = false
}
}
</script>
@@ -124,7 +177,7 @@ const handleSave = () => {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.config-card { padding: 24px; }
.config-card { padding: 24px; position: relative; }
.config-header {
border-bottom: 1px solid #e8eaec;
@@ -172,7 +225,7 @@ const handleSave = () => {
.config-input {
width: 400px;
height: 36px;
height: 32px;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 0 12px;
@@ -186,8 +239,8 @@ const handleSave = () => {
.btn-submit {
width: 80px;
height: 36px;
line-height: 36px;
height: 32px;
line-height: 32px;
background: #1890ff;
color: #fff;
border: none;
@@ -195,4 +248,15 @@ const handleSave = () => {
font-size: 14px;
cursor: pointer;
}
.loading-mask {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(255, 255, 255, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
.loading-text { color: #1890ff; font-size: 14px; }
</style>