Commit 71002ae8 authored by songrui's avatar songrui

请求修改

parent 9e013cf0
<svg width="15" height="14" viewBox="0 0 15 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.50001 13.6666C3.81801 13.6666 0.833344 10.682 0.833344 6.99998C0.833344 3.31798 3.81801 0.333313 7.50001 0.333313C11.182 0.333313 14.1667 3.31798 14.1667 6.99998C14.1667 10.682 11.182 13.6666 7.50001 13.6666ZM6.83534 9.66665L11.5487 4.95265L10.606 4.00998L6.83534 7.78131L4.94934 5.89531L4.00668 6.83798L6.83534 9.66665Z" fill="#1890FF"/>
</svg>
......@@ -10,6 +10,11 @@ const routes = [
path: 'screening/simple/form',
name: 'tumour-screening-simple-form',
component: () => import(/* webpackChunkName: "page-tumour" */ '@/tumour/screening/simple/form/Index.vue')
},
{
path: 'screening/simple/result',
name: 'tumour-screening-simple-result',
component: () => import(/* webpackChunkName: "page-tumour" */ '@/tumour/screening/simple/form/Result.vue')
}
]
},
......
import axios from 'axios'
import { showFailToast, showLoadingToast, closeToast } from 'vant'
import { showFailToast, showLoadingToast } from 'vant'
const baseAxios = axios.create({
baseURL: '',
......@@ -8,6 +8,8 @@ const baseAxios = axios.create({
// 加载标志计数
let loadingList = 0
let loadingToast = null
let errorMark = 0
export function fetchBase({
url = '',
......@@ -26,7 +28,7 @@ export function fetchBase({
return new Promise((resolve, reject) => {
if (loading) {
loadingList++
showLoadingToast({ message: '加载中...', forbidClick: true, duration: 0 })
loadingToast = showLoadingToast({ message: '请求中', forbidClick: true, duration: 0 })
}
baseAxios({
method: method,
......@@ -39,21 +41,29 @@ export function fetchBase({
}).then(function (response) {
const data = response.data || {}
if (data.code !== 'SUCCESS') {
showFailToast('请求失败')
errorMark++
reject(data)
return
}
resolve(data)
}).catch(function (err) {
showFailToast('请求失败')
errorMark++
reject(err)
}).finally(() => {
console.log(33)
if (loading) {
loadingList--
if (loadingList <= 0) {
closeToast()
if (loadingList <= 0 && loadingToast) {
loadingToast.close()
loadingToast = null
}
}
if (errorMark) {
setTimeout(() => {
showFailToast('请求失败')
}, 300)
errorMark = 0
}
})
})
}
......@@ -25,6 +25,8 @@
import BaseForm from './base.vue'
import QuestionForm from './Question.vue'
import { showNotify } from 'vant'
import { addSimpleScreen } from '@/tumour/api/screening.js'
import { fetchDataHandle } from '@/utils/common.js'
export default {
components: {
......@@ -77,7 +79,15 @@ export default {
details: res,
createdUserId: this.doctorId
}
console.log(result)
const query = fetchDataHandle(result, {
species: 'arrToStr'
})
console.log(query)
addSimpleScreen(query).then(() => {
this.$router.replace({
name: 'tumour-screening-simple-result'
})
})
})
}
}
......
<template>
<div class="form-result">
<div class="flex align-center justify-center" style="padding-top: 14vh;">
<doc-icon type="doc-check-circle" class="text-16"/>
<span class="ml-1">提交成功</span>
</div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="less" scoped>
</style>
......@@ -82,8 +82,7 @@
/>
</van-popup>
<van-field required
v-model="form.educationTrans"
<van-field v-model="form.educationTrans"
is-link
readonly
name="education"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment