{"id":19012208,"url":"https://github.com/binaryify/yw","last_synced_at":"2026-02-25T10:33:16.285Z","repository":{"id":74335199,"uuid":"46316809","full_name":"Binaryify/yw","owner":"Binaryify","description":null,"archived":false,"fork":false,"pushed_at":"2015-11-19T13:12:55.000Z","size":3,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T22:09:28.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Binaryify.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-17T02:06:03.000Z","updated_at":"2021-12-14T14:28:42.000Z","dependencies_parsed_at":"2023-03-09T15:52:07.966Z","dependency_job_id":null,"html_url":"https://github.com/Binaryify/yw","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binaryify%2Fyw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binaryify%2Fyw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binaryify%2Fyw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Binaryify%2Fyw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Binaryify","download_url":"https://codeload.github.com/Binaryify/yw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240043951,"owners_count":19739180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T19:17:10.038Z","updated_at":"2025-10-27T10:14:34.101Z","avatar_url":"https://github.com/Binaryify.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# AJAX\n```js\nfunction ajax(urll, Func, data) {\n  $.ajax({\n    url: urll + \"\u0026area=\" + area,\n    type: \"POST\",\n    dataType: 'jsonp',\n    jsonp: 'callback',\n    data: data, //send data\n    timeout: 3000,\n    success: function(json) { //客户端jquery预先定义好的callback函数,成功获取跨域服务器上的json数据后,会动态执行这个callback函数\n      Func(json) //callback\n      netConnectStatus = true;\n      $('.netErr').hide()\n      $('.webContent').show()\n    },\n    error: function() {\n      netConnectStatus = false;\n\n      if (ajaxFailFlag \u003c10) {\n        console.log(\"AJAXerror\")\n        ajaxFailFlag++;\n        setTimeout(function() {\n          ajax(urll, Func, data)\n        }, 300)\n      } else {\n        $('.netErr').show()\n        $('.webContent').hide()\n        console.log('server error')\n      }\n    }\n  })\n}\n```\n只要调用了ajax这个函数都会在url上带上area=当前区域\n# 主页\n```js\nfunction loadtab1() {\n  ajax(\"http://senguzh.com/ztf/yw100/server/indexnews.php?\", function(data) {\n    tab1.$data.newsListData = JSON.parse(data)\n  }, \"\")\n  ajax(\"http://senguzh.com/ztf/yw100/server/indexrent.php?\", function(data) {\n    tab1.$data.indexRentHouse = JSON.parse(data)\n  }, \"\")\n  ajax(\"http://senguzh.com/ztf/yw100/server/indexfirstHandHouse.php?\", function(data) {\n    tab1.$data.indexFirstHouse = JSON.parse(data)\n  }, \"\")\n  ajax(\"http://senguzh.com/ztf/yw100/server/indexsecondHandHouse.php?\", function(data) {\n    tab1.$data.indexSecondHouse = JSON.parse(data)\n  }, \"\")\n}\n```\n\n\n```js\najax(\"http://senguzh.com/ztf/yw100/server/search.php?\" + \"search=\" + searchFrameMain.$data.searchInput, loadSearch)\n```\n网页打开会触发5个AJAX,其中搜索只会发起1次(成功的时候)\n主页会发起4个AJAX请求\n分别对应:资讯头条,新房,二手房,租房\n\n当点击资讯头条的里面的内容的时候,会发送那条新闻的id到newsdetail.php\n\n```js\nfunction loadnews(params) {\n  if (params == undefined||\"\") {\n    params = \"null=null\"\n  }\n  loadFunction = loadnews;\n  loadParams = params;\n  console.log(params)\n  if (netConnectStatus == true) {\n    setTimeout(function() {\n      ajax(\"http://senguzh.com/ztf/yw100/server/news.php?\" + params, function(json) {\n        newsList.$data.newsListData = JSON.parse(json)\n        loadDoSomething=\"newsList.$data.newsListData = dataArr\"\n        dataArr=JSON.parse(json);\n        loadMoreURL=\"http://senguzh.com/ztf/yw100/server/news.php?\" + params\n      })\n    }, 500)\n  }\n  hideSearch()\n}\n```\n\n# 通用\n当点击新房,二手房,租房里的区域,价格,面积,房龄,类型,特色的时候,会触发对应的\nloadfirsthouse和loadsecondhouse以及loadrent方法\n只是会传入对应的参数\n## 例如:\n```html\n\u003cli v-repeat=\"data in indexFirstHouse.area\"\u003e\u003ca href=\"#/tab/firstHandHouse\" onclick=\"loadfirstHouse('city=(%data%)')\"\u003e(%data%) \u003c/a\u003e\u003c/li\u003e\n```\n```html\n\u003cli v-repeat=\"data in indexFirstHouse.money\"\u003e\u003ca href=\"#/tab/firstHandHouse\" onclick=\"loadfirstHouse('money=(%data%)')\"\u003e(%data%) \u003c/a\u003e\u003c/li\u003e\n```\n\n```html\n  \u003cli v-repeat=\"data in indexFirstHouse.type\"\u003e\u003ca href=\"#/tab/firstHandHouse\" onclick=\"loadfirstHouse('type=(%data%)')\"\u003e(%data%) \u003c/a\u003e\u003c/li\u003e\n```\n\n```html\n\u003cli v-repeat=\"data in indexFirstHouse.special\"\u003e\u003ca href=\"#/tab/firstHandHouse\" onclick=\"loadfirstHouse('special=(%data%)')\"\u003e(%data%) \u003c/a\u003e\u003c/li\u003e\n```\n\n如果是详情列表,例如新闻,新房详情,二手房详情,租房详情,则传递具体的id(这个id是在服务器上定义的)\n```html\n\u003ca href=\"#/tab/firstHandHouseDetail\" onclick=\"loadfirstHouseDetail('(%id%)')\"\u003e\n```\n#首页\n1. 新房 :indexfirstHouse.php\n2. 二手房 :indexsecondHandHouse.php\n3. 租房 :indexrent.php\n4. 新闻 :indexnew.php\n\n# 新房\nfirstHandHouse.php\n# 新房详情\nfirstHandHousedetail.php\n# 二手房\nsecondHandHouse.php\n# 二手房详情\nsecondHandHouseDetail.php\n# 看房团\nwatchHouse.php\n# 看房团详情\nwatchHouseDetail.php\n# 小区\ncommunity.php\n# 新闻\nnews.php\n# 地图\nmap.php\n\n# 搜索\nsearch.php\n当点击搜索的时候也是触发对应的load方法,参数为search=xxx\n# 排序\n当点击排序的时候会触发对应的load方法,参数为order=\"默认\",\"价格\",\"开盘\",\"人气\",up=false/true\n# 刷新\n重新加载对应的load方法,同时把全局保存的参数传入\n# 滑动到底部加载\n加载对应的load方法,同时传入page=1,2,3,4,5...\n# 图片上传与加载\n图片上传是把图片转化成base64码,每次添加图片都会在一个数组里push进base64码然后传到后台,后台需要解析这个数组,然后保存为图片\n# 会员中心\n登录需要token无法使用cookie\n\n## 我的二手房\n发送用户id\nmySecondary.php\n点击修改\nchangeReleaseSecondary.php\n## 我的租房\n发送用户id\nmyRentalHousing.php\n点击修改\nchangeRentalHousing.php\n\n## 我的收藏\ncollect.php\n发送用户id\n## 站内信\nmail.php\n发送用户id\n\n# 头像上传\navatar.php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinaryify%2Fyw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinaryify%2Fyw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinaryify%2Fyw/lists"}