20260818
This commit is contained in:
parent
b9c8e026ca
commit
3e7e55cb1a
151
README.md
Normal file
151
README.md
Normal file
@ -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 `<dengzhifeng_63@163.com>`
|
||||
105
src/app.wpy
105
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',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="chooseImageTips">
|
||||
<view :class="{'~show':chooseShow}" class="cu-modal ~cu-modal ~bottom-modal" catchtap="hideModal">
|
||||
<view class="~cu-dialog cu-dialog ">
|
||||
<view :class="{'show': chooseShow}" class="chooseImageTips-modal" catchtap="hideModal">
|
||||
<view class="chooseImageTips-dialog">
|
||||
<view class="g_ct">
|
||||
<view class="u_tt ~font_26 ~color999">
|
||||
<view class="~font_26 ~color333">上传本人真实正面照,不规范的头像将无法通过审核哦</view>
|
||||
@ -140,48 +140,76 @@
|
||||
|
||||
<style lang="less">
|
||||
.chooseImageTips {
|
||||
.cu-modal {
|
||||
z-index: 9999999999;
|
||||
}
|
||||
|
||||
.chooseImageTips-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 9999999999;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: all 0.3s ease-in-out 0s;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chooseImageTips-modal.show {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.chooseImageTips-dialog {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 640rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
overflow: hidden;
|
||||
|
||||
.g_ct {
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
.cu-dialog{
|
||||
height: 640rpx;
|
||||
border-radius: 32rpx 32rpx 0px 0px !important;
|
||||
.g_ct {
|
||||
padding: 30rpx 0;
|
||||
.u_tt {
|
||||
padding: 0 30rpx;
|
||||
text-align: left;
|
||||
position: relative;
|
||||
.u_tt_img {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
.m_img {
|
||||
padding: 30rpx;
|
||||
border-bottom: 2px solid #F5F5F5;
|
||||
view {
|
||||
image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.font_32 {
|
||||
padding: 30rpx;
|
||||
}
|
||||
.u_album {
|
||||
border-top: 2px solid #F5F5F5;
|
||||
// border-bottom: 8px solid #F5F5F5;
|
||||
}
|
||||
}
|
||||
.padding30{
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.u_tt {
|
||||
padding: 0 30rpx;
|
||||
text-align: left;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.u_tt_img {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
position: absolute;
|
||||
right: 30rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.m_img {
|
||||
padding: 30rpx;
|
||||
border-bottom: 2px solid #F5F5F5;
|
||||
|
||||
image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.font_32 {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.u_album {
|
||||
border-top: 2px solid #F5F5F5;
|
||||
}
|
||||
|
||||
.padding30 {
|
||||
padding: 30rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,30 +1,53 @@
|
||||
<style lang="less">
|
||||
page {}
|
||||
|
||||
.upload_file {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.upload-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1110;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease-in-out 0s;
|
||||
pointer-events: none;
|
||||
|
||||
._item {
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
.upload-sheet {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
._cancel {
|
||||
border-top: 16rpx solid #f8f8f8;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
._title {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
._item {
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
._cancel {
|
||||
border-top: 16rpx solid #f8f8f8;
|
||||
margin-bottom: 24rpx;
|
||||
color: #B4B4B4;
|
||||
}
|
||||
|
||||
</style>
|
||||
<template>
|
||||
<view :class="{'~show': chooseShow}" class="~cu-modal ~bottom-modal">
|
||||
<view class="~cu-dialog" style="border-radius: 32rpx 32rpx 0 0;">
|
||||
<view class="~bg_f upload_file">
|
||||
<view class="_title _item ~font_32" @tap="onCamera">拍摄</view>
|
||||
<view class="_title _item ~font_32" @tap="chooseImageV2">从手机相册选择</view>
|
||||
<view class="_title _item ~font_32 ~color333 _cancel" @tap="cancelFn">取消</view>
|
||||
</view>
|
||||
<view class="upload-mask" :style="{ opacity: chooseShow ? 1 : 0, visibility: chooseShow ? 'visible' : 'hidden', pointerEvents: chooseShow ? 'auto' : 'none' }">
|
||||
<view class="upload-sheet">
|
||||
<view class="_title _item" @tap="onCamera">拍摄</view>
|
||||
<view class="_title _item" @tap="chooseImageV2">从手机相册选择</view>
|
||||
<view class="_title _item _cancel" @tap="cancelFn">取消</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -1269,6 +1269,7 @@
|
||||
vm.$showToast('最多可上传9张')
|
||||
} else {
|
||||
vm.choosePicsShow = true
|
||||
console.log(vm.choosePicsShow)
|
||||
// vm.$trigger('uploadPics', 'chooseImageV2', minNum)
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user