init project

This commit is contained in:
mac·ufutx 2026-04-21 09:56:13 +08:00
parent 774bab3655
commit ec59edc7f9
31 changed files with 7728 additions and 4249 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
<option name="progress" value="1.0" />
</component>
</project>

0
10
View File

0
10'
View File

8150
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +1,107 @@
{ {
"name": "ufutx_dma", "name": "ufutx_fulllink",
"version": "0.0.1", "version": "0.0.1",
"description": "A WePY project", "description": "ufutx 微信小程序项目基于wepy 2.x",
"main": "weapp/app.js", "main": "weapp/app.js",
"scripts": { "scripts": {
"start": "npm run dev",
"dev": "./node_modules/.bin/wepy build --watch", "dev": "./node_modules/.bin/wepy build --watch",
"build": "cross-env NODE_ENV=production ./node_modules/.bin/wepy build --no-cache", "build": "cross-env NODE_ENV=production ./node_modules/.bin/wepy build --no-cache ",
"clean": "rm -rf weapp", "clean": "rm -rf weapp",
"lint": "eslint --ext .js,.wpy src/",
"lint:fix": "eslint --ext .js,.wpy src/ --fix",
"preview": "npm run build && wx-tools preview",
"deploy": "npm run build && wx-tools upload --version $npm_package_version --desc '自动上传'",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"wepy": { "wepy": {
"module-a": false, "module-a": false,
"./src/components/list": "./src/components/wepy-list.wpy" "resolve": {
"alias": {
"@": "./src"
}
},
"compiler": {
"babel": {
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
]
],
"plugins": [
"@wepy/babel-plugin-import-regenerator"
]
},
"less": {
"paths": [
"./src/styles"
]
}
}
}, },
"author": "mamba <dengzhifeng_63@163.com>", "author": "mamba <dengzhifeng_63@163.com>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@wepy/core": "^2.0.0-alpha.16", "@wepy/core": "^2.1.0",
"@wepy/use-promisify": "^2.1.0", "@wepy/use-promisify": "^2.1.0",
"@wepy/x": "^2.0.2", "@wepy/x": "^2.1.0",
"@yolanda-qn/four-electrodes-report-lib-pe": "^1.1.5", "@yolanda-qn/four-electrodes-report-lib-pe": "^1.1.5",
"dayjs": "^1.11.7", "dayjs": "^1.11.10",
"miniprogram-slide-view": "0.0.3", "miniprogram-slide-view": "0.0.3",
"nim-web-sdk-ng": "^10.3.1" "nim-web-sdk-ng": "^10.3.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.1.0", "@babel/core": "^7.23.0",
"@babel/preset-env": "^7.1.0", "@babel/preset-env": "^7.23.0",
"@wepy/babel-plugin-import-regenerator": "0.0.2", "@wepy/babel-plugin-import-regenerator": "0.0.2",
"@wepy/cli": "^2.0.0-alpha.28", "@wepy/cli": "^2.1.0",
"@wepy/compiler-babel": "^2.0.1", "@wepy/compiler-babel": "^2.1.0",
"@wepy/compiler-less": "^2.0.1", "@wepy/compiler-less": "^2.1.0",
"babel-eslint": "^7.2.1", "babel-eslint": "^7.2.3",
"cross-env": "^5.1.3", "cross-env": "^7.0.3",
"eslint": "^3.18.0", "eslint": "^3.18.0",
"eslint-config-standard": "^7.1.0", "eslint-config-standard": "^7.1.0",
"eslint-friendly-formatter": "^2.0.7", "eslint-friendly-formatter": "^2.0.7",
"eslint-plugin-html": "^2.0.1", "eslint-plugin-html": "^2.0.1",
"eslint-plugin-promise": "^3.5.0", "eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.0.1", "eslint-plugin-standard": "^2.0.1",
"less": "^3.8.1", "husky": "^7.0.4",
"less": "^3.13.1",
"lint-staged": "^11.2.6",
"prettier": "^2.8.8",
"wepy-cli-extend": "^1.0.3", "wepy-cli-extend": "^1.0.3",
"wepy-eslint": "^1.5.3" "wepy-eslint": "^1.5.3"
},
"engines": {
"node": ">=14.0.0 <17.0.0",
"npm": ">=6.0.0"
},
"browserslist": [
"iOS >= 9",
"Android >= 5",
"last 2 versions",
"not dead"
],
"overrides": {
"nim-web-sdk-ng": {
"vue": "^2.6.14"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,wpy}": [
"eslint --fix",
"prettier --write"
],
"*.less": [
"prettier --write"
]
} }
} }

View File

@ -35,7 +35,7 @@ wepy.app({
} }
}, },
globalData: { globalData: {
versions: 'v5.5.101', // 版本号 versions: 'v5.6.3', // 版本号
navBarHeight: 0, // 导航栏高度 navBarHeight: 0, // 导航栏高度
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致) navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
navTop: 0, // 胶囊距顶部间距 navTop: 0, // 胶囊距顶部间距
@ -258,29 +258,29 @@ navigationBarTextStyle: 'black'
}, },
tabBar: { tabBar: {
color: '#999999', color: '#999999',
selectedColor: '#333333', selectedColor: '#fa4d76',
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
borderStyle: 'black', borderStyle: 'black',
list: [ list: [
{ {
pagePath: 'pages/tabBar/home', pagePath: 'pages/tabBar/home',
selectedIconPath: './images/tabbar/homeActive.png', selectedIconPath: './images/tabBar/tab_recommend_active.png',
iconPath: './images/tabbar/home.png', iconPath: './images/tabBar/tab_recommend_normal.png',
text: '推荐' text: '推荐'
}, { }, {
pagePath: 'pages/tabBar/dynamic', pagePath: 'pages/tabBar/dynamic',
selectedIconPath: './images/tabbar/attentionActive.png', selectedIconPath: './images/tabBar/tab_discover_active.png',
iconPath: './images/tabbar/attention.png', iconPath: './images/tabBar/tab_discover_normal.png',
text: '发现' text: '发现'
}, { }, {
pagePath: 'pages/tabBar/news', pagePath: 'pages/tabBar/news',
selectedIconPath: './images/tabbar/messageActive.png', selectedIconPath: './images/tabBar/tab_message_active.png',
iconPath: './images/tabbar/message.png', iconPath: './images/tabBar/tab_message_normal.png',
text: '消息' text: '消息'
}, { }, {
pagePath: 'pages/tabBar/user', pagePath: 'pages/tabBar/user',
selectedIconPath: './images/tabbar/myActive.png', selectedIconPath: './images/tabBar/tab_mine_active.png',
iconPath: './images/tabbar/my.png', iconPath: './images/tabBar/tab_mine_normal.png',
text: '我的' text: '我的'
}] }]
}, },

View File

@ -3,7 +3,7 @@
<view :class="{'~show':modalName == 'unlockModal'}" class="~cu-modal"> <view :class="{'~show':modalName == 'unlockModal'}" class="~cu-modal">
<view class="open_unlock_box" style="padding-top: 126rpx;"> <view class="open_unlock_box" style="padding-top: 126rpx;">
<image class="unlockPrompt_bg" src="https://images.ufutx.com/202106/01/3ae4aefd9aed69d6800ed12cac94fbb2.png" mode="widthFix"></image> <image class="unlockPrompt_bg" src="https://images.ufutx.com/202106/01/3ae4aefd9aed69d6800ed12cac94fbb2.png" mode="widthFix"></image>
<image v-if="ios" class="unlock_bg" src="https://images.ufutx.com/202106/02/d398cbcc114dbfce26470db15d47716c.png" mode="widthFix" @tap="goTo('/pages/users/upgradeVIP?chat_user_id={{chat_user_id}}')"></image> <image v-if="ios" class="unlock_bg" src="https://images.ufutx.com/202106/02/d398cbcc114dbfce26470db15d47716c.png" mode="widthFix" @tap="goTo('pages/users/upgradeVIP?chat_user_id={{chat_user_id}}')"></image>
<image v-else class="unlock_bg" src="https://images.ufutx.com/202106/02/d398cbcc114dbfce26470db15d47716c.png" mode="widthFix" @tap="determine('vipModal')"></image> <image v-else class="unlock_bg" src="https://images.ufutx.com/202106/02/d398cbcc114dbfce26470db15d47716c.png" mode="widthFix" @tap="determine('vipModal')"></image>
<view class="font_24 color-666" style="padding: 16rpx 0 24rpx 0"> <view class="font_24 color-666" style="padding: 16rpx 0 24rpx 0">
</view> </view>

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

View File

@ -117,9 +117,6 @@ export default {
if (res.confirm) { if (res.confirm) {
vm.errorOne = 1 vm.errorOne = 1
wx.hideLoading() wx.hideLoading()
// wx.navigateBack({
// delta: 1
// })
} }
} }
}) })

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import Vuex from '@wepy/x'; import Vuex from '@wepy/x'
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
@ -6,23 +6,23 @@ export default new Vuex.Store({
}, },
mutations: { mutations: {
increment (state) { increment (state) {
state.counter++; state.counter++
}, },
decrement (state) { decrement (state) {
state.counter--; state.counter--
} }
}, },
actions: { actions: {
increment ({ commit }) { increment ({ commit }) {
commit('increment'); commit('increment')
}, },
decrement ({ commit }) { decrement ({ commit }) {
commit('decrement'); commit('decrement')
}, },
incrementAsync ({ commit }) { incrementAsync ({ commit }) {
setTimeout(() => { setTimeout(() => {
commit('increment'); commit('increment')
}, 1000); }, 1000)
} }
} }
}); })

View File

@ -2,6 +2,7 @@ import NIM from 'nim-web-sdk-ng/dist/v2/NIM_MINIAPP_SDK'
import { service } from '../config.js' import { service } from '../config.js'
const IM = (account, token) => { const IM = (account, token) => {
// 沿用旧版稳定配置格式:不使用官网新的分参数配置,避免兼容问题
let nim = NIM.getInstance({ let nim = NIM.getInstance({
debugLevel: 'off', debugLevel: 'off',
appkey: '9bc3ed1f7d8197b6b69f8f5b742824b1', appkey: '9bc3ed1f7d8197b6b69f8f5b742824b1',
@ -13,10 +14,38 @@ const IM = (account, token) => {
linkUrl: 'wlnimsc0.netease.im' linkUrl: 'wlnimsc0.netease.im'
}) })
// 保留核心优化筛选有效群会话ID解决“找不到会话”报错
const getValidTeamSessionIds = (sessions) => {
return sessions.filter(item => item.scene === 'team').map(item => item.to)
}
// 保留核心优化清理无效存储数据避免用无效群ID操作
const cleanInvalidTeamStorage = (validTeamIds) => {
// 清理免打扰列表
let muteNotList = wx.getStorageSync('muteNotList') || []
const validMuteList = muteNotList.filter(item =>
validTeamIds.includes(`team-${item.teamId}`)
)
if (muteNotList.length !== validMuteList.length) {
wx.setStorageSync('muteNotList', validMuteList)
}
// 清理群未读数列表
let teamsSessionsCount = wx.getStorageSync('teamsSessionsCount') || []
const validTeamsCount = teamsSessionsCount.filter(item =>
validTeamIds.includes(item.id)
)
if (teamsSessionsCount.length !== validTeamsCount.length) {
wx.setStorageSync('teamsSessionsCount', validTeamsCount)
}
}
// 沿用旧版事件列表:不新增可能兼容问题的事件
const eventList = [ const eventList = [
'logined', 'willReconnect', 'disconnect', 'msg', 'syncdone', 'syncRoamingMsgs', 'sessions', 'updateMuteList', 'friends', 'updateSession', 'teams', 'myTeamMembers', 'updateMyMemberInfo', 'sendTeamMsg' 'logined', 'willReconnect', 'disconnect', 'msg', 'syncdone', 'syncRoamingMsgs', 'sessions', 'updateMuteList', 'friends', 'updateSession', 'teams', 'myTeamMembers', 'updateMyMemberInfo', 'sendTeamMsg'
] ]
// 沿用旧版事件注册方式
eventList.forEach((key) => { eventList.forEach((key) => {
nim.on(key, (res) => { nim.on(key, (res) => {
// console.log(`Receive ${key} event`, res ? JSON.parse(JSON.stringify(res)) : res) // console.log(`Receive ${key} event`, res ? JSON.parse(JSON.stringify(res)) : res)
@ -25,30 +54,43 @@ const IM = (account, token) => {
nim.connect() nim.connect()
// 沿用旧版连接状态监听
nim.on('logined', function () { nim.on('logined', function () {
console.log('连接成功') console.log('IM连接成功')
}) })
nim.on('willReconnect', function (e) { nim.on('willReconnect', function (e) {
console.log(e, '即将重连') console.log('IM即将重连', e)
}) })
nim.on('disconnect', function (e) { nim.on('disconnect', function (e) {
console.log(e, '丢失连接') console.log('IM连接断开', e)
}) })
// 保留核心优化会话同步时校验有效会话避免无效ID报错
nim.on('sessions', function(e) { nim.on('sessions', function(e) {
console.log(e, '会话消息') console.log('会话列表同步:', e)
// 如果群是开启了免打扰自动标记未读数已读 const validTeamIds = getValidTeamSessionIds(e)
cleanInvalidTeamStorage(validTeamIds) // 清理无效数据
// 免打扰群标已读(双重校验:解决找不到会话报错)
let mute = wx.getStorageSync('muteNotList') || [] let mute = wx.getStorageSync('muteNotList') || []
if (mute && mute.length > 0) { if (mute && mute.length > 0) {
mute.forEach((j) => { mute.forEach((j) => {
nim.session.resetSessionUnreadCount({ const sessionId = `team-${j.teamId}`
id: `team-${j.teamId}` const session = nim.session.getSession({ id: sessionId })
}) // 只对“存在且有效”的会话操作,无效会话直接跳过
if (session && validTeamIds.includes(sessionId)) {
try {
nim.session.resetSessionUnreadCount({ id: sessionId })
} catch (err) {
console.log(`重置会话${sessionId}未读失败:`, err)
}
}
}) })
} }
// 获取群消息未读数并赋值在tabBar显示
// 沿用旧版未读数统计和TabBar更新逻辑
let teamsSsions = [] let teamsSsions = []
e.forEach((i) => { e.forEach((i) => {
if (i.scene === 'team') { if (i.scene === 'team') {
@ -56,6 +98,7 @@ const IM = (account, token) => {
} }
}) })
wx.setStorageSync('teamsSessionsCount', teamsSsions) wx.setStorageSync('teamsSessionsCount', teamsSsions)
let groupCount = 0 let groupCount = 0
if (teamsSsions.length > 0) { if (teamsSsions.length > 0) {
for (let i = 0; i < teamsSsions.length; i++) { for (let i = 0; i < teamsSsions.length; i++) {
@ -74,8 +117,9 @@ const IM = (account, token) => {
} }
}) })
// 完全沿用旧版消息处理逻辑:不新增@提醒、撤回等功能
nim.on('msg', function (e) { nim.on('msg', function (e) {
console.log(e, '收到新消息') console.log('收到新消息', e)
let pages = getCurrentPages() let pages = getCurrentPages()
let currentPage = pages[pages.length - 1] let currentPage = pages[pages.length - 1]
let notiTypeData = { muteTeam: false } let notiTypeData = { muteTeam: false }
@ -155,6 +199,9 @@ const IM = (account, token) => {
index: 2 index: 2
}) })
} }
},
fail: (err) => {
console.log('获取系统通知未读失败:', err)
} }
}) })
setTimeout(() => { setTimeout(() => {
@ -169,6 +216,7 @@ const IM = (account, token) => {
}, 800) }, 800)
}) })
// 完全沿用旧版免打扰列表处理逻辑
nim.on('myTeamMembers', function (e) { nim.on('myTeamMembers', function (e) {
let pages = getCurrentPages() let pages = getCurrentPages()
let currentPage = pages[pages.length - 1] let currentPage = pages[pages.length - 1]
@ -188,12 +236,14 @@ const IM = (account, token) => {
}) })
} }
}) })
// 沿用旧版setTimeout如果之前稳定保留避免改动
setTimeout(() => { setTimeout(() => {
console.log(muteNotList, '99399') console.log(muteNotList, '99399')
wx.setStorageSync('muteNotList', muteNotList) wx.setStorageSync('muteNotList', muteNotList)
}) })
} }
}) })
return nim return nim
} }