<template>
    <view :class="[AppTheme]" class="cname">
        <view class="content">
            <input type="text" placeholder="请输入您要更改的昵称" class="ipt" v-model="nicheng" />
            <button class="add-btn bg-linear-gradient" @click="goSave">提交</button>
        </view>
    </view>
</template>

<script>
import mineApi from '@/api/mine/index.js';
export default {
    data() {
        return {
            primary:this.$theme.primary,
            nicheng: '',
            sex: '',
            settingFile:getApp().globalData.siteinfo
        };
    },
    methods: {
        goSave: function() {
            let data = {
                nickname:encodeURI(this.nicheng),
                sex: 1
            };
            mineApi.myinfo(data).then(ret => {
                if (ret.status == 200) {
                    this.$u.toast(ret.msg);
                    uni.setStorageSync('nickname', this.nicheng);
                    setTimeout(() => {
                        uni.redirectTo({
                            url: '/pagesD/pages/set/set?name' + this.nicheng
                        });
                    }, 1000);
                } else if (ret.status == 401) {
                    this.$u.toast('登陆失效请重新登陆');
                    setTimeout(function() {
                        uni.redirectTo({
                            url: '/pagesD/pages/set/set'
                        });
                    }, 2000);
                } else if (ret.status === 0) {
                    this.$u.toast(ret.msg);
                }
            });
        }
    }
};
</script>

<style lang="scss">
page {
    width: 100%;
    height: 100%;
    background: #f1f1f1;
}
.set-btn {
    margin: 50rpx auto;
    width: 582rpx;
    height: 90rpx;
    border-radius: 45rpx;
    background-color: #0e7aff;
    font-size: 31rpx;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cname {
    width: 100%;
    height: 100%;
}
.content {
	width: 100%;
    margin-top: 30rpx;
    height: 84rpx;
    background-color: #ffffff;
}

.content .ipt {
    padding-left: 20rpx;
    width: 100%;
    height: 100%;
    font-size: 28rpx;
    display: flex;
    align-items: center;
    font-family: PingFang SC;
    font-weight: 500;
    color: #666666;
}

.aui-bar-nav .aui-btn.aui-btn-outlined {
    border-width: 0;
}
.add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 690upx;
    height: 80upx;
    margin: 60upx auto;
    font-size: $font-lg;
    color: #fff;
    border-radius: 10upx;
    // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
}
</style>
