红绿项目
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.
 
 
 
 

266 lines
5.4 KiB

<template>
<view class="content">
<view class="my-head">
<view class="my-info">
<view class="my-a">
<view class="my-img">
<!-- <img :src=`http://openweathermap.org/img/w/${item.weather[0].icon}.png`> -->
<image :src="'https://apitest.luck-work.com/'+MyInfo.headImgPath" mode=""></image>
</view>
<view class="my-nameid">
<view class="my-name">
{{MyInfo.nickname}}
</view>
<view class="my-id">
ID: {{MyInfo.userId}}
</view>
</view>
</view>
<view class="my-b">
<view class="my-tel">
Mobile: {{MyInfo.mobile}}
</view>
<view class="my-bal flex">
<view>Available Balance: 385813.55</view>
<view class="my-ap">
A+ Plan
</view>
</view>
</view>
<view class="my-c flex">
<view class="my-btn1" @click="goRecharge()">
recharge
</view>
<view class="my-btn2" @click="transferCode=1">
change nick name
</view>
</view>
</view>
</view>
<view class="my-bg">
<view class="my-body">
<view class="my-body-item" v-for="(item,index) in myAList" :key="item.id" @click="go(index)">
{{item.text}}
</view>
</view>
<view class="my-body-out" @click="logout">
logout
</view>
<cont></cont>
</view>
<u-mask :show="transferCode==1" :z-index="888"></u-mask>
<view class="tc" v-show="transferCode==1">
<view class="title">
change name
</view>
<view class="tc_body">
<view class="body_item ">
<input type="text" value="" placeholder="New user name"
placeholder-style="color: #BFC2CC;font-size:14px;text-transform: capitalize;padding-left:24rpx" v-model="newName"/>
</view>
</view>
<view class="anniu_con flex">
<view class="cancel" @click="transferCode=0">
cancel
</view>
<view class="cancel pupler" @click="changeName()">
confirm
</view>
</view>
</view>
</view>
</template>
<script>
import api from '@/utils/api'
import utils from '@/utils'
import cont from "@/components/cont/cont.vue"
export default{
data(){
return{
newName:'',
MyInfo:{},
transferCode:0,
myAList:[
{
id:'1',
text:'wallet'
},
{
id:'2',
text:'Bank card'
},
{
id:'3',
text:'Address'
},
{
id:'4',
text:'Reset password'
},
{
id:'5',
text:'Android download'
},
],
}
},
onLoad() {
uni.request({
url: '/start/api/user/userInfo',
data: {
"ticket": uni.getStorageSync('logInfo').data,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' //自定义请求头信息
},
method: 'POST', //请求方式 或GET,必须为大写
success: (res) => {
this.MyInfo=res.data.data;
console.log(this.MyInfo,9990);
uni.setStorage({
key: 'MyInfo',
data: res.data.data,
success: function() {
console.log('success')
}
});
console.log(res.data)
},
fail: (res) => {
console.log(res.data);
}
});
},
methods:{
go(i){
if(i==3){
uni.reLaunch({
url:'../../login/resetPassword/index'
})
}
if(i==4){
const androidUrl= uni.getStorageSync('siteInfo').androidUrl;
console.log(androidUrl)
uni.reLaunch({
url:androidUrl
})
}
},
changeName(){
uni.showLoading({
title:"loading"
})
if(this.newName==''){
uni.showToast({
title: 'The new user name cannot be empty',
icon: 'none',
duration: 1500
})
return;
}
uni.request({
url: '/start/api/user/updateNickname',
data: {
"ticket": uni.getStorageSync('logInfo').data,
"nickname":this.newName,
},
header: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' //自定义请求头信息
},
method: 'POST', //请求方式 或GET,必须为大写
success: (res) => {
if(res.data.success==true){
uni.showToast({
title: 'Modified successfully',
icon: 'success',
duration: 1500
})
setTimeout(function(){
location.reload();
},1000)
}else{
uni.showToast({
title: 'Modification failed',
icon: 'none',
duration: 1500
})
}
console.log(res.data,9990);
},
fail: (res) => {
uni.showToast({
title: res.data.errMsg,
icon: 'none',
duration: 1500
})
}
});
},
goRecharge(){
uni.reLaunch({
url:'../recharge/index'
})
},
logout(){
const param = {
"ticket": uni.getStorageSync('logInfo').data,
}
const post = api.loginOut(param)
post.then(res => {
uni.showLoading({
title:'loading'
})
if(res.data.success==true){
uni.showToast({
title: 'Log out successfully',
icon: 'success',
duration: 1500
})
uni.removeStorageSync('logInfo');
uni.removeStorageSync('ticket')
setTimeout(function(){
uni.reLaunch({
url:'../../login/index'
})
},2000)
}else{
uni.showToast({
title: 'Exit failed',
icon: 'none',
duration: 1500
})
}
console.log(res.data,9990);
})
.catch(e => {
console.log(e)
})
}
},
}
</script>
<style>
@import './index.css';
</style>