main.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. import App from './App';
  2. import Vue from 'vue';
  3. import VHtmlPlugin from '@megalo/vhtml-plugin';
  4. import Vuex from 'vuex';
  5. import http from './plugins/http';
  6. import Dialog from './native/vant/dialog/dialog';
  7. import vuexI18n from 'vuex-i18n';
  8. import en from './locales/en.json';
  9. import zh from './locales/zh.json';
  10. import commont from './mixins/commont';
  11. require('dayjs/locale/zh-cn');
  12. Vue.mixin(commont);
  13. Vue.prototype.$colors = {
  14. prim: '#0F264D',
  15. warn: '#FFA526',
  16. info: '#BCC1CC',
  17. text: '#292C33',
  18. bg: '#f5f7fa'
  19. };
  20. Vue.prototype.$oss = {
  21. logo1: '?x-oss-process=image/resize,m_fill,h_280,w_120',
  22. normal: '?x-oss-process=image/resize,m_fill,h_500,w_500',
  23. mini: '?x-oss-process=image/resize,m_fill,h_300,w_300',
  24. big: '?x-oss-process=image/resize,m_fill,h_1080,w_1080',
  25. hotPro: '?x-oss-process=image/resize,m_fill,h_998,w_490'
  26. };
  27. Vue.use(Vuex);
  28. const store = require('./store').default;
  29. Vue.use(vuexI18n.plugin, store);
  30. Vue.use(VHtmlPlugin);
  31. Vue.use(http);
  32. Vue.i18n.add('en', en);
  33. Vue.i18n.add('zh', zh);
  34. Vue.i18n.set('zh');
  35. Vue.prototype.$store = store;
  36. Vue.prototype.$toast = function(title, icon) {
  37. if (!icon) {
  38. icon = 'none';
  39. }
  40. wx.showToast({
  41. icon: icon,
  42. title: title
  43. });
  44. };
  45. function $loading(title) {
  46. wx.showLoading({
  47. mask: true,
  48. title: title || ''
  49. });
  50. }
  51. $loading.close = function() {
  52. wx.hideLoading();
  53. };
  54. Vue.prototype.$loading = $loading;
  55. const app = new Vue(App);
  56. app.$mount();
  57. export default {
  58. config: {
  59. // pages 的首个页面会被编译成首页
  60. pages: ['pages/Home', 'pages/Chat', 'pages/Classify', 'pages/My'],
  61. subPackages: [
  62. {
  63. root: 'pagesHome',
  64. pages: [
  65. 'Product',
  66. 'Brand',
  67. 'InformationList',
  68. 'VendorList',
  69. 'ProductList',
  70. 'Authorized',
  71. 'FilterPage',
  72. 'Edit',
  73. 'Search',
  74. 'SearchList',
  75. 'ShowView'
  76. ]
  77. },
  78. {
  79. root: 'pagesImt',
  80. pages: ['Index', 'ServiceDetail']
  81. },
  82. {
  83. root: 'pagesChat',
  84. pages: ['ChatDetail', 'ChatForm']
  85. },
  86. {
  87. root: 'pagesMine',
  88. pages: [
  89. 'Upload',
  90. 'Collect',
  91. 'ReadRecords',
  92. 'Activity',
  93. 'Order',
  94. 'OrderDetail',
  95. 'Account',
  96. 'ChangePsd',
  97. 'ChangePhone',
  98. 'ChangeEmail',
  99. 'Enter'
  100. ]
  101. },
  102. {
  103. root: 'pagesProduct',
  104. pages: [
  105. 'Detail',
  106. 'Contrast',
  107. 'FilterVendor',
  108. 'FilterProduct',
  109. 'ContrastDetail',
  110. 'IntentionList',
  111. 'Inquiry',
  112. 'InquiryResult'
  113. ]
  114. },
  115. {
  116. root: 'pagesNews',
  117. pages: ['Detail', 'News', 'Submit']
  118. },
  119. {
  120. root: 'pagesVendor',
  121. pages: ['Detail', 'Connect', 'FilterProduct', 'Case', 'ProductList']
  122. }
  123. ],
  124. tabBar: {
  125. color: '#878D99',
  126. selectedColor: '#0F264D',
  127. borderStyle: 'white',
  128. list: [
  129. {
  130. pagePath: 'pages/Home',
  131. text: '首页',
  132. iconPath: 'native/tabbar/tabbar_icon_01.png',
  133. selectedIconPath: 'native/tabbar/tabbar_icon_01_pre.png'
  134. },
  135. {
  136. pagePath: 'pages/Classify',
  137. text: '类别',
  138. iconPath: 'native/tabbar/tabbar_icon_02.png',
  139. selectedIconPath: 'native/tabbar/tabbar_icon_02_pre.png'
  140. },
  141. {
  142. pagePath: 'pages/Chat',
  143. text: '咨询',
  144. iconPath: 'native/tabbar/tabbar_icon_03.png',
  145. selectedIconPath: 'native/tabbar/tabbar_icon_03_pre.png'
  146. },
  147. {
  148. pagePath: 'pages/My',
  149. text: '我的',
  150. iconPath: 'native/tabbar/tabbar_icon_04.png',
  151. selectedIconPath: 'native/tabbar/tabbar_icon_04_pre.png'
  152. }
  153. ]
  154. },
  155. window: {
  156. backgroundTextStyle: 'dark',
  157. navigationBarBackgroundColor: '#fff',
  158. navigationBarTitleText: 'imt',
  159. navigationBarTextStyle: 'black'
  160. },
  161. usingComponents: {
  162. robot: '/native/robot/index',
  163. 'van-button': '/native/vant/button/index',
  164. 'van-tabs': '/native/vant/tabs/index',
  165. 'van-tab': '/native/vant/tab/index',
  166. 'van-notice-bar': '/native/vant/notice-bar/index',
  167. 'van-icon': '/native/vant/icon/index',
  168. 'van-image': '/native/vant/image/index',
  169. 'van-grid': '/native/vant/grid/index',
  170. 'van-grid-item': '/native/vant/grid-item/index',
  171. 'van-dialog': '/native/vant/dialog/index',
  172. 'van-search': '/native/vant/search/index',
  173. 'van-empty': '/native/vant/empty/index',
  174. 'van-sticky': '/native/vant/sticky/index',
  175. 'van-loading': '/native/vant/loading/index',
  176. 'van-action-sheet': '/native/vant/action-sheet/index',
  177. 'van-picker': '/native/vant/picker/index',
  178. 'van-cell-group': '/native/vant/cell-group/index',
  179. 'van-cell': '/native/vant/cell/index',
  180. 'van-radio-group': '/native/vant/radio-group/index',
  181. 'van-radio': '/native/vant/radio/index',
  182. 'van-field': '/native/vant/field/index',
  183. 'van-uploader': '/native/vant/uploader/index',
  184. 'van-checkbox': '/native/vant/checkbox/index',
  185. 'van-panel': '/native/vant/panel/index',
  186. 'van-overlay': '/native/vant/overlay/index',
  187. 'van-stepper': '/native/vant/stepper/index',
  188. 'van-steps': '/native/vant/steps/index',
  189. 'van-rate': '/native/vant/rate/index',
  190. 'van-popup': '/native/vant/popup/index',
  191. 'van-transition': '/native/vant/transition/index',
  192. 'van-dropdown-menu': '/native/vant/dropdown-menu/index',
  193. 'van-dropdown-item': '/native/vant/dropdown-item/index',
  194. 'van-nav-bar': '/native/vant/nav-bar/index',
  195. 'van-tag': '/native/vant/tag/index',
  196. 'van-divider': '/native/vant/divider/index'
  197. }
  198. }
  199. };