init project
6
.idea/MarsCodeWorkspaceAppSettings.xml
Normal 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>
|
||||
8150
package-lock.json
generated
91
package.json
@ -1,46 +1,107 @@
|
||||
{
|
||||
"name": "ufutx_dma",
|
||||
"name": "ufutx_fulllink",
|
||||
"version": "0.0.1",
|
||||
"description": "A WePY project",
|
||||
"description": "ufutx 微信小程序项目(基于wepy 2.x)",
|
||||
"main": "weapp/app.js",
|
||||
"scripts": {
|
||||
"start": "npm run dev",
|
||||
"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",
|
||||
"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"
|
||||
},
|
||||
"wepy": {
|
||||
"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>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@wepy/core": "^2.0.0-alpha.16",
|
||||
"@wepy/core": "^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",
|
||||
"dayjs": "^1.11.7",
|
||||
"dayjs": "^1.11.10",
|
||||
"miniprogram-slide-view": "0.0.3",
|
||||
"nim-web-sdk-ng": "^10.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@babel/core": "^7.23.0",
|
||||
"@babel/preset-env": "^7.23.0",
|
||||
"@wepy/babel-plugin-import-regenerator": "0.0.2",
|
||||
"@wepy/cli": "^2.0.0-alpha.28",
|
||||
"@wepy/compiler-babel": "^2.0.1",
|
||||
"@wepy/compiler-less": "^2.0.1",
|
||||
"babel-eslint": "^7.2.1",
|
||||
"cross-env": "^5.1.3",
|
||||
"@wepy/cli": "^2.1.0",
|
||||
"@wepy/compiler-babel": "^2.1.0",
|
||||
"@wepy/compiler-less": "^2.1.0",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^3.18.0",
|
||||
"eslint-config-standard": "^7.1.0",
|
||||
"eslint-friendly-formatter": "^2.0.7",
|
||||
"eslint-plugin-html": "^2.0.1",
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"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-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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
20
src/app.wpy
@ -35,7 +35,7 @@ wepy.app({
|
||||
}
|
||||
},
|
||||
globalData: {
|
||||
versions: 'v5.5.101', // 版本号
|
||||
versions: 'v5.6.3', // 版本号
|
||||
navBarHeight: 0, // 导航栏高度
|
||||
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
|
||||
navTop: 0, // 胶囊距顶部间距
|
||||
@ -258,29 +258,29 @@ navigationBarTextStyle: 'black'
|
||||
},
|
||||
tabBar: {
|
||||
color: '#999999',
|
||||
selectedColor: '#333333',
|
||||
selectedColor: '#fa4d76',
|
||||
backgroundColor: '#ffffff',
|
||||
borderStyle: 'black',
|
||||
list: [
|
||||
{
|
||||
pagePath: 'pages/tabBar/home',
|
||||
selectedIconPath: './images/tabbar/homeActive.png',
|
||||
iconPath: './images/tabbar/home.png',
|
||||
selectedIconPath: './images/tabBar/tab_recommend_active.png',
|
||||
iconPath: './images/tabBar/tab_recommend_normal.png',
|
||||
text: '推荐'
|
||||
}, {
|
||||
pagePath: 'pages/tabBar/dynamic',
|
||||
selectedIconPath: './images/tabbar/attentionActive.png',
|
||||
iconPath: './images/tabbar/attention.png',
|
||||
selectedIconPath: './images/tabBar/tab_discover_active.png',
|
||||
iconPath: './images/tabBar/tab_discover_normal.png',
|
||||
text: '发现'
|
||||
}, {
|
||||
pagePath: 'pages/tabBar/news',
|
||||
selectedIconPath: './images/tabbar/messageActive.png',
|
||||
iconPath: './images/tabbar/message.png',
|
||||
selectedIconPath: './images/tabBar/tab_message_active.png',
|
||||
iconPath: './images/tabBar/tab_message_normal.png',
|
||||
text: '消息'
|
||||
}, {
|
||||
pagePath: 'pages/tabBar/user',
|
||||
selectedIconPath: './images/tabbar/myActive.png',
|
||||
iconPath: './images/tabbar/my.png',
|
||||
selectedIconPath: './images/tabBar/tab_mine_active.png',
|
||||
iconPath: './images/tabBar/tab_mine_normal.png',
|
||||
text: '我的'
|
||||
}]
|
||||
},
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<view :class="{'~show':modalName == 'unlockModal'}" class="~cu-modal">
|
||||
<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 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>
|
||||
<view class="font_24 color-666" style="padding: 16rpx 0 24rpx 0">
|
||||
</view>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
BIN
src/images/tabBar/tab_discover_active.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/images/tabBar/tab_discover_normal.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/images/tabBar/tab_message_active.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/images/tabBar/tab_message_normal.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/images/tabBar/tab_mine_active.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/images/tabBar/tab_mine_normal.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/images/tabBar/tab_recommend_active.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/images/tabBar/tab_recommend_normal.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
16
src/mixins/aliyun-upload-sdk-1.0.1.min.js
vendored
@ -117,9 +117,6 @@ export default {
|
||||
if (res.confirm) {
|
||||
vm.errorOne = 1
|
||||
wx.hideLoading()
|
||||
// wx.navigateBack({
|
||||
// delta: 1
|
||||
// })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Vuex from '@wepy/x';
|
||||
import Vuex from '@wepy/x'
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
@ -6,23 +6,23 @@ export default new Vuex.Store({
|
||||
},
|
||||
mutations: {
|
||||
increment (state) {
|
||||
state.counter++;
|
||||
state.counter++
|
||||
},
|
||||
decrement (state) {
|
||||
state.counter--;
|
||||
state.counter--
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
increment ({ commit }) {
|
||||
commit('increment');
|
||||
commit('increment')
|
||||
},
|
||||
decrement ({ commit }) {
|
||||
commit('decrement');
|
||||
commit('decrement')
|
||||
},
|
||||
incrementAsync ({ commit }) {
|
||||
setTimeout(() => {
|
||||
commit('increment');
|
||||
}, 1000);
|
||||
commit('increment')
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
@ -2,6 +2,7 @@ import NIM from 'nim-web-sdk-ng/dist/v2/NIM_MINIAPP_SDK'
|
||||
import { service } from '../config.js'
|
||||
|
||||
const IM = (account, token) => {
|
||||
// 沿用旧版稳定配置格式:不使用官网新的分参数配置,避免兼容问题
|
||||
let nim = NIM.getInstance({
|
||||
debugLevel: 'off',
|
||||
appkey: '9bc3ed1f7d8197b6b69f8f5b742824b1',
|
||||
@ -13,10 +14,38 @@ const IM = (account, token) => {
|
||||
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 = [
|
||||
'logined', 'willReconnect', 'disconnect', 'msg', 'syncdone', 'syncRoamingMsgs', 'sessions', 'updateMuteList', 'friends', 'updateSession', 'teams', 'myTeamMembers', 'updateMyMemberInfo', 'sendTeamMsg'
|
||||
]
|
||||
|
||||
// 沿用旧版事件注册方式
|
||||
eventList.forEach((key) => {
|
||||
nim.on(key, (res) => {
|
||||
// console.log(`Receive ${key} event:`, res ? JSON.parse(JSON.stringify(res)) : res)
|
||||
@ -25,30 +54,43 @@ const IM = (account, token) => {
|
||||
|
||||
nim.connect()
|
||||
|
||||
// 沿用旧版连接状态监听
|
||||
nim.on('logined', function () {
|
||||
console.log('连接成功')
|
||||
console.log('IM连接成功')
|
||||
})
|
||||
|
||||
nim.on('willReconnect', function (e) {
|
||||
console.log(e, '即将重连')
|
||||
console.log('IM即将重连:', e)
|
||||
})
|
||||
|
||||
nim.on('disconnect', function (e) {
|
||||
console.log(e, '丢失连接')
|
||||
console.log('IM连接断开:', e)
|
||||
})
|
||||
|
||||
// 保留核心优化:会话同步时校验有效会话,避免无效ID报错
|
||||
nim.on('sessions', function(e) {
|
||||
console.log(e, '会话消息')
|
||||
// 如果群是开启了免打扰自动标记未读数已读
|
||||
console.log('会话列表同步:', e)
|
||||
const validTeamIds = getValidTeamSessionIds(e)
|
||||
cleanInvalidTeamStorage(validTeamIds) // 清理无效数据
|
||||
|
||||
// 免打扰群标已读(双重校验:解决找不到会话报错)
|
||||
let mute = wx.getStorageSync('muteNotList') || []
|
||||
if (mute && mute.length > 0) {
|
||||
mute.forEach((j) => {
|
||||
nim.session.resetSessionUnreadCount({
|
||||
id: `team-${j.teamId}`
|
||||
})
|
||||
const sessionId = `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 = []
|
||||
e.forEach((i) => {
|
||||
if (i.scene === 'team') {
|
||||
@ -56,6 +98,7 @@ const IM = (account, token) => {
|
||||
}
|
||||
})
|
||||
wx.setStorageSync('teamsSessionsCount', teamsSsions)
|
||||
|
||||
let groupCount = 0
|
||||
if (teamsSsions.length > 0) {
|
||||
for (let i = 0; i < teamsSsions.length; i++) {
|
||||
@ -74,8 +117,9 @@ const IM = (account, token) => {
|
||||
}
|
||||
})
|
||||
|
||||
// 完全沿用旧版消息处理逻辑:不新增@提醒、撤回等功能
|
||||
nim.on('msg', function (e) {
|
||||
console.log(e, '收到最新消息')
|
||||
console.log('收到新消息:', e)
|
||||
let pages = getCurrentPages()
|
||||
let currentPage = pages[pages.length - 1]
|
||||
let notiTypeData = { muteTeam: false }
|
||||
@ -155,6 +199,9 @@ const IM = (account, token) => {
|
||||
index: 2
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('获取系统通知未读失败:', err)
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
@ -169,6 +216,7 @@ const IM = (account, token) => {
|
||||
}, 800)
|
||||
})
|
||||
|
||||
// 完全沿用旧版免打扰列表处理逻辑
|
||||
nim.on('myTeamMembers', function (e) {
|
||||
let pages = getCurrentPages()
|
||||
let currentPage = pages[pages.length - 1]
|
||||
@ -188,12 +236,14 @@ const IM = (account, token) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
// 沿用旧版setTimeout(如果之前稳定,保留避免改动)
|
||||
setTimeout(() => {
|
||||
console.log(muteNotList, '99399')
|
||||
wx.setStorageSync('muteNotList', muteNotList)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return nim
|
||||
}
|
||||
|
||||
|
||||