Commit b14fe58b by 严立

列表查看公告详情方式优化 | 添加中标信息类型 | 供应商地址异常处理

parent 2da8c6e0
import iVue from '../../../main.js'
import iHost from '../host.js'
let timerClose = 0
let loading = null
let loadingFilter = [
'bid/order/queryState', // 查询支付状态
'bid/common/getImgCode', // 获取图片验证
]
let output = {
/**
* 请求拦截器
* @function
* @param {object} funcConfigure - 请求配置
* @returns {boolean}
*/
request: function (funXmlHttpRequest, funcConfigure, funcUrl) {
funcUrl = funcUrl.replace(iHost.base, '')
// 只有不被过滤的接口才会显示加载动画
if (loadingFilter.indexOf(funcUrl) === -1) {
if (loading === null) {
loading = iVue.$loading({ lock: false, text: 'Loading', spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.7)' })
}
if (timerClose !== 0) {
clearTimeout(timerClose)
}
}
// 默认添加 token 属性
if (funcConfigure.isToken) {
funXmlHttpRequest.setRequestHeader('token', localStorage.getItem('token'))
}
},
/**
* 响应拦截器
* @function
* @param {object} funcConfigure - 请求配置
* @param {object} funcResult - 响应数据
* @returns {boolean}
*/
response: function (funcConfigure, funcResult) {
if (loading) {
timerClose = setTimeout(() => {
if (loading) {
loading.close()
}
loading = null
clearTimeout(timerClose)
}, 500)
}
let funcDataType = ''
try {
JSON.parse(funcResult)
funcDataType = 'object'
}
catch (funcError) {
funcDataType = 'other'
}
if (funcDataType === 'object') {
let funcResultData = JSON.parse(funcResult)
switch (Number(funcResultData.code)) {
case 10001:
console.log('token overdue')
this.$store.commit('isSignIn', false)
this.$store.commit('redirectPath', null)
localStorage.clear()
iVue.$router.push('/')
return { state: false, response: { message: funcResultData.msg }}
break
// 请求正常直接返回 data 内容
case 200:
return { state: true, response: funcResultData.data}
break
// 请求正常直接返回 data 内容
case 400:
return { state: false, response: { message: funcResultData.msg, data: funcResultData.data }}
break
// 请求异常返回 msg 错误提示
default:
return { state: false, response: { message: funcResultData.msg }}
break
}
}
return funcResult
}
}
export default output
import iVue from '../../../main.js'
import iHost from '../host.js'
let timerClose = 0
let loading = null
let loadingFilter = [
'bid/order/queryState', // 查询支付状态
'bid/common/getImgCode', // 获取图片验证
]
let output = {
/**
* 请求拦截器
* @function
* @param {object} funcConfigure - 请求配置
* @returns {boolean}
*/
request: function (funXmlHttpRequest, funcConfigure, funcUrl) {
funcUrl = funcUrl.replace(iHost.base, '')
// 只有不被过滤的接口才会显示加载动画
if (loadingFilter.indexOf(funcUrl) === -1) {
if (loading === null) {
loading = iVue.$loading({ lock: false, text: 'Loading', spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.7)' })
}
if (timerClose !== 0) {
clearTimeout(timerClose)
}
}
// 默认添加 token 属性
if (funcConfigure.isToken) {
funXmlHttpRequest.setRequestHeader('token', localStorage.getItem('token'))
}
},
/**
* 响应拦截器
* @function
* @param {object} funcConfigure - 请求配置
* @param {object} funcResult - 响应数据
* @returns {boolean}
*/
response: function (funcConfigure, funcResult) {
if (loading) {
timerClose = setTimeout(() => {
if (loading) {
loading.close()
}
loading = null
clearTimeout(timerClose)
}, 500)
}
let funcDataType = ''
try {
JSON.parse(funcResult)
funcDataType = 'object'
}
catch (funcError) {
funcDataType = 'other'
}
if (funcDataType === 'object') {
let funcResultData = JSON.parse(funcResult)
switch (Number(funcResultData.code)) {
case 10001:
console.log('token overdue')
this.$store.commit('isSignIn', false)
this.$store.commit('redirectPath', null)
localStorage.clear()
iVue.$router.push('/')
return { state: false, response: { message: funcResultData.msg }}
break
// 请求正常直接返回 data 内容
case 200:
if (funcResultData.msg === '登录失效') {
return { state: false, response: { message: funcResultData.msg }}
}
return { state: true, response: funcResultData.data}
break
// 请求正常直接返回 data 内容
case 400:
return { state: false, response: { message: funcResultData.msg, data: funcResultData.data }}
break
// 请求异常返回 msg 错误提示
default:
return { state: false, response: { message: funcResultData.msg }}
break
}
}
return funcResult
}
}
export default output
......@@ -1103,7 +1103,7 @@
}
.bidding-news-detail-html {
width: 100%;
height: 40px;
height: 38px;
margin-top: 20px;
font-size: @fontSize01 !important;
overflow: hidden;
......
......@@ -230,11 +230,13 @@
'examineReason': funcResponse.reason,
}
// 判断地址数据类型,同时兼容字符串与数组类型
if (Object.prototype.toString.call(funcResponse.receiveArea) === '[object String]') {
this.formInfo.receiveArea = JSON.parse(funcResponse.receiveArea).join(' ')
} else {
this.formInfo.receiveArea = funcResponse.receiveArea.join(' ')
if (funcResponse.receiveArea) {
// 判断地址数据类型,同时兼容字符串与数组类型
if (Object.prototype.toString.call(funcResponse.receiveArea) === '[object String]') {
this.formInfo.receiveArea = JSON.parse(funcResponse.receiveArea).join(' ')
} else {
this.formInfo.receiveArea = funcResponse.receiveArea.join(' ')
}
}
console.log(this.formInfo)
......
......@@ -852,7 +852,6 @@
* @returns
*/
onQuoteSubmit: function () {
console.log(JSON.stringify(this.tableQuote))
if (this.tableQuote.length === 0) {
this.$message.error('请填写完整报价信息')
return
......@@ -893,7 +892,8 @@
'biddingOffers': JSON.stringify(funcQuoteData)
}
let funcOther = iRequest.request(iHost.base + 'bid/zBiddingProject/biddingOffer', funcParam, 'json', 'post')
console.log('promise begin')
iRequest.request(iHost.base + 'bid/zBiddingProject/biddingOffer', funcParam, 'json', 'post')
.then((funcResponse) => {
this.winQuote = false
this.$message({ message: '报价成功!', type: 'success' })
......
......@@ -283,25 +283,26 @@
if (funcResponse.orderBilling) {
this.isReceive = !Boolean(Number(funcResponse.orderBilling.receiveType))
this.componentReceive = {
'name': funcResponse.orderBilling.name,
'phone': funcResponse.orderBilling.phone,
'area': '',
'address': funcResponse.orderBilling.address,
}
if (this.isReceive) {
this.componentReceive = {
'name': funcResponse.orderBilling.name ? funcResponse.orderBilling.name : '暂无',
'phone': funcResponse.orderBilling.phone ? funcResponse.orderBilling.phone : '暂无',
'area': '',
'address': funcResponse.orderBilling.address ? funcResponse.orderBilling.address : '暂无',
}
// 判断地址数据类型,同时兼容字符串与数组类型
if (Object.prototype.toString.call(funcResponse.orderBilling.area) === '[object String]') {
this.componentReceive.area = JSON.parse(funcResponse.orderBilling.area).join(' ')
} else {
this.componentReceive.area = funcResponse.orderBilling.area.join(' ')
// 判断地址数据类型,同时兼容字符串与数组类型
if (funcResponse.orderBilling.area) {
if (Object.prototype.toString.call(funcResponse.orderBilling.area) === '[object String]') {
this.componentReceive.area = JSON.parse(funcResponse.orderBilling.area).join(' ')
} else {
this.componentReceive.area = funcResponse.orderBilling.area.join(' ')
}
}
}
} else {
this.isReceive = false
}
console.log(this.isReceive)
console.log(this.componentProject.isPackage)
if (this.componentProject.isPackage) {
// 多个合同
let funcRawData = funcResponse.order.tenderPackages
......@@ -313,6 +314,7 @@
'price': funcRawData[i].price,
}
this.componentContract.push(funcItem)
console.log('this.componentContract', this.componentContract)
}
} else {
this.componentContract.push({ 'price': funcResponse.order.price })
......
......@@ -469,7 +469,7 @@
* @returns
*/
reset: function () {
this.state = 3
this.state = 1
this.formRegister = {
// 基本信息
companyName: '',
......
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 sign in to comment