Parcourir la source

修改请求地址

yxb
不甘寂寞 il y a 2 ans
Parent
révision
360a0119ff
2 fichiers modifiés avec 146 ajouts et 163 suppressions
  1. 144
    161
      after-sale/activation-once-again/select-car.vue
  2. 2
    2
      utils/network/request.js

+ 144
- 161
after-sale/activation-once-again/select-car.vue Voir le fichier

@@ -1,171 +1,154 @@
<template>
<view class="selectCar-box">
<view v-if="state.list.length>0" @click="choose(i,item)" class="item" v-for="(item,i) in state.list" :key="i">
<view class="iten-left">
<image :src="`${$imgUrl}che.png`" mode=""></image>
<text>{{item.vehiclePlate}}</text>
</view>
<view class="choose-item">
<view class="active" v-if="flag==i">
</view>
</view>
</view>
<view v-else class="flex">
暂无车辆订单信息
</view>
</view>
<view class="selectCar-box">
<view
v-if="state.list.length > 0"
@click="choose(i, item)"
class="item"
v-for="(item, i) in state.list"
:key="i"
>
<view class="iten-left">
<image :src="`${$imgUrl}che.png`" mode=""></image>
<text>{{ item.vehiclePlate }}</text>
</view>
<view class="choose-item">
<view class="active" v-if="flag == i"> </view>
</view>
</view>
<view v-else class="flex"> 暂无车辆订单信息 </view>
</view>
</template>

<script lang="ts" setup>
import {
reactive,
ref
} from "vue"
import {
navTo
} from "@/utils/utils"
import {
onLoad,
onShow
} from "@dcloudio/uni-app";
import {
orderList
} from "@/utils/network/api.js";
import {
request
} from "@/utils/network/request.js";
import {
msg
} from "@/utils/utils";
import {
getItem,
StorageKeys,
setItem
} from "@/utils/storage";
import {
stringToJson
} from "@/utils/network/encryption";

const state = reactive({
list: []
});
onLoad(() => {
quanCheckActionTrue().then((item: any) => {
state.list = item.data
console.log(item)
})
});

const quanCheckActionTrue = () => {
var data = {
opId: getItem(StorageKeys.OpenId),
source: 'WECHAT',
tabIndex: '0',
orderStep: '11',
isValueCard: '2'
};
const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
return new Promise(async (resolve, reject) => {
const res = await request(orderList, options);
const data = stringToJson(res.bizContent);
resolve(data);
}).catch((error) => {
reject(error);
});
}
const list = reactive([{
name: "A12345"
},
{
name: "B12345"
},
{
name: "C12345"
},
])
const flag = ref('0')

const choose = (i, item) => {
console.log(item.cardId)
navTo(`/after-sale/activation-once-again/activation-once-again?id=${item.id}`)
}
import { reactive, ref } from "vue";
import { navTo } from "@/utils/utils";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { orderList } from "@/utils/network/api.js";
import { request } from "@/utils/network/request.js";
import { msg } from "@/utils/utils";
import { getItem, StorageKeys, setItem } from "@/utils/storage";
import { stringToJson } from "@/utils/network/encryption";

const state = reactive({
list: [],
});
onLoad(() => {
quanCheckActionTrue().then((item: any) => {
state.list = item.data;
console.log(item);
});
});

const quanCheckActionTrue = () => {
var data = {
opId: getItem(StorageKeys.OpenId),
source: "WECHAT",
tabIndex: "0",
orderStep: "11",
isValueCard: "2",
};
const options = {
type: 2,
data: data,
method: "POST",
showLoading: true,
};
return new Promise(async (resolve, reject) => {
const res = await request(orderList, options);
const data = stringToJson(res.bizContent);

resolve(data);
}).catch((error) => {
reject(error);
});
};
const list = reactive([
{
name: "A12345",
},
{
name: "B12345",
},
{
name: "C12345",
},
]);
const flag = ref("0");

const choose = (i, item) => {
console.log(item.cardId);
navTo(
`/after-sale/activation-once-again/activation-once-again?id=${item.id}`
);
};
</script>

<style>
page {
width: 100%;
height: 100%;
background-color: #EEF7F7;
}
page {
width: 100%;
height: 100%;
background-color: #eef7f7;
}
</style>
<style lang="scss" scoped>
.flex {
display: flex;
justify-content: center;
}

.selectCar-box {
// width: 100%;
height: 100%;
padding: 30rpx;

.item {
padding: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 130rpx;
background: #FFFFFF;
box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
border-radius: 20rpx;
margin-bottom: 30rpx;

.iten-left {
display: flex;
align-items: center;

image {
width: 150rpx;
height: 90rpx;

}

text {
margin-left: 20rpx;
font-size: 32rpx;
font-family: Noto Sans S Chinese;
font-weight: 400;
color: #333333;
}
}

.choose-item {
width: 44rpx;
height: 44rpx;
background: #FFFFFF;
border: 2rpx solid #00B38B;
border-radius: 50%;
margin-right: 20rpx;
display: flex;
justify-content: center;
align-items: center;
box-sizing: content-box;
}

.active {
width: 34rpx;
height: 34rpx;
background: #00B38B;
border-radius: 50%;
}

}


}
.flex {
display: flex;
justify-content: center;
}

.selectCar-box {
// width: 100%;
height: 100%;
padding: 30rpx;

.item {
padding: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 130rpx;
background: #ffffff;
box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
border-radius: 20rpx;
margin-bottom: 30rpx;

.iten-left {
display: flex;
align-items: center;

image {
width: 150rpx;
height: 90rpx;
}

text {
margin-left: 20rpx;
font-size: 32rpx;
font-family: Noto Sans S Chinese;
font-weight: 400;
color: #333333;
}
}

.choose-item {
width: 44rpx;
height: 44rpx;
background: #ffffff;
border: 2rpx solid #00b38b;
border-radius: 50%;
margin-right: 20rpx;
display: flex;
justify-content: center;
align-items: center;
box-sizing: content-box;
}

.active {
width: 34rpx;
height: 34rpx;
background: #00b38b;
border-radius: 50%;
}
}
}
</style>

+ 2
- 2
utils/network/request.js Voir le fichier

@@ -35,8 +35,8 @@ export function request(code, options = {}) {
}
//Url 地址
//options.url = envs[process.env.NODE_ENV].baseUrl || '' + options.url
options.url = 'http://192.168.100.63:8087/ifzt/api/interfaceMidGroundIn'
// options.url = 'http://222.85.144.89:19002/ifzt/api/interfaceMidGroundIn'
// options.url = 'http://192.168.100.63:8087/ifzt/api/interfaceMidGroundIn'
options.url = 'http://222.85.144.89:19002/ifzt/api/interfaceMidGroundIn'
//判断baseUri是否为空
if (options.baseUrl) {
options.url = options.baseUrl

Chargement…
Annuler
Enregistrer