first save
This commit is contained in:
333
scoring/pages/compute/compute.vue
Normal file
333
scoring/pages/compute/compute.vue
Normal file
@@ -0,0 +1,333 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部表头 -->
|
||||
<view class="table-header">
|
||||
<view class="header-player">玩家</view>
|
||||
<view class="header-result">胜负</view>
|
||||
<view class="header-score">得分</view>
|
||||
</view>
|
||||
|
||||
<!-- 玩家信息区域 -->
|
||||
<view class="player-row">
|
||||
<view class="player-info">
|
||||
<view class="player-avatar">
|
||||
<!-- 兔子头像 SVG -->
|
||||
<svg width="30" height="30" viewBox="0 0 30 30">
|
||||
<ellipse cx="15" cy="20" rx="9" ry="6" fill="#ffffff"/>
|
||||
<circle cx="15" cy="12" r="7" fill="#ffffff"/>
|
||||
<ellipse cx="12" cy="8" rx="2" ry="4" fill="#ffffff"/>
|
||||
<ellipse cx="18" cy="8" rx="2" ry="4" fill="#ffffff"/>
|
||||
<ellipse cx="12" cy="8" rx="1" ry="3" fill="#ffb6c1"/>
|
||||
<ellipse cx="18" cy="8" rx="1" ry="3" fill="#ffb6c1"/>
|
||||
<circle cx="13" cy="12" r="1" fill="#333333"/>
|
||||
<circle cx="17" cy="12" r="1" fill="#333333"/>
|
||||
<circle cx="15" cy="14" r="0.8" fill="#ff69b4"/>
|
||||
<path d="M14,16 Q15,17 16,16" stroke="#ff69b4" stroke-width="0.5" fill="none"/>
|
||||
<circle cx="11" cy="13" r="1.5" fill="#ffb6c1" opacity="0.6"/>
|
||||
<circle cx="19" cy="13" r="1.5" fill="#ffb6c1" opacity="0.6"/>
|
||||
<rect x="10" cy="19" width="10" height="4" fill="#4169e1" rx="1"/>
|
||||
<circle cx="20" cy="21" r="2" fill="#ffd700"/>
|
||||
</svg>
|
||||
</view>
|
||||
<text class="player-name">玩家59306</text>
|
||||
</view>
|
||||
|
||||
<view class="result-buttons">
|
||||
<view
|
||||
class="result-btn"
|
||||
:class="{ active: result === 'win' }"
|
||||
@tap="setResult('win')"
|
||||
>胜</view>
|
||||
<view
|
||||
class="result-btn"
|
||||
:class="{ active: result === 'lose' }"
|
||||
@tap="setResult('lose')"
|
||||
>负</view>
|
||||
</view>
|
||||
|
||||
<view class="score-display">
|
||||
<text class="score-value">{{ score }}</text>
|
||||
<button class="sum-btn" @tap="sumScore">Σ 合分</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 固定在底部的数字键盘 -->
|
||||
<view class="keyboard">
|
||||
<view
|
||||
v-for="key in keys"
|
||||
:key="key.value"
|
||||
class="key"
|
||||
:class="{
|
||||
'operator': key.type === 'operator',
|
||||
'minus': key.value === '-',
|
||||
'submit-key': key.type === 'submit'
|
||||
}"
|
||||
@tap="pressKey(key.value, key.type)"
|
||||
>{{ key.display }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const result = ref('win');
|
||||
const score = ref('0');
|
||||
|
||||
// 键盘布局 - 提交按钮在0的左侧
|
||||
const keys = [
|
||||
{ value: '1', display: '1', type: 'number' },
|
||||
{ value: '2', display: '2', type: 'number' },
|
||||
{ value: '3', display: '3', type: 'number' },
|
||||
{ value: '+', display: '+', type: 'operator' },
|
||||
{ value: '×', display: '×', type: 'delete' },
|
||||
{ value: '4', display: '4', type: 'number' },
|
||||
{ value: '5', display: '5', type: 'number' },
|
||||
{ value: '6', display: '6', type: 'number' },
|
||||
{ value: '-', display: '-', type: 'operator' },
|
||||
{ value: '√', display: '√', type: 'operator' },
|
||||
{ value: '7', display: '7', type: 'number' },
|
||||
{ value: '8', display: '8', type: 'number' },
|
||||
{ value: '9', display: '9', type: 'number' },
|
||||
{ value: 'submit', display: '提交', type: 'submit' }, // 提交按钮在0的左侧
|
||||
{ value: '0', display: '0', type: 'number' }
|
||||
];
|
||||
|
||||
const setResult = (res) => {
|
||||
result.value = res;
|
||||
};
|
||||
|
||||
const pressKey = (key, type) => {
|
||||
if (type === 'submit') {
|
||||
// 提交分数
|
||||
if (score.value !== '0') {
|
||||
uni.showToast({
|
||||
title: `分数 ${score.value} 已提交`,
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 实际应用中,这里应该调用API提交分数
|
||||
console.log('提交分数:', score.value);
|
||||
|
||||
// 重置分数
|
||||
setTimeout(() => {
|
||||
score.value = '0';
|
||||
}, 1500);
|
||||
}
|
||||
} else if (key === '×') {
|
||||
// 删除最后一个字符
|
||||
if (score.value.length > 1) {
|
||||
score.value = score.value.slice(0, -1);
|
||||
} else {
|
||||
score.value = '0';
|
||||
}
|
||||
} else if (key === '√') {
|
||||
// 计算平方根
|
||||
try {
|
||||
const result = Math.sqrt(parseFloat(score.value));
|
||||
score.value = result.toString();
|
||||
} catch (error) {
|
||||
score.value = '错误';
|
||||
setTimeout(() => {
|
||||
score.value = '0';
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
// 添加数字或运算符
|
||||
if (score.value === '0') {
|
||||
score.value = key;
|
||||
} else {
|
||||
score.value += key;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const sumScore = () => {
|
||||
uni.showToast({
|
||||
title: '合分功能需要与后端API交互',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
padding-bottom: 240rpx; /* 为底部键盘留出空间 */
|
||||
}
|
||||
|
||||
/* 顶部表头 */
|
||||
.table-header {
|
||||
display: flex;
|
||||
background-color: white;
|
||||
padding: 30rpx 40rpx;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.header-player {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.header-result {
|
||||
width: 200rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header-score {
|
||||
width: 200rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 玩家信息区域 */
|
||||
.player-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx 40rpx;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.player-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.player-avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 16rpx;
|
||||
background-color: #1e3a8a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.player-name {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.result-buttons {
|
||||
width: 200rpx;
|
||||
display: flex;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 8rpx;
|
||||
padding: 4rpx;
|
||||
}
|
||||
|
||||
.result-btn {
|
||||
flex: 1;
|
||||
padding: 12rpx 0;
|
||||
text-align: center;
|
||||
font-size: 28rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.result-btn.active {
|
||||
background-color: #6a5acd;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.score-display {
|
||||
width: 200rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.score-value {
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.sum-btn {
|
||||
background-color: #6a5acd;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8rpx;
|
||||
padding: 12rpx 20rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 固定在底部的数字键盘 */
|
||||
.keyboard {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 1px;
|
||||
background-color: #e0e0e0;
|
||||
padding: 1px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-width: 750rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.key {
|
||||
background-color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 120rpx;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.key:active {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.operator {
|
||||
color: #6a5acd;
|
||||
}
|
||||
|
||||
.minus {
|
||||
color: #ff4757;
|
||||
}
|
||||
|
||||
.submit-key {
|
||||
background-color: #8a2be2;
|
||||
color: white;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 调整键盘布局,使提交按钮在0的左侧 */
|
||||
.keyboard {
|
||||
grid-template-areas:
|
||||
"num1 num2 num3 plus delete"
|
||||
"num4 num5 num6 minus sqrt"
|
||||
"num7 num8 num9 submit num0";
|
||||
}
|
||||
|
||||
.key:nth-child(1) { grid-area: num1; }
|
||||
.key:nth-child(2) { grid-area: num2; }
|
||||
.key:nth-child(3) { grid-area: num3; }
|
||||
.key:nth-child(4) { grid-area: plus; }
|
||||
.key:nth-child(5) { grid-area: delete; }
|
||||
.key:nth-child(6) { grid-area: num4; }
|
||||
.key:nth-child(7) { grid-area: num5; }
|
||||
.key:nth-child(8) { grid-area: num6; }
|
||||
.key:nth-child(9) { grid-area: minus; }
|
||||
.key:nth-child(10) { grid-area: sqrt; }
|
||||
.key:nth-child(11) { grid-area: num7; }
|
||||
.key:nth-child(12) { grid-area: num8; }
|
||||
.key:nth-child(13) { grid-area: num9; }
|
||||
.key:nth-child(14) { grid-area: submit; }
|
||||
.key:nth-child(15) { grid-area: num0; }
|
||||
</style>
|
||||
196
scoring/pages/history-game/history-game.vue
Normal file
196
scoring/pages/history-game/history-game.vue
Normal file
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<view class="history-game">
|
||||
<view class="filter-tab">
|
||||
<view class="filter-item" @click="filterClick('all')" :class="{'filter-active': filterActive == 'all'}">全部</view>
|
||||
<view class="filter-item" @click="filterClick('win')" :class="{'filter-active': filterActive == 'win'}">胜场</view>
|
||||
<view class="filter-item" @click="filterClick('lose')" :class="{'filter-active': filterActive == 'lose'}">负场</view>
|
||||
</view>
|
||||
<view class="game-list">
|
||||
<view class="game-item" v-for="item in 10" :key="item">
|
||||
<view class="game-info">
|
||||
<view class="game-type">单人-1237房间</view>
|
||||
<view class="game-date">2025-06-12 12:00</view>
|
||||
<view class="del-btn">
|
||||
<uni-icons type="trash" size="30"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="game-user">
|
||||
<view class="game-user-item" v-for="(user, index) in userList" :key="index">
|
||||
<view class="user-avatar">
|
||||
<image :src="user.avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="user-name">{{user.name}}</view>
|
||||
<view class="user-score">{{user.score}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="game-foot">
|
||||
<view class="game-status">
|
||||
已结束
|
||||
</view>
|
||||
<view class="check-detail">
|
||||
<uni-icons type="right" size="25" color="#748cec"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from 'vue'
|
||||
import { onLoad, onShow, onHide } from '@dcloudio/uni-app'
|
||||
const proxy = getCurrentInstance().proxy;
|
||||
|
||||
// 过滤相关
|
||||
const filterActive = ref('all'); // all:全部,win:胜场,lose:负场
|
||||
const filterClick = (type) => {
|
||||
filterActive.value = type;
|
||||
};
|
||||
|
||||
|
||||
// 参与人
|
||||
const userList = ref([
|
||||
{
|
||||
avatar: 'https://q3.itc.cn/q_70/images03/20250110/1e71eecf56b34344bcae6a5b85c0bec2.jpeg',
|
||||
name: '赵云',
|
||||
score: 100
|
||||
},
|
||||
{
|
||||
avatar: 'https://q1.itc.cn/q_70/images03/20241119/197701bb9ef34b20b6497720081a9972.jpeg',
|
||||
name: '张飞',
|
||||
score: -50
|
||||
},
|
||||
{
|
||||
avatar: 'https://img1.baidu.com/it/u=3612220943,2414740890&fm=253&app=138&f=JPEG?w=526&h=500',
|
||||
name: '刘备',
|
||||
score: 30
|
||||
},
|
||||
{
|
||||
avatar: 'https://c-ssl.dtstatic.com/uploads/blog/202206/12/20220612135738_992b1.thumb.1000_0.jpg',
|
||||
name: '诸葛亮',
|
||||
score: -80
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.history-game {
|
||||
width: 750rpx;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.filter-tab {
|
||||
--filter-height: 80rpx;
|
||||
--filter-color: #748cec;
|
||||
--filter-border: 1rpx;
|
||||
width: 700rpx;
|
||||
height: var(--filter-height);
|
||||
margin: 20rpx auto;
|
||||
display: flex;
|
||||
.filter-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
line-height: calc(var(--filter-height) - 2 * var(--filter-border));
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
border: var(--filter-border) solid var(--filter-color);
|
||||
}
|
||||
.filter-active {
|
||||
background-color: var(--filter-color);
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.game-list {
|
||||
width: 700rpx;
|
||||
margin: 0 auto;
|
||||
.game-item {
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
margin: 20rpx 0;
|
||||
box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.1);
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.game-info {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.game-type {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.game-date {
|
||||
font-size: 32rpx;
|
||||
color: #bbbbbb;
|
||||
}
|
||||
.del-btn {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-left: 1rpx solid #cccccc;
|
||||
}
|
||||
}
|
||||
.game-user {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
overflow: auto;
|
||||
padding: 20rpx 0;
|
||||
.game-user-item {
|
||||
width: 140rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
.user-avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 10%;
|
||||
overflow: hidden;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.user-name {
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.user-score {
|
||||
font-size: 32rpx;
|
||||
color: #fa5d5d;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.game-foot {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.game-status {
|
||||
font-size: 32rpx;
|
||||
color: #57bcef;
|
||||
}
|
||||
.check-detail {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
170
scoring/pages/index/index.vue
Normal file
170
scoring/pages/index/index.vue
Normal file
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<view class="index">
|
||||
<view class="notice">
|
||||
<view class="icon">
|
||||
<uni-icons type="sound" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="text">
|
||||
您还有未结束的对局,
|
||||
<text class="underline">点击前往</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="function-list">
|
||||
<view class="function-item">
|
||||
<view class="function-icon">
|
||||
<image src="https://t14.baidu.com/it/u=3165460156,649373630&fm=224&app=112&f=JPEG?w=500&h=500"></image>
|
||||
</view>
|
||||
<view class="function-introduce">
|
||||
<view class="function-name">
|
||||
多人模式
|
||||
</view>
|
||||
<view class="function-desc">
|
||||
所有玩家自己计分
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="function-item" @click="gotoNewPage">
|
||||
<view class="function-icon">
|
||||
<image src="https://pic.rmb.bdstatic.com/bjh/down/1742bc3845cbbcf0c78c01eb59bb1c1a.jpeg"></image>
|
||||
</view>
|
||||
<view class="function-introduce">
|
||||
<view class="function-name">
|
||||
单人模式
|
||||
</view>
|
||||
<view class="function-desc">
|
||||
房主给所有玩家计分
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="function-item">
|
||||
<view class="function-icon">
|
||||
<image src="https://pic.rmb.bdstatic.com/bjh/down/1742bc3845cbbcf0c78c01eb59bb1c1a.jpeg"></image>
|
||||
</view>
|
||||
<view class="function-introduce">
|
||||
<view class="function-name">
|
||||
手动进入房间
|
||||
</view>
|
||||
<view class="function-desc">
|
||||
输入房间id进入房间
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="function-item">
|
||||
<view class="function-icon">
|
||||
<image src="https://pic.rmb.bdstatic.com/bjh/down/1742bc3845cbbcf0c78c01eb59bb1c1a.jpeg"></image>
|
||||
</view>
|
||||
<view class="function-introduce">
|
||||
<view class="function-name">
|
||||
扫码加入房间
|
||||
</view>
|
||||
<view class="function-desc">
|
||||
扫码房间二维码加入房间
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getOpenId } from '@/utils/wxutils.js'
|
||||
|
||||
const gotoNewPage = () => {
|
||||
wx.navigateTo({
|
||||
url: '/pages/single/single'
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.index {
|
||||
width: 750rpx;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.notice {
|
||||
width: 80%;
|
||||
margin: 20rpx auto;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 10rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 5rpx 5rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
border-radius: 20rpx;
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
color: #fa5d5d;
|
||||
}
|
||||
.text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
color: #000;
|
||||
}
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
color: #fa5d5d;
|
||||
}
|
||||
}
|
||||
.function-list {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.function-item {
|
||||
--content-height: 100rpx;
|
||||
width: 70%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
margin: 40rpx auto;
|
||||
box-shadow: 5rpx 5rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
gap: 10rpx;
|
||||
border-radius: 20rpx;
|
||||
.function-icon {
|
||||
width: var(--content-height);
|
||||
height: var(--content-height);
|
||||
border-radius: 10%;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.function-introduce {
|
||||
flex: 1;
|
||||
height: var(--content-height);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
.function-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
}
|
||||
.function-desc {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: #a8a8a8;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
215
scoring/pages/my/my.vue
Normal file
215
scoring/pages/my/my.vue
Normal file
@@ -0,0 +1,215 @@
|
||||
<template>
|
||||
<view class="my">
|
||||
<view class="user-info">
|
||||
<view class="background">
|
||||
|
||||
</view>
|
||||
<view class="info-content">
|
||||
<view class="top-user-name" :style="{'height': topHeight, 'line-height': topHeight}">
|
||||
{{userInfo.nickName}}
|
||||
</view>
|
||||
<view class="avatars">
|
||||
<image class="avatar-img" :src="userInfo.avatarUrl ? userInfo.avatarUrl : 'https://pic.rmb.bdstatic.com/bjh/down/1742bc3845cbbcf0c78c01eb59bb1c1a.jpeg'"></image>
|
||||
</view>
|
||||
<view class="hello-text">
|
||||
<p>你好,{{userInfo.nickName}}</p>
|
||||
<p>欢迎使用计分小程序</p>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="section">
|
||||
<view class="list">
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<uni-icons type="contact" size="20" color="#28b389"></uni-icons>
|
||||
<view class="text">更改头像昵称</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<uni-icons type="right" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<uni-icons type="fire" size="20" color="#28b389"></uni-icons>
|
||||
<view class="text">数据统计</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="text">33</view>
|
||||
<uni-icons type="right" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<uni-icons type="redo" size="20" color="#28b389"></uni-icons>
|
||||
<view class="text">分享给朋友</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<uni-icons type="right" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section">
|
||||
<view class="list">
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<uni-icons type="info" size="20" color="#28b389"></uni-icons>
|
||||
<view class="text">使用说明</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<uni-icons type="right" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row">
|
||||
<view class="left">
|
||||
<uni-icons type="chatboxes" size="20" color="#28b389"></uni-icons>
|
||||
<view class="text">建议与反馈</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<uni-icons type="right" size="20"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, onUnmounted, ref, getCurrentInstance } from 'vue'
|
||||
import { onLoad, onShow, onHide } from '@dcloudio/uni-app'
|
||||
import { getOpenId } from '@/utils/wxutils.js'
|
||||
import { register, login } from '@/api/user.js'
|
||||
|
||||
const proxy = getCurrentInstance().proxy;
|
||||
|
||||
// 小程序胶囊高度
|
||||
const topHeight = ref(proxy.$StaticValue.getTopHeight());
|
||||
|
||||
// 用户信息相关
|
||||
const userInfo = ref({});
|
||||
const getUserInfo = async () => {
|
||||
// 从本地获取用户信息
|
||||
userInfo.value = proxy.$StaticValue.getUserInfo();
|
||||
if(!userInfo.value?.userId) {
|
||||
// 如果没有登录, 获取到当前用户的openid
|
||||
const openIdRes = await getOpenId();
|
||||
const openId = openIdRes.openid;
|
||||
userInfo.value = {
|
||||
openId: openId,
|
||||
nickName: '用户'+openId.substring(0, 6)
|
||||
};
|
||||
register(userInfo.value).then(res => {
|
||||
// 注册成功就执行登录
|
||||
login(userInfo.value).then(loginRes => {
|
||||
userInfo.value = loginRes.data;
|
||||
// 存储用户信息到本地
|
||||
proxy.$StaticValue.setUserInfo(userInfo.value);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
getUserInfo();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.my {
|
||||
width: 750rpx;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.user-info {
|
||||
--user-height: 500rpx;
|
||||
width: 750rpx;
|
||||
height: var(--user-height);
|
||||
background-color: #f5f5f5;
|
||||
position: relative;
|
||||
.background {
|
||||
width: 750rpx;
|
||||
height: var(--user-height);
|
||||
background-image: linear-gradient(rgb(87, 255, 87), rgb(144, 251, 144));
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
.info-content {
|
||||
width: 750rpx;
|
||||
height: var(--user-height);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
.top-user-name {
|
||||
width: 750rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.avatars {
|
||||
width: 750rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 20rpx;
|
||||
.avatar-img {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
border-radius: 75rpx;
|
||||
border: 4rpx solid #ffffff;
|
||||
}
|
||||
}
|
||||
.hello-text {
|
||||
width: 750rpx;
|
||||
text-align: center;
|
||||
margin-top: 20rpx;
|
||||
font-size: 30rpx;
|
||||
color: #000000;
|
||||
p {
|
||||
margin: 5rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.section{
|
||||
width: 690rpx;
|
||||
margin: 50rpx auto;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 5rpx 5rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
.list{
|
||||
.row{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-radius: 5rpx;
|
||||
padding: 0 30rpx;
|
||||
height: 100rpx;
|
||||
border: 1px solid #eee;
|
||||
&last-child{
|
||||
border-bottom: 0;
|
||||
}
|
||||
.left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.text{
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
}
|
||||
.right{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.text{
|
||||
font-size: 28rpx;
|
||||
color:#aaa;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
447
scoring/pages/single/single.vue
Normal file
447
scoring/pages/single/single.vue
Normal file
@@ -0,0 +1,447 @@
|
||||
<template>
|
||||
<view class="single">
|
||||
<view class="single-lan">
|
||||
<button @click="addplayer">
|
||||
<uni-icons type="plus"></uni-icons>
|
||||
<text>添加玩家</text>
|
||||
</button>
|
||||
<button @click="transfer">
|
||||
<uni-icons type="person-filled"></uni-icons>
|
||||
<text>转让计分员</text>
|
||||
</button>
|
||||
<view class="lan-switch">
|
||||
<switch @change="" />
|
||||
<text>语音播报</text>
|
||||
</view>
|
||||
<view class="lan-switch">
|
||||
<switch @change="" />
|
||||
<text>台版</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="single-detail">
|
||||
<text class="sing-detail-title">对局记录</text>
|
||||
<text>点击对局分数进行修改</text>
|
||||
</view>
|
||||
<view class="single-score">
|
||||
<text style="color: red;" class="score-remind">
|
||||
点击头像编辑自己的昵称和性别~
|
||||
</text>
|
||||
<view class="single-score-record">
|
||||
<view class="score-record-player">
|
||||
<text class="score-head">玩家</text>
|
||||
<view v-for="(item,index) in players" :key="index" class="player" @click="gotoNewPage">
|
||||
<image :src="item.avatar" mode="widthFix"></image>
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-record-all">
|
||||
<text class="score-head">总分</text>
|
||||
<view class="all-score" v-for="(item,index) in allscores" :key="item.id">
|
||||
{{item.allscore}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-record-all" v-for="match in matchs" :key="match.id">
|
||||
<text class="score-head">第{{match.gametime}}局</text>
|
||||
<view class="all-score" v-for="(item,index) in match.details" :key="item.id">
|
||||
{{item.score}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="single-bottom">
|
||||
<button
|
||||
style="color: aliceblue;
|
||||
background-color: rgb(55, 47, 172);"
|
||||
@click="gotoNewPage1"
|
||||
>
|
||||
开局计分</button>
|
||||
<button
|
||||
@click="multiple"
|
||||
>结算房间</button>
|
||||
</view>
|
||||
<l-popup v-model="isPopupVisible" :closeable="true">
|
||||
<view class="popup-add">
|
||||
<view class="tilte">
|
||||
<text class="title">扫码加入房间</text>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<text class="small">邀请好友扫描下方二维码加入房间</text>
|
||||
<image src="/static/logo.png" mode=""></image>
|
||||
<button class="share">分享给好友邀请加入房间</button>
|
||||
<button class="hand" @click="addvirtue">手动添加虚拟玩家</button>
|
||||
</view>
|
||||
</l-popup>
|
||||
<l-popup v-model="isPopupVisible1" :closeable="true">
|
||||
<view class="popup-add">
|
||||
<view class="tilte">
|
||||
<text class="title">提示</text>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<text class="small">房间内暂无扫码或分享加入房间的玩家,暂时无法转让计分员</text>
|
||||
<button @click="closetransfer">确定</button>
|
||||
</view>
|
||||
</l-popup>
|
||||
<l-popup v-model="virtueplayer" :closeable="true">
|
||||
<view class="popup-virtue">
|
||||
<view class="tilte">
|
||||
<text class="title">添加玩家</text>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="lan-input">
|
||||
<uni-easyinput v-model="value" placeholder="请输入名称" style="width: 500rpx;"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<view class="lan-button">
|
||||
<button @click="closevirtue">取消</button>
|
||||
<button @click="closevirtue">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</l-popup>
|
||||
<l-popup v-model="isPopupVisible2" :closeable="true">
|
||||
<view class="popup-virtue">
|
||||
<view class="tilte">
|
||||
<text class="title" style="font-weight: 600;">输入倍率,快速结算!</text>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="lan-input">
|
||||
<uni-easyinput v-model="value" placeholder="请输入倍率" style="width: 400rpx;"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<view class="lan-button">
|
||||
<button @click="closemultiple">取消</button>
|
||||
<button @click="closemultiple">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</l-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
//跳转至user-detail
|
||||
const gotoNewPage = () => {
|
||||
wx.navigateTo({
|
||||
url: '/pages/user-detail/user-detail'
|
||||
})
|
||||
}
|
||||
|
||||
//跳转至compute
|
||||
const gotoNewPage1 = () => {
|
||||
wx.navigateTo({
|
||||
url: '/pages/compute/compute'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//添加玩家按钮弹窗
|
||||
const isPopupVisible = ref(false);
|
||||
|
||||
const addplayer = ()=>{
|
||||
isPopupVisible.value = true;
|
||||
}
|
||||
|
||||
const closeplayer = ()=>{
|
||||
isPopupVisible.value = false;
|
||||
}
|
||||
|
||||
//添加虚拟玩家
|
||||
const virtueplayer = ref(false);
|
||||
|
||||
const addvirtue = ()=>{
|
||||
isPopupVisible.value = false;
|
||||
virtueplayer.value = true;
|
||||
}
|
||||
|
||||
const closevirtue = ()=>{
|
||||
virtueplayer.value = false;
|
||||
}
|
||||
|
||||
//转让计分员按钮弹窗
|
||||
const isPopupVisible1 = ref(false);
|
||||
|
||||
const transfer = ()=>{
|
||||
isPopupVisible1.value = true;
|
||||
}
|
||||
|
||||
const closetransfer = ()=>{
|
||||
isPopupVisible1.value = false;
|
||||
}
|
||||
|
||||
//倍率结算按钮弹窗
|
||||
const isPopupVisible2 = ref(false);
|
||||
|
||||
const multiple = ()=>{
|
||||
isPopupVisible2.value = true;
|
||||
}
|
||||
|
||||
const closemultiple = ()=>{
|
||||
isPopupVisible2.value = false;
|
||||
}
|
||||
|
||||
const matchs = ref([
|
||||
{
|
||||
id: 1,
|
||||
gametime: 1,
|
||||
details: [
|
||||
{id: 101, score: "+"+10},
|
||||
{id: 102, score: "+"+20},
|
||||
{id: 103, score: "-"+30}
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
gametime: 2,
|
||||
details: [
|
||||
{id: 201, score: "+"+10},
|
||||
{id: 202, score: "+"+20},
|
||||
{id: 203, score: "-"+30}
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
const allscores = ref([
|
||||
{
|
||||
id: 301,
|
||||
allscore: "+"+ 20,
|
||||
},
|
||||
{
|
||||
id: 302,
|
||||
allscore: "+"+ 40,
|
||||
},
|
||||
{ id: 303,
|
||||
allscore: "-"+ 60,
|
||||
}
|
||||
])
|
||||
// const details = ref(
|
||||
// score[1,2,3]
|
||||
// )
|
||||
const players = ref([
|
||||
{
|
||||
id: 401,
|
||||
name: '刘备',
|
||||
avatar: 'https://img1.baidu.com/it/u=3612220943,2414740890&fm=253&app=138&f=JPEG?w=526&h=500'
|
||||
},
|
||||
{
|
||||
id: 401,
|
||||
name: "赵云",
|
||||
avatar: 'https://q3.itc.cn/q_70/images03/20250110/1e71eecf56b34344bcae6a5b85c0bec2.jpeg'
|
||||
},
|
||||
{
|
||||
id: 401,
|
||||
name: "张飞",
|
||||
avatar: 'https://q1.itc.cn/q_70/images03/20241119/197701bb9ef34b20b6497720081a9972.jpeg'
|
||||
}
|
||||
])
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.single{
|
||||
.single-lan{
|
||||
display: flex;
|
||||
border-bottom: 1.5px solid rgb(237, 237, 237);
|
||||
margin-top: 10rpx;
|
||||
padding-bottom: 10rpx;
|
||||
padding-right: 13rpx;
|
||||
button::after {
|
||||
border: none;
|
||||
display: none;
|
||||
}
|
||||
button{
|
||||
padding: 0;
|
||||
font-size: 14.4px;
|
||||
border: 0;
|
||||
outline: none;
|
||||
background-color: #fff;
|
||||
text{
|
||||
color: rgb(102, 102, 102);
|
||||
}
|
||||
}
|
||||
.lan-switch{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
switch{
|
||||
transform:scale(0.7);
|
||||
}
|
||||
text{
|
||||
font-size: 14.4px;
|
||||
color: rgb(102, 102, 102);
|
||||
}
|
||||
}
|
||||
}
|
||||
.single-detail{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid rgb(237, 237, 237);
|
||||
padding: 20rpx 0;
|
||||
.sing-detail-title{
|
||||
font-weight: 600;
|
||||
font-size: 37rpx;
|
||||
padding: 0 12rpx;
|
||||
color: black;
|
||||
}
|
||||
text{
|
||||
font-size: 29rpx;
|
||||
color: rgb(102, 102, 102);
|
||||
}
|
||||
}
|
||||
.single-score{
|
||||
padding-top: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.score-remind{
|
||||
align-self: center;
|
||||
font-size: 29rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.score-record-player{
|
||||
display: flex;
|
||||
margin: 30rpx 0;
|
||||
.score-head{
|
||||
width: 90rpx;
|
||||
align-self: center;
|
||||
padding: 10rpx;
|
||||
}
|
||||
.player{
|
||||
width: 160rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// margin: 0 35rpx;
|
||||
align-items: center;
|
||||
image{
|
||||
width: 100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.score-record-all{
|
||||
display: flex;
|
||||
.score-head{
|
||||
margin: 10rpx 0;
|
||||
width: 90rpx;
|
||||
align-self: center;
|
||||
padding: 10rpx;
|
||||
}
|
||||
.all-score{
|
||||
display: flex;
|
||||
width: 160rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
.single-bottom{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: white;
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.1);
|
||||
button{
|
||||
width: 350rpx;
|
||||
border: 2rpx solid rgb(55, 47, 172);
|
||||
}
|
||||
}
|
||||
.popup-add{
|
||||
width: 600rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: 25rpx;
|
||||
.title{
|
||||
font-size: 38rpx;
|
||||
padding-bottom: 20rpx;
|
||||
text{
|
||||
padding: 0 100rpx;
|
||||
}
|
||||
}
|
||||
.line{
|
||||
width: 580rpx;
|
||||
height: 0.1rpx;
|
||||
background-color: RGB(211, 211, 211);
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.small{
|
||||
padding-top: 30rpx;
|
||||
color: rgb(102, 102, 102);
|
||||
width: 450rpx;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.share{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
image{
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
}
|
||||
button{
|
||||
margin-top: 15rpx;
|
||||
width: 450rpx;
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 15rpx;
|
||||
background-color: rgb(55, 47, 172);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.popup-virtue{
|
||||
width: 600rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: 25rpx;
|
||||
.title{
|
||||
font-size: 38rpx;
|
||||
padding-bottom: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
text{
|
||||
padding: 0 100rpx;
|
||||
}
|
||||
}
|
||||
.line{
|
||||
width: 580rpx;
|
||||
height: 0.1rpx;
|
||||
background-color: RGB(211, 211, 211);
|
||||
margin-top: 30rpx;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
.small{
|
||||
padding-top: 30rpx;
|
||||
color: rgb(102, 102, 102);
|
||||
width: 450rpx;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.share{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
image{
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
}
|
||||
uni-easyinput{
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
.lan-button{
|
||||
padding-top: 50rpx;
|
||||
display: flex;
|
||||
}
|
||||
button{
|
||||
margin-top: 15rpx;
|
||||
width: 260rpx;
|
||||
margin: 0 12rpx;
|
||||
font-size: 30rpx;
|
||||
background-color: rgb(55, 47, 172);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
162
scoring/pages/user-detail/user-detail.vue
Normal file
162
scoring/pages/user-detail/user-detail.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 表单内容 -->
|
||||
<view class="form-content">
|
||||
<!-- 昵称表单项 -->
|
||||
<view class="form-item">
|
||||
<view class="form-label">昵称:</view>
|
||||
<input
|
||||
type="text"
|
||||
class="input-field"
|
||||
placeholder="请输入昵称"
|
||||
v-model="nickname"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 头像表单项 -->
|
||||
<view class="form-item">
|
||||
<view class="form-label">头像:</view>
|
||||
<view class="avatar-container">
|
||||
<view class="avatar-preview" @tap="changeAvatar">
|
||||
</view>
|
||||
<view class="avatar-tip">点击更新头像</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 保存按钮 -->
|
||||
<button class="save-btn" @tap="saveUserInfo">保存</button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const nickname = ref("玩家59306");
|
||||
|
||||
const changeAvatar = () => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: '头像已更新',
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const saveUserInfo = () => {
|
||||
if (!nickname.value.trim()) {
|
||||
uni.showToast({
|
||||
title: '昵称不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: '用户信息已保存',
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
// 延迟返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page{
|
||||
background-color: rgb(240, 243, 245);
|
||||
}
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 页面头部 */
|
||||
.page-header {
|
||||
background-color: #6a5acd;
|
||||
color: white;
|
||||
padding: 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 表单内容 */
|
||||
.form-content {
|
||||
padding: 20rpx 40rpx;
|
||||
margin-top: 30rpx;
|
||||
margin-left: 15rpx;
|
||||
margin-right: 15rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
width: 160rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.input-field {
|
||||
flex: 1;
|
||||
padding: 20rpx 30rpx;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
outline: none;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar-preview {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
margin-bottom: 16rpx;
|
||||
background-color: #1e3a8a;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.avatar-tip {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 保存按钮 */
|
||||
.save-btn {
|
||||
|
||||
background-color: rgb(55, 47, 172);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 13rpx;
|
||||
width: 550rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user