添加商城标签
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
const env = wx.getAccountInfoSync().miniProgram.envVersion; // 获取当前环境(develop/trial/release)
|
|
||||||
const config = {
|
|
||||||
develop: { apiBaseUrl: 'http://192.168.5.5:9096' }, // 开发环境(本地调试)
|
|
||||||
trial: { apiBaseUrl: 'https://test-api.example.com' }, // 体验版(测试环境)
|
|
||||||
release: { apiBaseUrl: 'https://api.example.com' } // 正式版(生产环境)
|
|
||||||
};
|
|
||||||
export default config[env];
|
|
||||||
23
miniprogram/env.ts
Normal file
23
miniprogram/env.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// 环境类型定义
|
||||||
|
type EnvVersion = 'develop' | 'trial' | 'release';
|
||||||
|
|
||||||
|
// 配置类型定义
|
||||||
|
interface EnvConfig {
|
||||||
|
apiBaseUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前环境
|
||||||
|
const accountInfo = wx.getAccountInfoSync();
|
||||||
|
const env = accountInfo.miniProgram.envVersion as EnvVersion;
|
||||||
|
|
||||||
|
// 环境配置映射
|
||||||
|
const config: Record<EnvVersion, EnvConfig> = {
|
||||||
|
develop: { apiBaseUrl: 'http://localhost:9096' },
|
||||||
|
trial: { apiBaseUrl: 'https://test-api.example.com' },
|
||||||
|
release: { apiBaseUrl: 'https://api.example.com' }
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理未知环境(兜底方案)
|
||||||
|
const envConfig = config[env] || config.develop;
|
||||||
|
|
||||||
|
export default envConfig;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<view class="message-container">
|
<view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
/* 消息列表容器 */
|
|
||||||
.message-container {
|
|
||||||
background-color: #f5f5f7;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 搜索栏样式 */
|
|
||||||
.search-bar {
|
|
||||||
padding: 16rpx 24rpx;
|
|
||||||
background-color: #f5f5f7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #eaeaea;
|
|
||||||
border-radius: 30rpx;
|
|
||||||
padding: 14rpx 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-input input {
|
|
||||||
margin-left: 12rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
flex: 1;
|
|
||||||
color: #333;
|
|
||||||
height: 40rpx;
|
|
||||||
line-height: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholder-style {
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 消息列表滚动区域 */
|
|
||||||
.message-list {
|
|
||||||
height: calc(100vh - 96rpx); /* 减去搜索栏高度 */
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 消息项样式 - 已调整高度 */
|
|
||||||
.message-item {
|
|
||||||
display: flex;
|
|
||||||
padding: 16rpx 24rpx; /* 减少内边距 */
|
|
||||||
background-color: #fff;
|
|
||||||
border-bottom: 1rpx solid #f1f1f1;
|
|
||||||
align-items: center;
|
|
||||||
transition: background-color 0.2s;
|
|
||||||
height: 120rpx; /* 固定消息项高度 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-item:active {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 头像容器 */
|
|
||||||
.avatar-container {
|
|
||||||
position: relative;
|
|
||||||
margin-right: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 头像样式 - 缩小尺寸 */
|
|
||||||
.avatar {
|
|
||||||
width: 80rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 未读提示 */
|
|
||||||
.unread-dot {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 24rpx;
|
|
||||||
height: 24rpx;
|
|
||||||
background-color: #ff4d4f;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 4rpx solid #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 未读数量 */
|
|
||||||
.unread-count {
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
min-width: 28rpx;
|
|
||||||
height: 28rpx;
|
|
||||||
line-height: 28rpx;
|
|
||||||
background-color: #ff4d4f;
|
|
||||||
border-radius: 14rpx;
|
|
||||||
border: 4rpx solid #fff;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 20rpx;
|
|
||||||
text-align: center;
|
|
||||||
padding: 0 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 消息内容区域 */
|
|
||||||
.message-content {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 内容顶部(用户名和时间) */
|
|
||||||
.content-top {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 6rpx; /* 减少间距 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.username {
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333;
|
|
||||||
font-weight: 500;
|
|
||||||
max-width: 400rpx;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 内容底部(最后一条消息) */
|
|
||||||
.content-bottom {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.last-message {
|
|
||||||
font-size: 26rpx; /* 缩小字体 */
|
|
||||||
color: #666;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 群聊消息中的发送者 */
|
|
||||||
.sender {
|
|
||||||
color: #677fff;
|
|
||||||
margin-right: 4rpx;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,25 +7,27 @@
|
|||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
}
|
}
|
||||||
.scroll-container {
|
/* 卡片容器使用纵向布局 */
|
||||||
width: 100%;
|
.cards-container {
|
||||||
|
display: flex;
|
||||||
}
|
flex-direction: column; /* 纵向排列卡片 */
|
||||||
.voting-card {
|
gap: 15px; /* 卡片之间的间距 */
|
||||||
min-width: calc(100% - 30px); /* 确保在手机上卡片占满宽度 */
|
padding: 15px;
|
||||||
/* 其他原有样式保持不变 */
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 投票卡片卡片样式 */
|
/* 投票卡片卡片样式 */
|
||||||
.voting-card {
|
.voting-card {
|
||||||
width: 90%;
|
width: 100%;
|
||||||
|
min-height: 400px; /* 卡片最小高度,可根据内容调整 */
|
||||||
background-color: #ffffff;
|
background: #fff;
|
||||||
border-radius: 24rpx;
|
border-radius: 10px;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||||
overflow: hidden;
|
padding: 15px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 卡片头部样式 */
|
/* 卡片头部样式 */
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ Component({
|
|||||||
label_value: 'label_1',
|
label_value: 'label_1',
|
||||||
list: [
|
list: [
|
||||||
{ label_value: 'label_1', icon: 'home', ariaLabel: '首页' },
|
{ label_value: 'label_1', icon: 'home', ariaLabel: '首页' },
|
||||||
{ label_value: 'label_2', icon: 'chat', ariaLabel: '聊天' },
|
{ label_value: 'label_2', icon: 'add', ariaLabel: '聊天' },
|
||||||
{ label_value: 'label_3', icon: 'user', ariaLabel: '我的' },
|
{ label_value: 'label_3', icon: 'shop', ariaLabel: '商城' },
|
||||||
|
{ label_value: 'label_4', icon: 'user', ariaLabel: '我的' },
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
<scroll-view class="scrollarea" scroll-y type="list">
|
<scroll-view class="scrollarea" scroll-y type="list">
|
||||||
<view hidden="{{label_value !== 'label_1'}}"><home-component></home-component></view>
|
<view hidden="{{label_value !== 'label_1'}}"><home-component></home-component></view>
|
||||||
<view hidden="{{label_value !== 'label_2'}}"><chat-component></chat-component></view>
|
<view hidden="{{label_value !== 'label_2'}}"><chat-component></chat-component></view>
|
||||||
<view hidden="{{label_value !== 'label_3'}}"><user-component id="userComp"></user-component></view>
|
<view hidden="{{label_value !== 'label_3'}}">
|
||||||
|
<a></a>
|
||||||
|
</view>
|
||||||
|
<view hidden="{{label_value !== 'label_4'}}"><user-component id="userComp"></user-component></view>
|
||||||
<t-tab-bar t-class="t-tab-bar" value="{{label_value}}" bindchange="onChange" shape="round" theme="tag" split="{{false}}">
|
<t-tab-bar t-class="t-tab-bar" value="{{label_value}}" bindchange="onChange" shape="round" theme="tag" split="{{false}}">
|
||||||
<t-tab-bar-item
|
<t-tab-bar-item
|
||||||
wx:for="{{list}}"
|
wx:for="{{list}}"
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
"./**/*.ts"
|
"./**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules",
|
||||||
|
"miniprogram/env.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user