首页静态完成

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,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>