Commit 483cf50c authored by Bill's avatar Bill

feat: 添加公共方法,添加默认的活动图片

parent 3bff5f16
<?xml version="1.0" encoding="UTF-8"?>
<svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>图标占位/活动</title>
<defs>
<rect id="path-1" x="0" y="0" width="40" height="40" rx="4"></rect>
</defs>
<g id="图标占位/活动" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icon">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="矩形" fill="#F25767" xlink:href="#path-1"></use>
<rect id="矩形" mask="url(#mask-2)" x="8" y="8" width="24" height="24"></rect>
<path d="M23.4047009,19.2867655 L23.3826623,19.4259721 C23.3772213,19.4585887 23.3715972,19.49113 23.3657912,19.5235947 C23.3355082,19.6929633 23.3001994,19.8605598 23.2601057,20.0258501 L23.2473269,20.0778047 C23.243061,20.094912 23.2387438,20.1119942 23.2343754,20.129051 C23.2183747,20.1915207 23.2017447,20.2534492 23.184443,20.3150287 C23.1774226,20.3400199 23.1701821,20.3653297 23.1628284,20.3905794 C23.1154485,20.5532271 23.063527,20.7129411 23.0071159,20.8699646 C23.0007005,20.8878231 22.9941797,20.9057756 22.9876003,20.9236924 C22.8940908,21.1783206 22.7888062,21.4256127 22.6724876,21.6647992 C22.6597157,21.6910619 22.6468326,21.7171828 22.6338181,21.7432052 C22.6114768,21.7878797 22.5886371,21.8324749 22.5654113,21.8767706 C22.5422864,21.9208673 22.5190153,21.9642362 22.4953745,22.0073081 C22.4778233,22.0392875 22.4599424,22.071325 22.441857,22.1031939 C22.42443,22.1339021 22.4068267,22.1644306 22.3890356,22.1948008 C22.2700814,22.3978369 22.142961,22.5934763 22.0080481,22.7813971 C21.9716976,22.8320351 21.9345667,22.882396 21.896875,22.932177 C21.810883,23.0457368 21.7222373,23.1559674 21.6308232,23.2630427 C21.6193413,23.2764914 21.6078649,23.2898336 21.5963455,23.3031262 C21.5580075,23.3473659 21.519152,23.3911004 21.4798285,23.4342726 C21.4555632,23.4609147 21.430946,23.4875274 21.4061505,23.5139202 C21.3747989,23.5472881 21.3434132,23.5800474 21.3117514,23.6124555 C21.2883758,23.6363815 21.2648921,23.6600739 21.2412603,23.6835735 C20.2212523,24.6981648 18.9240451,25.3535625 17.4983539,25.4782848 C17.3515045,25.7982007 17.3408143,26.0635946 17.4472136,26.2763932 C17.4999816,26.3819292 17.5725641,26.4788495 17.6870063,26.598672 L18.0202201,26.9242244 C18.817406,27.7214103 18.6837478,28.5233589 17.3535534,29.8535534 C17.1582912,30.0488155 16.8417088,30.0488155 16.6464466,29.8535534 C16.4511845,29.6582912 16.4511845,29.3417088 16.6464466,29.1464466 L16.9013664,28.8869261 L17.1075797,28.6656073 C17.5647022,28.1559614 17.5930155,27.9583184 17.401121,27.7266386 L17.3131133,27.6313312 L17.0831664,27.4095551 C16.8390335,27.1716821 16.6790663,26.9761665 16.5527864,26.7236068 C16.3554788,26.3289915 16.3217098,25.9109656 16.4395152,25.4713791 C13.1130662,25.1458317 10.5,21.9250203 10.5,18 C10.5,13.8578644 13.4101491,10.5 17,10.5 C19.4984272,10.5 21.6676247,12.1264613 22.7556877,14.5118014 C22.764971,14.5334531 22.7747717,14.5551712 22.7844824,14.5769511 C22.9032339,14.8423397 23.0080668,15.1168095 23.0985795,15.3992893 C23.1037449,15.4161476 23.1091397,15.4331589 23.1144825,15.4501989 C23.1385658,15.5263529 23.1613709,15.6030344 23.1831194,15.6802658 C23.1892298,15.7025482 23.1954457,15.7249642 23.2015723,15.7474257 C23.2174429,15.8050911 23.2325347,15.8629113 23.247034,15.9210211 C23.2613922,15.9790049 23.2753152,16.0374283 23.2886361,16.096132 C23.3062437,16.1733664 23.3227292,16.2511413 23.3381544,16.3293813 C23.3415362,16.3468412 23.3448955,16.3641577 23.3482027,16.3814967 C23.3616628,16.4517992 23.3742482,16.5226923 23.38596,16.5939421 C23.3918137,16.6297563 23.3975041,16.6657979 23.4029701,16.7019282 C23.413686,16.7726003 23.4235162,16.8436168 23.432476,16.9149584 C23.4375429,16.9554128 23.4423701,16.9961845 23.4469119,17.037059 C23.4556201,17.1153486 23.4632713,17.1940258 23.4698594,17.2730614 C23.4727402,17.3076879 23.4753983,17.3420551 23.4778548,17.3764883 C23.4925122,17.5818013 23.5,17.7898917 23.5,18 C23.5,18.1925677 23.4937102,18.3834404 23.4813549,18.5723594 C23.4796356,18.5986217 23.4778398,18.624301 23.4759322,18.6499435 C23.4707747,18.719304 23.464768,18.78871 23.457947,18.8578307 C23.4542386,18.8954039 23.4503043,18.932761 23.4461329,18.9700323 C23.4393774,19.0304087 23.4319663,19.09081 23.4239355,19.1509754 C23.4212832,19.1708411 23.418599,19.1904281 23.4158492,19.2099898 L23.4047009,19.2867655 L23.4047009,19.2867655 Z M24.5,13.5 C27.2614237,13.5 29.5,16.1862915 29.5,19.5 C29.5,22.4072781 27.7768764,24.8316077 25.4893142,25.3825665 C25.3688793,25.7048633 25.3464654,25.9680768 25.4085904,26.173341 C25.4292811,26.2417042 25.4561208,26.3025437 25.4978922,26.3764089 L25.6512559,26.62492 C26.0106899,27.2187142 25.9548117,27.772588 25.3577686,28.7589184 C25.2147719,28.9951525 24.9073446,29.0707364 24.6711105,28.9277397 C24.4348764,28.7847431 24.3592925,28.4773158 24.5022891,28.2410816 L24.6584513,27.9740291 C24.902047,27.5372963 24.9179307,27.3737069 24.8240216,27.1927558 L24.6955381,26.9830816 C24.5830803,26.8020621 24.5085097,26.6514933 24.4514673,26.4630227 C24.378669,26.2224933 24.358064,25.9684865 24.3872022,25.7010275 L24.418,25.497 L24.2518005,25.4927365 C23.3473038,25.4396775 22.5059532,25.0982038 21.7902615,24.5433307 C23.4509087,22.9799767 24.5,20.6210341 24.5,18 C24.5,16.4092906 24.1135889,14.9151172 23.4387103,13.6365908 C23.7805378,13.5467475 24.1357195,13.5 24.5,13.5 Z" id="形状结合" fill="#FFFFFF" mask="url(#mask-2)"></path>
</g>
</g>
</svg>
\ No newline at end of file
......@@ -21,6 +21,7 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
if (format) {
const [labelString, valueString] = format
enums = res.map(v => ({
...v,
label: v[labelString],
value: v[valueString]
}))
......@@ -31,7 +32,7 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
state.originAsyncData = res
})
linkage.loaded(name)
linkage.enum(name, enums)
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch('requestAsyncSelect', {
......@@ -43,4 +44,4 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
linkage.enum(name, [])
})
})
}
\ No newline at end of file
}
......@@ -663,6 +663,18 @@ export const clearModalParams = () => {
sessionStorage.setItem("currentState", JSON.stringify(result))
}
/** 数组转对象 */
export function arrayToMap<T>(list: T[], primaryKey: keyof T) {
const result: { [props: string]: T } = {};
list.forEach((_item: T) => {
const key = _item[primaryKey];
(result as any)[key] = _item;
});
return result;
}
export default {
isArray,
isObject,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment