|
|
@@ -28,9 +28,19 @@
|
|
|
<ElFormItem label="版本号">
|
|
|
<ElInput v-model="model.appInfo.versionCode" disabled />
|
|
|
</ElFormItem>
|
|
|
- <ElFormItem label="开屏页">
|
|
|
- <SingleUpload v-model="model.splash.url" />
|
|
|
+ <ElFormItem label="开屏广告">
|
|
|
+ <SingleUpload v-model="model.splash.imageUrl" />
|
|
|
</ElFormItem>
|
|
|
+ <ElFormItem label="跳转地址">
|
|
|
+ <ElInput v-model="model.splash.url" />
|
|
|
+ </ElFormItem>
|
|
|
+ <ElFormItem label="列表广告">
|
|
|
+ <SingleUpload v-model="model.banner.imageUrl" />
|
|
|
+ </ElFormItem>
|
|
|
+ <ElFormItem label="跳转地址">
|
|
|
+ <ElInput v-model="model.banner.url" />
|
|
|
+ </ElFormItem>
|
|
|
+ <ElButton @click="save" type="primary" :loading="loading">保存</ElButton>
|
|
|
</ElForm>
|
|
|
</el-main>
|
|
|
</template>
|
|
|
@@ -39,10 +49,20 @@
|
|
|
import { ref } from 'vue'
|
|
|
import resolveUrl from 'resolve-url'
|
|
|
import SingleUpload from '@/components/SingleUpload.vue'
|
|
|
+import { http } from '@/plugins/http'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
const uploadUrl = resolveUrl(import.meta.env.VITE_API_BASE_URL, '/api/file/upload')
|
|
|
-const model = ref({ appInfo: {}, splash: { enabled: true }, banner: { enabled: true } })
|
|
|
-console.log(uploadUrl)
|
|
|
+const model = ref({ appInfo: {}, splash: {}, banner: {} })
|
|
|
const uploading = ref(false)
|
|
|
+const loading = ref(false)
|
|
|
+const record = ref({
|
|
|
+ type: 'object',
|
|
|
+ name: 'app'
|
|
|
+})
|
|
|
+http.get('/sys-config/app').then((res) => {
|
|
|
+ model.value = JSON.parse(res.value)
|
|
|
+ record.value = res
|
|
|
+})
|
|
|
async function beforeUpload(file) {
|
|
|
const parser = new AppInfoParser(file)
|
|
|
try {
|
|
|
@@ -68,4 +88,12 @@ function onError(e) {
|
|
|
uploading.value = false
|
|
|
console.log(e)
|
|
|
}
|
|
|
+function save() {
|
|
|
+ loading.value = true
|
|
|
+ record.value.value = JSON.stringify(model.value)
|
|
|
+ http.put('/admin/sys-config', record.value).then((res) => {
|
|
|
+ loading.value = false
|
|
|
+ ElMessage.success('保存成功')
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|