代码拉取完成,页面将自动刷新
<script>
import storage from "@/utils/storage.js"
import { saveProduction } from "@/api/quality.js"
export default {
onLaunch () {
setTimeout(() => {
plus.screen.unlockOrientation() //解除屏幕方向的锁定,但是不一定是竖屏
plus.screen.lockOrientation('landscape-primary') //锁定横屏
// plus.screen.lockOrientation('landscape-secondary')
},500)
plus.navigator.setFullscreen(false); //隐藏状态栏(应用全屏:只能隐藏状态栏,标题栏和虚拟返回键都还可以显示)
// 加载系统信息
this.$store.dispatch('SystemInfo')
let systemInfo = uni.getSystemInfoSync();
this.systemLocale = systemInfo.language;
this.applicationLocale = uni.getStorageSync('lang');
this.isAndroid = systemInfo.platform.toLowerCase() === 'android';
uni.onLocaleChange((e) => {
this.applicationLocale = e.locale;
})
systemInfo.language = this.applicationLocale
this.$store.commit('SET_SYSTEM_INFO',systemInfo)
},
onShow () {
const data = uni.getStorageSync("offlineCaching")
if (Array.isArray(data)) {
uni.setStorageSync("offlineCaching", {})
}
setInterval(() => {
const currentSewingId = storage.get('currentSewingId')
let offlineCaching = uni.getStorageSync('offlineCaching')
const targetList = offlineCaching[currentSewingId] || []
if (!targetList || !targetList.length) return
uni.request({
url: "http://www.baidu.com",
success: () => {
console.log("网络状态正常~~~")
this.isConnected = true
while (targetList && targetList.length) {
const params = targetList.shift()
try {
saveProduction(params, { custom: { loading: false } })
if (!targetList.length) {
offlineCaching[currentSewingId] = []
uni.setStorageSync('offlineCaching', offlineCaching)
console.log("准备commit CHANGE_CACHE_IDX");
this.$store.commit('CHANGE_CACHE_IDX')
}
} catch (err) {
console.log(err);
}
}
},
fail: () => {
console.log("网络状态异常");
this.isConnected = false
}
})
}, 5000)
},
onHide () {
},
}
</script>
<style lang="scss">
@import url("@/static/icons/iconfont-weapp-icon.css");
@import "@/uni_modules/uview-ui/index.scss";
@import "@/static/style.scss";
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。