第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:14:48 +08:00
commit 1b923e5cff
1030 changed files with 128016 additions and 0 deletions

View File

@@ -0,0 +1,218 @@
<template>
<view class="page-wrap">
<view class="page-bg">
<u-navbar leftIconColor="#FFFFFF" :autoBack="true" bg-color="transparent" safeAreaInsetTop
placeholder></u-navbar>
<view class="notice">
请如实填写个人资料真实的资料会更受欢迎
</view>
<view class="title">
上传头像/封面
</view>
<view class="desc">
一张亮眼的头像更容易获得青睐
</view>
<view class="avatar">
<button class="btn-avatar u-reset-button" @click="onChooseAvatar">
<image class="btn-avatar-plus" v-if="!avatar" src="@/static/icon/path.png" mode="widthFix"></image>
<image class="avatar-img" v-else :src="avatar" mode="widthFix"></image>
</button>
</view>
<ksp-cropper mode="ratio" :url="avatarTemp"
@cancel="avatarTemp = ''" @ok="cropperOk"></ksp-cropper>
<view class="tips">
<view class="tips-item">
<image src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/user-base/5.png" mode="aspectFill" class="tips-item-image"></image>
<view class="tips-item-text">999+喜欢</view>
<image class="tips-ft" src="@/static/user-base/y.png" mode="widthFix"></image>
</view>
<view class="tips-item">
<image src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/user-base/4.png" mode="aspectFill" class="tips-item-image"></image>
<view class="tips-item-text">暴露照</view>
<image class="tips-ft" src="@/static/user-base/n.png" mode="widthFix"></image>
</view>
<view class="tips-item">
<image src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/user-base/3.png" mode="aspectFill" class="tips-item-image"></image>
<view class="tips-item-text">模糊照</view>
<image class="tips-ft" src="@/static/user-base/n.png" mode="widthFix"></image>
</view>
<view class="tips-item">
<image src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/user-base/2.png" mode="aspectFill" class="tips-item-image"></image>
<view class="tips-item-text">非人物照</view>
<image class="tips-ft" src="@/static/user-base/n.png" mode="widthFix"></image>
</view>
<view class="tips-item">
<image src="https://file-jimei.oss-cn-shenzhen.aliyuncs.com/static/user-base/1.png" mode="aspectFill" class="tips-item-image"></image>
<view class="tips-item-text">网络图片</view>
<image class="tips-ft" src="@/static/user-base/n.png" mode="widthFix"></image>
</view>
</view>
<view class="btn-wrapper-pla">
</view>
<view class="btn-wrapper">
<u-button v-if="avatar == null || avatar == ''" text="继续" color="#837C8B" shape="circle" @click="handleSubmit"></u-button>
<u-button v-else text="继续" color="linear-gradient(#95258d, #440a5f);" shape="circle" @click="handleSubmit"></u-button>
</view>
<u-safe-bottom></u-safe-bottom>
</view>
</view>
</template>
<script>
import * as UserProfileApi from '@/api/love-user-profile.js'
import * as UploadApi from '@/api/upload'
import {
dateFormat
} from '@/utils/util.js'
export default {
data() {
return {
avatarTemp: '',
fileList1: [],
avatar: '',
};
},
onLoad() {
},
methods: {
async cropperOk(e) {
const res = await this.uploadFilePromise(e.path)
this.avatarTemp = ''
this.avatar = res.url
},
async onChooseAvatar({
detail
}) {
uni.chooseImage({
count: 1,
success: (res) => {
this.avatarTemp = res.tempFilePaths[0]
}
})
},
handleSubmit() {
if (!this.avatar) {
uni.showToast({
title: '请上传头像',
icon: 'none'
})
return
}
const userBase = uni.getStorageSync('UserBase') || {}
userBase.avatar = this.avatar
uni.setStorageSync("UserBase", userBase)
this.$push('/sub_pages/user/base/photo/photo')
},
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
UploadApi.uploadFile({
filePath: url,
fileType: 'image',
name: 'file',
header: {
Authorization: uni.getStorageSync('AccessToken')
},
}).then(result => {
setTimeout(() => {
resolve(result.data)
}, 1000)
}).catch(err => {
console.log("err: ", err);
})
})
},
}
}
</script>
<style lang="scss">
@import "../base.scss";
.avatar{
margin: 100rpx 0 100rpx 0;
}
.nickname {
width: 620rpx;
margin: 160rpx auto 120rpx;
display: flex;
justify-content: center;
&-input {
background-color: #FFFFFF;
color: #FFFFFF;
}
/deep/.u-upload__button {
background-color: rgba(#6A6A6A, .6) !important;
border-radius: 10rpx !important;
border: 4rpx rgba(#BBBBBB, .5) solid;
}
}
.tips {
display: flex;
width: 640rpx;
margin: 10rpx auto;
justify-content: space-between;
&-item {
width: 104rpx;
font-size: 24rpx;
text-align: center;
position: relative;
&-image {
width: 104rpx;
height: 104rpx;
}
&-text {
white-space: nowrap;
}
}
.tips-ft{
width: 20rpx;
position: absolute;
right: 6rpx;
top: 82rpx;
border-radius: 50%;
}
}
.btn-avatar{
display: flex;
justify-content: center;
align-items: center;
width: 320rpx;
height: 320rpx;
background: rgba(15, 0, 32, 0.5);
border: 2rpx solid rgb(151, 99, 157);
border-radius: 10rpx;
overflow: hidden;
.btn-avatar-plus{
width: 72rpx;
height: 72rpx;
}
.avatar-img{
width: 320rpx;
height: 320rpx;
border-radius: 10rpx;
}
}
</style>