feat(web): load real data in dashboard and list pages
This commit is contained in:
@@ -14,6 +14,15 @@
|
||||
<el-form-item label="主体名称">
|
||||
<el-input v-model="form.subjectName" placeholder="主体名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="CorpID">
|
||||
<el-input v-model="form.corpId" placeholder="CorpID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="AgentID">
|
||||
<el-input v-model="form.agentId" placeholder="AgentID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="AgentSecret">
|
||||
<el-input v-model="form.agentSecret" placeholder="AgentSecret" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleCreate">创建</el-button>
|
||||
</el-form-item>
|
||||
@@ -31,19 +40,30 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { createChannelSubject } from '@/api/channel'
|
||||
import { createChannelSubject, listChannelSubjects } from '@/api/channel'
|
||||
|
||||
const form = reactive({
|
||||
channelType: 'wecom',
|
||||
subjectCode: '',
|
||||
subjectName: '',
|
||||
corpId: '',
|
||||
agentId: '',
|
||||
agentSecret: '',
|
||||
})
|
||||
|
||||
const subjects = ref<any[]>([])
|
||||
|
||||
async function loadSubjects() {
|
||||
try {
|
||||
const res: any = await listChannelSubjects()
|
||||
subjects.value = res.data || []
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreate() {
|
||||
try {
|
||||
const res: any = await createChannelSubject(form)
|
||||
@@ -53,4 +73,6 @@ async function handleCreate() {
|
||||
ElMessage.error(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadSubjects)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user