优化页面
This commit is contained in:
499
pages/Mine/minecomponents/recompose/recompose.vue
Normal file
499
pages/Mine/minecomponents/recompose/recompose.vue
Normal file
@@ -0,0 +1,499 @@
|
||||
<template><view v-if="Display" :class="[Display ? 'create-module' : 'close-animation ', 'Mask']" @click="open()">
|
||||
|
||||
<view @click.stop class="containers">
|
||||
<view class="container">
|
||||
<image
|
||||
class="Fork"
|
||||
@click="open()"
|
||||
src="../../../../static/Fork.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<view class="Titlecss">
|
||||
<view class="Star"></view>
|
||||
<view class="Title"></view>
|
||||
<view class="Star"></view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="Individual"> -->
|
||||
<view class="NameAnchor">
|
||||
<input
|
||||
class="NameAnchorcss"
|
||||
cursor-color="#666666"
|
||||
placeholder-style="color:#666666"
|
||||
@input="NameAnchor"
|
||||
placeholder="主播名称"
|
||||
/>
|
||||
<view v-if="nameAnchor === '' && Hint === true" class="Hint"
|
||||
>请填写主播名称</view
|
||||
>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- </view> -->
|
||||
|
||||
<view class="Accountnumber">
|
||||
<view class="Coins country">
|
||||
<wht-select
|
||||
style="width: 350rpx"
|
||||
backgroundColor="#ffffff"
|
||||
placeholderColor="#666666"
|
||||
textColor="#666666"
|
||||
borderColor="#ffffff"
|
||||
@change="country"
|
||||
:options="Country"
|
||||
:filterable = "filterable"
|
||||
placeholder="请选择国家"
|
||||
/>
|
||||
<view v-if="countrys === '' && Hint === true" class="Hint">请选择国家</view>
|
||||
</view>
|
||||
<view class="Gender">
|
||||
<view class="Gendercs">
|
||||
<view class="Gendercss">
|
||||
<wht-select
|
||||
style="width: 300rpx"
|
||||
backgroundColor="#ffffff"
|
||||
placeholderColor="#666666"
|
||||
textColor="#666666"
|
||||
borderColor="#ffffff"
|
||||
@change="gender"
|
||||
:options="Gender"
|
||||
placeholder="性别"
|
||||
/>
|
||||
</view>
|
||||
<view class="Gendericoncss">
|
||||
<image
|
||||
v-if="genders === 0"
|
||||
class="Gendericon"
|
||||
src="../../../../static/ask.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<image
|
||||
v-if="genders === 1"
|
||||
class="Gendericon"
|
||||
src="../../../../static/man.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<image
|
||||
v-if="genders === 2"
|
||||
class="Gendericon"
|
||||
src="../../../../static/girl.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="genders === 0 && Hint === true" class="Hintcss">请选择性别</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="goldCoin">
|
||||
<view class="number-box">
|
||||
<view class="number-box-title">金币数量:</view>
|
||||
<uni-number-box background="#03ABA8" v-model="numberCoins"></uni-number-box>
|
||||
<view class="number-box-title">单位:</view>
|
||||
<view class="number-box-unit">K</view>
|
||||
</view>
|
||||
<view v-if="numberCoins === '' && Hint === true" class="Hint"
|
||||
>请填写金币数量</view
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="time">
|
||||
<uni-datetime-picker
|
||||
type="datetime"
|
||||
hide-second="true"
|
||||
v-model="datetimesingle"
|
||||
/>
|
||||
<view v-if="datetimesingle === '' && Hint === true" class="Hint"
|
||||
>请选择日期</view
|
||||
>
|
||||
</view>
|
||||
<!-- ···············································标记2············································ -->
|
||||
<view class="goldCoin">
|
||||
<view class="number-box">
|
||||
<view class="number-box-title">选择场数:</view>
|
||||
<uni-number-box background="#03ABA8" v-model="session"></uni-number-box>
|
||||
<view class="number-box-title">次</view>
|
||||
</view>
|
||||
<view v-if="session === '' && Hint === true" class="Hint"
|
||||
>请填写场数</view
|
||||
>
|
||||
</view>
|
||||
<!-- ··························································································· -->
|
||||
<view class="Remarkscss">
|
||||
<uni-easyinput
|
||||
type="textarea"
|
||||
v-model="remarks"
|
||||
placeholder="备注"
|
||||
></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<view class="Publish">
|
||||
<button @click="Publish()" class="Publishcss">发布</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import message from "@tencentcloud/chat-uikit-uniapp/locales/en/message.js";
|
||||
import optionsArray from "../../../../components/NationalDictionary.js";
|
||||
import request from "../../../../components/request.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
genders: 0, //性别
|
||||
Gender: [
|
||||
{ label: "男", value: 1 },
|
||||
{ label: "女", value: 2 },
|
||||
],
|
||||
Country: optionsArray,
|
||||
countrys: "", //国家
|
||||
nameAnchor: "", //主播名称
|
||||
numberCoins: "", //金币数量
|
||||
session: "", //场数
|
||||
remarks: "", //备注
|
||||
Display: false,
|
||||
Hint: false,
|
||||
datetimesingle: "", //日期
|
||||
id: null, //用户id
|
||||
sendingTime: "", //发送时间
|
||||
filterable: true, //是否可搜索
|
||||
};
|
||||
},
|
||||
props: {
|
||||
message
|
||||
},
|
||||
mounted() {
|
||||
uni.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.id = res.data.id;
|
||||
},
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
gender(item) {
|
||||
this.genders = item.value;
|
||||
console.log(item);
|
||||
},
|
||||
|
||||
country(item) {
|
||||
this.countrys = item.value;
|
||||
console.log(item);
|
||||
},
|
||||
|
||||
handleOverlayClick(event) {
|
||||
if (event.target === this.$el) {
|
||||
this.Display = false;
|
||||
this.Hint = false;
|
||||
}
|
||||
},
|
||||
open() {
|
||||
if (this.Display) {
|
||||
this.Display = false;
|
||||
this.Hint = false;
|
||||
this.nameAnchor = "";
|
||||
this.genders = "";
|
||||
this.numberCoins = "";
|
||||
this.remarks = "";
|
||||
this.datetimesingle = "";
|
||||
this.countrys = "";
|
||||
this.session = "";
|
||||
} else {
|
||||
this.Display = true;
|
||||
}
|
||||
},
|
||||
//获取主播名称
|
||||
NameAnchor: function (event) {
|
||||
this.nameAnchor = event.target.value;
|
||||
},
|
||||
|
||||
async Publish() {
|
||||
console.log("````````````````````````````````````````````",message);
|
||||
|
||||
//判断是否为空
|
||||
if (
|
||||
this.nameAnchor === "" ||
|
||||
this.genders === "" ||
|
||||
this.numberCoins === "" ||
|
||||
this.countrys === "" ||
|
||||
this.datetimesingle === ""||
|
||||
this.session === ""
|
||||
) {
|
||||
this.Hint = true;
|
||||
return;
|
||||
}
|
||||
//格式化日期
|
||||
const isoString = this.datetimesingle.replace(" ", "T");
|
||||
const timestamp = Date.parse(isoString);
|
||||
if (isNaN(timestamp)) {
|
||||
throw new Error(`Invalid date format: ${this.datetimesingle}`);
|
||||
}
|
||||
this.sendingTime = Math.floor(timestamp / 1000);
|
||||
const secondsTimestamp = Math.floor(Date.now() / 1000);
|
||||
|
||||
if (this.sendingTime < secondsTimestamp) {
|
||||
uni.showToast({
|
||||
title: "日期不能早于当前时间",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
//发送请求
|
||||
uni.showLoading({
|
||||
title: "发布中...",
|
||||
mask: true,
|
||||
});
|
||||
const res = await request({
|
||||
url: "pk/addPkData",
|
||||
method: "POST",
|
||||
data: {
|
||||
anchorId: this.nameAnchor,
|
||||
pkTime: this.sendingTime,
|
||||
sex: this.genders,
|
||||
country: this.countrys,
|
||||
coin: this.numberCoins,
|
||||
remark: this.remarks,
|
||||
status: 0,
|
||||
senderId: this.id,
|
||||
anchorIcon: "",
|
||||
pkNumber: this.session,
|
||||
},
|
||||
userInfo: true,
|
||||
});
|
||||
if (res.code === 200) {
|
||||
this.Display = false;
|
||||
this.Hint = false;
|
||||
this.nameAnchor = "";
|
||||
this.genders = 0;
|
||||
this.numberCoins = "";
|
||||
this.remarks = "";
|
||||
this.datetimesingle = "";
|
||||
this.session = "";
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "发布成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "发布失败",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 定义动画 */
|
||||
/* 原始进入动画 */
|
||||
@keyframes slide-in {
|
||||
from { transform: translateY(100%); opacity: 0; }
|
||||
to { transform: translateY(0); opacity: 1; }
|
||||
}
|
||||
|
||||
/* 新增关闭动画 */
|
||||
@keyframes slide-out {
|
||||
from { transform: translateY(0); opacity: 1; }
|
||||
to { transform: translateY(-100%); opacity: 0; }
|
||||
}
|
||||
|
||||
/* 进入动画类 */
|
||||
.create-module {
|
||||
animation: slide-in 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
/* 关闭动画类 */
|
||||
.close-animation {
|
||||
animation: slide-out 0.3s ease-in-out forwards;
|
||||
}
|
||||
|
||||
.Mask {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: #00000076;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.Hint {
|
||||
color: rgb(255, 0, 0);
|
||||
font-size: 20rpx;
|
||||
margin-left: 30rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.Hintcss{
|
||||
color: rgb(255, 0, 0);
|
||||
font-size: 20rpx;
|
||||
margin-left: 30rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.containers {
|
||||
background-color: #ffffff;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
background-image: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/bgv.png);
|
||||
background-size: 100% 100%;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 1300rpx;
|
||||
border-radius: 50rpx;
|
||||
box-shadow: 0 0 10rpx #ccc;
|
||||
}
|
||||
.Fork {
|
||||
width: 46rpx;
|
||||
height: 46rpx;
|
||||
margin-top: 20rpx;
|
||||
/* margin-bottom: 40rpx; */
|
||||
margin-left: 90%;
|
||||
}
|
||||
.Titlecss{
|
||||
width: 100%;
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.Star{
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
background-image: url(../../../../static/star.png);
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.Title {
|
||||
width: 430rpx;
|
||||
height: 70rpx;
|
||||
background-image: url(../../../../static/Publishpk.png);
|
||||
background-size: 100% 200%;
|
||||
background-position: 30% 0%;
|
||||
margin-left: 26rpx;
|
||||
margin-right: -65rpx;
|
||||
}
|
||||
.Individual {
|
||||
display: flex;
|
||||
/* justify-content: center; */
|
||||
}
|
||||
.NameAnchor {
|
||||
width: 90%;
|
||||
margin: 40rpx;
|
||||
}
|
||||
.time {
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
.NameAnchorcss {
|
||||
width: 99%;
|
||||
height: 85rpx;
|
||||
background-color: #ffffff;
|
||||
border: 1rpx solid #BFBFBF;
|
||||
border-radius: 10rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.Gender {
|
||||
width: 310rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.Gendercs{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
/* align-items: center; */
|
||||
}
|
||||
.Gendercss{
|
||||
width: 200rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
.Gendericoncss{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 50%;
|
||||
border: 1rpx solid #ff9d0067;
|
||||
margin-left: 20rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.Gendericon{
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
/* margin-top: 10rpx;
|
||||
margin-right: 40rpx; */
|
||||
}
|
||||
.Accountnumber {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 60rpx;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
.Coins {
|
||||
width: 330rpx;
|
||||
height: 65rpx;
|
||||
/* display: flex; */
|
||||
margin-right: 50rpx;
|
||||
/* flex-direction: column; */
|
||||
}
|
||||
.country {
|
||||
margin-left:10rpx;
|
||||
}
|
||||
.goldCoin {
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.number-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
.number-box-title {
|
||||
color: #191919;
|
||||
font-size: 30rpx;
|
||||
margin-right: 22rpx;
|
||||
margin-left: 17rpx;
|
||||
}
|
||||
.number-box-unit {
|
||||
color: #03ABA8;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border: 1rpx solid #03ABA8;
|
||||
border-radius: 50%;
|
||||
line-height: 48rpx;
|
||||
text-align: center;
|
||||
/* color: #003cff5a; */
|
||||
}
|
||||
.Remarkscss {
|
||||
width: 90%;
|
||||
margin-top: 30rpx;
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
margin-bottom: 50rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.Publish {
|
||||
margin-bottom: 40rpx;
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
.Publishcss {
|
||||
background-image: linear-gradient(135deg, #4FCACD, #5FDBDE);
|
||||
/* color: #33ff00; */
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user