hookehuyr

新增首页页面

......@@ -2,8 +2,8 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-27 15:57:59
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-06 14:47:04
* @FilePath: /taro-vant-weapp/src/app.config.js
* @LastEditTime: 2022-09-20 13:51:26
* @FilePath: /swx/src/app.config.js
* @Description:
*/
const vantComponentNames = require("../vantComponentConf");
......@@ -24,8 +24,8 @@ export default {
],
subpackages: [ // 配置在tabBar中的页面不能分包写到subpackages中去
{
root: "pages/demo",
pages: ["index"],
root: 'pages/demo',
pages: ['index'],
},
],
window: {
......
page {
color: #222222;
background-color: #F6F6F6;
}
......
/*
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-20 13:55:01
* @FilePath: /swx/src/pages/index/index.config.js
* @Description: 文件描述
*/
export default {
navigationBarTitleText: '首页',
navigationBarTitleText: '胜文轩-活动工具',
usingComponents: {
},
}
......
.slide-box {
height: 15rem;
.slide-image {
width: 100%;
height: 100%;
}
}
.bg-gradient {
background: linear-gradient(#B3DDC9, #B3DDC9) no-repeat;
/*调整下划线的宽度占百分之百 高度是3px */
background-size: 100% 1vw;
/* 调整下划线的起始位置 左侧是0 上边是1.15em */
background-position: 0 1rem;
}
.underline {
position: relative;
z-index: 2;
&::before {
position: absolute;
z-index: 1;
content: "";
color: white;
left: 0;
width: 100%;
height: 1.1rem;
border-bottom: 4rpx solid #B3DDC9;
}
}
......
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-19 17:21:39
* @LastEditTime: 2022-09-20 15:45:23
* @FilePath: /swx/src/pages/index/index.vue
* @Description: 文件描述
* @Description: 首页
-->
<template>
<!-- <van-tabs :active="active" bind:change="onChange">
<van-tab title="标签 1">内容 2</van-tab>
<van-tab title="标签 2">内容 2</van-tab>
<van-tab title="标签 3">内容 3</van-tab>
<van-tab title="标签 4">
<van-button type="primary" @click="goTo">主要按钮</van-button>
</van-tab>
</van-tabs> -->
<van-button type="primary" @click="goTo">主要按钮</van-button>
<van-image width="100" height="100" src="https://img.yzcdn.cn/vant/cat.jpeg" />
<view class="page-body">
<view class="page-section">
<text>时间日期选择器--无默认</text>
<view>
<timePickerData
:start-time="startTime"
:end-time="endTime"
@result="onResult"
>
<input placeholder="请选择" disabled='true' :value="time" />
</timePickerData>
</view>
</view>
<view>
<swiper
class='slide-box'
indicatorColor='#94B294'
indicatorActiveColor='#FFFFFF'
current="current"
:duration="duration"
:interval="interval"
:circular="isCircular"
:autoplay="isAutoplay"
:indicatorDots="hasIndicatorDots">
<swiper-item v-for="(item, idx) in imgUrls" :key="idx">
<image :src="item" class="slide-image" />
</swiper-item>
</swiper>
</view>
<view style="padding: 1rem;">
<text class="bg-gradient">推荐活动</text>
</view>
<view style="padding: 1rem;">
<activity-card></activity-card>
</view>
</template>
<script setup>
import Taro from '@tarojs/taro'
import { ref } from 'vue';
import request from '../../utils/request';
import timePickerData from "@/components/time-picker-data/picker";
request.get('/srv/?a=kg_list')
.then(res => {
console.warn(res);
})
.catch(err => {
console.error(err);
})
// Taro.request({
// url: 'http://voice.onwall.cn/srv/?f=voice&a=kg_list', //仅为示例,并非真实的接口地址
// data: {
// },
// // header: {
// // 'content-type': 'application/json' // 默认值
// // },
// success: function (res) {
// console.log(res.data)
// }
// })
const active = ref(1);
import activityCard from '@/components/activity-card.vue'
const goTo = () => {
Taro.navigateTo({
url: '../demo/index?id=1'
})
}
</script>
<script>
import "./index.less";
export default {
name: "indexPage",
onReady() {
......@@ -110,34 +83,20 @@ export default {
},
data() {
return {
time:'',
startTime: new Date(),
default:new Date(),
current: 1,
duration: 500,
interval: 5000,
isCircular: true,
isAutoplay: false,
hasIndicatorDots: true,
imgUrls: [
'https://img10.360buyimg.com/babel/s700x360_jfs/t25855/203/725883724/96703/5a598a0f/5b7a22e1Nfd6ba344.jpg!q90!cc_350x180',
'https://img11.360buyimg.com/babel/s700x360_jfs/t1/4776/39/2280/143162/5b9642a5E83bcda10/d93064343eb12276.jpg!q90!cc_350x180',
'https://img14.360buyimg.com/babel/s700x360_jfs/t1/4099/12/2578/101668/5b971b4bE65ae279d/89dd1764797acfd9.jpg!q90!cc_350x180',
],
};
},
created(){
this.startTime = this.getTime("min", 1);
this.endTime = this.getTime("year", 2);
},
methods: {
getTime(key, number, date) {
let _date = date ? new Date(date) : new Date();
if (key === "min") {
_date.setMinutes(_date.getMinutes() + number);
}
if (key === "hour") {
_date.setHours(_date.getHours() + number);
}
if (key === "year") {
_date.setFullYear(_date.getFullYear() + number);
}
return _date;
},
onResult(arr) {
let time =
arr[0] + "-" + arr[1] + "-" + arr[2] + " " + arr[3] + ":" + arr[4];
this.time = time;
},
},
}
};
</script>
......