ufutx_love_mp/src/app.wpy
2024-09-26 11:41:20 +08:00

280 lines
6.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style lang="less">
@import './styles/index.less';
@import './colorui/icon.wxss';
@import './colorui/main.wxss';
@import './colorui/animation.wxss';
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
background: red;
}
</style>
<script>
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 {initEid} from './mp_ecard_sdk/main'
// import {service} from './config'
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: {
versions: 'v1.0.84', // 版本号
navBarHeight: 0, // 导航栏高度
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
navTop: 0, // 胶囊距顶部间距
navHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
windowHeight: 0,
userInfo: null,
uploadData: null,
nim: null,
APPID: 'wxe486777f4379507e',
bottomHeight: 0 // 底部小黑条的高度
},
onLaunch() {
let vm = this
vm.appLogin()
initEid()
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
vm.$options.globalData.windowHeight = systemInfo.windowHeight - vm.$options.globalData.navBarHeight
vm.$options.globalData.systemInfo = systemInfo
},
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() {},
methods: {
appLogin() {
let vm = this
wx_login().then((e) => {
wx.hideLoading()
let {accid, token} = e.data.im_user // wyy_user
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
})
}
}
})
})
}
}
})
</script>
<config>
{
pages: [
'pages/tabBar/welcome',
'pages/tabBar/dynamic',
'pages/tabBar/home',
'pages/tabBar/news',
'pages/tabBar/user',
'pages/login',
'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': {
'desc': '你的位置信息将用于小程序位置接口的效果展示'
},
'scope.userLocation': {
'desc': '你的位置信息将用于小程序位置接口的效果展示'
}
},
subPackages: [
{
'root': 'pages/dynamic',
'pages': [
'dynamicDetail',
'hotTopic',
'issue',
'searchPopular',
'searchTopic',
'voteDetail',
]
},
{
'root': 'pages/home',
'pages': [
'information',
'otherHalfDemand',
'qualitySingle',
'registration',
'searchCondition',
'searchUsers',
'singleSquare',
]
},
{
'root': 'pages/news',
'pages': [
'chitchat',
'friendRequest',
'groupChitchat',
'groupChitchatDetail',
'review',
'systemNews',
'visitor',
]
},
{
'root': 'pages/users',
'pages': [
'unmarriV2',
'unmarriV3',
'unmarri',
'myCertification',
'artificial',
'realName',
'selfTextarea',
'setTing',
'aboutLove',
'blacklist',
'logout',
'degreeCertificate',
'schools',
'friendlist',
'report',
'upgradeVIP',
'upgradeVIP2',
'myOrderList',
'orderDetails',
'exclusiveService',
'myDynamic',
'logoutDefault',
'ImageCropper',
]
},
{
'root': 'pages/books',
'pages': [
'bookDetail',
'schoolVerify',
]
},
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
},
tabBar: {
color: '#999999',
selectedColor: '#5AC7A0',
backgroundColor: '#ffffff',
borderStyle: 'black',
list: [
{
pagePath: 'pages/tabBar/home',
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: '发现'
}, {
pagePath: 'pages/tabBar/news',
selectedIconPath: './images/tabbar/messageActive.png',
iconPath: './images/tabbar/message.png',
text: '消息'
}, {
pagePath: 'pages/tabBar/user',
selectedIconPath: './images/tabbar/myActive.png',
iconPath: './images/tabbar/my.png',
text: '我的'
}]
},
useExtendedLib: {
'weui': true
},
plugins: {
"FL-plugin": {
"version": "0.0.3",
"provider": "wxc41491431733671e"
},
},
"miniApp": {
"useAuthorizePage": true
},
"lazyCodeLoading": "requiredComponents",
'requiredPrivateInfos': [
'chooseAddress',
'getFuzzyLocation',
'chooseLocation'
],
}
</config>