profile.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. function remote_up_icon() {
  2. $(".progress-container").hide();
  3. $(".redirect-tips").show().text("上传到云存储获得更快下载速度,请耐心等待...");
  4. var _url = in_path + "source/plugin/" + remote["dir"] + "/upload_progress.php/icon?id=" + in_id + "&uid=" + in_uid + "&upw=" + in_upw;
  5. if (remote["version"] >= 0) {
  6. $("body").append('<iframe width="0" height="0" allowtransparency="true" scrolling="no" border="0" frameborder="0" src="' + _url + '"></iframe>');
  7. return;
  8. }
  9. var xhr = new XMLHttpRequest();
  10. xhr.open("GET", _url.replace(/_progress/, ""), true);
  11. xhr.onreadystatechange = function () {
  12. if (xhr.readyState == 4) {
  13. if (xhr.status == 200) {
  14. if (xhr.responseText == -1) {
  15. $(".redirect-tips").text("应用不存在或已被删除!");
  16. } else if (xhr.responseText == -2) {
  17. $(".redirect-tips").text("您不能更新别人的应用!");
  18. } else if (xhr.responseText == 1) {
  19. location.reload();
  20. }
  21. }
  22. }
  23. };
  24. xhr.send(null);
  25. }
  26. function remote_up_app() {
  27. $(".redirect-tips").text("上传到云存储获得更快下载速度,请耐心等待...");
  28. var _url = in_path + "source/plugin/" + remote["dir"] + "/upload_progress.php/app?time=" + in_time + "&uid=" + in_uid + "&upw=" + in_upw;
  29. if (remote["version"] >= 0) {
  30. $("body").append('<iframe width="0" height="0" allowtransparency="true" scrolling="no" border="0" frameborder="0" src="' + _url + '"></iframe>');
  31. return;
  32. }
  33. var xhr = new XMLHttpRequest();
  34. xhr.open("GET", _url.replace(/_progress/, ""), true);
  35. xhr.onreadystatechange = function () {
  36. if (xhr.readyState == 4) {
  37. if (xhr.status == 200) {
  38. if (xhr.responseText == -1) {
  39. $(".redirect-tips").text("应用不存在或已被删除!");
  40. } else if (xhr.responseText == -2) {
  41. $(".redirect-tips").text("您不能更新别人的应用!");
  42. } else if (xhr.responseText == 1) {
  43. location.reload();
  44. }
  45. }
  46. }
  47. };
  48. xhr.send(null);
  49. }
  50. function send_verify(_tid) {
  51. if ($("#real_nick").val() == "") {
  52. $(".alert-warning ul li").text("真实姓名不能为空!");
  53. $("#real_nick").focus();
  54. return;
  55. }
  56. if (typeof $("#card_prev img").attr("src") == "undefined" || typeof $("#card_after img").attr("src") == "undefined" || typeof $("#card_hand img").attr("src") == "undefined") {
  57. $(".alert-warning ul li").text("证件照片未上传完整!");
  58. return;
  59. }
  60. if ($("#real_card").val() == "") {
  61. $(".alert-warning ul li").text("身份证号不能为空!");
  62. $("#real_card").focus();
  63. return;
  64. }
  65. if (_tid < 1) {
  66. $.layer({
  67. shade: [0],
  68. area: ["auto", "auto"],
  69. dialog: {
  70. msg: "确定要提交审核吗?",
  71. btns: 2,
  72. type: 4,
  73. btn: ["确定", "取消"],
  74. yes: function () {
  75. send_verify(1);
  76. },
  77. no: function () {
  78. layer.msg("已取消提交", 1, 0);
  79. }
  80. }
  81. });
  82. return;
  83. }
  84. var xhr = new XMLHttpRequest();
  85. xhr.open("GET", in_path + "index/ajax_profile/send_verify?nick=" + escape($("#real_nick").val()) + "&card=" + $("#real_card").val(), true);
  86. xhr.onreadystatechange = function () {
  87. if (xhr.readyState == 4) {
  88. if (xhr.status == 200) {
  89. if (xhr.responseText == -1) {
  90. $(".alert-warning ul li").text("请先登录后再操作!");
  91. } else {
  92. location.reload();
  93. }
  94. } else {
  95. $(".alert-warning ul li").text("通讯异常,请检查网络设置!");
  96. }
  97. }
  98. };
  99. xhr.send(null);
  100. }
  101. function add_space(_tid, _mb) {
  102. if (_tid < 1) {
  103. $(".pop-up-mask").hide();
  104. $(".pop-up-layer").hide();
  105. layer.prompt({
  106. title: "请输入扩充数量"
  107. },
  108. function (_key) {
  109. add_space(1, _key);
  110. });
  111. return;
  112. }
  113. var xhr = new XMLHttpRequest();
  114. xhr.open("GET", in_path + "index/ajax_profile/add_space?mb=" + _mb, true);
  115. xhr.onreadystatechange = function () {
  116. if (xhr.readyState == 4) {
  117. if (xhr.status == 200) {
  118. if (xhr.responseText == -1) {
  119. layer.msg("请先登录后再操作!", 3, 11);
  120. } else if (xhr.responseText == -2) {
  121. layer.msg("扩充数量输入有误!", 3, 8);
  122. } else if (xhr.responseText == -3) {
  123. layer.msg("下载点数不足!", 3, 8);
  124. } else {
  125. location.reload();
  126. }
  127. } else {
  128. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  129. }
  130. }
  131. };
  132. xhr.send(null);
  133. }
  134. function each_confirm() {
  135. $.layer({
  136. shade: [0],
  137. area: ["auto", "auto"],
  138. dialog: {
  139. msg: "确定要解除合并吗?",
  140. btns: 2,
  141. type: 4,
  142. btn: ["确定", "取消"],
  143. yes: function () {
  144. each_del();
  145. },
  146. no: function () {
  147. layer.msg("已取消解除", 1, 0);
  148. }
  149. }
  150. });
  151. }
  152. function each_del() {
  153. var xhr = new XMLHttpRequest();
  154. xhr.open("GET", in_path + "index/ajax_profile/each_del?aid=" + in_id, true);
  155. xhr.onreadystatechange = function () {
  156. if (xhr.readyState == 4) {
  157. if (xhr.status == 200) {
  158. if (xhr.responseText == -1) {
  159. layer.msg("请先登录后再操作!", 3, 11);
  160. } else if (xhr.responseText == -2) {
  161. layer.msg("您不能解除别人的应用!", 3, 8);
  162. } else {
  163. location.reload();
  164. }
  165. } else {
  166. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  167. }
  168. }
  169. };
  170. xhr.send(null);
  171. }
  172. function each_add(_kid) {
  173. var xhr = new XMLHttpRequest();
  174. xhr.open("GET", in_path + "index/ajax_profile/each_add&aid=" + in_id + "&kid=" + _kid, true);
  175. xhr.onreadystatechange = function () {
  176. if (xhr.readyState == 4) {
  177. if (xhr.status == 200) {
  178. if (xhr.responseText == -1) {
  179. layer.msg("请先登录后再操作!", 3, 11);
  180. } else if (xhr.responseText == -2) {
  181. layer.msg("应用不存在或已被删除!", 3, 11);
  182. } else if (xhr.responseText == -3) {
  183. layer.msg("您不能合并别人的应用!", 3, 8);
  184. } else if (xhr.responseText == -4) {
  185. layer.msg("应用平台一致,不能合并!", 3, 8);
  186. } else {
  187. location.reload();
  188. }
  189. } else {
  190. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  191. }
  192. }
  193. };
  194. xhr.send(null);
  195. }
  196. function s_earch() {
  197. var _keyword = $("#k_eyword").val().replace(/\//g, "");
  198. _keyword = _keyword.replace(/\\/g, "");
  199. _keyword = _keyword.replace(/\?/g, "");
  200. if (_keyword == "") {
  201. layer.msg("请输入要查询的关键词!", 1, 0);
  202. $("#k_eyword").focus();
  203. } else {
  204. location.href = in_path + "index/home/" + _keyword;
  205. }
  206. }
  207. function edit_app() {
  208. var xhr = new XMLHttpRequest();
  209. if ($("#in_name").val() == "") {
  210. layer.msg("应用名称不能为空!", 1, 0);
  211. $("#in_name").focus();
  212. return;
  213. }
  214. xhr.open("GET", in_path + "index/ajax_profile/edit?name=" + escape($("#in_name").val()) + "&link=" + $("#in_link").val() + "&id=" + in_id, true);
  215. xhr.onreadystatechange = function () {
  216. if (xhr.readyState == 4) {
  217. if (xhr.status == 200) {
  218. if (xhr.responseText == -1) {
  219. layer.msg("请先登录后再操作!", 3, 11);
  220. } else if (xhr.responseText == -2) {
  221. layer.msg("应用不存在或已被删除!", 3, 11);
  222. } else if (xhr.responseText == -3) {
  223. layer.msg("您不能编辑别人的应用!", 3, 8);
  224. } else if (xhr.responseText == -4) {
  225. layer.msg("短链地址不规范!", 3, 8);
  226. } else if (xhr.responseText == -5) {
  227. layer.msg("短链地址已被占用!", 3, 8);
  228. } else if (xhr.responseText == -6) {
  229. layer.msg("短链功能未开放!", 3, 8);
  230. } else if (xhr.responseText == 1) {
  231. layer.msg("恭喜,应用信息已保存!", 3, 1);
  232. setTimeout("location.reload()", 1e3);
  233. } else {
  234. layer.msg("内部出现错误,请稍后再试!", 3, 8);
  235. }
  236. } else {
  237. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  238. }
  239. }
  240. };
  241. xhr.send(null);
  242. }
  243. function del_app(_id, _type) {
  244. if (_type > 0) {
  245. $.layer({
  246. shade: [0],
  247. area: ["auto", "auto"],
  248. dialog: {
  249. msg: "删除操作不可逆,确认继续?",
  250. btns: 2,
  251. type: 4,
  252. btn: ["确认", "取消"],
  253. yes: function () {
  254. del_app(_id, 0);
  255. },
  256. no: function () {
  257. layer.msg("已取消删除", 1, 0);
  258. }
  259. }
  260. });
  261. } else {
  262. var xhr = new XMLHttpRequest();
  263. xhr.open("GET", in_path + "index/ajax_profile/del?id=" + _id, true);
  264. xhr.onreadystatechange = function () {
  265. if (xhr.readyState == 4) {
  266. if (xhr.status == 200) {
  267. if (xhr.responseText == -1) {
  268. layer.msg("请先登录后再操作!", 3, 11);
  269. } else if (xhr.responseText == -2) {
  270. layer.msg("应用不存在或已被删除!", 3, 11);
  271. } else if (xhr.responseText == -3) {
  272. layer.msg("您不能删除别人的应用!", 3, 8);
  273. } else if (xhr.responseText == 1) {
  274. layer.msg("恭喜,应用删除成功!", 3, 1);
  275. setTimeout("location.reload()", 1e3);
  276. } else {
  277. layer.msg("内部出现错误,请稍后再试!", 3, 8);
  278. }
  279. } else {
  280. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  281. }
  282. }
  283. };
  284. xhr.send(null);
  285. }
  286. }
  287. function high_speed(_id, _type) {
  288. if (_type > 0) {
  289. $.layer({
  290. shade: [0],
  291. area: ["auto", "auto"],
  292. dialog: {
  293. msg: "升级需扣除相应的下载点数?",
  294. btns: 2,
  295. type: 4,
  296. btn: ["确认", "取消"],
  297. yes: function () {
  298. high_speed(_id, 0);
  299. },
  300. no: function () {
  301. layer.msg("已取消升级", 1, 0);
  302. }
  303. }
  304. });
  305. } else {
  306. var xhr = new XMLHttpRequest();
  307. xhr.open("GET", in_path + "index/ajax_profile/high_speed?id=" + _id, true);
  308. xhr.onreadystatechange = function () {
  309. if (xhr.readyState == 4) {
  310. if (xhr.status == 200) {
  311. if (xhr.responseText == -1) {
  312. layer.msg("请先登录后再操作!", 3, 11);
  313. } else if (xhr.responseText == -2) {
  314. layer.msg("应用不存在或已被删除!", 3, 11);
  315. } else if (xhr.responseText == -3) {
  316. layer.msg("您不能升级别人的应用!", 3, 8);
  317. } else if (xhr.responseText == -4) {
  318. layer.msg("通道功能未开启!", 3, 8);
  319. } else if (xhr.responseText == -5) {
  320. layer.msg("下载点数不足!", 3, 8);
  321. } else if (xhr.responseText == 1) {
  322. layer.msg("恭喜,通道升级成功!", 3, 1);
  323. setTimeout("location.reload()", 1e3);
  324. } else {
  325. layer.msg("内部出现错误,请稍后再试!", 3, 8);
  326. }
  327. } else {
  328. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  329. }
  330. }
  331. };
  332. xhr.send(null);
  333. }
  334. }
  335. function remove_ad(_id, _type) {
  336. if (_type > 0) {
  337. $.layer({
  338. shade: [0],
  339. area: ["auto", "auto"],
  340. dialog: {
  341. msg: "去除需扣除相应的下载点数?",
  342. btns: 2,
  343. type: 4,
  344. btn: ["确认", "取消"],
  345. yes: function () {
  346. remove_ad(_id, 0);
  347. },
  348. no: function () {
  349. layer.msg("已取消去除", 1, 0);
  350. }
  351. }
  352. });
  353. } else {
  354. var xhr = new XMLHttpRequest();
  355. xhr.open("GET", in_path + "index/ajax_profile/remove_ad?id=" + _id, true);
  356. xhr.onreadystatechange = function () {
  357. if (xhr.readyState == 4) {
  358. if (xhr.status == 200) {
  359. if (xhr.responseText == -1) {
  360. layer.msg("请先登录后再操作!", 3, 11);
  361. } else if (xhr.responseText == -2) {
  362. layer.msg("应用不存在或已被删除!", 3, 11);
  363. } else if (xhr.responseText == -3) {
  364. layer.msg("您不能去除别人的应用!", 3, 8);
  365. } else if (xhr.responseText == -4) {
  366. layer.msg("广告功能未开启!", 3, 8);
  367. } else if (xhr.responseText == -5) {
  368. layer.msg("下载点数不足!", 3, 8);
  369. } else if (xhr.responseText == 1) {
  370. layer.msg("恭喜,广告去除成功!", 3, 1);
  371. setTimeout("location.reload()", 1e3);
  372. } else {
  373. layer.msg("内部出现错误,请稍后再试!", 3, 8);
  374. }
  375. } else {
  376. layer.msg("通讯异常,请检查网络设置!", 3, 3);
  377. }
  378. }
  379. };
  380. xhr.send(null);
  381. }
  382. }
  383. function profile_info() {
  384. var xhr = new XMLHttpRequest();
  385. var mobile = document.getElementById("in_mobile");
  386. var qq = document.getElementById("in_qq");
  387. var firm = document.getElementById("in_firm");
  388. var job = document.getElementById("in_job");
  389. document.getElementById("user_tips").style.display = "block";
  390. if (mobile.value == "") {
  391. document.getElementById("user_tips").innerHTML = "手机不能为空,请填写!";
  392. mobile.focus();
  393. return;
  394. }
  395. if (qq.value == "") {
  396. document.getElementById("user_tips").innerHTML = "QQ不能为空,请填写!";
  397. qq.focus();
  398. return;
  399. }
  400. if (firm.value == "") {
  401. document.getElementById("user_tips").innerHTML = "公司不能为空,请填写!";
  402. firm.focus();
  403. return;
  404. }
  405. if (job.value == "") {
  406. document.getElementById("user_tips").innerHTML = "职位不能为空,请填写!";
  407. job.focus();
  408. return;
  409. }
  410. xhr.open("GET", in_path + "index/ajax_profile/info?mobile=" + mobile.value + "&qq=" + qq.value + "&firm=" + escape(firm.value) + "&job=" + escape(job.value), true);
  411. xhr.onreadystatechange = function () {
  412. if (xhr.readyState == 4) {
  413. if (xhr.status == 200) {
  414. if (xhr.responseText == -1) {
  415. document.getElementById("user_tips").innerHTML = "请先登录后再操作!";
  416. } else if (xhr.responseText == 1) {
  417. document.getElementById("user_tips").innerHTML = "恭喜,个人资料已更新!";
  418. setTimeout("location.reload()", 1e3);
  419. } else {
  420. document.getElementById("user_tips").innerHTML = "内部出现错误,请稍后再试!";
  421. }
  422. } else {
  423. document.getElementById("user_tips").innerHTML = "通讯异常,请检查网络设置!";
  424. }
  425. }
  426. };
  427. xhr.send(null);
  428. }
  429. function profile_pwd() {
  430. var xhr = new XMLHttpRequest();
  431. var old_pwd = document.getElementById("old_pwd");
  432. var new_pwd = document.getElementById("new_pwd");
  433. var rnew_pwd = document.getElementById("rnew_pwd");
  434. document.getElementById("user_tips").style.display = "block";
  435. if (old_pwd.value == "") {
  436. document.getElementById("user_tips").innerHTML = "<li>当前密码不能为空!</li>";
  437. old_pwd.focus();
  438. return;
  439. }
  440. if (new_pwd.value.length < 6) {
  441. document.getElementById("user_tips").innerHTML = "<li>新密码最小长度为 6 个字符。</li>";
  442. new_pwd.focus();
  443. return;
  444. }
  445. if (rnew_pwd.value !== new_pwd.value) {
  446. document.getElementById("user_tips").innerHTML = "<li>两次输入的密码不一致!</li>";
  447. rnew_pwd.focus();
  448. return;
  449. }
  450. xhr.open("GET", in_path + "index/ajax_profile/pwd?old=" + old_pwd.value + "&new=" + rnew_pwd.value, true);
  451. xhr.onreadystatechange = function () {
  452. if (xhr.readyState == 4) {
  453. if (xhr.status == 200) {
  454. if (xhr.responseText == -1) {
  455. document.getElementById("user_tips").innerHTML = "<li>请先登录后再操作!</li>";
  456. } else if (xhr.responseText == -2) {
  457. document.getElementById("user_tips").innerHTML = "<li>当前密码有误,请重试!</li>";
  458. } else if (xhr.responseText == 1) {
  459. document.getElementById("user_tips").innerHTML = "<li>恭喜,密码修改成功!</li>";
  460. setTimeout("location.reload()", 1e3);
  461. } else {
  462. document.getElementById("user_tips").innerHTML = "<li>内部出现错误,请稍后再试!</li>";
  463. }
  464. } else {
  465. document.getElementById("user_tips").innerHTML = "<li>通讯异常,请检查网络设置!</li>";
  466. }
  467. }
  468. };
  469. xhr.send(null);
  470. }
  471. //上传成功后提交
  472. function ReturnValue(response) {
  473. $(".progress-container").hide();
  474. $(".redirect-tips").show();
  475. $.get(
  476. "/upload/index/" + response.extension + "?time=" + response.time + "&id=" + in_id,
  477. {},
  478. function (ret) {
  479. if (ret.code == -1) {
  480. $(".redirect-tips").text("请先登录后再操作!");
  481. } else if (ret.code == -2 || ret.code == -5) {
  482. $(".redirect-tips").text("Access denied");
  483. } else if (ret.code == -3) {
  484. $(".redirect-tips").text("未进行实名认证或认证审核中!");
  485. } else if (ret.code == -4) {
  486. $(".redirect-tips").text("应用容量不足!请升级VIP!");
  487. alert("应用容量不足!请升级VIP!", function () {
  488. window.location.href = "/index/item_price?type=2";
  489. })
  490. } else if (ret.code == -6) {
  491. $(".redirect-tips").text("安装包不一致,无法覆盖!");
  492. } else if (ret.code == 1) {
  493. remote["open"] > 0 ? remote_up_app() : location.reload();
  494. } else {
  495. $(".redirect-tips").text("内部出现错误,请稍后再试!");
  496. }
  497. }, 'json');
  498. }