初始化

This commit is contained in:
魏啾
2024-03-21 15:43:18 +08:00
parent 08c5d22de6
commit fab2d5f480
534 changed files with 76501 additions and 1 deletions

313
pages/my/setup/index.vue Normal file
View File

@@ -0,0 +1,313 @@
<template>
<view class="index" :style="[theme]">
<view class="onecontent">
个人信息
</view>
<view class="towcontent">
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
头像
</view>
<view class="towcontent_item_box">
<button open-type="chooseAvatar" @chooseavatar='onChooseAvatar' style="padding: 0;margin: 0;">
<image class="towcontent_item_box_imge" :src="urlavatar" mode="aspectFill"></image>
<!-- <image v-else class="towcontent_item_box_imge" src="@/static/logo.png" mode="aspectFill"></image> -->
</button>
<!-- <image v-if="userlist.avatar" class="towcontent_item_box_imge" :src="userlist.avatar" mode="aspectFill">
</image>
-->
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
UID
</view>
<view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">ID:{{userlist.user_id}}</text>
<!-- <u-icon name="arrow-right" color="#909399" size="14"></u-icon> -->
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
昵称
</view>
<view class="towcontent_item_box flex-start">
<input class="towcontent_item_box_text" style="text-align: right;" type="nickname" @blur="blurname"
v-model="userlist.nickname" placeholder="请输入昵称">
<!-- <text class="towcontent_item_box_text">{{userlist.nickname||'暂无您称'}}</text> -->
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
性别
</view>
<view class="towcontent_item_box flex-start">
<u-radio-group v-model="userlist.gender" placement="row" @change="groupChange">
<u-radio shape="circle" label="男" name="1"></u-radio>
<u-radio style="margin-left: 10rpx;" shape="circle" label="女" name="2"></u-radio>
</u-radio-group>
</view>
</view>
<view class="towcontent_item flex-between" @click="datetimeshow = true">
<view class="towcontent_item_text">
生日
</view>
<view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">{{userlist.birthday || ''}}</text>
<u-icon name="arrow-right" color="#909399" size="14"></u-icon>
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
手机号
</view>
<view class="towcontent_item_box flex-start" v-if="userlist.mobile">
<text
class="towcontent_item_box_text">{{userlist.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') }}</text>
<!-- <navigator :url="'/pages/my/setup/phone'" class="towcontent_item_box_ghbd">
更换绑定
</navigator>
<button class="towcontent_item_box_ghbd" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber">获取电话</button>-->
</view>
<!-- <navigator :url="'/pages/my/setup/phone'" v-else class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">去绑定</text>
<u-icon name="arrow-right" color="#909399" size="14"></u-icon>
</navigator> -->
<view v-else class="towcontent_item_box flex-start">
<button class="towcontent_item_box_ghbd" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber">获取电话</button>
</view>
</view>
</view>
<view class="thereconse thereconses" @click="useruserinfoedit">
保存
</view>
<u-datetime-picker :minDate="-946800000000" :maxDate="2240409600000" :show="datetimeshow"
v-model="datetimevalue" @cancel='datetimeshow = false' @confirm="confirmdatetime"
mode="date"></u-datetime-picker>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
import WXBizDataCrypt from "@/common/js/WXBizDataCrypt.js" // 需要引入
export default {
data() {
return {
urlavatar: '',
userlist: {},
datetimeshow: false,
datetimevalue: '',
// u-radio-group的v-model绑定的值如果设置为某个radio的name就会被默认选中
};
},
onLoad() {},
computed: {
theme() {
return this.$store.getters.theme
},
},
onShow() {
this.useruserinfo()
},
watch: {},
methods: {
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, '',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.urlavatar = result
console.log(this.urlavatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
// 获取昵称
blurname(e) {
console.log(e);
this.userlist.nickname = e.detail.value
},
async useruserinfo() {
let res = await this.api.useruserinfo()
uni.cache.set('loginuser', res);
this.userlist = res.userinfo
this.userlist.gender = String(res.userinfo.gender)
this.urlavatar = res.userinfo.avatar
},
async useruserinfoedit() {
if (this.userlist.mobile == '' || this.userlist.mobile == null) {
uni.showToast({
icon: 'none',
title: '请先绑定手机号'
});
return;
}
if (this.urlavatar == '' || this.urlavatar == null) {
uni.showToast({
icon: 'none',
title: '头像不能为空'
});
return;
}
if (this.userlist.gender == '' || this.userlist.gender == null) {
uni.showToast({
icon: 'none',
title: '性别不能为空'
});
return;
}
if (this.userlist.birthday == '' || this.userlist.birthday == null) {
uni.showToast({
icon: 'none',
title: '生日不能为空'
});
return;
}
let res = await this.api.useruserinfoedit({
avatar: this.urlavatar,
nickname: this.userlist.nickname,
gender: this.userlist.gender,
birthday: this.userlist.birthday
})
uni.showToast({
title: '修改成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
console.log(res)
},
confirmdatetime(e) {
console.log(e)
this.datetimeshow = false
this.userlist.birthday = uni.$u.date(e.value, 'yyyy-mm-dd')
},
groupChange(n) {
console.log(n)
this.userlist.gender = n
},
async getPhoneNumber(res) { // 获取手机号
var resdataa = res
console.log(res)
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let resdata = await this.api.usergetwechatphone({
code: data.code,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
this.userlist.mobile = resdata.mobile
}
});
// #endif
// #ifdef MP-WEIXIN
// #endif
},
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
::v-deep .u-radio{
margin-left: 10rpx;
}
.index {
padding: 28rpx;
.onecontent {
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #666666;
}
.towcontent {
padding: 0 32rpx;
margin-top: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 12rpx;
.towcontent_item:nth-child(1) {
border-top: none;
}
.towcontent_item {
padding: 22rpx;
border-top: 1rpx dotted #ccc;
.towcontent_item_text {
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.towcontent_item_box {
.towcontent_item_box_imge {
width: 64rpx;
height: 64rpx;
}
.towcontent_item_box_text {
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
}
.towcontent_item_box_ghbd {
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #9397C1;
border-radius: 10rpx;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 84rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
}
.thereconses {
background: var(--bg-color-button);
}
}
</style>

249
pages/my/setup/phone.vue Normal file
View File

@@ -0,0 +1,249 @@
<template>
<view class="Box">
<!-- <view class="Box_one">设置新手机</view>
<view class="Box_T">设置新手机号需要通过短信验证</view>
<view class="Box_there">当前手机号{{ form.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') }}</view> -->
<view class="Box_consitem">
<view class="Box_box flex-start">
<text class="top_box_one_text">中国大陆+86</text>
<input type="number" class="top_box_one_textinput" v-model="form.mobile" style="font-size: 24rpx;"
placeholder="请输入手机号" maxlength="11" data-key="mobile" />
</view>
<view class="Box_box flex-between"
style="padding: 14rpx 0;border-top: 1rpx solid #efefef;border-bottom: 1rpx solid #efefef; margin-top: 0;">
<text class="top_box_one_text" style="border-right:none;">验证码</text>
<input type="number" style="font-size: 24rpx;" v-model="form.code" placeholder="请输入短信验证码" />
<view class="top_box_one_texts">
<view v-if="showText == true" class="yzm" @click="CodeRegister">{{ Recapture }}</view>
<view v-else style="color: #ccc; background-color: #f9f9f9; border-radius:16px; padding: 10rpx;">
{{ second }}s重新发送
</view>
</view>
</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 class="flex-colum">
<view class="Box_bottom" @click="userInfochangePhone">确定</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
radioChangeItem: false, //单选框
form: {
mobile: '',
code: '',
oldPhone: '',
password: ''
},
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码'
};
},
onLoad() {},
computed: {},
methods: {
async CodeRegister() {
//发起验证码
if (this.form.mobile == null || this.form.mobile == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.api.smssend({
// post 手机验证码
mobile: this.form.mobile,
event: 'binding'
});
console.log(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) {
//是否同意
this.radioChangeItem = n;
},
async Privacy(e) {
let res = await this.api.useruserpolicy();
if (e == 1) {
//用户协议
uni.pro.navigateTo('webview/html', {
src: res.agreement
});
} else {
uni.pro.navigateTo('webview/html', {
src: res.policy
});
}
},
async userInfochangePhone() {
if (this.form.mobile == null || this.form.mobile == '') {
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.api.userbindingphone({
captcha: this.form.code,
mobile: this.form.mobile,
event: 'binding'
});
if (res) {
uni.showToast({
title: '成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack()
}, 1000);
}
}
}
};
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.Box {
padding: 0 28rpx;
.Box_one {
padding-top: 38rpx;
font-size: 40rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.Box_T {
margin-top: 2rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.Box_there {
margin-top: 70rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.Box_consitem {
background: #ffffff;
padding: 32rpx;
border-radius: 24rpx;
margin-top: 22rpx;
.Box_box {
padding: 18rpx 0;
.top_box_one_text {
width: auto;
padding: 0 20rpx;
font-size: 32rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
border-right: 1rpx solid #ccc;
}
.top_box_one_textinput {
margin-left: 20rpx;
}
input {
width: auto;
}
.top_box_one_texts {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
}
}
.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;
}
}
.flex-colum {
width: 100%;
margin-top: 64rpx;
.Box_bottom {
width: 558rpx;
height: 72rpx;
background: linear-gradient(115deg, #7E81A5 0%, #4D4E64 100%);
border-radius: 50rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
line-height: 72rpx;
text-align: center;
}
}
}
}
</style>

View File

@@ -0,0 +1,215 @@
<template>
<view class="Box" :style="[theme]">
<view class="box_one">安全密码用于支付退款确保资金安全</view>
<view class="box_item flex-between">
<text class="top_box_one_text">中国大陆+86</text>
<input type="number" v-model="form.mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
</view>
<view class="box_item flex-between">
<text class="top_box_one_text">密码</text>
<input type="number" v-model="form.password" placeholder="密码必须是6位" maxlength="6" :password="!passwords" />
</view>
<view class="box_item flex-between">
<text class="top_box_one_text">确认密码</text>
<input type="number" v-model="form.payPassword" placeholder="确认密码必须是6位" maxlength="6"
:password="!payPasswords" />
</view>
<view class="box_item flex-between" style="position:relative;">
<text class="top_box_one_text">验证码</text>
<input type="number" v-model="form.checkCode" placeholder="请输入验证码" style="padding-right: 140rpx;" />
<view class="top_box_one_texts">
<view v-if="showText == true" class="yzm" @click="CodeRegister">{{ Recapture }}</view>
<view v-else style="color: #ccc; background-color: #f9f9f9; border-radius:16px; padding: 10rpx;">
{{ second }}s重新发送
</view>
</view>
</view>
<view class="flex-colum">
<view class="Box_bottom" @click="userInfosavePayPassword">确定</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
mobile: uni.cache.get('loginuser').userinfo.mobile,
password: '',
payPassword: '',
checkCode: ''
},
passwords: false,
payPasswords: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码'
};
},
onLoad() {},
computed: {
theme() {
return this.$store.getters.theme
},
},
methods: {
async CodeRegister() {
//发起验证码
const res = await this.api.smssend({
mobile: this.form.mobile,
event: 'setpassword'
});
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);
}
},
async userInfosavePayPassword() {
console.log(this.form.payPassword, this.form.password)
if (this.form.mobile.length != 11) {
uni.showToast({
title: '手机号必须是11位',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (this.form.payPassword == null || this.form.payPassword == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (this.form.password.length != 6 || this.form.payPassword.length != 6) {
uni.showToast({
title: '密码必须是6位',
icon: 'none'
});
return false;
}
if (this.form.payPassword != this.form.password) {
uni.showToast({
title: '密码和确认密码不一致',
icon: 'none'
});
return false;
}
if (this.form.checkCode == null || this.form.checkCode == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
let res = await this.api.uservippassword({
password: this.form.password,
c_password: this.form.payPassword,
code: this.form.checkCode
})
if (res == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
}
}
};
</script>
<style lang="scss">
page {
background: #fff;
}
.Box {
padding: 0 28rpx;
.box_one {
margin-top: 26rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.box_item {
padding: 36rpx 0 0 0;
.top_box_one_text {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
input {
width: 75%;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.repeat {
position: absolute;
bottom: 26rpx;
right: 0;
width: 25rpx;
height: 17rpx;
}
.top_box_one_texts {
position: absolute;
right: 0;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
}
}
.flex-colum {
width: 100%;
margin-top: 156rpx;
.Box_bottom {
width: 558rpx;
height: 72rpx;
background:var(--bg-color-button);
border-radius: 50rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
line-height: 72rpx;
text-align: center;
}
}
}
</style>