This commit is contained in:
曹辉 2022-10-24 16:30:14 +08:00
parent a5cc20d03d
commit 90581ede40
5 changed files with 812 additions and 0 deletions

View File

@ -0,0 +1,74 @@
.app {
height: 100%;
padding-bottom: 70rpx;
.btn {
width: 217rpx;
height: 68rpx;
background: #4C7BC9;
border-radius: 26rpx;
font-size: 32rpx;
color: #FFFFFF;
line-height: 68rpx;
margin: 100rpx 0 0 60%;
}
.items {
width: 90%;
margin: 0 auto;
text-align: center;
color: #000000;
.other {
margin: 0 auto;
height: 93rpx;
display: flex;
background-color: #fff;
border-radius: 20rpx;
width: 100%;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
margin: 20rpx auto;
line-height: 93rpx;
view {
height: 93rpx;
font-size: 32rpx;
line-height: 93rpx;
}
span {
display: inline-block;
line-height: 93rpx;
height: 93rpx;
width: 30%;
font-size: 32rpx;
}
::v-deep .u-input__input {
height: 93rpx;
font-size: 32rpx;
}
::v-deep .uni-input-wrapper {
height: 93rpx;
line-height: 93rpx;
}
::v-deep .u-input {
width: 70%;
height: 93rpx;
line-height: 93rpx;
}
}
.item {
width: 100%;
height: 93rpx;
background: #ffffff;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
margin: 0 auto 20rpx;
line-height: 93rpx;
}
}
}

563
pages/picker/picker.vue Normal file
View File

@ -0,0 +1,563 @@
<template>
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto"
:safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
<view class="u-datetime-picker">
<view class="u-picker-header" @touchmove.stop.prevent="">
<view class="u-btn-picker u-btn-picker--tips" :style="{ color: cancelColor }" hover-class="u-opacity"
:hover-stay-time="150" @tap="getResult('cancel')">{{cancelText}}</view>
<view class="u-picker__title">{{ title }}</view>
<view class="u-btn-picker u-btn-picker--primary" :style="{ color: moving ? cancelColor : confirmColor }"
hover-class="u-opacity" :hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('confirm')">
{{confirmText}}
</view>
</view>
<view class="u-picker-body">
<picker-view :value="valueArr" @change="change" class="u-picker-view" @pickstart="pickstart"
@pickend="pickend">
<picker-view-column v-if="!reset && params.year" style="flex:6">
<view class="u-column-item" v-for="(item, index) in years" :key="index">
{{ item }}
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.month" style="flex:5">
<view class="u-column-item" v-for="(item, index) in months" :key="index">
{{ formatNumber(item) }}
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.day" style="flex:5">
<view class="u-column-item" v-for="(item, index) in days" :key="index">
{{ formatNumber(item) }}
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.hour" style="flex:6">
<view class="u-column-item" v-for="(item, index) in hours" :key="index">
<view class="" style="font-size:38rpx">
{{ formatNumber(item) }}
</view>
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.minute" style="flex:6">
<view class="u-column-item" v-for="(item, index) in minutes" :key="index">
<view class="" style="font-size:38rpx">
{{ formatNumber(item) }}
</view>
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
<picker-view-column style="flex:2">
<view class="u-column-item">
<text class="u-text"></text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.endhour" style="flex:6">
<view class="u-column-item" v-for="(item, index) in endhours" :key="index">
<view class="" style="font-size:38rpx">
{{ formatNumber(item) }}
</view>
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
<picker-view-column v-if="!reset && params.endminute" style="flex:6">
<view class="u-column-item" v-for="(item, index) in endminutes" :key="index">
<view class="" style="font-size:38rpx">
{{ formatNumber(item) }}
</view>
<text class="u-text" v-if="showTimeTag"></text>
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</u-popup>
</template>
<script>
/**
* picker picker弹出选择器
* @description 此选择器有两种弹出模式一是时间模式可以配置年秒参数 二是地区模式可以配置省区参数
* @tutorial https://www.uviewui.com/components/picker.html
* @property {Object} params 需要显示的参数见官网说明
* @property {String} mode 模式选择region-地区类型time-时间类型默认time
* @property {String Number} start-year 可选的开始年份mode=time时有效默认1950
* @property {String Number} end-year 可选的结束年份mode=time时有效默认2050
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配默认false
* @property {Boolean} show-time-tag 时间模式时是否显示后面的年月日中文提示
* @property {String} cancel-color 取消按钮的颜色默认#606266
* @property {String} confirm-color 确认按钮的颜色默认#2979ff
* @property {String} default-time 默认选中的时间mode=time时有效
* @property {String} confirm-text 确认按钮的文字
* @property {String} cancel-text 取消按钮的文字
* @property {String} default-region 默认选中的地区中文形式mode=region时有效
* @property {String} default-code 默认选中的地区编号形式mode=region时有效
* @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker默认true
* @property {String Number} z-index 弹出时的z-index值默认1075
* @property {Array} default-selector 数组形式其中每一项表示选择了range对应项中的第几个
* @property {Array} range 自定义选择的数据mode=selector或mode=multiSelector时有效
* @property {String} range-key 当range参数的元素为对象时指定Object中的哪个key的值作为选择器显示内容
* @event {Function} confirm 点击确定按钮返回当前选择的值
* @event {Function} cancel 点击取消按钮返回当前选择的值
* @example <u-picker v-model="show" mode="time"></u-picker>
*/
export default {
name: 'u-picker',
props: {
// picker
params: {
type: Object,
default () {
return {
year: false,
month: true,
day: true,
hour: true,
endhour: true,
minute: true,
endminute: true,
second: false,
};
}
},
// mode=selectormode=multiSelector
range: {
type: Array,
default () {
return [];
}
},
// mode=selectormode=multiSelector
defaultSelector: {
type: Array,
default () {
return [0];
}
},
// range ArrayObject range-key Object key
rangeKey: {
type: String,
default: ''
},
// region-time-selector-multiSelector-
mode: {
type: String,
default: 'time'
},
//
startYear: {
type: [String, Number],
default: 1950
},
//
endYear: {
type: [String, Number],
default: 2050
},
// ""
cancelColor: {
type: String,
default: '#606266'
},
// ""
confirmColor: {
type: String,
default: '#2979ff'
},
// 2025-07-02 || 2025-07-02 13:01:00 || 2025/07/02
defaultTime: {
type: String,
default: ''
},
//
showTimeTag: {
type: Boolean,
default: true
},
safeAreaInsetBottom: {
type: Boolean,
default: false
},
// Picker
maskCloseAble: {
type: Boolean,
default: true
},
//
value: {
type: Boolean,
default: false
},
// z-index
zIndex: {
type: [String, Number],
default: 0
},
//
title: {
type: String,
default: '预约时间'
},
//
cancelText: {
type: String,
default: '取消'
},
//
confirmText: {
type: String,
default: '确认'
}
},
data() {
return {
years: [],
months: [],
days: [],
hours: [],
endhours: [],
minutes: [],
endminutes: [],
seconds: [],
year: 0,
month: 0,
day: 0,
hour: 0,
endhour: 0,
minute: 0,
endminute: 0,
second: 0,
reset: false,
startDate: '',
endDate: '',
valueArr: [],
moving: false //
};
},
mounted() {
this.init();
},
computed: {
propsChange() {
//
return `${this.mode}-${this.defaultTime}-${this.startYear}-${this.endYear}-${this.defaultRegion}-${this.areaCode}`;
},
regionChange() {
//
return `${this.province}-${this.city}`;
},
yearAndMonth() {
return `${this.year}-${this.month}`;
},
uZIndex() {
// z-index使
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
}
},
watch: {
propsChange() {
this.reset = true;
setTimeout(() => this.init(), 10);
},
// pickerthis.citysthis.areas
regionChange(val) {
this.citys = citys[this.province];
this.areas = areas[this.province][this.city];
},
// watch
// 3031229228
yearAndMonth(val) {
if (this.params.year) this.setDays();
},
// QQ()
value(n) {
if (n) {
this.reset = true;
setTimeout(() => this.init(), 10);
}
}
},
methods: {
//
pickstart() {
// #ifdef MP-WEIXIN
this.moving = true;
// #endif
},
//
pickend() {
// #ifdef MP-WEIXIN
this.moving = false;
// #endif
},
//
getItemValue(item, mode) {
// (2020-05-25)uni-appv-iffalse
// getItemValue
if (this.mode == mode) {
return typeof item == 'object' ? item[this.rangeKey] : item;
}
},
// 100
formatNumber(num) {
return +num < 10 ? '0' + num : String(num);
},
//
generateArray: function(start, end) {
// end-yearend+1
start = Number(start);
end = Number(end);
end = end > start ? end : start;
//
return [...Array(end + 1).keys()].slice(start);
},
getIndex: function(arr, val) {
let index = arr.indexOf(val);
// index-1(index)~(-1)=-(-1)-1=0
return ~index ? index : 0;
},
//
initTimeValue() {
// IE(uni)"-"
let fdate = this.defaultTime.replace(/\-/g, '/');
fdate = fdate && fdate.indexOf('/') == -1 ? `2020/01/01 ${fdate}` : fdate;
let time = null;
if (fdate) time = new Date(fdate);
else time = new Date();
//
this.year = time.getFullYear();
this.month = Number(time.getMonth()) + 1;
this.day = time.getDate();
this.hour = time.getHours();
this.minute = time.getMinutes();
this.endhour = time.getHours();
this.endminute = time.getMinutes();
// this.second = time.getSeconds();
},
init() {
this.valueArr = [];
this.reset = false;
if (this.mode == 'time') {
this.initTimeValue();
if (this.params.year) {
this.valueArr.push(0);
this.setYears();
}
if (this.params.month) {
this.valueArr.push(0);
this.setMonths();
}
if (this.params.day) {
this.valueArr.push(0);
this.setDays();
}
if (this.params.hour) {
this.valueArr.push(0);
this.setHours();
}
if (this.params.minute) {
this.valueArr.push(0);
this.setMinutes();
}
if (this.params.endhour) {
this.valueArr.push(0);
this.setendHours();
}
if (this.params.endminute) {
this.valueArr.push(0);
this.setendMinutes();
}
// if (this.params.second) {
// this.valueArr.push(0);
// this.setSeconds();
// }
}
this.$forceUpdate();
},
// picker
setYears() {
//
this.years = this.generateArray(this.startYear, this.endYear);
// this.valueArrpicker
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.years, this.year));
},
setMonths() {
this.months = this.generateArray(1, 12);
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.months, this.month));
},
setDays() {
let totalDays = new Date(this.year, this.month, 0).getDate();
this.days = this.generateArray(1, totalDays);
let index = 0;
// 使setMonths()this.valueArr.splice(this.valueArr.length - 1, xxx)
// this.monththis.yearwatchthis.setDays()this.valueArr.length
if (this.params.year && this.params.month) index = 2;
else if (this.params.month) index = 1;
else if (this.params.year) index = 1;
else index = 0;
//
// 331229day3129(picker-column1)
if (this.day > this.days.length) this.day = this.days.length;
this.valueArr.splice(index, 1, this.getIndex(this.days, this.day));
},
setHours() {
this.hours = this.generateArray(0, 23);
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.hours, this.hour));
},
setMinutes() {
this.minutes = this.generateArray(0, 59);
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.minutes, this.minute));
},
setendHours() {
this.endhours = this.generateArray(0, 23);
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.endhours, this.endhour));
},
setendMinutes() {
this.endminutes = this.generateArray(0, 59);
this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.endminutes, this.endminute));
},
// setSeconds() {
// this.seconds = this.generateArray(0, 59);
// this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.seconds, this.second));
// },
close() {
this.$emit('input', false);
},
// picker
change(e) {
this.valueArr = e.detail.value;
console.log(this.valueArr)
let i = 0;
if (this.mode == 'time') {
// 使i++this.valueArrthis.params
// ifi1
if (this.params.year) this.year = this.years[this.valueArr[i++]];
if (this.params.month) this.month = this.months[this.valueArr[i++]];
if (this.params.day) this.day = this.days[this.valueArr[i++]];
if (this.params.hour) this.hour = this.hours[this.valueArr[i++]];
if (this.params.minute) this.minute = this.minutes[this.valueArr[i++]];
if (this.params.endhour) this.endhour = this.hours[this.valueArr[6]]
if (this.params.endminute) this.endminute = this.endminutes[this.valueArr[7]];
// if (this.params.second) this.second = this.seconds[this.valueArr[i++]];
}
},
//
getResult(event = null) {
// #ifdef MP-WEIXIN
if (this.moving) return;
// #endif
let result = {};
// this.paramstrue
if (this.mode == 'time') {
if (this.params.year) result.year = this.formatNumber(this.year || 0);
if (this.params.month) result.month = this.formatNumber(this.month || 0);
if (this.params.day) result.day = this.formatNumber(this.day || 0);
if (this.params.hour) result.hour = this.formatNumber(this.hour || 0);
if (this.params.minute) result.minute = this.formatNumber(this.minute || 0);
if (this.params.endhour) result.endhour = this.formatNumber(this.endhour || 0);
if (this.params.endminute) result.endminute = this.formatNumber(this.endminute || 0);
// if (this.params.second) result.second = this.formatNumber(this.second || 0);
// if (this.params.timestamp) result.timestamp = this.getTimestamp();
}
if (event) this.$emit(event, result);
this.close();
},
//
getTimestamp() {
// yyyy-mm-ddiOS使"/"
let time = this.year + '/' + this.month + '/' + this.day + ' ' + this.hour + ':' + this.minute + ':' + this
.second;
return new Date(time).getTime() / 1000;
}
}
};
</script>
<style lang="scss" scoped>
// nvueflexnvuedisplay
@mixin vue-flex($direction: row) {
/* #ifndef APP-NVUE */
display: flex;
flex-direction: $direction;
/* #endif */
}
.u-datetime-picker {
position: relative;
z-index: 999;
}
.u-picker-view {
height: 100%;
box-sizing: border-box;
}
.u-picker-header {
width: 100%;
height: 90rpx;
padding: 0 40rpx;
@include vue-flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
font-size: 30rpx;
background: #fff;
position: relative;
}
.u-picker-header::after {
content: '';
position: absolute;
border-bottom: 1rpx solid #eaeef1;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
bottom: 0;
right: 0;
left: 0;
}
.u-picker__title {
color: $u-content-color;
}
.u-picker-body {
width: 100%;
height: 500rpx;
overflow: hidden;
background-color: #fff;
}
.u-column-item {
@include vue-flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: $u-main-color;
padding: 0 8rpx;
}
.u-text {
font-size: 24rpx;
padding-left: 8rpx;
}
.u-btn-picker {
padding: 16rpx;
box-sizing: border-box;
text-align: center;
text-decoration: none;
}
.u-opacity {
opacity: 0.5;
}
.u-btn-picker--primary {
color: $u-type-primary;
}
.u-btn-picker--tips {
color: $u-tips-color;
}
</style>

175
pages/user/user.vue Normal file
View File

@ -0,0 +1,175 @@
<template>
<view class="app">
<view class="user">
<view class="img">
<image src="../../static/users.png" mode=""></image>
</view>
<view class="phone">
188****8888
</view>
<view class="nickname">
点此设置昵称
</view>
<view class="modify">
修改信息
<u-icon name="arrow-right" color="#ffffff" size="32"></u-icon>
</view>
</view>
<view class="information">
<view class="item">
姓名:
</view>
<view class="item">
电话:
</view>
<view class="item">
地址:
</view>
<view class="item">
疾病类型:
</view>
</view>
<view class="External" style="margin: 200rpx auto 0;">
<view class="lefttext">
积分:
</view>
<view class="righttext">
100
</view>
<image src="../../static/jiantou.png" mode=""></image>
</view>
<view class="External">
<view class="lefttext">
健康档案
</view>
<view class="righttext">
</view>
<image src="../../static/jiantou.png" mode=""></image>
</view>
<view class="External">
<view class="lefttext">
我的设备
</view>
<view class="righttext">
</view>
<image src="../../static/jiantou.png" mode=""></image>
</view>
</view>
</template>
<script>
export default {
data() {
return {
};
}
}
</script>
<style lang="scss">
.app {
padding: 0;
font-size: 36rpx;
height: 100vh;
.External {
width: 94%;
height: 100rpx;
line-height: 100rpx;
margin: 20rpx auto;
padding-left: 5%;
background: #FFFFFF;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
position: relative;
.righttext {
position: absolute;
right: 12%;
top: 50%;
color: #969394;
transform: translateY(-50%);
}
image {
width: 18rpx;
height: 27rpx;
position: absolute;
right: 5%;
top: 50%;
transform: translateY(-50%);
}
.lefttext,
.righttext {
display: inline-block;
}
}
.information {
width: 94%;
background: #FFFFFF;
box-shadow: 0px 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 20rpx;
position: absolute;
top: 18%;
left: 3%;
color: #000000;
padding-left: 5%;
overflow: hidden;
.item {
height: 110rpx;
line-height: 110rpx;
border-bottom: 1rpx solid #D8D4D4;
}
}
.user {
width: 100%;
height: 500rpx;
background: #4C7BC9;
position: relative;
color: #FFFFFF;
.modify {
font-size: 32rpx;
position: absolute;
right: 3%;
top: 22%;
}
.nickname {
position: absolute;
top: 26%;
left: 33%;
}
.phone {
position: absolute;
top: 13%;
left: 33%;
}
.img {
width: 150rpx;
height: 150rpx;
border-radius: 50%;
background: #F6F6F6;
position: absolute;
top: 10%;
left: 8%;
image {
width: 100rpx;
margin-left: 50%;
margin-top: 50%;
transform: translate(-50%, -50%);
height: 100rpx;
}
}
}
}
</style>

BIN
static/qdy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
static/sousuo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB