You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xxdj1/App.vue

158 lines
3.0 KiB

2 years ago
<script>
import $api from "@/api/index.js"
import $store from "@/store/index.js"
export default {
2 years ago
data(){
return{
timer:null
}
},
2 years ago
async mounted() {
1 year ago
// this.onlineStatus()
// this.timer = setInterval(()=>{
// this.onlineStatus()
// },300000)
2 years ago
// #ifdef H5
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
window.entryUrl = window.location.href.split('#')[0]
}
if (window.location.href.indexOf('?#') < 0) {
window.location.href = window.location.href.replace("#", "?#");
}
2 years ago
2 years ago
// #endif
console.log('App mounted')
2 years ago
2 years ago
},
async onLaunch() {
2 years ago
2 years ago
let configInfo = uni.getStorageSync('configInfo') || ''
if (configInfo) {
$store.commit('updateConfigItem', {
key: 'configInfo',
val: configInfo
})
}
let arr = ['autograph', 'userInfo', 'location', 'appLogin']
arr.map(key => {
let val = uni.getStorageSync(key) || ''
if (val) {
$store.commit('updateUserItem', {
key,
val
})
}
})
let commonOptions = $store.state.user.commonOptions
let {
channel_id = 0
} = commonOptions
if (channel_id) {
commonOptions.channel_id = 0
$store.commit('updateUserItem', {
key: 'commonOptions',
val: commonOptions
})
}
let {
primaryColor = ''
} = $store.state.config.configInfo
if (primaryColor) return
await this.getBaseConfig()
},
async onShow() {
2 years ago
2 years ago
console.log('App Show')
},
onHide() {
console.log('App Hide')
},
methods: {
async getBaseConfig() {
let config = await $api.base.getConfig()
if (!config.primaryColor) {
config.primaryColor = '#A40035'
}
if (!config.subColor) {
config.subColor = '#F1C06B'
}
let configInfo = Object.assign($store.state.config.configInfo, config)
$store.commit('updateConfigItem', {
key: 'configInfo',
val: configInfo
})
2 years ago
},
async onlineStatus(){
console.log("uuuu")
let res = await this.$api.mine.onlineStatus()
console.log(res,"pppp")
2 years ago
}
}
}
</script>
<style lang="scss">
@import "@/uni_modules/uview-ui/index.scss";
@import "/styles/index.wxss";
/* #ifdef H5 */
uni-page-head {
display: none;
}
/* #endif */
page {
font-size: 28rpx;
color: #222;
line-height: 1.5;
background: #F6F6F6;
font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif;
}
input {
// font-family: PingFangSC-Medium, PingFang SC, -apple-system-font, Helvetica Neue, Helvetica, sans-serif;
}
input::-webkit-input-placeholder {
/* WebKit browsers */
color: #A9A9A9;
}
input:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: #A9A9A9;
}
input::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #A9A9A9;
}
input:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: #A9A9A9;
}
view {
box-sizing: border-box;
}
image {
display: block;
}
/*隐藏滚动条*/
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
/* #ifdef MP-BAIDU */
.swan-button.swan-button-radius-ios {
border-radius: 0;
}
/* #endif */
</style>