链家普租带看单生成2.43

普租房子查看页面,把信息加工出来

  1. // ==UserScript==
  2. // @name 链家普租带看单生成2.43
  3. // @version 2.43
  4. // @description 普租房子查看页面,把信息加工出来
  5. // @author 链家员工
  6. // @match https://lease-pz.link.lianjia.com/rent/house/detail/*
  7. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  8. // @grant none
  9. // @namespace https://gf.qytechs.cn/users/1360117
  10. // ==/UserScript==
  11.  
  12.  
  13. (function () {
  14. 'use strict';
  15. init()
  16.  
  17. //构建道具窗口
  18. function init() {
  19. const Panel_DIV = document.createElement('div');
  20. Panel_DIV.id = "Panel_DIV";
  21. Panel_DIV.className = "Panel_DIV";
  22. Panel_DIV.style.position = 'fixed';
  23. Panel_DIV.style.top = '36px';
  24. Panel_DIV.style.right = '65px';
  25. //Panel_DIV.style.transform = 'translateX(-50%)';
  26. Panel_DIV.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  27. Panel_DIV.style.padding = '6px 10px'; // 修改内边距
  28. Panel_DIV.style.color = 'white';
  29. Panel_DIV.style.fontSize = '11px';
  30. Panel_DIV.style.textAlign = 'center';
  31. Panel_DIV.style.zIndex = '9999';
  32. Panel_DIV.style.width = '105px'; // 设置宽度
  33. //Panel_DIV.style.height = '250px'; // 设置高度
  34.  
  35. Panel_DIV.innerHTML = '普租带看单生成';
  36.  
  37. // 创建一个确认按钮
  38. const buttonKaiGuan = document.createElement('button');
  39. buttonKaiGuan.style.display = 'block';
  40. buttonKaiGuan.style.margin = "auto";
  41. buttonKaiGuan.style.textAlign = 'center';
  42. buttonKaiGuan.style.backgroundColor = '';
  43. buttonKaiGuan.style.color = 'black';
  44. buttonKaiGuan.style.border = 'none';
  45. buttonKaiGuan.style.cursor = 'pointer';
  46. buttonKaiGuan.style.outline = 'none';
  47. buttonKaiGuan.innerHTML = '生成';
  48. // 为按钮添加点击事件
  49. buttonKaiGuan.addEventListener('click', () => {
  50. //alert("点击了生成按钮")
  51. //调用函数生成带看单
  52. puzuDAIKAN();
  53. });
  54.  
  55. // 将div和按钮添加到body中
  56. Panel_DIV.appendChild(buttonKaiGuan);
  57. // 设置焦点到确认按钮
  58. buttonKaiGuan.focus();
  59. document.body.appendChild(Panel_DIV);
  60. }
  61.  
  62. //预设各种变量
  63. //小区名称
  64. var xiaoquNAME = "啥小区啊"
  65. //居室
  66. var houseJUSHI = "啥居室啊"
  67. //面积
  68. var houseMIANJI = "面积多大啊"
  69. //朝向
  70. var houseCHAOXIANG = "啥朝向啊"
  71. //入住时间
  72. var ruzhuTIME = "啥入住时间啊"
  73. //租期要求
  74. var houseZUQI = "啥租期啊"
  75. //价格
  76. var housePRICE = "啥价格啊"
  77. //楼层
  78. var houseLOUCENG = "啥楼层啊"
  79. //房源编码
  80. var houseCODE = "-"
  81.  
  82. //有没有维护人,维护人是否存在
  83. var weihuPEOPLE_exists = false
  84. //维护人
  85. var weihuPEOPLE = "维护人是谁啊"
  86. //维护人门店
  87. var weihuPEOPLE_mendian = "维护人哪个店的啊"
  88.  
  89. //有没有钥匙人,钥匙人是否存在
  90. var yaoshiPEOPLE_exists = false
  91. //钥匙人
  92. var yaoshiPEOPLE = "钥匙人是谁啊"
  93. //钥匙人门店
  94. var yaoshiPEOPLE_mendian = "钥匙人哪个店的啊"
  95.  
  96. //录入人
  97. var luruPEOPLE = "录入人是谁啊"
  98. //录入人门店
  99. var luruPEOPLE_mendian = "录入人哪个店的啊"
  100.  
  101. //两个角色人信息
  102. var juesePEOPLE001 = "张三";
  103. var juesePEOPLE002 = "李四";
  104. var svgERWEI = document.createElement("svg")
  105. svgERWEI.innerHTML = '<svg id="svgERWEI" width="100" height="100" xmlns="http://www.w3.org/2000/svg"><!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ --><g><title>background</title><rect fill="#0fffff" id="canvas_background" height="102" width="102" y="-1" x="-1"/><g display="none" overflow="visible" y="0" x="0" height="100%" width="100%" id="canvasGrid"><rect fill="url(#gridpattern)" stroke-width="0" y="0" x="0" height="100%" width="100%"/></g></g><g><title>Layer 1</title><text transform="rotate(-45 42.81383514404296,39.558170318603516) " opacity="0.75" xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="37" id="svg_1" y="52.232558" x="-1.372098" stroke-width="0" stroke="#000" fill="#000000">OMG</text><line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_15" y2="264" x2="-60.5" y1="239" x1="-60.5" fill-opacity="null" stroke-opacity="null" stroke-width="99" stroke="#000" fill="none"/><text opacity="0.75" transform="rotate(135 60.4881935119629,57.2325439453125) " xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="37" id="svg_16" y="69.906928" x="16.302272" stroke-width="0" stroke="#000" fill="#000000">OMG</text></g></svg>'
  106. var hoseERWEI_new = document.createElement("svg")
  107.  
  108.  
  109. //单击"生成"按钮触发这个函数
  110. function puzuDAIKAN() {
  111. //获取各种参数
  112. //小区名称
  113. xiaoquNAME = document.querySelector("#leaseroot span.title").innerHTML.split("<")[0]
  114. //居室
  115. houseJUSHI = document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center>div:nth-child(1)>div:nth-child(2)").textContent
  116. //面积
  117. houseMIANJI = document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center>div:nth-child(2)>div:nth-child(2)").innerHTML.split(" ")[0]
  118. //朝向
  119. houseCHAOXIANG = document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center>div:nth-child(3)>div:nth-child(2)").textContent
  120. //入住时间
  121. ruzhuTIME = document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner-form-bottom > div > div:nth-child(5)").innerHTML.split("</span>")[1]
  122. //租期要求
  123. houseZUQI = "|" + document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner-form-bottom > div > div:nth-child(7)").innerHTML.split("</span>")[1]
  124. //如果租期要求为空
  125. if (houseZUQI === "-") {
  126. houseZUQI = "";
  127. }
  128. //获取楼层
  129. if (document.querySelector("#leaseroot div.page-header-part > div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.key").textContent === "楼层") {
  130. if (document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.value.floor > span > span.floor-number") !== null) {
  131. houseLOUCENG = "|" + document.querySelector("#leaseroot div.page-header-part > div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.value.floor > span").textContent
  132. } else {
  133. console.log("楼层129验证不通过,无法点击楼层")
  134. }
  135. } else {
  136. console.log("楼层132验证不通过,无法点击楼层")
  137. }
  138. //价格
  139. housePRICE = document.querySelector("#leaseroot div.price").textContent
  140. //房源编号
  141. houseCODE = document.querySelector("#leaseroot > div > div > div.ant-layout-content > div > div.house-detail-main > div.left-detail > div.header.flex.align-items > div > span").textContent.split(":")[1]
  142.  
  143. //有没有维护人,维护人是否存在
  144. weihuPEOPLE_exists = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(2) > div >div").childElementCount === 2
  145. console.log("维护人存在?")
  146. if (weihuPEOPLE_exists) {
  147. //维护人
  148. weihuPEOPLE = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(2) > div> div > div.name").textContent
  149. console.log("维护人姓名:" + weihuPEOPLE)
  150. console.log(weihuPEOPLE.length)
  151. //维护人门店
  152. weihuPEOPLE_mendian = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(2) > div >div span.cct-ellipsis").textContent
  153. }
  154.  
  155. //有没有钥匙人,钥匙人是否存在
  156. yaoshiPEOPLE_exists = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(3) > div >div").childElementCount === 2
  157. if (yaoshiPEOPLE_exists) {
  158. //钥匙人
  159. yaoshiPEOPLE = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(3) > div > div > div.name").textContent
  160. //钥匙人门店
  161. yaoshiPEOPLE_mendian = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(3) > div >div span.cct-ellipsis").textContent
  162. }
  163.  
  164. //录入人
  165. luruPEOPLE = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(1) > div> div > div.name").textContent
  166. //录入人门店
  167. luruPEOPLE_mendian = document.querySelector("#leaseroot div.ant-collapse-content.ant-collapse-content-active > div > div > div:nth-child(1) > div >div span.cct-ellipsis").textContent
  168.  
  169. //处理角色人信息
  170. //如果维护人健在
  171. console.log("维护人在吗?")
  172. console.log(weihuPEOPLE_exists)
  173. if (weihuPEOPLE_exists) {
  174. // // console.log("维护人:" + weihuPEOPLE + "(" + weihuPEOPLE_mendian + ")")
  175. juesePEOPLE001 = "维护人:" + weihuPEOPLE;
  176. // juesePEOPLE001 = "维护人:" + weihuPEOPLE + "(" + weihuPEOPLE_mendian + ")"
  177. }
  178. //如果钥匙人健在
  179. if (yaoshiPEOPLE_exists) {
  180. //如果角色人1没出现
  181. if (juesePEOPLE001.length === 2) {
  182. juesePEOPLE001 = "--钥匙人:" + yaoshiPEOPLE;
  183. // juesePEOPLE001 = "--钥匙人:" + yaoshiPEOPLE + "(" + weihuPEOPLE_mendian + ")"
  184. //如果角色人2没出现
  185. } else if (juesePEOPLE002.length === 2) {
  186. juesePEOPLE002 = "--钥匙人:" + yaoshiPEOPLE;
  187. // juesePEOPLE002 = "--钥匙人:" + yaoshiPEOPLE + "(" + weihuPEOPLE_mendian + ")"
  188. }
  189. }
  190. //如果角色人1没出现
  191. if (juesePEOPLE001.length === 2) {
  192. juesePEOPLE001 = "录入人:" + luruPEOPLE;
  193. // juesePEOPLE001 = "录入人:" + luruPEOPLE + "(" + luruPEOPLE_mendian + ")"
  194. //如果角色人2没出现
  195. } else if (juesePEOPLE002.length === 2) {
  196. juesePEOPLE002 = "录入人:" + luruPEOPLE;
  197. // juesePEOPLE002 = "录入人:" + luruPEOPLE + "(" + luruPEOPLE_mendian + ")"
  198. }
  199. //如果角色人1没出现
  200. if (juesePEOPLE001.length === 2) {
  201. juesePEOPLE001 = "---"
  202. //如果角色人2没出现
  203. }
  204. if (juesePEOPLE002.length === 2) {
  205. juesePEOPLE002 = "---"
  206. }
  207.  
  208. //加入特制的普租style
  209. document.querySelector("style").innerHTML += ".DaikanDIV {display: inline-block;background-color: #fff;padding: 10px;border: 2px solid #171717;height: 202px;position: fixed;top: 25%;left: 50%;transform: translateX(-50%);z-index: 99;/*overflow: hidden;*/}.DaiKanDan {width: 866px;height: 140px;/* background-color: #d01c1c; padding-top: 6px;*/padding-left: 13px;padding-right: 6px;display: flex;border-bottom: #eee 2px solid;}div.fengMian {width: 135px;}ul.infoUL {/*background-color: aqua;*/color: #1d1d1d;height: 136px;width: 555px;display: inline-block;padding-top: 0;padding-left: 12px;margin-top: 0;list-style: none;font-size: 18px;}ul.infoUL > li:nth-child(1) {color: #000;font-size: 25px;font-weight: 800;}ul.infoUL > li:nth-child(2) {margin-top: 0;position: relative;left: -2px;}ul.infoUL > li:nth-child(2) > span {padding: 0 2px;}ul.infoUL > li:nth-child(3) {padding-top: 0;}ul.infoUL > li:nth-child(4) {padding-top: 0;}ul.infoUL > li:nth-child(5) {padding-top: 5px;}ul.infoUL > li > div {/*background-color: yellow;*/display: inline-block;position: relative;/*left: 20px;*//*width: 3000px;*/}ul.infoUL > li > div > input {position: absolute;width: 206px;left: 7px;transform: translateY(-75%);border: none;/*background-color: yellow;*/}ul.infoUL > li:nth-child(1) > div > input {font-size: 24px;font-style: italic;font-weight: 500;/*background-color: yellow;*/}ul.infoUL > li:nth-child(2) > div > input {font-size: 18px;color: blue;left: -3px;}ul.infoUL > li:nth-child(3) > div > input {font-size: 18px;color: crimson;}ul.infoUL > li:nth-child(4) > div > input {font-size: 18px;color: #cdcd00;}ul.price {list-style: none;position: relative;top: -5px;color: red;line-height: 35px;}ul > li.price {font-size: 26px;font-weight: 800;}ul > li.erWM {position: relative;left: 1px;}ul > li.erWM > svg {position: relative;left: 52px;}div.okk {/*margin: auto;*/position: relative;}div.okk > button#closeInfo {font-size: 22px;width: 20%;height: 40px;position: absolute;right: -10px;bottom: -40px;/*transform: translateX(50%);*/}#houseBIANMA {position: relative;top: -19px;left: 26px;color: #000;font-size: 16px;} "
  210. //加入新的body
  211. document.body.innerHTML += "<div class=\"DaikanDIV\">"+
  212. "<div style=\"background: rgba( 255, 255, 255, 0.25 );backdrop-filter: blur( 1px );-webkit-backdrop-filter: blur( 1.5px );position: fixed;top: -200px;left: -200px;height: 9999px;width: 1272px;z-index: -1;\"></div>"+
  213. "<hr style=\"margin-bottom: 0;\"><div class=\"DaiKanDan\"><div class=\"fengMian\"><img width=\"100%\"src=\"https://vrlab-image4.ljcdn.com/release/auto3dhd/2547e39f88748e547992a88959c6cd33/screenshot/1693644757_0/pc1_mKj3kwxf4.jpg?imageMogr2/quality/70\"alt=\"\"></div><div>" +
  214. "<ul class=\"infoUL\"><li>" + xiaoquNAME + "<div><input type=\"text\"></div></li><li><span>" + houseJUSHI + "</span>|<span>" + houseMIANJI + "㎡</span>|<span>" + houseCHAOXIANG + "</span>|<span>" + ruzhuTIME + "" + houseZUQI + "" + houseLOUCENG + "</span> <div><input type=\"text\"></div></li><li>" + juesePEOPLE001 + "<div><input type=\"text\"></div></li><li>" + juesePEOPLE002 + "<div><input type=\"text\"></div></li></ul></div>" +
  215. "<ul class=\"price\"><li class=\"price\">" + housePRICE + "元/月</li><li class=\"erWM\">" +
  216. "<svg id=\"svgERWEI\" width=\"80\" height=\"80\" viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\"><!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ --><g><title>background</title><rect fill=\"#0fffff\" id=\"canvas_background\" height=\"102\" width=\"102\" y=\"-1\" x=\"-1\"/><g display=\"none\" overflow=\"visible\" y=\"0\" x=\"0\" height=\"100%\" width=\"100%\" id=\"canvasGrid\"><rect fill=\"url(#gridpattern)\" stroke-width=\"0\" y=\"0\" x=\"0\" height=\"100%\" width=\"100%\"/></g></g><g><title>Layer 1</title><text transform=\"rotate(-45 42.81383514404296,39.558170318603516) \" opacity=\"0.75\" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"37\" id=\"svg_1\" y=\"52.232558\" x=\"-1.372098\" stroke-width=\"0\" stroke=\"#000\" fill=\"#000000\">OMG</text><line stroke-linecap=\"undefined\" stroke-linejoin=\"undefined\" id=\"svg_15\" y2=\"264\" x2=\"-60.5\" y1=\"239\" x1=\"-60.5\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"99\" stroke=\"#000\" fill=\"none\"/><text opacity=\"0.75\" transform=\"rotate(135 60.4881935119629,57.2325439453125) \" xml:space=\"preserve\" text-anchor=\"start\" font-family=\"Helvetica, Arial, sans-serif\" font-size=\"37\" id=\"svg_16\" y=\"69.906928\" x=\"16.302272\" stroke-width=\"0\" stroke=\"#000\" fill=\"#000000\">OMG</text></g></svg>" +
  217. "</li><div id=\"houseBIANMA\">" + houseCODE + "</div><hr style=\"position: absolute;bottom: -3px;right: -22px;\"></ul></div><div class=\"okk\"><button id=\"closeInfo\" class=\"closeInfo\" onclick=\"location.reload();for (let i = 0; i < document.getElementsByClassName('DaikanDIV').length + 1; i++) {document.getElementsByClassName('DaikanDIV')[0].remove();/*location.reload();*/}\">OK</button></div></div>"
  218.  
  219.  
  220. //找到封面图片src
  221. var fengmianSRC = document.querySelector("#leaseroot div.img-ImgDesc > div.left.pr > div > div.img-content-wrap > div.img-content > img:nth-child(1)").src
  222. //创建img元素
  223. const fengmian_DIV = document.createElement('img');
  224. document.querySelector("div.fengMian > img").src = fengmianSRC;
  225.  
  226. //把房源二维码贴上去
  227. document.querySelector("#svgERWEI").innerHTML = "";
  228. // document.querySelector("#svgERWEI").append(document.querySelector("body > div:nth-child(10) > div > div > div > div.ant-popover-inner > div > div > svg"))
  229. document.querySelector("#svgERWEI").append(hoseERWEI_new)
  230.  
  231. //删除工具窗口
  232. //document.getElementsByClassName("Panel_DIV")[0].remove()
  233. init()
  234.  
  235. }
  236.  
  237.  
  238. //寻找房子二维码
  239. var hoseERWEI = false;
  240. setTimeout(findERWEI, 900);
  241.  
  242. function findERWEI() {
  243. console.log("寻找房源二维码函数启动")
  244. if (document.querySelector("#leaseroot div.page-header-part > div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.key").textContent === "楼层") {
  245. if (document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.value.floor > span > span") !== null) {
  246. //获取楼层
  247. document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.value.floor > span > span").click()
  248. } else {
  249. console.log("楼层238验证不通过,无法点击楼层")
  250. }
  251. /*if (document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.value.floor > span > span.S-txt-theme.cursorP") !== null) {
  252. //获取楼层
  253. document.querySelector("#leaseroot div.img-ImgDesc > div.right > div > div.inner.inner-desc-center > div.col.col-4 > div.value.floor > span > span.S-txt-theme.cursorP").click()
  254. } else {
  255. console.log("楼层238验证不通过,无法点击楼层")
  256. }*/
  257. } else {
  258. console.log("楼层240验证不通过,无法点击楼层")
  259. }
  260. //点击暴露二维码
  261. document.querySelector("#leaseroot > div > div > div.ant-layout-content > div > div.house-detail-main > div.left-detail > div.header.flex.align-items > div > div").click()
  262. //房源二维码出现了没有
  263. if (document.querySelector("div.ant-popover-inner-content>svg") != null) {
  264. //if (document.querySelector("body > div:nth-child(10) > div > div > div > div.ant-popover-inner > div > div > svg") != null) {
  265. hoseERWEI = true
  266. hoseERWEI_new = document.querySelector("div.ant-popover-inner-content>svg")
  267. //再次点击,关闭二维码
  268. document.querySelector("#leaseroot > div > div > div.ant-layout-content > div > div.house-detail-main > div.left-detail > div.header.flex.align-items > div > div").click()
  269. document.querySelector("#leaseroot > div > div > div.ant-layout-content > div > div.house-detail-main > div.left-detail > div.header.flex.align-items > div > div").click()
  270. }else{
  271. console.log("二维码不在271")
  272. }
  273. if (!hoseERWEI) {
  274. setTimeout(findERWEI, 2000)
  275. } else {
  276. console.log("找到了!!")
  277. document.querySelector("#Panel_DIV > button").style.backgroundColor="#ff0"
  278. console.log(document.querySelector("div.ant-popover-inner-content>svg"))
  279. }
  280. }
  281.  
  282.  
  283. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址