123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <script>
- export default {
- onLaunch: function() {
- const that = this;
- that.forceUpdate();
- },
- onShow: function() {
- const that = this;
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods: {
- // 强制更新
- forceUpdate() {
- const that = this;
- let system = uni.getSystemInfoSync();
- if (system.uniPlatform == 'mp-weixin') {
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function(res) {
- // 请求完新版本信息的回调
- console.log(res.hasUpdate);
- });
- updateManager.onUpdateReady(function(res) {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- if (res.confirm) {
- uni.clearStorage();
- updateManager.applyUpdate();
- }
- }
- });
- });
- updateManager.onUpdateFailed(function(res) {
- console.log(res);
- console.log('更新失败');
- });
- }
- }
- }
- }
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import '@/uni_modules/uni-scss/index.scss';
- @import './static/iconfont-weapp/iconfont-weapp-icon.css';
- /* 公用 */
- .container {
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
- width: 100vw;
- height: 100vh;
- }
- .textOne {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- -o-text-overflow: ellipsis;
- }
- .textOver {
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- // 弹框公共样式
- .uni-dialog-content {
- padding: 2vw !important;
- max-height: 40vh;
- overflow-y: auto;
- align-items: normal !important;
- box-sizing: border-box;
- }
- /* 设置整个项目的公用样式*/
- page {
- // font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
- /* 窗口可用高度 */
- /* 有头有底 */
- --oneHeight: 100vh;
- /* 有头无底 */
- --twoHeight: 92vh;
- /* 可用窗口背景颜色 */
- --mainColor: #ffffff;
- /* 底部菜单背景颜色 */
- --footColor: #f1f1f1;
- /* 字体大小 */
- --font20Size: 20px;
- --font19Size: 19px;
- --font18Size: 18px;
- --font17Size: 17px;
- --font16Size: 16px;
- --font15Size: 15px;
- --font14Size: 14px;
- --font13Size: 13px;
- --font12Size: 12px;
- /* 颜色 */
- --f1Color: #f1f1f1;
- --f2Color: #f2f2f2;
- --f3Color: #f3f3f3;
- --f4Color: #f4f4f4;
- --f5Color: #f5f5f5;
- --f6Color: #f6f6f6;
- --f7Color: #f7f7f7;
- --f8Color: #f8f8f8;
- --f9Color: #f9f9f9;
- --f99Color: #999999;
- --f85Color: #858585;
- --f69Color: #696969;
- --f80Color: #808080;
- --f33Color: #333333;
- --fFB1Color: #7A7E83;
- --fDCColor: #DCDCDC;
- --fcColor: #cccccc;
- --f00Color: #000000;
- --fffColor: #ffffff;
- --f3CColor: #007AFF;
- --fF0Color: #FF0000;
- --f08Color: #008000;
- --f35BColor: #35BD7B;
- --f191Color: #191970;
- }
- </style>
|