文件
fenleixinxi/uniapp/components/fc-navbar/fc-navbar.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

114 行
2.3 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="fc-navbar" :class="[`fc-navbar--${theme}`]">
<view class="fc-navbar__status" :style="{ height: statusBarHeight + 'px' }"></view>
<view class="fc-navbar__bar" :style="{ height: barHeight + 'px' }">
<view v-if="showBack" class="fc-navbar__back" @click="onBack">
<text class="fc-navbar__back-icon">‹</text>
</view>
<view class="fc-navbar__title" :class="{ 'fc-navbar__title--center': center }">
<slot>
<text class="fc-navbar__title-text">{{ title }}</text>
</slot>
</view>
<view class="fc-navbar__right">
<slot name="right"></slot>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'FcNavbar',
props: {
title: { type: String, default: '' },
theme: { type: String, default: 'gradient' }, // gradient | white
showBack: { type: Boolean, default: false },
center: { type: Boolean, default: true },
},
data() {
return { statusBarHeight: 20, barHeight: 44 }
},
created() {
try {
const info = uni.getSystemInfoSync()
this.statusBarHeight = info.statusBarHeight || 20
} catch (e) {
/* 忽略(非 uni 环境) */
}
},
methods: {
onBack() {
const pages = getCurrentPages()
if (pages && pages.length > 1) uni.navigateBack()
else uni.reLaunch({ url: '/pages/index/index' })
},
},
}
</script>
<style lang="scss" scoped>
.fc-navbar {
position: sticky;
top: 0;
z-index: 99;
&--gradient {
background: $fc-gradient-hero;
.fc-navbar__title-text {
color: #ffffff;
}
.fc-navbar__back-icon {
color: #ffffff;
}
}
&--white {
background: #ffffff;
border-bottom: 2rpx solid $fc-border;
.fc-navbar__title-text {
color: $fc-text;
}
.fc-navbar__back-icon {
color: $fc-text;
}
}
}
.fc-navbar__bar {
display: flex;
align-items: center;
padding: 0 24rpx;
position: relative;
}
.fc-navbar__back {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.fc-navbar__back-icon {
font-size: 52rpx;
line-height: 1;
font-weight: 300;
}
.fc-navbar__title {
flex: 1;
&--center {
position: absolute;
left: 0;
right: 0;
text-align: center;
pointer-events: none;
}
}
.fc-navbar__title-text {
font-size: $fc-font-xl;
font-weight: 600;
}
.fc-navbar__right {
position: relative;
z-index: 1;
display: flex;
align-items: center;
}
</style>