From ec90cbd7680a6f927cb1cea43f33ab7df6d0864c Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期二, 11 十一月 2025 09:23:22 +0800
Subject: [PATCH] -
---
src/App.vue | 149 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 122 insertions(+), 27 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 886c5fa..fb73310 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,27 +1,122 @@
-<script>
import { http } from '@/uni_modules/uview-plus'
- export default {
- // globalData: {
- // showLoginTip: false,
- // },
- onLaunch: function() {
- this.$store.dispatch('getUserInfo')
-
- console.log('App Launch')
- },
- onShow: async function() {
- console.log('App Show')
- // let res = await http.get('/')
// console.log(res)
- },
- onHide: function() {
- console.log('App Hide')
- }
- }
-</script>
-
-<style lang="scss">
- /*姣忎釜椤甸潰鍏叡css */
- // @import "uview-plus/index.scss";
@import "@/uni_modules/uview-plus/index.scss";
- @import "common/demo.scss";
- @import "@/static/css/comm.scss";
- @import "@/static/css/iconfont.css";
-</style>
+<script>
+ import {
+ http
+ } from '@/uni_modules/uview-plus'
+ export default {
+ // globalData: {
+ // showLoginTip: false,
+ // },
+ onLaunch: function() {
+ // let isjump = this.$db.get('identity')
+ // console.log(isjump,'isjumpisjump');
+ // if (isjump) {
+ // uni.switchTab({
+ // url: '/pages/index/index'
+ // });
+ // }
+
+ let token = this.$db.get('userToken')
+ if (token) {
+ this.$store.dispatch('getUserInfo')
+ }
+ // #ifdef MP-WEIXIN
+ this.autoUpdate();
+ // #endif
+ console.log('App Launch')
+ },
+ onShow: async function() {
+ console.log('App Show')
+ // let res = await http.get('/')
+ // console.log(res)
+ },
+ onHide: function() {
+ console.log('App Hide')
+ },
+ methods: {
+ // #ifdef MP-WEIXIN
+ //寰俊灏忕▼搴忔娴嬫洿鏂版帾鏂斤紝鏂瑰紡鏇存柊鍔熻兘鍚庯紝瑕佺瓑寰�24灏忔椂鍐呮墠鍒锋柊鐨勯棶棰樸��
+ autoUpdate() {
+ var self = this
+ // 鑾峰彇灏忕▼搴忔洿鏂版満鍒跺吋瀹�
+ if (wx.canIUse('getUpdateManager')) {
+ //console.log("杩涘叆灏忕▼搴忚嚜鍔ㄦ洿鏂版娴�");
+ const updateManager = wx.getUpdateManager()
+ //1. 妫�鏌ュ皬绋嬪簭鏄惁鏈夋柊鐗堟湰鍙戝竷
+ updateManager.onCheckForUpdate(function(res) {
+ //console.log("杩涘叆灏忕▼搴忔娴嬫槸鍚﹂渶瑕佽嚜鍔ㄦ洿鏂�");
+ //console.log(res);
+ // 璇锋眰瀹屾柊鐗堟湰淇℃伅鐨勫洖璋�
+ if (res.hasUpdate) {
+ //妫�娴嬪埌鏂扮増鏈紝闇�瑕佹洿鏂帮紝缁欏嚭鎻愮ず
+ wx.showModal({
+ title: '鏇存柊鎻愮ず',
+ content: '妫�娴嬪埌鏂扮増鏈紝鏄惁涓嬭浇鏂扮増鏈苟閲嶅惎灏忕▼搴忥紵',
+ success: function(res) {
+ if (res.confirm) {
+ //2. 鐢ㄦ埛纭畾涓嬭浇鏇存柊灏忕▼搴忥紝灏忕▼搴忎笅杞藉強鏇存柊闈欓粯杩涜
+ self.downLoadAndUpdate(updateManager)
+ } else if (res.cancel) {
+ //鐢ㄦ埛鐐瑰嚮鍙栨秷鎸夐挳锛岄渶瑕佸己鍒舵洿鏂帮紝浜屾寮圭獥
+ wx.showModal({
+ title: '娓╅Θ鎻愮ず~',
+ content: '鏈鐗堟湰鏇存柊娑夊強鍒版柊鐨勫姛鑳芥坊鍔狅紝鏃х増鏈棤娉曟甯歌闂殑鍝',
+ showCancel: false,
+ confirmText: "纭畾鏇存柊",
+ success: function(res) {
+ if (res.confirm) {
+ //涓嬭浇鏂扮増鏈紝骞堕噸鏂板簲鐢�
+ self.downLoadAndUpdate(updateManager)
+ }
+ }
+ })
+ }
+ }
+ })
+ }
+ })
+ } else {
+ // 濡傛灉甯屾湜鐢ㄦ埛鍦ㄦ渶鏂扮増鏈殑瀹㈡埛绔笂浣撻獙鎮ㄧ殑灏忕▼搴忥紝鍙互杩欐牱瀛愭彁绀�
+ wx.showModal({
+ title: '鎻愮ず',
+ content: '褰撳墠寰俊鐗堟湰杩囦綆锛屾棤娉曚娇鐢ㄨ鍔熻兘锛岃鍗囩骇鍒版渶鏂板井淇$増鏈悗閲嶈瘯銆�'
+ })
+ }
+ },
+ downLoadAndUpdate(updateManager) {
+ var self = this
+ wx.showLoading();
+ //闈欓粯涓嬭浇鏇存柊灏忕▼搴忔柊鐗堟湰
+ updateManager.onUpdateReady(function() {
+ wx.hideLoading()
+ //鏂扮殑鐗堟湰宸茬粡涓嬭浇濂斤紝璋冪敤 applyUpdate 搴旂敤鏂扮増鏈苟閲嶅惎
+ updateManager.applyUpdate()
+ })
+ updateManager.onUpdateFailed(function() {
+ // 鏂扮殑鐗堟湰涓嬭浇澶辫触
+ wx.showModal({
+ title: '宸茬粡鏈夋柊鐗堟湰浜嗗摕~',
+ content: '鏂扮増鏈凡缁忎笂绾垮暒~锛岃鎮ㄥ垹闄ゅ綋鍓嶅皬绋嬪簭锛岄噸鏂版悳绱㈡墦寮�鍝焴',
+ })
+ })
+ },
+ // #endif
+ }
+ }
+</script>
+
+<style lang="scss">
+ // page{
+ // height: 100vh
+ // }
+ // .page {
+ // display: flex;
+ // flex-direction: column;
+ // overflow-x: hidden;
+ // }
+ /*姣忎釜椤甸潰鍏叡css */
+ // @import "uview-plus/index.scss";
+ @import "common/demo.scss";
+ @import "@/static/css/comm.scss";
+ @import "@/static/css/iconfont.css";
+ @import "@/uni_modules/uview-plus/index.scss";
+</style>
\ No newline at end of file
--
Gitblit v1.9.1