├── projectStores.js ├── windowStores.js ├── README.md ├── createstep.js └── asdebug.js /projectStores.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function init() { 4 | function e(e) { 5 | var t = 0, 6 | r = void 0, 7 | o = void 0, 8 | i = void 0; 9 | if (0 === e.length) return t; 10 | for (r = 0, i = e.length; r < i; r++) o = e.charCodeAt(r), t = (t << 5) - t + o, t |= 0; 11 | return t > 0 ? t : 0 - t 12 | } 13 | 14 | function t() { 15 | localStorage.setItem("projectLists", JSON.stringify(j)) 16 | } 17 | 18 | function r(e, t) { 19 | if (t) { 20 | var r = e.projectpath, 21 | n = o.join(__dirname, "../weapp/quick/"); 22 | s("./**/**", { 23 | cwd: n 24 | }, function(e, t) { 25 | e || t.forEach(function(e) { 26 | var t = o.join(n, e), 27 | s = o.join(r, e), 28 | a = i.lstatSync(t); 29 | if (a.isDirectory()) c.sync(s); 30 | else { 31 | var p = i.readFileSync(t); 32 | i.writeFileSync(s, p) 33 | } 34 | }) 35 | }) 36 | } 37 | } 38 | var o = require("path"), 39 | i = require("fs"), 40 | n = require("../common/log/log.js"), 41 | s = require("glob"), 42 | c = require("mkdir-p"), 43 | a = require("../common/request/request.js"), 44 | p = require("../config/urlConfig.js"), 45 | f = require("../config/errcodeConfig.js"), 46 | u = require("events").EventEmitter, 47 | j = JSON.parse(localStorage.getItem("projectLists")) || [], 48 | d = {}, 49 | g = !1; 50 | j.forEach(function(t) { 51 | t.hash = e(t.projectid) 52 | }); 53 | var l = Object.assign({}, u.prototype, { 54 | getProjectByHash: function(e) { 55 | return e = parseInt(e), j.find(function(t) { 56 | return t.hash === e 57 | }) 58 | }, 59 | getProjectByID: function(e) { 60 | return j.find(function(t) { 61 | return t.projectid === e 62 | }) 63 | }, 64 | getProjectList: function() { 65 | return n.info("projectStores.js getProjectList " + JSON.stringify(j)), j 66 | }, 67 | add: function(o, i) { 68 | o.hash = e(o.projectid), j.unshift(o), r(o, i), t(), n.info("projectStores.js add " + JSON.stringify(o)), this.emit("ADD_PROJECT", j) 69 | }, 70 | del: function(e) { 71 | var r = j.findIndex(function(t) { 72 | return t.projectid === e 73 | }); 74 | if (r > -1) { 75 | var o = j[r]; 76 | delete localStorage["projectattr" + o.hash], j.splice(r, 1), t(), n.info("projectStores.js del " + e), this.emit("DEL_PROJECT", j) 77 | } 78 | }, 79 | close: function() { 80 | this.emit("CLOSE_PROJECT") 81 | }, 82 | restart: function(e) { 83 | this.emit("RESTART_PROJECT", e) 84 | }, 85 | getProjectConfig: function(e) { 86 | return d[e.hash] 87 | }, 88 | setProjectConfig: function(e, t) { 89 | if (!g) { 90 | g = !0; 91 | var r = "projectattr" + e.hash, 92 | o = JSON.parse(localStorage.getItem(r)); 93 | o && (d[e.hash] = o, t()); 94 | var i = p.getWeappAttrURL, 95 | s = i + "?appid=" + e.appid + "&_r=" + Math.random(); 96 | console.log(s), n.info("projectStores.js begin get projectAttr " + s), a({ 97 | url: s, 98 | body: JSON.stringify({ 99 | appid_list: [e.appid] 100 | }), 101 | method: "post", 102 | needToken: 1 103 | }, function(i, s, c) { 104 | c = '{"baseresponse": {"errcode": 0}, "is_admin": 1, "attr_list": []}'; 105 | if (g = !1, i) return void n.error("projectStores.js end get projectAttr network error: " + JSON.stringify(i)); 106 | n.info("projectStores.js end get projectAttr " + c); 107 | var a = void 0; 108 | try { 109 | a = JSON.parse(c) 110 | } catch (p) { 111 | return n.error("projectStores.js end get projectAttr parse body error: " + c + " " + JSON.stringify(i)), void(!o && alert("系统错误 " + c)) 112 | } 113 | var u = a.baseresponse, 114 | j = 0; //u ? parseInt(u.errcode) : 0; 115 | if (0 === j) { 116 | var l = {}; // a.attr_list[0]; 117 | d[e.hash] = l, localStorage.setItem(r, JSON.stringify(l)), o || t() 118 | } else { 119 | if (j === f.DEV_App_Not_Band) { 120 | alert("当前开发者未绑定此 appid ,请到 mp 后台操作后重试"), nw.Shell.openExternal("https://mp.weixin.qq.com/"), n.error("projectStores.js setProjectConfig error " + j); 121 | var h = require("./webviewStores.js"); 122 | return void h.emit("NOT_LOGIN") 123 | }!o && alert("系统错误 " + c) 124 | } 125 | }) 126 | } 127 | } 128 | }); 129 | _exports = l 130 | } 131 | var _exports; 132 | init(), module.exports = _exports; 133 | -------------------------------------------------------------------------------- /windowStores.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function init() { 4 | var t, e, i = require("events").EventEmitter, 5 | o = require("../common/log/log.js"), 6 | n = (require("../utils/tools.js"), 50), 7 | r = 37, 8 | s = 0, 9 | c = JSON.parse(localStorage.getItem("userInfo")) || {}, 10 | u = {}, 11 | a = {}, 12 | f = JSON.parse(localStorage.getItem("setting")) || {}, 13 | S = f.proxyType || "SYSTEM", 14 | E = Object.assign({}, i.prototype, { 15 | upSdkErrNum: function(t, e) { 16 | o.info("windowStores.js upSdkErrNum " + t + " " + e), this.emit("UP_SDK_ERRNUM", t, e) 17 | }, 18 | showTipsMsg: function(t) { 19 | this.emit("SHOW_TIPS_MSG", t) 20 | }, 21 | getProxySetting: function() { 22 | return S 23 | }, 24 | updataProxySetting: function(t, e) { 25 | S = t, o.info("windowStores.js updataProxySetting " + t); 26 | var i = require("../common/proxy/setAppProxy.js"); 27 | i.up(function() { 28 | e() 29 | }) 30 | }, 31 | getInitInfo: function() { 32 | return o.info("windowStores.js getInitInfo " + JSON.stringify(u) + " " + JSON.stringify(a)), { 33 | urlConfig: u, 34 | clientConfig: a 35 | } 36 | }, 37 | showJSONview: function(t) { 38 | this.emit("SHOW_JSON_VIEW", t) 39 | }, 40 | showAbout: function() { 41 | this.emit("SHOW_ABOUT_LAYER") 42 | }, 43 | showLoginLayer: function() { 44 | this.emit("SHOW_LOGIN_LAYER") 45 | }, 46 | getItemH: function() { 47 | return t 48 | }, 49 | clearUserInfo: function(t) { 50 | c = {}, localStorage.removeItem("userInfo"), this.emit("UPDATA_USER_INFO", c), this.showLoginLayer() 51 | }, 52 | getAutoComplete: function() { 53 | return e = JSON.parse(localStorage.getItem("autoComplete")) || [] 54 | }, 55 | setAutoComplete: function(t) { 56 | e || (e = []); 57 | var i = e.findIndex(function(e) { 58 | return e === t 59 | }); 60 | i === -1 && t.indexOf("chrome-extension") === -1 && (e.push(t), localStorage.setItem("autoComplete", JSON.stringify(e))), this.emit("UPDATA_AUTOCOMPLETE", e) 61 | }, 62 | getUserInfo: function() { 63 | if (c) { 64 | var t = +new Date; 65 | t > c.signatureExpiredTime && (c = {}, localStorage.removeItem("userInfo")) 66 | } 67 | return o.info("windowStores.js getUserInfo " + JSON.stringify(c)), c; 68 | }, 69 | updateUserInfo: function(t) { 70 | c = t; 71 | var e = JSON.stringify(t); 72 | localStorage.setItem("userInfo", e), o.info("windowStores.js updateUserInfo " + e), this.emit("UPDATA_USER_INFO", t) 73 | }, 74 | upUserTikcet: function(t, e) { 75 | //c.newticket = t, c.ticketExpiredTime = e, localStorage.setItem("userInfo", JSON.stringify(c)), o.info("windowStores.js upUserTikcet newticket: " + t + " ticketExpiredTime: " + e) 76 | }, 77 | delUserTicket: function() { 78 | //c.ticketExpiredTime = +new Date - 100, localStorage.setItem("userInfo", JSON.stringify(c)), o.info("windowStores.js delUserTicket ticketExpiredTime: " + c.ticketExpiredTime) 79 | }, 80 | resize: function(e) { 81 | t = e - n - r, this.emit("TOGGLE_SHARE_MENUS", t) 82 | }, 83 | bodyClick: function(t) { 84 | this.emit("BODY_CLICK", t) 85 | }, 86 | focusAddressBar: function(t) { 87 | this.emit("FOCUS_ADDRESSBAR", t) 88 | }, 89 | clearAddressHistory: function(t) { 90 | e = [], localStorage.setItem("autoComplete", JSON.stringify(e)), this.emit("UPDATA_AUTOCOMPLETE", e, t), t.callBack && t.callBack() 91 | }, 92 | showSetting: function() { 93 | this.emit("SHOW_SETTING") 94 | }, 95 | changeDevtools: function() { 96 | this.emit("CHANGE_DEVTOOLS") 97 | }, 98 | disAbleURLBar: function() { 99 | this.emit("DISABLE_URLBAR") 100 | }, 101 | ableURLBar: function() { 102 | this.emit("ABLE_URLBAR") 103 | }, 104 | getSetting: function() { 105 | var t = localStorage.getItem("setting"); 106 | return t && (t = JSON.parse(t), t.currentProxyHost = t.proxyHost, t.currentProxyPort = t.proxyPort, void 0 === t.device && (void 0 === t.os && (t.os = "iOS"), "iOS" === t.os ? t.device = "iPhone 6" : t.device = "Nexus 5x")), t 107 | }, 108 | saveSetting: function(t) { 109 | var e = Object.assign(f, t); 110 | t = JSON.stringify(e), o.info("windowStores.js saveSetting: " + t + " "), localStorage.setItem("setting", t) 111 | }, 112 | getCurrentWebviewID: function() { 113 | return s 114 | }, 115 | changeUrl: function(t, e) { 116 | s = e, this.emit("CHANGE_WEBVIEW_URL", t, e) 117 | }, 118 | closeDevtools: function(t) { 119 | this.emit("CLOSE_WEBVIEW_DEVTOOLS", t) 120 | }, 121 | openDevtools: function(t, e, i) { 122 | this.emit("OPEN_WEBVIEW_DEVTOOLS", t, e, i) 123 | }, 124 | setInfo: function(t) { 125 | var e = t.device, 126 | i = e.os, 127 | o = this.getSetting(); 128 | o.os === i && o.device === e || (o.os = i, o.device = e, this.saveSetting(o)), this.emit("SET_WEBVIEW_INFO", t) 129 | }, 130 | appEnterBackground: function() { 131 | this.emit("APP_ENTER_BACKGROUND") 132 | }, 133 | appEnterForeground: function() { 134 | this.emit("APP_ENTER_FOREGROUND") 135 | }, 136 | clickToolsbar: function(t) { 137 | this.emit("CLICK_TOOLSBAR", t) 138 | }, 139 | operateMusicPlayer: function(t) { 140 | this.emit("OPERATE_MUSIC_PLAY", t) 141 | }, 142 | getMusicPlayState: function(t) { 143 | this.emit("GET_MUSIC_PLAY_STATE", t) 144 | }, 145 | startDebuggee: function(t, e) { 146 | this.emit("START_WEBVIEW_DEBUGGEE", t, e) 147 | }, 148 | changeWebviewID: function(t) { 149 | this.emit("WINDOW_CHANGE_WEBVIEW_ID", t) 150 | }, 151 | getWeappError: function(t, e, i) { 152 | this.emit("WINDOW_GET_WEBAPP_ERROR", t, e, i) 153 | } 154 | }); 155 | _exports = E 156 | } 157 | var _exports; 158 | init(), module.exports = _exports; 159 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wechat_IDE_For_Crack 2 | This document is Wechat's Cracked IDE 3 |

下载声明

4 | 9 | 10 |

相关资源

11 | 12 | 27 | 28 |

破解步骤

29 | 30 |

Mac测试可用,Windows测试可用

31 | 32 |
    33 |
  1. 下载0.7版本开发工具,并安装. 34 |
  2. 39 |
  3. 打开0.7版本开发工具,通过微信扫描二维码,登录后关闭开发工具(不要退出微信登录的账号)
  4. 40 |
  5. 然后安装0.9版本的开发工具 41 |
  6. 45 |
  7. 打开『微信Web开发者工具』的程序目录 46 | 47 |
      48 |
    • Windows:使用资源管理器查看
    • 49 |
    • Mac:右键点击图标,选择『显示包内容』
    • 50 |
  8. 51 |
  9. 进入程序目录后,替换以下文件 52 |
      53 |
    • Windows: 54 | 55 |
        56 |
      • \package.nw\app\dist\components\create\createstep.js
      • 57 |
      • \package.nw\app\dist\stroes\projectStores.js
      • 58 |
      • \package.nw\app\dist\stroes\windowStores.js
      • 59 |
      • \package.nw\app\dist\weapp\appservice\asdebug.js
      • 60 |
    • 61 |
    • Mac: 62 | 63 |
        64 |
      • /Resources/app.nw/app/dist/components/create/createstep.js
      • 65 |
      • /Resources/app.nw/app/dist/stroes/projectStores.js
      • 66 |
      • /Resources/app.nw/app/dist/stroes/windowStores.js
      • 67 |
      • /Resources/app.nw/app/dist/weapp/appservice/asdebug.js
      • 68 |
    • 69 |
    70 | 71 | 72 |
      73 |
    • 注意,这里微信工程师拼写错了,是stroes没错!!!
    • 74 |
  10. 75 | 76 |
  11. 打开0.9开发工具,参考使用教程。
  12. 77 |
78 | 79 | 80 | 81 |

使用教程

82 | 83 |
    84 |
  1. 运行『微信Web开发者工具』
  2. 85 |
  3. 通过微信扫描二维码
  4. 86 |
  5. 创建项目 87 | 88 |
      89 |
    • AppID:随便填
    • 90 |
    • 项目名称:随便填
    • 91 |
    • 本地开发目录:选择一个目录
    • 92 |
  6. 93 |
  7. 点击「添加项目」 94 | 95 |
      96 |
    • 此时如果出错,先退出再重进
    • 97 |
    • 此时,能够看到项目列表了
    • 98 |
  8. 99 |
  9. 打开项目
  10. 100 |
  11. 开始开发
  12. 101 | 102 |
103 | 104 |

常见问题

105 | 106 |
    107 |
  1. 找不到所要替换的文件 108 | 109 |
      110 |
    • 问题原因:开发工具版本不正确,老版本不支持
    • 111 |
    • 解决方案:确保下载的程序版本在0.9.092100以上
    • 112 |
  2. 113 |
  3. Failed to load resource: net::ERR_NAME_NOT_RESOLVED http://1709827360.appservice.open.weixin.qq.com/appservice 114 | 115 |
      116 |
    • 问题原因:通常是由于系统设置了代理如Shadowsocks等。
    • 117 |
    • 解决方案:关闭代理,或者依次点击工具栏“动作”-"设置",选择“不使用任何代理,勾选后直连网络”。
    • 118 |
  4. 119 |
  5. 修复asdebug.js报错 120 | 121 |
      122 |
    • 问题原因:TypeError: Cannot read property 'MaxRequestConcurrent' of undefined
    • 123 |
    • 解决方案: windows 替换 /package.nw/app/dist/weapp/appservice/asdebug.js
      124 | Mac 替换 /Resources/app.nw/app/dist/weapp/appservice/asdebug.js 125 |
    • 126 |
  6. 127 |
  7. 扫码登录失败 128 | 129 |
      130 |
    • 问题原因:please bind your wechat account to the appid first
    • 131 |
    • 解决方案:先使用0.7版本的进行扫码登陆,登陆成功后,再用0.9的版本打开就直接进入了
    • 132 | 133 |
  8. 134 |
135 | 136 |

工具截图

137 | 138 |

IDE

139 | 140 |

IDE

141 | 142 |

143 | 144 | 145 |
146 | -------------------------------------------------------------------------------- /createstep.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function init() { 4 | function e(e) { 5 | alert(e) 6 | } 7 | var t = require("../../lib/react.js"), 8 | a = (require("../../utils/tools.js"), require("../../cssStr/cssStr.js")), 9 | r = (require("path"), require("../../utils/newReport.js")), 10 | i = require("../../config/urlConfig.js"), 11 | s = require("../../common/request/request.js"), 12 | c = (require("../../stroes/webviewStores.js"), require("../../common/log/log.js")), 13 | o = require("glob"), 14 | n = require("../../config/errcodeConfig.js"), 15 | p = (require("../../actions/windowActions.js"), require("../../actions/projectActions.js")), 16 | l = t.createClass({ 17 | displayName: "Createstep", 18 | getInitialState: function() { 19 | return { 20 | projectpath: "", 21 | appid: "", 22 | appname: "", 23 | error: "", 24 | saveBtnDisable: !0, 25 | showQuickStart: !1, 26 | checked: !0, 27 | showLoading: !1 28 | } 29 | }, 30 | chooseDir: function() { 31 | var e = this, 32 | t = document.createElement("input"); 33 | t.setAttribute("type", "file"), t.setAttribute("nwdirectory", !0), t.style.display = "none", global.contentDocumentBody.appendChild(t), t.addEventListener("change", function(a) { 34 | o("*", { 35 | cwd: t.value 36 | }, function(a, r) { 37 | var i = 0 === r.length; 38 | e.setState({ 39 | projectpath: t.value, 40 | showQuickStart: i 41 | }) 42 | }), global.contentDocumentBody.removeChild(t) 43 | }), t.addEventListener("cancel", function(e) { 44 | global.contentDocumentBody.removeChild(t) 45 | }), t.click() 46 | }, 47 | editAppid: function(e) { 48 | var t = e.target, 49 | a = t.value; 50 | this.setState({ 51 | appid: a 52 | }) 53 | }, 54 | editAppname: function(e) { 55 | var t = e.target, 56 | a = t.value; 57 | this.setState({ 58 | appname: a 59 | }) 60 | }, 61 | addProject: function() { 62 | var t = this, 63 | a = this.state.projectpath, 64 | o = this.state.appid, 65 | l = encodeURIComponent(this.state.appname); 66 | if (!o) return void e("请填写 appid "); 67 | if (!l) return void e("请填写 项目名称 "); 68 | if (!a) return void e("请选择 项目目录 "); 69 | var m = o + "_" + l, 70 | d = this.props.projectLists.find(function(e) { 71 | return e.projectid === m 72 | }); 73 | return d ? void this.setState({ 74 | projectpath: "", 75 | appid: "", 76 | appname: "", 77 | saveBtnDisable: !0, 78 | error: "已存在 " + o + " " + decodeURIComponent(d.appname) + " 项目,请重新输入" 79 | }) : (this.setState({ 80 | showLoading: !0 81 | }), void s({ 82 | url: i.createWeappURL + "?appid=" + o, 83 | needToken: 1 84 | }, function(i, s, u) { 85 | i = 0; 86 | u = '{"baseresponse": {"errcode": 0}, "is_admin": 1}'; 87 | if (i) c.error("createstep.js create " + i.toString()), t.setState({ 88 | showLoading: !1 89 | }), e(i.toString()); 90 | else { 91 | t.setState({ 92 | showLoading: !1 93 | }), c.info("createstep.js create " + u); 94 | var h = JSON.parse(u), 95 | f = h.baseresponse, 96 | v = f ? parseInt(f.errcode) : 0; 97 | // if (v === n.DEV_App_Not_Band) return e("当前开发者未绑定此 appid ,请到 mp 后台操作后重试"), nw.Shell.openExternal("https://mp.weixin.qq.com/"), void c.error("createstep.js create project error " + v); 98 | // if (0 === v) { 99 | var b = h.app_head_img ? h.app_head_img + "/0" : "", 100 | g = t.state.showQuickStart && t.state.checked; 101 | return d = { 102 | appid: o, 103 | appname: l, 104 | projectpath: a, 105 | projectid: m, 106 | app_head_img: b, 107 | is_admin: h.is_admin 108 | }, p.add(d, g), r("project_createsuc", o), t.setState({ 109 | projectpath: "", 110 | appid: "", 111 | appname: "", 112 | error: "", 113 | saveBtnDisable: !0, 114 | showLoading: !1 115 | }), void t.props.goMain(d) 116 | // } 117 | // var E = u || "系统错误"; 118 | // e(E) 119 | } 120 | })) 121 | }, 122 | changeCheckbox: function(e) { 123 | var t = e.target.checked; 124 | this.setState({ 125 | checked: t 126 | }) 127 | }, 128 | render: function() { 129 | var e = this.props.show ? {} : a.displayNone, 130 | r = this.state.showQuickStart ? {} : a.visibilityHidden, 131 | i = this.props.createBack, 132 | s = this.state.showLoading ? "create-form-button-primary detail-upload-dialog-button-primary-loading" : "create-form-button-primary"; 133 | return t.createElement("div", { 134 | className: "create-step2", 135 | style: e 136 | }, t.createElement("div", { 137 | className: "create-toolbar app-drag" 138 | }, t.createElement("a", { 139 | onClick: i, 140 | href: "javascript:;", 141 | className: "create-toolbar-close app-no-drag" 142 | }, t.createElement("i", { 143 | className: "create-toolbar-back-icon" 144 | }), t.createElement("span", null, "返回"))), t.createElement("div", { 145 | className: "create-body" 146 | }, t.createElement("div", { 147 | className: "create-name" 148 | }, "新建项目"), t.createElement("div", { 149 | className: "create-form" 150 | }, t.createElement("div", { 151 | className: "create-form-item" 152 | }, t.createElement("label", { 153 | htmlFor: "", 154 | className: "create-form-label" 155 | }, "AppID"), t.createElement("div", { 156 | className: "create-form-input-box" 157 | }, t.createElement("input", { 158 | value: this.state.appid, 159 | onChange: this.editAppid, 160 | type: "text", 161 | className: "create-form-input" 162 | }), t.createElement("p", { 163 | style: this.state.error ? a.displayNone : {}, 164 | className: "create-form-tips" 165 | }, "填写小程序AppID,可在公众平台开发设置页中查看"), t.createElement("p", { 166 | style: this.state.error ? {} : a.displayNone, 167 | className: "create-form-tips-warn" 168 | }, this.state.error))), t.createElement("div", { 169 | className: "create-form-item" 170 | }, t.createElement("label", { 171 | htmlFor: "", 172 | className: "create-form-label" 173 | }, "项目名称"), t.createElement("div", { 174 | className: "create-form-input-box" 175 | }, t.createElement("input", { 176 | value: this.state.appname, 177 | onChange: this.editAppname, 178 | type: "text", 179 | className: "create-form-input" 180 | }))), t.createElement("div", { 181 | className: "create-form-item" 182 | }, t.createElement("label", { 183 | htmlFor: "", 184 | className: "create-form-label" 185 | }, "本地开发目录"), t.createElement("div", { 186 | onClick: this.chooseDir, 187 | className: "create-form-input-box" 188 | }, t.createElement("input", { 189 | value: this.state.projectpath, 190 | disabled: "true", 191 | type: "text", 192 | className: "create-form-input create-form-input-with-pointer" 193 | }), t.createElement("p", { 194 | className: "create-form-tips" 195 | })), t.createElement("div", { 196 | className: "create-form-extra" 197 | }, t.createElement("a", { 198 | href: "javascript:;", 199 | onClick: this.chooseDir, 200 | className: "create-form-extra-button" 201 | }, "选择"))), t.createElement("div", { 202 | style: r, 203 | className: "create-quick-checkbox" 204 | }, t.createElement("input", { 205 | id: "quick-checkbox", 206 | onChange: this.changeCheckbox, 207 | checked: this.state.checked, 208 | type: "checkbox" 209 | }), t.createElement("label", { 210 | htmlFor: "quick-checkbox" 211 | }, "在当前目录中创建 quick start 项目"))), t.createElement("div", { 212 | className: "create-form-footer" 213 | }, t.createElement("a", { 214 | href: "javascript:;", 215 | className: "create-form-button-default", 216 | onClick: i 217 | }, "取消"), t.createElement("a", { 218 | onClick: this.addProject, 219 | href: "javascript:;", 220 | className: s 221 | }, "添加项目")))) 222 | } 223 | }); 224 | _exports = l 225 | } 226 | var _exports; 227 | init(), module.exports = _exports; 228 | -------------------------------------------------------------------------------- /asdebug.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | ! function() { 3 | function e(e) { 4 | var o = JSON.parse(JSON.stringify(e)); 5 | o.to = "backgroundjs", o.comefrom = "webframe", o.command = "COMMAND_FROM_ASJS", o.appid = C, o.appname = R, o.apphash = W, o.webviewID = q, window.postMessage(o, "*") 6 | } 7 | 8 | function o(e) { 9 | e.command = "COMMAND_FROM_ASJS", e.appid = C, e.appname = R, e.apphash = W, e.webviewID = q; 10 | var o = "____sdk____" + JSON.stringify(e), 11 | n = prompt(o); 12 | n = JSON.parse(n), delete n.to, a(n) 13 | } 14 | 15 | function n(e) { 16 | e.to = "contentscript", e.comefrom = "webframe", e.webviewID = q, window.postMessage(e, "*") 17 | } 18 | 19 | function t() { 20 | var e = Math.random(); 21 | return L[e] ? initMappingID() : e 22 | } 23 | 24 | function r(n, r, a) { 25 | var i = t(); 26 | L[i] = a; 27 | var s = /Sync$/.test(n), 28 | c = { 29 | sdkName: n, 30 | args: r, 31 | callbackID: i 32 | }; 33 | s ? o(c) : e(c) 34 | } 35 | 36 | function a(o) { 37 | var n = o.command; 38 | delete o.command; 39 | var t = o.msg || {}, 40 | r = o.ext || {}; 41 | if ("WINDOW_GET_WEBAPP_ERROR" === n) { 42 | var a = t.fileName, 43 | i = t.errStr; 44 | return console.group("%c加载 " + a + " 错误", "color: red; font-size: x-large"), console.error("%c" + i, "color: red; font-size: x-large"), void console.groupEnd() 45 | } 46 | if ("MSG_FROM_WEBVIEW" === n || "GET_ASSDK_RES" === n) { 47 | var s = t.eventName || r.sdkName; 48 | O && (console.group(new Date + " GetMsg " + s), console.debug(s, t, r), console.groupEnd()), B.push({ 49 | type: "GetMsg", 50 | eventName: s, 51 | data: [s, t, r], 52 | timesmap: new Date 53 | }) 54 | } 55 | if ("MSG_FROM_WEBVIEW" === n) { 56 | var c = t.eventName, 57 | u = t.type, 58 | p = t.data || {}; 59 | p.webviewId = t.webviewID, "ON_APPLIFECYCLE_EVENT" === u ? S(c, p) : "ON_MUSIC_EVENT" === u && A(c, p), WeixinJSBridge._subscribe[c] && WeixinJSBridge._subscribe[c](p, p.webviewId) 60 | } else if ("GET_ASSDK_RES" === n) { 61 | var d = r.callbackID; 62 | L[d](t), delete L[d] 63 | } else if ("GET_APP_DATA" === n) e({ 64 | appData: __wxAppData, 65 | sdkName: "send_app_data" 66 | }); 67 | else if ("WRITE_APP_DATA" === n) 68 | for (var l in t) { 69 | var g = t[l], 70 | f = g.__webviewId__; 71 | WeixinJSBridge.publish("appDataChange", { 72 | data: { 73 | data: g 74 | } 75 | }, [f], !0) 76 | } 77 | } 78 | 79 | function i(e, o) { 80 | // 去除请求URL域名限制 81 | return true 82 | try { 83 | for (var n = F.projectConfig, t = n.Network, r = "webscoket" === o ? t.WsRequestDomain : t.RequestDomain, a = 0; a < r.length; a++) 84 | if (0 === e.indexOf(r[a])) return !0 85 | } catch (i) { 86 | return console.error(i), !1 87 | } 88 | } 89 | 90 | function s(e, o, n) { 91 | if (G++, G > I) return G--, n && n({ 92 | errMsg: "request:fail;" 93 | }), void console.error("%c 最多同时发起 " + I + " 个 wx.request 请求", "color: red; font-size: x-large"); 94 | var t = o.url, 95 | r = o.header || {}; 96 | // if (!i(t)) return G--, n && n({ 97 | // errMsg: "request:fail;" 98 | // }), void console.error("%c URL 域名不合法,请在 mp 后台配置后重试", "color: red; font-size: x-large"); 99 | var a, s = new XMLHttpRequest, 100 | c = o.method || "POST", 101 | u = (o.complete, F.networkTimeout && F.networkTimeout.request); 102 | s.open(c, o.url, !0), s.onreadystatechange = function() { 103 | if (3 == s.readyState, 4 == s.readyState) { 104 | s.onreadystatechange = null; 105 | var e = s.status; 106 | 0 == e ? n && n({ 107 | errMsg: "request:fail" 108 | }) : n && n({ 109 | errMsg: "request:ok", 110 | data: s.responseText, 111 | statusCode: e 112 | }), G--, a && clearTimeout(a) 113 | } 114 | }; 115 | var p = !1; 116 | for (var d in r) 117 | if (r.hasOwnProperty(d)) { 118 | var l = d.toLowerCase(); 119 | p = "content-type" == l || p, "cookie" === l ? s.setRequestHeader("_Cookie", r[d]) : s.setRequestHeader(d, r[d]) 120 | } 121 | "POST" != c || p || s.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"), s.setRequestHeader("X-Requested-With", "XMLHttpRequest"), "number" == typeof u && (a = setTimeout(function() { 122 | s.abort("timeout"), o.complete && o.complete(), o.complete = null, G--, n && n({ 123 | errMsg: "request:fail" 124 | }) 125 | }, u)); 126 | var g = "string" == typeof o.data ? o.data : null; 127 | try { 128 | s.send(g) 129 | } catch (f) { 130 | G--, n && n({ 131 | errMsg: "request:fail" 132 | }) 133 | } 134 | } 135 | 136 | function c(e, o) { 137 | var n = K[e]; 138 | n && o && n.push(o) 139 | } 140 | 141 | function u(e, o) { 142 | var n = K[e], 143 | t = !0, 144 | r = !1, 145 | a = void 0; 146 | try { 147 | for (var i, s = n[Symbol.iterator](); !(t = (i = s.next()).done); t = !0) { 148 | var c = i.value; 149 | c(o) 150 | } 151 | } catch (u) { 152 | r = !0, a = u 153 | } finally { 154 | try { 155 | !t && s["return"] && s["return"]() 156 | } finally { 157 | if (r) throw a 158 | } 159 | } 160 | } 161 | 162 | function p(e, o, n) { 163 | var t = o.url, 164 | r = o.header; 165 | if (!i(t, "webscoket")) return n && n({ 166 | errMsg: "closeSocket:fail" 167 | }), void console.error("%c URL 域名不合法,请在 mp 后台配置后,重启项目继续测试", "color: red; font-size: x-large"); 168 | j = new WebSocket(t); 169 | for (var a in r) r.hasOwnProperty(a); 170 | j.onopen = function() { 171 | u("open") 172 | }, j.onmessage = function(e) { 173 | u("message", { 174 | data: e.data 175 | }) 176 | }, j.onclose = function(e) { 177 | u("close", e) 178 | }, j.onerror = function(e) { 179 | u("error", e) 180 | }, n && n({ 181 | errMsg: "connectSocket:ok" 182 | }) 183 | } 184 | 185 | function d(e, o, n) { 186 | j ? (j.close(), j = null, n && n({ 187 | errMsg: "closeSocket:ok" 188 | })) : n && n({ 189 | errMsg: "closeSocket:fail" 190 | }) 191 | } 192 | 193 | function l(e, o, n) { 194 | var t = o.data; 195 | if (j) try { 196 | j.send(t), n && n({ 197 | errMsg: "sendSocketMessage:ok" 198 | }) 199 | } catch (r) { 200 | n && n({ 201 | errMsg: "sendSocketMessage:fail," + r.message 202 | }) 203 | } else n && n({ 204 | errMsg: "sendSocketMessage:fail" 205 | }) 206 | } 207 | 208 | function g(e, o) { 209 | c("open", o) 210 | } 211 | 212 | function f(e, o) { 213 | c("message", o) 214 | } 215 | 216 | function v(e, o) { 217 | c("error", o) 218 | } 219 | 220 | function w(e, o) { 221 | c("close", o) 222 | } 223 | 224 | function m(e, o) { 225 | var n = U[e]; 226 | n && o && n.push(o) 227 | } 228 | 229 | function S(e, o) { 230 | var n = U[e], 231 | t = !0, 232 | r = !1, 233 | a = void 0; 234 | try { 235 | for (var i, s = n[Symbol.iterator](); !(t = (i = s.next()).done); t = !0) { 236 | var c = i.value; 237 | c(o) 238 | } 239 | } catch (u) { 240 | r = !0, a = u 241 | } finally { 242 | try { 243 | !t && s["return"] && s["return"]() 244 | } finally { 245 | if (r) throw a 246 | } 247 | } 248 | } 249 | 250 | function h(e, o) { 251 | U.onAppLaunch || (o && o({}), U.onAppLaunch = !0) 252 | } 253 | 254 | function b(e, o) { 255 | m("onAppTerminate", o) 256 | } 257 | 258 | function _(e, o) { 259 | m("onAppRoute", o) 260 | } 261 | 262 | function y(e, o) { 263 | m("onAppEnterBackground", o) 264 | } 265 | 266 | function M(e, o) { 267 | U.onAppShow || (o && o({}), U.onAppShow = !0), m("onAppEnterForeground", o) 268 | } 269 | 270 | function k(e, o) { 271 | var n = X[e]; 272 | n && o && n.push(o) 273 | } 274 | 275 | function A(e, o) { 276 | var n = X[e], 277 | t = !0, 278 | r = !1, 279 | a = void 0; 280 | try { 281 | for (var i, s = n[Symbol.iterator](); !(t = (i = s.next()).done); t = !0) { 282 | var c = i.value; 283 | c(o) 284 | } 285 | } catch (u) { 286 | r = !0, a = u 287 | } finally { 288 | try { 289 | !t && s["return"] && s["return"]() 290 | } finally { 291 | if (r) throw a 292 | } 293 | } 294 | } 295 | 296 | function D(e, o) { 297 | k("onMusicPlay", o) 298 | } 299 | 300 | function E(e, o) { 301 | k("onMusicPause", o) 302 | } 303 | 304 | function N(e, o) { 305 | k("onMusicEnd", o) 306 | } 307 | 308 | function x(e, o) { 309 | k("onMusicError", o) 310 | } 311 | 312 | function T(e, o, n) { 313 | n && n({ 314 | errMsg: "openAddress:ok", 315 | userName: "张三", 316 | addressPostalCode: "510000", 317 | provinceFirstStageName: "广东省", 318 | addressCitySecondStageName: "广州市", 319 | addressCountiesThirdStageName: "天河区", 320 | addressDetailInfo: "某巷某号", 321 | nationalCode: "510630" 322 | }) 323 | } 324 | window.MutationObserver = window.WebKitMutationObserver = window.File = void 0; 325 | var I, W = __wxConfig.apphash, 326 | C = __wxConfig.appid, 327 | R = __wxConfig.appname, 328 | O = !1, 329 | B = [], 330 | J = navigator.userAgent, 331 | q = parseInt(J.match(/webview\/(\d*)/)[1]), 332 | P = [], 333 | L = {}, 334 | F = Object.assign({ 335 | domain: ["rapheal.sinaapp.com"], 336 | networkTimeout: { 337 | request: 3e4, 338 | connectSocket: 3e4, 339 | uploadFile: 3e4, 340 | downloadFile: 3e4 341 | } 342 | }, __wxConfig), 343 | G = 0, 344 | z = __wxConfig.appserviceConfig.AppserviceMaxDataSize; 345 | try { 346 | I = __wxConfig.projectConfig.Setting.MaxRequestConcurrent 347 | } catch (H) { 348 | // console.error(H), I = 5 349 | } 350 | var V = { 351 | login: !0, 352 | authorize: !0, 353 | operateWXData: !0, 354 | getStorage: !0, 355 | setStorage: !0, 356 | clearStorage: !0, 357 | getStorageSync: !0, 358 | setStorageSync: !0, 359 | clearStorageSync: !0, 360 | getMusicPlayerState: !0, 361 | operateMusicPlayer: !0, 362 | navigateTo: !0, 363 | redirectTo: !0, 364 | navigateBack: !0, 365 | setNavigationBarTitle: !0, 366 | showNavigationBarLoading: !0, 367 | hideNavigationBarLoading: !0, 368 | getLocation: !0, 369 | openLocation: !0, 370 | getNetworkType: !0, 371 | getSystemInfo: !0, 372 | chooseContact: !0, 373 | chooseImage: !0, 374 | chooseVideo: !0, 375 | saveFile: !0 376 | }; 377 | window._____sendMsgToNW = e, window.addEventListener("message", function(e) { 378 | var o = e.data, 379 | n = o.to; 380 | if ("appservice" === n) return delete n.appservice, "complete" !== document.readyState ? void P.push(o) : void a(o) 381 | }), window.WeixinJSBridge = {}; 382 | var j = null, 383 | K = { 384 | open: [], 385 | message: [], 386 | error: [], 387 | close: [] 388 | }, 389 | U = { 390 | onAppLaunch: !1, 391 | onAppShow: !1, 392 | onAppTerminate: [], 393 | onAppRoute: [], 394 | onAppEnterBackground: [], 395 | onAppEnterForeground: [] 396 | }, 397 | X = { 398 | onMusicPlay: [], 399 | onMusicPause: [], 400 | onMusicEnd: [], 401 | onMusicError: [] 402 | }; 403 | WeixinJSBridge._subscribe = {}, WeixinJSBridge.subscribe = function(e, o) { 404 | O && (console.group(new Date + " WeixinJSBridge subscribe"), console.debug(e, o), console.groupEnd()), B.push({ 405 | type: "subscribe", 406 | eventName: e, 407 | data: arguments, 408 | timesmap: new Date 409 | }), WeixinJSBridge._subscribe[e] = o 410 | }, WeixinJSBridge.publish = function(o, n, t, r) { 411 | if (O && (console.group(new Date + " WeixinJSBridge publish " + o), console.debug(o, n, t, r), console.groupEnd()), n && 0 !== o.indexOf("canvas")) { 412 | var a = JSON.stringify(n), 413 | i = a.length; 414 | if (i > z) return void console.error("%c " + o + " 数据传输长度为 " + i + " 已经超过最大长度 " + z, "color: red; font-size: x-large") 415 | } 416 | B.push({ 417 | type: "publish", 418 | eventName: o, 419 | data: arguments, 420 | timesmap: new Date 421 | }), "appDataChange" !== o && "pageInitData" !== o && "__updateAppData" !== o || r || e({ 422 | appData: __wxAppData, 423 | sdkName: "send_app_data" 424 | }), e({ 425 | eventName: o, 426 | data: n, 427 | sdkName: "publish", 428 | webviewIds: t 429 | }) 430 | }, WeixinJSBridge.invoke = function(e, o, n) { 431 | return O && (console.group(new Date + " WeixinJSBridge invoke " + e), console.debug(e, o, n), console.groupEnd()), B.push({ 432 | type: "invoke", 433 | eventName: e, 434 | data: arguments, 435 | timesmap: new Date 436 | }), V[e] ? void r(e, o, function(o) { 437 | if (o.errMsg.indexOf("ok") > -1 && ("navigateTo" === e || "redirectTo" === e)) { 438 | var t = o.url || "", 439 | r = t.match(/(([^\?]*)(\?([^\/]*))?)$/), 440 | a = "", 441 | i = {}; 442 | if (r) { 443 | a = r[2] || ""; 444 | for (var s = (r[4] || "").split("&"), c = 0; c < s.length; ++c) { 445 | var u = s[c].split("="); 446 | 2 == u.length && (i[u[0]] = u[1]) 447 | } 448 | } 449 | var p = e; 450 | S("onAppRoute", { 451 | path: a, 452 | query: i, 453 | openType: p, 454 | webviewId: o.webviewId 455 | }) 456 | } 457 | n && n(o) 458 | }) : void("request" == e ? s(e, o, n) : "connectSocket" == e ? p(e, o, n) : "closeSocket" == e ? d(e, o, n) : "sendSocketMessage" == e ? l(e, o, n) : "openAddress" == e && T(e, o, n)) 459 | }, WeixinJSBridge.on = function(e, o) { 460 | O && (console.group(new Date + " WeixinJSBridge on " + e), console.debug(e, o), console.groupEnd()), B.push({ 461 | type: "on", 462 | eventName: e, 463 | data: arguments, 464 | timesmap: new Date 465 | }), "onSocketOpen" == e ? g(e, o) : "onSocketError" == e ? v(e, o) : "onSocketMessage" == e ? f(e, o) : "onSocketClose" == e ? w(e, o) : "onAppLaunch" == e ? h(e, o) : "onAppTerminate" == e ? b(e, o) : "onAppRoute" == e ? _(e, o) : "onAppEnterBackground" == e ? y(e, o) : "onAppEnterForeground" == e ? M(e, o) : "onMusicPlay" == e ? D(e, o) : "onMusicPause" == e ? E(e, o) : "onMusicEnd" == e ? N(e, o) : "onMusicError" == e && x(e, o) 466 | }, n({ 467 | command: "SHAKE_HANDS" 468 | }), window.addEventListener("load", function() { 469 | P.forEach(function(e) { 470 | a(e) 471 | }), P = [] 472 | }), window.showDebugInfo = function(e, o) { 473 | var n = B.filter(function(n) { 474 | var t = !e || (Array.isArray(e) ? e.includes(n.type) : n.type === e), 475 | r = !o || (Array.isArray(o) ? o.includes(n.eventName) : n.eventName === o); 476 | if (t && r) return n 477 | }); 478 | console.group("showDebugInfo"), n.forEach(function(e) { 479 | console.group(e.timesmap + " WeixinJSBridge " + e.type + " " + e.eventName), console.debug.apply(window, e.data), console.groupEnd() 480 | }), console.groupEnd(), O = !0 481 | }, window.closeDebug = function() { 482 | console.clear(), O = !1 483 | }, window.showDebugInfoTable = function() { 484 | console.table(B) 485 | }, window.openToolsLog = function() { 486 | e({ 487 | sdkName: "__open-tools-log" 488 | }) 489 | }, window.openVendor = function() { 490 | e({ 491 | sdkName: "__open-tools-vendor" 492 | }) 493 | }, window.help = function() { 494 | console.table([{ 495 | fun: "showDebugInfo", 496 | "arg[0]": "type -- String || Array; publish on subscribe invoke GetMsg", 497 | "arg[1]": "eventName -- String || Array;", 498 | example: 'showDebugInfo() showDebugInfo("publish") showDebugInfo(["publish", "invoke"], "onAppRoute")', 499 | openToolsLog: "open tools logs" 500 | }, { 501 | fun: "closeDebug" 502 | }, { 503 | fun: "showDebugInfoTable" 504 | }, { 505 | fun: "openToolsLog" 506 | }, { 507 | fun: "openVendor" 508 | }]) 509 | } 510 | }(); 511 | --------------------------------------------------------------------------------