├── .vscode └── settings.json ├── LICENSE ├── README.md ├── app.js ├── app.json ├── app.wxss ├── images ├── me │ ├── angle-right.png │ ├── cog_blue.png │ └── edit_blue.png ├── onboard │ └── octocat.png ├── tab │ ├── explore.png │ ├── explore@active.png │ ├── famous.png │ ├── famous@active.png │ ├── index.png │ ├── index@active.png │ ├── me.png │ └── me@active.png └── user │ ├── blog.png │ ├── company.png │ ├── email.png │ ├── location.png │ ├── repo.png │ ├── repo_fork.png │ ├── star.png │ └── time.png ├── jsconfig.json ├── pages ├── auth │ └── onboard │ │ ├── onboard.js │ │ ├── onboard.json │ │ ├── onboard.wxml │ │ └── onboard.wxss ├── explore │ ├── explore.js │ ├── explore.json │ ├── explore.wxml │ └── explore.wxss ├── famous │ ├── famous.js │ ├── famous.json │ ├── famous.wxml │ └── famous.wxss ├── follower │ ├── follower.js │ ├── follower.json │ ├── follower.wxml │ └── follower.wxss ├── following │ ├── following.js │ ├── following.json │ ├── following.wxml │ └── following.wxss ├── helpers │ ├── auth.js │ └── index.js ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── me │ ├── me.js │ ├── me.json │ ├── me.wxml │ └── me.wxss ├── org │ ├── org.js │ ├── org.json │ ├── org.wxml │ └── org.wxss ├── repo │ ├── repo.js │ ├── repo.json │ ├── repo.wxml │ └── repo.wxss ├── settings │ ├── settings.js │ ├── settings.json │ ├── settings.wxml │ └── settings.wxss └── user │ ├── user.js │ ├── user.json │ ├── user.wxml │ └── user.wxss ├── screenshots ├── explore.png ├── famous.png ├── feed.png ├── githubfeed.gif └── user.png ├── styles ├── _var.wxss ├── main.wxss └── widget │ └── _button.wxss ├── typings └── wx.d.ts └── utils ├── country_list.js ├── language_list.js ├── services.js └── util.js /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": {"editor":{"fontFamily":"Consolas, 'Courier New', monospace","fontWeight":"normal","fontSize":14,"lineHeight":20,"lineNumbers":"on","rulers":[],"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","tabSize":2,"insertSpaces":true,"detectIndentation":true,"roundedSelection":true,"scrollBeyondLastLine":true,"wrappingColumn":300,"wordWrap":false,"wrappingIndent":"same","mouseWheelScrollSensitivity":1,"quickSuggestions":true,"quickSuggestionsDelay":10,"parameterHints":true,"autoClosingBrackets":true,"formatOnType":false,"suggestOnTriggerCharacters":true,"acceptSuggestionOnEnter":true,"snippetSuggestions":"bottom","emptySelectionClipboard":true,"wordBasedSuggestions":true,"suggestFontSize":0,"suggestLineHeight":0,"tabCompletion":false,"selectionHighlight":true,"overviewRulerLanes":3,"cursorBlinking":"blink","mouseWheelZoom":false,"cursorStyle":"line","fontLigatures":false,"hideCursorInOverviewRuler":false,"renderWhitespace":"none","renderControlCharacters":false,"renderIndentGuides":true,"renderLineHighlight":true,"codeLens":true,"folding":true,"glyphMargin":true,"useTabStops":true,"trimAutoWhitespace":true,"stablePeek":false,"formatOnSave":false},"diffEditor":{"renderSideBySide":true,"ignoreTrimWhitespace":true},"emmet":{"triggerExpansionOnTab":true,"preferences":{},"syntaxProfiles":{},"excludeLanguages":[]},"workbench":{"editor":{"showTabs":true,"showIcons":true,"enablePreview":true,"enablePreviewFromQuickOpen":true,"openPositioning":"right"},"quickOpen":{"closeOnFocusLost":true},"settings":{"openDefaultSettings":true},"sideBar":{"location":"left"},"statusBar":{"visible":true}},"window":{"openFilesInNewWindow":true,"reopenFolders":"one","restoreFullscreen":false,"zoomLevel":0},"files":{"exclude":{"**/.git":true,"**/.svn":true,"**/.hg":true,"**/.DS_Store":true},"associations":{"editor":{"fontFamily":"Consolas, 'Courier New', monospace","fontWeight":"normal","fontSize":14,"lineHeight":20,"lineNumbers":"on","rulers":[],"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","tabSize":2,"insertSpaces":true,"detectIndentation":true,"roundedSelection":true,"scrollBeyondLastLine":true,"wrappingColumn":300,"wordWrap":false,"wrappingIndent":"same","mouseWheelScrollSensitivity":1,"quickSuggestions":true,"quickSuggestionsDelay":10,"parameterHints":true,"autoClosingBrackets":true,"formatOnType":false,"suggestOnTriggerCharacters":true,"acceptSuggestionOnEnter":true,"snippetSuggestions":"bottom","emptySelectionClipboard":true,"wordBasedSuggestions":true,"suggestFontSize":0,"suggestLineHeight":0,"tabCompletion":false,"selectionHighlight":true,"overviewRulerLanes":3,"cursorBlinking":"blink","mouseWheelZoom":false,"cursorStyle":"line","fontLigatures":false,"hideCursorInOverviewRuler":false,"renderWhitespace":"none","renderControlCharacters":false,"renderIndentGuides":true,"renderLineHighlight":true,"codeLens":true,"folding":true,"glyphMargin":true,"useTabStops":true,"trimAutoWhitespace":true,"stablePeek":false,"formatOnSave":false},"diffEditor":{"renderSideBySide":true,"ignoreTrimWhitespace":true},"emmet":{"triggerExpansionOnTab":true,"preferences":{},"syntaxProfiles":{},"excludeLanguages":[]},"workbench":{"editor":{"showTabs":true,"showIcons":true,"enablePreview":true,"enablePreviewFromQuickOpen":true,"openPositioning":"right"},"quickOpen":{"closeOnFocusLost":true},"settings":{"openDefaultSettings":true},"sideBar":{"location":"left"},"statusBar":{"visible":true}},"window":{"openFilesInNewWindow":true,"reopenFolders":"one","restoreFullscreen":false,"zoomLevel":0},"files":{"exclude":{"**/.git":true,"**/.svn":true,"**/.hg":true,"**/.DS_Store":true},"associations":{"editor":{"fontFamily":"Consolas, 'Courier New', monospace","fontWeight":"normal","fontSize":14,"lineHeight":20,"lineNumbers":"on","rulers":[],"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","tabSize":2,"insertSpaces":true,"detectIndentation":true,"roundedSelection":true,"scrollBeyondLastLine":true,"wrappingColumn":300,"wordWrap":false,"wrappingIndent":"same","mouseWheelScrollSensitivity":1,"quickSuggestions":true,"quickSuggestionsDelay":10,"parameterHints":true,"autoClosingBrackets":true,"formatOnType":false,"suggestOnTriggerCharacters":true,"acceptSuggestionOnEnter":true,"snippetSuggestions":"bottom","emptySelectionClipboard":true,"wordBasedSuggestions":true,"suggestFontSize":0,"suggestLineHeight":0,"tabCompletion":false,"selectionHighlight":true,"overviewRulerLanes":3,"cursorBlinking":"blink","mouseWheelZoom":false,"cursorStyle":"line","fontLigatures":false,"hideCursorInOverviewRuler":false,"renderWhitespace":"none","renderControlCharacters":false,"renderIndentGuides":true,"renderLineHighlight":true,"codeLens":true,"folding":true,"glyphMargin":true,"useTabStops":true,"trimAutoWhitespace":true,"stablePeek":false,"formatOnSave":false},"diffEditor":{"renderSideBySide":true,"ignoreTrimWhitespace":true},"emmet":{"triggerExpansionOnTab":true,"preferences":{},"syntaxProfiles":{},"excludeLanguages":[]},"workbench":{"editor":{"showTabs":true,"showIcons":true,"enablePreview":true,"enablePreviewFromQuickOpen":true,"openPositioning":"right"},"quickOpen":{"closeOnFocusLost":true},"settings":{"openDefaultSettings":true},"sideBar":{"location":"left"},"statusBar":{"visible":true}},"window":{"openFilesInNewWindow":true,"reopenFolders":"one","restoreFullscreen":false,"zoomLevel":0},"files":{"exclude":{"**/.git":true,"**/.svn":true,"**/.hg":true,"**/.DS_Store":true},"associations":{"editor":{"fontFamily":"Consolas, 'Courier New', monospace","fontWeight":"normal","fontSize":14,"lineHeight":20,"lineNumbers":"on","rulers":[],"wordSeparators":"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?","tabSize":2,"insertSpaces":true,"detectIndentation":true,"roundedSelection":true,"scrollBeyondLastLine":true,"wrappingColumn":300,"wordWrap":false,"wrappingIndent":"same","mouseWheelScrollSensitivity":1,"quickSuggestions":true,"quickSuggestionsDelay":10,"parameterHints":true,"autoClosingBrackets":true,"formatOnType":false,"suggestOnTriggerCharacters":true,"acceptSuggestionOnEnter":true,"snippetSuggestions":"bottom","emptySelectionClipboard":true,"wordBasedSuggestions":true,"suggestFontSize":0,"suggestLineHeight":0,"tabCompletion":false,"selectionHighlight":true,"overviewRulerLanes":3,"cursorBlinking":"blink","mouseWheelZoom":false,"cursorStyle":"line","fontLigatures":false,"hideCursorInOverviewRuler":false,"renderWhitespace":"none","renderControlCharacters":false,"renderIndentGuides":true,"renderLineHighlight":true,"codeLens":true,"folding":true,"glyphMargin":true,"useTabStops":true,"trimAutoWhitespace":true,"stablePeek":false,"formatOnSave":false},"diffEditor":{"renderSideBySide":true,"ignoreTrimWhitespace":true},"emmet":{"triggerExpansionOnTab":true,"preferences":{},"syntaxProfiles":{},"excludeLanguages":[]},"workbench":{"editor":{"showTabs":true,"showIcons":true,"enablePreview":true,"enablePreviewFromQuickOpen":true,"openPositioning":"right"},"quickOpen":{"closeOnFocusLost":true},"settings":{"openDefaultSettings":true},"sideBar":{"location":"left"},"statusBar":{"visible":true}},"window":{"openFilesInNewWindow":true,"reopenFolders":"one","restoreFullscreen":false,"zoomLevel":0},"files":{"exclude":{"**/.git":true,"**/.svn":true,"**/.hg":true,"**/.DS_Store":true},"associations":{"*.wxml":"html","*.wxss":"css"},"encoding":"utf8","eol":"\r\n","trimTrailingWhitespace":false,"autoSave":"off","autoSaveDelay":1000,"watcherExclude":{"**/.git/objects/**":true}},"explorer":{"openEditors":{"visible":9,"dynamicHeight":true},"autoReveal":true,"enableDragAndDrop":true},"search":{"exclude":{"**/node_modules":true,"**/bower_components":true},"quickOpen":{"includeSymbols":false}},"git":{"enabled":true,"path":null,"autorefresh":true,"autofetch":true,"enableLongCommitWarning":true,"allowLargeRepositories":false,"confirmSync":true,"countBadge":"all"},"http":{"proxy":"","proxyStrictSSL":true,"proxyAuthorization":null},"css":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"scss":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"less":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"debug":{"allowBreakpointsEverywhere":false,"openExplorerOnEnd":false},"html":{"format":{"enable":true,"wrapLineLength":120,"unformatted":"a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, script, select, small, span, strong, sub, sup, textarea, tt, var","indentInnerHtml":false,"preserveNewLines":true,"maxPreserveNewLines":null,"indentHandlebars":false,"endWithNewline":false,"extraLiners":"head, body, /html"},"suggest":{"angular1":true,"ionic":true,"html5":true}},"json":{"schemas":[],"format":{"enable":true}},"markdown":{"styles":[]},"php":{"validate":{"enable":true,"executablePath":null,"run":"onSave"}},"typescript":{"tsdk":"C:\\Users\\uniqu\\AppData\\Roaming\\npm\\node_modules\\typescript\\lib","check":{"workspaceVersion":true,"tscVersion":false},"tsserver":{"trace":"off"},"useCodeSnippetsOnMethodSuggest":false,"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"javascript":{"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"extensions":{"autoUpdate":false},"terminal":{"integrated":{"shell":{"linux":"sh","osx":"sh","windows":"C:\\WINDOWS\\system32\\cmd.exe"},"shellArgs":{"linux":[],"osx":[],"windows":[]},"fontFamily":"","fontLigatures":false,"fontSize":0,"lineHeight":1.2,"cursorBlinking":false,"setLocaleVariables":false,"commandsToSkipShell":["editor.action.toggleTabFocusMode","workbench.action.debug.continue","workbench.action.debug.restart","workbench.action.debug.run","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.quickOpen","workbench.action.showCommands","workbench.action.terminal.clear","workbench.action.terminal.copySelection","workbench.action.terminal.focus","workbench.action.terminal.focusNext","workbench.action.terminal.focusPrevious","workbench.action.terminal.kill","workbench.action.terminal.new","workbench.action.terminal.paste","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.toggleTerminal"]},"external":{"windowsExec":"%COMSPEC%","osxExec":"Terminal.app","linuxExec":"xterm"}},"problems":{"autoReveal":true},"telemetry":{"enableTelemetry":true,"enableCrashReporter":true},"eslint":{"enable":true,"nodePath":null,"_legacyModuleResolve":false,"options":{},"trace":{"server":"off"},"run":"onType","autoFixOnSave":false},"react":{"beautify":{"onSave":false,"formatter":"prettydiff","configFilePath":".jsbeautifyrc"}},"color-highlight":{"enable":true,"languages":["javascript","scss","css","sass","less","php","xml","html","json"],"matchWords":true,"markerType":"background"},"csscomb":{"preset":{},"ignoreFilesOnSave":[],"supportEmbeddedStyles":true,"formatOnSave":false,"useLatestCore":false},"autoprefixer":{"findExternalAutoprefixer":false,"browsers":["last 2 versions","> 5%"],"formatOnSave":false},"path-autocomplete":{"extensionOnImport":false},"beautify":{"onSave":false,"onSaveIgnore":["**/*+(.|_|-)min.*"],"language":{"js":{"type":["javascript","json"],"filename":[".jshintrc",".jsbeautify"]},"css":["css","scss"],"html":["htm","html"]}},"*.wxml":"html","*.wxss":"css"},"encoding":"utf8","eol":"\r\n","trimTrailingWhitespace":false,"autoSave":"off","autoSaveDelay":1000,"watcherExclude":{"**/.git/objects/**":true}},"explorer":{"openEditors":{"visible":9,"dynamicHeight":true},"autoReveal":true,"enableDragAndDrop":true},"search":{"exclude":{"**/node_modules":true,"**/bower_components":true},"quickOpen":{"includeSymbols":false}},"git":{"enabled":true,"path":null,"autorefresh":true,"autofetch":true,"enableLongCommitWarning":true,"allowLargeRepositories":false,"confirmSync":true,"countBadge":"all"},"http":{"proxy":"","proxyStrictSSL":true,"proxyAuthorization":null},"css":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"scss":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"less":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"debug":{"allowBreakpointsEverywhere":false,"openExplorerOnEnd":false},"html":{"format":{"enable":true,"wrapLineLength":120,"unformatted":"a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, script, select, small, span, strong, sub, sup, textarea, tt, var","indentInnerHtml":false,"preserveNewLines":true,"maxPreserveNewLines":null,"indentHandlebars":false,"endWithNewline":false,"extraLiners":"head, body, /html"},"suggest":{"angular1":true,"ionic":true,"html5":true}},"json":{"schemas":[],"format":{"enable":true}},"markdown":{"styles":[]},"php":{"validate":{"enable":true,"executablePath":null,"run":"onSave"}},"typescript":{"tsdk":"C:\\Users\\uniqu\\AppData\\Roaming\\npm\\node_modules\\typescript\\lib","disableAutomaticTypeAcquisition":false,"check":{"workspaceVersion":true,"tscVersion":false},"tsserver":{"trace":"off"},"useCodeSnippetsOnMethodSuggest":false,"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"javascript":{"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"extensions":{"autoUpdate":false},"terminal":{"integrated":{"shell":{"linux":"sh","osx":"sh","windows":"C:\\WINDOWS\\system32\\cmd.exe"},"shellArgs":{"linux":[],"osx":[],"windows":[]},"fontFamily":"","fontLigatures":false,"fontSize":0,"lineHeight":1.2,"cursorBlinking":false,"setLocaleVariables":false,"commandsToSkipShell":["editor.action.toggleTabFocusMode","workbench.action.debug.continue","workbench.action.debug.restart","workbench.action.debug.run","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.quickOpen","workbench.action.showCommands","workbench.action.terminal.clear","workbench.action.terminal.copySelection","workbench.action.terminal.focus","workbench.action.terminal.focusNext","workbench.action.terminal.focusPrevious","workbench.action.terminal.kill","workbench.action.terminal.new","workbench.action.terminal.paste","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.toggleTerminal"]},"external":{"windowsExec":"%COMSPEC%","osxExec":"Terminal.app","linuxExec":"xterm"}},"problems":{"autoReveal":true},"telemetry":{"enableTelemetry":true,"enableCrashReporter":true},"react":{"beautify":{"onSave":false,"formatter":"prettydiff","configFilePath":".jsbeautifyrc"}},"color-highlight":{"enable":true,"languages":["javascript","scss","css","sass","less","php","xml","html","json"],"matchWords":true,"markerType":"background"},"csscomb":{"preset":{},"ignoreFilesOnSave":[],"supportEmbeddedStyles":true,"formatOnSave":false,"useLatestCore":false},"autoprefixer":{"findExternalAutoprefixer":false,"browsers":["last 2 versions","> 5%"],"formatOnSave":false},"path-autocomplete":{"extensionOnImport":false},"eslint":{"enable":true,"nodePath":null,"_legacyModuleResolve":false,"options":{},"trace":{"server":"off"},"run":"onType","autoFixOnSave":false},"beautify":{"onSave":false,"onSaveIgnore":["**/*+(.|_|-)min.*"],"language":{"js":{"type":["javascript","json"],"filename":[".jshintrc",".jsbeautify"]},"css":["css","scss"],"html":["htm","html"]}},"*.wxml":"html","*.wxss":"css"},"encoding":"utf8","eol":"\r\n","trimTrailingWhitespace":false,"autoSave":"off","autoSaveDelay":1000,"watcherExclude":{"**/.git/objects/**":true}},"explorer":{"openEditors":{"visible":9,"dynamicHeight":true},"autoReveal":true,"enableDragAndDrop":true},"search":{"exclude":{"**/node_modules":true,"**/bower_components":true},"quickOpen":{"includeSymbols":false}},"git":{"enabled":true,"path":null,"autorefresh":true,"autofetch":true,"enableLongCommitWarning":true,"allowLargeRepositories":false,"confirmSync":true,"countBadge":"all"},"http":{"proxy":"","proxyStrictSSL":true,"proxyAuthorization":null},"css":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"scss":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"less":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"debug":{"allowBreakpointsEverywhere":false,"openExplorerOnEnd":false},"html":{"format":{"enable":true,"wrapLineLength":120,"unformatted":"a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, script, select, small, span, strong, sub, sup, textarea, tt, var","indentInnerHtml":false,"preserveNewLines":true,"maxPreserveNewLines":null,"indentHandlebars":false,"endWithNewline":false,"extraLiners":"head, body, /html"},"suggest":{"angular1":true,"ionic":true,"html5":true}},"json":{"schemas":[],"format":{"enable":true}},"markdown":{"styles":[]},"php":{"validate":{"enable":true,"executablePath":null,"run":"onSave"}},"typescript":{"tsdk":"C:\\Users\\uniqu\\AppData\\Roaming\\npm\\node_modules\\typescript\\lib","disableAutomaticTypeAcquisition":false,"check":{"workspaceVersion":true,"tscVersion":false},"tsserver":{"trace":"off"},"useCodeSnippetsOnMethodSuggest":false,"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"javascript":{"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"extensions":{"autoUpdate":false},"terminal":{"integrated":{"shell":{"linux":"sh","osx":"sh","windows":"C:\\WINDOWS\\system32\\cmd.exe"},"shellArgs":{"linux":[],"osx":[],"windows":[]},"fontFamily":"","fontLigatures":false,"fontSize":0,"lineHeight":1.2,"cursorBlinking":false,"setLocaleVariables":false,"commandsToSkipShell":["editor.action.toggleTabFocusMode","workbench.action.debug.continue","workbench.action.debug.restart","workbench.action.debug.run","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.quickOpen","workbench.action.showCommands","workbench.action.terminal.clear","workbench.action.terminal.copySelection","workbench.action.terminal.focus","workbench.action.terminal.focusNext","workbench.action.terminal.focusPrevious","workbench.action.terminal.kill","workbench.action.terminal.new","workbench.action.terminal.paste","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.toggleTerminal"]},"external":{"windowsExec":"%COMSPEC%","osxExec":"Terminal.app","linuxExec":"xterm"}},"problems":{"autoReveal":true},"telemetry":{"enableTelemetry":true,"enableCrashReporter":true},"react":{"beautify":{"onSave":false,"formatter":"prettydiff","configFilePath":".jsbeautifyrc"}},"color-highlight":{"enable":true,"languages":["javascript","scss","css","sass","less","php","xml","html","json"],"matchWords":true,"markerType":"background"},"csscomb":{"preset":{},"ignoreFilesOnSave":[],"supportEmbeddedStyles":true,"formatOnSave":false,"useLatestCore":false},"autoprefixer":{"findExternalAutoprefixer":false,"browsers":["last 2 versions","> 5%"],"formatOnSave":false},"path-autocomplete":{"extensionOnImport":false},"eslint":{"enable":true,"nodePath":null,"_legacyModuleResolve":false,"options":{},"trace":{"server":"off"},"run":"onType","autoFixOnSave":false},"beautify":{"onSave":false,"onSaveIgnore":["**/*+(.|_|-)min.*"],"language":{"js":{"type":["javascript","json"],"filename":[".jshintrc",".jsbeautify"]},"css":["css","scss"],"html":["htm","html"]}},"*.wxml":"html","*.wxss":"css"},"encoding":"utf8","eol":"\r\n","trimTrailingWhitespace":false,"autoSave":"off","autoSaveDelay":1000,"watcherExclude":{"**/.git/objects/**":true}},"explorer":{"openEditors":{"visible":9,"dynamicHeight":true},"autoReveal":true,"enableDragAndDrop":true},"search":{"exclude":{"**/node_modules":true,"**/bower_components":true},"quickOpen":{"includeSymbols":false}},"git":{"enabled":true,"path":null,"autorefresh":true,"autofetch":true,"enableLongCommitWarning":true,"allowLargeRepositories":false,"confirmSync":true,"countBadge":"all"},"http":{"proxy":"","proxyStrictSSL":true,"proxyAuthorization":null},"css":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"scss":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"less":{"validate":true,"lint":{"compatibleVendorPrefixes":"ignore","vendorPrefix":"warning","duplicateProperties":"ignore","emptyRules":"warning","importStatement":"ignore","boxModel":"ignore","universalSelector":"ignore","zeroUnits":"ignore","fontFaceProperties":"warning","hexColorLength":"error","argumentsInColorFunction":"error","unknownProperties":"warning","ieHack":"ignore","unknownVendorSpecificProperties":"ignore","propertyIgnoredDueToDisplay":"warning","important":"ignore","float":"ignore","idSelector":"ignore"}},"debug":{"allowBreakpointsEverywhere":false,"openExplorerOnEnd":false},"html":{"format":{"enable":true,"wrapLineLength":120,"unformatted":"a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, script, select, small, span, strong, sub, sup, textarea, tt, var","indentInnerHtml":false,"preserveNewLines":true,"maxPreserveNewLines":null,"indentHandlebars":false,"endWithNewline":false,"extraLiners":"head, body, /html"},"suggest":{"angular1":true,"ionic":true,"html5":true}},"json":{"schemas":[],"format":{"enable":true}},"markdown":{"styles":[]},"php":{"validate":{"enable":true,"executablePath":null,"run":"onSave"}},"typescript":{"tsdk":"C:\\Users\\uniqu\\AppData\\Roaming\\npm\\node_modules\\typescript\\lib","disableAutomaticTypeAcquisition":false,"check":{"workspaceVersion":true,"tscVersion":false},"tsserver":{"trace":"off"},"useCodeSnippetsOnMethodSuggest":false,"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"javascript":{"validate":{"enable":true},"format":{"enable":true,"insertSpaceAfterCommaDelimiter":true,"insertSpaceAfterSemicolonInForStatements":true,"insertSpaceBeforeAndAfterBinaryOperators":true,"insertSpaceAfterKeywordsInControlFlowStatements":true,"insertSpaceAfterFunctionKeywordForAnonymousFunctions":true,"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":false,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":false,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":false,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false}},"extensions":{"autoUpdate":false},"terminal":{"integrated":{"shell":{"linux":"sh","osx":"sh","windows":"C:\\WINDOWS\\system32\\cmd.exe"},"shellArgs":{"linux":[],"osx":[],"windows":[]},"fontFamily":"","fontLigatures":false,"fontSize":0,"lineHeight":1.2,"cursorBlinking":false,"setLocaleVariables":false,"commandsToSkipShell":["editor.action.toggleTabFocusMode","workbench.action.debug.continue","workbench.action.debug.restart","workbench.action.debug.run","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.quickOpen","workbench.action.showCommands","workbench.action.terminal.clear","workbench.action.terminal.copySelection","workbench.action.terminal.focus","workbench.action.terminal.focusNext","workbench.action.terminal.focusPrevious","workbench.action.terminal.kill","workbench.action.terminal.new","workbench.action.terminal.paste","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.toggleTerminal"]},"external":{"windowsExec":"%COMSPEC%","osxExec":"Terminal.app","linuxExec":"xterm"}},"problems":{"autoReveal":true},"telemetry":{"enableTelemetry":true,"enableCrashReporter":true},"react":{"beautify":{"onSave":false,"formatter":"prettydiff","configFilePath":".jsbeautifyrc"}},"color-highlight":{"enable":true,"languages":["javascript","scss","css","sass","less","php","xml","html","json"],"matchWords":true,"markerType":"background"},"csscomb":{"preset":{},"ignoreFilesOnSave":[],"supportEmbeddedStyles":true,"formatOnSave":false,"useLatestCore":false},"autoprefixer":{"findExternalAutoprefixer":false,"browsers":["last 2 versions","> 5%"],"formatOnSave":false},"path-autocomplete":{"extensionOnImport":false},"eslint":{"enable":true,"nodePath":null,"_legacyModuleResolve":false,"options":{},"trace":{"server":"off"},"run":"onType","autoFixOnSave":false},"beautify":{"onSave":false,"onSaveIgnore":["**/*+(.|_|-)min.*"],"language":{"js":{"type":["javascript","json"],"filename":[".jshintrc",".jsbeautify"]},"css":["css","scss"],"html":["htm","html"]}},"*.wxml":"html","*.wxss":"css"} 3 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 公子小白 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### GitHub Feed 小程序版 2 | 参考:[react-native-gitfeed](https://github.com/xiekw2010/react-native-gitfeed) 3 | 4 | ![](./screenshots/githubfeed.gif) 5 | 6 | ### 已完成的功能 7 | ![](./screenshots/feed.png) 8 | ![](./screenshots/famous.png) 9 | ![](./screenshots/explore.png) 10 | ![](./screenshots/user.png) 11 | 12 | ### 一些痛点 13 | - 不支持 WebView ,故不能使用 OAuth2 获得 GitHub 授权,目前会有每小时 60 次的 API 请求限制 ; 14 | - wx.request() 这个网络请求的 API 封装的太简单粗暴,以至于不能获取响应头中的其他域,如 Link ; 15 | - 不支持 ES2015 原生的 Promise,故不得不引入第三方的 Promise 库,此处使用的是 bluebird ; -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | App({ 2 | onLaunch () { 3 | 4 | } 5 | }); 6 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/explore/explore", 5 | "pages/famous/famous", 6 | "pages/me/me", 7 | "pages/settings/settings", 8 | "pages/auth/onboard/onboard", 9 | "pages/repo/repo", 10 | "pages/org/org", 11 | "pages/user/user", 12 | "pages/follower/follower", 13 | "pages/following/following" 14 | ], 15 | 16 | "window":{ 17 | "navigationBarBackgroundColor": "#4078C0", 18 | "navigationBarTitleText": "Github Feed", 19 | "navigationBarTextStyle": "white", 20 | "backgroundTextStyle": "light", 21 | "enablePullDownRefresh": true 22 | }, 23 | 24 | "tabBar": { 25 | "color": "#9A9A9A", 26 | "selectedColor": "#4078c0", 27 | "backgroundColor": "#F7F7FA", 28 | "borderStyle": "white", 29 | "list": [ 30 | { 31 | "pagePath": "pages/index/index", 32 | "text": "Feed", 33 | "iconPath": "images/tab/index.png", 34 | "selectedIconPath": "images/tab/index@active.png" 35 | }, 36 | { 37 | "pagePath": "pages/explore/explore", 38 | "text": "Explore", 39 | "iconPath": "images/tab/explore.png", 40 | "selectedIconPath": "images/tab/explore@active.png" 41 | }, 42 | { 43 | "pagePath": "pages/famous/famous", 44 | "text": "Famous", 45 | "iconPath": "images/tab/famous.png", 46 | "selectedIconPath": "images/tab/famous@active.png" 47 | }, 48 | { 49 | "pagePath": "pages/me/me", 50 | "text": "Me", 51 | "iconPath": "images/tab/me.png", 52 | "selectedIconPath": "images/tab/me@active.png" 53 | } 54 | ] 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | @import './styles/main.wxss'; 2 | 3 | .container { 4 | position: absolute; 5 | top: 0; 6 | bottom: 0; 7 | left: 0; 8 | right: 0; 9 | box-sizing: border-box; 10 | display: flex; 11 | flex-direction: column; 12 | } 13 | .row { 14 | display: flex; 15 | flex-direction: row; 16 | } 17 | .col { 18 | display: flex; 19 | flex-direction: column; 20 | } 21 | .align_center { 22 | align-items: center; 23 | } 24 | .justify_center { 25 | justify-content: center; 26 | } 27 | .center { 28 | align-items: center; 29 | justify-content: center; 30 | } 31 | view, text { 32 | font-family: 'Segoe UI', '微软雅黑'; 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /images/me/angle-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/me/angle-right.png -------------------------------------------------------------------------------- /images/me/cog_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/me/cog_blue.png -------------------------------------------------------------------------------- /images/me/edit_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/me/edit_blue.png -------------------------------------------------------------------------------- /images/onboard/octocat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/onboard/octocat.png -------------------------------------------------------------------------------- /images/tab/explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/explore.png -------------------------------------------------------------------------------- /images/tab/explore@active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/explore@active.png -------------------------------------------------------------------------------- /images/tab/famous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/famous.png -------------------------------------------------------------------------------- /images/tab/famous@active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/famous@active.png -------------------------------------------------------------------------------- /images/tab/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/index.png -------------------------------------------------------------------------------- /images/tab/index@active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/index@active.png -------------------------------------------------------------------------------- /images/tab/me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/me.png -------------------------------------------------------------------------------- /images/tab/me@active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/tab/me@active.png -------------------------------------------------------------------------------- /images/user/blog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/blog.png -------------------------------------------------------------------------------- /images/user/company.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/company.png -------------------------------------------------------------------------------- /images/user/email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/email.png -------------------------------------------------------------------------------- /images/user/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/location.png -------------------------------------------------------------------------------- /images/user/repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/repo.png -------------------------------------------------------------------------------- /images/user/repo_fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/repo_fork.png -------------------------------------------------------------------------------- /images/user/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/star.png -------------------------------------------------------------------------------- /images/user/time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/images/user/time.png -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "commonjs" 5 | } 6 | } -------------------------------------------------------------------------------- /pages/auth/onboard/onboard.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | import { debounce } from '../../../utils/util'; 3 | import { findUserByName } from '../../helpers/auth'; 4 | 5 | Page({ 6 | data: { 7 | error_msg_hidden: true 8 | }, 9 | 10 | onLoad() { 11 | this.setData({ 12 | avatar_url: '/images/onboard/octocat.png' 13 | }); 14 | }, 15 | 16 | onShareAppMessage: function(){ 17 | return { 18 | title: 'Github Feed', 19 | desc: '你的另一个 GitHub 客户端', 20 | path: '/pages/auth/onboard/onboard' 21 | }; 22 | }, 23 | 24 | handleOnboardSubmit(e) { 25 | const name = e.detail.value.username; 26 | 27 | findUserByName(name) 28 | .then((res) => { 29 | console.log(res); 30 | if (res.statusCode === 200) { 31 | const user = { username: name, avatar_url: res.data.avatar_url }; 32 | 33 | wx.setStorageSync('user', user); 34 | wx.switchTab({ 35 | url: '../../index/index', 36 | }); 37 | } else { 38 | this.setData({ 39 | avatar_url: '/images/onboard/octocat.png', 40 | error_msg_hidden: false 41 | }); 42 | } 43 | }); 44 | }, 45 | 46 | handleInputChange: debounce(isUserExisted, 1000) 47 | }); 48 | 49 | function isUserExisted(e) { 50 | const name = e.detail.value; 51 | 52 | findUserByName(name) 53 | .then((res) => { 54 | const currentPage = getCurrentPages()[getCurrentPages().length - 1]; 55 | 56 | if (res.statusCode === 200) { 57 | currentPage.setData({ 58 | avatar_url: res.data.avatar_url, 59 | error_msg_hidden: true 60 | }); 61 | } else { 62 | currentPage.setData({ 63 | avatar_url: '/images/onboard/octocat.png', 64 | error_msg_hidden: false 65 | }); 66 | } 67 | }); 68 | }; 69 | -------------------------------------------------------------------------------- /pages/auth/onboard/onboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "上船" 3 | } 4 | -------------------------------------------------------------------------------- /pages/auth/onboard/onboard.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 |
10 |
11 | -------------------------------------------------------------------------------- /pages/auth/onboard/onboard.wxss: -------------------------------------------------------------------------------- 1 | .avatar { 2 | margin-top: 50rpx; 3 | width: 400rpx; 4 | height: 400rpx; 5 | } 6 | .error_view { 7 | height: 50rpx; 8 | } 9 | .error_text { 10 | font-size: 30rpx; 11 | color: #f00; 12 | } 13 | form { 14 | width: 100%; 15 | box-sizing: border-box; 16 | padding: 20rpx; 17 | } 18 | input { 19 | border-bottom: 1rpx solid #1AAD19; 20 | margin-bottom: 20rpx; 21 | font-size: 30rpx; 22 | } 23 | .placeholder { 24 | font-size: 25rpx; 25 | } 26 | -------------------------------------------------------------------------------- /pages/explore/explore.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | import { fetch } from '../../utils/services'; 3 | import languageList from '../../utils/language_list'; 4 | 5 | Page({ 6 | data: { 7 | languageList: languageList, 8 | languageIndex: 0, 9 | tabList: ['Daily', 'Weekly', 'Monthly'], 10 | tabIndex: 0 11 | }, 12 | 13 | onLoad() { 14 | this.refreshData(); 15 | }, 16 | 17 | onPullDownRefresh() { 18 | this.refreshData(); 19 | }, 20 | 21 | _reloadUrl() { 22 | // const basic_url = 'http://trending.codehub-app.com/v2/trending?since='; 23 | const basic_url = 'https://arguments.cn/api/trending?since='; 24 | 25 | // locationIndex may be 0 or '0' 26 | if (this.data.languageIndex == 0) { 27 | return basic_url + this.data.tabList[this.data.tabIndex].toLowerCase(); 28 | } 29 | return `${basic_url}${this.data.tabList[this.data.tabIndex].toLowerCase()}&language=${this.data.languageList[this.data.languageIndex].toLowerCase()}`; 30 | }, 31 | 32 | handleLanguagePickerChange(e) { 33 | this.setData({ 34 | languageIndex: e.detail.value 35 | }); 36 | this.fetchReposData(this._reloadUrl()); 37 | }, 38 | 39 | handleTabPickerChange(e) { 40 | this.setData({ 41 | tabIndex: e.detail.value 42 | }); 43 | this.fetchReposData(this._reloadUrl()); 44 | }, 45 | 46 | fetchReposData(url) { 47 | this.showLoadingToast(); 48 | fetch(url).then(res => { 49 | if (res.statusCode === 200) { 50 | this.setData({ items: res.data }); 51 | } else { 52 | console.log('# Request Error #', res); 53 | } 54 | this.hideLoadingToast(); 55 | }); 56 | }, 57 | 58 | refreshData() { 59 | this.fetchReposData(this._reloadUrl()); 60 | }, 61 | 62 | showLoadingToast() { 63 | wx.showLoading({ 64 | title: 'Loading', 65 | mask: true 66 | }); 67 | }, 68 | 69 | hideLoadingToast() { 70 | wx.hideLoading(); 71 | } 72 | }); 73 | -------------------------------------------------------------------------------- /pages/explore/explore.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "Popular Repos" 3 | } 4 | -------------------------------------------------------------------------------- /pages/explore/explore.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 挑选语言:{{languageList[languageIndex]}} 7 | 8 | 9 | 10 | 11 | 挑选时间:{{tabList[tabIndex]}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {{item.full_name}} 24 | {{item.language ? item.language : ''}} 25 | 26 | {{item.stargazers_count}} 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /pages/explore/explore.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background: rgba(255,255,255,0.8); 3 | } 4 | .explore { 5 | flex: 1; 6 | } 7 | .pickers { 8 | height: 13%; 9 | box-sizing: border-box; 10 | justify-content: space-around; 11 | padding: 20rpx; 12 | } 13 | .picker_text { 14 | font-size: 30rpx; 15 | } 16 | scroll-view { 17 | height: 87%; 18 | } 19 | .repo_item { 20 | padding: 20rpx; 21 | border-bottom: 1rpx solid #E2E2E2; 22 | } 23 | .avatar { 24 | width: 80rpx; 25 | height: 80rpx; 26 | } 27 | .full_name { 28 | font-size: 25rpx; 29 | } 30 | .language { 31 | margin-top: 5rpx; 32 | font-size: 20rpx; 33 | } 34 | .stargazers_count { 35 | font-size: 20rpx; 36 | } 37 | .avatar { 38 | width: 80rpx; 39 | height: 80rpx; 40 | padding-right: 20rpx; 41 | } 42 | -------------------------------------------------------------------------------- /pages/famous/famous.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | import { fetch } from '../../utils/services'; 3 | import languageList from '../../utils/language_list'; 4 | import countryList from '../../utils/country_list'; 5 | 6 | Page({ 7 | data: { 8 | locationList: countryList, 9 | locationIndex: 2, 10 | languageList: languageList, 11 | languageIndex: 12, 12 | items: [], 13 | page: 1, 14 | incomplete_results: false 15 | }, 16 | 17 | onLoad() { 18 | this.refreshData(); 19 | }, 20 | 21 | onPullDownRefresh() { 22 | this.refreshData(); 23 | }, 24 | 25 | _reloadUrl() { 26 | const basic_url = 'https://api.github.com/search/users?q='; 27 | 28 | // locationIndex may be 0 or '0' 29 | if (this.data.locationIndex == 0) { 30 | return `${basic_url}language:${this.data.languageList[this.data.languageIndex]}&sort=followers&page=${this.data.page}`; 31 | } 32 | if (this.data.languageIndex == 0) { 33 | return `${basic_url}location:${this.data.locationList[this.data.locationIndex]}&sort=followers&page=${this.data.page}`; 34 | } 35 | return `${basic_url}location:${this.data.locationList[this.data.locationIndex]}+language:${this.data.languageList[this.data.languageIndex]}&sort=followers&page=${this.data.page}`; 36 | }, 37 | 38 | _initData() { 39 | this.setData({ 40 | items: [], 41 | page: 1, 42 | incomplete_results: false 43 | }); 44 | }, 45 | 46 | fetchUsersData(url) { 47 | this.showLoadingToast(); 48 | fetch(url).then(res => { 49 | if (res.statusCode === 200) { 50 | this.setData({ 51 | items: this.data.items.concat(res.data.items), 52 | page: 1, 53 | incomplete_results: res.data.incomplete_results 54 | }); 55 | } else { 56 | console.log('# Request Error #', res); 57 | } 58 | this.hideLoadingToast(); 59 | }); 60 | }, 61 | 62 | handleLocationPickerChange(e) { 63 | if (this.data.languageIndex || e.detail.value) { 64 | this.setData({ 65 | locationIndex: e.detail.value 66 | }); 67 | this._initData(); 68 | this.fetchUsersData(this._reloadUrl()); 69 | } 70 | }, 71 | 72 | handleLanguagePickerChange(e) { 73 | if (this.data.locationIndex || e.detail.value) { 74 | this.setData({ 75 | languageIndex: e.detail.value 76 | }); 77 | this._initData(); 78 | this.fetchUsersData(this._reloadUrl()); 79 | } 80 | }, 81 | 82 | loadMoreData() { 83 | if (this.data.incomplete_results) return; 84 | this.setData({ 85 | page: ++this.data.page 86 | }); 87 | this.fetchUsersData(this._reloadUrl()); 88 | }, 89 | 90 | refreshData() { 91 | this._initData(); 92 | this.fetchUsersData(this._reloadUrl()); 93 | }, 94 | 95 | showLoadingToast() { 96 | wx.showLoading({ 97 | title: 'Loading', 98 | mask: true 99 | }); 100 | }, 101 | 102 | hideLoadingToast() { 103 | wx.hideLoading(); 104 | } 105 | }); 106 | -------------------------------------------------------------------------------- /pages/famous/famous.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "Popular Users" 3 | } 4 | -------------------------------------------------------------------------------- /pages/famous/famous.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 挑选地区:{{locationList[locationIndex]}} 7 | 8 | 9 | 10 | 11 | 挑选语言:{{languageList[languageIndex]}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | {{item.login}} 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /pages/famous/famous.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background: rgba(255,255,255,0.8); 3 | } 4 | .famous { 5 | flex: 1; 6 | } 7 | .pickers { 8 | height: 13%; 9 | box-sizing: border-box; 10 | justify-content: space-around; 11 | padding: 20rpx; 12 | } 13 | .picker_text { 14 | font-size: 30rpx; 15 | } 16 | scroll-view { 17 | height: 87%; 18 | } 19 | .user_item { 20 | padding: 20rpx; 21 | border-bottom: 1rpx solid #E2E2E2; 22 | } 23 | .avatar { 24 | width: 80rpx; 25 | height: 80rpx; 26 | margin-right: 20rpx; 27 | } 28 | .username { 29 | font-size: 25rpx; 30 | font-weight: bold; 31 | } 32 | -------------------------------------------------------------------------------- /pages/follower/follower.js: -------------------------------------------------------------------------------- 1 | import services from '../../utils/services'; 2 | 3 | Page({ 4 | data: { 5 | items: [], 6 | page: 1 7 | }, 8 | 9 | onLoad(options) { 10 | this.setData({ 11 | user_name: options.login 12 | }); 13 | 14 | this.fetchFollowersData(this._reloadUrl()); 15 | }, 16 | 17 | _reloadUrl() { 18 | return `https://api.github.com/users/${this.data.user_name}/followers?page=${this.data.page}`; 19 | }, 20 | 21 | fetchFollowersData(url) { 22 | this.showLoadingToast(); 23 | services.fetch(url).then(res => { 24 | if (res.data) { 25 | this.setData({ 26 | items: this.data.items.concat(res.data), 27 | }); 28 | this.hideLoadingToast(); 29 | } 30 | }); 31 | }, 32 | 33 | loadMoreData() { 34 | this.setData({ 35 | page: ++this.data.page 36 | }); 37 | this.fetchFollowersData(this._reloadUrl()); 38 | }, 39 | 40 | showLoadingToast() { 41 | wx.showToast({ 42 | title: 'Loading', 43 | icon: 'loading', 44 | duration: 10000 45 | }); 46 | }, 47 | 48 | hideLoadingToast() { 49 | wx.hideToast(); 50 | } 51 | }); -------------------------------------------------------------------------------- /pages/follower/follower.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "Followers" 3 | } 4 | -------------------------------------------------------------------------------- /pages/follower/follower.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{item.login}} 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /pages/follower/follower.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background: rgba(255,255,255,0.8); 3 | } 4 | .follower { 5 | display: flex; 6 | flex: 1; 7 | } 8 | scroll-view { 9 | height: 100%; 10 | } 11 | .user_item { 12 | padding: 20rpx; 13 | border-bottom: 1rpx solid #E2E2E2; 14 | } 15 | .avatar { 16 | width: 80rpx; 17 | height: 80rpx; 18 | margin-right: 20rpx; 19 | } 20 | .username { 21 | font-size: 25rpx; 22 | font-weight: bold; 23 | } 24 | -------------------------------------------------------------------------------- /pages/following/following.js: -------------------------------------------------------------------------------- 1 | import services from '../../utils/services'; 2 | 3 | Page({ 4 | data: { 5 | items: [], 6 | page: 1 7 | }, 8 | 9 | onLoad(options) { 10 | this.setData({ 11 | user_name: options.login 12 | }); 13 | 14 | this.fetchFollowingsData(this._reloadUrl()); 15 | }, 16 | 17 | _reloadUrl() { 18 | return `https://api.github.com/users/${this.data.user_name}/following?page=${this.data.page}`; 19 | }, 20 | 21 | fetchFollowingsData(url) { 22 | this.showLoadingToast(); 23 | services.fetch(url).then(res => { 24 | if (res.data) { 25 | this.setData({ 26 | items: this.data.items.concat(res.data), 27 | }); 28 | this.hideLoadingToast(); 29 | } 30 | }); 31 | }, 32 | 33 | loadMoreData() { 34 | this.setData({ 35 | page: ++this.data.page 36 | }); 37 | this.fetchFollowingsData(this._reloadUrl()); 38 | }, 39 | 40 | showLoadingToast() { 41 | wx.showToast({ 42 | title: 'Loading', 43 | icon: 'loading', 44 | duration: 10000 45 | }); 46 | }, 47 | 48 | hideLoadingToast() { 49 | wx.hideToast(); 50 | } 51 | }); -------------------------------------------------------------------------------- /pages/following/following.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "Following" 3 | } 4 | -------------------------------------------------------------------------------- /pages/following/following.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{item.login}} 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /pages/following/following.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background: rgba(255,255,255,0.8); 3 | } 4 | .following { 5 | display: flex; 6 | flex: 1; 7 | } 8 | scroll-view { 9 | height: 100%; 10 | } 11 | .user_item { 12 | padding: 20rpx; 13 | border-bottom: 1rpx solid #E2E2E2; 14 | } 15 | .avatar { 16 | width: 80rpx; 17 | height: 80rpx; 18 | margin-right: 20rpx; 19 | } 20 | .username { 21 | font-size: 25rpx; 22 | font-weight: bold; 23 | } 24 | -------------------------------------------------------------------------------- /pages/helpers/auth.js: -------------------------------------------------------------------------------- 1 | import { fetch } from '../../utils/services'; 2 | 3 | export const findUserByName = (name) => { 4 | const url = 'https://api.github.com/users/' + name; 5 | 6 | return fetch(url); 7 | } 8 | -------------------------------------------------------------------------------- /pages/helpers/index.js: -------------------------------------------------------------------------------- 1 | export const formateActionType = (type) => { 2 | switch (type) { 3 | case 'CreateEvent': 4 | return 'Create'; 5 | case 'DeleteEvent': 6 | return 'Delete'; 7 | case 'ForkEvent': 8 | return 'Forked'; 9 | case 'WatchEvent': 10 | return 'Started'; 11 | case 'PushEvent': 12 | return 'Pushed'; 13 | case 'PullRequestEvent': 14 | return 'Pull Request'; 15 | case 'IssuesEvent': 16 | return 'Create Issue' 17 | case 'IssueCommentEvent': 18 | return 'Comment Issue'; 19 | case 'MemberEvent': 20 | return 'Add Member' 21 | case 'PullRequestReviewCommentEvent': 22 | return 'Pull Request Review'; 23 | default: 24 | return 'Started'; 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | import { fetch } from '../../utils/services'; 3 | import { timesAgo } from '../../utils/util' 4 | import { formateActionType } from '../helpers/index'; 5 | 6 | Page({ 7 | data: { 8 | items: [], 9 | page: 1 10 | }, 11 | 12 | onLoad() { 13 | const user = wx.getStorageSync('user'); 14 | 15 | console.log('#user#', user); 16 | if (!user) { 17 | wx.redirectTo({ 18 | url: '../auth/onboard/onboard' 19 | }); 20 | } else { 21 | this.refreshData(); 22 | } 23 | }, 24 | 25 | onPullDownRefresh() { 26 | this.refreshData(); 27 | }, 28 | 29 | _reloadUrl() { 30 | const basic_url = 'https://api.github.com/users/uniquexiaobai/received_events?page='; 31 | 32 | return basic_url + this.data.page; 33 | }, 34 | 35 | _initData() { 36 | this.setData({ 37 | items: [], 38 | page: 1 39 | }); 40 | }, 41 | 42 | fetchEventsData(url) { 43 | fetch(url).then(res => { 44 | if (res.statusCode === 200) { 45 | res.data.forEach(item => { 46 | item.type = formateActionType(item.type); 47 | item.created_at = timesAgo(item.created_at); 48 | }); 49 | this.setData({ 50 | items: this.data.items.concat(res.data) 51 | }); 52 | } else { 53 | console.log('# Request Error #', res); 54 | } 55 | this.hideLoadingToast(); 56 | }); 57 | }, 58 | 59 | loadMoreData() { 60 | this.showLoadingToast(); 61 | this.setData({ 62 | page: ++this.data.page 63 | }); 64 | this.fetchEventsData(this._reloadUrl()); 65 | }, 66 | 67 | refreshData() { 68 | this.showLoadingToast(); 69 | this._initData(); 70 | this.fetchEventsData(this._reloadUrl()); 71 | }, 72 | 73 | showLoadingToast() { 74 | wx.showLoading({ 75 | title: 'Loading', 76 | mask: true 77 | }); 78 | }, 79 | 80 | hideLoadingToast() { 81 | wx.hideLoading(); 82 | } 83 | }); 84 | -------------------------------------------------------------------------------- /pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {{item.actor.display_login}} 14 | 15 | 16 | {{item.created_at}} 17 | 18 | 19 | 20 | 21 | {{item.type}} 22 | 23 | 24 | {{item.repo.name}} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background: rgba(255,255,255,0.8); 3 | } 4 | scroll-view { 5 | width: 100%; 6 | height: 100%; 7 | } 8 | .received_events { 9 | border-bottom: 1rpx solid #E2E2E2; 10 | padding: 15rpx; 11 | } 12 | .actor_avatar { 13 | width: 80rpx; 14 | height: 80rpx; 15 | margin-right: 20rpx; 16 | } 17 | .actor_name { 18 | font-size: 25rpx; 19 | } 20 | .created_at { 21 | margin-top: 5rpx; 22 | font-size: 20rpx; 23 | } 24 | .action_type { 25 | font-size: 25rpx; 26 | font-weight: bold; 27 | margin-right: 20rpx; 28 | } 29 | .action_repo { 30 | font-size: 25rpx; 31 | } 32 | -------------------------------------------------------------------------------- /pages/me/me.js: -------------------------------------------------------------------------------- 1 | const app = getApp(); 2 | 3 | Page({ 4 | data: { 5 | 6 | }, 7 | 8 | onReady() { 9 | const user = wx.getStorageSync('user'); 10 | 11 | if (user) { 12 | this.setData({ user: user }); 13 | } 14 | }, 15 | 16 | goRouteSettings() { 17 | wx.navigateTo({ 18 | url: '../settings/settings' 19 | }); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /pages/me/me.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "Me" 3 | } -------------------------------------------------------------------------------- /pages/me/me.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{user.username}} 6 | 7 | 8 | 9 | 10 | 11 | Edit Profile 12 | 13 | 14 | 15 | 16 | Settings 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /pages/me/me.wxss: -------------------------------------------------------------------------------- 1 | .me { 2 | height: 100%; 3 | background: #F0EFF5; 4 | } 5 | .item { 6 | display: flex; 7 | align-items: center; 8 | justify-content: space-between; 9 | padding: 8px 10px; 10 | margin-top: 20px; 11 | background: #fff; 12 | } 13 | .avatar { 14 | width: 40px; 15 | height: 40px; 16 | border: 1px solid #9A9A9A; 17 | margin-right: 10px; 18 | } 19 | .icon { 20 | width: 48rpx; 21 | height: 48rpx; 22 | margin-right: 20px; 23 | } 24 | .icon-right { 25 | width: 48rpx; 26 | height: 48rpx; 27 | margin-right: -15rpx; 28 | } 29 | .flex1 { 30 | flex: 1; 31 | } 32 | text { 33 | font-size: 30rpx; 34 | } 35 | -------------------------------------------------------------------------------- /pages/org/org.js: -------------------------------------------------------------------------------- 1 | // pages/org/org.js 2 | Page({ 3 | data:{}, 4 | onLoad:function(options){ 5 | // 页面初始化 options为页面跳转所带来的参数 6 | console.log('#org#', options.org_url); 7 | }, 8 | onReady:function(){ 9 | // 页面渲染完成 10 | }, 11 | onShow:function(){ 12 | // 页面显示 13 | }, 14 | onHide:function(){ 15 | // 页面隐藏 16 | }, 17 | onUnload:function(){ 18 | // 页面关闭 19 | } 20 | }) -------------------------------------------------------------------------------- /pages/org/org.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/org/org.wxml: -------------------------------------------------------------------------------- 1 | 2 | pages/org/org.wxml 3 | -------------------------------------------------------------------------------- /pages/org/org.wxss: -------------------------------------------------------------------------------- 1 | /* pages/org/org.wxss */ -------------------------------------------------------------------------------- /pages/repo/repo.js: -------------------------------------------------------------------------------- 1 | import { fetch } from '../../utils/services'; 2 | 3 | Page({ 4 | onLoad(options) { 5 | this.setData({ 6 | repo_full_name: options.repo_full_name 7 | }); 8 | 9 | this.fetchRepoData(this._reloadUrl()); 10 | }, 11 | 12 | onReady() { 13 | wx.setNavigationBarTitle({ 14 | title: this.data.repo_full_name 15 | }); 16 | }, 17 | 18 | _reloadUrl() { 19 | const basic_url = 'https://api.github.com/repos/'; 20 | 21 | return basic_url + this.data.repo_full_name; 22 | }, 23 | 24 | fetchRepoData(url) { 25 | this.showLoadingToast(); 26 | fetch(url).then(res => { 27 | if (res.statusCode === 200) { 28 | this.setData({ repo: res.data }); 29 | } else { 30 | console.log('# Request Error #', res); 31 | } 32 | this.hideLoadingToast(); 33 | }); 34 | }, 35 | 36 | showLoadingToast() { 37 | wx.showLoading({ 38 | title: 'Loading', 39 | mask: true 40 | }); 41 | }, 42 | 43 | hideLoadingToast() { 44 | wx.hideLoading(); 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /pages/repo/repo.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/repo/repo.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{repo.owner.login}} 7 | 8 | 9 | Watch 10 | {{repo.subscribers_count}} 11 | 12 | 13 | Star 14 | {{repo.watchers_count}} 15 | 16 | 17 | {{repo.description}} 18 | 19 | 20 | -------------------------------------------------------------------------------- /pages/repo/repo.wxss: -------------------------------------------------------------------------------- 1 | .repo_header { 2 | padding: 5rpx; 3 | justify-content: space-between; 4 | padding: 10rpx; 5 | padding-right: 50rpx; 6 | border-bottom: 1rpx solid #E2E2E2; 7 | } 8 | .avatar { 9 | width: 50rpx; 10 | height: 50rpx; 11 | margin-right: 5rpx; 12 | } 13 | .owner_name { 14 | font-size: 25rpx; 15 | } 16 | .watch { 17 | font-size: 25rpx; 18 | background: #F0F0F0; 19 | border-radius: 5rpx; 20 | margin-right: 10rpx; 21 | padding: 5rpx; 22 | padding-left: 10rpx; 23 | padding-right: 10rpx; 24 | } 25 | .watch_number { 26 | font-size: 25rpx; 27 | } 28 | .repo_desc { 29 | padding: 20rpx; 30 | font-size: 25rpx; 31 | } 32 | -------------------------------------------------------------------------------- /pages/settings/settings.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | handleLogoutTap() { 3 | wx.clearStorageSync(); 4 | wx.redirectTo({ 5 | url: '../auth/onboard/onboard' 6 | }); 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /pages/settings/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "Settings" 3 | } 4 | -------------------------------------------------------------------------------- /pages/settings/settings.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /pages/settings/settings.wxss: -------------------------------------------------------------------------------- 1 | .settings { 2 | height: 100%; 3 | padding: 20rpx; 4 | } 5 | .logout { 6 | width: 100%; 7 | background-color: #f61d4b; 8 | color: #fff; 9 | font-weight: bold; 10 | } 11 | -------------------------------------------------------------------------------- /pages/user/user.js: -------------------------------------------------------------------------------- 1 | import { fetch } from '../../utils/services'; 2 | 3 | Page({ 4 | onLoad(options) { 5 | this.setData({ 6 | user_name: options.user_name 7 | }); 8 | 9 | const user_url = `https://api.github.com/users/${this.data.user_name}`; 10 | this.fetchUserData(user_url); 11 | }, 12 | 13 | onReady() { 14 | wx.setNavigationBarTitle({ 15 | title: this.data.user_name 16 | }); 17 | }, 18 | 19 | fetchUserData(url) { 20 | let user; 21 | 22 | this.showLoadingToast(); 23 | fetch(url).then(res => { 24 | if (res.statusCode === 200) { 25 | user = res.data; 26 | return fetch(user.organizations_url); 27 | } 28 | }).then(res => { 29 | if (res.statusCode === 200) { 30 | user.orgs = res.data; 31 | return fetch(`${user.repos_url}?sort=updated`); 32 | } 33 | }).then(res => { 34 | if (res.statusCode === 200) { 35 | user.repos = res.data; 36 | console.log('#user#', user); 37 | this.setData({ user: user }); 38 | } 39 | this.hideLoadingToast(); 40 | }); 41 | }, 42 | 43 | showLoadingToast() { 44 | wx.showLoading({ 45 | title: 'Loading', 46 | mask: true 47 | }); 48 | }, 49 | 50 | hideLoadingToast() { 51 | wx.hideLoading(); 52 | } 53 | }); -------------------------------------------------------------------------------- /pages/user/user.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/user/user.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | Organizations 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | {{user.followers}} 36 | Followers 37 | 38 | 39 | 40 | 41 | 0 42 | Starred 43 | 44 | 45 | 46 | 47 | {{user.following}} 48 | Following 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {{item.name}} 61 | {{item.description || ''}} 62 | 63 | 64 | {{item.language || ''}} 65 | {{item.stargazers_count}} 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /pages/user/user.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background: rgba(255,255,255,0.8); 3 | } 4 | .user { 5 | flex: 1; 6 | } 7 | 8 | .user_info { 9 | padding: 20rpx; 10 | padding-bottom: 10rpx; 11 | margin-bottom: 15rpx; 12 | } 13 | .user_info_left { 14 | padding-top: 10rpx; 15 | margin-right: 20rpx; 16 | } 17 | .icon-info { 18 | width: 38rpx; 19 | height: 38rpx; 20 | margin-right: 10rpx; 21 | } 22 | .user_info_left image { 23 | width: 200rpx; 24 | height: 200rpx; 25 | } 26 | .user_name { 27 | font-size: 35rpx; 28 | font-weight: bold; 29 | } 30 | .user_login { 31 | font-size: 28rpx; 32 | margin-bottom: 15rpx; 33 | } 34 | .user_company { 35 | font-size: 28rpx; 36 | margin-bottom: 5rpx; 37 | } 38 | .user_location { 39 | font-size: 28rpx; 40 | margin-bottom: 5rpx; 41 | } 42 | .user_email { 43 | font-size: 28rpx; 44 | margin-bottom: 5rpx; 45 | } 46 | .user_blog { 47 | font-size: 28rpx; 48 | margin-bottom: 5rpx; 49 | } 50 | .user_created_at { 51 | font-size: 28rpx; 52 | } 53 | 54 | .user_orgs { 55 | font-size: 35rpx; 56 | font-weight: bold; 57 | padding: 20rpx; 58 | padding-top: 10rpx; 59 | padding-bottom: 10rpx; 60 | margin-bottom: 20rpx; 61 | border-bottom: 1rpx solid #E2E2E2; 62 | } 63 | .user_orgs_title { 64 | margin-bottom: 10rpx; 65 | } 66 | .user_orgs_list { 67 | flex-wrap: wrap; 68 | } 69 | .user_orgs_list__image { 70 | margin: 5rpx; 71 | width: 55rpx; 72 | height: 55rpx; 73 | } 74 | 75 | .user_status { 76 | padding: 10rpx 20rpx; 77 | } 78 | .user_status_info { 79 | padding: 0 50rpx; 80 | } 81 | .user_status_info__view { 82 | flex: 1; 83 | margin-top: 10rpx; 84 | } 85 | .user_status_info__view view { 86 | font-weight: bold; 87 | font-size: 35rpx; 88 | } 89 | .user_status_info__view text { 90 | font-size: 30rpx; 91 | } 92 | 93 | .user_repos { 94 | margin-top: 10rpx; 95 | } 96 | .user_repo { 97 | border-top: 1px solid #E2E2E2; 98 | padding: 12rpx 20rpx; 99 | } 100 | .icon-repo { 101 | width: 45rpx; 102 | height: 45rpx; 103 | margin-top: 5rpx; 104 | } 105 | .user_repo_center { 106 | flex: 1 0 350rpx; 107 | margin-left: 15rpx; 108 | } 109 | .user_repo_name { 110 | font-weight: bold; 111 | font-size: 34rpx; 112 | } 113 | .user_repo_desc { 114 | font-size: 25rpx; 115 | margin-top: 10rpx; 116 | padding-right: 50rpx; 117 | } 118 | .user_repo_right { 119 | align-items: flex-end; 120 | } 121 | .user_repo_language { 122 | height: 38rpx; 123 | font-size: 28rpx; 124 | margin-bottom: 10rpx; 125 | } 126 | .user_repo_star_count { 127 | font-size: 28rpx; 128 | display: flex; 129 | align-items: flex-end; 130 | } 131 | .icon-star { 132 | width: 40rpx; 133 | height: 40rpx; 134 | } -------------------------------------------------------------------------------- /screenshots/explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/screenshots/explore.png -------------------------------------------------------------------------------- /screenshots/famous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/screenshots/famous.png -------------------------------------------------------------------------------- /screenshots/feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/screenshots/feed.png -------------------------------------------------------------------------------- /screenshots/githubfeed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/screenshots/githubfeed.gif -------------------------------------------------------------------------------- /screenshots/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uniquexiaobai/wechat-app-githubfeed/96944961d7179b194eaaf78de8b8a57eadfa913d/screenshots/user.png -------------------------------------------------------------------------------- /styles/_var.wxss: -------------------------------------------------------------------------------- 1 | /* color */ 2 | .color_black { 3 | color: #333333; 4 | } 5 | .color_gray { 6 | color: #9A9A9A; 7 | } 8 | .color_blue { 9 | color: #4078C0; 10 | } 11 | 12 | .borderColor { 13 | color: #E2E2E2; 14 | } 15 | -------------------------------------------------------------------------------- /styles/main.wxss: -------------------------------------------------------------------------------- 1 | 2 | @import './_var.wxss'; 3 | @import './widget/_button.wxss'; -------------------------------------------------------------------------------- /styles/widget/_button.wxss: -------------------------------------------------------------------------------- 1 | .btn { 2 | width: 100%; 3 | } -------------------------------------------------------------------------------- /typings/wx.d.ts: -------------------------------------------------------------------------------- 1 | // generate time:2017-5-9 09:37:03 2 | // Type definitions for wx app 3 | // Definitions by: hellopao 4 | 5 | /************************************************ 6 | * * 7 | * 微信小程序 API * 8 | * * 9 | ************************************************/ 10 | 11 | interface IAnimation { 12 | /** 13 | * 透明度,参数范围 0~1 14 | */ 15 | opacity(value: number): IAnimation; 16 | /** 17 | * 颜色值 18 | */ 19 | backgroundColor(color: string): IAnimation; 20 | /** 21 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 22 | */ 23 | width(length: number): IAnimation; 24 | /** 25 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 26 | */ 27 | height(length: number): IAnimation; 28 | /** 29 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 30 | */ 31 | top(length: number): IAnimation; 32 | /** 33 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 34 | */ 35 | left(length: number): IAnimation; 36 | /** 37 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 38 | */ 39 | bottom(length: number): IAnimation; 40 | /** 41 | * 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 42 | */ 43 | right(length: number): IAnimation; 44 | /** 45 | * deg的范围-180~180,从原点顺时针旋转一个deg角度 46 | */ 47 | rotate(deg: number): IAnimation; 48 | /** 49 | * deg的范围-180~180,在X轴旋转一个deg角度 50 | */ 51 | rotateX(deg: number): IAnimation; 52 | /** 53 | * deg的范围-180~180,在Y轴旋转一个deg角度 54 | */ 55 | rotateY(deg: number): IAnimation; 56 | /** 57 | * deg的范围-180~180,在Z轴旋转一个deg角度 58 | */ 59 | rotateZ(deg: number): IAnimation; 60 | /** 61 | * 同transform-function rotate3d 62 | */ 63 | rotate3d(x: number, y: number, z: number, deg: number): IAnimation; 64 | /** 65 | * 一个参数时,表示在X轴、Y轴同时缩放sx倍数;两个参数时表示在X轴缩放sx倍数,在Y轴缩放sy倍数 66 | */ 67 | scale(sx: number, sy?: number): IAnimation; 68 | /** 69 | * 在X轴缩放sx倍数 70 | */ 71 | scaleX(sx: number): IAnimation; 72 | /** 73 | * 在Y轴缩放sy倍数 74 | */ 75 | scaleY(sy: number): IAnimation; 76 | /** 77 | * 在Z轴缩放sy倍数 78 | */ 79 | scaleZ(sz: number): IAnimation; 80 | /** 81 | * 在X轴缩放sx倍数,在Y轴缩放sy倍数,在Z轴缩放sz倍数 82 | */ 83 | scale3d(sx: number, sy: number, sz: number): IAnimation; 84 | /** 85 | * 一个参数时,表示在X轴偏移tx,单位px;两个参数时,表示在X轴偏移tx,在Y轴偏移ty,单位px。 86 | */ 87 | translate(tx: number, ty?: number): IAnimation; 88 | /** 89 | * 在X轴偏移tx,单位px 90 | */ 91 | translateX(tx: number): IAnimation; 92 | /** 93 | * 在Y轴偏移tx,单位px 94 | */ 95 | translateY(tx: number): IAnimation; 96 | /** 97 | * 在Z轴偏移tx,单位px 98 | */ 99 | translateZ(tx: number): IAnimation; 100 | /** 101 | * 在X轴偏移tx,在Y轴偏移ty,在Z轴偏移tz,单位px 102 | */ 103 | translate3d(tx: number, ty: number, tz: number): IAnimation; 104 | /** 105 | * 参数范围-180~180;一个参数时,Y轴坐标不变,X轴坐标延顺时针倾斜ax度;两个参数时,分别在X轴倾斜ax度,在Y轴倾斜ay度 106 | */ 107 | skew(ax: number, ay?: number): IAnimation; 108 | /** 109 | * 参数范围-180~180;Y轴坐标不变,X轴坐标延顺时针倾斜ax度 110 | */ 111 | skewX(ax: number): IAnimation; 112 | /** 113 | * 参数范围-180~180;X轴坐标不变,Y轴坐标延顺时针倾斜ay度 114 | */ 115 | skewY(ay: number): IAnimation; 116 | /** 117 | * 同transform-function matrix 118 | */ 119 | matrix(a, b, c, d, tx, ty): IAnimation; 120 | /** 121 | * 同transform-function matrix3d 122 | */ 123 | matrix3d(): IAnimation; 124 | } 125 | 126 | interface ICanvasContext { 127 | /** 128 | * 设置填充色, 如果没有设置 fillStyle,默认颜色为 black。 129 | */ 130 | setFillStyle(color: string): void; 131 | /** 132 | * 设置边框颜色, 如果没有设置 fillStyle,默认颜色为 black。 133 | */ 134 | setStrokeStyle(color: string): void; 135 | /** 136 | * 设置阴影 137 | */ 138 | setShadow(offsetX: number, offsetY: number, blur: number, color: string): void; 139 | /** 140 | * 创建一个线性的渐变颜色。需要使用 addColorStop() 来指定渐变点,至少要两个。 141 | */ 142 | createLinearGradient(x0: number, y0: number, x1: number, y1: number): void; 143 | /** 144 | * 创建一个圆形的渐变颜色。 起点在圆心,终点在圆环。 需要使用 addColorStop() 来指定渐变点,至少要两个。 145 | */ 146 | createCircularGradient(x: number, y: number, r: number): void; 147 | /** 148 | * 创建一个颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染。需要使用 addColorStop() 来指定渐变点,至少要两个。 149 | */ 150 | addColorStop(stop: number, color: string): void; 151 | /** 152 | * 设置线条端点的样式 153 | */ 154 | setLineCap(lineCap: 'butt' | 'round' | 'square'): void; 155 | /** 156 | * 设置两线相交处的样式 157 | */ 158 | setLineJoin(lineJoin: 'bevel' | 'round' | 'miter'): void; 159 | /** 160 | * 设置线条宽度 161 | */ 162 | setLineWidth(lineWidth: number): void; 163 | /** 164 | * 设置最大倾斜 165 | */ 166 | setMiterLimit(miterLimit: number): void; 167 | /** 168 | * 添加一个矩形路径到当前路径。 169 | */ 170 | rect(x: number, y: number, width: number, height: number): void; 171 | /** 172 | * 填充一个矩形。用 setFillStyle() 设置矩形的填充色,如果没设置默认是黑色。 173 | */ 174 | fillRect(x: number, y: number, width: number, height: number): void; 175 | /** 176 | * 一个矩形(非填充)。用 setFillStroke() 设置矩形线条的颜色,如果没设置默认是黑色。 177 | */ 178 | strokeRect(x: number, y: number, width: number, height: number): void; 179 | /** 180 | * 在给定的矩形区域内,清除画布上的像素 181 | */ 182 | clearRect(x: number, y: number, width: number, height: number): void; 183 | /** 184 | * 对当前路径进行填充 185 | */ 186 | fill(): void; 187 | /** 188 | * 对当前路径进行描边 189 | */ 190 | stroke(): void; 191 | /** 192 | * 开始一个路径 193 | */ 194 | beginPath(): void; 195 | /** 196 | * 关闭一个路径 197 | */ 198 | closePath(): void; 199 | /** 200 | * 把路径移动到画布中的指定点,但不创建线条。 201 | */ 202 | moveTo(x: number, y: number): void; 203 | /** 204 | * 添加一个新点,然后在画布中创建从该点到最后指定点的线条。 205 | */ 206 | lineTo(x: number, y: number): void; 207 | /** 208 | * 添加一个弧形路径到当前路径,顺时针绘制。 209 | */ 210 | arc(x: number, y: number, radius: number, startAngle: number, sweepAngle: number): void; 211 | /** 212 | * 创建二次方贝塞尔曲线 213 | */ 214 | quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; 215 | /** 216 | * 创建三次方贝塞尔曲线 217 | */ 218 | bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): void; 219 | /** 220 | * 对横纵坐标进行缩放 221 | */ 222 | scale(scaleWidth: number/**横坐标缩放的倍数1 = 100%,0.5 = 50%,2 = 200%,依次类 */, scaleHeight: number/** 纵坐标轴缩放的倍数1 = 100%,0.5 = 50%,2 = 200%,依次类 */): void; 223 | /** 224 | * 对坐标轴进行顺时针旋转 225 | */ 226 | rotate(deg: number/**degrees * Math.PI/180;degrees范围为0~360;旋转角度,以弧度计 */): void; 227 | /** 228 | * 对坐标原点进行缩放 229 | */ 230 | translate(x: number/**水平坐标平移量 */, y: number/**竖直坐标平移量 */): void; 231 | /** 232 | * 在画布上绘制被填充的文本 233 | */ 234 | fillText(text: string, x: number, y: number): void; 235 | /** 236 | * 设置字体大小 237 | */ 238 | setFontSize(fontSize: number): void; 239 | /** 240 | * 在画布上绘制图像 241 | */ 242 | drawImage(imageResource: string, x: number, y: number, width: number, height: number): void; 243 | /** 244 | * 设置全局画笔透明度。 245 | */ 246 | setGlobalAlpha(alpha: number): void; 247 | /** 248 | * 保存当前坐标轴的缩放、旋转、平移信息 249 | */ 250 | save(): void; 251 | /** 252 | * 恢复之前保存过的坐标轴的缩放、旋转、平移信息 253 | */ 254 | restore(): void; 255 | /** 256 | * 进行绘图 257 | */ 258 | draw(): void; 259 | } 260 | 261 | interface IAudioContext { 262 | /** 263 | * 播放 264 | */ 265 | play: () => void; 266 | /** 267 | * 暂停 268 | */ 269 | pause: () => void; 270 | /** 271 | * 跳转到指定位置,单位 s 272 | */ 273 | seek: (position: number) => void; 274 | } 275 | 276 | interface IVideoContext { 277 | /** 278 | * 播放 279 | */ 280 | play: () => void; 281 | /** 282 | * 暂停 283 | */ 284 | pause: () => void; 285 | /** 286 | * 跳转到指定位置,单位 s 287 | */ 288 | seek: (position: number) => void; 289 | /** 290 | * 发送弹幕,danmu 包含两个属性 text, color。 291 | */ 292 | sendDanmu: (danmu: {text: string; color: string;}) => void; 293 | } 294 | 295 | interface IMapContext { 296 | /** 297 | * 获取当前地图中心的经纬度,返回的是 gcj02 坐标系,可以用于 wx.openLocation 298 | */ 299 | getCenterLocation: (obj: { 300 | /** 301 | * 接口调用成功的回调函数 ,res = { longitude: "经度", latitude: "纬度"} 302 | */ 303 | success?: (res: {longitude: string; latitude: string}) => void; 304 | /** 305 | * 接口调用失败的回调函数 306 | */ 307 | fail?: () => void; 308 | /** 309 | * 接口调用结束的回调函数(调用成功、失败都会执行) 310 | */ 311 | complete?: () => void; 312 | }) => void; 313 | /** 314 | * 将地图中心移动到当前定位点,需要配合map组件的show-location使用 315 | */ 316 | moveToLocation: () => void; 317 | } 318 | 319 | interface Application { 320 | setData: (obj: any) => void; 321 | } 322 | 323 | interface AppConstructor { 324 | new (): Application; 325 | (opts: { 326 | /** 327 | * 生命周期函数--监听小程序初始化 328 | */ 329 | onLaunch?: () => void; 330 | /** 331 | * 生命周期函数--监听小程序显示 332 | */ 333 | onShow?: () => void; 334 | /** 335 | * 生命周期函数--监听小程序隐藏 336 | */ 337 | onHide?: () => void; 338 | 339 | [key: string]: any; 340 | }): Application; 341 | } 342 | 343 | declare var App: AppConstructor; 344 | declare function getApp(): Application; 345 | 346 | declare function getCurrentPages(): Page[]; 347 | 348 | interface Page { 349 | setData: (obj: any) => void; 350 | } 351 | 352 | interface PageConstructor { 353 | new (): Page; 354 | (opts: { 355 | /** 356 | * 页面的初始数据 357 | */ 358 | data?: any; 359 | /** 360 | * 页面的初始数据 361 | */ 362 | onLoad?: () => void; 363 | /** 364 | * 生命周期函数--监听页面初次渲染完成 365 | */ 366 | onReady?: () => void; 367 | /** 368 | * 生命周期函数--监听页面显示 369 | */ 370 | onShow?: () => void; 371 | /** 372 | * 生命周期函数--监听页面隐藏 373 | */ 374 | onHide?: () => void; 375 | /** 376 | * 生命周期函数--监听页面卸载 377 | */ 378 | onUnload?: () => void; 379 | /** 380 | * 页面相关事件处理函数--监听用户下拉动作 381 | */ 382 | onPullDownRefreash?: () => void; 383 | /** 384 | * 页面上拉触底事件的处理函数 385 | */ 386 | onReachBottom?: () => void; 387 | /** 388 | * 用户点击右上角分享 389 | */ 390 | onShareAppMessage?: () => { 391 | /** 392 | * 分享标题, 默认值当前小程序名称 393 | */ 394 | title: string; 395 | /** 396 | * 分享描述, 默认值当前小程序名称 397 | */ 398 | desc: string; 399 | /** 400 | * 分享路径 默认值当前页面 path ,必须是以 / 开头的完整路径 401 | */ 402 | path: string; 403 | }; 404 | 405 | [key: string]: any; 406 | }): Page; 407 | } 408 | 409 | declare var Page: PageConstructor; 410 | 411 | declare var wx: { 412 | // # 网络 # 413 | 414 | /** 415 | * wx.request发起的是 HTTPS 请求。 416 | */ 417 | request(obj: { 418 | /** 419 | * 开发者服务器接口地址 420 | */ 421 | url: string; 422 | /** 423 | * 请求的参数 424 | */ 425 | data?: any | string; 426 | /** 427 | * 设置请求的 header , header 中不能设置 Referer 428 | */ 429 | header?: any; 430 | /** 431 | * 默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT 432 | */ 433 | method?: string; 434 | /** 435 | * 默认为 json。如果设置了 dataType 为 json,则会尝试对响应的数据做一次 JSON.parse 436 | */ 437 | dataType?: string; 438 | /** 439 | * 收到开发者服务成功返回的回调函数,res = {data: '开发者服务器返回的内容'} 440 | */ 441 | success?: Function; 442 | /** 443 | * 接口调用失败的回调函数 444 | */ 445 | fail?: Function; 446 | /** 447 | * 接口调用结束的回调函数(调用成功、失败都会执行) 448 | */ 449 | complete?: Function; 450 | }): void; 451 | 452 | /** 453 | * 将本地资源上传到开发者服务器。如页面通过 wx.chooseImage 等接口获取到一个本地资源的临时文件路径后,可通过此接口将本地资源上传到指定服务器。客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data 。 454 | */ 455 | uploadFile(obj: { 456 | /** 457 | * 开发者服务器 url 458 | */ 459 | url: string; 460 | /** 461 | * 要上传文件资源的路径 462 | */ 463 | filePath: string; 464 | /** 465 | * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 466 | */ 467 | name: string; 468 | /** 469 | * HTTP 请求 Header , header 中不能设置 Referer 470 | */ 471 | header?: any; 472 | /** 473 | * HTTP 请求中其他额外的 form data 474 | */ 475 | formData?: any; 476 | /** 477 | * 接口调用成功的回调函数 478 | */ 479 | success?: Function; 480 | /** 481 | * 接口调用失败的回调函数 482 | */ 483 | fail?: Function; 484 | /** 485 | * 接口调用结束的回调函数(调用成功、失败都会执行) 486 | */ 487 | complete?: Function; 488 | }): void; 489 | 490 | /** 491 | * 下载文件资源到本地。客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。 492 | */ 493 | downloadFile(obj: { 494 | /** 495 | * 下载资源的 url 496 | */ 497 | url: string; 498 | /** 499 | * HTTP 请求 Header 500 | */ 501 | header?: any; 502 | /** 503 | * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} 504 | */ 505 | success?: Function; 506 | /** 507 | * 接口调用失败的回调函数 508 | */ 509 | fail?: Function; 510 | /** 511 | * 接口调用结束的回调函数(调用成功、失败都会执行) 512 | */ 513 | complete?: Function; 514 | }): void; 515 | 516 | /** 517 | * 创建一个 WebSocket 连接;一个微信小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。 518 | */ 519 | connectSocket(obj: { 520 | /** 521 | * 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 522 | */ 523 | url: string; 524 | /** 525 | * 请求的数据 526 | */ 527 | data?: any; 528 | /** 529 | * HTTP Header , header 中不能设置 Referer 530 | */ 531 | header?: any; 532 | /** 533 | * 默认是GET,有效值: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT 534 | */ 535 | method?: string; 536 | /** 537 | * 接口调用成功的回调函数 538 | */ 539 | success?: Function; 540 | /** 541 | * 接口调用失败的回调函数 542 | */ 543 | fail?: Function; 544 | /** 545 | * 接口调用结束的回调函数(调用成功、失败都会执行) 546 | */ 547 | complete?: Function; 548 | }): void; 549 | 550 | /** 551 | * 监听WebSocket连接打开事件。 552 | */ 553 | onSocketOpen(callback: Function): void; 554 | 555 | /** 556 | * 监听WebSocket错误。 557 | */ 558 | onSocketError(callback: Function): void; 559 | 560 | /** 561 | * 通过 WebSocket 连接发送数据,需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。 562 | */ 563 | sendSocketMessage(obj: { 564 | /** 565 | * 需要发送的内容 566 | */ 567 | data: undefined; 568 | /** 569 | * 接口调用成功的回调函数 570 | */ 571 | success?: Function; 572 | /** 573 | * 接口调用失败的回调函数 574 | */ 575 | fail?: Function; 576 | /** 577 | * 接口调用结束的回调函数(调用成功、失败都会执行) 578 | */ 579 | complete?: Function; 580 | }): void; 581 | 582 | /** 583 | * 监听WebSocket接受到服务器的消息事件。 584 | */ 585 | onSocketMessage(callback: Function): void; 586 | 587 | /** 588 | * 关闭WebSocket连接。 589 | */ 590 | closeSocket(): void; 591 | 592 | /** 593 | * 监听WebSocket关闭。 594 | */ 595 | onSocketClose(callback: Function): void; 596 | 597 | // # 媒体 # 598 | 599 | /** 600 | * 从本地相册选择图片或使用相机拍照。 601 | */ 602 | chooseImage(obj: { 603 | /** 604 | * 最多可以选择的图片张数,默认9 605 | */ 606 | count?: number; 607 | /** 608 | * original 原图,compressed 压缩图,默认二者都有 609 | */ 610 | sizeType?: string[]; 611 | /** 612 | * album 从相册选图,camera 使用相机,默认二者都有 613 | */ 614 | sourceType?: string[]; 615 | /** 616 | * 成功则返回图片的本地文件路径列表 tempFilePaths 617 | */ 618 | success: Function; 619 | /** 620 | * 接口调用失败的回调函数 621 | */ 622 | fail?: Function; 623 | /** 624 | * 接口调用结束的回调函数(调用成功、失败都会执行) 625 | */ 626 | complete?: Function; 627 | }): void; 628 | 629 | /** 630 | * 预览图片。 631 | */ 632 | previewImage(obj: { 633 | /** 634 | * 当前显示图片的链接,不填则默认为 urls 的第一张 635 | */ 636 | current?: string; 637 | /** 638 | * 需要预览的图片链接列表 639 | */ 640 | urls: string[]; 641 | /** 642 | * 接口调用成功的回调函数 643 | */ 644 | success?: Function; 645 | /** 646 | * 接口调用失败的回调函数 647 | */ 648 | fail?: Function; 649 | /** 650 | * 接口调用结束的回调函数(调用成功、失败都会执行) 651 | */ 652 | complete?: Function; 653 | }): void; 654 | 655 | /** 656 | * 获取图片信息 657 | */ 658 | getImageInfo(obj: { 659 | /** 660 | * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径 661 | */ 662 | src: string; 663 | /** 664 | * 接口调用成功的回调函数 665 | */ 666 | success?: Function; 667 | /** 668 | * 接口调用失败的回调函数 669 | */ 670 | fail?: Function; 671 | /** 672 | * 接口调用结束的回调函数(调用成功、失败都会执行) 673 | */ 674 | complete?: Function; 675 | }): void; 676 | 677 | /** 678 | * 开始录音。当主动调用wx.stopRecord,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。当用户离开小程序时,此接口无法调用。 679 | */ 680 | startRecord(obj: { 681 | /** 682 | * 录音成功后调用,返回录音文件的临时文件路径,res = {tempFilePath: '录音文件的临时路径'} 683 | */ 684 | success?: Function; 685 | /** 686 | * 接口调用失败的回调函数 687 | */ 688 | fail?: Function; 689 | /** 690 | * 接口调用结束的回调函数(调用成功、失败都会执行) 691 | */ 692 | complete?: Function; 693 | }): void; 694 | 695 | /** 696 | * ​ 主动调用停止录音。 697 | */ 698 | stopRecord(): void; 699 | 700 | /** 701 | * 开始播放语音,同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。 702 | */ 703 | playVoice(obj: { 704 | /** 705 | * 需要播放的语音文件的文件路径 706 | */ 707 | filePath: string; 708 | /** 709 | * 接口调用成功的回调函数 710 | */ 711 | success?: Function; 712 | /** 713 | * 接口调用失败的回调函数 714 | */ 715 | fail?: Function; 716 | /** 717 | * 接口调用结束的回调函数(调用成功、失败都会执行) 718 | */ 719 | complete?: Function; 720 | }): void; 721 | 722 | /** 723 | * 暂停正在播放的语音。再次调用wx.playVoice播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 wx.stopVoice。 724 | */ 725 | pauseVoice(): void; 726 | 727 | /** 728 | * 结束播放语音。 729 | */ 730 | stopVoice(): void; 731 | 732 | /** 733 | * 获取后台音乐播放状态。 734 | */ 735 | getBackgroundAudioPlayerState(obj: { 736 | /** 737 | * 接口调用成功的回调函数 738 | */ 739 | success?: Function; 740 | /** 741 | * 接口调用失败的回调函数 742 | */ 743 | fail?: Function; 744 | /** 745 | * 接口调用结束的回调函数(调用成功、失败都会执行) 746 | */ 747 | complete?: Function; 748 | }): void; 749 | 750 | /** 751 | * 使用后台播放器播放音乐,对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户点击“显示在聊天顶部”时,音乐不会暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放。 752 | */ 753 | playBackgroundAudio(obj: { 754 | /** 755 | * 音乐链接 756 | */ 757 | dataUrl: string; 758 | /** 759 | * 音乐标题 760 | */ 761 | title?: string; 762 | /** 763 | * 封面URL 764 | */ 765 | coverImgUrl?: string; 766 | /** 767 | * 接口调用成功的回调函数 768 | */ 769 | success?: Function; 770 | /** 771 | * 接口调用失败的回调函数 772 | */ 773 | fail?: Function; 774 | /** 775 | * 接口调用结束的回调函数(调用成功、失败都会执行) 776 | */ 777 | complete?: Function; 778 | }): void; 779 | 780 | /** 781 | * 暂停播放音乐。 782 | */ 783 | pauseBackgroundAudio(): void; 784 | 785 | /** 786 | * 控制音乐播放进度。 787 | */ 788 | seekBackgroundAudio(obj: { 789 | /** 790 | * 音乐位置,单位:秒 791 | */ 792 | position: number; 793 | /** 794 | * 接口调用成功的回调函数 795 | */ 796 | success?: Function; 797 | /** 798 | * 接口调用失败的回调函数 799 | */ 800 | fail?: Function; 801 | /** 802 | * 接口调用结束的回调函数(调用成功、失败都会执行) 803 | */ 804 | complete?: Function; 805 | }): void; 806 | 807 | /** 808 | * 停止播放音乐。 809 | */ 810 | stopBackgroundAudio(): void; 811 | 812 | /** 813 | * 监听音乐播放。 814 | */ 815 | onBackgroundAudioPlay(callback: Function): void; 816 | 817 | /** 818 | * 监听音乐暂停。 819 | */ 820 | onBackgroundAudioPause(callback: Function): void; 821 | 822 | /** 823 | * 监听音乐停止。 824 | */ 825 | onBackgroundAudioStop(callback: Function): void; 826 | 827 | /** 828 | * 创建并返回 audio 上下文 audioContext 对象 829 | */ 830 | createAudioContext(audioId: string): IAudioContext; 831 | 832 | /** 833 | * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。 834 | */ 835 | chooseVideo(obj: { 836 | /** 837 | * album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera'] 838 | */ 839 | sourceType?: string[]; 840 | /** 841 | * 拍摄视频最长拍摄时间,单位秒。最长支持 60 秒 842 | */ 843 | maxDuration?: number; 844 | /** 845 | * 默认调起的为前置还是后置摄像头。front: 前置,back: 后置,默认 back 846 | */ 847 | camera?: string; 848 | /** 849 | * 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明 850 | */ 851 | success?: Function; 852 | /** 853 | * 接口调用失败的回调函数 854 | */ 855 | fail?: Function; 856 | /** 857 | * 接口调用结束的回调函数(调用成功、失败都会执行) 858 | */ 859 | complete?: Function; 860 | }): void; 861 | 862 | /** 863 | * 创建并返回 video 上下文 videoContext 对象 864 | */ 865 | createVideoContext(videoId: string): IVideoContext; 866 | 867 | // # 文件 # 868 | 869 | /** 870 | * 保存文件到本地。 871 | */ 872 | saveFile(obj: { 873 | /** 874 | * 需要保存的文件的临时路径 875 | */ 876 | tempFilePath: string; 877 | /** 878 | * 返回文件的保存路径,res = {savedFilePath: '文件的保存路径'} 879 | */ 880 | success?: Function; 881 | /** 882 | * 接口调用失败的回调函数 883 | */ 884 | fail?: Function; 885 | /** 886 | * 接口调用结束的回调函数(调用成功、失败都会执行) 887 | */ 888 | complete?: Function; 889 | }): void; 890 | 891 | /** 892 | * 获取本地已保存的文件列表 893 | */ 894 | getSavedFileList(obj: { 895 | /** 896 | * 接口调用成功的回调函数,返回结果见success返回参数说明 897 | */ 898 | success?: Function; 899 | /** 900 | * 接口调用失败的回调函数 901 | */ 902 | fail?: Function; 903 | /** 904 | * 接口调用结束的回调函数(调用成功、失败都会执行) 905 | */ 906 | complete?: Function; 907 | }): void; 908 | 909 | /** 910 | * 获取本地文件的文件信息 911 | */ 912 | getSavedFileInfo(obj: { 913 | /** 914 | * 文件路径 915 | */ 916 | filePath: string; 917 | /** 918 | * 接口调用成功的回调函数,返回结果见success返回参数说明 919 | */ 920 | success?: Function; 921 | /** 922 | * 接口调用失败的回调函数 923 | */ 924 | fail?: Function; 925 | /** 926 | * 接口调用结束的回调函数(调用成功、失败都会执行) 927 | */ 928 | complete?: Function; 929 | }): void; 930 | 931 | /** 932 | * 删除本地存储的文件 933 | */ 934 | removeSavedFile(obj: { 935 | /** 936 | * 需要删除的文件路径 937 | */ 938 | filePath: string; 939 | /** 940 | * 接口调用成功的回调函数 941 | */ 942 | success?: Function; 943 | /** 944 | * 接口调用失败的回调函数 945 | */ 946 | fail?: Function; 947 | /** 948 | * 接口调用结束的回调函数(调用成功、失败都会执行) 949 | */ 950 | complete?: Function; 951 | }): void; 952 | 953 | /** 954 | * 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx 955 | */ 956 | openDocument(obj: { 957 | /** 958 | * 文件路径,可通过 downFile 获得 959 | */ 960 | filePath: string; 961 | /** 962 | * 接口调用成功的回调函数 963 | */ 964 | success?: Function; 965 | /** 966 | * 接口调用失败的回调函数 967 | */ 968 | fail?: Function; 969 | /** 970 | * 接口调用结束的回调函数(调用成功、失败都会执行) 971 | */ 972 | complete?: Function; 973 | }): void; 974 | 975 | // # 数据缓存 # 976 | 977 | /** 978 | * 将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。 979 | */ 980 | setStorage(obj: { 981 | /** 982 | * 本地缓存中的指定的 key 983 | */ 984 | key: string; 985 | /** 986 | * 需要存储的内容 987 | */ 988 | data: any; 989 | /** 990 | * 接口调用成功的回调函数 991 | */ 992 | success?: Function; 993 | /** 994 | * 接口调用失败的回调函数 995 | */ 996 | fail?: Function; 997 | /** 998 | * 接口调用结束的回调函数(调用成功、失败都会执行) 999 | */ 1000 | complete?: Function; 1001 | }): void; 1002 | 1003 | /** 1004 | * 将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。 1005 | */ 1006 | setStorageSync(key: string, data: any, ): void; 1007 | 1008 | /** 1009 | * 从本地缓存中异步获取指定 key 对应的内容。 1010 | */ 1011 | getStorage(obj: { 1012 | /** 1013 | * 本地缓存中的指定的 key 1014 | */ 1015 | key: string; 1016 | /** 1017 | * 接口调用的回调函数,res = {data: key对应的内容} 1018 | */ 1019 | success: Function; 1020 | /** 1021 | * 接口调用失败的回调函数 1022 | */ 1023 | fail?: Function; 1024 | /** 1025 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1026 | */ 1027 | complete?: Function; 1028 | }): void; 1029 | 1030 | /** 1031 | * 从本地缓存中同步获取指定 key 对应的内容。 1032 | */ 1033 | getStorageSync(key: string): void; 1034 | 1035 | /** 1036 | * 异步获取当前storage的相关信息 1037 | */ 1038 | getStorageInfo(obj: { 1039 | /** 1040 | * 接口调用的回调函数,详见返回参数说明 1041 | */ 1042 | success: Function; 1043 | /** 1044 | * 接口调用失败的回调函数 1045 | */ 1046 | fail?: Function; 1047 | /** 1048 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1049 | */ 1050 | complete?: Function; 1051 | }): void; 1052 | 1053 | /** 1054 | * 同步获取当前storage的相关信息 1055 | */ 1056 | getStorageInfoSync(): void; 1057 | 1058 | /** 1059 | * 从本地缓存中异步移除指定 key 。 1060 | */ 1061 | removeStorage(obj: { 1062 | /** 1063 | * 本地缓存中的指定的 key 1064 | */ 1065 | key: string; 1066 | /** 1067 | * 接口调用的回调函数 1068 | */ 1069 | success: Function; 1070 | /** 1071 | * 接口调用失败的回调函数 1072 | */ 1073 | fail?: Function; 1074 | /** 1075 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1076 | */ 1077 | complete?: Function; 1078 | }): void; 1079 | 1080 | /** 1081 | * 从本地缓存中同步移除指定 key 。 1082 | */ 1083 | removeStorageSync(key: string): void; 1084 | 1085 | /** 1086 | * 清理本地数据缓存。 1087 | */ 1088 | clearStorage(): void; 1089 | 1090 | /** 1091 | * 同步清理本地数据缓存 1092 | */ 1093 | clearStorageSync(): void; 1094 | 1095 | // # 位置 # 1096 | 1097 | /** 1098 | * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用;当用户点击“显示在聊天顶部”时,此接口可继续调用。 1099 | */ 1100 | getLocation(obj: { 1101 | /** 1102 | * 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于wx.openLocation的坐标 1103 | */ 1104 | type?: string; 1105 | /** 1106 | * 接口调用成功的回调函数,返回内容详见返回参数说明。 1107 | */ 1108 | success: Function; 1109 | /** 1110 | * 接口调用失败的回调函数 1111 | */ 1112 | fail?: Function; 1113 | /** 1114 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1115 | */ 1116 | complete?: Function; 1117 | }): void; 1118 | 1119 | /** 1120 | * 打开地图选择位置 1121 | */ 1122 | chooseLocation(obj: { 1123 | /** 1124 | * 接口调用成功的回调函数,返回内容详见返回参数说明。 1125 | */ 1126 | success: Function; 1127 | /** 1128 | * 用户取消时调用 1129 | */ 1130 | cancel?: Function; 1131 | /** 1132 | * 接口调用失败的回调函数 1133 | */ 1134 | fail?: Function; 1135 | /** 1136 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1137 | */ 1138 | complete?: Function; 1139 | }): void; 1140 | 1141 | /** 1142 | * ​ 使用微信内置地图查看位置 1143 | */ 1144 | openLocation(obj: { 1145 | /** 1146 | * 纬度,范围为-90~90,负数表示南纬 1147 | */ 1148 | latitude: number; 1149 | /** 1150 | * 经度,范围为-180~180,负数表示西经 1151 | */ 1152 | longitude: number; 1153 | /** 1154 | * 缩放比例,范围5~18,默认为18 1155 | */ 1156 | scale?: number; 1157 | /** 1158 | * 位置名 1159 | */ 1160 | name?: string; 1161 | /** 1162 | * 地址的详细说明 1163 | */ 1164 | address?: string; 1165 | /** 1166 | * 接口调用成功的回调函数 1167 | */ 1168 | success?: Function; 1169 | /** 1170 | * 接口调用失败的回调函数 1171 | */ 1172 | fail?: Function; 1173 | /** 1174 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1175 | */ 1176 | complete?: Function; 1177 | }): void; 1178 | 1179 | /** 1180 | * 创建并返回 map 上下文 mapContext 对象 1181 | */ 1182 | createMapContext(mapId: string): IMapContext; 1183 | 1184 | // # 设备 # 1185 | 1186 | /** 1187 | * 获取系统信息。 1188 | */ 1189 | getSystemInfo(obj: { 1190 | /** 1191 | * 接口调用成功的回调 1192 | */ 1193 | success: Function; 1194 | /** 1195 | * 接口调用失败的回调函数 1196 | */ 1197 | fail?: Function; 1198 | /** 1199 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1200 | */ 1201 | complete?: Function; 1202 | }): void; 1203 | 1204 | /** 1205 | * 获取系统信息同步接口 1206 | */ 1207 | getSystemInfoSync(): void; 1208 | 1209 | /** 1210 | * 获取网络类型。 1211 | */ 1212 | getNetworkType(obj: { 1213 | /** 1214 | * 接口调用成功,返回网络类型 networkType 1215 | */ 1216 | success: Function; 1217 | /** 1218 | * 接口调用失败的回调函数 1219 | */ 1220 | fail?: Function; 1221 | /** 1222 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1223 | */ 1224 | complete?: Function; 1225 | }): void; 1226 | 1227 | onNetworkStatusChange(callback: Function): void; 1228 | 1229 | /** 1230 | * 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer 停止监听。 1231 | */ 1232 | onAccelerometerChange(callback: Function): void; 1233 | 1234 | startAccelerometer(obj: { 1235 | /** 1236 | * 接口调用成功的回调函数 1237 | */ 1238 | success?: Function; 1239 | /** 1240 | * 接口调用失败的回调函数 1241 | */ 1242 | fail?: Function; 1243 | /** 1244 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1245 | */ 1246 | complete?: Function; 1247 | }): void; 1248 | 1249 | stopAccelerometer(obj: { 1250 | /** 1251 | * 接口调用成功的回调函数 1252 | */ 1253 | success?: Function; 1254 | /** 1255 | * 接口调用失败的回调函数 1256 | */ 1257 | fail?: Function; 1258 | /** 1259 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1260 | */ 1261 | complete?: Function; 1262 | }): void; 1263 | 1264 | /** 1265 | * 监听罗盘数据,频率:5次/秒,接口调用后会自动开始监听,可使用wx.stopCompass停止监听。 1266 | */ 1267 | onCompassChange(callback: Function): void; 1268 | 1269 | startCompass(obj: { 1270 | /** 1271 | * 接口调用成功的回调函数 1272 | */ 1273 | success?: Function; 1274 | /** 1275 | * 接口调用失败的回调函数 1276 | */ 1277 | fail?: Function; 1278 | /** 1279 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1280 | */ 1281 | complete?: Function; 1282 | }): void; 1283 | 1284 | stopCompass(obj: { 1285 | /** 1286 | * 接口调用成功的回调函数 1287 | */ 1288 | success?: Function; 1289 | /** 1290 | * 接口调用失败的回调函数 1291 | */ 1292 | fail?: Function; 1293 | /** 1294 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1295 | */ 1296 | complete?: Function; 1297 | }): void; 1298 | 1299 | makePhoneCall(obj: { 1300 | /** 1301 | * 需要拨打的电话号码 1302 | */ 1303 | phoneNumber: string; 1304 | /** 1305 | * 接口调用成功的回调 1306 | */ 1307 | success?: Function; 1308 | /** 1309 | * 接口调用失败的回调函数 1310 | */ 1311 | fail?: Function; 1312 | /** 1313 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1314 | */ 1315 | complete?: Function; 1316 | }): void; 1317 | 1318 | /** 1319 | * 调起客户端扫码界面,扫码成功后返回对应的结果 1320 | */ 1321 | scanCode(obj: { 1322 | /** 1323 | * 接口调用成功的回调函数,返回内容详见返回参数说明。 1324 | */ 1325 | success?: Function; 1326 | /** 1327 | * 接口调用失败的回调函数 1328 | */ 1329 | fail?: Function; 1330 | /** 1331 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1332 | */ 1333 | complete?: Function; 1334 | }): void; 1335 | 1336 | setClipboardData(obj: { 1337 | /** 1338 | * 需要设置的内容 1339 | */ 1340 | data: string; 1341 | /** 1342 | * 接口调用成功的回调函数 1343 | */ 1344 | success?: Function; 1345 | /** 1346 | * 接口调用失败的回调函数 1347 | */ 1348 | fail?: Function; 1349 | /** 1350 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1351 | */ 1352 | complete?: Function; 1353 | }): void; 1354 | 1355 | getClipboardData(obj: { 1356 | /** 1357 | * 接口调用成功的回调函数 1358 | */ 1359 | success?: Function; 1360 | /** 1361 | * 接口调用失败的回调函数 1362 | */ 1363 | fail?: Function; 1364 | /** 1365 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1366 | */ 1367 | complete?: Function; 1368 | }): void; 1369 | 1370 | openBluetoothAdapter(obj: { 1371 | /** 1372 | * 成功则返回成功初始化信息 1373 | */ 1374 | success: Function; 1375 | /** 1376 | * 接口调用失败的回调函数 1377 | */ 1378 | fail?: Function; 1379 | /** 1380 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1381 | */ 1382 | complete?: Function; 1383 | }): void; 1384 | 1385 | closeBluetoothAdapter(obj: { 1386 | /** 1387 | * 成功则返回成功关闭模块信息 1388 | */ 1389 | success: Function; 1390 | /** 1391 | * 接口调用失败的回调函数 1392 | */ 1393 | fail?: Function; 1394 | /** 1395 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1396 | */ 1397 | complete?: Function; 1398 | }): void; 1399 | 1400 | getBluetoothAdapterState(obj: { 1401 | /** 1402 | * 成功则返回本机蓝牙适配器状态 1403 | */ 1404 | success: Function; 1405 | /** 1406 | * 接口调用失败的回调函数 1407 | */ 1408 | fail?: Function; 1409 | /** 1410 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1411 | */ 1412 | complete?: Function; 1413 | }): void; 1414 | 1415 | onBluetoothAdapterStateChange(callback: Function): void; 1416 | 1417 | startBluetoothDevicesDiscovery(obj: { 1418 | /** 1419 | * 蓝牙设备主 service 的 uuid 列表 1420 | */ 1421 | services?: Array; 1422 | /** 1423 | * 成功则返回本机蓝牙适配器状态 1424 | */ 1425 | success: Function; 1426 | /** 1427 | * 接口调用失败的回调函数 1428 | */ 1429 | fail?: Function; 1430 | /** 1431 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1432 | */ 1433 | complete?: Function; 1434 | }): void; 1435 | 1436 | stopBluetoothDevicesDiscovery(obj: { 1437 | /** 1438 | * 成功则返回本机蓝牙适配器状态 1439 | */ 1440 | success: Function; 1441 | /** 1442 | * 接口调用失败的回调函数 1443 | */ 1444 | fail?: Function; 1445 | /** 1446 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1447 | */ 1448 | complete?: Function; 1449 | }): void; 1450 | 1451 | getBluetoothDevices(obj: { 1452 | /** 1453 | * 蓝牙设备主 service 的 uuid 列表 1454 | */ 1455 | services?: Array; 1456 | /** 1457 | * 成功则返回本机蓝牙适配器状态 1458 | */ 1459 | success: Function; 1460 | /** 1461 | * 接口调用失败的回调函数 1462 | */ 1463 | fail?: Function; 1464 | /** 1465 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1466 | */ 1467 | complete?: Function; 1468 | }): void; 1469 | 1470 | onBluetoothDeviceFound(callback: Function): void; 1471 | 1472 | getConnectedBluetoothDevices(obj: { 1473 | /** 1474 | * 蓝牙设备主 service 的 uuid 列表 1475 | */ 1476 | services: Array; 1477 | /** 1478 | * 成功则返回本机蓝牙适配器状态 1479 | */ 1480 | success: Function; 1481 | /** 1482 | * 接口调用失败的回调函数 1483 | */ 1484 | fail?: Function; 1485 | /** 1486 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1487 | */ 1488 | complete?: Function; 1489 | }): void; 1490 | 1491 | createBLEConnection(obj: { 1492 | /** 1493 | * 蓝牙设备 id,参考 getDevices 接口 1494 | */ 1495 | deviceId: string; 1496 | /** 1497 | * 成功则返回本机蓝牙适配器状态 1498 | */ 1499 | success: Function; 1500 | /** 1501 | * 接口调用失败的回调函数 1502 | */ 1503 | fail?: Function; 1504 | /** 1505 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1506 | */ 1507 | complete?: Function; 1508 | }): void; 1509 | 1510 | closeBLEConnection(obj: { 1511 | /** 1512 | * 蓝牙设备 id,参考 getDevices 接口 1513 | */ 1514 | deviceId: string; 1515 | /** 1516 | * 成功则返回本机蓝牙适配器状态 1517 | */ 1518 | success: Function; 1519 | /** 1520 | * 接口调用失败的回调函数 1521 | */ 1522 | fail?: Function; 1523 | /** 1524 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1525 | */ 1526 | complete?: Function; 1527 | }): void; 1528 | 1529 | getBLEDeviceServices(obj: { 1530 | /** 1531 | * 蓝牙设备 id,参考 getDevices 接口 1532 | */ 1533 | deviceId: string; 1534 | /** 1535 | * 成功则返回本机蓝牙适配器状态 1536 | */ 1537 | success: Function; 1538 | /** 1539 | * 接口调用失败的回调函数 1540 | */ 1541 | fail?: Function; 1542 | /** 1543 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1544 | */ 1545 | complete?: Function; 1546 | }): void; 1547 | 1548 | getBLEDeviceCharacteristics(obj: { 1549 | /** 1550 | * 蓝牙设备 id,参考 device 对象 1551 | */ 1552 | deviceId: string; 1553 | /** 1554 | * 蓝牙服务 uuid 1555 | */ 1556 | serviceId: string; 1557 | /** 1558 | * 成功则返回本机蓝牙适配器状态 1559 | */ 1560 | success: Function; 1561 | /** 1562 | * 接口调用失败的回调函数 1563 | */ 1564 | fail?: Function; 1565 | /** 1566 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1567 | */ 1568 | complete?: Function; 1569 | }): void; 1570 | 1571 | readBLECharacteristicValue(obj: { 1572 | /** 1573 | * 蓝牙设备 id,参考 device 对象 1574 | */ 1575 | deviceId: string; 1576 | /** 1577 | * 蓝牙特征值对应服务的 uuid 1578 | */ 1579 | serviceId: string; 1580 | /** 1581 | * 蓝牙特征值的 uuid 1582 | */ 1583 | characteristicId: string; 1584 | /** 1585 | * 成功则返回本机蓝牙适配器状态 1586 | */ 1587 | success: Function; 1588 | /** 1589 | * 接口调用失败的回调函数 1590 | */ 1591 | fail?: Function; 1592 | /** 1593 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1594 | */ 1595 | complete?: Function; 1596 | }): void; 1597 | 1598 | writeBLECharacteristicValue(obj: { 1599 | /** 1600 | * 蓝牙设备 id,参考 device 对象 1601 | */ 1602 | deviceId: string; 1603 | /** 1604 | * 蓝牙特征值对应服务的 uuid 1605 | */ 1606 | serviceId: string; 1607 | /** 1608 | * 蓝牙特征值的 uuid 1609 | */ 1610 | characteristicId: string; 1611 | /** 1612 | * 蓝牙设备特征值对应的二进制值 1613 | */ 1614 | value: undefined; 1615 | /** 1616 | * 成功则返回本机蓝牙适配器状态 1617 | */ 1618 | success: Function; 1619 | /** 1620 | * 接口调用失败的回调函数 1621 | */ 1622 | fail?: Function; 1623 | /** 1624 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1625 | */ 1626 | complete?: Function; 1627 | }): void; 1628 | 1629 | notifyBLECharacteristicValueChange(obj: { 1630 | /** 1631 | * 蓝牙设备 id,参考 device 对象 1632 | */ 1633 | deviceId: string; 1634 | /** 1635 | * 蓝牙特征值对应服务的 uuid 1636 | */ 1637 | serviceId: string; 1638 | /** 1639 | * 蓝牙特征值的 uuid 1640 | */ 1641 | characteristicId: string; 1642 | /** 1643 | * true: 启用 notify; false: 停用 notify 1644 | */ 1645 | state: boolean; 1646 | /** 1647 | * 成功则返回本机蓝牙适配器状态 1648 | */ 1649 | success: Function; 1650 | /** 1651 | * 接口调用失败的回调函数 1652 | */ 1653 | fail?: Function; 1654 | /** 1655 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1656 | */ 1657 | complete?: Function; 1658 | }): void; 1659 | 1660 | onBLEConnectionStateChange(callback: Function): void; 1661 | 1662 | onBLECharacteristicValueChange(callback: Function): void; 1663 | 1664 | // # 界面 # 1665 | 1666 | /** 1667 | * 显示消息提示框 1668 | */ 1669 | showToast(obj: { 1670 | /** 1671 | * 提示的内容 1672 | */ 1673 | title: string; 1674 | /** 1675 | * 图标,有效值 "success", "loading" 1676 | */ 1677 | icon?: string; 1678 | /** 1679 | * 自定义图标的本地路径,image 的优先级高于 icon 1680 | */ 1681 | image?: string; 1682 | /** 1683 | * 提示的延迟时间,单位毫秒,默认:1500 1684 | */ 1685 | duration?: number; 1686 | /** 1687 | * 是否显示透明蒙层,防止触摸穿透,默认:false 1688 | */ 1689 | mask?: boolean; 1690 | /** 1691 | * 接口调用成功的回调函数 1692 | */ 1693 | success?: Function; 1694 | /** 1695 | * 接口调用失败的回调函数 1696 | */ 1697 | fail?: Function; 1698 | /** 1699 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1700 | */ 1701 | complete?: Function; 1702 | }): void; 1703 | 1704 | showLoading(obj: { 1705 | /** 1706 | * 提示的内容 1707 | */ 1708 | title: string; 1709 | /** 1710 | * 是否显示透明蒙层,防止触摸穿透,默认:false 1711 | */ 1712 | mask?: boolean; 1713 | /** 1714 | * 接口调用成功的回调函数 1715 | */ 1716 | success?: Function; 1717 | /** 1718 | * 接口调用失败的回调函数 1719 | */ 1720 | fail?: Function; 1721 | /** 1722 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1723 | */ 1724 | complete?: Function; 1725 | }): void; 1726 | 1727 | /** 1728 | * 隐藏消息提示框 1729 | */ 1730 | hideToast(): void; 1731 | 1732 | hideLoading(): void; 1733 | 1734 | /** 1735 | * ​显示模态弹窗 1736 | */ 1737 | showModal(obj: { 1738 | /** 1739 | * 提示的标题 1740 | */ 1741 | title: string; 1742 | /** 1743 | * 提示的内容 1744 | */ 1745 | content: string; 1746 | /** 1747 | * 是否显示取消按钮,默认为 true 1748 | */ 1749 | showCancel?: boolean; 1750 | /** 1751 | * 取消按钮的文字,默认为"取消",最多 4 个字符 1752 | */ 1753 | cancelText?: string; 1754 | /** 1755 | * 取消按钮的文字颜色,默认为"#000000" 1756 | */ 1757 | cancelColor?: undefined; 1758 | /** 1759 | * 确定按钮的文字,默认为"确定",最多 4 个字符 1760 | */ 1761 | confirmText?: string; 1762 | /** 1763 | * 确定按钮的文字颜色,默认为"#3CC51F" 1764 | */ 1765 | confirmColor?: undefined; 1766 | /** 1767 | * 接口调用成功的回调函数 1768 | */ 1769 | success?: Function; 1770 | /** 1771 | * 接口调用失败的回调函数 1772 | */ 1773 | fail?: Function; 1774 | /** 1775 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1776 | */ 1777 | complete?: Function; 1778 | }): void; 1779 | 1780 | /** 1781 | * ​显示操作菜单 1782 | */ 1783 | showActionSheet(obj: { 1784 | /** 1785 | * 按钮的文字数组,数组长度最大为6个 1786 | */ 1787 | itemList: undefined; 1788 | /** 1789 | * 按钮的文字颜色,默认为"#000000" 1790 | */ 1791 | itemColor?: undefined; 1792 | /** 1793 | * 接口调用成功的回调函数,详见返回参数说明 1794 | */ 1795 | success?: Function; 1796 | /** 1797 | * 接口调用失败的回调函数 1798 | */ 1799 | fail?: Function; 1800 | /** 1801 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1802 | */ 1803 | complete?: Function; 1804 | }): void; 1805 | 1806 | /** 1807 | * 动态设置当前页面的标题。 1808 | */ 1809 | setNavigationBarTitle(obj: { 1810 | /** 1811 | * 页面标题 1812 | */ 1813 | title: string; 1814 | /** 1815 | * 接口调用成功的回调函数 1816 | */ 1817 | success?: Function; 1818 | /** 1819 | * 接口调用失败的回调函数 1820 | */ 1821 | fail?: Function; 1822 | /** 1823 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1824 | */ 1825 | complete?: Function; 1826 | }): void; 1827 | 1828 | /** 1829 | * 在当前页面显示导航条加载动画。 1830 | */ 1831 | showNavigationBarLoading(): void; 1832 | 1833 | /** 1834 | * 隐藏导航条加载动画。 1835 | */ 1836 | hideNavigationBarLoading(): void; 1837 | 1838 | /** 1839 | * 保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。 1840 | */ 1841 | navigateTo(obj: { 1842 | /** 1843 | * 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' 1844 | */ 1845 | url: string; 1846 | /** 1847 | * 接口调用成功的回调函数 1848 | */ 1849 | success?: Function; 1850 | /** 1851 | * 接口调用失败的回调函数 1852 | */ 1853 | fail?: Function; 1854 | /** 1855 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1856 | */ 1857 | complete?: Function; 1858 | }): void; 1859 | 1860 | /** 1861 | * 关闭当前页面,跳转到应用内的某个页面。 1862 | */ 1863 | redirectTo(obj: { 1864 | /** 1865 | * 需要跳转的应用内非 tabBar 的页面的路径,路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' 1866 | */ 1867 | url: string; 1868 | /** 1869 | * 接口调用成功的回调函数 1870 | */ 1871 | success?: Function; 1872 | /** 1873 | * 接口调用失败的回调函数 1874 | */ 1875 | fail?: Function; 1876 | /** 1877 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1878 | */ 1879 | complete?: Function; 1880 | }): void; 1881 | 1882 | reLaunch(obj: { 1883 | /** 1884 | * 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' 1885 | */ 1886 | url: string; 1887 | /** 1888 | * 接口调用成功的回调函数 1889 | */ 1890 | success?: Function; 1891 | /** 1892 | * 接口调用失败的回调函数 1893 | */ 1894 | fail?: Function; 1895 | /** 1896 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1897 | */ 1898 | complete?: Function; 1899 | }): void; 1900 | 1901 | /** 1902 | * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 1903 | */ 1904 | switchTab(obj: { 1905 | /** 1906 | * 需要跳转的 tabBar 页面的路径(需在 app.json 的 tabBar 字段定义的页面),路径后不能带参数 1907 | */ 1908 | url: string; 1909 | /** 1910 | * 接口调用成功的回调函数 1911 | */ 1912 | success?: Function; 1913 | /** 1914 | * 接口调用失败的回调函数 1915 | */ 1916 | fail?: Function; 1917 | /** 1918 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1919 | */ 1920 | complete?: Function; 1921 | }): void; 1922 | 1923 | /** 1924 | * 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages()) 获取当前的页面栈,决定需要返回几层。 1925 | */ 1926 | navigateBack(obj: { 1927 | /** 1928 | * 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 1929 | */ 1930 | delta?: number; 1931 | }): void; 1932 | 1933 | /** 1934 | * 创建一个动画实例animation。调用实例的方法来描述动画。最后通过动画实例的export方法导出动画数据传递给组件的animation属性。 1935 | */ 1936 | createAnimation(obj: { 1937 | /** 1938 | * 400 1939 | */ 1940 | duration?: number; 1941 | /** 1942 | * "linear" 1943 | */ 1944 | timingFunction?: string; 1945 | /** 1946 | * 0 1947 | */ 1948 | delay?: number; 1949 | /** 1950 | * "50% 50% 0" 1951 | */ 1952 | transformOrigin?: string; 1953 | }): IAnimation; 1954 | 1955 | /** 1956 | * 创建 canvas 绘图上下文(指定 canvasId).Tip: 需要指定 canvasId,该绘图上下文只作用于对应的 1957 | */ 1958 | createCanvasContext(canvasId: string): ICanvasContext; 1959 | 1960 | /** 1961 | * 把当前画布的内容导出生成图片,并返回文件路径 1962 | */ 1963 | canvasToTempFilePath(canvasId: string): void; 1964 | 1965 | /** 1966 | * 停止当前页面下拉刷新。 1967 | */ 1968 | stopPullDownRefresh(): void; 1969 | 1970 | // # 第三方平台 # 1971 | 1972 | getExtConfig(obj: { 1973 | /** 1974 | * 返回第三方平台自定义的数据 1975 | */ 1976 | success?: Function; 1977 | /** 1978 | * 接口调用失败的回调函数 1979 | */ 1980 | fail?: Function; 1981 | /** 1982 | * 接口调用结束的回调函数(调用成功、失败都会执行) 1983 | */ 1984 | complete?: Function; 1985 | }): void; 1986 | 1987 | getExtConfigSync(): void; 1988 | 1989 | // # 开放接口 # 1990 | 1991 | /** 1992 | * 调用接口获取登录凭证(code)进而换取用户登录态信息,包括用户的唯一标识(openid) 及本次登录的 会话密钥(session_key)。用户数据的加解密通讯需要依赖会话密钥完成。 1993 | */ 1994 | login(obj: { 1995 | /** 1996 | * 接口调用成功的回调函数 1997 | */ 1998 | success?: Function; 1999 | /** 2000 | * 接口调用失败的回调函数 2001 | */ 2002 | fail?: Function; 2003 | /** 2004 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2005 | */ 2006 | complete?: Function; 2007 | }): void; 2008 | 2009 | /** 2010 | * 通过上述接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用wx.checkSession接口检测当前用户登录态是否有效。登录态过期后开发者可以再调用wx.login获取新的用户登录态。 2011 | */ 2012 | checkSession(obj: { 2013 | /** 2014 | * 接口调用成功的回调函数,登录态未过期 2015 | */ 2016 | success?: Function; 2017 | /** 2018 | * 接口调用失败的回调函数,登录态已过期 2019 | */ 2020 | fail?: Function; 2021 | /** 2022 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2023 | */ 2024 | complete?: Function; 2025 | }): void; 2026 | 2027 | /** 2028 | * 获取用户信息,需要先调用 wx.login 接口。 2029 | */ 2030 | getUserInfo(obj: { 2031 | /** 2032 | * 是否带上登录态信息 2033 | */ 2034 | withCredentials?: boolean; 2035 | /** 2036 | * 接口调用成功的回调函数 2037 | */ 2038 | success?: Function; 2039 | /** 2040 | * 接口调用失败的回调函数 2041 | */ 2042 | fail?: Function; 2043 | /** 2044 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2045 | */ 2046 | complete?: Function; 2047 | }): void; 2048 | 2049 | /** 2050 | * 发起微信支付。 2051 | */ 2052 | requestPayment(obj: { 2053 | /** 2054 | * 时间戳从1970年1月1日00:00:00至今的秒数,即当前的时间 2055 | */ 2056 | timeStamp: string; 2057 | /** 2058 | * 随机字符串,长度为32个字符以下。 2059 | */ 2060 | nonceStr: string; 2061 | /** 2062 | * 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=* 2063 | */ 2064 | package: string; 2065 | /** 2066 | * 签名算法,暂支持 MD5 2067 | */ 2068 | signType: string; 2069 | /** 2070 | * 签名,具体签名方案参见微信公众号支付帮助文档; 2071 | */ 2072 | paySign: string; 2073 | /** 2074 | * 接口调用成功的回调函数 2075 | */ 2076 | success?: Function; 2077 | /** 2078 | * 接口调用失败的回调函数 2079 | */ 2080 | fail?: Function; 2081 | /** 2082 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2083 | */ 2084 | complete?: Function; 2085 | }): void; 2086 | 2087 | chooseAddress(obj: { 2088 | /** 2089 | * 返回用户选择的收货地址信息 2090 | */ 2091 | success?: Function; 2092 | /** 2093 | * 接口调用失败的回调函数 2094 | */ 2095 | fail?: Function; 2096 | /** 2097 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2098 | */ 2099 | complete?: Function; 2100 | }): void; 2101 | 2102 | addCard(obj: { 2103 | /** 2104 | * 需要添加的卡券列表 2105 | */ 2106 | cardList: undefined; 2107 | /** 2108 | * 接口调用成功的回调函数 2109 | */ 2110 | success?: Function; 2111 | /** 2112 | * 接口调用失败的回调函数 2113 | */ 2114 | fail?: Function; 2115 | /** 2116 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2117 | */ 2118 | complete?: Function; 2119 | }): void; 2120 | 2121 | openCard(obj: { 2122 | /** 2123 | * 需要打开的卡券列表 2124 | */ 2125 | cardList: undefined; 2126 | /** 2127 | * 接口调用成功的回调函数 2128 | */ 2129 | success?: Function; 2130 | /** 2131 | * 接口调用失败的回调函数 2132 | */ 2133 | fail?: Function; 2134 | /** 2135 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2136 | */ 2137 | complete?: Function; 2138 | }): void; 2139 | 2140 | openSetting(obj: { 2141 | /** 2142 | * 接口调用成功的回调函数,返回内容详见返回参数说明。 2143 | */ 2144 | success?: Function; 2145 | /** 2146 | * 接口调用失败的回调函数 2147 | */ 2148 | fail?: Function; 2149 | /** 2150 | * 接口调用结束的回调函数(调用成功、失败都会执行) 2151 | */ 2152 | complete?: Function; 2153 | }): void; 2154 | 2155 | // # 数据分析 # 2156 | 2157 | // # 拓展接口 # 2158 | 2159 | arrayBufferToBase64(arrayBuffer: string): void; 2160 | 2161 | base64ToArrayBuffer(base64: string): void; 2162 | 2163 | } -------------------------------------------------------------------------------- /utils/country_list.js: -------------------------------------------------------------------------------- 1 | const countries = [ 2 | 'All Countries', 3 | 'Australia', 4 | 'China', 5 | 'Canada', 6 | 'France', 7 | 'Germany', 8 | 'India', 9 | 'Japan', 10 | 'UK', 11 | 'USA' 12 | ]; 13 | 14 | export default countries; 15 | -------------------------------------------------------------------------------- /utils/language_list.js: -------------------------------------------------------------------------------- 1 | const languages = [ 2 | "All Languages", 3 | "ActionScript", 4 | "C", 5 | "C#", 6 | "C++", 7 | "Clojure", 8 | "CoffeeScript", 9 | "CSS", 10 | "Go", 11 | "Haskell", 12 | "HTML", 13 | "Java", 14 | "JavaScript", 15 | "Lua", 16 | "Matlab", 17 | "Objective-C", 18 | "Objective-C++", 19 | "Perl", 20 | "PHP", 21 | "Python", 22 | "R", 23 | "Ruby", 24 | "Scala", 25 | "Shell", 26 | "Swift", 27 | "TeX", 28 | "VimL" 29 | ]; 30 | 31 | export default languages; 32 | -------------------------------------------------------------------------------- /utils/services.js: -------------------------------------------------------------------------------- 1 | export const fetch = (url) => { 2 | return new Promise((resolve, reject) => { 3 | wx.request({ 4 | url: url, 5 | method: 'GET', 6 | data: {}, 7 | header: { 8 | 'Accept': 'application/json' 9 | }, 10 | success: resolve, 11 | fail: reject 12 | }); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | export const debounce = (fn, delay) => { 2 | let timer, context, args; 3 | 4 | return function () { 5 | context = this; 6 | args = arguments; 7 | 8 | if (timer) clearTimeout(timer); 9 | timer = setTimeout(() => { 10 | fn.apply(context, args); 11 | }, delay); 12 | }; 13 | }; 14 | 15 | export const timesAgo = (date) => { 16 | const currentDate = new Date(); 17 | const ghDate = new Date(date); 18 | 19 | return timeDifference(currentDate.getTime(), ghDate.getTime()); 20 | }; 21 | 22 | const timeDifference = (current, previous) => { 23 | const msPerMinute = 60 * 1000; 24 | const msPerHour = msPerMinute * 60; 25 | const msPerDay = msPerHour * 60; 26 | const msPerWeek = msPerDay * 7; 27 | const msPerMouth = msPerWeek * 4; 28 | const msPerYear = msPerMouth * 12; 29 | const elapsed = Math.abs(current - previous); 30 | 31 | switch (true) { 32 | case elapsed < msPerMinute: 33 | return Math.round(elapsed / 1000) + ' seconds age'; 34 | case elapsed < msPerHour: 35 | return Math.round(elapsed / msPerMinute) + ' minutes age'; 36 | case elapsed < msPerDay: 37 | return Math.round(elapsed / msPerHour) + ' hours age'; 38 | case elapsed < msPerWeek: 39 | return Math.round(elapsed / msPerDay) + ' days age'; 40 | case elapsed < msPerMouth: 41 | return `approximately ${Math.round(elapsed / msPerWeek)} weeks age`; 42 | case elapsed < msPerYear: 43 | return `approximately ${Math.round(elapsed / msPerMouth)} mouths age`; 44 | default: 45 | return `approximately ${Math.round(elapsed / msPerYear)} years age`; 46 | } 47 | }; 48 | --------------------------------------------------------------------------------