diff --git a/README.md b/README.md new file mode 100644 index 0000000..afc9d46 --- /dev/null +++ b/README.md @@ -0,0 +1,151 @@ +# 福恋小程序(ufutx.love.mp.v2) + +> 基于 **WePY 2.x** 的微信小程序项目,对应线上小程序 **福恋(love.ufutx.com)**。 + +- 项目名:`ufutx_fulllink` +- 版本:`v5.6.5`(见 `src/app.wpy` 中 `globalData.versions`) +- AppID:`wxe486777f4379507e` +- 框架:WePY 2.x(类 Vue 语法,编译为微信小程序原生代码) +- 仓库目录:`/Users/d/fulllink-project/ufutx.love.mp.v2` + +--- + +## 一、技术栈 + +| 分类 | 选型 | +| --- | --- | +| 小程序框架 | [WePY 2.x](https://wepyjs.github.io/wepy/)(`@wepy/core` `^2.1.0`) | +| 状态管理 | `@wepy/x`(Vuex 风格,见 `src/store/index.js`) | +| 异步化 | `@wepy/use-promisify`(wx API Promise 化) | +| UI 样式 | ColorUI(`src/colorui`,wxss)+ Less(`@wepy/compiler-less`) | +| 构建 | `@wepy/cli` / `wepy build` | +| 即时通讯 | 网易云信 `nim-web-sdk-ng`(IM 聊天,见 `src/utils/im.js`) | +| 电子卡 / 实人认证 | 内置 `src/mp_ecard_sdk`(eID 相关协议页) | +| 国际化 | `src/i18n`(中文 `zh` / 英文 `en`) | +| 工具库 | `dayjs`、`miniprogram-slide-view`、四电极报告库 `@yolanda-qn/four-electrodes-report-lib-pe` | + +--- + +## 二、目录结构 + +``` +ufutx.love.mp.v2/ +├── src/ # 源码(开发目录,WePY 工程) +│ ├── app.wpy # 小程序入口(全局样式/生命周期/页面注册) +│ ├── config.js # 接口域名配置(线上/本地环境切换) +│ ├── colorui/ # ColorUI 样式库(icon/main/animation.wxss) +│ ├── common/ # 公共模块(eventHub 事件总线) +│ ├── components/ # 公共组件(27 个 .wpy) +│ │ ├── chatEmojiFile/ # 聊天表情 +│ │ ├── uploadPic(s)/uploadVideo(V2)/ # 图片/视频上传 +│ │ ├── wepy-image-cropper.wpy # 图片裁剪 +│ │ ├── loginDialog / recommendDialog / residenceDialog ... +│ │ └── ... +│ ├── i18n/ # 国际化(zh.js / en.js) +│ ├── images/ # 图片资源(tabBar 图标、icon 等) +│ ├── mixins/ # 混入(https 请求封装、base、阿里云上传 SDK) +│ ├── mp_ecard_sdk/ # 电子卡 / eID 实人认证 SDK 及协议页 +│ ├── pages/ # 业务页面(tabBar + 分包) +│ ├── store/ # 全局状态(Vuex 风格) +│ ├── styles/ # 全局 Less 样式 +│ └── utils/ # 工具(util / dateTimeFormat / comment / im) +├── weapp/ # 编译产物(微信开发者工具直接导入此目录) +├── node_modules/ # 依赖(已安装) +├── package.json +├── project.config.json # 微信项目配置(miniprogramRoot: weapp/) +├── wepy.config.js +└── .eslintrc.js / .prettierrc +``` + +### 页面与分包(`src/app.wpy`) + +- **tabBar 主包**:`welcome` / `home` / `dynamic` / `news` / `user` +- **分包 `pages/dynamic`**:动态详情、热门话题、发布、话题搜索、投票详情 +- **分包 `pages/home`**:动态信息流、择偶要求、优质单身、报名、搜索条件/用户、单身广场 +- **分包 `pages/news`**:私聊、群聊、好友请求、访客、系统消息、审核等 +- **分包 `pages/users`**:实名/学历认证、未婚证明、VIP 升级、黑名单、设置、关于等 +- **分包 `pages/books`**:书籍详情、学校认证 + +--- + +## 三、环境准备 + +> ⚠️ **Node 版本要求**:`package.json` 中 `engines` 限定 `node >=14 <17`。 +> 本机当前为 Node **v22**,与 WePY 2.x 工具链不兼容,**请先切到 Node 14~16**(推荐用 nvm): +> +> ```bash +> nvm install 16 +> nvm use 16 +> ``` + +1. 安装依赖(如 `node_modules` 缺失或需重装): + + ```bash + npm install + ``` + +2. 配置接口域名(编辑 `src/config.js`): + + ```js + // 线上环境(默认) + host = 'https://love.ufutx.com/go/api' + // 本地联调时取消注释: + // host = 'http://love.ufutx.net/go/api' + ``` + +--- + +## 四、本地开发 / 构建 + +```bash +# 开发模式:监听改动并实时编译到 weapp/ +npm run dev + +# 生产构建(关闭缓存) +npm run build + +# 代码检查 / 自动修复 +npm run lint +npm run lint:fix + +# 清理编译产物 +npm run clean +``` + +### 在微信开发者工具中运行 + +1. 打开**微信开发者工具** → 导入项目 +2. 目录选择本项目的 **`weapp/`** 文件夹(`project.config.json` 已设 `miniprogramRoot: "weapp/"`) +3. 填入 AppID:`wxe486777f4379507e` +4. 确保已执行过 `npm run dev` 或 `npm run build`,`weapp/` 内有编译产物 + +> 上传 / 预览(需安装 `wx-tools`): +> ```bash +> npm run preview # 预览 +> npm run deploy # 上传,版本号取 package.json version +> ``` + +--- + +## 五、关键模块说明 + +- **登录态**:`src/app.wpy` `onLaunch` 调用 `appLogin()`;IM 实例在 `src/utils/im.js` 通过 `NIM.getInstance` 初始化(网易云信 appkey 已内置)。 +- **网络请求**:封装于 `src/mixins/https.js`,统一走 `src/config.js` 的 `service` 接口地址。 +- **电子卡 / 实人认证**:`src/mp_ecard_sdk` 含 eID 相关协议页与逻辑,被主包以页面形式注册。 +- **国际化**:`src/i18n/modules/zh.js` 与 `en.js`,通过 `src/i18n/index.js` 注入。 +- **Git 分支约定**:仓库内历史提交多为功能/审核修复(如 iOS 购买 VIP、扫码地址、强制登录限制等)。 + +--- + +## 六、常见问题 + +- **编译报 Node 版本错误** → 切到 Node 16(`nvm use 16`)。 +- **开发者工具提示找不到页面** → 确认先执行 `npm run dev/build`,且工具导入的是 `weapp/` 而非 `src/`。 +- **接口 404 / 无法登录** → 检查 `src/config.js` 中的 `host` 是否为当前环境域名。 +- **IM 连不上** → 确认 `src/utils/im.js` 中 appkey / lbsUrls / linkUrl 与网易云信后台一致。 + +--- + +## 七、License + +MIT — Author: mamba `` diff --git a/src/app.wpy b/src/app.wpy index 9bb78be..bf0fdde 100644 --- a/src/app.wpy +++ b/src/app.wpy @@ -17,8 +17,8 @@ import wepy from '@wepy/core' import vuex from '@wepy/x' import promisify from '@wepy/use-promisify' -import { wx_login } from './utils/util' -import { IM } from './utils/im' +import {wx_login} from './utils/util' +import {IM} from './utils/im' import {initEid} from './mp_ecard_sdk/main' // import {service} from './config' @@ -35,7 +35,7 @@ wepy.app({ } }, globalData: { - versions: 'v5.6.5', // 版本号 + versions: 'v5.6.7', // 版本号 navBarHeight: 0, // 导航栏高度 navRight: 0, // 胶囊距右方间距(方保持左、右间距一致) navTop: 0, // 胶囊距顶部间距 @@ -89,11 +89,11 @@ wepy.app({ onShow(options) { console.log('路径携带参数:', options) - // if (options.path === 'pages/home/informationV2') { - // wx.redirectTo({ url: `/pages/home/information?${decodeURIComponent(options.query.scene)}` }) - // } + // if (options.path === 'pages/home/informationV2') { + // wx.redirectTo({ url: `/pages/home/information?${decodeURIComponent(options.query.scene)}` }) + // } if (options.path === 'pages/tabBar/home1') { - wx.switchTab({ url: `/pages/tabBar/home?${decodeURIComponent(options.query.scene)}` }) + wx.switchTab({url: `/pages/tabBar/home?${decodeURIComponent(options.query.scene)}`}) } if (options.query.scene) { let sceneList = decodeURIComponent(options.query.scene).split(/[= &]/) @@ -115,14 +115,15 @@ wepy.app({ onPageNotFound(res) { console.log(res, '错误res') if (res.path === 'pages/home/informationV2') { - wx.redirectTo({ url: `/pages/home/information?${decodeURIComponent(res.query.scene)}` }) + wx.redirectTo({url: `/pages/home/information?${decodeURIComponent(res.query.scene)}`}) } else { wx.switchTab({ url: `/pages/tabBar/home?${decodeURIComponent(res.query.scene)}` }) // 如果是 tabbar 页面,请使用 wx.switchTab } }, - onHide() {}, + onHide() { + }, methods: { appLogin() { @@ -157,11 +158,11 @@ pages: [ 'pages/tabBar/home', 'pages/tabBar/news', 'pages/tabBar/user', - 'mp_ecard_sdk/index/index', - 'mp_ecard_sdk/protocol/service/index', - 'mp_ecard_sdk/protocol/privacy/index', - 'mp_ecard_sdk/protocol/userAccredit/index', - 'mp_ecard_sdk/protocol/eid/index' +'mp_ecard_sdk/index/index', +'mp_ecard_sdk/protocol/service/index', +'mp_ecard_sdk/protocol/privacy/index', +'mp_ecard_sdk/protocol/userAccredit/index', +'mp_ecard_sdk/protocol/eid/index' ], 'permission': { 'scope.userFuzzyLocation': { @@ -211,44 +212,44 @@ subPackages: [ 'visitorNum', ] }, - { - 'root': 'pages/users', - 'pages': [ - 'unmarriV2', - 'unmarri', - 'myCertification', - 'artificial', - 'realName', - 'selfTextarea', - 'setTing', - 'aboutLove', - 'blacklist', - 'logout', - 'degreeCertificate', - 'schools', - 'friendlist', - 'report', - 'upgradeVIP', - 'upgradeVIP2', - 'myOrderList', - 'orderDetails', - 'exclusiveService', - 'myDynamic', - 'logoutDefault', - 'ImageCropper', - 'myDynamicDetail', - 'groupMember', - 'blacklistDefault', - 'freeze', - ] - }, - { - 'root': 'pages/books', - 'pages': [ - 'bookDetail', - 'schoolVerify', - ] - }, +{ +'root': 'pages/users', +'pages': [ +'unmarriV2', +'unmarri', +'myCertification', +'artificial', +'realName', +'selfTextarea', +'setTing', +'aboutLove', +'blacklist', +'logout', +'degreeCertificate', +'schools', +'friendlist', +'report', +'upgradeVIP', +'upgradeVIP2', +'myOrderList', +'orderDetails', +'exclusiveService', +'myDynamic', +'logoutDefault', +'ImageCropper', +'myDynamicDetail', +'groupMember', +'blacklistDefault', +'freeze', +] +}, +{ +'root': 'pages/books', +'pages': [ +'bookDetail', +'schoolVerify', +] +}, ], window: { backgroundTextStyle: 'light', diff --git a/src/components/chooseImageTips.wpy b/src/components/chooseImageTips.wpy index be2111e..1b6b7b2 100644 --- a/src/components/chooseImageTips.wpy +++ b/src/components/chooseImageTips.wpy @@ -1,7 +1,7 @@