文件
fenleixinxi/uniapp/components/fc-tabbar/fc-tabbar.vue
linda 376a7ed793 feat(uniapp): 小程序端(用户端 uni-app)源码入库到 uniapp/ 目录
需求:小程序端代码要同时同步到服务器与 git 远程仓库,此前前端仅存在于本地目录(无 remote,从未推送),
服务器与 gitcode 上只有后端。现并入本仓库,复用现有「push 即部署」链路,一次推送双端落地。

- 新增 uniapp/:小程序端源码全量快照(150 文件 / 1.2M)
  pages(13 页面) · components(fc-navbar/fc-tabbar/fc-post-card/fc-empty) ·
  common(api·utils·mock·assets·store·config) · static(74 图标 + 3 轮播插画 + LOGO) ·
  docs(01-04 交付文档) · tests(零依赖全链路用例) · tools(图标/主题/轮播配图生成脚本)
- 明确排除:AGENTS.md(含后台密码、服务器 root 密码、小程序 AppSecret,切勿入库)、
  unpackage/(构建产物,由 uniapp/.gitignore 忽略)、node_modules、.DS_Store、*.log
- .gitignore 新增 /uniapp/AGENTS.md 兜底(与根 /AGENTS.md、/fluniapp/ 同一约定)
- README.md 增补「本项目结构 + 部署链路」章节,说明 uniapp/ 为源码快照、
  小程序真正上线仍需微信开发者工具 cli upload

说明:本次为源码快照,未携带前端本地仓库历史——其历史提交中含 AGENTS.md 凭据,
若做 subtree 合并会把密码永久写入本仓库历史,故采用快照方式。
2026-10-17 14:19:03 +08:00

111 行
2.6 KiB
Vue

<template>
<view class="fc-tabbar">
<view
v-for="(item, idx) in tabs"
:key="item.path"
class="fc-tabbar__item"
:class="{ 'fc-tabbar__item--active': current === idx, 'fc-tabbar__item--primary': item.primary }"
@click="switchTo(item, idx)"
>
<view class="fc-tabbar__icon" :class="{ 'fc-tabbar__icon--circle': item.primary }">
<image v-if="item.primary" class="fc-tabbar__plus" :src="iconUrl('plus-ink')" mode="aspectFit" />
<image v-else class="fc-tabbar__img" :src="iconUrl(current === idx ? item.active : item.icon)" mode="aspectFit" />
</view>
<text class="fc-tabbar__text">{{ item.text }}</text>
</view>
<view class="fc-safe-bottom"></view>
</view>
</template>
<script>
import { iconUrl } from '@/common/store/ui.js'
export default {
name: 'FcTabbar',
props: {
current: { type: Number, default: 0 },
},
data() {
return {
tabs: [
{ text: '首页', icon: 'tab-home', active: 'tab-home-on', path: '/pages/index/index' },
{ text: '发布', icon: 'tab-post', active: 'tab-post-on', path: '/pages/post/create', primary: true },
{ text: '消息', icon: 'tab-message', active: 'tab-message-on', path: '/pages/message/index' },
{ text: '我的', icon: 'tab-mine', active: 'tab-mine-on', path: '/pages/mine/index' },
],
}
},
methods: {
// 暴露给模板:图标地址由后台配置决定(未配置则用内置图标)
iconUrl,
switchTo(item, idx) {
if (idx === this.current) return
uni.reLaunch({ url: item.path })
},
},
}
</script>
<style lang="scss" scoped>
.fc-tabbar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
display: flex;
align-items: center;
justify-content: space-around;
padding-top: 10rpx;
background: #ffffff;
border-top: 2rpx solid $fc-border;
box-shadow: 0 -6rpx 24rpx rgba(4, 48, 30, 0.08);
}
.fc-tabbar__item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 8rpx;
&--active {
.fc-tabbar__text {
color: $fc-primary-text;
font-weight: 600;
}
}
&--primary {
.fc-tabbar__text {
color: $fc-primary-text;
}
}
}
.fc-tabbar__icon {
height: 52rpx;
display: flex;
align-items: center;
justify-content: center;
&--circle {
width: 76rpx;
height: 76rpx;
margin-top: -34rpx;
border-radius: 50%;
background: $fc-gradient-primary;
box-shadow: 0 8rpx 20rpx rgba(4, 48, 30, 0.4);
}
}
.fc-tabbar__img {
width: 44rpx;
height: 44rpx;
}
.fc-tabbar__plus {
width: 40rpx;
height: 40rpx;
}
.fc-tabbar__text {
font-size: $fc-font-xs;
color: $fc-text-secondary;
margin-top: 4rpx;
}
</style>