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

181 lines
3.7 KiB

<script>
import $api from "@/api/index.js"
import $store from "@/store/index.js"
export default {
data(){
return{
timer:null
}
},
async mounted() {
// this.onlineStatus()
// this.timer = setInterval(()=>{
// this.onlineStatus()
// },300000)
// #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("#", "?#");
}
// #endif
console.log('App mounted')
},
async onLaunch() {
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() {
console.log('App Show');
// this.timer = setInterval(()=>{
// // this.onlineStatus()
// console.log("666",uni.getStorageSync('configInfo'))
// },1000)
// this.$store.user.dispatch.
// this.userInfo = uni.getStorageSync('userInfo');
console.log("666",this.$store.state.user.userInfo)
},
// watch:{
// '$store.state.user.userInfo':{
// deep:true,
// immediate:true,
// handler:function(newV){
// console.log("==32323==",newV)
// // this.timer = setInterval(()=>{
// // // this.onlineStatus()
// // console.log("666",newV)
// // },1000)
// }
// }
// },
onHide() {
console.log('App Hide')
clearInterval(this.timer);
this.timer = null;
},
methods: {
async getBaseConfig() {
let config = await $api.base.getConfig();
console.log(config,"zazaza")
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
})
},
async onlineStatus(){
let res = await this.$api.mine.onlineStatus()
console.log(res,"pppp")
}
}
}
</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>