main.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 conf from "./config/conf"; /** @全局公共配置 */
  15. import xhr from "./service/request"; /** @前端网络对象 */
  16. import dp from "./aliwork/dp"; /** @宜搭前端查询 */
  17. import { crossDomainByScript } from "./service/vendor"; /** @前端网络三方 */
  18. import ding from "./vendor/dingApi"; /** @钉钉API */
  19. import cp from "./sample/cloudpure"
  20. import guyuan from "./sample/guyuan"
  21. export async function init (_this, config = {}) {
  22. console.log(this)
  23. this.$this = _this // this全局化
  24. this.env = com.checkEnv(); // 环境: 0提交(其它),1查看,2编辑(审批)
  25. loadVConsole(config.vconsole)
  26. this.auth = auth; // 授权
  27. this.dom = dom; // 样式
  28. this.com = com; // 通用
  29. this.bus = bus; // 事件
  30. this.conf = conf; // 配置
  31. this.optimize = optimize; // 优化
  32. this.storage = storage; // 存储
  33. this.date = date; // 日期
  34. this.request = { dp, xhr, net: { crossDomainByScript } }; // 请求
  35. this.ding = ding;
  36. this.corp = {
  37. cp, guyuan
  38. }
  39. // 输出日志;
  40. const msg = `mjs load success. ♨ 访问应用: ${pageConfig.appType} ${pageConfig.appName} ©️ 版权请请联系: https://www.aliwork.com/o/mc`;
  41. console.log(msg, mjs, config);
  42. }