123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <view>
- <view class="con">
- <view class="item">
- <view class="l">用户名:</view>
- <input class="r" v-model="person.name" :disabled="enable" />
- </view>
- <view class="item">
- <view class="l">性别:</view>
- <input class="r" v-model="person.genderName" :disabled="enable" />
- </view>
- <!-- <view class="item">
- <view class="l">年龄:</view>
- <input class="r" v-model="person.age" :disabled="enable" />
- </view> -->
- <view class="item">
- <view class="l">手机号:</view>
- <input class="r" v-model="person.phone" :disabled="enable" />
- </view>
- <view class="item">
- <view class="l">互助组:</view>
- <input class="r" v-model="person.groupName" :disabled="enable" />
- </view>
- <!-- <view class="item">
- <view class="l">角色:</view>
- <input class="r" v-model="person.roleName" :disabled="enable" />
- </view> -->
- <view class="item">
- <view class="l">贸易区域:</view>
- <input class="r" v-model="person.tradeAreaName" :disabled="enable" />
- </view>
- <view class="item" style="border: none;">
- <view class="l">地址:</view>
- <input class="r" v-model="person.address" :disabled="enable" />
- </view>
- </view>
- <view>
- <button class="btn" @click="edit">编辑资料</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- person: {},
- enable: true,
- name: ''
- }
- },
- onLoad() {
- this.getSelfInfo()
- },
- methods: {
- // 查看个人信息
- getSelfInfo() {
- this.http.request({
- url: '/sp-admin/app/AppUser/getSelfInfo',
- success: res => {
- this.person = res.data.data
- }
- });
- },
- edit(){
- uni.showModal({
- title: '请输入用户名',
- editable: true,
- placeholderText: '请输入新的用户名',
- success: res => {
- if(res.confirm){
- this.name = res.content
- this.updateUser()
- // uni.navigateBack({delta: 1})
- }
- }
- })
- },
- // 修改个人信息
- updateUser(){
- let userId = this.getUser().id
- let param = {
- id: userId,
- name: this.name
- }
- this.http.request({
- url: '/sp-admin/app/AppUser/update',
- data: param,
- method: 'POST',
- success: res => {
- uni.showModal({
- content: '修改成功',
- showCancel: false
- }),
- this.getSelfInfo()
- }
- });
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: $pg;
- }
-
- .con{
- background-color: #fff;
- margin: 20px;
- padding: 10px;
- border-radius: 10px;
- border: 1px #fff solid;
- }
- .item{
- height: 50px;
- display: flex;
- align-items: center;
- border-bottom: 1px #dcdcdc solid;
- .l{
- flex: 4;
- }
- .r{
- flex: 10;
- }
- }
- .btn{
- width: 80%;
- }
- </style>
|