1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <view class="content">
- <view class="row1 flex">
- <view class="left">
- 昵称
- </view>
- <u-input v-model="userInfo.nickname" :border="false" focus class="input" />
- </view>
- <view class="row2">
- <view class="btn" @click="edit">
- 保存
- </view>
- </view>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- value: '',
- userInfo: {
- nickname: ''
- }
- };
- },
- onLoad() {
- this.userInfo = uni.getStorageSync("userInfo")
- },
- methods: {
- edit() {
- this.$request.baseRequest('commonUserApp', 'edit', {
- commonUserInfo: JSON.stringify(this.userInfo)
- }, failres => {
- this.$refs.uToast.show({
- type: 'error',
- message: failres.errmsg,
- })
- uni.hideLoading()
- }).then(res => {
- this.userInfo = res.data
- uni.setStorageSync("userInfo", this.userInfo)
- let params = {
- type: 'success',
- message: "修改成功",
- url: '/pages/mySet/mySet'
- }
- this.$refs.uToast.show({
- ...params,
- complete() {
- params.url && uni.switchTab({
- url: params.url
- })
- }
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .row1 {
- background: #fff;
- padding: 20rpx;
- }
- .input {
- font-size: 28rpx;
- }
- .row2 {
- padding: 20rpx;
- }
- .btn {
- color: #fff;
- padding: 20rpx;
- border-radius: 8px;
- background: rgba(17, 34, 83, 1);
- text-align: center;
- font-size: 36rpx;
- }
- </style>
|