303 lines
7.3 KiB
Plaintext
303 lines
7.3 KiB
Plaintext
<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: #f8f8f8;
|
||
}
|
||
</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: 'v5.5.99', // 版本号
|
||
navBarHeight: 0, // 导航栏高度
|
||
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
|
||
navTop: 0, // 胶囊距顶部间距
|
||
navHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
|
||
windowHeight: 0,
|
||
userInfo: null,
|
||
uploadData: null,
|
||
nim: null,
|
||
APPID: 'wxe486777f4379507e',
|
||
bottomHeight: 0 // 底部小黑条的高度
|
||
},
|
||
|
||
onLaunch(e) {
|
||
let vm = this
|
||
console.log(e, 'uuu=')
|
||
vm.appLogin()
|
||
console.log(e, 'e=')
|
||
console.log(decodeURIComponent(e.query.scene), 'e=')
|
||
// if (e.path === 'pages/home/informationV2') {
|
||
// wx.redirectTo({ url: `/pages/home/information?${decodeURIComponent(e.query.scene)}` })
|
||
// }
|
||
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.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)}` })
|
||
}
|
||
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')
|
||
}
|
||
}
|
||
},
|
||
onPageNotFound(res) {
|
||
console.log(res, '错误res')
|
||
wx.switchTab({
|
||
url: '/pages/tabBar/home'
|
||
}) // 如果是 tabbar 页面,请使用 wx.switchTab
|
||
},
|
||
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',
|
||
'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',
|
||
'personalDynamic',
|
||
'qualitySingle',
|
||
'registration',
|
||
'searchCondition',
|
||
'searchUsers',
|
||
'singleSquare',
|
||
]
|
||
},
|
||
{
|
||
'root': 'pages/news',
|
||
'pages': [
|
||
'chitchat',
|
||
'editGroupMembers',
|
||
'friendRequest',
|
||
'groupChitchat',
|
||
'groupChitchatDetail',
|
||
'newsSearch',
|
||
'review',
|
||
'systemNews',
|
||
'visitor',
|
||
'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',
|
||
]
|
||
},
|
||
],
|
||
window: {
|
||
backgroundTextStyle: 'light',
|
||
navigationBarBackgroundColor: '#fff',
|
||
navigationBarTitleText: 'WeChat',
|
||
navigationBarTextStyle: 'black'
|
||
},
|
||
tabBar: {
|
||
color: '#999999',
|
||
selectedColor: '#333333',
|
||
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>
|