Browse Source

修改util请求方法

master
396316021 1 year ago
parent
commit
a32472ed91
  1. 2
      config/host.js
  2. 2
      pages/Login/index.vue
  3. 126
      pages/OrderDetail/index.vue
  4. 6
      utils/request.js
  5. 11
      utils/requestOther.js

2
config/host.js

@ -1,7 +1,9 @@
// const host='http://192.168.2.92:9505/api'
// const host='https://weiyang.test.scyp.ink/api'
const host='https://wechat.wwxtx.com/api'
// const host='https://bml.test.scyp.ink/api'
// const host='http://192.168.2.92:9503/api'
// const imghost='https://weiyang.test.scyp.ink/static/image'
const imghost='https://wechat.wwxtx.com/static/image'
const title = '汪汪行天下'
const oss = 'https://pet-feed.'+'oss-cn-chengdu.aliyuncs.com'

2
pages/Login/index.vue

@ -31,7 +31,7 @@
height="88"
>
<!-- <u-icon name="weixin-fill" size="50" color="#fff" class="weixin-icon"></u-icon>-->
<u-text text="登录" color="#fff" size="32" align="center" prefix-icon="weixin-fill" :icon-style="{fontSize:'50rpx',color:'#ffffff',marginRight:'5rpx'}" custom-style="display:inline;"></u-text>
<u-text text="手机号快捷登录" color="#fff" size="32" align="center" custom-style="display:inline;"></u-text>
</u-button>
<u-button
v-else

126
pages/OrderDetail/index.vue

@ -190,7 +190,7 @@
<view class="pet-detail-background"></view>
</view>
</view>
<view v-if="service?.startservice && Object.keys(service.startservice).length > 0 " class="pet-detail-bottom-container">
<view v-if="service?.startservice && service.startservice.id > 0 " class="pet-detail-bottom-container">
<view class="pet-detail-container">
<view class="pet-detail-gun col">
@ -207,10 +207,10 @@
<FomItem @showBigImage="showBigImage" @showBigVideo="showBigVideo" :data="service.startservice.service_tools" name="服务工具" type="text"></FomItem>
</view>
<view class="pet-detail-background"></view>
<!-- <view class="pet-detail-background"></view>-->
</view>
</view>
<view v-if="service.endservice && Object.keys(service.endservice).length > 0" class="pet-detail-bottom-container">
<view v-if="service.endservice && service.endservice.id > 0" class="pet-detail-bottom-container">
<view class="pet-detail-container">
<view class="pet-detail-gun col">
<image class="img" mode="heightFix" :src="staticImage.petGun"/>
@ -367,8 +367,56 @@
],
detail:{},
service:{
startservice:{},
endservice:{},
startservice:{
id:'',
needTime:'',
arrival_time :'',
worker_confirm:[],
hand_disinfect:[],
body_disinfect:[],
key:[],
key_info :'',
service_tools:'',
},
endservice:{
id: '',
appliance: {option: '', remark: '', upload: []},
before_status: {option: '', remark: '', upload: []},
pet_status: {option: '', remark: '', upload: []},
food_status: {food_option: '', water_option: '', remark: '', upload: []},
sick: {option: '', remark: '', upload: []},
excrement: {option: '', remark: '', upload: []},
other: {option: '', remark: '', upload: []},
food_bowl: {value: 0, remark: '', upload: []},
basin: {value: 0, remark: '', upload: []},
staple_food: {option: '', type_option: '', remark: '', upload: []},
water: {option: '', remark: '', upload: []},
snacks: {option: '', remark: '', upload: []},
wowo: {option: '', remark: '', upload: []},
cage: {option: '', remark: '', upload: []},
hair: {option: '', remark: '', upload: []},
pet_sick: {option: '', remark: '', upload: []},
pet_excrement: {option: '', remark: '', upload: []},
cat_litter: {option: '', remark: '', upload: []},
other_info: {option: '', remark: '', upload: []},
foundation: {option: '', remark: '', upload: []},
health: '',
health_other: {option: '', remark: '', upload: []},
pet_clean: {option: '', remark: '', upload: []},
before_facial: {option: '', remark: '', upload: []},
pet_facial: {option: '', remark: '', upload: []},
end_facial: {option: '', remark: '', upload: []},
home_play: {option: '', remark: '', upload: []},
out_play: {option: '', number_option: '', feces_option: '', in_home_option: '', remark: '', upload: []},
trash: {option: '', remark: '', upload: []},
appliance_info: {option: '', remark: '', upload: []},
pet_secure: {option: '', remark: '', upload: []},
close: {option: '', remark: '', upload: []},
close_mima: {option: '', remark: '', upload: []},
key: {option: '', remark: '', upload: []},
leave: '',
goOutTime: ''
}
},
id:0,
}
@ -424,8 +472,60 @@
},
getOrderServiceInfo(id){
orderServiceInfo(id).then(res => {
this.service.startservice =res.data.startservice;
this.service.endservice =res.data.endservice;
// this.service =res.data;
// this.service.startservice = res.data.startservice;
// this.service.startservice = res.data.endservice;
this.service.startservice.id = res.data.startservice.id;
this.service.startservice.needTime = res.data.startservice.needTime;
this.service.startservice.arrival_time = res.data.startservice.arrival_time;
this.service.startservice.worker_confirm = res.data.startservice.worker_confirm;
this.service.startservice.hand_disinfect = res.data.startservice.hand_disinfect;
this.service.startservice.body_disinfect = res.data.startservice.body_disinfect;
this.service.startservice.key = res.data.startservice.key;
this.service.startservice.key_info = res.data.startservice.key_info;
this.service.startservice.service_tools = res.data.startservice.service_tools;
this.service.endservice.id = res.data.endservice.id;
this.service.endservice.appliance = res.data.endservice.appliance;
this.service.endservice.before_status = res.data.endservice.before_status;
this.service.endservice.pet_status = res.data.endservice.pet_status;
this.service.endservice.food_status = res.data.endservice.food_status;
this.service.endservice.sick = res.data.endservice.sick;
this.service.endservice.excrement = res.data.endservice.excrement;
this.service.endservice.other = res.data.endservice.other;
this.service.endservice.food_bowl = res.data.endservice.food_bowl;
this.service.endservice.basin = res.data.endservice.basin;
this.service.endservice.staple_food = res.data.endservice.staple_food;
this.service.endservice.water = res.data.endservice.water;
this.service.endservice.snacks = res.data.endservice.snacks;
this.service.endservice.wowo = res.data.endservice.wowo;
this.service.endservice.cage = res.data.endservice.cage;
this.service.endservice.hair = res.data.endservice.hair;
this.service.endservice.pet_sick = res.data.endservice.pet_sick;
this.service.endservice.pet_excrement = res.data.endservice.pet_excrement;
this.service.endservice.cat_litter = res.data.endservice.cat_litter;
this.service.endservice.other_info = res.data.endservice.other_info;
this.service.endservice.foundation = res.data.endservice.foundation;
this.service.endservice.health = res.data.endservice.health;
this.service.endservice.health_other = res.data.endservice.health_other;
this.service.endservice.pet_clean = res.data.endservice.pet_clean;
this.service.endservice.before_facial = res.data.endservice.before_facial;
this.service.endservice.pet_facial = res.data.endservice.pet_facial;
this.service.endservice.end_facial = res.data.endservice.end_facial;
this.service.endservice.home_play = res.data.endservice.home_play;
this.service.endservice.out_play = res.data.endservice.out_play;
this.service.endservice.trash = res.data.endservice.trash;
this.service.endservice.appliance_info = res.data.endservice.appliance_info;
this.service.endservice.pet_secure = res.data.endservice.pet_secure;
this.service.endservice.close = res.data.endservice.close;
this.service.endservice.close_mima = res.data.endservice.close_mima;
this.service.endservice.key = res.data.endservice.key;
})
}
},
@ -439,7 +539,17 @@
created() {
this.pagePadding = (api.navHeight().navPaddingTop +
api.navHeight().navHeight + (api.navHeight().headerPadding * 2))
}
},
computed:{
// service :{
// get(){
// return this.services;
// },
// set(newValue){
// this.services = newValue;
// },
// }
},
}
</script>

6
utils/request.js

@ -4,10 +4,12 @@ const service = (params) => {
return new Promise((relove, reject) => {
let token=uni.getStorageSync('token')
let user=uni.getStorageSync('user')
// console.log(params.url)
if (!/^http/.test(params.url)){
params.url = `${host}/${params.url}`.replace(/(?<!:)\/{2,}/, '/')
// const rExp = new RegExp("(?<!:)\\/{2,}", 'g');
params.url = 'https://'+(host+ '/' +params.url).replace('https://', '').replace('//', '/')
}
// console.log(params.url)
uni.request({
url: params.url,
data: params.data,

11
utils/requestOther.js

@ -4,13 +4,14 @@ const service = (params) => {
return new Promise((relove, reject) => {
let token=uni.getStorageSync('token')
let user=uni.getStorageSync('user')
try{
// try{
if (!/^http/.test(params.url)) {
params.url = `${host}/${params.url}`.replace(/(?<!:)\/{2,}/, '/')
// const rExp = new RegExp("(?<!:)\\/{2,}", 'g');
params.url = host+ '/' +(params.url.replace('//', '/'))
}
}catch (e){
console.log(e)
}
// }catch (e){
// console.log(e)
// }
uni.request({
url: params.url,

Loading…
Cancel
Save