@ldesign/desktop-public-next 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/App.js CHANGED
@@ -1 +1,61 @@
1
- import{useConfigStore as n,RouterView as e}from"@ldesign/business-next";import{ConfigProvider as t}from"@ldesign/desktop-next";import{defineComponent as o,inject as r,computed as i,Transition as a,KeepAlive as f}from"vue";var p=o({name:"App",setup:function(){var e=r("$config",{}),t=i((function(){return e.getLeapConfig()})),o=i((function(){return e.getAppConfig()}));return(0,n().$setInfo)("333"),{leapConfig:t,appConfig:o}},render:function(){var n=this,o=arguments[0];return o(t,[o(e,{directives:[{name:"slots",value:{default:function(e){var t=e.Component;return o(a,{attrs:{name:"fade"}},[o(f,[t&&o(t,{attrs:{leapConfig:n.leapConfig,appConfig:n.appConfig}})])])}}}]})])}});export{p as default};
1
+ function __$styleInject(css) {
2
+ if (!css) return;
3
+
4
+ if (typeof window == 'undefined') return;
5
+ var style = document.createElement('style');
6
+ style.setAttribute('media', 'screen');
7
+
8
+ style.innerHTML = css;
9
+ document.head.appendChild(style);
10
+ return css;
11
+ }
12
+
13
+ import { useConfigStore, RouterView } from '@ldesign/business-next';
14
+ import { ConfigProvider } from '@ldesign/desktop-next';
15
+ import { defineComponent, inject, computed, Transition, KeepAlive } from 'vue';
16
+
17
+ var App = defineComponent({
18
+ name: 'App',
19
+ setup: function setup() {
20
+ var $config = inject('$config', {});
21
+ var leapConfig = computed(function () {
22
+ return $config.getLeapConfig();
23
+ });
24
+ var appConfig = computed(function () {
25
+ return $config.getAppConfig();
26
+ });
27
+ var _useConfigStore = useConfigStore(),
28
+ $setInfo = _useConfigStore.$setInfo;
29
+ $setInfo('333');
30
+ return {
31
+ leapConfig: leapConfig,
32
+ appConfig: appConfig
33
+ };
34
+ },
35
+ render: function render() {
36
+ var _this = this;
37
+ var h = arguments[0];
38
+ return h(ConfigProvider, [h(RouterView, {
39
+ "directives": [{
40
+ name: "slots",
41
+ value: {
42
+ default: function _default(_ref) {
43
+ var Component = _ref.Component;
44
+ return h(Transition, {
45
+ "attrs": {
46
+ "name": 'fade'
47
+ }
48
+ }, [h(KeepAlive, [Component && h(Component, {
49
+ "attrs": {
50
+ "leapConfig": _this.leapConfig,
51
+ "appConfig": _this.appConfig
52
+ }
53
+ })])]);
54
+ }
55
+ }
56
+ }]
57
+ })]);
58
+ }
59
+ });
60
+
61
+ export { App as default };
package/es/index.js CHANGED
@@ -1 +1,45 @@
1
- import{createApp as e}from"vue";import n from"@ldesign/desktop-next";import r from"@ldesign/desktop-profession-next";import{LeapRouter as t,LeapApi as o,LeapConfig as i,pinia as p}from"@ldesign/business-next";import s from"./App.js";export{default as Login}from"./public/Login.js";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";function m(m){var u=m.env,d=m.files,a=new t({env:u,files:d}),f=new o({env:u}),l=new i({env:u});return e(s).use(n).use(r).use(p).use(a.router).provide("$api",f).provide("$config",l).provide("$router",a).mount(m.el)}!function(e){if(e&&"undefined"!=typeof window){var n=document.createElement("style");n.setAttribute("media","screen"),n.innerHTML=e,document.head.appendChild(n)}}("html,\nbody {\n height: 100%;\n margin: 0;\n}\n#app {\n height: 100%;\n}\n");export{m as createLeapApp};
1
+ function __$styleInject(css) {
2
+ if (!css) return;
3
+
4
+ if (typeof window == 'undefined') return;
5
+ var style = document.createElement('style');
6
+ style.setAttribute('media', 'screen');
7
+
8
+ style.innerHTML = css;
9
+ document.head.appendChild(style);
10
+ return css;
11
+ }
12
+
13
+ import { createApp } from 'vue';
14
+ import LDesign from '@ldesign/desktop-next';
15
+ import LDesignProfession from '@ldesign/desktop-profession-next';
16
+ import { LeapRouter, LeapApi, LeapConfig, pinia } from '@ldesign/business-next';
17
+ import App from './App.js';
18
+ export { default as Login } from './public/Login.js';
19
+ import '@babel/runtime/helpers/defineProperty';
20
+ import '@babel/runtime/helpers/asyncToGenerator';
21
+ import '@babel/runtime/regenerator';
22
+
23
+ __$styleInject("html,\nbody {\n height: 100%;\n margin: 0;\n}\n#app {\n height: 100%;\n}\n");
24
+
25
+ function createLeapApp(options) {
26
+ var env = options.env,
27
+ files = options.files;
28
+ /** 通用路由配置 */
29
+ var $router = new LeapRouter({
30
+ env: env,
31
+ files: files
32
+ });
33
+ /** 通用api */
34
+ var $api = new LeapApi({
35
+ env: env
36
+ });
37
+ /** 通用配置 */
38
+ var $config = new LeapConfig({
39
+ env: env
40
+ });
41
+ var app = createApp(App).use(LDesign).use(LDesignProfession).use(pinia).use($router.router).provide('$api', $api).provide('$config', $config).provide('$router', $router).mount(options.el);
42
+ return app;
43
+ }
44
+
45
+ export { createLeapApp };
@@ -1 +1,22 @@
1
- import{defineComponent as r}from"vue";var e=r({name:"Layout",render:function(){return h("div",["Layout"])}});export{e as default};
1
+ function __$styleInject(css) {
2
+ if (!css) return;
3
+
4
+ if (typeof window == 'undefined') return;
5
+ var style = document.createElement('style');
6
+ style.setAttribute('media', 'screen');
7
+
8
+ style.innerHTML = css;
9
+ document.head.appendChild(style);
10
+ return css;
11
+ }
12
+
13
+ import { defineComponent } from 'vue';
14
+
15
+ var Layout = defineComponent({
16
+ name: 'Layout',
17
+ render: function render() {
18
+ return h("div", ["Layout"]);
19
+ }
20
+ });
21
+
22
+ export { Layout as default };
@@ -1 +1,165 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{defineComponent as o,inject as n,computed as a,reactive as s,ref as c,onBeforeMount as i,toRefs as p}from"vue";import{LpLogin as u}from"@ldesign/desktop-profession-next";function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function f(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var m=o({name:"Login",props:{appConfig:{type:Object,default:{}}},setup:function(e){var o=n("$router"),u=n("$api",{}),l=a((function(){return e.appConfig.login_layout})),m=s({password:{name:"",password:"",captcha:"",remember:!1},phone:{name:"",password:"",captcha:"",code:""}}),d=c(""),g=function(){var e=r(t.mark((function e(){return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=void 0,t=void 0,n=void 0,r=m.password,t=r.name,n=r.password,r.remember?u.loginApi.saveUserPasswordLocal(t,n):(localStorage.removeItem("".concat(t,"_pass")),localStorage.removeItem("".concat(t,"_code")),localStorage.removeItem("LOGINUSER")),console.log("登录成功"),null==o||o.router.push({path:"/"});case 3:case"end":return e.stop()}var r,t,n}),e)})));return function(){return e.apply(this,arguments)}}();return i(r(t.mark((function e(){return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.loginApi.getSid();case 2:return e.next=4,r=void 0,t=void 0,r=localStorage.getItem("LOGINUSER"),t=u.loginApi.getSavedPasswordByUser(r),m.password.name=r,m.password.password=t,void(r&&t&&(m.password.remember=!0));case 4:d.value=u.loginApi.getValiCode();case 5:case"end":return e.stop()}var r,t}),e)})))),f(f({},p(e)),{},{form:m,layout:l,captchaUrl:d,handleLogin:function(e,o){return new Promise(function(){var n=r(t.mark((function r(n){var a;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(a=null,"password"!==o){r.next=5;break}return r.next=4,u.loginApi.loginByPassword(e.name,e.password,e.captcha);case 4:a=r.sent;case 5:n(a);case 6:case"end":return r.stop()}}),r)})));return function(e){return n.apply(this,arguments)}}())},handleLoginSuccess:g})},render:function(){return(0,arguments[0])(u,{attrs:{value:this.form,layout:this.layout,captchaUrl:this.captchaUrl},on:{login:this.handleLogin,loginSuccess:this.handleLoginSuccess}})}});export{m as default};
1
+ function __$styleInject(css) {
2
+ if (!css) return;
3
+
4
+ if (typeof window == 'undefined') return;
5
+ var style = document.createElement('style');
6
+ style.setAttribute('media', 'screen');
7
+
8
+ style.innerHTML = css;
9
+ document.head.appendChild(style);
10
+ return css;
11
+ }
12
+
13
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
14
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
15
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
16
+ import { defineComponent, inject, computed, reactive, ref, onBeforeMount, toRefs } from 'vue';
17
+ import { LpLogin } from '@ldesign/desktop-profession-next';
18
+
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+ var Login = defineComponent({
22
+ name: 'Login',
23
+ props: {
24
+ appConfig: {
25
+ type: Object,
26
+ default: {}
27
+ }
28
+ },
29
+ setup: function setup(props) {
30
+ var $router = inject('$router');
31
+ var $api = inject('$api', {});
32
+ /** 登录模板 */
33
+ var layout = computed(function () {
34
+ return props.appConfig.login_layout;
35
+ });
36
+ /** 登录数据 */
37
+ var form = reactive({
38
+ password: {
39
+ name: '',
40
+ password: '',
41
+ captcha: '',
42
+ remember: false
43
+ },
44
+ phone: {
45
+ name: '',
46
+ password: '',
47
+ captcha: '',
48
+ code: ''
49
+ }
50
+ });
51
+ /** 图片验证码地址 */
52
+ var captchaUrl = ref('');
53
+ var handleLogin = function handleLogin(res, type) {
54
+ return new Promise( /*#__PURE__*/function () {
55
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
56
+ var cb;
57
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ cb = null;
61
+ if (!(type === 'password')) {
62
+ _context.next = 5;
63
+ break;
64
+ }
65
+ _context.next = 4;
66
+ return $api.loginApi.loginByPassword(res.name, res.password, res.captcha);
67
+ case 4:
68
+ cb = _context.sent;
69
+ case 5:
70
+ resolve(cb);
71
+ case 6:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }, _callee);
76
+ }));
77
+ return function (_x) {
78
+ return _ref.apply(this, arguments);
79
+ };
80
+ }());
81
+ };
82
+ var rememberPassword = function rememberPassword() {
83
+ var _form$password = form.password,
84
+ name = _form$password.name,
85
+ password = _form$password.password,
86
+ remember = _form$password.remember;
87
+ if (!remember) {
88
+ localStorage.removeItem("".concat(name, "_pass"));
89
+ localStorage.removeItem("".concat(name, "_code"));
90
+ localStorage.removeItem('LOGINUSER');
91
+ } else {
92
+ $api.loginApi.saveUserPasswordLocal(name, password);
93
+ }
94
+ };
95
+ var getLocalPassword = function getLocalPassword() {
96
+ var username = localStorage.getItem('LOGINUSER');
97
+ var password = $api.loginApi.getSavedPasswordByUser(username);
98
+ form.password.name = username;
99
+ form.password.password = password;
100
+ if (username && password) {
101
+ form.password.remember = true;
102
+ }
103
+ };
104
+ var handleLoginSuccess = /*#__PURE__*/function () {
105
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
106
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
107
+ while (1) switch (_context2.prev = _context2.next) {
108
+ case 0:
109
+ rememberPassword();
110
+ console.log('登录成功');
111
+ $router === null || $router === void 0 ? void 0 : $router.router.push({
112
+ path: '/'
113
+ });
114
+ case 3:
115
+ case "end":
116
+ return _context2.stop();
117
+ }
118
+ }, _callee2);
119
+ }));
120
+ return function handleLoginSuccess() {
121
+ return _ref2.apply(this, arguments);
122
+ };
123
+ }();
124
+ onBeforeMount( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
125
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
126
+ while (1) switch (_context3.prev = _context3.next) {
127
+ case 0:
128
+ _context3.next = 2;
129
+ return $api.loginApi.getSid();
130
+ case 2:
131
+ _context3.next = 4;
132
+ return getLocalPassword();
133
+ case 4:
134
+ captchaUrl.value = $api.loginApi.getValiCode();
135
+ case 5:
136
+ case "end":
137
+ return _context3.stop();
138
+ }
139
+ }, _callee3);
140
+ })));
141
+ return _objectSpread(_objectSpread({}, toRefs(props)), {}, {
142
+ form: form,
143
+ layout: layout,
144
+ captchaUrl: captchaUrl,
145
+ handleLogin: handleLogin,
146
+ handleLoginSuccess: handleLoginSuccess
147
+ });
148
+ },
149
+ render: function render() {
150
+ var h = arguments[0];
151
+ return h(LpLogin, {
152
+ "attrs": {
153
+ "value": this.form,
154
+ "layout": this.layout,
155
+ "captchaUrl": this.captchaUrl
156
+ },
157
+ "on": {
158
+ "login": this.handleLogin,
159
+ "loginSuccess": this.handleLoginSuccess
160
+ }
161
+ });
162
+ }
163
+ });
164
+
165
+ export { Login as default };
@@ -1 +1,18 @@
1
- export{default as Login}from"./Login.js";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"vue";import"@ldesign/desktop-profession-next";
1
+ function __$styleInject(css) {
2
+ if (!css) return;
3
+
4
+ if (typeof window == 'undefined') return;
5
+ var style = document.createElement('style');
6
+ style.setAttribute('media', 'screen');
7
+
8
+ style.innerHTML = css;
9
+ document.head.appendChild(style);
10
+ return css;
11
+ }
12
+
13
+ export { default as Login } from './Login.js';
14
+ import '@babel/runtime/helpers/defineProperty';
15
+ import '@babel/runtime/helpers/asyncToGenerator';
16
+ import '@babel/runtime/regenerator';
17
+ import 'vue';
18
+ import '@ldesign/desktop-profession-next';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldesign/desktop-public-next",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "es/index.js",
6
6
  "publishConfig": {