服务时间表

This commit is contained in:
闫晓茹 2023-10-23 17:31:18 +08:00
parent 88ec847a3a
commit 1897b377e8
5 changed files with 460 additions and 67 deletions

385
components/utabs/u-tabs.vue Normal file
View File

@ -0,0 +1,385 @@
<template>
<view class="u-tabs" :style="{
background: bgColor
}">
<!-- $u.getRect()对组件根节点无效因为写了.in(this)故这里获取内层接点尺寸 -->
<view :id="id">
<scroll-view scroll-x class="u-scroll-view" :scroll-left="scrollLeft" scroll-with-animation>
<view class="u-scroll-box" :class="{'u-tabs-scorll-flex': !isScroll}">
<view class="u-tab-item u-line-1" :id="'u-tab-item-' + index" v-for="(item, index) in list"
:key="index" @tap="clickTab(index)" :style="[tabItemStyle(index)]">
<view class="">
{{item.dates}}
</view>
<u-badge :count="item[count] || item['count'] || 0" :offset="offset" size="mini"></u-badge>
{{ item[name] || item['name']}}
</view>
<view v-if="showBar" class="u-tab-bar" :style="[tabBarStyle]"></view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
/**
* tabs 标签
* @description 该组件是一个tabs标签组件在标签多的时候可以配置为左右滑动标签少的时候可以禁止滑动 该组件的一个特点是配置为滚动模式时激活的tab会自动移动到组件的中间位置
* @tutorial https://www.uviewui.com/components/tabs.html
* @property {Boolean} is-scroll tabs是否可以左右拖动默认true
* @property {Array} list 标签数组元素为对象[{name: '推荐'}]
* @property {String Number} current 指定哪个tab为激活状态默认0
* @property {String Number} height 导航栏的高度单位rpx默认80
* @property {String Number} font-size tab文字大小单位rpx默认30
* @property {String Number} duration 滑块移动一次所需的时间单位秒默认0.5
* @property {String} active-color 滑块和激活tab文字的颜色默认#2979ff
* @property {String} inactive-color tabs文字颜色默认#303133
* @property {String Number} bar-width 滑块宽度单位rpx默认40
* @property {Object} active-item-style 活动tabs item的样式对象形式
* @property {Object} bar-style 底部滑块的样式对象形式
* @property {Boolean} show-bar 是否显示底部的滑块默认true
* @property {String Number} bar-height 滑块高度单位rpx默认6
* @property {String Number} item-width 标签的宽度默认auto
* @property {String Number} gutter 单个tab标签的左右内边距之和单位rpx默认40
* @property {String} bg-color tabs导航栏的背景颜色默认#ffffff
* @property {String} name 组件内部读取的list参数中的属性名tab名称见官网说明默认name
* @property {String} count 组件内部读取的list参数中的属性名badge徽标数同name属性的使用见官网说明默认count
* @property {Array} offset 设置badge徽标数的位置偏移格式为 [x, y]也即设置的为top和right的值单位rpx默认[5, 20]
* @property {Boolean} bold 激活选项的字体是否加粗默认true
* @event {Function} change 点击标签时触发
* @example <u-tabs ref="tabs" :list="list" :is-scroll="false"></u-tabs>
*/
export default {
name: "u-tabs",
props: {
// 23使flextab
isScroll: {
type: Boolean,
default: true
},
//
list: {
type: Array,
default () {
return [];
}
},
// tab
current: {
type: [Number, String],
default: 0
},
//
height: {
type: [String, Number],
default: 80
},
//
fontSize: {
type: [String, Number],
default: 28
},
// , ms
duration: {
type: [String, Number],
default: 0.5
},
//
activeColor: {
type: String,
default: '#F44B2F;'
},
//
inactiveColor: {
type: String,
default: '#303133'
},
// barrpx
barWidth: {
type: [String, Number],
default: 40
},
// bar
barHeight: {
type: [String, Number],
default: 6
},
// tab
gutter: {
type: [String, Number],
default: 30
},
//
bgColor: {
type: String,
default: '#ffffff'
},
// (tab)
name: {
type: String,
default: 'name'
},
// ()
count: {
type: String,
default: 'count'
},
//
offset: {
type: Array,
default: () => {
return [5, 20]
}
},
// tab
bold: {
type: Boolean,
default: true
},
// tab item
activeItemStyle: {
type: Object,
default () {
return {}
}
},
//
showBar: {
type: Boolean,
default: true
},
//
barStyle: {
type: Object,
default () {
return {}
}
},
//
itemWidth: {
type: [Number, String],
default: 'auto'
}
},
data() {
return {
scrollLeft: 0, // scroll-view
tabQueryInfo: [], // tab
componentWidth: 0, // px
scrollBarLeft: 0, // bartranslateX()
parentLeft: 0, // (tabs)
id: this.$u.guid(), // id
currentIndex: this.current,
barFirstTimeMove: true, // ()
};
},
watch: {
// tabtab使
// applist
list(n, o) {
// list
if (n.length !== o.length) this.currentIndex = 0;
// $nextTicktabtab
this.$nextTick(() => {
this.init();
});
},
current: {
immediate: true,
handler(nVal, oVal) {
//
this.$nextTick(() => {
this.currentIndex = nVal;
this.scrollByIndex();
});
}
},
},
computed: {
// bar
tabBarStyle() {
let style = {
width: this.barWidth + 'rpx',
transform: `translate(${this.scrollBarLeft}px, -100%)`,
//
'transition-duration': `${this.barFirstTimeMove ? 0 : this.duration }s`,
'background-color': this.activeColor,
height: this.barHeight + 'rpx',
opacity: this.barFirstTimeMove ? 0 : 1,
//
'border-radius': `${this.barHeight / 2}px`
};
Object.assign(style, this.barStyle);
return style;
},
// tab
tabItemStyle() {
return (index) => {
let style = {
height: this.height + 'rpx',
'line-height': '33rpx',
'font-size': this.fontSize + 'rpx',
'transition-duration': `${this.duration}s`,
padding: this.isScroll ? `0 ${this.gutter}rpx` : '',
flex: this.isScroll ? 'auto' : '1',
width: this.$u.addUnit(this.itemWidth)
};
//
if (index == this.currentIndex && this.bold) style.fontWeight = 'bold';
if (index == this.currentIndex) {
style.color = this.activeColor;
// tab item
style = Object.assign(style, this.activeItemStyle);
} else {
style.color = this.inactiveColor;
}
return style;
}
}
},
methods: {
// init便
async init() {
// tabs
let tabRect = await this.$uGetRect('#' + this.id);
// tabs
this.parentLeft = tabRect.left;
// tabs
this.componentWidth = tabRect.width;
this.getTabRect();
},
// tab
clickTab(index) {
// tab
if (index == this.currentIndex) return;
//
this.$emit('change', index);
},
// tab
getTabRect() {
//
let query = uni.createSelectorQuery().in(this);
// tab使exec()
for (let i = 0; i < this.list.length; i++) {
// sizerect
query.select(`#u-tab-item-${i}`).fields({
size: true,
rect: true
});
}
//
query.exec(
function(res) {
this.tabQueryInfo = res;
// bar
this.scrollByIndex();
}.bind(this)
);
},
// scroll-viewtab
scrollByIndex() {
// tabtabwidthleft()
let tabInfo = this.tabQueryInfo[this.currentIndex];
if (!tabInfo) return;
// tab
let tabWidth = tabInfo.width;
// itemtabsitemlefttabsleft
let offsetLeft = tabInfo.left - this.parentLeft;
// tabs-itemscroll-view
let scrollLeft = offsetLeft - (this.componentWidth - tabWidth) / 2;
this.scrollLeft = scrollLeft < 0 ? 0 : scrollLeft;
// item
let left = tabInfo.left + tabInfo.width / 2 - this.parentLeft;
// item
this.scrollBarLeft = left - uni.upx2px(this.barWidth) / 2;
// barFirstTimeMovetruefalse
// scrollBarLeftcomputed
if (this.barFirstTimeMove == true) {
setTimeout(() => {
this.barFirstTimeMove = false;
}, 100)
}
}
},
mounted() {
this.init();
}
};
</script>
<style lang="scss" scoped>
// nvueflexnvuedisplay
@mixin vue-flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: $direction;
/* #endif */
}
.u-tabs {
padding: 20rpx 0;
-webkit-overflow-scrolling: touch;
}
view,
scroll-view {
box-sizing: border-box;
}
/* #ifndef APP-NVUE */
::-webkit-scrollbar,
::-webkit-scrollbar,
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
/* #endif */
.u-scroll-box {
position: relative;
/* #ifdef MP-TOUTIAO */
white-space: nowrap;
/* #endif */
}
/* #ifdef H5 */
// 穿H5scroll-view
scroll-view ::v-deep ::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
/* #endif */
.u-scroll-view {
width: 100%;
white-space: nowrap;
position: relative;
}
.u-tab-item {
position: relative;
/* #ifndef APP-NVUE */
display: inline-block;
/* #endif */
text-align: center;
transition-property: background-color, color;
}
.u-tab-bar {
position: absolute;
bottom: 0;
}
.u-tabs-scorll-flex {
@include vue-flex;
justify-content: space-between;
}
</style>

View File

@ -3,34 +3,31 @@
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/myinformation/myinformation",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/ServiceSchedule/ServiceSchedule",
"style": {
"navigationBarTitleText": "服务时间表",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#4ac4ab"
}
}, {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/myinformation/myinformation",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/myinformation/myinformation",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
// "navigationBarBackgroundColor": "#4ac4ab"
// "navigationStyle": "custom"
}
},
{
"path": "pages/homepage/homepage",
"style": {
@ -46,18 +43,17 @@
// }
// }
,{
"path" : "pages/Personalinfo/Personalinfo",
"style" :
{
"navigationBarTitleText": "个人信息",
"enablePullDownRefresh": false
}
}
],
, {
"path": "pages/Personalinfo/Personalinfo",
"style": {
"navigationBarTitleText": "个人信息",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "",
@ -85,4 +81,4 @@
}
]
}
}
}

View File

@ -32,7 +32,7 @@
<view class="spanitem">不可预约
</view>
</view>
<view class="body">
<view class="bodytwo">
<span class="spanitem">9:30~10:00</span>
<view class="spanitem">可预约
</view>
@ -65,7 +65,7 @@
<view class="spanitem">不可预约
</view>
</view>
<view class="body">
<view class="bodytwo">
<span class="spanitem">9:30~10:00</span>
<view class="spanitem">可预约
</view>
@ -105,16 +105,16 @@
orderStatus: '',
}, {
name: '周一 01-01',
orderStatus: 'WAIT_PAY',
orderStatus: '',
}, {
name: '周二 01-01',
orderStatus: 'WAIT_RECEIVED_GOODS',
orderStatus: '',
}, {
name: '周三 01-01',
orderStatus: 'RECEIVED_GOODS',
orderStatus: '',
}, {
name: '周四 01-01',
orderStatus: 'EVALUATED',
orderStatus: '',
},
{
name: '周五 01-01',
@ -149,7 +149,7 @@
display: flex;
position: fixed;
right: 2%;
top: 20%;
top: 18%;
flex-wrap: wrap;
width: 400rpx;
@ -181,6 +181,7 @@
height: 361px;
background: #fff;
border-radius: 0rpx 5rpx 5rpx 0rpx;
// margin: 15px 0 15px 0;
}
.morning {
@ -190,6 +191,7 @@
border-radius: 0rpx 5rpx 5rpx 0rpx;
margin: 20rpx auto;
background-color: #fff;
margin: 15px 0 15px 0;
.morningtime {
padding: 15px 27px 62rpx 20rpx;
@ -266,7 +268,7 @@
}
.content {
margin: 30rpx auto;
// padding-top: 30rpx;
// top: 2%;
background-color: #fff;
width: 100%;

View File

@ -14,14 +14,14 @@
</view>
<view class="name">
<u-form :model="form" ref="uForm" label-width="110">
<u-form-item label="用户名:"><u-input placeholder="请输入用户名" /></u-form-item>
<u-form-item label="用户名:"><u-input placeholder="请输入用户名" /></u-form-item>
<u-form-item label="密码:">
<u-input placeholder="请输入密码" :password-icon="true" type="password"/>
<!-- <span class="pwd">忘记密码</span> -->
<u-input placeholder="请输入密码" :password-icon="true" type="password" />
<!-- <span class="pwd">忘记密码</span> -->
</u-form-item>
</u-form>
</view>
<view class="loginsubmit">
<view class="loginsubmit" @tap="gohomepage">
登录
</view>
@ -48,7 +48,11 @@
},
methods: {
gohomepage() {
uni.redirectTo({
url: '/pages/homepage/homepage'
})
},
}
}
</script>
@ -133,14 +137,15 @@
position: relative;
width: 83%;
/* background: red; */
left: 50%;
transform: translateX(-50%);
top: 9%;
left: 50%;
transform: translateX(-50%);
top: 9%;
::v-deep .u-form-item--left {
font-size: 30rpx;
}
.pwd{
.pwd {
display: inline-block;
position: absolute;
right: 10%;
@ -153,17 +158,17 @@
}
.loginsubmit{
text-align: center;
width: 83%;
height: 88rpx;
line-height: 88rpx;
background: #18CBB3;
/* position: absolute; */
margin: 177rpx auto;
color: #fff;
.loginsubmit {
text-align: center;
width: 83%;
height: 88rpx;
line-height: 88rpx;
background: #18CBB3;
/* position: absolute; */
margin: 177rpx auto;
color: #fff;
border-radius: 100rpx
}
}

View File

@ -68,8 +68,8 @@
<view class="name">
张三族
</view>
<image src="../../static/time.png" mode="" class="fist"></image>
<image src="../../static/see.png" mode="" class="two"></image>
<image src="../../static/time.png" mode="" class="fist" @tap="gotime"></image>
<image src="../../static/see.png" mode="" class="two" @tap="gotime"></image>
<view class="myorder titles" @tap="personlinfo">
<view class="title">
个人信息
@ -120,6 +120,11 @@
})
},
gotime(){
uni.navigateTo({
url:'/pages/ServiceSchedule/ServiceSchedule'
})
},