214 lines
4.3 KiB
Vue
214 lines
4.3 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="container">
|
|
<view class="bai-box">
|
|
<view style="margin-bottom: 10px;">驾校图片</view>
|
|
<view class="">
|
|
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
|
|
:maxCount="10"></u-upload>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="bai-box">
|
|
<view class="k-bs">
|
|
<view class="">驾校名称</view>
|
|
<view class="right_box">
|
|
<input type="text" placeholder="请输入" />
|
|
</view>
|
|
|
|
</view>
|
|
<view class="k-bs">
|
|
<view class="">驾校标签</view>
|
|
<view class="right_box">
|
|
<input type="text" placeholder="请输入" />
|
|
</view>
|
|
|
|
</view>
|
|
<view class="k-bs">
|
|
<view class="">驾校电话</view>
|
|
<view class="right_box">
|
|
<input type="text" placeholder="请输入" />
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
<view class="bai-box">
|
|
<view class="k-bs" @click="show=true">
|
|
<view class="">驾校地址</view>
|
|
<view class="right_box">
|
|
<view class="">省、市、区</view>
|
|
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="k-bs">
|
|
<view class="">详细地址</view>
|
|
<view class="right_box">
|
|
<input type="text" placeholder="请输入详细地址" />
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></u-picker>
|
|
|
|
<view style="width: 100%; height: 70px;"></view>
|
|
<view class="bottom-box">
|
|
<view class="anniu">保存</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
show: false,
|
|
columns: [
|
|
['中国', '美国', '日本']
|
|
],
|
|
fileList1: [],
|
|
}
|
|
},
|
|
onShow() {
|
|
|
|
},
|
|
onPullDownRefresh() {
|
|
console.log("刷新");
|
|
uni.stopPullDownRefresh()
|
|
},
|
|
onReachBottom() {
|
|
// this.show = true
|
|
setTimeout(() => {
|
|
console.log("加载执行");
|
|
}, 2000)
|
|
},
|
|
|
|
methods: {
|
|
confirm() {
|
|
this.show = false
|
|
},
|
|
cancel() {
|
|
this.show = false
|
|
},
|
|
// 删除图片
|
|
deletePic(event) {
|
|
this[`fileList${event.name}`].splice(event.index, 1)
|
|
},
|
|
// 新增图片
|
|
async afterRead(event) {
|
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
|
let lists = [].concat(event.file)
|
|
let fileListLen = this[`fileList${event.name}`].length
|
|
lists.map((item) => {
|
|
this[`fileList${event.name}`].push({
|
|
...item,
|
|
status: 'uploading',
|
|
message: '上传中'
|
|
})
|
|
})
|
|
for (let i = 0; i < lists.length; i++) {
|
|
const result = await this.uploadFilePromise(lists[i].url)
|
|
let item = this[`fileList${event.name}`][fileListLen]
|
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
|
status: 'success',
|
|
message: '',
|
|
url: result
|
|
}))
|
|
fileListLen++
|
|
}
|
|
},
|
|
uploadFilePromise(url) {
|
|
return new Promise((resolve, reject) => {
|
|
let a = uni.uploadFile({
|
|
url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
|
|
filePath: url,
|
|
name: 'file',
|
|
formData: {
|
|
user: 'test'
|
|
},
|
|
success: (res) => {
|
|
setTimeout(() => {
|
|
resolve(res.data.data)
|
|
}, 1000)
|
|
}
|
|
});
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.content {
|
|
width: 100%;
|
|
background: #f4f5f6;
|
|
height: 100vh;
|
|
}
|
|
|
|
.container {
|
|
width: 100%;
|
|
background: #f4f5f6;
|
|
box-sizing: border-box;
|
|
padding-top: 8px;
|
|
}
|
|
|
|
.bai-box {
|
|
width: 95%;
|
|
box-sizing: border-box;
|
|
padding: 15px;
|
|
background-color: #fff;
|
|
margin: 10px auto;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.bottom-box {
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
padding: 5px;
|
|
background: #fff;
|
|
position: fixed;
|
|
bottom: 0px;
|
|
left: 0px;
|
|
height: 70px;
|
|
overflow: hidden;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.anniu {
|
|
width: 311px;
|
|
height: 40px;
|
|
background: #4AA76F;
|
|
border-radius: 20px 20px 20px 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #fff;
|
|
}
|
|
|
|
.k-bs {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
box-sizing: border-box;
|
|
padding: 10px 0px;
|
|
border-bottom: 1px solid #dadada;
|
|
}
|
|
|
|
.right_box {
|
|
text-align: right;
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
}
|
|
</style> |