12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import App from './App'
-
- // #ifndef VUE3
- import Vue from 'vue'
- import uView from 'uview-ui'
- Vue.use(uView)
- Vue.config.productionTip = false
- App.mpType = 'app'
-
-
- import tabBar from './components/tabbar/index.vue'
- Vue.component('tab-bar', tabBar)
-
- import request from'./utils/request.js'
-
- Vue.prototype.$request = request
- // 封装全局登录函数
- // backpage, backtype 2个参数分别代表:
- // backpage : 登录后返回的页面
- // backtype : 打开页面的类型[1 : redirectTo 2 : switchTab]
- Vue.prototype.checkLogin = function(backpage, backtype) {
- // 同步获取本地数据(uid、随机码、用户名、头像)
- var user_id = uni.getStorageSync('user_id');
- var user_nu = uni.getStorageSync('user_nu');
- var user_nm = uni.getStorageSync('user_nm');
- var user_fa = uni.getStorageSync('user_fa');
- if (user_id == '' || user_nu == '' || user_fa == '') {
- // 使用重定向的方式跳转至登录页面
- debugger;
- uni.redirectTo({
- url: '../login/login?backpage=' + backpage + '&backtype=' + backtype
- });
- return false;
- }
- // 登录成功、已经登录返回数组 [用户 id, 用户随机码, 用户昵称, 用户表情]
- return [user_id, user_nu, user_nm, user_fa];
- }
-
- Vue.mixin({
- data(){
- return {
- $theme:'#F34B16'
- }
- }
- })
- // 定义一个全局的请求地址
- Vue.prototype.apiServer = 'http://dianping.vtor.xyz/'
- // Vue.prototype.apiServer = 'http://192.168.1.50:8066/'
-
- // uni.addInterceptor('request', {
- // invoke(arg:WechatMiniprogram.RequestOption) {
- // // 对请求头处理事情
- // arg.header = {
- // ...arg.header,
- // Authorization: 'xxx'
- // }
- // return arg
- // },
- // success(args) {
- // debugger;
- // console.log('interceptor-complete', res)
- // // 请求成功后,修改code值为1
- // args.data.code = 1
- // },
- // fail(err) {
- // console.log('interceptor-fail', err)
- // },
- // complete(res) {
- // console.log('interceptor-complete', res)
- // }
- // })
-
-
-
- const app = new Vue({
- ...App
- })
- app.$mount()
- // #endif
-
- // #ifdef VUE3
- import {
- createSSRApp
- } from 'vue'
- export function createApp() {
- const app = createSSRApp(App)
- return {
- app
- }
- }
- // #endif
|