cloudcc-ccdk 0.3.4 → 0.3.6
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/README.md +16 -0
- package/lib/ccdk.js +15 -13
- package/lib/ccdk.min.js +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
#### 发布版本:0.3.6
|
|
2
|
+
#### 更新日期:2022/11/20
|
|
3
|
+
#### 更新内容:
|
|
4
|
+
* 修复
|
|
5
|
+
* 发布组件,在dev-web布局编辑器,点击刷新问题。
|
|
6
|
+
* 迭代
|
|
7
|
+
* 优化
|
|
8
|
+
|
|
9
|
+
#### 发布版本:0.3.5
|
|
10
|
+
#### 更新日期:2022/11/20
|
|
11
|
+
#### 更新内容:
|
|
12
|
+
* 修复
|
|
13
|
+
* 迭代
|
|
14
|
+
* 优化
|
|
15
|
+
* 替换element-ui库
|
|
16
|
+
|
|
1
17
|
#### 发布版本:0.3.4
|
|
2
18
|
#### 更新日期:2022/11/17
|
|
3
19
|
#### 更新内容:
|
package/lib/ccdk.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import CryptoJS from 'crypto-js/aes';
|
|
2
2
|
import UTF8 from 'crypto-js/enc-utf8';
|
|
3
3
|
import PAD from 'crypto-js/pad-pkcs7';
|
|
4
|
+
import Vue from 'vue';
|
|
4
5
|
import axios from 'axios';
|
|
5
|
-
import { Message, MessageBox, Notification } from '
|
|
6
|
+
import { Message, MessageBox, Notification } from 'element-ui';
|
|
6
7
|
import Cookies from 'js-cookie';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -105,6 +106,7 @@ var CCApplication = /*#__PURE__*/Object.freeze({
|
|
|
105
106
|
setApplication: setApplication
|
|
106
107
|
});
|
|
107
108
|
|
|
109
|
+
window.ccBus = new Vue;
|
|
108
110
|
/**
|
|
109
111
|
* 发布信息
|
|
110
112
|
* @param {string} event 事件名称
|
|
@@ -234,7 +236,7 @@ const service = axios.create({
|
|
|
234
236
|
|
|
235
237
|
service.interceptors.request.use(
|
|
236
238
|
config => {
|
|
237
|
-
config.headers['accessToken'] =
|
|
239
|
+
config.headers['accessToken'] = window.$CCDK.CCToken.getToken();
|
|
238
240
|
return config
|
|
239
241
|
},
|
|
240
242
|
error => {
|
|
@@ -311,42 +313,42 @@ var CCHttp = /*#__PURE__*/Object.freeze({
|
|
|
311
313
|
* @param {object} options 菜单配置
|
|
312
314
|
*/
|
|
313
315
|
function addMenu1(options) {
|
|
314
|
-
|
|
316
|
+
window.$CCDK.CCBus.$emit('addMenu1', options);
|
|
315
317
|
}
|
|
316
318
|
/**
|
|
317
319
|
* 添加一个二级菜单
|
|
318
320
|
* @param {object} options 菜单配置
|
|
319
321
|
*/
|
|
320
322
|
function addMenu2(options) {
|
|
321
|
-
|
|
323
|
+
window.$CCDK.CCBus.$emit('addMenu2', options);
|
|
322
324
|
}
|
|
323
325
|
/**
|
|
324
326
|
* 删除一个一级菜单
|
|
325
327
|
* @param {object} options 菜单配置
|
|
326
328
|
*/
|
|
327
329
|
function deleteMenu1(options) {
|
|
328
|
-
|
|
330
|
+
window.$CCDK.CCBus.$emit('deleteMenu1', options);
|
|
329
331
|
}
|
|
330
332
|
/**
|
|
331
333
|
* 删除一个二级菜单
|
|
332
334
|
* @param {object} options 菜单配置
|
|
333
335
|
*/
|
|
334
336
|
function deleteMenu2(options) {
|
|
335
|
-
|
|
337
|
+
window.$CCDK.CCBus.$emit('deleteMenu2', options);
|
|
336
338
|
}
|
|
337
339
|
/**
|
|
338
340
|
* 刷新一个一级菜单
|
|
339
341
|
* @param {object} options 菜单配置
|
|
340
342
|
*/
|
|
341
343
|
function refreshMenu1(options) {
|
|
342
|
-
|
|
344
|
+
window.$CCDK.CCBus.$emit('refreshMenu1', options);
|
|
343
345
|
}
|
|
344
346
|
/**
|
|
345
347
|
* 刷新一个二级菜单
|
|
346
348
|
* @param {object} options 菜单配置
|
|
347
349
|
*/
|
|
348
350
|
function refreshMenu2(options) {
|
|
349
|
-
|
|
351
|
+
window.$CCDK.CCBus.$emit('refreshMenu2', options);
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
var CCMenu = /*#__PURE__*/Object.freeze({
|
|
@@ -498,7 +500,7 @@ let pageList = new Map();
|
|
|
498
500
|
*/
|
|
499
501
|
function openListPage(obj, options = {}) {
|
|
500
502
|
let pageId = Math.random().toString(16).slice(2);
|
|
501
|
-
|
|
503
|
+
window.$CCDK.CCBus.$emit('openListPage', pageId, obj, options);
|
|
502
504
|
return pageId;
|
|
503
505
|
}
|
|
504
506
|
|
|
@@ -510,7 +512,7 @@ function openListPage(obj, options = {}) {
|
|
|
510
512
|
*/
|
|
511
513
|
function openDetailPage(obj, id, options = {}) {
|
|
512
514
|
let pageId = Math.random().toString(16).slice(2);
|
|
513
|
-
|
|
515
|
+
window.$CCDK.CCBus.$emit('openDetailPage', pageId, obj, id, options);
|
|
514
516
|
return pageId;
|
|
515
517
|
}
|
|
516
518
|
|
|
@@ -521,7 +523,7 @@ function openDetailPage(obj, id, options = {}) {
|
|
|
521
523
|
*/
|
|
522
524
|
function openCreatePage(obj, options = {}) {
|
|
523
525
|
let pageId = Math.random().toString(16).slice(2);
|
|
524
|
-
|
|
526
|
+
window.$CCDK.CCBus.$emit('openCreatePage', pageId, obj, options);
|
|
525
527
|
return pageId;
|
|
526
528
|
}
|
|
527
529
|
|
|
@@ -533,7 +535,7 @@ function openCreatePage(obj, options = {}) {
|
|
|
533
535
|
*/
|
|
534
536
|
function openEditPage(obj, id, options = {}) {
|
|
535
537
|
let pageId = Math.random().toString(16).slice(2);
|
|
536
|
-
|
|
538
|
+
window.$CCDK.CCBus.$emit('openEditPage', pageId, obj, id, options);
|
|
537
539
|
return pageId;
|
|
538
540
|
}
|
|
539
541
|
/**
|
|
@@ -543,7 +545,7 @@ function openEditPage(obj, id, options = {}) {
|
|
|
543
545
|
*/
|
|
544
546
|
function openCustomPage(obj, options = {}) {
|
|
545
547
|
let pageId = Math.random().toString(16).slice(2);
|
|
546
|
-
|
|
548
|
+
window.$CCDK.CCBus.$emit('openCustomPage', pageId, obj, options);
|
|
547
549
|
return pageId;
|
|
548
550
|
}
|
|
549
551
|
|
package/lib/ccdk.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import CryptoJS from"crypto-js/aes";import UTF8 from"crypto-js/enc-utf8";import PAD from"crypto-js/pad-pkcs7";import axios from"axios";import{Message,MessageBox,Notification}from"
|
|
1
|
+
import CryptoJS from"crypto-js/aes";import UTF8 from"crypto-js/enc-utf8";import PAD from"crypto-js/pad-pkcs7";import Vue from"vue";import axios from"axios";import{Message,MessageBox,Notification}from"element-ui";import Cookies from"js-cookie";function getAesString(data,key,iv){key=UTF8.parse(key);iv=UTF8.parse(iv);let encrypted=CryptoJS.encrypt(data,key,{iv:iv,padding:PAD});return encrypted.toString()}function getDAesString(encrypted,key,iv){key=UTF8.parse(key);iv=UTF8.parse(iv);let decrypted=CryptoJS.decrypt(encrypted,key,{iv:iv,padding:PAD});return decrypted.toString(UTF8)}function encrypt(data,key="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",iv=1){data=JSON.stringify(data);var encrypted=getAesString(data,key,iv);return encrypted}function decrypt(data,key="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",iv=1){try{var decryptedStr=getDAesString(data,key,iv);if(!decryptedStr)return null;return JSON.parse(decryptedStr)}catch(error){console.trace("解密密码错误",error);return null}}var Crypto=Object.freeze({__proto__:null,encrypt:encrypt,decrypt:decrypt});const APPLICATION_DETAIL="applicaton_current";function getApplicaton(){let detail=localStorage.getItem(Crypto.encrypt(APPLICATION_DETAIL));if(detail){return JSON.parse(detail)}return""}function setApplication(detail=""){if(detail){localStorage.setItem(Crypto.encrypt(APPLICATION_DETAIL),JSON.stringify(detail))}}var CCApplication=Object.freeze({__proto__:null,getApplicaton:getApplicaton,setApplication:setApplication});window.ccBus=new Vue;function $emit(event,...args){window.ccBus.$emit(event,...args)}function $on(event,callback){window.ccBus.$on(event,callback)}function $off(event){window.ccBus.$off(event)}var CCBus=Object.freeze({__proto__:null,$emit:$emit,$on:$on,$off:$off});let ccCall=new Map;let currentCall;function init(id,callClient){if(id&&callClient){ccCall.set(id,callClient);currentCall=callClient;return currentCall}}function call(id,options){let call;if(id){call=ccCall.get(id)}else{call=currentCall}if(call){call.call(options)}return call}function openCallPanel(id,options){let call;if(id){call=ccCall.get(id)}else{call=currentCall}if(call){call.openCallPanel(options)}return call}var CCCall=Object.freeze({__proto__:null,init:init,call:call,openCallPanel:openCallPanel});function getBaseUrl(){return window.gw.BASE_URL}function getGw(){return window.gw}function getSvc(){return window.Glod}var CCConfig=Object.freeze({__proto__:null,getBaseUrl:getBaseUrl,getGw:getGw,getSvc:getSvc});const service=axios.create({timeout:6e4,headers:{"Content-Type":"application/json; charset=utf-8"}});service.interceptors.request.use(config=>{config.headers["accessToken"]=window.$CCDK.CCToken.getToken();return config},error=>{Promise.reject(error)});service.interceptors.response.use(response=>{const code=response.data.code||200;if(code!==200){return Promise.reject(null==response.data.msg?"未知异常":response.data.msg)}else{return response.data}},error=>{return Promise.reject(error)});function get(url,data={},responseType=""){return service({url:url,method:"get",params:data,responseType:responseType})}function post(url,data={},responseType=""){return service({url:url,method:"post",data:data,responseType:responseType})}function put(url,data={}){return service({url:url,method:"put",data:data})}function postParams(url,data={}){return service({url:url,method:"post",params:data})}function patch(url,data={}){return service({url:url,method:"patch",data:data})}var CCHttp=Object.freeze({__proto__:null,get:get,post:post,put:put,patch:patch,postParams:postParams});function addMenu1(options){window.$CCDK.CCBus.$emit("addMenu1",options)}function addMenu2(options){window.$CCDK.CCBus.$emit("addMenu2",options)}function deleteMenu1(options){window.$CCDK.CCBus.$emit("deleteMenu1",options)}function deleteMenu2(options){window.$CCDK.CCBus.$emit("deleteMenu2",options)}function refreshMenu1(options){window.$CCDK.CCBus.$emit("refreshMenu1",options)}function refreshMenu2(options){window.$CCDK.CCBus.$emit("refreshMenu2",options)}var CCMenu=Object.freeze({__proto__:null,addMenu1:addMenu1,addMenu2:addMenu2,deleteMenu1:deleteMenu1,deleteMenu2:deleteMenu2,refreshMenu1:refreshMenu1,refreshMenu2:refreshMenu2});function showMessage(text,type="info",duration=3e3,showClose=false,center=false){Message({message:text,type:type,duration:duration,showClose:showClose,center:center})}function showConfirm(text,title,options={},confirm=()=>{},reject=()=>{}){MessageBox.confirm(text,title,options).then(()=>{confirm()}).catch(()=>{reject()})}function showNotification(options={}){Notification(options)}var CCMessage=Object.freeze({__proto__:null,showMessage:showMessage,showConfirm:showConfirm,showNotification:showNotification});const OBJECT_DETAIL="cc_object_detail";const OBJECT="cc_object";function getObject(){let detail=localStorage.getItem(Crypto.encrypt(OBJECT));if(detail){return JSON.parse(detail)}return""}function setObject(detail=""){if(detail){localStorage.setItem(Crypto.encrypt(OBJECT),JSON.stringify(detail))}}function getObjectDetail(apiname){let detail=localStorage.getItem(Crypto.encrypt(OBJECT_DETAIL));if(detail){if(apiname){let detail=JSON.parse(detail).detail;let targetField=undefined;if(Array.isArray(detail)){targetField=detail.find(item=>item.apiname===apiname)}return targetField}else{return JSON.parse(detail)}}return""}function setObjectDetail(detail=""){if(detail){if(Array.isArray(detail.detail)){let data=[];detail.detail.forEach(item=>{if(item&&Array.isArray(item.data)){item.data.forEach(itemData=>{if(itemData.left&&!Array.isArray(itemData.left)){data.push(itemData.left)}if(itemData.right&&!Array.isArray(itemData.right)){data.push(itemData.right)}})}});if(data.length>0){detail.detail=data}}localStorage.setItem(Crypto.encrypt(OBJECT_DETAIL),JSON.stringify(detail))}}var CCObject=Object.freeze({__proto__:null,getObject:getObject,setObject:setObject,getObjectDetail:getObjectDetail,setObjectDetail:setObjectDetail});let pageList=new Map;function openListPage(obj,options={}){let pageId=Math.random().toString(16).slice(2);window.$CCDK.CCBus.$emit("openListPage",pageId,obj,options);return pageId}function openDetailPage(obj,id,options={}){let pageId=Math.random().toString(16).slice(2);window.$CCDK.CCBus.$emit("openDetailPage",pageId,obj,id,options);return pageId}function openCreatePage(obj,options={}){let pageId=Math.random().toString(16).slice(2);window.$CCDK.CCBus.$emit("openCreatePage",pageId,obj,options);return pageId}function openEditPage(obj,id,options={}){let pageId=Math.random().toString(16).slice(2);window.$CCDK.CCBus.$emit("openEditPage",pageId,obj,id,options);return pageId}function openCustomPage(obj,options={}){let pageId=Math.random().toString(16).slice(2);window.$CCDK.CCBus.$emit("openCustomPage",pageId,obj,options);return pageId}function reOpenPage(pageId,options){let page;if(pageId){page=pageList.get(pageId)}if(page){page.reOpenPage();if(options.refresh){page.refresh()}}}function addPage(id,page){if(id&&page){pageList.set(id,page)}}function close(pageId=""){let page;if(pageId){page=pageList.get(pageId)}else{if(pageList.size>0){page=[...pageList.values()][pageList.size-1]}}if(page){page.close()}}function refresh(pageId=""){let page;if(pageId){page=pageList.get(pageId)}if(page){page.refresh()}}var CCPage=Object.freeze({__proto__:null,openListPage:openListPage,openDetailPage:openDetailPage,openCreatePage:openCreatePage,openEditPage:openEditPage,openCustomPage:openCustomPage,reOpenPage:reOpenPage,addPage:addPage,close:close,refresh:refresh});function getDomain(){let lastTow=document.domain.split(".").slice(-2,-1)[0];if(lastTow=="com"||lastTow=="org"||lastTow=="net"){return"."+document.domain.split(".").slice(-3).join(".")}else{return"."+document.domain.split(".").slice(-2).join(".")}}var CCUtils=Object.freeze({__proto__:null,getDomain:getDomain});const TOKEN="cc_token";function getUrlQuery(name){var reg=new RegExp(name+"=([^&]*)(&|$)");var r=window.location.href.match(reg);let res=null;if(r!=null)res=r[1].trim();return res}function getToken(urlName="binding"){let token=getUrlQuery(urlName)||Cookies.get(Crypto.encrypt(TOKEN))||Cookies.get(urlName);if(token){setToken(token)}return token}function setToken(token,domain=getDomain()){Cookies.set(Crypto.encrypt(TOKEN),token,{domain:domain,expires:1/12});Cookies.set(Crypto.encrypt(TOKEN),token,{expires:1/12})}function clearToken(domain=getDomain()){Cookies.remove(Crypto.encrypt(TOKEN),{domain:domain});Cookies.remove(Crypto.encrypt(TOKEN))}var CCToken=Object.freeze({__proto__:null,setToken:setToken,getToken:getToken,clearToken:clearToken});const USER_INFO="cc_user_info";function setUserInfo(userInfo,domain=getDomain()){Cookies.set(Crypto.encrypt(USER_INFO),Crypto.encrypt(userInfo),{domain:domain,expires:1/12});Cookies.set(Crypto.encrypt(USER_INFO),Crypto.encrypt(userInfo),{expires:1/12})}function getUserInfo(){let encryptUserInfo=Cookies.get(Crypto.encrypt(USER_INFO));if(encryptUserInfo){return Crypto.decrypt(encryptUserInfo)}else{return""}}var CCUser=Object.freeze({__proto__:null,setUserInfo:setUserInfo,getUserInfo:getUserInfo});export{CCApplication,CCBus,CCCall,CCConfig,Crypto as CCCrypto,CCHttp,CCMenu,CCMessage,CCObject,CCPage,CCToken,CCUser,CCUtils};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcc-ccdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/ccdk-min.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
],
|
|
18
18
|
"author": "294985925@qq.com",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"rollup": "
|
|
21
|
-
"uglify-js": "
|
|
20
|
+
"rollup": "2.77.0",
|
|
21
|
+
"uglify-js": "3.17.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"js
|
|
24
|
+
"vue": "2.6.14",
|
|
25
|
+
"axios": "1.1.3",
|
|
26
|
+
"element-ui": "2.15.12",
|
|
27
|
+
"crypto-js": "4.1.1",
|
|
28
|
+
"js-cookie": "3.0.1"
|
|
28
29
|
}
|
|
29
30
|
}
|