1.代码优化

sws 2024-09-03
v1.0.0
sws 2024-09-03 10:53:24 +08:00
parent b7baff7392
commit 090960f095
10 changed files with 31 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

View File

@ -2,7 +2,7 @@
<!-- 顶部导航栏 --> <!-- 顶部导航栏 -->
<div class="navbar"> <div class="navbar">
<div class="nav-left"> <div class="nav-left">
<icon name="arrow-left" color="f">返回</icon> <!-- <icon name="arrow-left" color="f">返回</icon> -->
<div class="flex-row align-c"> <div class="flex-row align-c">
<div class="name"> <div class="name">
<div class="flex-row align-c gap-10 c-pointer" @click="dialog_visible = true"> <div class="flex-row align-c gap-10 c-pointer" @click="dialog_visible = true">
@ -27,17 +27,17 @@
</div> </div>
</template> </template>
<div class="content pa-20"> <div class="content pa-20">
<el-form ref="ruleFormRef" :model="form" :rules="rules" label-width="70" status-icon> <el-form ref="ruleFormRef" :model="form" :rules="rules" label-width="50" status-icon>
<el-form-item label="上传头像"> <el-form-item label="封面">
<upload v-model="form.logo" :limit="1"></upload> <upload v-model="form.logo" :limit="1"></upload>
</el-form-item> </el-form-item>
<el-form-item label="模版名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入模版名称" /> <el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item> </el-form-item>
<el-form-item label="模版描述"> <el-form-item label="描述">
<el-input v-model="form.describe" placeholder="请输入模版描述" :rows="4" type="textarea" /> <el-input v-model="form.describe" placeholder="请输入描述" :rows="4" type="textarea" />
</el-form-item> </el-form-item>
<el-form-item label="模版开关"> <el-form-item label="开关">
<el-switch v-model="form.is_enable" active-value="1" inactive-value="0"></el-switch> <el-switch v-model="form.is_enable" active-value="1" inactive-value="0"></el-switch>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -110,7 +110,7 @@ const confirm_event = async (formEl: FormInstance | undefined) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
height: 8rem; height: 8rem;
padding: 0 3.7rem; padding: 0 3rem;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@ -119,21 +119,21 @@ const confirm_event = async (formEl: FormInstance | undefined) => {
display: flex; display: flex;
align-items: center; align-items: center;
.name { .name {
padding-left: 2rem; // padding-left: 2rem;
margin: 0 2rem; // margin: 0 2rem;
color: #fff; color: #fff;
position: relative; position: relative;
&::before { // &::before {
content: ''; // content: '';
display: inline-block; // display: inline-block;
width: 0.1rem; // width: 0.1rem;
height: 65%; // height: 65%;
background-color: #fff; // background-color: #fff;
position: absolute; // position: absolute;
left: 0; // left: 0;
top: 50%; // top: 50%;
transform: translateY(-50%); // transform: translateY(-50%);
} // }
.img { .img {
width: 2.2rem; width: 2.2rem;
height: 2.2rem; height: 2.2rem;

View File

@ -142,10 +142,9 @@ const save = () => {
formmat_form_data(form.value); formmat_form_data(form.value);
}; };
const save_close = () => { const save_close = () => {
formmat_form_data(form.value); formmat_form_data(form.value, true);
window.close();
}; };
const formmat_form_data = (data: diy_data_item) => { const formmat_form_data = (data: diy_data_item, close: boolean = false) => {
const clone_form = cloneDeep(data); const clone_form = cloneDeep(data);
clone_form.header.show_tabs = true; clone_form.header.show_tabs = true;
clone_form.footer.show_tabs = false; clone_form.footer.show_tabs = false;
@ -161,6 +160,13 @@ const formmat_form_data = (data: diy_data_item) => {
const new_data = diy_data_transfor_form_data(clone_form); const new_data = diy_data_transfor_form_data(clone_form);
DiyAPI.save(new_data).then((res) => { DiyAPI.save(new_data).then((res) => {
ElMessage.success('保存成功'); ElMessage.success('保存成功');
if (!close) return;
ElMessageBox.confirm('您确定要关闭本页吗?', '提示')
.then(() => {
//
window.close();
})
.catch(() => {});
}); });
}; };
//#endregion ---------------------end //#endregion ---------------------end