首页静态完成

This commit is contained in:
魏啾
2024-04-01 16:31:14 +08:00
parent a9b9da0bbf
commit 653da2ad81
54 changed files with 6265 additions and 687 deletions

View File

@@ -1,169 +1,218 @@
<template>
<view>
<view class="banner-wrap">
<u-swiper :list="banners" height="440" radius="0" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper>
</view>
<view class="container">
<view class="user-info">
<view class="top">
<view class="col">
<view style="width: 36px; height: 36px;border-radius: 10rpx;">
<button open-type="chooseAvatar" @chooseavatar='onChooseAvatar'
style="padding: 0;margin: 0; width: 36px; height: 36px;border-radius: 10rpx;">
<image style="width: 36px; height: 36px;" v-if="userInfo.avatar" :src="userInfo.avatar"
mode="aspectFill">
</image>
<image style="width: 36px; height: 36px;" v-else src="@/static/avatar.png"
mode="aspectFill">
</image>
</button>
<view class="content">
<!-- 导航栏 -->
<view class="navbar" :class="{active:opacity}">
<view class="status-bar"></view>
<!-- #ifdef APP-PLUS -->
<view class="navbar_tow flex-between">
<!-- #endif -->
<!-- #ifndef APP-PLUS -->
<view class="navbar_tow flex-between"
:style="{'height':HeighT.customBar+'px','padding-right':HeighT.custwidth + 'px'}">
<!-- #endif -->
<!-- 盒子2 返回标题搜索框 -->
<view class="flex-between">
<view class="navbar_tow_one flex-start">
<text>美味抢先点</text>
<text>西安</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
<text class="t">{{userInfo.nickName}}</text>
</view>
<navigator class="ewm-wrap" url="/pages/pay_code/pay_code" hover-class="none">
<image class="ewm" src="../../static/ewm.png" mode="aspectFit"></image>
<text class="t">会员码</text>
</navigator>
</view>
<view class="bottom">
<view class="col">
<text class="t1 num">{{shopUser.amount || '0'}}</text>
<text class="t2">余额</text>
</view>
<view class="col">
<text class="t1 num">{{shopUser.levelConsume || '0'}}</text>
<text class="t2">积分</text>
</view>
</view>
</view>
<view class="menu-wrap">
<view class="top-wrap">
<view class="item" @click="scanCodehandle">
<image class="bg" src="../../static/index_m2.png" mode="widthFix"></image>
<view class="btn">
<text class="t">扫码点餐</text>
</view>
</view>
<view class="item" @click="memberindex">
<image class="bg" src="../../static/index_m1.png" mode="widthFix"></image>
<view class="btn">
<text class="t">会员充值</text>
<view class="navbar_tow_tow">
<input type="text" class="navbar_tow_towinput" v-model="keyword" placeholder="请输入关键字" />
</view>
</view>
</view>
</view>
<view class="footer-banner">
<u-swiper :list="footerBanners" radius="20" height="160" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper>
<!-- 轮播图 -->
<view class="viewswiper">
<u-swiper :list="list1" @change="e => current = e.current" indicatorStyle="right: 20px" height='484'>
<view slot="indicator" class="indicator">
<view class="indicator__dot" v-for="(item, index) in list1" :key="index"
:class="[index === current && 'indicator__dot--active']"
:style="[index === current && {'width':16+'px'}]">
</view>
</view>
</u-swiper>
</view>
<!-- 广告 -->
<view class="onecontent flex-between">
<view class="onecontentleft">
现有<text>0元无门槛</text>抵价券 正在出售
</view>
<view class="onecontentright flex-start">
<view class="onecontentrightimage flex-start">
<u-swiper class="onecontentrightswiper" circular style="width: 100%;" nextMargin="50"
:list="list1" height='28'></u-swiper>
</view>
<view class="onecontentrighttext">购买了10面值优惠券</view>
</view>
<!-- 小内切圆 -->
<view class="after"></view>
</view>
<!-- 金刚区 -->
<view class="towcontent flex-between">
<view class="towcontent_item flex-colum" v-for="(item,index) in 5" :key="index">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<text>扫码点餐</text>
</view>
</view>
<!-- 今日上线 -->
<view class="therecontent flex-between">
<view class="therecontent_box_item" v-for="item in 2" :key="item">
<view class="therecontent_box_imge flex-between" :style="item&&item">
<view class="therecontent_box_imge_text">
今日上新
</view>
<view class="therecontent_box_imge_right flex-start">
<view>
10点更新
</view>
<u-icon name="arrow-right" color="#666666" size="16"></u-icon>
</view>
</view>
<view class="therecontent_box_itembox">
<view class="therecontent_box_itembox_item flex-between" v-for="item in 2" :key="item">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<view class="therecontent_box_itembox_itemview">
<view class="therecontent_box_itembox_itemviewone">
书亦烧仙草新品书亦烧仙草新品亦烧仙草新品
</view>
<view class="therecontent_box_itembox_itemviewtow flex-start">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/xia.png"
mode="widthFix"></image>
<view>
8
</view>
</view>
<view class="therecontent_box_itembox_itemviewthere flex-start">
<text>15.00</text>
<text>18.00</text>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 类目 -->
<view class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in 10" :key="index">
<text>西安</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333" size="16"></u-icon>
</view>
</view>
<!-- 产品 -->
<view class="fivecontent">
<view class="fivecontent_item" v-for="(item,index) in 12" :key="index">
<view class="fivecontent_item_nav flex-start">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
幸运咖啡荣民时代广场店
</view>
<view>
龙首.151m
</view>
</view>
<view class="fivecontent_item_nav_leftlang flex-start">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
mode="aspectFill"></image>
<text>人气连锁品牌</text>
</view>
</view>
</view>
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image src="@/static/avatar.png" mode=""></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between">
<view>全场饮品任选</view>
<text>已抢15789份</text>
</view>
<view class="fivecontent_item_boxitemlefttow flex-start">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
mode="aspectFill"></image>
<text>人气连锁品牌</text>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="indexboxitemlefttheretextone">
<text>¥</text>
<text>1444</text>
</view>
<view class="indexboxitemlefttheretexttow">
¥111
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省4元</text>
<!-- <view class="indexboxitemleftthere_countdowntexts">
已失效
</view> -->
<!-- <view v-else class="indexboxitemleftthere_countdowntexts">
<uni-countdown @timeup="updateCity" :day="item.end_times.d"
:hour="item.end_times.h" :minute="item.end_times.m"
:second="item.end_times.s" :indexs='index'></uni-countdown>
</view> -->
<view class="indexboxitemleftthere_countdowntexts">
<uni-countdown :show-day="false" :day="1" :hour="1" :minute="12"
:second="40" color="#FFFFFF" border-color="#00B26A"
splitorColor="#FFFFFF" :font-size="8"></uni-countdown>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
banners: [require('@/static/banner1.png')],
footerBanners: [require('@/static/footer_banner1.png')],
shopUser: {},
userInfo: {},
shopInfo: {}
Backgroundtow: 'none',
keyword: '',
current: 0,
opacity: 0,
list1: [
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
]
};
},
onLoad() {
// #ifdef MP-WEIXIN
if (!uni.cache.get('token')) {
uni.reLaunch({
url: '/pages/login/login'
})
}
// #endif
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
onPageScroll(e) {
if (e.scrollTop <= 44) {
this.opacity = false
} else {
uni.reLaunch({
url: '/pages/login/login'
})
this.opacity = true
}
},
computed: {
HeighT() {
return this.$store.getters.is_BarHeight
},
},
onLoad() {
},
onShow() {},
methods: {
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopUser').shopId
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser);
uni.cache.set('shopInfo', res.data.shopInfo);
this.shopUser = uni.cache.get('shopUser')
this.userInfo = uni.cache.get('userInfo')
this.shopInfo = uni.cache.get('shopInfo')
}
},
scanCodehandle() {
// #ifndef H5
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
},
fail: (err) => {
console.log(err)
}
})
// #endif
// #ifdef H5
uni.pro.navigateTo('order_food/order_food', {
tableCode: '3000103958',
})
// #endif
},
memberindex() {
uni.pro.navigateTo('member/index')
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, 'avatar',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.userInfo.avatar = result
console.log(this.userInfo.avatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
updateCity(data) {
this.list[data].end_times = 0;
this.$forceUpdate();
},
}
@@ -171,109 +220,508 @@
</script>
<style scoped lang="scss">
.container {
padding: 40upx;
page {
background: #F9F9F9;
}
.user-info {
background-color: #fff;
padding: 40upx;
border-radius: 20upx;
.content {
.top {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1upx solid #ececec;
padding-bottom: 42upx;
.col {
display: flex;
align-items: center;
.t {
margin-left: 20upx;
}
}
.ewm-wrap {
display: flex;
flex-direction: column;
align-items: center;
.ewm {
$size: 50upx;
width: $size;
height: $size;
}
.t {
font-size: 20upx;
padding-top: 8upx;
}
}
.active {
background:rgba(249,249,249,1);
}
.status-bar {
// #ifdef APP-PLUS
height: calc(var(--status-bar-height) / 2);
// #endif
// #ifndef APP-PLUS
height: var(--status-bar-height);
// #endif
}
.bottom {
padding-top: 40upx;
display: flex;
.col {
flex: 1;
display: flex;
align-items: center;
flex-direction: column;
.t1 {
font-size: 38upx;
}
}
}
}
.menu-wrap {
padding: 40upx 0 0 0;
$gap: 20upx;
.top-wrap {
display: flex;
gap: $gap;
.item {
flex: auto;
display: flex;
align-items: center;
flex-direction: column;
background-color: #fff;
border-radius: 20upx;
.navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 99;
.navbar_tow {
width: 100%;
position: relative;
font-size: 36rpx;
.bg {
.flex-between {
// #ifdef APP-PLUS || H5
margin: 28rpx;
// #endif
// #ifdef MP-WEIXIN
margin-left: 28rpx;
// #endif
width: 100%;
height: auto;
border-radius: $gap;
flex-wrap: nowrap;
height: 100%;
line-height: 100%;
.navbar_tow_one {
height: 100%;
line-height: 100%;
text:nth-child(1) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
text:nth-child(2) {
margin-left: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.navbar_tow_tow {
position: relative;
height: 100%;
line-height: 100%;
flex: 1;
margin-left: 10rpx;
.navbar_tow_towinput {
padding-left: 32rpx;
height: 100%;
width: auto;
background: #FFFFFF;
border-radius: 34rpx;
}
}
}
.btn {
margin-top: $gap;
padding: $gap $gap * 2;
border-radius: 100upx;
display: flex;
justify-content: center;
font-size: 32upx;
background-color: #fff;
box-shadow: 0 12upx 12upx rgba(0, 0, 0, 0.05);
position: absolute;
bottom: $gap * 2;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
}
}
.viewswiper {
.indicator {
margin-bottom: 46rpx;
@include flex(row);
justify-content: center;
&__dot {
height: 6px;
width: 6px;
border-radius: 100px;
background-color: rgba(255, 255, 255, 0.35);
margin: 0 5px;
transition: background-color 0.3s;
&--active {
background-color: #ffffff;
}
}
}
.indicator-num {
padding: 2px 0;
background-color: rgba(0, 0, 0, 0.35);
border-radius: 100px;
width: 35px;
@include flex;
justify-content: center;
&__text {
color: #FFFFFF;
font-size: 12px;
}
}
}
}
.footer-banner {
padding-top: 20upx;
.onecontent {
position: relative;
margin-top: -30rpx;
padding: 14rpx 28rpx 44rpx 28rpx;
width: 100%;
background: linear-gradient(92deg, #FCECAA 0%, #fff 100%);
border-radius: 40rpx 0rpx 0rpx 0rpx;
.onecontentleft {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #333333;
text {
color: #FC851E;
}
}
.onecontentright {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #333333;
.onecontentrightimage {
width: 90rpx;
.onecontentrightswiper {
border: 50%;
width: 28rpx;
height: 28rpx;
}
}
}
.after {
position: absolute;
top: -40rpx;
right: 0;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
background-image: radial-gradient(160rpx at 0px 0px, rgba(0, 0, 0, 0) 40rpx, #fff 40rpx);
}
}
.towcontent {
position: relative;
margin-top: -32rpx;
padding: 32rpx 40rpx;
width: 100%;
background: #F9F9F9;
border-radius: 48rpx 48rpx 0rpx 0rpx;
.towcontent_item {
image {
width: 92rpx;
height: 92rpx;
}
text {
margin-top: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
}
.therecontent {
padding: 0 28rpx;
background: #F9F9F9;
.therecontent_box_item {
width: 336rpx;
border-radius: 18rpx;
background: #FFFFFF;
.therecontent_box_itembox {
padding: 10rpx 18rpx 24rpx 24rpx;
.therecontent_box_itembox_item {
margin-top: 20rpx;
image {
width: 114rpx;
height: 136rpx;
border-radius: 10rpx;
}
.therecontent_box_itembox_itemview {
margin-left: 12rpx;
.therecontent_box_itembox_itemviewone {
width: 168rpx;
height: 68rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.therecontent_box_itembox_itemviewtow {
margin-top: 8rpx;
width: 60rpx;
padding: 4rpx 10rpx;
background: #FFFFFF;
border-radius: 4rpx;
border: 2rpx solid #FF7127;
image {
width: 9.74rpx;
height: 13.51rpx;
}
view {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 16rpx;
color: #FF7127;
}
}
.therecontent_box_itembox_itemviewthere {
margin-top: 4rpx;
text:nth-child(1) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 24rpx;
color: #FF7127;
}
text:nth-child(2) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 16rpx;
color: #999999;
text-decoration-line: line-through;
}
}
}
}
.therecontent_box_itembox_item:nth-child(1) {
margin-top: 0;
}
}
.therecontent_box_imge {
padding: 24rpx 16rpx 6rpx 24rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box1.png) no-repeat;
width: 100%;
height: 70rpx;
background-size: cover;
.therecontent_box_imge_text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.therecontent_box_imge_right {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 24rpx;
color: #666666;
}
}
.therecontent_box_imge:nth-child(2) {
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box2.png) no-repeat;
}
}
}
.fourcontent {
padding: 32rpx 0 0 28rpx;
overflow-x: auto;
flex-wrap: nowrap;
.fourcontent_item {
flex-wrap: nowrap;
margin-left: 22rpx;
padding: 4rpx 14rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
text {
width: max-content;
}
}
.fourcontent_item:nth-child(1) {
margin-left: 0;
}
}
.fivecontent {
padding: 0 28rpx;
.fivecontent_item {
margin-top: 32rpx;
padding: 24rpx 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.fivecontent_item_nav {
image {
width: 60rpx;
height: 60rpx;
border-radius: 8rpx;
}
.fivecontent_item_nav_left {
flex: auto;
margin-left: 12rpx;
.fivecontent_item_nav_lefttop {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
.fivecontent_item_nav_leftlang {
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
}
image {
width: 10.82rpx;
height: 14.06rpx;
}
}
}
}
.fivecontent_item_box {
margin-top: 20rpx;
border-top: 2rpx solid #E5E5E5;
padding-top: 14rpx;
.fivecontent_item_boxitem {
image {
width: 192rpx;
height: 192rpx;
border-radius: 12rpx;
}
.fivecontent_item_boxitemleft {
margin-left: 24rpx;
flex: auto;
.fivecontent_item_boxitemleftone {
width: 100%;
text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
view {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.fivecontent_item_boxitemlefttow {
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
}
image {
width: 10.82rpx;
height: 14.06rpx;
}
}
.indexboxitemleftthere {
position: relative;
margin-top: 30rpx;
padding-left: 16rpx;
width: 100%;
height: 88rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
background-size: 100% 100%;
.indexboxitemleftthereabsolute {
position: absolute;
top: 14rpx;
right: 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 24rpx;
color: #FFFFFF;
}
.indexboxitemlefttheretext {
.indexboxitemlefttheretextone {
text {
font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
font-weight: normal;
color: #FF5053;
}
text:nth-child(2) {
font-weight: bold;
font-size: 34rpx;
}
text:nth-child(1) {
font-size: 24rpx;
}
}
.indexboxitemlefttheretexttow {
margin-left: 12rpx;
font-size: 20rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
color: #999999;
text-decoration: line-through;
}
}
.indexboxitemleftthere_countdown {
width: 100%;
.indexboxitemleftthere_countdowntext {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.indexboxitemleftthere_countdowntexts {
font-family: Roboto, Roboto;
font-weight: 400;
color: #333333;
margin-left: 16rpx;
font-size: 22rpx;
}
}
}
}
}
}
}
}
}
</style>

View File

@@ -1,31 +1,68 @@
<template>
<view class="container">
<view class="containerbox flex-colum">
<view class="containerimage_logo">
<image class="input_itemone" src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/manage/login2.png"
mode=""></image>
<view class="box flex-colum-start">
<text>您好</text>
<text>欢迎使用银收客</text>
</view>
<view class="top_box" :style="h">
<view class="top_box_one">
<text class="top_box_one_text">手机号码</text>
<input type="text" v-model="form.loginName" :adjust-position="false" placeholder="请输入手机号码"
maxlength="-1" data-key="mobile" />
</view>
<view class="containertext">
微信昵称
<view class="top_box_one">
<text class="top_box_one_text">密码</text>
<input type="mobile" v-model="form.password" :adjust-position="false" placeholder="8-16位密码"
maxlength="16" :password="!showPassword" />
<view class="repeat" @click="display">
<u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon>
</view>
</view>
<view class="containerbottom">
<view class="containerbottom_text flex-colum-start">
<text>该程序获得以下授权</text>
<text>获得您的手机号</text>
</view>
<view class="containerbottom_item flex-between">
<navigator class="containerbottomone" open-type="exit" target="miniProgram"><button
class="containerbottomone" open-type="launchApp" app-parameter="wechat"
binderror="launchAppError">
暂不授权
</button></navigator>
<button class="containerbottomtow" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
确认授权
</button>
</view>
<view class="top_box_tow flex-between">
<text @click="register">注册账号</text>
<text @click="passwords">忘记密码</text>
</view>
<view class="toLogin" @click="toLogin">登录</view>
<view class="agreement flex-start">
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
size="12"></u-checkbox></u-checkbox-group>
<text>阅读并同意银收客</text>
<view class="agreement-Item" @click="Privacy(1)">用户协议</view>
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view>
</view>
<view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view>
<u-overlay :show="agreeShow">
<view class="warp">
<view class="rect">
<view class="rect_img"></view>
<view class="rect_text flex-colum">
<view class="rect_text_one">用户须知</view>
<view class="rect_text_tow">
感谢您使用银收客我们非常重视您的个 人信息和隐私保护在您使用服务前请仔 细阅读
<text @click="Privacy(1)">用户协议</text>
<text @click="Privacy(2)">隐私协议</text>
</view>
<view class="rect_text_there">如您同意此条款请点击同意并开始使 用我们的产品和服务我们将尽全力保护您 的个人信息安全</view>
<view class="rect_text_four flex-between">
<view class="rect_text_four_o" @click="refuse">拒绝</view>
<view class="rect_text_four_t" @click="agree">同意</view>
</view>
</view>
</view>
</view>
</u-overlay>
<u-popup :show="showpopup" mode="center">
<view style="width: 600rpx; height: 100rpx">
<u--input style="width: 100%; height: 100%" placeholder="请输入内容" border="surround" @blur="blurinput"
v-model="valueinput"></u--input>
</view>
</u-popup>
<u-picker :show="showpicker" @cancel="showpicker = false" :columns="columns"
@confirm="confirmpicker"></u-picker>
</view>
</template>
@@ -33,249 +70,391 @@
export default {
data() {
return {
phone: ''
}
showpicker: false,
showpopup: false,
valueinput: '',
columns: [
['http://admintestapi.sxczgkj.cn/', 'https://ky.sxczgkj.cn', 'http://192.168.2.22:7004',
'http://admintestapi.sxczgkj.cn/', '自定义输入'
]
],
radioChangeItem: false, //单选框
agreeShow: false,
h: null, //动态高度
showPassword: false, //是否显示密码
debug: uni.conf.debug,
baseUrl: uni.conf.baseUrl,
form: {
//密码
loginName: '',
password: ''
}
};
},
mounted() {
this.computed_h();
},
onLoad() {
uni.cache.clear();
},
onLoad() {},
methods: {
async userlogin() {
// #ifdef MP-WEIXIN || MP-ALIPAY
uni.login({ //alipay weixin
// #ifdef MP-ALIPAY
provider: 'alipay',
// #endif
// #ifdef MP-WEIXIN
provider: 'weixin',
// #endif
success: async (data) => {
try {
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
console.log(infoRes, 81);
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
encryptedData: infoRes
.encryptedData, // 用户非敏感信息
rawData: infoRes.rawData,
signature: infoRes.signature,
iv: infoRes.iv,
phone: this.phone
})
if (res.code == 0) {
console.log(res, 88)
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index')
}
},
fail: (err) => {
console.log(err)
}
});
} catch (e) {
console.log(e)
}
}
});
// 同意隐私政策
agree() {
uni.setStorageSync('agree', 1);
this.agreeShow = false;
},
blurinput(e) {
console.log(e);
uni.conf.baseUrl = e;
this.baseUrl = e;
this.showpopup = false;
},
confirmpicker(e) {
this.showpicker = false;
if (e.value == '自定义输入') {
this.showpopup = true;
} else {
this.baseUrl = e.value[0];
uni.conf.baseUrl = e.value;
}
},
// 拒绝隐私政策-退出应用
refuse() {
// #ifdef APP-PLUS
//android 退出方法
plus.runtime.quit();
// ios 退出方法
plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
// #endif
},
async getPhoneNumber(res) { // 获取手机号
var resdataa = res
console.log(res)
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let resdata = await this.api.logingetPhoneNumber({
code: data.code,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
console.log(resdata)
if (resdata.data) {
this.phone = resdata.data
this.userlogin()
}
// this.userlogin()
}
});
// #endif
// #ifdef MP-WEIXIN
// #endif
radioChange(n) {
//是否同意
this.radioChangeItem = n;
},
},
display() {
// 切换图片显示隐藏
this.showPassword = !this.showPassword;
},
async Privacy(e) {
if (e == 1) {
//用户协议
let res = await this.api.agreementgetAgreementOne({
discern: 0
});
uni.pro.navigateTo('my/about/agreement', {
discern: 0,
list: res.data.content
});
} else {
let res3 = await this.api.agreementgetAgreementOne({
discern: 3
});
uni.pro.navigateTo('my/about/agreement', {
discern: 3,
list: res3.data.content
});
}
},
rightClick() {
console.log(11);
uni.switchTab({
url: '/pages/device_shop/index'
});
},
register() {
uni.navigateTo({
url: '../login/register'
});
},
passwords() {
uni.navigateTo({
url: '../login/password'
});
},
async computed_h() {
//获取div宽度
let content_Icon = await uni.utils.info_distance('box');
let system_info = await uni.getSystemInfo();
let h = null;
h = system_info.windowHeight - content_Icon.height + 'px';
this.h = {
height: h
};
},
async toLogin() {
//登录
if (this.form.loginName == null || this.form.loginName == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '' || uni.$u.trim(this.form.password, 'all') ==
'') {
uni.showToast({
title: '请输入密码或密码不能输入空格',
icon: 'none'
});
return false;
}
if (this.radioChangeItem == false) {
uni.showToast({
icon: 'none',
title: '请先阅读《用户协议》和《隐私政策》'
});
return;
}
let res = await this.api.Login({
loginName: this.form.loginName,
password: this.form.password
});
console.log(res);
if (res.code == 200) {
uni.cache.set('loginName', this.form.loginName + '');
uni.cache.set('password', this.form.password + '');
uni.cache.set('token', res.data.userApp.token);
uni.cache.set('myLoginName', res.data.userInfo.loginName);
uni.cache.set('userId', res.data.userInfo.id);
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('userApp', res.data.userApp);
}
// 积分商城用到的token
// uni.cache.set('rechargeToken', res.data.rechargeToken);
this.$store.commit('set_login', true);
this.$store.commit('userInfo', res.data.userInfo);
this.$store.commit('userApp', res.data.userApp);
this.$store.dispatch('USerVoiceactions'); //获取语音播报初始数据
// #ifdef APP-PLUS
try {
let pinf = plus.push.getClientInfo();
let cid = (pinf && pinf.clientid) || ''; //客户端标识
uni.cache.set('cid', cid);
let res = await this.api.pushbindalias({
cid: cid
});
console.log('cid res===', res);
console.log('cid===', cid);
} catch (e) {
console.log('ciderr===', e);
//TODO handle the exception
}
// #endif
uni.pro.switchTab('/pages/index/index');
} else {
this.$api.msg(res.message);
}
}
}
};
</script>
<style lang="scss">
page {
background: #F9F9F9;
width: 100%;
height: 100%;
background: linear-gradient(104deg, #4679ff 0%, #2868e8 47%, #2a94fc 100%);
}
button {}
.container {
position: relative;
.containerbox {
position: relative;
width: 100%;
.top {
position: absolute;
left: 64rpx;
.containerimage_logo {
margin-top: 66rpx;
border-radius: 50%;
width: 120rpx;
height: 120rpx;
.u-navbar--fixed {
top: 88rpx;
}
}
image {
.box {
padding-top: 228rpx;
padding-left: 64rpx;
padding-bottom: 144rpx;
box-sizing: border-box;
text {
font-size: 40rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #ffffff;
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.rect {
width: 606rpx;
background-color: #fff;
border-radius: 12rpx;
.rect_img {
// background: url(@/static/login/uoverlay.png) no-repeat;
background-size: 100% 100%;
width: 100%;
height: 100%;
height: 120px;
}
}
.containertext {
margin-top: 32rpx;
font-size: 28rpx;
}
.rect_text {
padding: 0 40rpx;
.rect_text_one {
margin-top: 32rpx;
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
.containerbottom {
margin-top: 40rpx;
border-top: 1px solid #ccc;
width: 100%;
padding: 0 28rpx;
.containerbottom_text {
margin-top: 32rpx;
text:nth-child(1) {
.rect_text_tow {
margin-top: 32rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
text {
color: #2f87fd;
}
color: #333333;
}
text:nth-child(2) {
font-size: 24rpx;
color: #847f7f;
}
}
.containerbottom_item {
margin-top: 60rpx;
.containerbottomone {
padding: 10rpx 80rpx;
font-size: 24rpx;
.rect_text_there {
margin-top: 16rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.containerbottomone::after {
background: none;
border: 1px solid #000;
}
.rect_text_four {
width: 100%;
padding: 48rpx 40rpx 30rpx 40rpx;
.containerbottomtow {
font-size: 24rpx;
background: #baf505;
border: none;
padding: 10rpx 80rpx;
}
.rect_text_four_o {
padding: 16rpx 64rpx;
background: #ffffff;
border-radius: 36rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
border: 2rpx solid #333333;
}
.containerbottomtow::after {
background: none;
border: none;
.rect_text_four_t {
background: #2f87fd;
padding: 16rpx 64rpx;
border-radius: 36rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #ffffff;
}
}
}
}
}
.wrapper {
position: relative;
top: -118rpx;
z-index: 90;
padding: 0 28rpx;
.box_conf {
position: fixed;
top: 10%;
color: #fff;
padding: 20rpx;
right: 2%;
}
.wrapper_box {
.top_box::after {
position: absolute;
// content: url(@/static/icon.png);
width: 282rpx;
height: 280rpx;
top: -240rpx;
right: 32rpx;
z-index: 2;
}
.top_box {
z-index: 9;
padding: 0 64rpx;
box-sizing: border-box;
width: 100%;
position: fixed;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;
.top_box_one {
position: relative;
width: 100%;
background: #FFFFFF;
border-radius: 32rpx;
padding: 16rpx 30rpx;
margin-top: 64rpx;
border-bottom: 6rpx solid #e5e5e5;
.input_content {
.input_item {
margin-top: 32rpx;
.input_itemone {
width: 49.68rpx;
height: 49.68rpx;
}
.input_itemtow {
position: relative;
flex: auto;
margin-left: 16rpx;
.input_itemtowicon {
position: absolute;
right: 0;
bottom: 20rpx;
z-index: 999;
}
.tit {
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
input {
width: 100%;
padding: 10rpx 0;
border-bottom: 2rpx solid rgba(229, 229, 229, 0.7);
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #999999;
}
}
}
}
.agreement {
margin-top: 24rpx;
font-size: 20rpx;
.top_box_one_text {
font-size: 36rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
.agreement-Item {
color: #4ca1fc;
}
color: #333333;
}
.confirm-button {
margin: 40rpx auto 50rpx auto;
width: 90%;
background: #2F87FD;
padding: 28rpx 0;
border-radius: 50rpx;
text-align: center;
box-shadow: 0px 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
font-size: 36rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #FFFFFF;
input {
height: auto;
padding: 18rpx 0 20rpx 0;
}
.repeat {
position: absolute;
bottom: 26rpx;
right: 0;
width: 25rpx;
height: 17rpx;
}
}
.top_box_tow {
width: 100%;
text {
margin-top: 34rpx;
font-size: 24rpx;
font-family: $uni_family;
font-weight: 400;
color: #666666;
}
}
.toLogin {
width: 570rpx;
margin-top: 112rpx;
padding: 10rpx 0;
text-align: center;
background: #288efb;
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 36rpx;
font-family: $uni_family;
font-weight: 400;
color: #ffffff;
}
.agreement {
margin-top: 14rpx;
font-size: 20rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
.agreement-Item {
color: #4ca1fc;
}
}
}
}
</style>

281
pages/login/loginw.vue Normal file
View File

@@ -0,0 +1,281 @@
<template>
<view class="container">
<view class="containerbox flex-colum">
<view class="containerimage_logo">
<image class="input_itemone" src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/manage/login2.png"
mode=""></image>
</view>
<view class="containertext">
微信昵称
</view>
<view class="containerbottom">
<view class="containerbottom_text flex-colum-start">
<text>该程序获得以下授权</text>
<text>获得您的手机号</text>
</view>
<view class="containerbottom_item flex-between">
<navigator class="containerbottomone" open-type="exit" target="miniProgram"><button
class="containerbottomone" open-type="launchApp" app-parameter="wechat"
binderror="launchAppError">
暂不授权
</button></navigator>
<button class="containerbottomtow" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
确认授权
</button>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
phone: ''
}
},
onLoad() {
uni.cache.clear();
},
methods: {
async userlogin() {
// #ifdef MP-WEIXIN || MP-ALIPAY
uni.login({ //alipay weixin
// #ifdef MP-ALIPAY
provider: 'alipay',
// #endif
// #ifdef MP-WEIXIN
provider: 'weixin',
// #endif
success: async (data) => {
try {
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
console.log(infoRes, 81);
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
encryptedData: infoRes
.encryptedData, // 用户非敏感信息
rawData: infoRes.rawData,
signature: infoRes.signature,
iv: infoRes.iv,
phone: this.phone
})
if (res.code == 0) {
console.log(res, 88)
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index')
}
},
fail: (err) => {
console.log(err)
}
});
} catch (e) {
console.log(e)
}
}
});
// #endif
},
async getPhoneNumber(res) { // 获取手机号
var resdataa = res
console.log(res)
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let resdata = await this.api.logingetPhoneNumber({
code: data.code,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
console.log(resdata)
if (resdata.data) {
this.phone = resdata.data
this.userlogin()
}
// this.userlogin()
}
});
// #endif
// #ifdef MP-WEIXIN
// #endif
},
},
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
button {}
.container {
position: relative;
.containerbox {
position: relative;
width: 100%;
.containerimage_logo {
margin-top: 66rpx;
border-radius: 50%;
width: 120rpx;
height: 120rpx;
image {
width: 100%;
height: 100%;
}
}
.containertext {
margin-top: 32rpx;
font-size: 28rpx;
}
.containerbottom {
margin-top: 40rpx;
border-top: 1px solid #ccc;
width: 100%;
padding: 0 28rpx;
.containerbottom_text {
margin-top: 32rpx;
text:nth-child(1) {
font-size: 28rpx;
}
text:nth-child(2) {
font-size: 24rpx;
color: #847f7f;
}
}
.containerbottom_item {
margin-top: 60rpx;
.containerbottomone {
padding: 10rpx 80rpx;
font-size: 24rpx;
}
.containerbottomone::after {
background: none;
border: 1px solid #000;
}
.containerbottomtow {
font-size: 24rpx;
background: #baf505;
border: none;
padding: 10rpx 80rpx;
}
.containerbottomtow::after {
background: none;
border: none;
}
}
}
}
.wrapper {
position: relative;
top: -118rpx;
z-index: 90;
padding: 0 28rpx;
.wrapper_box {
width: 100%;
background: #FFFFFF;
border-radius: 32rpx;
padding: 16rpx 30rpx;
.input_content {
.input_item {
margin-top: 32rpx;
.input_itemone {
width: 49.68rpx;
height: 49.68rpx;
}
.input_itemtow {
position: relative;
flex: auto;
margin-left: 16rpx;
.input_itemtowicon {
position: absolute;
right: 0;
bottom: 20rpx;
z-index: 999;
}
.tit {
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
input {
width: 100%;
padding: 10rpx 0;
border-bottom: 2rpx solid rgba(229, 229, 229, 0.7);
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #999999;
}
}
}
}
.agreement {
margin-top: 24rpx;
font-size: 20rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
.agreement-Item {
color: #4ca1fc;
}
}
.confirm-button {
margin: 40rpx auto 50rpx auto;
width: 90%;
background: #2F87FD;
padding: 28rpx 0;
border-radius: 50rpx;
text-align: center;
box-shadow: 0px 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
font-size: 36rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #FFFFFF;
}
}
}
}
</style>

345
pages/login/register.vue Normal file
View File

@@ -0,0 +1,345 @@
<template>
<view class="container">
<view class="box flex-colum-start">
<text>您好</text>
<text>欢迎使用银收客</text>
</view>
<view class="top_box" :style="h">
<view class="top_box_one">
<text class="top_box_one_text">用户昵称</text>
<input type="text" v-model="form.nickName" placeholder="请输入用户昵称" data-key="mobile" />
</view>
<view class="top_box_one">
<text class="top_box_one_text">手机号码</text>
<input type="text" v-model="form.telephone" placeholder="请输入手机号码" data-key="mobile" />
</view>
<view class="top_box_one">
<text class="top_box_one_text">密码</text>
<input type="mobile" v-model="form.password" placeholder="8-16位密码" maxlength="16" :password="!showPassword" />
<view class="repeat" @click="display">
<u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon>
</view>
</view>
<view class="top_box_one">
<text class="top_box_one_text">验证码</text>
<input type="mobile" v-model="form.code" placeholder="请输入短信验证码" maxlength="6" />
<view class="repeats">
<view v-if="showText == true" class="yzm" style="padding: 8rpx 16rpx 6rpx 16rpx; background: #288efb; border-radius: 15rpx" @click="CodeRegister">
{{ Recapture }}
</view>
<view v-else style="color: #ccc; background-color: #f9f9f9; padding: 8rpx 16rpx 6rpx 16rpx; border-radius: 15rpx">{{ second }}s重新发送</view>
</view>
</view>
<!-- <view class="top_box_one">
<text class="top_box_one_text" @click="showTips">
邀请码选填
<uni-icons type="help" size="18"></uni-icons>
</text>
<input type="mobile" v-model="form.inviteCode" placeholder="请输入邀请人邀请码" />
</view> -->
<view class="Register" @click="Register">注册</view>
<view class="agreement flex-start">
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange" size="12"></u-checkbox></u-checkbox-group>
<text>阅读并同意银收客</text>
<view class="agreement-Item" @click="Privacy(1)">用户协议</view>
<view class="agreement-Item" @click="Privacy(3)">隐私政策</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
radioChangeItem: false, //单选框
h: null,
showPassword: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码',
form: {
nickName:'',
telephone: '',
password: '',
code: '',
inviteCode: ''
}
};
},
mounted() {
this.computed_h();
},
onLoad() {},
methods: {
showTips() {
uni.showModal({
title: '注意',
content: '若该邀请码的用户无推广权限,将自动绑定到其上级名下',
showCancel: false
});
},
leftClick() {
uni.navigateBack();
},
async CodeRegister() {
//发起验证码
if (this.form.telephone == null || this.form.telephone == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.apix.phoneValidateCode({
// post 手机验证码
phone: this.form.telephone
});
console.log(res);
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
radioChange(n) {
//是否同意
console.log(n);
this.radioChangeItem = n;
},
display() {
// 切换密码显示隐藏
this.showPassword = !this.showPassword;
},
async Privacy(e) {
if (e == 1) {
//用户协议
let res = await this.api.agreementgetAgreementOne({
discern: 0
});
uni.pro.navigateTo('my/about/agreement', { discern: 0, list: res.data.content });
} else {
let res3 = await this.api.agreementgetAgreementOne({
discern: 3
});
uni.pro.navigateTo('my/about/agreement', { discern: 3, list: res3.data.content });
}
},
async computed_h() {
//获取div宽度
let content_Icon = await uni.utils.info_distance('box');
let content_top_box = await uni.utils.info_distance('top_box');
let system_info = await uni.getSystemInfo();
var h_ = null;
if (content_Icon.height + content_top_box.height > system_info.windowHeight) {
console.log(135);
h_ = content_top_box.height + 30 + 'px';
} else {
h_ = system_info.windowHeight - content_Icon.height + 'px';
}
this.h = {
height: h_
};
},
async Register() {
//注册
if (this.form.nickName == null || this.form.nickName == '') {
uni.showToast({
title: '请输入用户昵称',
icon: 'none'
});
return false;
}
if (this.form.telephone == null || this.form.telephone == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '' || uni.$u.trim(this.form.password, 'all') == '') {
uni.showToast({
title: '请输入密码或密码不能输入空格',
icon: 'none'
});
return false;
}
if (this.form.code == null || this.form.code == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
if (this.radioChangeItem == false) {
uni.showToast({
icon: 'none',
title: '请先阅读《用户协议》和《隐私政策》'
});
return;
}
let res = await this.apix.cashierServiceloginregister({
telephone: this.form.telephone,
nickName: this.form.nickName,
password: this.form.password,
code: this.form.code,
// inviteCode: this.form.inviteCode,
source: 'promoter'
});
if (res) {
setTimeout((res) => {
uni.showToast({
title: '注册成功',
icon: 'none',
success: () => {
uni.navigateTo({
url: '../login/login'
});
}
});
}, 1500);
// uni.cache.set('storage:authorization', res.data.auth_token);
// this.$store.commit('set_login', true);
// uni.pro.switchTab('index/index');
}
// if (result.status === 1) {
// this.login(result.data);
// uni.navigateBack();
// } else {
// this.$api.msg(result.msg);
// this.logining = false;
// }
}
}
};
</script>
<style lang="scss">
page {
width: 100%;
background: linear-gradient(104deg, #4679ff 0%, #2868e8 47%, #2a94fc 100%);
}
.container {
position: relative;
.top {
position: absolute;
left: 64rpx;
.u-navbar--fixed {
top: 88rpx;
}
}
.box {
padding-top: 228rpx;
padding-left: 64rpx;
padding-bottom: 144rpx;
text {
font-size: 40rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #ffffff;
}
}
.top_box::after {
position: absolute;
// content: url(@/static/icon.png);
width: 282rpx;
height: 280rpx;
top: -240rpx;
right: 32rpx;
z-index: 2;
}
.top_box {
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;
.top_box_one {
position: relative;
width: 85%;
margin-top: 64rpx;
border-bottom: 6rpx solid #e5e5e5;
.top_box_one_text {
display: flex;
align-items: center;
font-size: 36rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
input {
padding: 18rpx 0 20rpx 0;
}
.repeat {
position: absolute;
bottom: 26rpx;
right: 0;
width: 25rpx;
height: 17rpx;
}
.repeats {
position: absolute;
bottom: 26rpx;
right: 0;
font-size: 24rpx;
z-index: 9;
font-family: $uni_family;
font-weight: 400;
color: #ffffff;
border-radius: 12rpx;
}
}
.top_box_tow {
width: 85%;
text {
margin-top: 34rpx;
font-size: 24rpx;
font-family: $uni_family;
font-weight: 400;
color: #666666;
}
}
.Register {
width: 75%;
margin-top: 112rpx;
padding: 10rpx 0;
text-align: center;
background: #288efb;
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 36rpx;
font-family: $uni_family;
font-weight: 400;
color: #ffffff;
}
.agreement {
margin-top: 14rpx;
font-size: 20rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
.agreement-Item {
color: #4ca1fc;
}
}
}
}
</style>