| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <script>
- import { ref, getCurrentInstance } from 'vue'
- export default {
- onLaunch: function () {
- if (process.env.NODE_ENV === 'development') {
- } else {
- const { $Http } = getCurrentInstance().proxy;
- if (uni.getStorageSync('userMsg').token) {
- $Http.basic({
- "classname": "webmanage.site.site",
- "method": "querySite_Parameter", //查询站点数据
- content: {
- nocache: true
- }
- }).then(res => {
- if (res.code == 1) {
- uni.removeStorageSync('siteP');
- uni.setStorageSync("siteP", res.data)
- try {
- let currentPages = getCurrentPages().pop();
- if (currentPages.route == 'pages/login/login' || currentPages.$page.fullPath == "/pages/login/login") uni.redirectTo({
- url: '/pages/index/index',
- });
- } catch (error) {
- uni.redirectTo({
- url: '/pages/index/index',
- });
- }
- }
- })
- }
- }
- },
- onShow: function () {
- try {
- const { $Http } = getCurrentInstance().proxy;
- $Http.uploadNumber && $Http.uploadNumber();
- } catch (error) {
- }
- try {
- const updateManager = uni.getUpdateManager()
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- console.log("是否有新版本", res.hasUpdate)
- })
- updateManager.onUpdateReady(function () {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
- updateManager.onUpdateFailed(function () {
- // 新版本下载失败
- })
- } catch (error) {
- }
- },
- onHide: function () {
- }
- }
- </script>
- <style lang="scss">
- /* 注意要写在第一行,注意不能引入至uni.scss,同时给style标签加入lang="scss"属性 */
- @import "@/uni_modules/uview-plus/index.scss";
- @import '/static/iconfont.css';
- page {
- background-color: #F7F7FF;
- }
- </style>
|