main.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. import Vue from 'vue'
  2. import App from './App'
  3. //store
  4. import store from '@/store';
  5. let vuexStore = require("@/store/$u.mixin.js");
  6. Vue.mixin(vuexStore);
  7. //uView
  8. import uView from "uview-ui";
  9. Vue.use(uView);
  10. import toast from '@/components/toast/toast.vue'
  11. Vue.use(toast)
  12. import loading from '@/components/loading/loading.vue'
  13. Vue.use(loading)
  14. import back from '@/components/back.vue'
  15. Vue.use(back)
  16. //mescroll
  17. import MescrollBody from "@/components/mescroll-body/mescroll-body.vue"
  18. Vue.component('MescrollBody', MescrollBody)
  19. //封装api
  20. import { api } from 'assets/http/api.js'
  21. Vue.prototype.$api = api
  22. //缓存
  23. import simpleCache from "@/utils/cache.js"
  24. Vue.prototype.$cache = simpleCache
  25. //封装日期时间工具类
  26. import dateTime from 'utils/dateTime.js'
  27. Vue.prototype.$dateTime = dateTime
  28. //封装提示工具
  29. import dialog from 'utils/dialog.js'
  30. Vue.prototype.$dialog = dialog
  31. //全局变量
  32. import Global from './utils/global'
  33. Vue.prototype.$global = Global
  34. //数字处理
  35. import digital from './utils/digital.js'
  36. Vue.prototype.$digital = digital
  37. // 全局注入
  38. import Mixin from './utils/mixin'
  39. Vue.mixin(Mixin)
  40. // 微信函数封装
  41. import Mpi from './utils/mpi'
  42. Vue.prototype.$mpi = Mpi
  43. //引入工具类
  44. import util from 'utils/util.js'
  45. Vue.prototype.$util = util
  46. //校验文件
  47. import verify from 'utils/verify.js'
  48. Vue.prototype.$verify = verify
  49. //加密处理
  50. import crypto from './utils/crypto.js'
  51. Vue.prototype.$crypto = crypto
  52. //跳转
  53. Vue.prototype.$jump=function(url){
  54. uni.navigateTo({
  55. url
  56. })
  57. }
  58. Vue.prototype.$back=function(){
  59. uni.navigateBack({
  60. delta:1
  61. })
  62. }
  63. Vue.prototype.$getBankCodeType=function(data){
  64. let bankCodeType=''
  65. switch (data){
  66. case 'DEBIT_CARD':
  67. bankCodeType='借记卡'
  68. break;
  69. case 'CREDIT_CARD':
  70. bankCodeType='贷记卡'
  71. break;
  72. case 'DEBIT_CARD':
  73. bankCodeType='借记卡'
  74. break;
  75. case 'QUASI_CREDIT_CARD':
  76. bankCodeType='准贷卡'
  77. break;
  78. case 'PASSBOOK':
  79. bankCodeType='存折'
  80. break;
  81. case 'UNIT_SETTLE_CARD':
  82. bankCodeType='单位结算卡'
  83. break;
  84. case 'PUBLIC_CARD':
  85. bankCodeType='对公卡'
  86. break;
  87. default:
  88. break;
  89. }
  90. return bankCodeType
  91. }
  92. //判空函数
  93. Vue.prototype.$isEmpty=function(value){
  94. switch (typeof value) {
  95. case 'undefined':
  96. return true;
  97. case 'string':
  98. if(value=='undefined') return true
  99. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  100. break;
  101. case 'boolean':
  102. if (!value) return true;
  103. break;
  104. case 'number':
  105. if (0 === value || isNaN(value)) return true;
  106. break;
  107. case 'object':
  108. if (null === value || value.length === 0) return true;
  109. for (var i in value) {
  110. return false;
  111. }
  112. return true;
  113. }
  114. return false;
  115. }
  116. Vue.prototype.$isNotEmpty=function(value){
  117. switch (typeof value) {
  118. case 'undefined':
  119. return false;
  120. case 'string':
  121. if(value=='undefined') return false
  122. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return false;
  123. break;
  124. case 'boolean':
  125. if (!value) return false;
  126. break;
  127. case 'number':
  128. if (0 === value || isNaN(value)) return false;
  129. break;
  130. case 'object':
  131. if (null === value || value.length === 0) return false;
  132. for (var i in value) {
  133. return true;
  134. }
  135. return false;
  136. }
  137. return true;
  138. }
  139. //消息模板
  140. Vue.prototype.$tmplIds=[
  141. //签约成功通知
  142. // 'nbIQLyWc4TaogP-NFIlpoO66qYyCDVvtjMpalF5S01k',
  143. //认证消息模板
  144. 'yAtQ6AY8zBHDT1PxXHv7x7gS-qiN1DnSedN4MWLbHwk',
  145. //收款消息模板
  146. // '2TcoWv042wo8Bf0SLRkjSLG00JAb9bE-usMy_aAW3Js'
  147. ]
  148. Vue.config.productionTip = false
  149. App.mpType = 'app'
  150. const app = new Vue({
  151. store,
  152. ...App
  153. })
  154. app.$mount()