main.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*** mc 系列之 mjs
  2. * 对接宜搭公共JavaScript库
  3. * 公共库地址:https://mc.cloudpure.cn/mjs/mjs.min.js
  4. * 本地库地址: http://127.0.0.1:7001/dist/mjs.js
  5. ***/
  6. import { loadVConsole } from "./config/vConsole" /** @远程调试工具 */
  7. import auth from "./auth/copyright";
  8. import com from "./aliwork/com";
  9. import dom from "./aliwork/dom";
  10. import bus from "./aliwork/bus";
  11. import optimize from "./utils/optimize";
  12. import storage from "./utils/storage";
  13. import date from "./vendor/date";
  14. import math from "./utils/math"
  15. import conf from "./config/conf"; /** @全局公共配置 */
  16. import xhr from "./service/request"; /** @前端网络对象 */
  17. import dp from "./aliwork/dp"; /** @宜搭前端查询 */
  18. import { crossDomainByScript } from "./service/vendor"; /** @前端网络三方 */
  19. import ding from "./vendor/dingApi"; /** @钉钉API */
  20. import cp from "./sample/cloudpure"
  21. import guyuan from "./sample/guyuan"
  22. import hangshi from "./sample/hangshi"
  23. export async function init (_this, config = {}) {
  24. console.log(this)
  25. this.$this = _this // this全局化
  26. this.env = com.checkEnv(); // 环境: 0提交(其它),1查看,2编辑(审批)
  27. loadVConsole(config.vconsole)
  28. this.auth = auth; // 授权
  29. this.dom = dom; // 样式
  30. this.com = com; // 通用
  31. this.bus = bus; // 事件
  32. this.conf = conf; // 配置
  33. this.optimize = optimize; // 优化
  34. this.storage = storage; // 存储
  35. this.date = date; // 日期
  36. this.math = math; // 数字
  37. this.request = { dp, xhr, net: { crossDomainByScript } }; // 请求
  38. this.ding = ding;
  39. this.corp = {
  40. cp, guyuan, hangshi
  41. }
  42. // 输出日志;
  43. const msg = `mjs load success. ♨ 访问应用: ${pageConfig.appType} ${pageConfig.appName} ©️ 版权请请联系: https://www.aliwork.com/o/mc`;
  44. console.log(msg, mjs, config);
  45. }