2024-08-28 11:51:49 +08:00
|
|
|
<template>
|
|
|
|
<view class="content">
|
|
|
|
<view class="container">
|
2024-08-28 16:17:17 +08:00
|
|
|
<!-- <view class="up-box">
|
2024-08-28 11:51:49 +08:00
|
|
|
<view class="">修改头像</view>
|
|
|
|
<view class="">
|
|
|
|
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
|
|
|
|
:maxCount="10"></u-upload>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="up-box">
|
|
|
|
<view class="">修改昵称</view>
|
|
|
|
<view class="right-text">
|
|
|
|
<input type="text" placeholder="修改昵称">
|
|
|
|
</view>
|
2024-08-28 16:17:17 +08:00
|
|
|
</view> -->
|
|
|
|
<view class="anniu" @click="tttt()">
|
|
|
|
退出登录
|
2024-08-28 11:51:49 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import headers from '../../components/header/headers.vue'
|
|
|
|
import tabbar from '../../components/tabbar/tabbar.vue'
|
|
|
|
import request from '@/utils/request.js'
|
|
|
|
import {
|
|
|
|
getToken
|
|
|
|
} from '@/utils/auth'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fileList1: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
},
|
|
|
|
onPullDownRefresh() {
|
|
|
|
console.log("刷新");
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
},
|
|
|
|
onReachBottom() {
|
|
|
|
// this.show = true
|
|
|
|
setTimeout(() => {
|
|
|
|
console.log("加载执行");
|
|
|
|
}, 2000)
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2024-08-28 16:17:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
tttt() {
|
|
|
|
|
|
|
|
uni.clearStorageSync();
|
|
|
|
uni.reLaunch({
|
|
|
|
url: '/pages/login/loginSms'
|
|
|
|
})
|
|
|
|
},
|
2024-08-28 11:51:49 +08:00
|
|
|
// 删除图片
|
|
|
|
deletePic(event) {
|
|
|
|
this[`fileList${event.name}`].splice(event.index, 1)
|
|
|
|
},
|
|
|
|
// 新增图片
|
|
|
|
async afterRead(event) {
|
|
|
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
|
let lists = [].concat(event.file)
|
|
|
|
let fileListLen = this[`fileList${event.name}`].length
|
|
|
|
lists.map((item) => {
|
|
|
|
this[`fileList${event.name}`].push({
|
|
|
|
...item,
|
|
|
|
status: 'uploading',
|
|
|
|
message: '上传中'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
for (let i = 0; i < lists.length; i++) {
|
|
|
|
const result = await this.uploadFilePromise(lists[i].url)
|
|
|
|
let item = this[`fileList${event.name}`][fileListLen]
|
|
|
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
|
|
|
status: 'success',
|
|
|
|
message: '',
|
|
|
|
url: result
|
|
|
|
}))
|
|
|
|
fileListLen++
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async afterRead(event) {
|
|
|
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
|
let lists = [].concat(event.file)
|
|
|
|
let fileListLen = this[`fileList${event.name}`].length
|
|
|
|
lists.map((item) => {
|
|
|
|
this[`fileList${event.name}`].push({
|
|
|
|
...item,
|
|
|
|
status: 'uploading',
|
|
|
|
message: '上传中'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const result = await this.uploadFilePromise(lists[0].url)
|
|
|
|
let data = {
|
|
|
|
url: result
|
|
|
|
}
|
|
|
|
this.fileList1 = []
|
|
|
|
this.fileList1.push(data)
|
|
|
|
console.log(this.fileList1, 'this.fileList1');
|
|
|
|
},
|
|
|
|
async uploadFilePromise(e) {
|
|
|
|
console.log(e);
|
|
|
|
let res = await upload({
|
|
|
|
url: '/common/upload',
|
|
|
|
filePath: e,
|
|
|
|
})
|
|
|
|
console.log(res.fileName);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
goback() {
|
|
|
|
uni.navigateBack()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.content {
|
|
|
|
width: 100%;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
.container {
|
|
|
|
width: 100%;
|
|
|
|
background: #fff;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.up-box {
|
|
|
|
width: 95%;
|
|
|
|
border-bottom: 1px solid #ebebeb;
|
|
|
|
margin: 10px auto;
|
|
|
|
padding: 10px 0px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
|
|
|
|
.right-text {
|
|
|
|
text-align: right;
|
|
|
|
}
|
2024-08-28 16:17:17 +08:00
|
|
|
|
|
|
|
.anniu {
|
|
|
|
width: 90%;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
color: #fff;
|
|
|
|
background: #eb0e12;
|
|
|
|
border-radius: 6px;
|
|
|
|
margin: 40px auto;
|
|
|
|
height: 38px;
|
|
|
|
|
|
|
|
}
|
2024-08-28 11:51:49 +08:00
|
|
|
</style>
|