lijuncheng
12 months ago
9 changed files with 270 additions and 120 deletions
@ -1,42 +1,119 @@ |
|||
<template> |
|||
<view class="" style="background-color: #fff; height: 100%;"> |
|||
<view class="" style="font-size: 35rpx;padding: 15rpx;"> |
|||
请求地址 |
|||
<view class="page-wraper"> |
|||
<view class="page-main" style="background-color: #fff; height: 100%;"> |
|||
|
|||
<pullDown label="项目名称" v-model="name" :options="arrayUnique(options,'name')" description='column' /> |
|||
|
|||
<pullDown label="服务器地址" v-model="value" :options="unique(options)" :itemTextCount="2" :isAutoHeight='true' |
|||
description='column' style="font-size: 35rpx;padding: 30rpx 0 0 0;" /> |
|||
|
|||
</view> |
|||
<!-- 页面底部 --> |
|||
<view class="page-footer"> |
|||
<button type="primary" @click="saveClick">保存</button> |
|||
</view> |
|||
<uni-combox :candidates="candidates" placeholder="请选择请求地址" v-model="city"></uni-combox> |
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
candidates:["http://192.168.0.178:12080/admin-api(陈放)", |
|||
"http://192.168.0.178:12080/admin-api" |
|||
], |
|||
city:"" |
|||
|
|||
name: '', |
|||
value: '', |
|||
|
|||
options: [{ |
|||
|
|||
name: '汽车镜备件', |
|||
desc: '汽车镜备件公司测试库', |
|||
value: 'http://192.168.0.178:12080/admin-api', |
|||
}, |
|||
{ |
|||
|
|||
name: '汽车镜备件', |
|||
desc: '汽车镜备件现场测试库', |
|||
value: 'http://192.168.0.178:12080/admin-api', |
|||
}, |
|||
{ |
|||
|
|||
name: '汽车镜备件', |
|||
desc: '汽车镜备件现场正式库', |
|||
value: 'http://192.168.0.178:12080/admin-api', |
|||
}, |
|||
{ |
|||
|
|||
name: '富维汽车镜', |
|||
desc: '汽车镜备件现场正式库', |
|||
value: 'http://192.168.0.178:12080/admin-api', |
|||
}, |
|||
], |
|||
}; |
|||
}, |
|||
|
|||
|
|||
onLoad(option) { |
|||
this.value = getApp().globalData.request_url; |
|||
}, |
|||
|
|||
|
|||
|
|||
methods: { |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
saveClick() { |
|||
getApp().globalData.request_url = this.value; |
|||
console.log(getApp().globalData.request_url); |
|||
// 调用uni.navigateBack()函数来返回上一页 |
|||
uni.navigateBack({ |
|||
delta: 1 // 表示返回到上一页,若需要返回多级页面则设置delta值为对应的级数 |
|||
}) |
|||
}, |
|||
|
|||
unique(arr) { |
|||
let that = this; |
|||
if (this.name == '') { |
|||
return this.options |
|||
} else { |
|||
return arr.filter(item => item.name === this.name); |
|||
} |
|||
|
|||
}, |
|||
|
|||
arrayUnique(arr, type) { |
|||
return arr ? [ |
|||
...new Set( |
|||
arr.map((item) => { |
|||
return item[type] |
|||
}) |
|||
) |
|||
] : [] |
|||
} |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.page-wraper { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
.page-main { |
|||
flex: 1; |
|||
position: relative; |
|||
} |
|||
|
|||
.page-footer { |
|||
color: #fff; |
|||
line-height: 100rpx; |
|||
/* 不放大不缩小固定100rpx */ |
|||
flex: 0 0 100rpx; |
|||
background-color: #00AAFF; |
|||
} |
|||
|
|||
.container { |
|||
background-color: #f5f7fa; |
|||
/* 这里只是作为样式展示 */ |
|||
} |
|||
</style> |
Loading…
Reference in new issue