"use weex:vue";

if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor
    return this.then(
      value => promise.resolve(callback()).then(() => value),
      reason => promise.resolve(callback()).then(() => {
        throw reason
      })
    )
  }
};

if (typeof uni !== 'undefined' && uni && uni.requireGlobal) {
  const global = uni.requireGlobal()
  ArrayBuffer = global.ArrayBuffer
  Int8Array = global.Int8Array
  Uint8Array = global.Uint8Array
  Uint8ClampedArray = global.Uint8ClampedArray
  Int16Array = global.Int16Array
  Uint16Array = global.Uint16Array
  Int32Array = global.Int32Array
  Uint32Array = global.Uint32Array
  Float32Array = global.Float32Array
  Float64Array = global.Float64Array
  BigInt64Array = global.BigInt64Array
  BigUint64Array = global.BigUint64Array
};


(()=>{var L=Object.create;var I=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var F=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N(t))!k.call(e,i)&&i!==r&&I(e,i,{get:()=>t[i],enumerable:!(o=j(t,i))||o.enumerable});return e};var x=(e,t,r)=>(r=e!=null?L(O(e)):{},F(t||!e||!e.__esModule?I(r,"default",{value:e,enumerable:!0}):r,e));var m=(e,t,r)=>new Promise((o,i)=>{var n=d=>{try{c(r.next(d))}catch(f){i(f)}},u=d=>{try{c(r.throw(d))}catch(f){i(f)}},c=d=>d.done?o(d.value):Promise.resolve(d.value).then(n,u);c((r=r.apply(e,t)).next())});var v=B((V,E)=>{E.exports=Vue});var z=x(v());function D(e,t,...r){uni.__log__?uni.__log__(e,t,...r):console[e].apply(console,[...r,t])}var R={tips(e,t=2e3,r="bottom"){plus.nativeUI.toast(e,{type:"text",duration:t,align:"center",verticalAlign:r})},isIOS(){return uni.getSystemInfoSync().platform==="ios"},isAndroid(){return uni.getSystemInfoSync().platform==="android"},getUUID(){return m(this,null,function*(){return new Promise((e,t)=>{plus.device.getInfo({success:r=>{e(r.uuid)},fail:r=>{t(r)}})})})},timeToTimestamp(e){return new Date(e.replace(/-/g,"/"))},friendlyDate(e){let t=this.timeToTimestamp(e);var r={year:"%n% \u5E74\u524D",month:"%n% \u6708\u524D",day:"%n% \u5929\u524D",hour:"%n% \u5C0F\u65F6\u524D",minute:"%n% \u5206\u949F\u524D",second:"%n% \u79D2\u524D"},o=Date.now(),i=Math.floor((o-t)/1e3),n=Math.floor(i/60),u=Math.floor(n/60),c=Math.floor(u/24),d=Math.floor(c/30),f=Math.floor(d/12),p="",g=0;return f>0?(p="year",g=f):d>0?(p="month",g=d):c>0?(p="day",g=c):u>0?(p="hour",g=u):n>0?(p="minute",g=n):(p="second",g=i===0?i=1:i),r[p].replace("%n%",g)},base64Encode(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="",o,i,n,u,c,d,f,p=0;for(e=this.utf8Encode(e);p<e.length;)o=e.charCodeAt(p++),i=e.charCodeAt(p++),n=e.charCodeAt(p++),u=o>>2,c=(o&3)<<4|i>>4,d=(i&15)<<2|n>>6,f=n&63,isNaN(i)?d=f=64:isNaN(n)&&(f=64),r=r+t.charAt(u)+t.charAt(c)+t.charAt(d)+t.charAt(f);return r},utf8Encode(e){e=e.replace(/\r\n/g,`
`);for(var t="",r=0;r<e.length;r++){var o=e.charCodeAt(r);o<128?t+=String.fromCharCode(o):o>127&&o<2048?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(o&63|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(o&63|128))}return t},utf8Decode(e){var t=[],r=0,o=0,i=0,n=0,u=0;for(e+="";r<e.length;)i=e.charCodeAt(r),i<128?(t[o++]=String.fromCharCode(i),r++):i>191&&i<224?(n=e.charCodeAt(r+1),t[o++]=String.fromCharCode((i&31)<<6|n&63),r+=2):(n=e.charCodeAt(r+1),u=e.charCodeAt(r+2),t[o++]=String.fromCharCode((i&15)<<12|(n&63)<<6|u&63),r+=3);return t.join("")},base64Decode(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,i,n,u,c,d,f,p=0,g=0,A="",y=[];if(!e)return e;for(e+="";p<e.length;)n=t.indexOf(e.charAt(p++)),u=t.indexOf(e.charAt(p++)),c=t.indexOf(e.charAt(p++)),d=t.indexOf(e.charAt(p++)),f=n<<18|u<<12|c<<6|d,r=f>>16&255,o=f>>8&255,i=f&255,c==64?y[g++]=String.fromCharCode(r):d==64?y[g++]=String.fromCharCode(r,o):y[g++]=String.fromCharCode(r,o,i);return A=y.join(""),this.utf8Decode(A)},hasNotchInScreen(){return plus.navigator.hasNotchInScreen()}},_=R,U=!1;function a(e){uni.getNetworkType({success:function(o){if(o.networkType=="none")return _.tips("\u8BF7\u68C0\u6D4B\u7F51\u7EDC\u8FDE\u63A5"),!1}}),e.loading&&uni.showLoading({title:"\u52A0\u8F7D\u4E2D...",mask:!0,icon:"none"});let t={};var r=uni.getStorageSync("USER_TOKEN");return t.Authorization=r,t["Content-Type"]="application/x-www-form-urlencoded",new Promise((o,i)=>{uni.request({url:e.url,method:e.method||"POST",data:e.data||{},header:t,timeout:5e3,success:n=>{U&&D("log","at utils/request.js:48",n),o(n.data)},fail:n=>{U&&D("log","at utils/request.js:52",n),i(n)},complete:n=>{e.loading&&uni.hideLoading()}})})}a.baseURL="https://newapp.cheshi.com";var S="USER_TOKEN",h="USER_INFO",s=a.baseURL+"/v1",M={baseURL:s,STORAGE_USER_KEY:h,isLogin(){return!!(uni.getStorageSync(S)&&uni.getStorageSync(h))},login(){return uni.navigateTo({url:"/pages/login/index"}),!1},bindThird(e){let t={url:s+"/user/bind-app",data:{openid:e.openid,type:e.type,unionid:e.unionid,nickname:e.nickname,avatar:e.avatar}};return a(t)},getUserInfo(e=!1){return m(this,null,function*(){if(!e){let o=uni.getStorageSync(h);if(o)return o}let t={url:s+"/person/user-info"};return(yield a(t)).data})},getCode(e,t,r,o){let i={url:s+"/user/get-code",data:{device_id:e,mobile:t,token:r,type:o}};return a(i)},fastLogin(e,t){let r={url:s+"/user/fast-login",data:{mobile:e,code:t}};return a(r)},logOff(){let e={url:s+"/person/log-off"};return a(e)},oAuthLogin(e,t,r,o,i,n,u){let c={url:s+"/user/oauth-login",data:{openid:e,type:t,unionid:r,nickname:o,user_img:i,mobile:n,code:u}};return a(c)},updateUserInfo(e,t){let r={url:s+"/person/update-user-info",data:{key:e,value:t}};return a(r)},bindMobile(e,t){let r={url:s+"/user/bind-mobile",data:{mobile:e,code:t}};return a(r)},getNewsHistory(e,t="news",r=10){let o={url:s+"/person/my-history",data:{type:t,page:e,limit:r},method:"POST"};return a(o)},getFocus(e,t=10){let r={url:s+"/person/my-focus",data:{page:e,limit:t},method:"POST"};return a(r)},addFocus(e){let t={url:s+"/person/add-focus",data:{to_uid:e},method:"post"};return a(t)},delFocus(e){let t={url:s+"/person/del-focus",data:{to_uid:e},method:"post"};return a(t)},getMyLikes(e){let t={url:s+"/collect/list",data:{type:e.type,page:e.page,limit:e.limit||30},method:"post"};return a(t)},getProvinceList(){let e={url:s+"/user/get-provinces"};return a(e)},getCityList(e){let t={url:s+"/user/get-citys",data:{provinceID:e}};return a(t)},logout(){this.updateUserClientId("del"),uni.removeStorageSync(S),uni.removeStorageSync(h)},getFavoriteList(e){let t={url:s+"/story/collectlist",data:{action:e.type||"all",page:e.page||1,pagesize:e.limit||10}};return a(t)},thirdLogin(e){return m(this,null,function*(){let t={url:s+"/user/oauth-login",data:{openid:e.openid,type:e.type,unionid:e.unionid,nickname:e.nickname,avatar:e.avatar,mobile:e.mobile,code:e.code}},r=yield a(t);if(_.tips(r.message),r.code==204&&e.mobile==0&&e.code==0)return uni.setStorageSync("LOGIN_BIND_INFO",t.data),uni.redirectTo({url:"/pages/user/bind-mobile/index"}),!1;if(r.code!=200)return uni.removeStorageSync(S),uni.removeStorageSync(h),!1;uni.setStorageSync(S,r.data.login_token),uni.setStorageSync(h,r.data.user_info),this.updateUserClientId("add"),uni.switchTab({url:"/pages/index/index"})})},share(e){return m(this,null,function*(){if(!this.isAppExists("wechat"))return!1;let[t,r]=yield uni.showActionSheet({itemList:["\u5206\u4EAB\u7ED9\u670B\u53CB","\u5206\u4EAB\u5230\u670B\u53CB\u5708"]});if(!r)return!1;let o=yield this.getUserInfo(),i=["video","live"].includes(e.imageType)?o.base_share_host+"/app_"+e.imageType+"_"+e.id+"/?s_id="+o.id:o.base_share_host+"/kaizen/article/"+o.id+"/"+e.id+".html",n=e.title_pic1||e.share_logo,u={provider:"weixin",scene:r.tapIndex==0?"WXSceneSession":"WXSenceTimeline",type:0,href:i,title:e.title+" - KAIZEN",summary:e.short_summary,imageUrl:n};uni.setClipboardData({data:e.short_summary}),yield uni.share(u);let c={url:s+"/story/share",data:{favid:e.id,action:e.imageType}};yield a(c)})},updateUserClientId(e){let t=uni.getStorageSync("UNI_PUSH_CLIENT_ID")||"";if(t=="")return!1;let r={url:s+"/user/push-device",data:{action:e,cid:t,from:_.isIOS()?"ios":"android"}};return a(r)},updateAppBadge(){let e=uni.getStorageSync("UNI_PUSH_CLIENT_ID")||"";if(e==""||_.isAndroid())return!1;let t={url:s+"/public/delete-badge",data:{cid:e,badge:0}};return a(t)},isAppExists(e){let t={};switch(e){case"wechat":t.pname="com.tencent.mm",t.action="weixin://";break;default:t.pname="",t.action=""}return plus.runtime.isApplicationExist(t)}},C=M;var l=x(v());var T=(e,t)=>{let r=e.__vccOpts||e;for(let[o,i]of t)r[o]=i;return r};var P={content:{"":{paddingTop:"20rpx",paddingRight:0,paddingBottom:"20rpx",paddingLeft:0}},"con-top":{"":{backgroundColor:"#ffffff",paddingTop:0,paddingRight:"32rpx",paddingBottom:0,paddingLeft:"32rpx"}},"band-list":{"":{height:"88rpx",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}},q={data(){return{isLogin:!1,userInfo:{user_img:"",realname:"",nickname:"",mobile:"",id:"",is_bind_weixin:!1,level:{name:"\u9A7E\u6821\u5B66\u5458",level:1,pic:""}}}},onShow(){return m(this,null,function*(){this.isLogin=C.isLogin(),this.isLogin&&(this.userInfo=yield C.getUserInfo(!0))})},methods:{}};function G(e,t,r,o,i,n){return(0,l.openBlock)(),(0,l.createElementBlock)("scroll-view",{scrollY:!0,showScrollbar:!0,enableBackToTop:!0,bubble:"true",style:{flexDirection:"column"}},[(0,l.createElementVNode)("view",{class:"content"},[(0,l.createElementVNode)("view",{class:"con-top"},[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(i.userInfo.bind_list,(u,c)=>((0,l.openBlock)(),(0,l.createElementBlock)("view",{class:"band-list"},[(0,l.createElementVNode)("view",{class:"list-left"},[(0,l.createElementVNode)("u-text",{class:"list-name"},(0,l.toDisplayString)(u.name),1)]),(0,l.createElementVNode)("u-text",{class:"list-btn"},"\u5DF2\u7ED1\u5B9A")]))),256))])])])}var b=T(q,[["render",G],["styles",[P]]]);var w=plus.webview.currentWebview();if(w){let e=parseInt(w.id),t="pages/mycenter/setting/bindApp",r={};try{r=JSON.parse(w.__query__)}catch(i){}b.mpType="page";let o=Vue.createPageApp(b,{$store:getApp({allowDefault:!0}).$store,__pageId:e,__pagePath:t,__pageQuery:r});o.provide("__globalStyles",Vue.useCssStyles([...__uniConfig.styles,...b.styles||[]])),o.mount("#root")}})();
