<script> import updata from '@/util/updata.js'; //版本更新 import homeservice from '@/service/homeservice.js'; export default { globalData: { typefacedata: [], num: 0 }, onLaunch: function(options) { //console.log(options) console.log('App Launch'); //设备信息 let app = uni.getSystemInfoSync() app.machine_id = options.query.machine_id || 0 app.s = 'DeviceAccess.create' this.$base.appInformation = app this.$base.appInformationOld = JSON.parse(JSON.stringify(app)); //console.log(this.$base.appInformationOld) homeservice.DeviceAccesscreate(app).then(result => { console.log(result) }).catch(err => { console.log(err) }); // 字体列表 homeservice.queryList({ s: 'Material.fontFamilyList' }).then(result => { result.forEach(item => { item.long = false item.textlong = null }) result.unshift({ id: 0, key: "SourceHanSansCN-Normal", remark: "", title: "思源黑体", textlong: true, long: true }) this.globalData.typefacedata = result this.$base.typefacedata = this.globalData.typefacedata let t1 = new Date().getTime(); let that = this this.globalData.typefacedata.forEach(textlist => { uni.loadFontFace({ global: true, family: textlist.key, source: 'url(' + textlist.remark + ')', desc: { weight: 100 }, success: function(success) { textlist.textlong = true // console.log(success) }, fail: function(fail) { textlist.textlong = false // console.log(fail) }, complete(res) { //console.log(res) textlist.long = true that.globalData.typefacedata.forEach(item => { if (item.long == true) { that.globalData.num++ } }) that.$base.typefacedata = that.globalData.typefacedata if (that.globalData.num == that.globalData.typefacedata.length) { //console.log("加载字体耗时 "+ (new Date().getTime() - t1) +" 毫秒") that.$base.typefacedata = that.globalData.typefacedata } that.globalData.num = 0 } }) }) }).catch(err => { }); }, onShow: function() { console.log('App Show'); //调用监听网络状态的方法 wx.getNetworkType({ success: function(res) { if (res.networkType == 'none') { uni.showToast({ title: '网络似乎不太顺畅', icon: 'none', duration: 2000 }); } } }) }, onHide: function() { console.log('App Hide'); } }; </script> <style lang="scss"> page, .page { height: 100%; width: 100%; background-color: #ebeef5; font-size: 28upx; font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif; } // hover-class="loginBtn-hover" .hover-class-bg { background: #888888 !important; } .hover-class-text { color: #888888 !important; } // 单行 // overflow: hidden; /*文本超出隐藏*/ // text-overflow: ellipsis; /*文本超出显示省略号*/ // white-space: nowrap; /*超出的空白区域不换行*/ // word-break:break-all; /*如果文本中有英文,可以使一个单词能够在换行时进行拆分*/ // 多行 // overflow: hidden; /*文本超出隐藏*/ // display:-webkit-box; /*盒子模型微弹性伸缩模型*/ // -webkit-box-orient: vertical;/*伸缩盒子的子元素垂直排列*/ // -webkit-line-clamp: 2; /*文本显示3行*/ </style>