image.png 集成的Git、调试、扩展的免费开源编程软件 Microsoft在2015年4月30日Build 开发者大会上正式宣布了 Visual Studio Code 项目:一个运行于 Mac OS X、Windows和 Linux 之上的,针对于编写现代 Web 和云应用的跨平台源代码编辑器

Snipaste_2021-12-02_11-10-59.png

javascriptreact.json

  1. {
  2. "map快速遍历模板": {
  3. "prefix": "map",
  4. "body": [
  5. "{",
  6. "[",
  7. "{$1}",
  8. "].map((item, index) => {",
  9. "return $2",
  10. "})}"
  11. ],
  12. "description": "map快速遍历模板"
  13. },
  14. "打印输出": {
  15. "prefix": "log",
  16. "body": [
  17. "console.log($1,`打印输出$2`)",
  18. ],
  19. "description": "打印输出"
  20. },
  21. "路由参数跳转页面": {
  22. "prefix": "tiaozhuan-thispropshistory",
  23. "body": [
  24. "this.props.history.push(`/Dashboard/${activeKey}$1?id=${e.id }`);",
  25. ],
  26. "description": "路由参数跳转页面"
  27. },
  28. "返回页面": {
  29. "prefix": "tiaozhuan-history.go(-1) ",
  30. "body": [
  31. "window.app.router.goBack()",
  32. ],
  33. "description": "返回页面"
  34. },
  35. "跳转导出": {
  36. "prefix": "tiaozhuan-window.open()",
  37. "body": [
  38. "window.open(`${CDN_BASE}公告对象模板.xlsx`)",
  39. ],
  40. "description": "跳转导出"
  41. },
  42. "React更新视图": {
  43. "prefix": "thissetstate",
  44. "body": [
  45. "this.setState({",
  46. "$1",
  47. "})",
  48. ],
  49. "description": "React更新视图"
  50. },
  51. "快速生成enum": {
  52. "prefix": "enum",
  53. "body": [
  54. "emum:{",
  55. "0:\"$1\",",
  56. "1:\"$2\",",
  57. "2:\"$3\",",
  58. "3:\"$4\",",
  59. "},",
  60. ],
  61. "description": "快速生成enum"
  62. },
  63. "快速生成表单中Select等的data": {
  64. "prefix": "data",
  65. "body": [
  66. "data:[",
  67. " {value:\"$1\" ,label:\"$1\"},",
  68. " {value:\"$2\" ,label:\"$2\"},",
  69. " {value:\"$3\" ,label:\"$3\"},",
  70. "],",
  71. ],
  72. "description": "快速生成data"
  73. },
  74. "解构ant form": {
  75. "prefix": "thispropsform",
  76. "body": [
  77. "const { form: { getFieldDecorator, getFieldValue, getFieldsValue, getFieldsError, resetFields, validateFields,validateFieldsAndScroll, setFieldsValue, setFields } } = this.props",
  78. "$1"
  79. ],
  80. "description": "ant pro 表单的api方法"
  81. },
  82. "解构mobx的AppStore": {
  83. "prefix": "thispropsAppStore",
  84. "body": [
  85. " const { searchparams, isLoaded, hookCbf, routerCfg } = this.props.AppStore.state",
  86. "$1"
  87. ],
  88. "description": "ant pro 表单的api方法"
  89. },
  90. "提交函数": {
  91. "prefix": "bind",
  92. "body": [
  93. "{this.handleSubmit$1.bind(this)}",
  94. ],
  95. "description": "提交函数"
  96. },
  97. "ant提交时候校验": {
  98. "prefix": "handleSubmit",
  99. "body": [
  100. "handleSubmit() {",
  101. "const { form: { validateFields } } = this.props",
  102. "validateFields(async (err, values) => {",
  103. " console.log(values, \"————————这是提交时候的values值————————\");",
  104. "if (err) { return }",
  105. "let { customs, ...other } = values",
  106. "let newData = other",
  107. "let { resultMsg, resultCode, data } = await request.save(",
  108. " { ...newData }",
  109. ")",
  110. "if (resultCode == '0') {",
  111. "message.success(\"已保存\")",
  112. "this.setState({",
  113. "isShowModel: false,",
  114. "version: Math.random()",
  115. "})",
  116. " } else {",
  117. " message.error(\"操作错误\")",
  118. " }",
  119. "})",
  120. "}",
  121. ],
  122. "description": "ant提交时候校验"
  123. },
  124. "详情查询数据": {
  125. "prefix": "chaxun",
  126. "body": [
  127. "this.queryPageNeedData()",
  128. "async queryPageNeedData() {",
  129. "let { resultMsg, resultCode, data",
  130. "} = await request.queryByRecallOrderNo({",
  131. " recallOrderNo: this.id,",
  132. "})",
  133. " if (resultCode == '0') {",
  134. "const { form: { setFieldsValue, setFields",
  135. "}",
  136. "} = this.props",
  137. "setFieldsValue({ QA: data",
  138. "})",
  139. " // this.setState({",
  140. "// isShowModel: false,",
  141. "// version: Math.random()",
  142. "// })",
  143. "} else {",
  144. " message.error(\"查询错误\")",
  145. "}",
  146. "}",
  147. ],
  148. "description": "详情查询数据"
  149. },
  150. "antd中的form结合row使用": {
  151. "prefix": "formrow",
  152. "body": [
  153. "{/*",
  154. "const {Item:FormItem} = Form",
  155. "const formItemLayout = {",
  156. "labelCol: {span: 6 },",
  157. "wrapperCol: {span: 18 },",
  158. "};*/}",
  159. "",
  160. "<Form {...formItemLayout}>",
  161. "<Row gutter={32}>",
  162. " <Col span={12}>",
  163. "<FormItem label=\"$1\">",
  164. "{getFieldDecorator('$2', {",
  165. "rules: [",
  166. " {",
  167. " required: true,",
  168. " message: '$1不能为空',",
  169. " },",
  170. " {",
  171. " max: 50,",
  172. " message: '$1的字符不能超过50个字符',",
  173. "},",
  174. " ],",
  175. " })(",
  176. "<Input$3 />",
  177. ")}",
  178. "</FormItem>",
  179. "</Col>",
  180. "$4",
  181. "$3",
  182. " </Row>",
  183. " </Form>",
  184. ],
  185. "description": "antd中的form结合row使用"
  186. },
  187. "FormItem 每一项": {
  188. "prefix": "formcol",
  189. "body": [
  190. " <Col span={12}>",
  191. "<FormItem label=\"$1\">",
  192. "{getFieldDecorator('$2', {",
  193. "//normalize: this.normalizeAllPositiveInteger,",
  194. "rules: [",
  195. " {",
  196. " required: true,",
  197. " message: '$1不能为空',",
  198. " },",
  199. " {",
  200. " max: 50,",
  201. " message: '$1的字符不能超过50个字符',",
  202. "},",
  203. " ],",
  204. " })(",
  205. "<Input$3 />",
  206. ")}",
  207. "</FormItem>",
  208. "</Col>",
  209. "$4",
  210. ],
  211. "description": "FormItem 每一项"
  212. },
  213. "解构React State": {
  214. "prefix": "thisstate",
  215. "body": [
  216. "const { isShowModal,$1 } = this.state",
  217. "$2"
  218. ],
  219. "description": "解构React State"
  220. },
  221. "解构React Props": {
  222. "prefix": "thisprops",
  223. "body": [
  224. "const { $1 } = this.props",
  225. "$2"
  226. ],
  227. "description": "解构React Props"
  228. },
  229. "快速导入Select的Option": {
  230. "prefix": "antselect",
  231. "body": [
  232. "const { Option: SelectOption} = Select",
  233. "$1"
  234. ],
  235. "description": "快速导入Select的Option"
  236. },
  237. // ———————————— 云徙常用 ————————————
  238. "yx 常用表单元素": {
  239. "prefix": "yxformelement",
  240. "body": [
  241. "{",
  242. " type: \"String$3\",",
  243. " controlItemParam: {",
  244. " id: `id$2`,",
  245. " label: `$1`,",
  246. " placeholder: `请输入`,",
  247. " // placeholder: ['开始时间', '结束时间'],",
  248. " // type:`range`,",
  249. " // labelLength:11,",
  250. " // rules:{ required: false, max: 11 },",
  251. " // inputParam:{ maxLength: 11 },",
  252. " },",
  253. "},",
  254. "$5",
  255. ],
  256. "description": "yx 常用表单元素"
  257. },
  258. "yx导出": {
  259. "prefix": "daochu-action",
  260. "body": [
  261. "{",
  262. "text: \"导出\",",
  263. "actionType: \"action\",",
  264. "isConfirm: false,",
  265. "check: false,",
  266. "type: \"primary\",",
  267. "onClick: async (data) => {",
  268. "console.log(data,\"data\");",
  269. "data.pageSize = 2000;",
  270. "let res = await request.exportData({$1});",
  271. "if(res.resultCode == 0){",
  272. "//window.open(res.data,\"_blank\");",
  273. "utils.downloadFiles(`\\${CDN_BASE}公告对象模板.xlsx`, \"公告对象模板.xlsx\")",
  274. "}",
  275. "},",
  276. "},",
  277. ],
  278. "description": "yx导出"
  279. },
  280. "yx优化下载文件": {
  281. "prefix": "xiazai-downloadFiles",
  282. "body": [
  283. "utils.downloadFiles(`\\${CDN_BASE}公告对象模板.xlsx`, \"公告对象模板.xlsx\")",
  284. ],
  285. "description": "yx优化导出"
  286. },
  287. "yx导出的api": {
  288. "prefix": "daochu-api",
  289. "body": [
  290. "// 导出数据",
  291. "static exportData(params={}) {",
  292. "return request({",
  293. "url: `$1/export`,",
  294. "method: 'post',",
  295. "//params,",
  296. "data: params,",
  297. "headers: { 'Content-type': 'application/json' }",
  298. " })",
  299. "}",
  300. "$2"
  301. ],
  302. "description": "使用put请求api接口"
  303. },
  304. "yx导入": {
  305. "prefix": "daoru-action",
  306. "body": [
  307. "{",
  308. "actionType: 'upload',",
  309. "text: \"导入\",",
  310. "isConfirm: false,",
  311. "check: false,",
  312. "loading: this.state.importLoading,",
  313. "uploadConfig: config.uploadConfig,",
  314. "// uploadConfig: {",
  315. "// url: `${config.BACKEND_BASE}/v1/${apis.getPolicyUrl}`,",
  316. "// AccessToken: config.uploadConfig.AccessToken",
  317. "// },",
  318. "type: \"primary\",",
  319. "inputParam: {",
  320. "type: 'file',",
  321. "accept: '.xlsx,.xls'",
  322. "},",
  323. "requestParam: {",
  324. "url: 'word/importWord',",
  325. "method: 'post',",
  326. "message: false,",
  327. "beforeRequest: (data) => {",
  328. "return {",
  329. "fileUrl: data.fileUrl[0],",
  330. " value: 0,",
  331. "name: Date.now(),",
  332. "type: this.state.key === \"1\" ? \"1\" : \"0\"",
  333. "}",
  334. " },",
  335. " // 请求成功的回调",
  336. " callback: (res) => {",
  337. "message.success(\"导入成功\");",
  338. "queryList = setInterval(() => {",
  339. "let { version } = this.state;",
  340. "version++",
  341. "this.setState({",
  342. "version: version",
  343. "})",
  344. "}, 20000)",
  345. " },",
  346. "// 请求失败的回调",
  347. "failure: (res) => {",
  348. "if (res.data) {",
  349. "console.log(\"上传失败\");",
  350. " } else {",
  351. " message.error('导入失败,' + res.resultMsg);",
  352. " }",
  353. "},",
  354. "}",
  355. "},",
  356. ],
  357. "description": "yx导入"
  358. },
  359. "yx删除": {
  360. "prefix": "shanchu-action-onClick",
  361. "body": [
  362. "onClick: async (rowData) => {",
  363. "let { resultMsg, resultCode,data } = await request.invalidCoupon({",
  364. "id: rowData.id,",
  365. "status:1,",
  366. "})",
  367. "if (resultCode == '0') {",
  368. "message.success(\"已失效\")",
  369. "this.setState({",
  370. "isShowModel: false,",
  371. "version: Math.random()",
  372. "})",
  373. "}else{",
  374. "message.error(\"操作错误\")",
  375. " }",
  376. "},",
  377. ],
  378. "description": "yx删除"
  379. },
  380. "yx动作action过滤1": {
  381. "prefix": "filter1",
  382. "body": [
  383. "filter: { dataIndex: \"$1\", contains: [$2] },",
  384. "$3"
  385. ],
  386. "description": "yx动作action过滤1"
  387. },
  388. "yx动作action过滤2【函数】": {
  389. "prefix": "filter2",
  390. "body": [
  391. "//【ture】表示筛选到,【false】表示过滤掉",
  392. "filter: (rowData) => {",
  393. "if (rowData.status == 1) { return true",
  394. "}",
  395. "return false",
  396. "},",
  397. "$1",
  398. ],
  399. "description": "yx动作action过滤2"
  400. },
  401. "获取URL的参数": {
  402. "prefix": "utilgetParameter",
  403. "body": [
  404. "import utils from \"utils$1\"",
  405. "this.id = utils.getParameter(\"id\")",
  406. "$2",
  407. ],
  408. "description": "获取URL的参数"
  409. },
  410. "获取详情": {
  411. "prefix": "getdatail",
  412. "body": [
  413. "async getDatail(id) {",
  414. "let { resultMsg, resultCode, data } = await request.getDetail({",
  415. "id: this.id || utils.getParameter(\"id\"),",
  416. "})",
  417. "if (data) {,",
  418. "const { form: { setFieldsValue } } = this.props",
  419. "setFieldsValue(data)",
  420. "}",
  421. "}",
  422. ],
  423. "description": "获取详情"
  424. },
  425. //———————————————————— 请求api ————————————————————
  426. "使用get请求api接口": {
  427. "prefix": "apigetRequest",
  428. "body": [
  429. "//获取单条优惠券详情$1",
  430. "static detail$2(params) {",
  431. "return request({",
  432. "url: `$3/${params.id}`,",
  433. "method: 'get',",
  434. " params,",
  435. " // data: params,",
  436. "headers: { 'Content-type': 'application/json' }",
  437. " })",
  438. "}",
  439. ],
  440. "description": "使用get请求api接口"
  441. },
  442. "使用post请求api接口": {
  443. "prefix": "apipostRequest",
  444. "body": [
  445. "//获取单条优惠券详情$1",
  446. "static post$2(params={}) {",
  447. "return request({",
  448. "url: `$3`,",
  449. "method: 'post',",
  450. "//params,",
  451. "data: params,",
  452. "headers: { 'Content-type': 'application/json' }",
  453. " })",
  454. "}",
  455. "$4"
  456. ],
  457. "description": "使用post请求api接口"
  458. },
  459. "使用put请求api接口": {
  460. "prefix": "apiputRequest",
  461. "body": [
  462. "//获取单条优惠券详情$1",
  463. "static put$2(params={}) {",
  464. "return request({",
  465. "url: `$3`,",
  466. "method: 'put',",
  467. "params,",
  468. "//data: params,",
  469. "headers: { 'Content-type': 'application/json' }",
  470. " })",
  471. "}",
  472. "$4"
  473. ],
  474. "description": "使用put请求api接口"
  475. },
  476. "使用delete请求api接口": {
  477. "prefix": "apideleteRequest",
  478. "body": [
  479. "//【删除】$1",
  480. "static delete(params) {",
  481. "return request({",
  482. "url: `coupon/${params.id}`,",
  483. "method: 'delete$3',",
  484. " params,",
  485. " // data: params,",
  486. "headers: { 'Content-type': 'application/json' }",
  487. " })",
  488. "}",
  489. ],
  490. "description": "使用delete请求api接口"
  491. },
  492. //———————————————————— 格式转化 ————————————————————
  493. "moment范围格式转化": {
  494. "prefix": "momentrange",
  495. "body": [
  496. "import moment from 'moment'",
  497. "if (data.transferCreateTime){",
  498. "let timeFomrmat = \"YYYY-MM-DD HH:mm:ss\"",
  499. "data.createStartTime = moment(data.transferCreateTime[0]).format(timeFomrmat)",
  500. "data.createEndTime = moment(data.transferCreateTime[1]).format(timeFomrmat)",
  501. "delete data.transferCreateTime",
  502. "}",
  503. ],
  504. "description": "moment范围格式转化"
  505. },
  506. }