main.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import Vue from 'vue'
  2. import App from './App'
  3. Vue.config.productionTip = false
  4. App.mpType = 'app'
  5. const app = new Vue({
  6. ...App
  7. })
  8. // 引入文件
  9. import Dever from './lib/dever'
  10. // 绑定全局的组件
  11. import pageLoading from "./lib/pageLoading.vue";
  12. Vue.component('pageLoading', pageLoading);
  13. Vue.prototype.pageLoading = true;
  14. // 绑定到 Vue 的实例上
  15. Vue.prototype.Dever = Dever;
  16. // 载入全局配置 默认配置,防止第一次载入报错的,系统会自动从后台更新最新的配置
  17. var defaultConfig = {
  18. 'system_name' : '幻境合集',
  19. 'system_info' : '互联网赚钱创新模式',
  20. 'system_phone' : '18611795659',
  21. //自动更新时间间隔
  22. 'set_update' : 86400,
  23. //本次更新时间
  24. 'update_time' : false,
  25. };
  26. Vue.prototype.Dever.init('', Vue, defaultConfig);
  27. /*
  28. //自定义get的loading效果,设置全屏loading
  29. Vue.prototype.Dever.setGetLoading(function(self) {
  30. self.vue.prototype.pageLoading = true;
  31. }, function(self) {
  32. self.vue.prototype.pageLoading = false;
  33. self.btnFinish();
  34. });
  35. //自定义post的loading
  36. Vue.prototype.Dever.setPostLoading(function(self) {
  37. self.btnLoad();
  38. uni.showLoading({title: '加载中', mask: true});
  39. }, function(self) {
  40. self.btnFinish();
  41. uni.hideLoading();
  42. });
  43. */
  44. //设置switchTab
  45. Vue.prototype.Dever.switchTab = ['index/index'];
  46. //自定义switchTab页面回调,因为switchTab执行后不会自动刷新页面,这里需要做个回调
  47. Vue.prototype.Dever.switchTabCall = {
  48. 'index/index' : function(self, e) {
  49. var page = self.getPage();
  50. if (!page) return;
  51. if ('getInfo' in page) {
  52. page.getInfo();
  53. }
  54. }
  55. };
  56. //载入一些通用的方法
  57. Vue.prototype.Dever.common({
  58. // 载入人工客服
  59. 'callPhone' : function() {
  60. uni.makePhoneCall({
  61. phoneNumber: Vue.prototype.$config.system_phone
  62. });
  63. },
  64. // 跳转到页面
  65. 'location' : function(e) {
  66. Vue.prototype.Dever.viewLocation(e);
  67. },
  68. // 提示
  69. 'alert' : function(e) {
  70. Vue.prototype.Dever.viewAlert(e);
  71. },
  72. })
  73. app.$mount()