123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>洪楼Plus-让买房更省心</title>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
- <meta content="telephone=no, address=no" name="format-detection" />
- <style>
- html,body,div,span,iframe,h1,h2,h3,h4,h5,h6,p,pre,a,address,img,small,strong,sub,sup,tt,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,canvas,audio,video {
- margin: 0;
- padding: 0;
- border: 0;
- font-size: 100%;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
- vertical-align: baseline
- }
- article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
- display: block
- }
- ol,
- ul {
- list-style: none
- }
- table {
- border-collapse: collapse;
- border-spacing: 0
- }
- button,
- img,
- fieldset {
- display: block;
- border: 0
- }
- button,
- html input[type=button],
- input[type=reset],
- input[type=submit] {
- -webkit-appearance: button;
- cursor: pointer;
- padding: 0
- }
- input[type=checkbox],
- input[type=radio] {
- cursor: pointer;
- padding: 0
- }
- a {
- color: #4183c4;
- text-decoration: none
- }
- a:hover {
- text-decoration: none
- }
- html {
- -ms-text-size-adjust: 100%;
- -webkit-text-size-adjust: 100%
- }
- body {
- font-family: "Microsoft YaHei", "Segoe UI", "Lucida Grande", Helvetica, Arial, FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", FontAwesome, sans-serif;
- font-weight: 400;
- line-height: 1.42;
- min-width: 320px;
- max-width: 640px;
- margin: 0 auto;
- color: #333;
- font-size: 16px;
- background: #fff;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale
- }
- /*主体css*/
- .app-view{
- padding: 0 16px 20px;
- }
- .app-view img{
- max-width: 100%;
- }
- .app-view .title{
- margin: 20px 0;
- font-size: 24px;
- }
- .app-view .other-info{
- margin-bottom: 10px;
- color: #b2b2b2;
- }
- #content, #content *, #content div, #content p, #content span {
- word-break: break-all!important;
- }
- </style>
- <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
- </head>
- <body>
- <div id="app">
- <div class="app-view">
- <h3 class="title" id="title"></h3>
- <p class="other-info">
- <span style="color:#576b95;padding-right:10px;font-weight: bold;" Id="from"></span>
- <span id="time"></span>
- <wx-open-launch-weapp
- id="launch-btn"
- username="gh_998dfd1fc347"
- path="pages/index/index.html"
- >
- <span style="color:#576b95;padding-left:10px;font-weight: bold;">去小程序了解更多南昌楼市信息>></span>
- </wx-open-launch-weapp>
-
-
- <wx-open-launch-weapp
- id="launch-btn2"
- username="gh_998dfd1fc347"
- path="pages/index/index.html"
- >
- <script type="text/wxtag-template">
- <style>.btn { padding: 12px }</style>
- <button class="btn">打开小程序</button>
- </script>
- </wx-open-launch-weapp>
- </p>
- <div id="content"></div>
- </div>
- </div>
- </body>
- </html>
- <script>
- // 封装ajax
- function ajax(list) {
- if (XMLHttpRequest) {
- var req = new XMLHttpRequest();
- } else {
- var req = new ActiveXObject("Microsoft.XMLHTTP");
- }
- var type = list.type || 'get';
- var data = list.data || '';
- var isAysnch = list.isAysnch || true;
- if (type == 'get') {
- req.open(type, list.url + "?" + data, isAysnch);
- req.send(null);
- } else {
- // console.log(req)
- // req.responseType = 'json'
- req.open(type, list.url, isAysnch);
- req.send(data);
- }
- req.onload = function () {
- var d = req.responseText;
- list.success(d);
- }
- }
- //获取路由参数
- function getRouteQuery () {
- var searchStr = window.location.search.slice(1)
- var searchArr = searchStr.split('&')
- var query = {}
- for (var i = 0; i < searchArr.length; i++) {
- var item = searchArr[i].split('=')
- query[item[0]] = item[1]
- }
- return query
- }
- //请求数据
- var novelId = getRouteQuery().id
- if (novelId) {
- var formData = new FormData();
- formData.append("id", novelId);
- ajax({
- type:'post',
- url:'https://api.honglouplus.com/api/h5/information',
- data: formData,
- success:function(msg){
- var res = JSON.parse(msg)
- var newsInfo = res.data
- var content = newsInfo.content
- document.getElementById('content').innerHTML = content
- var timeArr = newsInfo.create_at.split(' ')
- var time = timeArr[0]
- document.getElementById('title').innerHTML = newsInfo.title
- document.getElementById('time').innerHTML = time
- document.getElementById('from').innerHTML = newsInfo.author
- value = content.replace(/(\n)/g, "");
- value = value.replace(/(\t)/g, "");
- value = value.replace(/(\r)/g, "");
- value = value.replace(/<\/?[^>]*>/g, "");
- value = value.replace(/\s*/g, "");
- value = value.replace(/ /ig, "");
- var desc = value.substring(0, 40);
- // console.log(desc)
- configJsSDKAndDoSomething(res.jssdk, newsInfo.title, newsInfo.pri_image, desc)
- }
- })
- } else {
- window.alert('缺少文章ID')
- }
- var shareImgUrl = 'http://icon.honglounews.com/plus.png';
- function configJsSDKAndDoSomething(config, title, imgUrl, desc){
- wx.config({
- debug: true,
- appId: config.appId,
- timestamp: config.timestamp,
- nonceStr: config.nonceStr,
- signature: config.signature,
- jsApiList: config.jsApiList,
- openTagList: ['wx-open-launch-weapp'],
- })
- wx.error(function(error){
- console.log(error);
- });
- wx.ready(function () {
- wx.updateAppMessageShareData({
- title: title,
- desc: desc,
- link: location.href,
- imgUrl: imgUrl,
- success: function () {
- alert(title);
- }
- });
- wx.updateTimelineShareData({
- title: title,
- link: location.href,
- imgUrl: imgUrl,
- success: function () {
- alert(desc);
- }
- });
- var btn = document.getElementById('launch-btn');
- btn.addEventListener('launch', function (e) {
- alert('success');
- });
- btn.addEventListener('error', function (e) {
- alert('fail', e.detail);
- });
- var btn = document.getElementById('launch-btn2');
- btn.addEventListener('launch', function (e) {
- alert('success2success2');
- });
- btn.addEventListener('error', function (e) {
- alert('fail2', e.detail);
- });
-
- });
- }
- </script>
|