You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

350 lines
8.4 KiB

<template>
<view>
<view class="profile_item profile_item1" @click="gotochange">
<text>Photo</text>
<view class="profile_item_right">
<image src="../../static/img/logo.png" mode="" class="head_img" v-show="!user_info.isLogin"></image>
<image :src="user_info.user_head" mode="" class="head_img"></image>
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<view class="profile_item ">
<!-- <view class="profile_item " @click="$refs.inputDialog.open()"> -->
<text>Name</text>
<view class="profile_item_right">
<text>{{user_info.nickname}}</text>
<image src="" alt="" class="right_img"></image>
<!-- <image v-show="" src="../../static/img/right1.png" alt="" class="right_img"></image> -->
</view>
</view>
<view class="profile_item " @click="ss">
<!-- <view class="profile_item " @click="$refs.inputDialog.open()"> -->
<text>Email</text>
<view class="profile_item_right">
<image src="../../static/img/gantan.png" alt="" class="right_img1" v-if="user_info.is_validated==0">
</image>
<image src="../../static/img/qr.png" alt="" class="right_img1" v-if="user_info.is_validated!=0"></image>
<text>{{user_info.is_validated==0?'Unverified':''+user_info.email}}</text>
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<navigator :url="'/pages/login/verifyEmail?type=0&email='+user_info.email">
<view class="profile_item ">
<text>Change Password</text>
<view class="profile_item_right">
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
</navigator>
<view class="profile_item" @click="gotoaddress">
<text>Ship to</text>
<view class="profile_item_right">
<!-- <text>{{addressDate.country_name || 'United States'}}</text> -->
<text>{{ country }}</text>
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<navigator url="/pages/account/deleteCount">
<view class="profile_item ">
<text>Delete account</text>
<view class="profile_item_right">
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
</navigator>
<uni-popup ref="inputDialog" type="dialog" :mask-click="false">
<view style=" position: absolute;top: 45%;left: 50%;transform: translate(-50%, -50%);color: #909399;">{{query.email}}</view>
<uni-popup-dialog ref="inputClose" title="Email verification" cancelText="Cancel"
confirmText="Verify" :before-close="true" @close="close"
@confirm="dialogInputConfirm">
</uni-popup-dialog>
<view class="get" style="position: absolute;right: 21px;bottom: 12px;" @tap="getCheckNum()">
<text>{{!codeTime?'':codeTime+'s'}}</text>
</view>
</uni-popup>
</view>
</template>
<script>
import {
defaultRequest,
defaultRequest2
} from '../../api/index.js'
export default {
data() {
return {
value: '',
codeTime:0,
second: 60,
showText: true,
user_info: {
isLogin: false,
},
query: {
_action: 'updateinfo',
nickname: '',
user_head: '',
email: ''
},
query2: {
_action: 'sendmessagesforvalidation',
username: '',
// password: '',
},
addressDate: {},
country: ''
}
},
methods: {
ss() {
if (this.user_info.is_validated == 0) {
this.$refs.inputDialog.open()
} else {
}
},
getCheckNum() {
},
inputpassword(e) {
console.log(e);
this.$refs.inputDialog.open()
},
close() {
this.$refs.inputDialog.close()
},
change(e) {
this.show = e.show
},
//换头像
gotochange() {
uni.navigateTo({
url: './changeImg'
})
},
getaddress() {
let data = {
_action: 'getregions',
parent_region_id: 0
}
defaultRequest(data).then(res => {
console.log(JSON.parse(res), 'p')
})
},
// 获取默认地址
getDefaultAddress() {
let data = {
_action: 'getdefaultconsignee'
}
defaultRequest2(data).then(res => {
console.info(res)
if (res.error == 0) {
this.addressDate = res.data
}
})
},
getUserInfo() {
let data = {
_action: 'getinfo'
}
defaultRequest2(data).then(res => {
// console.info(res, 'pph')
if (res.error == 0) {
res.data.isLogin = true
this.user_info = res.data
uni.setStorageSync('user_info', this.user_info)
// this.user_info=uni.getStorageSync('user_info')
} else {
this.user_info = uni.getStorageSync('user_info')
}
})
},
// 邮箱
dialogInputConfirm(e) {
uni.showToast({
title: 'We have sent you an email with a link to verify your email address. Please click on it to verify your account.',
icon: "none"
})
// 倒计时
if (this.codeTime > 0) {
uni.showToast({
title: 'Please wait',
icon: "none"
});
return;
} else {
this.codeTime = 60
let timer = setInterval(() => {
this.codeTime--;
if (this.codeTime < 1) {
clearInterval(timer);
this.codeTime = 0
}
}, 1000)
}
// 倒计时结束
console.log('===========',e)
console.log('===========', this.user_info.nickname)
this.query2.password = e
this.query2.username = this.user_info.nickname
// setTimeout(() => {
// // 关闭窗口后,恢复默认内容
// uni.showToast({
// title: this.second,
// duration: 600,
// icon: "none"
// })
// }, 2000)
// val = this.query.email
// this.query.user_head = this.user_info.user_head
if (this.query2.username !== '') {
this.query2.username = ''
// uni.showToast({
// title: '已登陆',
// icon: 'none'
// })
}else {
// uni.showToast({
// title: '未登录',
// icon: 'none'
// })
}
console.log('this.query2', this.query2)
defaultRequest2(this.query2).then(res => {
console.info(res, '///')
if (res.error == 0) {
// this.query2.username = ''
// uni.showToast({
// title: res.message,
// icon: 'none'
// })
this.getUserInfo()
} else {
// console.log(1111111);
// uni.showToast({
// title: res.message,
// icon: 'none',
// duration: 6666
// })
}
})
},
gotoaddress() {
uni.navigateTo({
url: '../index/address'
})
},
goEmail() {
// uni.navigateTo({
// url:'../login/verifyEmail'
// })
}
},
onLoad(e) {
console.log('====', e)
let that = this;
let s = 0;
let time = setInterval(() => {
uni.getNetworkType({
success: (res) => {
console.log(res.networkType, s);
if (res.networkType == 'none') {
uni.showToast({
icon: 'none',
title: 'Please connect to the network',
duration: 3000,
})
} else if (res.networkType !== 'none') {
that.typee = 2;
clearInterval(time);
}
}
})
s++;
}, 1000);
console.log(e, 'address')
this.country = uni.getStorageSync('country')
console.log(this.country)
console.info(e)
this.type = e.type
if (e.type != 0) {
this.query.email = e.password
this.query.username = e.email
} else {
}
this.username = e.email
this.sendresetcode()
},
onShow() {
this.user_info = uni.getStorageSync('user_info')
console.log(this.user_info, 'ppppp')
console.log(this.user_info.email);
this.query.email = this.user_info.email.substring(0, 3) + '****' + this.user_info.email.substring(7);
console.log(this.query.email);
this.getUserInfo()
this.getDefaultAddress()
}
}
</script>
<style>
page {
border-top: 13.33rpx #F7F7F7 solid;
padding-left: 26.67rpx;
}
</style>
<style lang="scss" scoped>
.profile_item {
width: 97%;
display: flex;
margin-right: 3%;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
font-weight: bold;
padding: 40rpx 0rpx;
padding-right: 30.33rpx;
border-bottom: 1.33rpx #ECECEC solid;
box-sizing: border-box;
.profile_item_right {
display: flex;
align-items: center;
.head_img {
width: 112rpx;
height: 112rpx;
border-radius: 50%;
}
.right_img {
width: 18.67rpx;
height: 18.67rpx;
margin-left: 20rpx;
}
.right_img1 {
width: 25.33rpx;
height: 25.33rpx;
margin-right: 9.33rpx;
}
}
}
.profile_item1 {
padding: 17.33rpx 0rpx;
padding-right: 33.33rpx;
}
</style>