| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <script>
- import store from '@/store'
- import StoreModel from '@/common/model/Store'
- import {
- getSceneData
- } from './core/app'
- import {
- isObject
- } from './utils/util'
- import storage from '@/utils/storage'
- export default {
- /**
- * 全局变量
- */
- globalData: {},
- onShow(path) {
- // console.log('app - onShow', path)
- // this.onStartupQuery(path)
- },
- /**
- * 初始化完成时触发
- */
- onLaunch(path) {
- // #ifdef MP
- // console.log('app - onLaunch', path)
- // #endif
- this.onStartupQuery(path)
- // #ifdef APP-PLUS
- this.$navTo('pages/txmLogin/index')
- // #endif
- // // app启动参数
- // this.onStartupQuery(isObject(query) ? query : {})
- },
- methods: {
- // app启动参数
- onStartupQuery(path) {
- console.log(path, 'app启动参数')
- const query = path.query
- // 微信鉴权
- StoreModel.getApiData(query).then((res) => {
- let param = query?.param ? query?.param.split(',') : ['', '']
- if (res.resCode) {
- if (param[1] === 'enterprise') {
- console.log('******************企业注册页面******************')
- } else if (param[1] === 'shopping') {
- if (!storage.get('wx_qym')) {
- this.$navTo('pages/authentication/index')
- return
- }
- console.log('******************商场选购页面******************')
- } else if (param[1] === 'activation') {
- console.log('******************用户激活页面******************')
- } else if (param[1] === 'tiaoxingma') {
- console.log('******************条形码******************')
- }
- if (param[0]) {
- console.log(param[0], 'padding')
- this.$navTo(param[0])
- } else {
- console.log('没有指定路由,跳转默认路由', storage.get('wx_v'))
- switch (storage.get('wx_v')) {
- case 'enterprise':
- if (storage.get('wx_userinfo').customertype == '代理商') {
- this.$navTo('pages/firm/home/index')
- } else {
- // 如果已经是代理商则直接登录
- this.$navTo('pages/firm/index')
- }
- break
- case 'shopping':
- if (!storage.get('wx_qym')) {
- this.$navTo('pages/authentication/index')
- } else {
- this.$navTo('pages/index/index')
- }
- break
- case 'activation':
- this.$navTo('pages/activationcode/index')
- break
- case 'tiaoxingma':
- this.$navTo('pages/tiaoxingma/index')
- break
- default:
- console.log('没有模式路由')
- this.$navTo('pages/empty')
- break
- }
- }
- } else {
- this.$navTo('pages/empty')
- let errMes = res.err || '错误!请退出重新打开'
- uni.showModal({
- title: '提示',
- content: errMes,
- showCancel: false
- })
- }
- // 激活路由器
- // this.$navTo('pages/activationcode/index')
- // 填写二维码
- // this.$navTo('pages/authentication/index')
- //
- // this.$navTo('pages/txmLogin/index')
- // this.$navTo('pages/tiaoxingma/index')
- // this.$navTo('pages/firm/authentication/index')
- // this.$navTo('pages/user/activatorder/index')
- })
- },
- // 小程序主动更新
- updateManager() {
- const updateManager = uni.getUpdateManager()
- updateManager.onCheckForUpdate((res) => {
- // 请求完新版本信息的回调
- // console.log(res.hasUpdate)
- })
- updateManager.onUpdateReady(() => {
- uni.showModal({
- title: '更新提示',
- content: '新版本已经准备好,即将重启应用',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
- updateManager.onUpdateFailed(() => {
- // 新的版本下载失败
- uni.showModal({
- title: '更新提示',
- content: '新版本下载失败',
- showCancel: false
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- /* uView库样式 */
- @import './uni_modules/vk-uview-ui/index.scss';
- /* 项目基础样式 */
- @import './app.scss';
- /* iconfont图标库 */
- @import './utils/iconfont.scss';
- // 基础央视表
- @import './colorui/main.css';
- @import './colorui/icon.css';
- @import './colorui/animation.css';
- @import './colorui/reset.css';
- // gs-logo样式
- .gs-logo-box {
- width: 70rpx;
- height: 70rpx;
- border: 6rpx solid #fff;
- background: #fff;
- border-radius: 100%;
- overflow: hidden;
- }
- </style>
|