fix[design]: 在创建页面添加保存提示
- 增加 Dialog 取提示是否保存 - 去除多余的 watch 导入
This commit is contained in:
@@ -2,14 +2,8 @@
|
|||||||
<div class="common-layout container">
|
<div class="common-layout container">
|
||||||
<!-- title 标题和搜索栏 -->
|
<!-- title 标题和搜索栏 -->
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<van-nav-bar
|
<van-nav-bar class="navbar-header" :title="$route.meta.title" left-arrow safe-area-inset-top :border="false"
|
||||||
class="navbar-header"
|
@click-left="goBack">
|
||||||
:title="$route.meta.title"
|
|
||||||
left-arrow
|
|
||||||
safe-area-inset-top
|
|
||||||
:border="false"
|
|
||||||
@click-left="goBack"
|
|
||||||
>
|
|
||||||
<template #left>
|
<template #left>
|
||||||
<van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" />
|
<van-icon name="left-long" class-prefix="mobilefont" size="18" style="color: #fff" />
|
||||||
</template>
|
</template>
|
||||||
@@ -25,10 +19,25 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { RouterView, useRouter, useRoute } from 'vue-router';
|
import { RouterView, useRouter, useRoute } from 'vue-router';
|
||||||
import appBridge from '@/assets/js/appBridge';
|
import appBridge from '@/assets/js/appBridge';
|
||||||
|
// import { Dialog } from 'vant';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
function goBack() {
|
function goBack () {
|
||||||
|
// 查看当前路由, 如果路由是 create,则提示是否保存
|
||||||
|
// if (route.name === 'create') {
|
||||||
|
// Dialog.confirm({
|
||||||
|
// title: '提示',
|
||||||
|
// message: '是否保存问卷',
|
||||||
|
// // confirmButtonText: '保存',
|
||||||
|
// // cancelButtonText: '不保存'
|
||||||
|
// }).then(() => {
|
||||||
|
// // on confirm
|
||||||
|
// }).catch(() => {
|
||||||
|
// // on cancel
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (window.history.length > 1 && route.name !== 'home') {
|
if (window.history.length > 1 && route.name !== 'home') {
|
||||||
router.go(-1);
|
router.go(-1);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, useTemplateRef, onUnmounted, watch } from 'vue';
|
import { computed, onMounted, ref, useTemplateRef, onUnmounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { showConfirmDialog } from 'vant';
|
import { showConfirmDialog } from 'vant';
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
>
|
>
|
||||||
<template #button="{ item }">
|
<template #button="{ item }">
|
||||||
<div v-if="activeId === item.id" class="design-button">
|
<div v-if="activeId === item.id" class="design-button">
|
||||||
<van-button size="small" @click="show = true"> + 添加题目 </van-button>
|
<van-button size="small" @click="show = true"> + 添加题目</van-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
:min="1"
|
:min="1"
|
||||||
@blur="saveSetting"
|
@blur="saveSetting"
|
||||||
>
|
>
|
||||||
<template #right-icon> 份 </template>
|
<template #right-icon> 份</template>
|
||||||
</van-field>
|
</van-field>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
@@ -303,7 +303,7 @@
|
|||||||
input-align="right"
|
input-align="right"
|
||||||
@blur="saveSetting"
|
@blur="saveSetting"
|
||||||
>
|
>
|
||||||
<template #right-icon> 次 </template>
|
<template #right-icon> 次</template>
|
||||||
</van-field>
|
</van-field>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
<van-cell title="设备答题次数限制" class="border-bottom" :border="false" label-align="left">
|
<van-cell title="设备答题次数限制" class="border-bottom" :border="false" label-align="left">
|
||||||
@@ -332,7 +332,7 @@
|
|||||||
input-align="right"
|
input-align="right"
|
||||||
@blur="saveSetting"
|
@blur="saveSetting"
|
||||||
>
|
>
|
||||||
<template #right-icon> 次 </template>
|
<template #right-icon> 次</template>
|
||||||
</van-field>
|
</van-field>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
@@ -359,18 +359,18 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import emptyImage from '@/assets/img/empty.png';
|
import emptyImage from '@/assets/img/empty.png';
|
||||||
import { ref, computed, onMounted, watch, onBeforeMount } from 'vue';
|
import { computed, onBeforeMount, onMounted, ref, watch } from 'vue';
|
||||||
import * as Base64 from 'js-base64';
|
import * as Base64 from 'js-base64';
|
||||||
import {
|
import {
|
||||||
|
changeStatus,
|
||||||
getSetting,
|
getSetting,
|
||||||
saveQuestions,
|
|
||||||
saveQuestion,
|
|
||||||
snQuestions,
|
|
||||||
sync,
|
|
||||||
saveSettings,
|
|
||||||
saveProjectName,
|
|
||||||
getSurveysDetail,
|
getSurveysDetail,
|
||||||
changeStatus
|
saveProjectName,
|
||||||
|
saveQuestion,
|
||||||
|
saveQuestions,
|
||||||
|
saveSettings,
|
||||||
|
snQuestions,
|
||||||
|
sync
|
||||||
} from '@/api/design/index';
|
} from '@/api/design/index';
|
||||||
import { getFormattedTime } from '@/utils/utils';
|
import { getFormattedTime } from '@/utils/utils';
|
||||||
import Design from '@/views/Design/Index.vue';
|
import Design from '@/views/Design/Index.vue';
|
||||||
@@ -381,7 +381,7 @@ import { basicQuesTypeList } from '@/utils/common';
|
|||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import YLPicker from '@/components/YLPicker.vue';
|
import YLPicker from '@/components/YLPicker.vue';
|
||||||
import { getPages } from '@/utils/public';
|
import { getPages } from '@/utils/public';
|
||||||
import { showConfirmDialog, showFailToast, showToast, Toast } from 'vant';
|
import { showConfirmDialog, showFailToast, showToast } from 'vant';
|
||||||
|
|
||||||
// 获取 Store 实例
|
// 获取 Store 实例
|
||||||
const counterStore = useCounterStore();
|
const counterStore = useCounterStore();
|
||||||
@@ -877,6 +877,7 @@ onBeforeMount(() => {
|
|||||||
height: 30px;
|
height: 30px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.introduction) {
|
:deep(.introduction) {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 230px;
|
width: 230px;
|
||||||
@@ -1074,8 +1075,10 @@ onBeforeMount(() => {
|
|||||||
:deep(.van-cell) {
|
:deep(.van-cell) {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-border {
|
.line-border {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -1085,6 +1088,7 @@ onBeforeMount(() => {
|
|||||||
transform: scaleY(0.5);
|
transform: scaleY(0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.survey-action {
|
.survey-action {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user