main.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. //自定义get的loading效果,设置全屏loading
  28. Vue.prototype.Dever.setGetLoading(function(self) {
  29. self.vue.prototype.pageLoading = true;
  30. }, function(self) {
  31. self.vue.prototype.pageLoading = false;
  32. self.btnFinish();
  33. });
  34. //自定义post的loading
  35. Vue.prototype.Dever.setPostLoading(function(self) {
  36. self.btnLoad();
  37. uni.showLoading({title: '加载中', mask: true});
  38. }, function(self) {
  39. self.btnFinish();
  40. uni.hideLoading();
  41. });
  42. //设置switchTab
  43. Vue.prototype.Dever.switchTab = ['index/index'];
  44. //自定义switchTab页面回调,因为switchTab执行后不会自动刷新页面,这里需要做个回调
  45. Vue.prototype.Dever.switchTabCall = {
  46. 'index/index' : function(self, e) {
  47. var page = self.getPage();
  48. if (!page) return;
  49. if ('getInfo' in page) {
  50. page.getInfo();
  51. }
  52. }
  53. };
  54. //载入一些通用的方法
  55. Vue.prototype.Dever.common({
  56. // 载入人工客服
  57. 'callPhone' : function() {
  58. uni.makePhoneCall({
  59. phoneNumber: Vue.prototype.$config.system_phone
  60. });
  61. },
  62. // 跳转到页面
  63. 'location' : function(e) {
  64. Vue.prototype.Dever.viewLocation(e);
  65. },
  66. // 提示
  67. 'alert' : function(e) {
  68. Vue.prototype.Dever.viewAlert(e);
  69. },
  70. })
  71. app.$mount()