1h27min
This commit is contained in:
@@ -1,29 +1,113 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
|
||||
<view class="intro">本项目已包含uni ui组件,无需import和注册,可直接使用。在代码区键入字母u,即可通过代码助手列出所有可用组件。光标置于组件名称处按F1,即可查看组件文档。</view>
|
||||
<text class="intro">详见:</text>
|
||||
<uni-link :href="href" :text="href"></uni-link>
|
||||
<view>
|
||||
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
|
||||
<swiper-item v-for="value in adv_list">
|
||||
<view class="swiper-item">
|
||||
<image :src="value[0]"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view>
|
||||
<view>
|
||||
<view>
|
||||
<image src="/static/定位.png"></image>
|
||||
<text>{{}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<image src="/static/坐标.png"></image>
|
||||
<text>我的位置</text>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<view>入住</view>
|
||||
<view>请选择</view>
|
||||
</view>
|
||||
<view>共{{}}晚</view>
|
||||
<view>
|
||||
<view>离店</view>
|
||||
<view>请选择</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<input type="search" placeholder="搜索民宿名称" />
|
||||
</view>
|
||||
<button style="background-color: orange;">开始搜索</button>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<!-- <image src=""></image> -->
|
||||
<text>民俗文化</text>
|
||||
</view>
|
||||
<view>
|
||||
<image src=""></image>
|
||||
<text>优惠促销</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<view v-for="unit in footerlist">
|
||||
<image :src="unit[0]"></image>
|
||||
<text>{{unit[1]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
const footerlist = ["首页", "数据分析", "民宿", "我的"].map((value, index) => [value,`/static${["首页_首页.png","导航-民宿.png","导航-攻略.png","导航-我的.png"][index]}`])
|
||||
return {
|
||||
href: 'https://uniapp.dcloud.io/component/README?id=uniui'
|
||||
adv_list: null,
|
||||
footerlist
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
methods: {
|
||||
async request(method, path) {
|
||||
let text
|
||||
if (method == "post") {
|
||||
text = await fetch(`http://124.93.196.45:10091/Neusoft/homestay${path}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// "Authorization":
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"password": "0CYdq6Hn",
|
||||
"username": "6dOMIgIU"
|
||||
})
|
||||
})
|
||||
} else if (method == "get") {
|
||||
text = await fetch(`http://124.93.196.45:10091/Neusoft/homestay${path}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": (await this.request("post", "/api/login")).token
|
||||
}
|
||||
})
|
||||
}
|
||||
const data = await text.json()
|
||||
console.log(data);
|
||||
return data
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.adv_list = (await this.request("get", "/api/adv/list")).data.map(x => [
|
||||
`http://124.93.196.45:10091/Neusoft/homestay${x.image}`, x.id, x.title, x.createTime
|
||||
])
|
||||
console.log(this.adv_list);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
padding: 20px;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
swiper {
|
||||
height: 25vh;
|
||||
}
|
||||
</style>
|
||||
|
||||
swiper image {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user