123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <custom-dialog :visible.sync="dialogVisible" title="角色信息" @close="onClose">
- <view class="character-content">
- <view class="character-info">
- <view class="avatar-section">
- <image class="avatar" src="/static/avatar/default.png" mode="aspectFit"></image>
- <text class="level">Lv.{{level}}</text>
- </view>
- <view class="info-section">
- <view class="info-item">
- <text class="label">名称:</text>
- <text class="value">{{name}}</text>
- </view>
- <view class="info-item">
- <text class="label">经验:</text>
- <text class="value">{{exp}}/{{nextLevelExp}}</text>
- </view>
- <view class="progress-bar">
- <view class="progress" :style="{width: expProgress + '%'}"></view>
- </view>
- </view>
- </view>
- <view class="stats-section">
- <view class="stat-item" v-for="(stat, index) in stats" :key="index">
- <text class="stat-label">{{stat.label}}</text>
- <text class="stat-value">{{stat.value}}</text>
- </view>
- </view>
- </view>
- </custom-dialog>
- </template>
- <script>
- import CustomDialog from '../CustomDialog/CustomDialog.vue'
- export default {
- name: 'CharacterDialog',
- components: {
- CustomDialog
- },
- props: {
- visible: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- dialogVisible: false,
- name: '玩家名称',
- level: 1,
- exp: 100,
- nextLevelExp: 200,
- stats: [
- { label: '力量', value: 10 },
- { label: '敏捷', value: 8 },
- { label: '智力', value: 12 },
- { label: '体力', value: 15 }
- ]
- }
- },
- computed: {
- expProgress() {
- return (this.exp / this.nextLevelExp) * 100
- }
- },
- watch: {
- visible(val) {
- this.dialogVisible = val
- },
- dialogVisible(val) {
- this.$emit('update:visible', val)
- }
- },
- methods: {
- onClose() {
- this.dialogVisible = false
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .character-content {
- .character-info {
- display: flex;
- padding: 20rpx;
- gap: 30rpx;
- .avatar-section {
- position: relative;
-
- .avatar {
- width: 160rpx;
- height: 160rpx;
- border-radius: 80rpx;
- border: 4rpx solid #eee;
- }
- .level {
- position: absolute;
- bottom: -10rpx;
- left: 50%;
- transform: translateX(-50%);
- background: #007AFF;
- color: white;
- padding: 4rpx 16rpx;
- border-radius: 20rpx;
- font-size: 24rpx;
- }
- }
- .info-section {
- flex: 1;
- .info-item {
- margin-bottom: 16rpx;
-
- .label {
- color: #666;
- font-size: 28rpx;
- }
-
- .value {
- color: #333;
- font-size: 28rpx;
- }
- }
- .progress-bar {
- height: 16rpx;
- background: #eee;
- border-radius: 8rpx;
- overflow: hidden;
- margin-top: 10rpx;
- .progress {
- height: 100%;
- background: #007AFF;
- transition: width 0.3s ease;
- }
- }
- }
- }
- .stats-section {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 20rpx;
- padding: 20rpx;
- background: #f8f8f8;
- border-radius: 12rpx;
- margin: 20rpx;
- .stat-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10rpx 20rpx;
- .stat-label {
- color: #666;
- font-size: 28rpx;
- }
- .stat-value {
- color: #333;
- font-size: 28rpx;
- font-weight: 500;
- }
- }
- }
- }
- </style>
|