123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <template>
- <view>
- <statusBar :item="navBarData"></statusBar>
- <view class="editBox">
- <view class="edit_avatar">
- <view class="edit_title">
- <text>头像</text>
- </view>
- <view class="userAvatar">
- <image :src="userAvatar"></image>
- </view>
- </view>
- <view class="setName">
- <view class="edit_title">
- <text>昵称</text>
- </view>
- <view class="input_details">
- <view class="nickname">
- <input type="text" style=" text-align: right;" maxlength="10" placeholder="请输入一个昵称"
- placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="username" />
- </view>
- </view>
- </view>
- <view class="setPicker">
- <picker mode="selector" :range="genderList" @change="handelGender">
- <view class="content">
- <view class="edit_title">
- <text>性别</text>
- </view>
- <view class="input_details">
- <view class="details">
- <view class="uni-input text">{{gender}}</view>
- </view>
- <view class="arrow">
- <image src="http://43.139.158.220:5007/img/static/mine/arrow-right_gray.png" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </picker>
- </view>
- <view class="setPicker">
- <picker mode="selector" :range="schoolList" @change="handelSchool">
- <view class="content">
- <view class="edit_title">
- <text>学校</text>
- </view>
- <view class="input_details">
- <view class="details">
- <view class="uni-input text">{{school}}</view>
- </view>
- <view class="arrow">
- <image src="http://43.139.158.220:5007/img/static/mine/arrow-right_gray.png" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </picker>
- </view>
- <view class="setPicker">
- <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
- <view class="content">
- <view class="edit_title">
- <text>生日</text>
- </view>
- <view class="input_details">
- <view class="details">
- <view class="uni-input text">{{date}}</view>
- </view>
- <view class="arrow">
- <image src="http://43.139.158.220:5007/img/static/mine/arrow-right_gray.png" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </picker>
- </view>
- <view class="setPicker">
- <picker mode="selector" :range="hobbyList" @change="handelHobby">
- <view class="content">
- <view class="edit_title">
- <text>兴趣标签</text>
- </view>
- <view class="input_details">
- <view class="details">
- <view class="uni-input text">{{hobby}}</view>
- </view>
- <view class="arrow">
- <image src="http://43.139.158.220:5007/img/static/mine/arrow-right_gray.png" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- </picker>
- </view>
- <view class="setIntro">
- <view class="edit_title">
- <text>简介</text>
- </view>
- <view class="input_details">
- <view class="selfdomIntro">
- <textarea type="text" placeholder="请输入你的个性签名" maxlength="75"
- placeholder-style="font-size: 28rpx; color: rgb(153, 153, 153);" v-model="selfdomintro" />
- </view>
- </view>
- </view>
- </view>
- <view class="btnBox">
- <view class="btn">
- <button>保存修改</button>
- <button @click="gotoLogin">退出登录</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- const currentDate = this.getDate({
- format: true
- })
- return {
- navBarData: {
- title: '个人资料',
- btn: 1
- },
- userAvatar:'',
- username: '',
- selfdomintro: '',
- genderList: ['男', '女'],
- gender: '男',
- schoolList: ['xx学院', 'xx学院', 'xx学院'],
- school: 'xx学院',
- date: currentDate,
- hobbyList: ['篮球'],
- hobby: '篮球'
- };
- },
- computed: {
- startDate() {
- return this.getDate('start');
- },
- endDate() {
- return this.getDate('end');
- }
- },
- methods: {
- handelGender(e) {
- this.gender = this.genderList[e.detail.value]
- },
- handelSchool(e) {
- this.school = this.schoolList[e.detail.value]
- },
- handeHobby(e) {
- this.hobby = this.hobbyList[e.detail.value]
- },
- bindDateChange: function(e) {
- this.date = e.detail.value
- },
- getDate(type) {
- const date = new Date();
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- let day = date.getDate();
- if (type === 'start') {
- year = year - 60;
- } else if (type === 'end') {
- year = year + 2;
- }
- month = month > 9 ? month : '0' + month;
- day = day > 9 ? day : '0' + day;
- return `${year}-${month}-${day}`;
- },
- gotoLogin(){
- let user= {
- openid:'',
- avatar: "",
- desc: "",
- email: "",
- phone: "",
- sex: "",
- token: "",
- username: "暂无",
- __v: 0,
- _id: ""
- }
- this.$store.dispatch('asyncUpdateUser', user)
- uni.navigateTo({
- url:'/pages/login_Wechat/login_Wechat'
- })
- },
- },
- onShow() {
- console.log(this.$store.state);
- this.userAvatar=this.$store.state.user.avatar;
- this.username=this.$store.state.user.username;
- // this.isManage = this.$store.state.user.openid;
- // console.log(this.isManage == "");
- }
- }
- </script>
- <style lang="scss">
- .edit_title {
- display: flex;
- align-items: center;
- font-size: 32rpx;
- }
- .editBox {
- width: 100%;
- height: 840rpx;
- display: flex;
- flex-direction: column;
- background-color: #fff;
- border-top: 1px solid #E7E7E7;
- padding: 0 18px;
- .edit_avatar {
- height: 164rpx;
- display: flex;
- justify-content: space-between;
- .userAvatar {
- display: flex;
- align-items: center;
- image {
- width: 120rpx;
- height: 120rpx;
- }
- }
- }
- .setName {
- display: flex;
- justify-content: space-between;
- height: 92rpx;
- border-top: 1px solid #E7E7E7;
- .input_details {
- display: flex;
- align-items: center;
- flex-direction: row;
- .nickname {
- width: 350rpx;
- text-align: end;
- // padding-right: 10rpx;
- // margin-right: 10rpx;
- font-size: 28rpx;
- color: rgb(153, 153, 153);
- }
- }
- }
- .setPicker {
- height: 92rpx;
- border-top: 1px solid #E7E7E7;
- .content {
- height: 92rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .input_details {
- display: flex;
- align-items: center;
- .details {
- display: flex;
- flex-direction: row;
- .text {
- font-size: 28rpx;
- color: rgb(153, 153, 153);
- }
- }
- .arrow {
- display: flex;
- image {
- width: 32rpx;
- height: 32rpx;
- }
- }
- }
- }
- }
- .setIntro {
- display: flex;
- flex-direction: column;
- justify-content: space-evenly;
- height: 216rpx;
- border-top: 1px solid #E7E7E7;
-
- .input_details {
- display: flex;
- align-items: center;
-
- .selfdomIntro {
- width: 100%;
- height: 88rpx;
-
- textarea{
- width: 100%;
- height: 88rpx;
- font-size: 28rpx;
- color: rgb(153, 153, 153);
- }
- }
- }
- }
- }
- .btnBox{
- position: absolute;
- margin: 0 85rpx;
- bottom: 40px;
- .btn{
- button{
- width: 580rpx;
- height: 88rpx;
- border: none;
- border-radius: 100rpx;
- border: 1px solid lightgray;
- font-size: 36rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #545454;
- text-align: center;
- &:first-child{
- background-color: rgb(0, 86, 168);
- color: white;
- margin-bottom: 24rpx;
- }
- &::after{
- border: none;
- }
- }
- }
- }
- </style>
|