From cc4295f008ab2dd3e24f05055a7cba86d2db2a92 Mon Sep 17 00:00:00 2001 From: A1300399510 Date: Tue, 3 Dec 2024 16:58:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=90=91=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=8F=91url=20=EF=BC=8C=E5=88=86=E4=BA=AB=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.html | 4 +- ...6.8fbf3e55.js => app~42f9d7e6.daa557fa.js} | 2 +- ...c.801893bf.js => app~d363ae0c.79592ad6.js} | 2 +- public/index.html | 3 + src/main.js | 1 + src/router/index.js | 240 ++++---- src/utils/jweixin-1.3.2.js | 545 ++++++++++++++++++ 7 files changed, 676 insertions(+), 121 deletions(-) rename dist/js/{app~42f9d7e6.8fbf3e55.js => app~42f9d7e6.daa557fa.js} (99%) rename dist/js/{app~d363ae0c.801893bf.js => app~d363ae0c.79592ad6.js} (61%) create mode 100644 src/utils/jweixin-1.3.2.js diff --git a/dist/index.html b/dist/index.html index a53a92b..fd20873 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,7 +1,7 @@ -寄托家园留学论坛_出国留学经验分享|留学申请|留学考试|DIY留学寄托论坛
\ No newline at end of file + })();
\ No newline at end of file diff --git a/dist/js/app~42f9d7e6.8fbf3e55.js b/dist/js/app~42f9d7e6.daa557fa.js similarity index 99% rename from dist/js/app~42f9d7e6.8fbf3e55.js rename to dist/js/app~42f9d7e6.daa557fa.js index 2216bda..6bc29e7 100644 --- a/dist/js/app~42f9d7e6.8fbf3e55.js +++ b/dist/js/app~42f9d7e6.daa557fa.js @@ -1 +1 @@ -"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[151],{9773:function(t,e,n){n.d(e,{Z:function(){return d}});var s=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"app"}},[e("div",{staticClass:"container"},[e("router-view")],1)])},i=[],o={name:"App",data(){return{loading:null,pathname:"",parameterObject:{},isPc:!1,socketTask:null}},watch:{},mounted(){console.log("初始化"),this.$store.dispatch("fetchHistoricalSearch"),this.$store.dispatch("getAllForum",this);let t=setInterval((()=>{0!==Object.keys(this.$store.state.user).length&&(this.useSocket(),clearInterval(t))}),1e3)},methods:{useSocket(){let t=this.getMiucmsSessionCookie()||"";this.socketTask=new WebSocket(`wss://socket.gter.net?token=${t}`),this.socketTask.onopen=()=>{let e=this.$store.state.user||{};e&&t&&this.socketTask.send(JSON.stringify({type:"bind",data:{token:t,uid:e.uid||0}})),setTimeout((()=>this.timedTransmission()),5e4)},this.socketTask.onclose=()=>{console.log("socket关闭了",new Date)}},timedTransmission(){1==this.socketTask.readyState&&(this.socketTask.send(JSON.stringify({type:"ping"})),setTimeout((()=>this.timedTransmission()),5e4))},getMiucmsSessionCookie(){let t=document.cookie.split(";");for(let e=0;e0){n=!1;break}if(n){console.log("flag",n);let t=window.location.pathname;const e=window.location.search,s=e.substring(1);let i=Object.fromEntries(new URLSearchParams(s));if(this.pathname=t,this.parameterObject=i,-1!=this.pathname.indexOf("allSections")&&this.parameterObject["fid"])return void this.handleNeedAllSkipPc();if(-1!=this.pathname.indexOf("userIndex"))return void this.handleNeedInfo();let o="";-1!=t.indexOf("detailIndex")&&(o=`https://bbs.gter.net/thread-${i["tid"]}-${i["page"]||1}-1.html`),-1!=t.indexOf("searchResult")&&(o="https://search.gter.net/index.html?type=forum"+(i["kw"]?`&kw=${i["kw"]}`:"")),-1==t.indexOf("allSections")||i["fid"]||(o="https://bbs.gter.net/forum.php"),-1!=t.indexOf("recommend")&&(o="https://bbs.gter.net/forum.php"),-1!=t.indexOf("collect")&&(o="https://bbs.gter.net/forum.php"),"/"!=t&&""!=t&&t||(o="https://bbs.gter.net/forum.php"),o&&this.$skipUrl(o,!1)}},handleNeedInfo(){let t=this.$store.state.user||{},e="";"{}"!=JSON.stringify(t)?(e=`https://bbs.gter.net/home.php?mod=space&uid=${t.uin}`,this.$skipUrl(e,!1)):setTimeout((()=>{this.handleNeedInfo()}),300)},handleNeedAllSkipPc(){let t=this.$store.state.allForumList||[],e="",n=this.parameterObject["fid"]||null;0!=t.length?(t.forEach(((t,s)=>{t.fid==n&&(e=`https://bbs.gter.net/forum.php?gid=${t.fid}`),t.data.forEach(((t,s)=>{t.fid==n&&(e=`https://bbs.gter.net/forum-${t.fid}-${this.parameterObject["page"]||1}.html`)}))})),this.$skipUrl(e,!1)):setTimeout((()=>{this.handleNeedAllSkipPc()}),300)}}},r=o,a=n(1001),l=(0,a.Z)(r,s,i,!1,null,null,null),d=l.exports},9614:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-add",use:"icon-add-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},1378:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-addyellow",use:"icon-addyellow-usage",viewBox:"0 0 12 12",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},9814:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsBlackLeft",use:"icon-arrowsBlackLeft-usage",viewBox:"0 0 7 12",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},865:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsLeft",use:"icon-arrowsLeft-usage",viewBox:"0 0 6 11",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},9061:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsRoundBlackLeft",use:"icon-arrowsRoundBlackLeft-usage",viewBox:"0 0 11 12",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},5435:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsRoundLeft",use:"icon-arrowsRoundLeft-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},9607:function(t,e,n){var s=n(6369),i=function(){var t=this,e=t._self._c;return e("svg",{staticClass:"svg-icon",class:t.className,attrs:{xmlns:"http://www.w3.org/2000/svg"}},[e("use",{attrs:{"xlink:href":`#icon-${t.iconClass}`,"xmlns:xlink":"http://www.w3.org/1999/xlink"}})])},o=[],r={name:"SvgIcon",props:{iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{iconName(){return`#icon-${this.iconClass}`},svgClass(){return this.className?"svg-icon "+this.className:"svg-icon"}}},a=r,l=n(1001),d=(0,l.Z)(a,i,o,!1,null,"7cc231e5",null),c=d.exports;s["default"].component("svg-icon",c);const h=n(7886),m=t=>t.keys().map(t);m(h)}}]); \ No newline at end of file +"use strict";(self["webpackChunkninepage"]=self["webpackChunkninepage"]||[]).push([[151],{9062:function(t,e,n){n.d(e,{Z:function(){return d}});var s=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"app"}},[e("div",{staticClass:"container"},[e("router-view")],1)])},i=[],o={name:"App",data(){return{loading:null,pathname:"",parameterObject:{},isPc:!1,socketTask:null}},watch:{},mounted(){console.log("初始化"),this.$store.dispatch("fetchHistoricalSearch"),this.$store.dispatch("getAllForum",this);let t=setInterval((()=>{0!==Object.keys(this.$store.state.user).length&&(this.useSocket(),clearInterval(t))}),1e3)},methods:{useSocket(){let t=this.getMiucmsSessionCookie()||"";this.socketTask=new WebSocket(`wss://socket.gter.net?token=${t}`),this.socketTask.onopen=()=>{let e=this.$store.state.user||{};e&&t&&this.socketTask.send(JSON.stringify({type:"bind",data:{token:t,uid:e.uid||0}})),setTimeout((()=>this.timedTransmission()),5e4)},this.socketTask.onclose=()=>{console.log("socket关闭了",new Date)}},timedTransmission(){1==this.socketTask.readyState&&(this.socketTask.send(JSON.stringify({type:"ping"})),setTimeout((()=>this.timedTransmission()),5e4))},getMiucmsSessionCookie(){let t=document.cookie.split(";");for(let e=0;e0){n=!1;break}if(n){console.log("flag",n);let t=window.location.pathname;const e=window.location.search,s=e.substring(1);let i=Object.fromEntries(new URLSearchParams(s));if(this.pathname=t,this.parameterObject=i,-1!=this.pathname.indexOf("allSections")&&this.parameterObject["fid"])return void this.handleNeedAllSkipPc();if(-1!=this.pathname.indexOf("userIndex"))return void this.handleNeedInfo();let o="";-1!=t.indexOf("detailIndex")&&(o=`https://bbs.gter.net/thread-${i["tid"]}-${i["page"]||1}-1.html`),-1!=t.indexOf("searchResult")&&(o="https://search.gter.net/index.html?type=forum"+(i["kw"]?`&kw=${i["kw"]}`:"")),-1==t.indexOf("allSections")||i["fid"]||(o="https://bbs.gter.net/forum.php"),-1!=t.indexOf("recommend")&&(o="https://bbs.gter.net/forum.php"),-1!=t.indexOf("collect")&&(o="https://bbs.gter.net/forum.php"),"/"!=t&&""!=t&&t||(o="https://bbs.gter.net/forum.php"),o&&this.$skipUrl(o,!1)}},handleNeedInfo(){let t=this.$store.state.user||{},e="";"{}"!=JSON.stringify(t)?(e=`https://bbs.gter.net/home.php?mod=space&uid=${t.uin}`,this.$skipUrl(e,!1)):setTimeout((()=>{this.handleNeedInfo()}),300)},handleNeedAllSkipPc(){let t=this.$store.state.allForumList||[],e="",n=this.parameterObject["fid"]||null;0!=t.length?(t.forEach(((t,s)=>{t.fid==n&&(e=`https://bbs.gter.net/forum.php?gid=${t.fid}`),t.data.forEach(((t,s)=>{t.fid==n&&(e=`https://bbs.gter.net/forum-${t.fid}-${this.parameterObject["page"]||1}.html`)}))})),this.$skipUrl(e,!1)):setTimeout((()=>{this.handleNeedAllSkipPc()}),300)}}},r=o,a=n(1001),l=(0,a.Z)(r,s,i,!1,null,null,null),d=l.exports},9614:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-add",use:"icon-add-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},1378:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-addyellow",use:"icon-addyellow-usage",viewBox:"0 0 12 12",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},9814:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsBlackLeft",use:"icon-arrowsBlackLeft-usage",viewBox:"0 0 7 12",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},865:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsLeft",use:"icon-arrowsLeft-usage",viewBox:"0 0 6 11",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},9061:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsRoundBlackLeft",use:"icon-arrowsRoundBlackLeft-usage",viewBox:"0 0 11 12",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},5435:function(t,e,n){n.r(e);var s=n(2512),i=n.n(s),o=n(1736),r=n.n(o),a=new(i())({id:"icon-arrowsRoundLeft",use:"icon-arrowsRoundLeft-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n'});r().add(a);e["default"]=a},9607:function(t,e,n){var s=n(6369),i=function(){var t=this,e=t._self._c;return e("svg",{staticClass:"svg-icon",class:t.className,attrs:{xmlns:"http://www.w3.org/2000/svg"}},[e("use",{attrs:{"xlink:href":`#icon-${t.iconClass}`,"xmlns:xlink":"http://www.w3.org/1999/xlink"}})])},o=[],r={name:"SvgIcon",props:{iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{iconName(){return`#icon-${this.iconClass}`},svgClass(){return this.className?"svg-icon "+this.className:"svg-icon"}}},a=r,l=n(1001),d=(0,l.Z)(a,i,o,!1,null,"7cc231e5",null),c=d.exports;s["default"].component("svg-icon",c);const h=n(7886),m=t=>t.keys().map(t);m(h)}}]); \ No newline at end of file diff --git a/dist/js/app~d363ae0c.801893bf.js b/dist/js/app~d363ae0c.79592ad6.js similarity index 61% rename from dist/js/app~d363ae0c.801893bf.js rename to dist/js/app~d363ae0c.79592ad6.js index 2c5c90f..067e047 100644 --- a/dist/js/app~d363ae0c.801893bf.js +++ b/dist/js/app~d363ae0c.79592ad6.js @@ -1 +1 @@ -(function(){var e={9154:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-pen",use:"icon-pen-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},2752:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-quotation-left",use:"icon-quotation-left-usage",viewBox:"0 0 16 13",content:'\r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},9839:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-quotation-right",use:"icon-quotation-right-usage",viewBox:"0 0 16 13",content:'\r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},6613:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-settingAdd",use:"icon-settingAdd-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},2168:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-threeAcross",use:"icon-threeAcross-usage",viewBox:"0 0 24 20",content:'\r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},5263:function(e,t,n){"use strict";var r=n(6369),o=n(9773),i=(n(7658),n(2631));const s="寄托天下论坛";function a(e){return e?`${e} - ${s}`:`${s}`}r["default"].use(i.ZP);const l=i.ZP.prototype.push;i.ZP.prototype.push=function(e){return l.call(this,e).catch((e=>e))};const c=()=>Promise.all([n.e(917),n.e(94)]).then(n.bind(n,2013)),u=()=>n.e(280).then(n.bind(n,280)),d=()=>n.e(884).then(n.bind(n,1884)),f=()=>n.e(217).then(n.bind(n,9217)),A=()=>Promise.all([n.e(917),n.e(483)]).then(n.bind(n,5817)),m=()=>n.e(878).then(n.bind(n,5878)),g=()=>Promise.all([n.e(917),n.e(584)]).then(n.bind(n,6170)),p=()=>n.e(336).then(n.bind(n,1336)),h=()=>Promise.all([n.e(917),n.e(561)]).then(n.bind(n,9143)),w=()=>Promise.all([n.e(621),n.e(875),n.e(84)]).then(n.bind(n,6513)),C=[{path:"/",name:"Index",redirect:"/recommend",component:c,children:[{path:"/recommend",name:"Recommend",component:u,meta:{title:"推荐版块"}},{path:"/collect",name:"Collect",component:d,meta:{title:"收藏的版块"}},{path:"/allSections",name:"AllSections",component:f,meta:{title:"全部版块"}}]},{path:"/searchResult",name:"search",redirect:"/searchResult",component:A,children:[{path:"/searchResult",name:"Recommend",component:m,meta:{title:"搜索帖子"}}]},{path:"/user",name:"user",redirect:"/userIndex",component:g,children:[{path:"/userIndex",name:"userIndex",component:p,meta:{title:"我的寄托"}}]},{path:"/detail",name:"detail",redirect:"/detailIndex",component:h,children:[{path:"/detailIndex",name:"detailIndex",component:w,meta:{title:"帖子详情"}}]}],y=new i.ZP({mode:"history",routes:C});let b=!0;y.beforeEach((async(e,t,n)=>{e.meta.title&&(document.title=a(e.meta.title)),b?b=!1:window._hmt&&e.path&&window._hmt.push(["_trackPageview","/#"+e.fullPath]),n()}));var v=y,L=n(3822);r["default"].use(L.ZP);var k=new L.ZP.Store({state:{historicalSearch:[],allForumList:[],homeRequestState:!1,getUserInfoState:!1,favoriteList:[],recommendList:[],menu:[],user:{},hotSearchkeywords:[],loading:null},getters:{},mutations:{setHistoricalSearch(e,t){Array.isArray(t)||(t=[t]);let n=[...new Set([...t,...e.historicalSearch])];n.length>10&&(n=n.slice(0,10)),e.historicalSearch=n,localStorage.setItem("historicalSearch",JSON.stringify(n))},setAllForumList(e,t){e.allForumList=t},setHomeRequestState(e,t){e.homeRequestState=t},setFavoriteList(e,t){e.favoriteList=t},setRecommendList(e,t){e.recommendList=t},setUser(e,t){e.user=t},setHotSearchkeywords(e,t){e.hotSearchkeywords=t},setgetUserInfoState(e,t){e.getUserInfoState=t},setMenu(e,t){e.menu=t}},actions:{fetchHistoricalSearch({commit:e}){let t=JSON.parse(localStorage.getItem("historicalSearch"))||[];e("setHistoricalSearch",t)},getAllForum({commit:e},t){t.$http.get("/api/home/allForum").then((t=>{if(200!=t.code)return;let n=t.data;e("setAllForumList",n)})).catch((e=>{t.$message.error(e.message)}))},getUserInfo({state:e,commit:t},n){e.getUserInfoState||(t("setgetUserInfoState",!0),n.$http.post("/api/home").then((e=>{if(200!=e.code)return;let r=e.data,{config:o,favorite:i,hotSearchkeywords:s,recommend:a,user:l,menu:c}=r;console.log("user",l.uid>0);const u=l.uid>0;console.log("islogin",u),t("setHomeRequestState",!0),t("setUser",l),t("setFavoriteList",i),t("setRecommendList",a),t("setHotSearchkeywords",s),t("setMenu",c),l.uid>0&&setTimeout((()=>{"undefined"!==typeof xstat&&xstat.identify({uid:l.uid,uin:l.uin})}),600),n.userInfo&&(n.userInfo=l,n.islogin=l.uid>0,n.hotSearchkeywords=s,n.menu=c)})).catch((e=>{n.$message.error(e.message)})).finally((()=>{t("setgetUserInfoState",!1)})))}},modules:{}}),x=n(8499);function B(e,t=!0){let n=document.createElement("a");document.body.appendChild(n),n.setAttribute("href",e),t&&n.setAttribute("target","_blank"),n.click()}function M(){document.body.style.overflow="hidden"}function S(){document.body.style.overflow=""}function E(){let e=encodeURIComponent(location.href);B(`https://passport.gter.net/?referer=${e}`,!1)}function R(e,t){let n=document.createElement("input");document.body.appendChild(n),n.setAttribute("value",e),n.select(),document.execCommand("Copy"),n.remove(),t?this.$Message.success(t):this.$Message.success("复制成功")}function I(e){e.loading=this.$loading({lock:!0,text:"加载中...",background:"rgba(0, 0, 0, 0.7)"})}function P(e){e.loading&&this.loading.close(),e.loading=null}function O(e){if(!e)return;const t=new Date(1e3*e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),a=`${n}-${r}-${o} ${i}:${s}`;return a}function U(e={}){const t=new URLSearchParams(window.location.search);for(const r in e)t.set(r,e[r]);const n=window.location.pathname+"?"+t.toString();window.history.pushState({},"",n)}function N(){let e=document.cookie.split("; ");for(let t of e){let[e,n]=t.split("=");document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}}var T=n(6522);const F="https://forum.gter.net";var G=F;T.Z.defaults.withCredentials=!0,T.Z.defaults.emulateJSON=!0,G={forum:"https://app.gter.net/forum",offer:"https://offer.gter.net",tenement:"https://app.gter.net"};const J=T.Z.create({baseURL:G.forum,timeout:15e3});J.interceptors.request.use((e=>e),(e=>{Promise.reject(e)})),J.interceptors.response.use((e=>{let t=e.data;return 401==t.code?E():(201==t.code&&1==e["config"]["ispop"]&&x.Message.error(t.message),t)}),(e=>{if(e&&e.response)switch(e.response.status){case 400:e.message="错误请求";break;case 401:e.message="未授权,请重新登录";break;case 403:e.message="拒绝访问";break;case 404:e.message="请求错误,未找到该资源";break;case 405:e.message="请求方法未允许";break;case 408:e.message="请求超时";break;case 500:e.message="服务器端出错";break;case 501:e.message="网络未实现";break;case 502:e.message="网络错误";break;case 503:e.message="服务不可用";break;case 504:e.message="网络超时";break;case 505:e.message="http版本不支持该请求";break;default:e.message=`连接错误${e.response.status}`}else JSON.stringify(e).includes("timeout")&&(e.message="服务器响应超时,请刷新当前页"),e.message="连接服务器失败";return x.Message.error(e.message),Promise.resolve(e.response)}));const j={get(e,t,n,r=!0){const o=window.location.hostname;let i=0;for(let l=0;l>>0).toString(16),a={method:"get",url:e,baseURL:G[n]};return t=Object.assign({},t,{key:s}),t&&(a.params=t),J(a)},post(e,t,n,r=!0){const o={method:"post",url:e,baseURL:G[n]};return t&&(o.data=t),o["ispop"]=r,J(o)}};var D=j;n(9607),n(5918);r["default"].config.productionTip=!1,r["default"].prototype.$loginUrl="https://passport.gter.net/",r["default"].prototype.$http=D,r["default"].prototype.$skipUrl=B,r["default"].prototype.$goTologin=E,r["default"].prototype.$pageStop=M,r["default"].prototype.$pageMove=S,r["default"].prototype.$Message=x.Message,r["default"].prototype.$loading=x.Loading,r["default"].prototype.$copy=R,r["default"].prototype.$startupUnderLoading=I,r["default"].prototype.$closeUnderLoading=P,r["default"].prototype.$formattedDate=O,r["default"].prototype.$updateURLSearchParams=U,r["default"].prototype.$clearCookies=N,r["default"].prototype.$baseURL="https://ansnid.oss-cn-shenzhen.aliyuncs.com/forum",Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),r["default"].use(x.Pagination),r["default"].use(x.Alert),r["default"].use(x.Loading),r["default"].use(x.Dialog),r["default"].directive("focus",{inserted:function(e){e.focus()}}),new r["default"]({router:v,store:k,render:e=>e(o.Z)}).$mount("#app")},5918:function(){(function(e,t){var n=750,r=75,o=t.documentElement,i=t.querySelector("body");function s(){var e=o.clientWidth/n*r;o.style.fontSize=e+"px",i.style.fontSize=16/e+"rem",a()}function a(){for(var t=parseInt(o.style.fontSize),n=t,r=0;r<100;r++){var i=parseInt(e.getComputedStyle(o).fontSize),s=i-t;if(!(Math.abs(s)>=1))break;s>0?n--:n++,o.style.fontSize=n+"px"}}s(),e.addEventListener("resize",s),e.addEventListener("pageshow",(function(e){e.persisted&&s()}))})(window,document)},7886:function(e,t,n){var r={"./add.svg":9614,"./addyellow.svg":1378,"./arrowsBlackLeft.svg":9814,"./arrowsLeft.svg":865,"./arrowsRoundBlackLeft.svg":9061,"./arrowsRoundLeft.svg":5435,"./bi.svg":3453,"./collapse-close.svg":1161,"./collapse.svg":1557,"./collect-btn.svg":7439,"./cross.svg":1965,"./gray-cross.svg":8163,"./look.svg":2726,"./msg.svg":2217,"./notlogin.svg":7525,"./pen.svg":9154,"./quotation-left.svg":2752,"./quotation-right.svg":9839,"./settingAdd.svg":6613,"./threeAcross.svg":2168};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=7886}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,function(){n.amdO={}}(),function(){var e=[];n.O=function(t,r,o,i){if(!r){var s=1/0;for(u=0;u=i)&&Object.keys(n.O).every((function(e){return n.O[e](r[l])}))?r.splice(l--,1):(a=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,o,i]}}(),function(){n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,{a:t}),t}}(),function(){n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}}(),function(){n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce((function(t,r){return n.f[r](e,t),t}),[]))}}(),function(){n.u=function(e){return"js/"+e+"."+{84:"1779a56b",94:"fc6edfaa",217:"d1ddcd5f",280:"ed574ed9",336:"52ad8d34",483:"9b9ef662",561:"862fb303",584:"43395d1c",621:"cb507707",875:"80111e79",878:"25f811f5",884:"b48d5ca7",917:"8692ef86"}[e]+".js"}}(),function(){n.miniCssF=function(e){return"css/"+e+"."+{94:"c58bb57f",217:"0fc0e835",280:"0915ca91",336:"7f7c43de",483:"8c066913",561:"8c066913",584:"8c066913",875:"02a76cc4",878:"0c2853cd",884:"9aa3ed80"}[e]+".css"}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={},t="ninepage:";n.l=function(r,o,i,s){if(e[r])e[r].push(o);else{var a,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),u=0;u\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},2752:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-quotation-left",use:"icon-quotation-left-usage",viewBox:"0 0 16 13",content:'\r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},9839:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-quotation-right",use:"icon-quotation-right-usage",viewBox:"0 0 16 13",content:'\r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},6613:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-settingAdd",use:"icon-settingAdd-usage",viewBox:"0 0 20 20",content:'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},2168:function(e,t,n){"use strict";n.r(t);var r=n(2512),o=n.n(r),i=n(1736),s=n.n(i),a=new(o())({id:"icon-threeAcross",use:"icon-threeAcross-usage",viewBox:"0 0 24 20",content:'\r\n \r\n \r\n \r\n'});s().add(a);t["default"]=a},5263:function(e,t,n){"use strict";var r=n(6369),o=n(9062),i=(n(7658),n(2631));const s="寄托天下论坛";function a(e){return e?`${e} - ${s}`:`${s}`}r["default"].use(i.ZP);const l=i.ZP.prototype.push;i.ZP.prototype.push=function(e){return l.call(this,e).catch((e=>e))};const c=()=>Promise.all([n.e(917),n.e(94)]).then(n.bind(n,2013)),u=()=>n.e(280).then(n.bind(n,280)),d=()=>n.e(884).then(n.bind(n,1884)),f=()=>n.e(217).then(n.bind(n,9217)),A=()=>Promise.all([n.e(917),n.e(483)]).then(n.bind(n,5817)),m=()=>n.e(878).then(n.bind(n,5878)),g=()=>Promise.all([n.e(917),n.e(584)]).then(n.bind(n,6170)),p=()=>n.e(336).then(n.bind(n,1336)),h=()=>Promise.all([n.e(917),n.e(561)]).then(n.bind(n,9143)),w=()=>Promise.all([n.e(621),n.e(875),n.e(84)]).then(n.bind(n,6513)),C=[{path:"/",name:"Index",redirect:"/recommend",component:c,children:[{path:"/recommend",name:"Recommend",component:u,meta:{title:"推荐版块"}},{path:"/collect",name:"Collect",component:d,meta:{title:"收藏的版块"}},{path:"/allSections",name:"AllSections",component:f,meta:{title:"全部版块"}}]},{path:"/searchResult",name:"search",redirect:"/searchResult",component:A,children:[{path:"/searchResult",name:"Recommend",component:m,meta:{title:"搜索帖子"}}]},{path:"/user",name:"user",redirect:"/userIndex",component:g,children:[{path:"/userIndex",name:"userIndex",component:p,meta:{title:"我的寄托"}}]},{path:"/detail",name:"detail",redirect:"/detailIndex",component:h,children:[{path:"/detailIndex",name:"detailIndex",component:w,meta:{title:"帖子详情"}}]}],y=new i.ZP({mode:"history",routes:C});let b=!0;y.beforeEach((async(e,t,n)=>{e.meta.title&&(document.title=a(e.meta.title)),b?b=!1:window._hmt&&e.path&&window._hmt.push(["_trackPageview","/#"+e.fullPath]),wx.miniProgram.postMessage({data:location.href}),n()}));var v=y,L=n(3822);r["default"].use(L.ZP);var k=new L.ZP.Store({state:{historicalSearch:[],allForumList:[],homeRequestState:!1,getUserInfoState:!1,favoriteList:[],recommendList:[],menu:[],user:{},hotSearchkeywords:[],loading:null},getters:{},mutations:{setHistoricalSearch(e,t){Array.isArray(t)||(t=[t]);let n=[...new Set([...t,...e.historicalSearch])];n.length>10&&(n=n.slice(0,10)),e.historicalSearch=n,localStorage.setItem("historicalSearch",JSON.stringify(n))},setAllForumList(e,t){e.allForumList=t},setHomeRequestState(e,t){e.homeRequestState=t},setFavoriteList(e,t){e.favoriteList=t},setRecommendList(e,t){e.recommendList=t},setUser(e,t){e.user=t},setHotSearchkeywords(e,t){e.hotSearchkeywords=t},setgetUserInfoState(e,t){e.getUserInfoState=t},setMenu(e,t){e.menu=t}},actions:{fetchHistoricalSearch({commit:e}){let t=JSON.parse(localStorage.getItem("historicalSearch"))||[];e("setHistoricalSearch",t)},getAllForum({commit:e},t){t.$http.get("/api/home/allForum").then((t=>{if(200!=t.code)return;let n=t.data;e("setAllForumList",n)})).catch((e=>{t.$message.error(e.message)}))},getUserInfo({state:e,commit:t},n){e.getUserInfoState||(t("setgetUserInfoState",!0),n.$http.post("/api/home").then((e=>{if(200!=e.code)return;let r=e.data,{config:o,favorite:i,hotSearchkeywords:s,recommend:a,user:l,menu:c}=r;console.log("user",l.uid>0);const u=l.uid>0;console.log("islogin",u),t("setHomeRequestState",!0),t("setUser",l),t("setFavoriteList",i),t("setRecommendList",a),t("setHotSearchkeywords",s),t("setMenu",c),l.uid>0&&setTimeout((()=>{"undefined"!==typeof xstat&&xstat.identify({uid:l.uid,uin:l.uin})}),600),n.userInfo&&(n.userInfo=l,n.islogin=l.uid>0,n.hotSearchkeywords=s,n.menu=c)})).catch((e=>{n.$message.error(e.message)})).finally((()=>{t("setgetUserInfoState",!1)})))}},modules:{}}),x=n(8499);function B(e,t=!0){let n=document.createElement("a");document.body.appendChild(n),n.setAttribute("href",e),t&&n.setAttribute("target","_blank"),n.click()}function M(){document.body.style.overflow="hidden"}function S(){document.body.style.overflow=""}function E(){let e=encodeURIComponent(location.href);B(`https://passport.gter.net/?referer=${e}`,!1)}function R(e,t){let n=document.createElement("input");document.body.appendChild(n),n.setAttribute("value",e),n.select(),document.execCommand("Copy"),n.remove(),t?this.$Message.success(t):this.$Message.success("复制成功")}function I(e){e.loading=this.$loading({lock:!0,text:"加载中...",background:"rgba(0, 0, 0, 0.7)"})}function P(e){e.loading&&this.loading.close(),e.loading=null}function O(e){if(!e)return;const t=new Date(1e3*e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),a=`${n}-${r}-${o} ${i}:${s}`;return a}function U(e={}){const t=new URLSearchParams(window.location.search);for(const r in e)t.set(r,e[r]);const n=window.location.pathname+"?"+t.toString();window.history.pushState({},"",n)}function N(){let e=document.cookie.split("; ");for(let t of e){let[e,n]=t.split("=");document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}}var T=n(6522);const F="https://forum.gter.net";var G=F;T.Z.defaults.withCredentials=!0,T.Z.defaults.emulateJSON=!0,G={forum:"https://app.gter.net/forum",offer:"https://offer.gter.net",tenement:"https://app.gter.net"};const J=T.Z.create({baseURL:G.forum,timeout:15e3});J.interceptors.request.use((e=>e),(e=>{Promise.reject(e)})),J.interceptors.response.use((e=>{let t=e.data;return 401==t.code?E():(201==t.code&&1==e["config"]["ispop"]&&x.Message.error(t.message),t)}),(e=>{if(e&&e.response)switch(e.response.status){case 400:e.message="错误请求";break;case 401:e.message="未授权,请重新登录";break;case 403:e.message="拒绝访问";break;case 404:e.message="请求错误,未找到该资源";break;case 405:e.message="请求方法未允许";break;case 408:e.message="请求超时";break;case 500:e.message="服务器端出错";break;case 501:e.message="网络未实现";break;case 502:e.message="网络错误";break;case 503:e.message="服务不可用";break;case 504:e.message="网络超时";break;case 505:e.message="http版本不支持该请求";break;default:e.message=`连接错误${e.response.status}`}else JSON.stringify(e).includes("timeout")&&(e.message="服务器响应超时,请刷新当前页"),e.message="连接服务器失败";return x.Message.error(e.message),Promise.resolve(e.response)}));const j={get(e,t,n,r=!0){const o=window.location.hostname;let i=0;for(let l=0;l>>0).toString(16),a={method:"get",url:e,baseURL:G[n]};return t=Object.assign({},t,{key:s}),t&&(a.params=t),J(a)},post(e,t,n,r=!0){const o={method:"post",url:e,baseURL:G[n]};return t&&(o.data=t),o["ispop"]=r,J(o)}};var D=j;n(9607),n(5918);r["default"].config.productionTip=!1,r["default"].prototype.$loginUrl="https://passport.gter.net/",r["default"].prototype.$http=D,r["default"].prototype.$skipUrl=B,r["default"].prototype.$goTologin=E,r["default"].prototype.$pageStop=M,r["default"].prototype.$pageMove=S,r["default"].prototype.$Message=x.Message,r["default"].prototype.$loading=x.Loading,r["default"].prototype.$copy=R,r["default"].prototype.$startupUnderLoading=I,r["default"].prototype.$closeUnderLoading=P,r["default"].prototype.$formattedDate=O,r["default"].prototype.$updateURLSearchParams=U,r["default"].prototype.$clearCookies=N,r["default"].prototype.$baseURL="https://ansnid.oss-cn-shenzhen.aliyuncs.com/forum",Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),r["default"].use(x.Pagination),r["default"].use(x.Alert),r["default"].use(x.Loading),r["default"].use(x.Dialog),r["default"].directive("focus",{inserted:function(e){e.focus()}}),new r["default"]({router:v,store:k,render:e=>e(o.Z)}).$mount("#app")},5918:function(){(function(e,t){var n=750,r=75,o=t.documentElement,i=t.querySelector("body");function s(){var e=o.clientWidth/n*r;o.style.fontSize=e+"px",i.style.fontSize=16/e+"rem",a()}function a(){for(var t=parseInt(o.style.fontSize),n=t,r=0;r<100;r++){var i=parseInt(e.getComputedStyle(o).fontSize),s=i-t;if(!(Math.abs(s)>=1))break;s>0?n--:n++,o.style.fontSize=n+"px"}}s(),e.addEventListener("resize",s),e.addEventListener("pageshow",(function(e){e.persisted&&s()}))})(window,document)},7886:function(e,t,n){var r={"./add.svg":9614,"./addyellow.svg":1378,"./arrowsBlackLeft.svg":9814,"./arrowsLeft.svg":865,"./arrowsRoundBlackLeft.svg":9061,"./arrowsRoundLeft.svg":5435,"./bi.svg":3453,"./collapse-close.svg":1161,"./collapse.svg":1557,"./collect-btn.svg":7439,"./cross.svg":1965,"./gray-cross.svg":8163,"./look.svg":2726,"./msg.svg":2217,"./notlogin.svg":7525,"./pen.svg":9154,"./quotation-left.svg":2752,"./quotation-right.svg":9839,"./settingAdd.svg":6613,"./threeAcross.svg":2168};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=7886}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,function(){n.amdO={}}(),function(){var e=[];n.O=function(t,r,o,i){if(!r){var s=1/0;for(u=0;u=i)&&Object.keys(n.O).every((function(e){return n.O[e](r[l])}))?r.splice(l--,1):(a=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,o,i]}}(),function(){n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,{a:t}),t}}(),function(){n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}}(),function(){n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce((function(t,r){return n.f[r](e,t),t}),[]))}}(),function(){n.u=function(e){return"js/"+e+"."+{84:"1779a56b",94:"fc6edfaa",217:"d1ddcd5f",280:"ed574ed9",336:"52ad8d34",483:"9b9ef662",561:"862fb303",584:"43395d1c",621:"cb507707",875:"80111e79",878:"25f811f5",884:"b48d5ca7",917:"8692ef86"}[e]+".js"}}(),function(){n.miniCssF=function(e){return"css/"+e+"."+{94:"c58bb57f",217:"0fc0e835",280:"0915ca91",336:"7f7c43de",483:"8c066913",561:"8c066913",584:"8c066913",875:"02a76cc4",878:"0c2853cd",884:"9aa3ed80"}[e]+".css"}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={},t="ninepage:";n.l=function(r,o,i,s){if(e[r])e[r].push(o);else{var a,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),u=0;u + + + diff --git a/src/main.js b/src/main.js index a93c42f..c927e0c 100755 --- a/src/main.js +++ b/src/main.js @@ -7,6 +7,7 @@ import 'element-ui/lib/theme-chalk/index.css'; import { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate, updateURLSearchParams, clearCookies } from "@/utils/common.js" import http from "@/utils/request" + Vue.config.productionTip = false Vue.prototype.$loginUrl = "https://passport.gter.net/" // 跳转登录的url diff --git a/src/router/index.js b/src/router/index.js index 3f95136..185ad65 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,143 +1,149 @@ -import Vue from 'vue' -import VueRouter from 'vue-router' +import Vue from "vue" +import VueRouter from "vue-router" Vue.use(VueRouter) const VueRouterPush = VueRouter.prototype.push VueRouter.prototype.push = function push(to) { - return VueRouterPush.call(this, to).catch(err => err) + return VueRouterPush.call(this, to).catch(err => err) } //标题js -import getPageTitle from "@/utils/title-config"; +import getPageTitle from "@/utils/title-config" -const Index = () => import('views/index/index') -const Recommend = () => import('views/index/recommend/Recommend') -const Collect = () => import('views/index/collect/Collect') -const AllSections = () => import('views/index/allSections/AllSections') -const search = () => import('views/search/search') -const SearchResult = () => import('views/search/searchResult/SearchResult') -const user = () => import('views/user/user') -const userIndex = () => import('views/user/UserIndex') -const detail = () => import('views/detail/detail') -const detailIndex = () => import('views/detail/detailIndex') +const Index = () => import("views/index/index") +const Recommend = () => import("views/index/recommend/Recommend") +const Collect = () => import("views/index/collect/Collect") +const AllSections = () => import("views/index/allSections/AllSections") +const search = () => import("views/search/search") +const SearchResult = () => import("views/search/searchResult/SearchResult") +const user = () => import("views/user/user") +const userIndex = () => import("views/user/UserIndex") +const detail = () => import("views/detail/detail") +const detailIndex = () => import("views/detail/detailIndex") const routes = [ - { - // 首页 - // path: '*', - path: '/', - name: 'Index', - redirect: "/recommend", - component: Index, - children: [ - { - path: '/recommend', - name: 'Recommend', - component: Recommend, - meta: { - title: "推荐版块" - } - }, - { - path: '/collect', - name: 'Collect', - component: Collect, - meta: { - title: "收藏的版块" - } - }, - { - path: '/allSections', - name: 'AllSections', - component: AllSections, - meta: { - title: "全部版块" - } - }, - ] - }, { - path: '/searchResult', // 搜索结果 - name: 'search', - redirect: "/searchResult", - component: search, - children: [ - { - path: '/searchResult', - name: 'Recommend', - component: SearchResult, - meta: { - title: "搜索帖子" - } - }, - ] - }, { - path: '/user', // 我的 - name: 'user', - redirect: "/userIndex", - component: user, - children: [ - { - path: '/userIndex', - name: 'userIndex', - component: userIndex, - meta: { - title: "我的寄托" - } - }, - ] - }, { - path: '/detail', // 帖子详情 - name: 'detail', - redirect: "/detailIndex", - component: detail, - children: [ - { - path: '/detailIndex', - name: 'detailIndex', - component: detailIndex, - meta: { - title: "帖子详情" - } - }, - ] - } + { + // 首页 + // path: '*', + path: "/", + name: "Index", + redirect: "/recommend", + component: Index, + children: [ + { + path: "/recommend", + name: "Recommend", + component: Recommend, + meta: { + title: "推荐版块", + }, + }, + { + path: "/collect", + name: "Collect", + component: Collect, + meta: { + title: "收藏的版块", + }, + }, + { + path: "/allSections", + name: "AllSections", + component: AllSections, + meta: { + title: "全部版块", + }, + }, + ], + }, + { + path: "/searchResult", // 搜索结果 + name: "search", + redirect: "/searchResult", + component: search, + children: [ + { + path: "/searchResult", + name: "Recommend", + component: SearchResult, + meta: { + title: "搜索帖子", + }, + }, + ], + }, + { + path: "/user", // 我的 + name: "user", + redirect: "/userIndex", + component: user, + children: [ + { + path: "/userIndex", + name: "userIndex", + component: userIndex, + meta: { + title: "我的寄托", + }, + }, + ], + }, + { + path: "/detail", // 帖子详情 + name: "detail", + redirect: "/detailIndex", + component: detail, + children: [ + { + path: "/detailIndex", + name: "detailIndex", + component: detailIndex, + meta: { + title: "帖子详情", + }, + }, + ], + }, ] const router = new VueRouter({ - mode: 'history', - // mode: 'hash', - // mode: process.env.NODE_ENV == "development" ? 'hash' : 'history', - // base: process.env.BASE_URL, - routes + mode: "history", + // mode: 'hash', + // mode: process.env.NODE_ENV == "development" ? 'hash' : 'history', + // base: process.env.BASE_URL, + routes, }) // 判断是不是首次 加载 let isInitialNavigation = true router.beforeEach(async (to, from, next) => { - if (to.meta.title) document.title = getPageTitle(to.meta.title); + if (to.meta.title) document.title = getPageTitle(to.meta.title) - if (isInitialNavigation) { - isInitialNavigation = false - } else { - if (window._hmt) { - if (to.path) { - window._hmt.push(['_trackPageview', '/#' + to.fullPath]) - } - } + if (isInitialNavigation) { + isInitialNavigation = false + } else { + if (window._hmt) { + if (to.path) { + window._hmt.push(["_trackPageview", "/#" + to.fullPath]) + } + } - // if (window._czc) { - // let location = window.location - // let contentUrl = location.pathname + location.hash - // let refererUrl = "/" - // // 用于发送某个URL的PV统计请求 - // window._czc.push(["_trackPageview", contentUrl, refererUrl]) - // } + // if (window._czc) { + // let location = window.location + // let contentUrl = location.pathname + location.hash + // let refererUrl = "/" + // // 用于发送某个URL的PV统计请求 + // window._czc.push(["_trackPageview", contentUrl, refererUrl]) + // } + } - } + wx.miniProgram.postMessage({ + data: location.href, + }) - next(); -}); + next() +}) export default router diff --git a/src/utils/jweixin-1.3.2.js b/src/utils/jweixin-1.3.2.js new file mode 100644 index 0000000..10c32f7 --- /dev/null +++ b/src/utils/jweixin-1.3.2.js @@ -0,0 +1,545 @@ +;((e, n) => { + "function" == typeof define && (define.amd || define.cmd) + ? define(function () { + return n(e) + }) + : n(e, !0) +})(this, function (r, e) { + var a, c, n, i, t, s, d, o, l, u, p, f, m, g, h, I, S, y, v, _, w, T + if (!r.jWeixin) + return ( + (a = { config: "preVerifyJSAPI", onMenuShareTimeline: "menu:share:timeline", onMenuShareAppMessage: "menu:share:appmessage", onMenuShareQQ: "menu:share:qq", onMenuShareWeibo: "menu:share:weiboApp", onMenuShareQZone: "menu:share:QZone", previewImage: "imagePreview", getLocation: "geoLocation", openProductSpecificView: "openProductViewWithPid", addCard: "batchAddCard", openCard: "batchViewCard", chooseWXPay: "getBrandWCPayRequest", openEnterpriseRedPacket: "getRecevieBizHongBaoRequest", startSearchBeacons: "startMonitoringBeacons", stopSearchBeacons: "stopMonitoringBeacons", onSearchBeacons: "onBeaconsInRange", consumeAndShareCard: "consumedShareCard", openAddress: "editAddress" }), + (c = (() => { + var e, + n = {} + for (e in a) n[a[e]] = e + return n + })()), + (i = (n = r.document).title), + (t = navigator.userAgent.toLowerCase()), + (f = navigator.platform.toLowerCase()), + (s = !(!f.match("mac") && !f.match("win"))), + (d = -1 != t.indexOf("wxdebugger")), + (o = -1 != t.indexOf("micromessenger")), + (l = -1 != t.indexOf("android")), + (u = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad")), + (p = (f = t.match(/micromessenger\/(\d+\.\d+\.\d+)/) || t.match(/micromessenger\/(\d+\.\d+)/)) ? f[1] : ""), + (m = { initStartTime: L(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 }), + (g = { version: 1, appId: "", initTime: 0, preVerifyTime: 0, networkType: "", isPreVerifyOk: 1, systemType: u ? 1 : l ? 2 : -1, clientVersion: p, url: encodeURIComponent(location.href) }), + (h = {}), + (I = { _completes: [] }), + (S = { state: 0, data: {} }), + B(function () { + m.initEndTime = L() + }), + (y = !1), + (v = []), + (_ = { + config: function (e) { + C("config", (h = e)) + var o = !1 !== h.check + B(function () { + if (o) + k( + a.config, + { verifyJsApiList: V(h.jsApiList) }, + ((I._complete = function (e) { + ;(m.preVerifyEndTime = L()), (S.state = 1), (S.data = e) + }), + (I.success = function (e) { + g.isPreVerifyOk = 0 + }), + (I.fail = function (e) { + I._fail ? I._fail(e) : (S.state = -1) + }), + (t = I._completes).push(function () { + var n + s || + d || + h.debug || + p < "6.0.2" || + g.systemType < 0 || + ((n = new Image()), + (g.appId = h.appId), + (g.initTime = m.initEndTime - m.initStartTime), + (g.preVerifyTime = m.preVerifyEndTime - m.preVerifyStartTime), + _.getNetworkType({ + isInnerInvoke: !0, + success: function (e) { + ;(g.networkType = e.networkType), (n.src = "https://open.weixin.qq.com/sdk/report?v=" + g.version + "&o=" + g.isPreVerifyOk + "&s=" + g.systemType + "&c=" + g.clientVersion + "&a=" + g.appId + "&n=" + g.networkType + "&i=" + g.initTime + "&p=" + g.preVerifyTime + "&u=" + g.url) + }, + })) + }), + (I.complete = function (e) { + for (var n = 0, i = t.length; n < i; ++n) t[n]() + I._completes = [] + }), + I) + ), + (m.preVerifyStartTime = L()) + else { + S.state = 1 + for (var e = I._completes, n = 0, i = e.length; n < i; ++n) e[n]() + I._completes = [] + } + var t + }), + _.invoke || + ((_.invoke = function (e, n, i) { + r.WeixinJSBridge && WeixinJSBridge.invoke(e, P(n), i) + }), + (_.on = function (e, n) { + r.WeixinJSBridge && WeixinJSBridge.on(e, n) + })) + }, + ready: function (e) { + ;(0 != S.state || (I._completes.push(e), !o && h.debug)) && e() + }, + error: function (e) { + p < "6.0.2" || (-1 == S.state ? e(S.data) : (I._fail = e)) + }, + checkJsApi: function (e) { + k( + "checkJsApi", + { jsApiList: V(e.jsApiList) }, + ((e._complete = function (e) { + l && (i = e.checkResult) && (e.checkResult = JSON.parse(i)) + var n, + i = e, + t = i.checkResult + for (n in t) { + var o = c[n] + o && ((t[o] = t[n]), delete t[n]) + } + }), + e) + ) + }, + onMenuShareTimeline: function (e) { + M( + a.onMenuShareTimeline, + { + complete: function () { + k("shareTimeline", { title: e.title || i, desc: e.title || i, img_url: e.imgUrl || "", link: e.link || location.href, type: e.type || "link", data_url: e.dataUrl || "" }, e) + }, + }, + e + ) + }, + onMenuShareAppMessage: function (n) { + M( + a.onMenuShareAppMessage, + { + complete: function (e) { + "favorite" === e.scene ? k("sendAppMessage", { title: n.title || i, desc: n.desc || "", link: n.link || location.href, img_url: n.imgUrl || "", type: n.type || "link", data_url: n.dataUrl || "" }) : k("sendAppMessage", { title: n.title || i, desc: n.desc || "", link: n.link || location.href, img_url: n.imgUrl || "", type: n.type || "link", data_url: n.dataUrl || "" }, n) + }, + }, + n + ) + }, + onMenuShareQQ: function (e) { + M( + a.onMenuShareQQ, + { + complete: function () { + k("shareQQ", { title: e.title || i, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) + }, + }, + e + ) + }, + onMenuShareWeibo: function (e) { + M( + a.onMenuShareWeibo, + { + complete: function () { + k("shareWeiboApp", { title: e.title || i, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) + }, + }, + e + ) + }, + onMenuShareQZone: function (e) { + M( + a.onMenuShareQZone, + { + complete: function () { + k("shareQZone", { title: e.title || i, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e) + }, + }, + e + ) + }, + startRecord: function (e) { + k("startRecord", {}, e) + }, + stopRecord: function (e) { + k("stopRecord", {}, e) + }, + onVoiceRecordEnd: function (e) { + M("onVoiceRecordEnd", e) + }, + playVoice: function (e) { + k("playVoice", { localId: e.localId }, e) + }, + pauseVoice: function (e) { + k("pauseVoice", { localId: e.localId }, e) + }, + stopVoice: function (e) { + k("stopVoice", { localId: e.localId }, e) + }, + onVoicePlayEnd: function (e) { + M("onVoicePlayEnd", e) + }, + uploadVoice: function (e) { + k("uploadVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) + }, + downloadVoice: function (e) { + k("downloadVoice", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) + }, + translateVoice: function (e) { + k("translateVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) + }, + chooseImage: function (e) { + k( + "chooseImage", + { scene: "1|2", count: e.count || 9, sizeType: e.sizeType || ["original", "compressed"], sourceType: e.sourceType || ["album", "camera"] }, + ((e._complete = function (e) { + if (l) { + var n = e.localIds + try { + n && (e.localIds = JSON.parse(n)) + } catch (e) {} + } + }), + e) + ) + }, + getLocation: function (e) {}, + getLocation: function (e) { + ;(e = e || {}), + k( + a.getLocation, + { type: e.type || "wgs84" }, + ((e._complete = function (e) { + delete e.type + }), + e) + ) + }, + previewImage: function (e) { + k(a.previewImage, { current: e.current, urls: e.urls }, e) + }, + uploadImage: function (e) { + k("uploadImage", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) + }, + downloadImage: function (e) { + k("downloadImage", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e) + }, + getLocalImgData: function (e) { + !1 === y + ? ((y = !0), + k( + "getLocalImgData", + { localId: e.localId }, + ((e._complete = function (e) { + var n + ;(y = !1), 0 < v.length && ((n = v.shift()), wx.getLocalImgData(n)) + }), + e) + )) + : v.push(e) + }, + getNetworkType: function (e) { + k( + "getNetworkType", + {}, + ((e._complete = function (e) { + var n = e, + e = n.errMsg, + i = ((n.errMsg = "getNetworkType:ok"), n.subtype) + if ((delete n.subtype, i)) n.networkType = i + else { + var i = e.indexOf(":"), + t = e.substring(i + 1) + switch (t) { + case "wifi": + case "edge": + case "wwan": + n.networkType = t + break + default: + n.errMsg = "getNetworkType:fail" + } + } + }), + e) + ) + }, + openLocation: function (e) { + k("openLocation", { latitude: e.latitude, longitude: e.longitude, name: e.name || "", address: e.address || "", scale: e.scale || 28, infoUrl: e.infoUrl || "" }, e) + }, + hideOptionMenu: function (e) { + k("hideOptionMenu", {}, e) + }, + showOptionMenu: function (e) { + k("showOptionMenu", {}, e) + }, + closeWindow: function (e) { + k("closeWindow", {}, (e = e || {})) + }, + hideMenuItems: function (e) { + k("hideMenuItems", { menuList: e.menuList }, e) + }, + showMenuItems: function (e) { + k("showMenuItems", { menuList: e.menuList }, e) + }, + hideAllNonBaseMenuItem: function (e) { + k("hideAllNonBaseMenuItem", {}, e) + }, + showAllNonBaseMenuItem: function (e) { + k("showAllNonBaseMenuItem", {}, e) + }, + scanQRCode: function (e) { + k( + "scanQRCode", + { needResult: (e = e || {}).needResult || 0, scanType: e.scanType || ["qrCode", "barCode"] }, + ((e._complete = function (e) { + var n + u && (n = e.resultStr) && ((n = JSON.parse(n)), (e.resultStr = n && n.scan_code && n.scan_code.scan_result)) + }), + e) + ) + }, + openAddress: function (e) { + k( + a.openAddress, + {}, + ((e._complete = function (e) { + ;((e = e).postalCode = e.addressPostalCode), delete e.addressPostalCode, (e.provinceName = e.proviceFirstStageName), delete e.proviceFirstStageName, (e.cityName = e.addressCitySecondStageName), delete e.addressCitySecondStageName, (e.countryName = e.addressCountiesThirdStageName), delete e.addressCountiesThirdStageName, (e.detailInfo = e.addressDetailInfo), delete e.addressDetailInfo + }), + e) + ) + }, + openProductSpecificView: function (e) { + k(a.openProductSpecificView, { pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo }, e) + }, + addCard: function (e) { + for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { + var r = n[t], + r = { card_id: r.cardId, card_ext: r.cardExt } + i.push(r) + } + k( + a.addCard, + { card_list: i }, + ((e._complete = function (e) { + if ((n = e.card_list)) { + for (var n, i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) { + var o = n[i] + ;(o.cardId = o.card_id), (o.cardExt = o.card_ext), (o.isSuccess = !!o.is_succ), delete o.card_id, delete o.card_ext, delete o.is_succ + } + ;(e.cardList = n), delete e.card_list + } + }), + e) + ) + }, + chooseCard: function (e) { + k( + "chooseCard", + { app_id: h.appId, location_id: e.shopId || "", sign_type: e.signType || "SHA1", card_id: e.cardId || "", card_type: e.cardType || "", card_sign: e.cardSign, time_stamp: e.timestamp + "", nonce_str: e.nonceStr }, + ((e._complete = function (e) { + ;(e.cardList = e.choose_card_info), delete e.choose_card_info + }), + e) + ) + }, + openCard: function (e) { + for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) { + var r = n[t], + r = { card_id: r.cardId, code: r.code } + i.push(r) + } + k(a.openCard, { card_list: i }, e) + }, + consumeAndShareCard: function (e) { + k(a.consumeAndShareCard, { consumedCardId: e.cardId, consumedCode: e.code }, e) + }, + chooseWXPay: function (e) { + k(a.chooseWXPay, x(e), e) + }, + openEnterpriseRedPacket: function (e) { + k(a.openEnterpriseRedPacket, x(e), e) + }, + startSearchBeacons: function (e) { + k(a.startSearchBeacons, { ticket: e.ticket }, e) + }, + stopSearchBeacons: function (e) { + k(a.stopSearchBeacons, {}, e) + }, + onSearchBeacons: function (e) { + M(a.onSearchBeacons, e) + }, + openEnterpriseChat: function (e) { + k("openEnterpriseChat", { useridlist: e.userIds, chatname: e.groupName }, e) + }, + launchMiniProgram: function (e) { + k( + "launchMiniProgram", + { + targetAppId: e.targetAppId, + path: (e => { + var n + if ("string" == typeof e && 0 < e.length) return (n = e.split("?")[0]), (n += ".html"), void 0 !== (e = e.split("?")[1]) ? n + "?" + e : n + })(e.path), + envVersion: e.envVersion, + }, + e + ) + }, + miniProgram: { + navigateBack: function (e) { + ;(e = e || {}), + B(function () { + k("invokeMiniProgramAPI", { name: "navigateBack", arg: { delta: e.delta || 1 } }, e) + }) + }, + navigateTo: function (e) { + B(function () { + k("invokeMiniProgramAPI", { name: "navigateTo", arg: { url: e.url } }, e) + }) + }, + redirectTo: function (e) { + B(function () { + k("invokeMiniProgramAPI", { name: "redirectTo", arg: { url: e.url } }, e) + }) + }, + switchTab: function (e) { + B(function () { + k("invokeMiniProgramAPI", { name: "switchTab", arg: { url: e.url } }, e) + }) + }, + reLaunch: function (e) { + B(function () { + k("invokeMiniProgramAPI", { name: "reLaunch", arg: { url: e.url } }, e) + }) + }, + postMessage: function (e) { + B(function () { + k("invokeMiniProgramAPI", { name: "postMessage", arg: e.data || {} }, e) + }) + }, + getEnv: function (e) { + B(function () { + e({ miniprogram: "miniprogram" === r.__wxjs_environment }) + }) + }, + }, + }), + (w = 1), + (T = {}), + n.addEventListener( + "error", + function (e) { + var n, i, t + l || + ((t = (n = e.target).tagName), (i = n.src), "IMG" != t && "VIDEO" != t && "AUDIO" != t && "SOURCE" != t) || + (-1 != i.indexOf("wxlocalresource://") && + (e.preventDefault(), + e.stopPropagation(), + (t = n["wx-id"]) || ((t = w++), (n["wx-id"] = t)), + T[t] || + ((T[t] = !0), + wx.ready(function () { + wx.getLocalImgData({ + localId: i, + success: function (e) { + n.src = e.localData + }, + }) + })))) + }, + !0 + ), + n.addEventListener( + "load", + function (e) { + var n + l || ((n = (e = e.target).tagName), "IMG" != n && "VIDEO" != n && "AUDIO" != n && "SOURCE" != n) || ((n = e["wx-id"]) && (T[n] = !1)) + }, + !0 + ), + e && (r.wx = r.jWeixin = _), + _ + ) + function k(n, e, i) { + r.WeixinJSBridge + ? WeixinJSBridge.invoke(n, P(e), function (e) { + A(n, e, i) + }) + : C(n, i) + } + function M(n, i, t) { + r.WeixinJSBridge + ? WeixinJSBridge.on(n, function (e) { + t && t.trigger && t.trigger(e), A(n, e, i) + }) + : C(n, t || i) + } + function P(e) { + return ((e = e || {}).appId = h.appId), (e.verifyAppId = h.appId), (e.verifySignType = "sha1"), (e.verifyTimestamp = h.timestamp + ""), (e.verifyNonceStr = h.nonceStr), (e.verifySignature = h.signature), e + } + function x(e) { + return { timeStamp: e.timestamp + "", nonceStr: e.nonceStr, package: e.package, paySign: e.paySign, signType: e.signType || "SHA1" } + } + function A(e, n, i) { + "openEnterpriseChat" == e && (n.errCode = n.err_code), delete n.err_code, delete n.err_desc, delete n.err_detail + var t = n.errMsg, + e = + (t || + ((t = n.err_msg), + delete n.err_msg, + (t = ((e, n) => { + var i, + t = c[e] + return t && (e = t), (t = "ok"), n && ((i = n.indexOf(":")), ("access denied" != (t = (t = (t = -1 != (t = -1 != (t = "failed" == (t = "confirm" == (t = n.substring(i + 1)) ? "ok" : t) ? "fail" : t).indexOf("failed_") ? t.substring(7) : t).indexOf("fail_") ? t.substring(5) : t).replace(/_/g, " ")).toLowerCase()) && "no permission to execute" != t) || (t = "permission denied"), "" == (t = "config" == e && "function not exist" == t ? "ok" : t)) && (t = "fail"), (n = e + ":" + t) + })(e, t)), + (n.errMsg = t)), + (i = i || {})._complete && (i._complete(n), delete i._complete), + (t = n.errMsg || ""), + h.debug && !i.isInnerInvoke && alert(JSON.stringify(n)), + t.indexOf(":")) + switch (t.substring(e + 1)) { + case "ok": + i.success && i.success(n) + break + case "cancel": + i.cancel && i.cancel(n) + break + default: + i.fail && i.fail(n) + } + i.complete && i.complete(n) + } + function V(e) { + if (e) { + for (var n = 0, i = e.length; n < i; ++n) { + var t = e[n], + t = a[t] + t && (e[n] = t) + } + return e + } + } + function C(e, n) { + var i + !h.debug || (n && n.isInnerInvoke) || ((i = c[e]) && (e = i), n && n._complete && delete n._complete, console.log('"' + e + '",', n || "")) + } + function L() { + return new Date().getTime() + } + function B(e) { + o && (r.WeixinJSBridge ? e() : n.addEventListener && n.addEventListener("WeixinJSBridgeReady", e, !1)) + } +})