123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <script>
- import { VerifyAppid } from 'API/cloud'
- import { appVersion } from 'config.js'
- import { mapActions, mapMutations } from 'vuex'
- // import UpdateApp from './utils/updateApp.js'
- export default {
- globalData: {
- // 图片缓存
- imgDict: {},
- // 选项默认选中值桥
- // guid 选项的唯一标识符
- // defaultVal 默认选中的值数组
- // maxlength 最多能选择多少项
- // list 自定义列表数据数组
- // title 标题名
- // config 其他配置信息
- // config.labelField 选项中展示的字段
- // config.valueField 选项值字段
- // config.checkFn 点击确定时的校验方法,必须返回一个Boolean值(暂时在user类型上实现)
- // params 请求附加参数 *list有值时该项不生效
- // request 自定义列表请求 *list有值时该项不生效
- selectedValBridge: {},
- auditInfo: {}, // 审批信息
- // 自定义表单
- // default 表单字段设置默认表单值
- // key-value (eg: { id: [{id: 15, name: '张三' }] } )
- // assignForm 保存表单时默认追加的 key-value (eg: { id: 15 })
- // fields 字段库
- formBridge: {},
- // 自定义筛选项中转
- // choose 已经选择的筛选字段
- // other 未选择的筛选字段
- filterBridge: {},
- // 临时数据缓存,用完即删
- cacheDataBridge: null
- },
- data() {
- return {
- loading: false,
- // isLaunchOk: false
- }
- },
- onLaunch: function() {
- // this.isLaunchOk = true
- // #ifdef APP-PLUS
- // const instance = new UpdateApp()
- // instance.check().then(resData => {
- // if (resData.downloadUrl) {
- // uni.showModal({
- // title: '更新提示',
- // content: resData.remark || '新版本已经准备好,是否更新?',
- // success(res) {
- // if (res.confirm) {
- // // 点击确定,更新
- // console.log('点击确定更新--')
- // instance.install(resData)
- // } else if (res.cancel && resData.force) {
- // // 点击取消
- // plus.runtime.quit()
- // }
- // },
- // fail(e) {
- // if (resData.force) {
- // plus.runtime.quit()
- // }
- // }
- // })
- // }
- // })
- // #endif
- this.initApp()
- },
- onShow: function() {
- console.log('App Show')
- // this.initApp()
- },
- onHide: function() {
- console.log('App Hide')
- },
- methods: {
- ...mapActions({
- setUserData: 'user/setUserData'
- }),
- ...mapMutations({
- SET_TOKEN: 'user/SET_TOKEN'
- }),
- async initApp() {
- if (this.loading) return
- this.loading = true
- const token = uni.getStorageSync('token') || null
- const version = uni.getStorageSync('version') || null
- const appid = uni.getStorageSync('appid') || ''
- // #ifdef MP-WEIXIN
- if (version !== appVersion) {
- // 升级后清空微信缓存,重新登录
- this.$clearStorage()
- this.$Router.reLaunch('/pages/login/index')
- this.loading = false
- return
- }
- // #endif
- this.SET_TOKEN(token)
- if (!token) {
- this.$clearStorage()
- this.$Router.reLaunch('/pages/login/index')
- this.loading = false
- return
- }
- await this.setUserData()
- this.loading = false
- },
- verifyApp(params) {
- }
- }
- }
- </script>
- <style lang="scss">
- @import './static/iconfont/iconfont.css';
- @import './static/iconfont-flutter/iconfont.css';
- /* 每个页面公共css */
- @import './style/reset.scss';
- @import './style/theme.scss';
- @import './style/uni.theme.scss';
- </style>
|