You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.5 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. import Vue from "vue";
  2. import App from "./App.vue";
  3. import router from "./router";
  4. import store from "./store";
  5. import ElementUI from "element-ui";
  6. import "element-ui/lib/theme-chalk/index.css";
  7. import axios from "axios";
  8. import JsonExcel from "vue-json-excel"; //vue全局导入导出excel
  9. import Print from "vue-print-nb";
  10. import Meta from 'vue-meta'
  11. import Contextmenu from 'vue-contextmenujs' //'vue-contextmenu'
  12. Vue.use(Contextmenu);
  13. Vue.use(Meta);
  14. Vue.use(ElementUI);
  15. console.log('vue',Vue.prototype)
  16. Vue.prototype.$axios = axios;
  17. //全局注册外壳的 peisAPI 对象
  18. try {
  19. Vue.prototype.$peisAPI = window.peisAPI;
  20. } catch (error) {
  21. Vue.prototype.$peisAPI = null;
  22. }
  23. Vue.use(Print);
  24. Vue.component("downloadExcel", JsonExcel);
  25. Vue.config.productionTip = false;
  26. // Vue.filter('format', function (date) {
  27. // var json_date = new Date(date).toJSON()
  28. // return new Date(new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/t/g, '').replace(/\.[\d]{3}Z/, '')
  29. // })
  30. Vue.directive('focus', {
  31. // 当被绑定的元素插入到 DOM 中时
  32. inserted: function (el) {
  33. // 聚焦元素
  34. el.focus()
  35. },
  36. update: function (el) {
  37. // 聚焦元素
  38. el.focus()
  39. }
  40. })
  41. Vue.filter("dateFormat", (dataStr) => {
  42. var time = new Date(dataStr);
  43. function timeAdd0(str) {
  44. if (str < 10) {
  45. str = "0" + str;
  46. }
  47. return str;
  48. }
  49. var y = time.getFullYear();
  50. var m = time.getMonth() + 1;
  51. var d = time.getDate();
  52. var h = time.getHours();
  53. var mm = time.getMinutes();
  54. var s = time.getSeconds();
  55. return (
  56. y +
  57. "-" +
  58. timeAdd0(m) +
  59. "-" +
  60. timeAdd0(d) +
  61. " " +
  62. timeAdd0(h) +
  63. ":" +
  64. timeAdd0(mm) +
  65. ":" +
  66. timeAdd0(s)
  67. );
  68. });
  69. new Vue({
  70. router,
  71. store,
  72. metaInfo(){
  73. return {
  74. title: '神豚体检管理系统',
  75. meta: [
  76. {
  77. name:"http-equiv",
  78. content: "Content-Security-Policy", //http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline';">
  79. },{
  80. name:"content",
  81. content: "default-src 'self' 'unsafe-inline';", //指向data的数据
  82. }
  83. ]
  84. }
  85. },
  86. render: (h) => h(App),
  87. }).$mount("#app");
  88. //监听页面大小改变
  89. window.addEventListener('resize', onResize);
  90. function onResize() {
  91. //console.log(document.body.clientHeight,'-document.body.clientHeight-',window.innerHeight)
  92. store.commit('setData', { key: 'window.pageHeight', value: window.innerHeight})
  93. store.commit('setData', { key: 'window.pageWidth', value: window.innerWidth})
  94. }
  95. onResize();