123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <view class="content">
- <view class="row1">
- <text class="tit">{{$t('set.a1')}}</text>
- <view class="background-img" @click="imgsub"><image class="background-img" v-model="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill"></image></view>
- </view>
- <view class="row">
- <text class="tit">{{$t('set.a2')}}</text>
- <input class="input" type="text" v-model="userInfo.nickname" placeholder-class="placeholder"/>
- </view>
- <vie<!-- w class="row">
- <text class="tit">{{$t('set.a3')}}</text>
- <view class="input">
- {{userInfo.account}}
- </view>
- </view> -->
- <!-- <view class="row">
- <text class="tit">ID</text>
- <input class="input" type="text" disabled="true" v-model="userInfo.uid" placeholder-class="placeholder" />
- </view> -->
- <view class="list-cell log-out-btn" @click="confirm">
- <text class="cell-tit">{{$t('set.a4')}}</text>
- </view>
- <uni-popup ref="popup" type="center">
- <view class="psw-wrapper">
- <view class="psw-title">{{$t('safe.f3')}}</view>
- <input type="text" v-model="password" class="psw-ipt" />
- <view class="psw-btn">
- <text @click.stop="qx">{{$t('zy.b4')}}</text>
- <text class="psw-qd" @click.stop="pswQd">{{$t('zy.b3')}}</text>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { mapState,mapMutations } from 'vuex';
- import { upload } from '@/api/order.js';
- import {userEdit,logout} from '@/api/set.js';
- export default {
- data(){
- return{
- show:false,
- password: '',
- }
- },
- onLoad() {
- console.log(this.userInfo)
- },
- computed: {
- ...mapState('user',['userInfo'])
- },
- methods: {
- ...mapMutations('user',['logout']),
- imgsub() {
- console.log('上传头像')
- upload({
- filename: ''
- }).then(data => {
- console.log("data",data);
- this.userInfo.avatar = data[0].url;
- })
- },
- confirm() {
- userEdit({ avatar: this.userInfo.avatar ,nickname: this.userInfo.nickname})
- .then(e => {
- uni.showToast({
- // title: '修改成功',
- title: this.$t("safe.d3"),
- icon:"success",
- mask:true
- });
- setTimeout(()=> {
- uni.switchTab({
- url:'/pages/user/user'
- });
- }, 1000);
- console.log(e);
- })
- .catch(e => {
- console.log(e);
- });
-
- },
- toLogout(){
- let obj = this;
- uni.showModal({
- content: this.$t('login.b7'),
- success: (e)=>{
- if(e.confirm){
- logout({}).then((e) => {
- uni.navigateBack();
- }).catch((e) => {
- console.log(e);
- })
- obj.logout();
- }
- }
- });
- },
- cancel(){
- // this.$refs.popup.open();
- let obj = this;
- uni.showModal({
- content: this.$t('login.b7'),
- success: e => {
- if (e.confirm) {
- logout({}).then(e => {
- obj.logout();
- uni.switchTab({
- url: '/pages/index/index'
- })
- })
- .catch(e => {
- console.log(e);
- });
- }
- }
- });
- },
- qx() {
- this.password = '';
- this.$refs.popup.close();
- },
- pswQd() {
- if(this.password != this.userInfo.phone){
- this.$refs.popup.close();
- this.password = '';
- this.$api.msg(obj.$t("safe.f3"))
- return
- }
- this.$refs.popup.close();
- this.password = '';
- this.$api.msg(obj.$t("safe.f4"))
- }
- }
- }
- </script>
- <style lang="scss">
- page{
- background-color: #f3f3f3;
- }
- .list-cell{
- display:flex;
- align-items:baseline;
- padding: 20rpx $page-row-spacing;
- line-height:60rpx;
- position:relative;
- background: #fff;
- justify-content: center;
- &.log-out-btn{
- margin-top: 40rpx;
- .cell-tit{
- text-align: center;
- margin-right: 0;
- }
- }
- .cell-tit{
- flex: 1;
- font-size: $font-base + 2rpx;
- color: $font-color-dark;
- margin-right:10rpx;
- }
- }
- .row1 {
- display: flex;
- align-items: center;
- justify-content: space-between;
- position: relative;
- padding: 0 30upx;
- height: 110upx;
- background: #fff;
- margin-bottom: 20upx;
- .tit {
- flex-shrink: 0;
- width: 120upx;
- font-size: $font-lg;
- color: $font-color-dark;
- }
-
- .background-img {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- background: #f2f2f2;
- }
- }
- .row {
- display: flex;
- align-items: center;
- padding: 0 30upx;
- height: 110upx;
- background: #fff;
- border-bottom:1px solid $border-color-light ;
- .tit {
- flex-shrink: 0;
- width: 120upx;
- font-size: $font-lg;
- color: $font-color-dark;
- }
- .input {
- flex: 1;
- text-align: right;
- font-size: $font-base;
- color: $color-gray;
- }
- }
- .add-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 158rpx auto 30rpx;
- width: 560rpx;
- height: 80rpx;
- background: #feca00;
- border-radius: 40px;
- color: #FFFFFF;
- }
- .out {
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 0 auto 30rpx;
- width: 560rpx;
- height: 80rpx;
- border: 1px solid #feca00;
- background: #FFFFFF;
- border-radius: 40px;
- color: #feca00;
- }
- .psw-wrapper {
- width: 548rpx;
- height: 344rpx;
- background-color: #ffffff;
- .psw-title {
- width: 100%;
- font-size: 35rpx;
- padding: 43rpx 0 49rpx;
- text-align: center;
- font-weight: 800;
- }
- .psw-ipt {
- display: block;
- background-color: #dce3ed;
- height: 90rpx;
- width: 464rpx;
- padding-left: 30rpx;
- margin: 0 auto;
- font-size: 80rpx;
- }
- .psw-btn text {
- display: inline-block;
- text-align: center;
- width: 50%;
- padding-top: 29rpx;
- font-size: 35rpx;
- }
- .psw-qd {
- color: #32C6FF;
- }
- }
- </style>
|