ufutx_love_mp/src/app.wpy

282 lines
6.5 KiB
Plaintext
Raw Normal View History

2024-08-16 09:14:13 +08:00
<style lang="less">
@import './styles/index.less';
2024-09-21 11:02:39 +08:00
@import './colorui/icon.wxss';
@import './colorui/main.wxss';
@import './colorui/animation.wxss';
2024-08-16 09:14:13 +08:00
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
2024-09-29 16:36:49 +08:00
background: #f8f8f8;
2024-08-16 09:14:13 +08:00
}
</style>
<script>
import wepy from '@wepy/core'
import vuex from '@wepy/x'
import promisify from '@wepy/use-promisify'
2024-09-06 10:09:34 +08:00
import { wx_login } from './utils/util'
import { IM } from './utils/im'
2024-09-21 11:02:39 +08:00
import {initEid} from './mp_ecard_sdk/main'
// import {service} from './config'
2024-08-16 09:14:13 +08:00
wepy.use(promisify)
wepy.use(vuex)
wepy.app({
hooks: {
// App 级别 hook对整个 App 生效
// 同时存在 Page hook 和 App hook 时,优先执行 Page hook返回值再交由 App hook 处
'before-setData': function (dirty) {
// console.log('setData dirty: ', dirty)
return dirty
}
},
globalData: {
2024-10-10 17:10:19 +08:00
versions: 'v5.5.74', // 版本号
2024-08-16 09:14:13 +08:00
navBarHeight: 0, // 导航栏高度
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
navTop: 0, // 胶囊距顶部间距
navHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
2024-09-06 10:09:34 +08:00
windowHeight: 0,
2024-08-16 09:14:13 +08:00
userInfo: null,
uploadData: null,
nim: null,
APPID: 'wxe486777f4379507e',
bottomHeight: 0 // 底部小黑条的高度
},
onLaunch() {
let vm = this
2024-09-06 10:09:34 +08:00
vm.appLogin()
2024-09-21 11:02:39 +08:00
initEid()
2024-08-16 09:14:13 +08:00
wx.getSystemInfo({
success: res => {
vm.$options.globalData.bottomHeight = res.screenHeight - res.safeArea.bottom
vm.$options.globalData.StatusBar = res.statusBarHeight
let capsule = wx.getMenuButtonBoundingClientRect()
if (capsule) {
vm.$options.globalData.Custom = capsule
vm.$options.globalData.CustomBar = capsule.bottom + capsule.top - res.statusBarHeight
} else {
vm.$options.globalData.CustomBar = res.statusBarHeight + 50
}
},
fail(err) {
console.log(err)
}
})
// 获取系统信息
const systemInfo = wx.getSystemInfoSync()
// 胶囊按钮位置信息
const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
// 导航栏高度 = 状态栏高度 + 44
vm.$options.globalData.navBarHeight = systemInfo.statusBarHeight + 44
vm.$options.globalData.navRight = systemInfo.screenWidth - menuButtonInfo.right
vm.$options.globalData.navTop = menuButtonInfo.top
vm.$options.globalData.navHeight = menuButtonInfo.height
2024-09-06 10:09:34 +08:00
vm.$options.globalData.windowHeight = systemInfo.windowHeight - vm.$options.globalData.navBarHeight
2024-09-21 11:02:39 +08:00
vm.$options.globalData.systemInfo = systemInfo
2024-08-16 09:14:13 +08:00
},
onShow(options) {
console.log('路径携带参数:', options)
if (options.query.scene) {
let sceneList = decodeURIComponent(options.query.scene).split(/[= &]/)
sceneList.forEach((item, index) => {
if (item == 'userId') {
wx.setStorageSync('agent_user_id', sceneList[index + 1])
}
})
}
if (options.query && options.query.from_user_id) {
wx.setStorageSync('from_user_id', options.query.from_user_id)
} else {
if (options.path && options.path === 'pages/sub_mall/confirmOrder') {
} else {
wx.removeStorageSync('from_user_id')
}
}
},
onHide() {},
2024-09-06 10:09:34 +08:00
methods: {
appLogin() {
let vm = this
wx_login().then((e) => {
wx.hideLoading()
2024-09-21 11:02:39 +08:00
let {accid, token} = e.data.im_user // wyy_user
2024-09-06 10:09:34 +08:00
vm.$options.globalData.nim = IM(accid, token)
}).catch((msg) => {
wx.showModal({ // 使用模态框提示用户进行操作
title: '温馨提示:',
content: `${msg}`,
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateBack({
delta: 1
})
}
}
})
})
}
}
2024-08-16 09:14:13 +08:00
})
</script>
<config>
{
pages: [
'pages/tabBar/welcome',
2024-09-06 10:09:34 +08:00
'pages/tabBar/dynamic',
2024-08-16 09:14:13 +08:00
'pages/tabBar/home',
'pages/tabBar/news',
'pages/tabBar/user',
'pages/login',
2024-09-21 11:02:39 +08:00
'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'
2024-08-16 09:14:13 +08:00
],
'permission': {
'scope.userFuzzyLocation': {
'desc': '你的位置信息将用于小程序位置接口的效果展示'
},
'scope.userLocation': {
'desc': '你的位置信息将用于小程序位置接口的效果展示'
}
},
subPackages: [
{
2024-09-10 15:16:50 +08:00
'root': 'pages/dynamic',
'pages': [
'dynamicDetail',
'hotTopic',
'issue',
'searchPopular',
'searchTopic',
'voteDetail',
]
},
{
2024-08-16 09:14:13 +08:00
'root': 'pages/home',
'pages': [
'information',
2024-08-16 18:00:23 +08:00
'otherHalfDemand',
2024-10-30 15:43:07 +08:00
'personalDynamic',
2024-08-16 09:14:13 +08:00
'qualitySingle',
'registration',
'searchCondition',
'searchUsers',
'singleSquare',
]
},
{
'root': 'pages/news',
'pages': [
'chitchat',
'friendRequest',
'groupChitchat',
'groupChitchatDetail',
2024-10-08 14:14:52 +08:00
'newsSearch',
2024-08-16 09:14:13 +08:00
'review',
'systemNews',
'visitor',
2024-10-18 09:34:14 +08:00
'visitorNum',
2024-08-16 09:14:13 +08:00
]
},
2024-09-21 11:02:39 +08:00
{
'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',
2024-09-26 11:41:20 +08:00
'ImageCropper',
2024-09-21 11:02:39 +08:00
]
},
{
'root': 'pages/books',
'pages': [
'bookDetail',
'schoolVerify',
]
},
2024-08-16 09:14:13 +08:00
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
},
tabBar: {
color: '#999999',
2024-10-18 09:34:14 +08:00
selectedColor: '#333333',
2024-08-16 09:14:13 +08:00
backgroundColor: '#ffffff',
borderStyle: 'black',
list: [
{
pagePath: 'pages/tabBar/home',
2024-09-06 10:09:34 +08:00
selectedIconPath: './images/tabbar/homeActive.png',
iconPath: './images/tabbar/home.png',
text: '推荐'
}, {
pagePath: 'pages/tabBar/dynamic',
selectedIconPath: './images/tabbar/attentionActive.png',
iconPath: './images/tabbar/attention.png',
text: '发现'
2024-08-16 09:14:13 +08:00
}, {
pagePath: 'pages/tabBar/news',
2024-09-06 10:09:34 +08:00
selectedIconPath: './images/tabbar/messageActive.png',
iconPath: './images/tabbar/message.png',
text: '消息'
2024-08-16 09:14:13 +08:00
}, {
pagePath: 'pages/tabBar/user',
2024-09-06 10:09:34 +08:00
selectedIconPath: './images/tabbar/myActive.png',
iconPath: './images/tabbar/my.png',
2024-08-16 09:14:13 +08:00
text: '我的'
}]
},
useExtendedLib: {
'weui': true
},
plugins: {
"FL-plugin": {
"version": "0.0.3",
"provider": "wxc41491431733671e"
},
},
"miniApp": {
"useAuthorizePage": true
},
"lazyCodeLoading": "requiredComponents",
'requiredPrivateInfos': [
'chooseAddress',
'getFuzzyLocation',
'chooseLocation'
],
}
</config>