refactor(form): remove unused back home button and related code
移除了表单页面中不再使用的返回主页按钮、对应的国际化文案和重置表单方法,清理冗余代码
This commit is contained in:
@@ -10,6 +10,4 @@ export const lang = {
|
|||||||
// Modal dialog
|
// Modal dialog
|
||||||
tip: 'Tip',
|
tip: 'Tip',
|
||||||
paramError: 'Parameter error',
|
paramError: 'Parameter error',
|
||||||
// Back to home
|
|
||||||
backHome: 'Back to Home',
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,4 @@ export const lang = {
|
|||||||
// 弹窗
|
// 弹窗
|
||||||
tip: '提示',
|
tip: '提示',
|
||||||
paramError: '参数错误',
|
paramError: '参数错误',
|
||||||
// 返回主页
|
|
||||||
backHome: '返回主页',
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view :style="themeColor">
|
<view :style="themeColor">
|
||||||
<!-- 返回主页按钮:左上角固定,始终可见 -->
|
|
||||||
<view class="home-btn" @click="goHome">
|
|
||||||
<text class="home-btn-text">{{ $lang('form.formdata.backHome') }}</text>
|
|
||||||
</view>
|
|
||||||
<block v-if="detail">
|
<block v-if="detail">
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="system-form-wrap">
|
<view class="system-form-wrap">
|
||||||
@@ -178,18 +174,6 @@ export default {
|
|||||||
// #endif
|
// #endif
|
||||||
uni.setNavigationBarTitle({ title: formName });
|
uni.setNavigationBarTitle({ title: formName });
|
||||||
},
|
},
|
||||||
// 返回主页(用 reLaunch 避免返回后还能 navigateBack 回到已提交的表单页)
|
|
||||||
goHome() {
|
|
||||||
this.$util.redirectTo(this.$util.INDEX_PAGE_URL, {}, 'reLaunch');
|
|
||||||
},
|
|
||||||
// 清空表单数据:通过 diy-form 的 ref 拿到 ns-newform 实例,调用 setFormData 重置
|
|
||||||
resetForm() {
|
|
||||||
try {
|
|
||||||
if (this.$refs.form && this.$refs.form.$refs.nsNewform && this.$refs.form.$refs.nsNewform.setFormData) {
|
|
||||||
this.$refs.form.$refs.nsNewform.setFormData();
|
|
||||||
}
|
|
||||||
} catch(e) {}
|
|
||||||
},
|
|
||||||
// 由 diy-form 内置提交按钮触发:diy-form handleSubmit 已先做 verify(),
|
// 由 diy-form 内置提交按钮触发:diy-form handleSubmit 已先做 verify(),
|
||||||
// 仅在通过时才通过 :onSubmit 函数 prop 调用本方法(跨 H5 / MP 一致,不走 $emit / $listeners)。
|
// 仅在通过时才通过 :onSubmit 函数 prop 调用本方法(跨 H5 / MP 一致,不走 $emit / $listeners)。
|
||||||
// 注意:本方法通过 created 中 this.handleSubmit = this.create.bind(this) 预绑定 this,
|
// 注意:本方法通过 created 中 this.handleSubmit = this.create.bind(this) 预绑定 this,
|
||||||
@@ -211,9 +195,6 @@ export default {
|
|||||||
success: res => {
|
success: res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.complete = true
|
this.complete = true
|
||||||
// 提交成功后清空表单
|
|
||||||
this.resetForm()
|
|
||||||
this.isRepeat = false
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: this.$lang('form.formdata.tip'),
|
title: this.$lang('form.formdata.tip'),
|
||||||
content: this.$lang('form.formdata.submitSuccess'),
|
content: this.$lang('form.formdata.submitSuccess'),
|
||||||
@@ -254,35 +235,6 @@ page {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 左上角返回主页按钮
|
|
||||||
.home-btn {
|
|
||||||
position: fixed;
|
|
||||||
left: 30rpx;
|
|
||||||
// #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ || MP-LARK
|
|
||||||
// 小程序端需避开右上角胶囊按钮,下移到状态栏 + 胶囊高度之下
|
|
||||||
top: calc(var(--status-bar-height, 20px) + 10rpx);
|
|
||||||
// #endif
|
|
||||||
// #ifdef H5
|
|
||||||
top: 20rpx;
|
|
||||||
// #endif
|
|
||||||
z-index: 999;
|
|
||||||
padding: 12rpx 28rpx;
|
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
|
||||||
border-radius: 40rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.home-btn-text {
|
|
||||||
color: #ffffff;
|
|
||||||
font-size: 26rpx;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .mescroll-totop {
|
::v-deep .mescroll-totop {
|
||||||
/* #ifdef H5 */
|
/* #ifdef H5 */
|
||||||
right: 27rpx !important;
|
right: 27rpx !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user