|
@@ -3592,8 +3592,23 @@ export default {
|
|
|
close() {
|
|
close() {
|
|
|
this.product.open = false
|
|
this.product.open = false
|
|
|
},
|
|
},
|
|
|
|
|
+ safeParseConfig(configValue, fallback = {}) {
|
|
|
|
|
+ if (configValue === null || configValue === undefined || configValue === '' || configValue === 'null') {
|
|
|
|
|
+ return fallback
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ const parsed = JSON.parse(configValue)
|
|
|
|
|
+ if (parsed === null || parsed === undefined) {
|
|
|
|
|
+ return fallback
|
|
|
|
|
+ }
|
|
|
|
|
+ return parsed
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ return fallback
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
getConfigByKey(key) {
|
|
getConfigByKey(key) {
|
|
|
getConfigByKey(key).then(response => {
|
|
getConfigByKey(key).then(response => {
|
|
|
|
|
+ const configValue = response && response.data ? response.data.configValue : null
|
|
|
if(!!response.data){
|
|
if(!!response.data){
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
@@ -3602,39 +3617,39 @@ export default {
|
|
|
this.configKey = key;
|
|
this.configKey = key;
|
|
|
}
|
|
}
|
|
|
if (key == 'sys.oss.cloudStorage') {
|
|
if (key == 'sys.oss.cloudStorage') {
|
|
|
- this.form1 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form1 = this.safeParseConfig(configValue, { ...this.form1 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.inquiryConfig') {
|
|
if (key == 'his.inquiryConfig') {
|
|
|
- this.form2 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form2 = this.safeParseConfig(configValue, { ...this.form2 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.agreementConfig') {
|
|
if (key == 'his.agreementConfig') {
|
|
|
- this.form3 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form3 = this.safeParseConfig(configValue, { ...this.form3 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.certs') {
|
|
if (key == 'his.certs') {
|
|
|
- this.form4 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form4 = this.safeParseConfig(configValue, { ...this.form4 })
|
|
|
if (this.form4.certs != null) {
|
|
if (this.form4.certs != null) {
|
|
|
this.photoArr = this.form4.certs.split(',')
|
|
this.photoArr = this.form4.certs.split(',')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (key == 'his.brokerage') {
|
|
if (key == 'his.brokerage') {
|
|
|
- this.form5 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form5 = this.safeParseConfig(configValue, { ...this.form5 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.coupon') {
|
|
if (key == 'his.coupon') {
|
|
|
allList().then(response => {
|
|
allList().then(response => {
|
|
|
this.couponList = response.data
|
|
this.couponList = response.data
|
|
|
})
|
|
})
|
|
|
- this.form6 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form6 = this.safeParseConfig(configValue, { ...this.form6 })
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
if (key == 'his.store') {
|
|
if (key == 'his.store') {
|
|
|
- this.form7 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form7 = this.safeParseConfig(configValue, { ...this.form7 })
|
|
|
getAllFollowTempName().then(response => {
|
|
getAllFollowTempName().then(response => {
|
|
|
this.tempOptions = response.rows
|
|
this.tempOptions = response.rows
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
if (key == 'his.store') {
|
|
if (key == 'his.store') {
|
|
|
// this.form7 =JSON.parse(response.data.configValue);
|
|
// this.form7 =JSON.parse(response.data.configValue);
|
|
|
- const parsed = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ const parsed = this.safeParseConfig(configValue, { ...this.form7 })
|
|
|
if (parsed.isUpdateOrder != null) {
|
|
if (parsed.isUpdateOrder != null) {
|
|
|
parsed.isUpdateOrder = Number(parsed.isUpdateOrder)
|
|
parsed.isUpdateOrder = Number(parsed.isUpdateOrder)
|
|
|
} else {
|
|
} else {
|
|
@@ -3643,71 +3658,72 @@ export default {
|
|
|
this.form7 = parsed
|
|
this.form7 = parsed
|
|
|
}
|
|
}
|
|
|
if (key == 'his.package') {
|
|
if (key == 'his.package') {
|
|
|
- this.form8 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form8 = this.safeParseConfig(configValue, { ...this.form8 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.pay') {
|
|
if (key == 'his.pay') {
|
|
|
- this.form9 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form9 = this.safeParseConfig(configValue, { ...this.form9 })
|
|
|
}
|
|
}
|
|
|
if (key == 'store.pay') {
|
|
if (key == 'store.pay') {
|
|
|
- this.form23 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form23 = this.safeParseConfig(configValue, { ...this.form23 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.appShow') {
|
|
if (key == 'his.appShow') {
|
|
|
- this.form10 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form10 = this.safeParseConfig(configValue, { ...this.form10 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.integral') {
|
|
if (key == 'his.integral') {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if (key == 'his.sign') {
|
|
if (key == 'his.sign') {
|
|
|
- this.form12 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form12 = this.safeParseConfig(configValue, { ...this.form12 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.config') {
|
|
if (key == 'his.config') {
|
|
|
this.getCompanyOptions()
|
|
this.getCompanyOptions()
|
|
|
- this.form13 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form13 = this.safeParseConfig(configValue, { ...this.form13 })
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
if (key == 'store.config') {
|
|
if (key == 'store.config') {
|
|
|
- this.form17 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form17 = this.safeParseConfig(configValue, { ...this.form17 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.sms') {
|
|
if (key == 'his.sms') {
|
|
|
- this.form14 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form14 = this.safeParseConfig(configValue, { ...this.form14 })
|
|
|
}
|
|
}
|
|
|
if (key == 'qw:config') {
|
|
if (key == 'qw:config') {
|
|
|
- this.form15 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form15 = this.safeParseConfig(configValue, { ...this.form15 })
|
|
|
}
|
|
}
|
|
|
if (key == 'his.brand') {
|
|
if (key == 'his.brand') {
|
|
|
- this.form16 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form16 = this.safeParseConfig(configValue, { ...this.form16 })
|
|
|
console.log(this.form16)
|
|
console.log(this.form16)
|
|
|
}
|
|
}
|
|
|
if (key == 'course.config') {
|
|
if (key == 'course.config') {
|
|
|
- this.form18 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form18 = this.safeParseConfig(configValue, { ...this.form18 })
|
|
|
}
|
|
}
|
|
|
if (key == 'redPacket.config') {
|
|
if (key == 'redPacket.config') {
|
|
|
- this.form19 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form19 = this.safeParseConfig(configValue, { ...this.form19 })
|
|
|
}
|
|
}
|
|
|
if (key == 'qwRating.config') {
|
|
if (key == 'qwRating.config') {
|
|
|
- this.form20 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form20 = this.safeParseConfig(configValue, { ...this.form20 })
|
|
|
}
|
|
}
|
|
|
if (key == 'courseMa.config') {
|
|
if (key == 'courseMa.config') {
|
|
|
this.courseMaConfigLoading = true
|
|
this.courseMaConfigLoading = true
|
|
|
if (response.data && response.data.configValue) {
|
|
if (response.data && response.data.configValue) {
|
|
|
- this.courseMaConfigList = JSON.parse(response.data.configValue).map(item => ({
|
|
|
|
|
|
|
+ const parsedCourseMaConfigList = this.safeParseConfig(configValue, [])
|
|
|
|
|
+ this.courseMaConfigList = Array.isArray(parsedCourseMaConfigList) ? parsedCourseMaConfigList.map(item => ({
|
|
|
...item,
|
|
...item,
|
|
|
editing: false
|
|
editing: false
|
|
|
- }))
|
|
|
|
|
|
|
+ })) : []
|
|
|
} else {
|
|
} else {
|
|
|
this.courseMaConfigList = []
|
|
this.courseMaConfigList = []
|
|
|
}
|
|
}
|
|
|
this.courseMaConfigLoading = false
|
|
this.courseMaConfigLoading = false
|
|
|
}
|
|
}
|
|
|
if (key == 'his.login') {
|
|
if (key == 'his.login') {
|
|
|
- this.form22 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form22 = this.safeParseConfig(configValue, { ...this.form22 })
|
|
|
}
|
|
}
|
|
|
if (key === 'his.healthIndexConfig') {
|
|
if (key === 'his.healthIndexConfig') {
|
|
|
- this.form26 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form26 = this.safeParseConfig(configValue, { ...this.form26 })
|
|
|
} else if (key == 'store.concept') {
|
|
} else if (key == 'store.concept') {
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form21 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form21 = this.safeParseConfig(configValue, { ...this.form21 })
|
|
|
if (this.form21.images != null) {
|
|
if (this.form21.images != null) {
|
|
|
this.images = this.form21.images.split(',')
|
|
this.images = this.form21.images.split(',')
|
|
|
}
|
|
}
|
|
@@ -3715,48 +3731,48 @@ export default {
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
console.log(response.data.configValue)
|
|
console.log(response.data.configValue)
|
|
|
- this.form24 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form24 = this.safeParseConfig(configValue, { ...this.form24 })
|
|
|
console.log(this.form24.sign)
|
|
console.log(this.form24.sign)
|
|
|
} else if (key == 'app.config') {
|
|
} else if (key == 'app.config') {
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form25 = JSON.parse(response.data.configValue)
|
|
|
|
|
|
|
+ this.form25 = this.safeParseConfig(configValue, { ...this.form25 })
|
|
|
if (this.form25.images != null) {
|
|
if (this.form25.images != null) {
|
|
|
this.appImages = this.form25.images.split(',')
|
|
this.appImages = this.form25.images.split(',')
|
|
|
}
|
|
}
|
|
|
}else if (key == 'medicalMall.func.switch') {
|
|
}else if (key == 'medicalMall.func.switch') {
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form27 = {...this.form27, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form27 = {...this.form27, ...this.safeParseConfig(configValue, {})}
|
|
|
console.log(this.form27)
|
|
console.log(this.form27)
|
|
|
}
|
|
}
|
|
|
if (key == 'his.zzzs') {
|
|
if (key == 'his.zzzs') {
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form28 = {...this.form28, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form28 = {...this.form28, ...this.safeParseConfig(configValue, {})}
|
|
|
}
|
|
}
|
|
|
if (key == 'randomRedpacket:config') {
|
|
if (key == 'randomRedpacket:config') {
|
|
|
if(!!response.data){
|
|
if(!!response.data){
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form29 = {...this.form29, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form29 = {...this.form29, ...this.safeParseConfig(configValue, {})}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (key == 'wx.config') {
|
|
if (key == 'wx.config') {
|
|
|
if(!!response.data){
|
|
if(!!response.data){
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form30 = {...this.form30, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form30 = {...this.form30, ...this.safeParseConfig(configValue, {})}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(key=="luckyBag.config"){
|
|
if(key=="luckyBag.config"){
|
|
|
console.log("----------"+response.data.configValue)
|
|
console.log("----------"+response.data.configValue)
|
|
|
- this.form36 =JSON.parse(response.data.configValue);
|
|
|
|
|
|
|
+ this.form36 = this.safeParseConfig(configValue, { ...this.form36 });
|
|
|
}
|
|
}
|
|
|
if (key == 'his.AppRedPacket') {
|
|
if (key == 'his.AppRedPacket') {
|
|
|
if (response.data && response.data.configValue) {
|
|
if (response.data && response.data.configValue) {
|
|
|
- this.form35 = JSON.parse(response.data.configValue);
|
|
|
|
|
|
|
+ this.form35 = this.safeParseConfig(configValue, { ...this.form35 });
|
|
|
} else {
|
|
} else {
|
|
|
// 如果没有配置,使用默认值
|
|
// 如果没有配置,使用默认值
|
|
|
this.form35 = {
|
|
this.form35 = {
|
|
@@ -3776,27 +3792,27 @@ export default {
|
|
|
this.configKey = response.data?.configKey || 'his.AppRedPacket';
|
|
this.configKey = response.data?.configKey || 'his.AppRedPacket';
|
|
|
}
|
|
}
|
|
|
if(key=="im.config"){
|
|
if(key=="im.config"){
|
|
|
- this.form34 =JSON.parse(response.data.configValue);
|
|
|
|
|
|
|
+ this.form34 = this.safeParseConfig(configValue, { ...this.form34 });
|
|
|
}
|
|
}
|
|
|
if(key == 'vc.config'){
|
|
if(key == 'vc.config'){
|
|
|
if(!!response.data){
|
|
if(!!response.data){
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form31 = {...this.form31, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form31 = {...this.form31, ...this.safeParseConfig(configValue, {})}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(key == 'living.config'){
|
|
if(key == 'living.config'){
|
|
|
if(!!response.data){
|
|
if(!!response.data){
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form32 = {...this.form32, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form32 = {...this.form32, ...this.safeParseConfig(configValue, {})}
|
|
|
console.log(this.form32 );
|
|
console.log(this.form32 );
|
|
|
}
|
|
}
|
|
|
}if(key == 'his.adminUi.config'){
|
|
}if(key == 'his.adminUi.config'){
|
|
|
if(!!response.data){
|
|
if(!!response.data){
|
|
|
this.configId = response.data.configId
|
|
this.configId = response.data.configId
|
|
|
this.configKey = response.data.configKey
|
|
this.configKey = response.data.configKey
|
|
|
- this.form33 = {...this.form33, ...JSON.parse(response.data.configValue)}
|
|
|
|
|
|
|
+ this.form33 = {...this.form33, ...this.safeParseConfig(configValue, {})}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|