2025-04-01 09:03:51 +08:00

1 line
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/my/index"],{"091b":function(t,e,n){"use strict";n.r(e);var o=n("42c3"),a=n.n(o);for(var i in o)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(i);e["default"]=a.a},"42c3":function(t,e,n){"use strict";(function(t){var o=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=o(n("7ca3")),i=n("8f59");function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){(0,a.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var r=c(c({},(0,i.mapActions)(["number"])),{},{data:function(){return{topHeight:"",popupStyle:{width:"690rpx",height:"630rpx"},showPopup:!1,userName:"请登录",show:!1,avatar:"",agree:!1,other:[{tit:"《用户协议》",type:"page",content:"/pages/Negotiate/agreement"},{tit:"《隐私政策》",type:"page",content:"/pages/Negotiate/privacy"}],protocolArr:["<隐私协议>"],userinfo:{},shop_id:"",openidInfo:null,token:"",src:"",openid_code:"",code:"",unread_number:"",init:{},timer:null,list:[{image:"../../static/my/class.png",text:"我的课程",url:"/packageA/my/orderList"},{image:"../../static/my/make.png",text:"预约课程",url:"/packageA/my/makeList"},{image:"../../static/my/start.png",text:"收藏课程",url:"/packageA/my/Collect"},{image:"../../static/my/afterSales.png",text:"售后订单",url:"/pages/afterSales/list"},{image:"../../static/my/Course.png",text:"课程表",url:"/packageA/my/timetable"},{image:"../../static/my/Feedback.png",text:"课程反馈",url:"/packageA/my/Feedback"},{image:"../../static/my/station.png",text:"消息通知",url:"/packageA/my/station"},{image:"../../static/my/Personal.png",text:"修改信息",url:"/packageA/my/person-detail"},{image:"../../static/my/exercise.png",text:"我的活动",url:"/packageA/activity/exercise"},{image:"../../static/my/Help.png",text:"帮助",url:"/packageA/my/help"}],list2:[{image:"../../static/my/Platform.png",text:"申请入驻",url:"/pages/index/Apply",auth_status:1},{image:"../../static/my/Check.png",text:"报名审核",url:"/packageA/my/classCheck",auth_status:0},{image:"../../static/my/Manage.png",text:"课程管理",auth_status:0,url:"/packageA/my/management"},{image:"../../static/my/activity.png",text:"活动管理",auth_status:0,url:"/packageA/my/ac-management"},{image:"../../static/my/verification.png",text:"核销课程",url:"/packageA/my/cancel",auth_status:0},{image:"../../static/my/cancal.png",text:"核销活动",url:"/packageA/my/cancelActivity",auth_status:0},{image:"../../static/my/organization.png",text:"我的机构",auth_status:0,url:"/pages/center/MechanismDetail"},{image:"../../static/my/addClass.png",text:"创建课程",auth_status:0,url:"/packageA/my/addManagement"}]}},onLoad:function(){t.hideTabBar()},onShow:function(){this.getStatus(),this.token=t.getStorageSync("token"),this.unread_number=this.number;var e=t.getStorageSync("userInfo"),n=t.getStorageSync("niName");n?(console.log(1,"niName",n),this.userName=n):(console.log(2),this.userName=e.name),this.avatar=t.getStorageSync("userInfo").avatar||"../../static/moren.png";var o=t.getStorageSync("openidInfo");o||this.miniLogin(),this.number(),this.getinit()},created:function(){var e=t.getSystemInfoSync(),n=e.statusBarHeight,o=e.windowWidth,a=n*(750/o);this.topHeight=a},beforeDestroy:function(){this.stopTimer()},mounted:function(){this.startTimer()},methods:{callPhone:function(e){t.makePhoneCall({phoneNumber:e})},getinit:function(){var e=this;t.$u.http.get("/api/index/init",{}).then((function(n){1==n.code?(e.init=n.data.customer_service,t.setStorageSync("init",n.data.customer_service)):t.showToast({title:n.msg,icon:"none",duration:2e3})})).catch((function(e){t.showToast({title:"请求失败,请稍后再试",icon:"none",duration:2e3})}))},getStatus:function(){var e=this;t.$u.http.get("/api/school/shop/auth_info",{}).then((function(n){if(console.log(e.list2.length,"this.list2.length"),1==n.code){var o=!1,a=!1;if(n.data.verification_auth.verification&&(o=!0),1==n.data.auth_status&&n.data.shop_id&&(a=!0),o&&1==n.data.auth_status){for(var i=1;i<e.list2.length;i++)e.list2[i].auth_status=1;e.list2[e.list2.length-1].auth_status=0,e.list2[e.list2.length-2].auth_status=0}if(a){e.list2[0].auth_status=0;for(var s=1;s<e.list2.length;s++)e.list2[s].auth_status=1;e.shop_id=n.data.shop_id,t.setStorageSync("shop_id",n.data.shop_id),t.setStorageSync("apply_info",n.data.apply_info),e.list2[e.list2.length-2].url="/pages/center/MechanismDetail?id=".concat(n.data.shop_id)}}})).catch((function(e){t.showToast({title:res.msg,icon:"none",duration:2e3})}))},showModel:function(){t.showToast({title:"开发中,暂未开放",icon:"none"})},out:function(){t.clearStorageSync(),t.reLaunch({url:"/pages/my/index"})},to:function(e){console.log(e),t.navigateTo({url:e})},jump:function(e,n){var o=this;console.log(e),"/packageA/my/cancel"==e?t.scanCode({success:function(n){console.log("扫码结果:"+n.result),t.navigateTo({url:e+"?res="+encodeURIComponent(n.result)})},fail:function(e){console.error("扫码失败:"+e),t.showToast({title:"扫码已取消",icon:"none"})}}):"/packageA/my/addManagement"==e?t.$u.http.get("/api/school/shop/auth_info").then((function(e){1==e.code?e.data.check_full?t.navigateTo({url:"/packageA/my/addManagement?shop_id="+o.shop_id}):t.showToast({title:"必要展示信息未完善,请先在机构完善展示信息",icon:"none",duration:2e3}):t.showToast({title:e.msg,icon:"none",duration:2e3})})).catch((function(t){console.error("请求失败",t)})):"/packageA/my/cancelActivity"==e?t.scanCode({success:function(n){console.log("扫码结果:"+n.result),t.navigateTo({url:e+"?res="+encodeURIComponent(n.result)})},fail:function(e){console.error("扫码失败:"+e),t.showToast({title:"扫码已取消",icon:"none"})}}):t.navigateTo({url:e})},close:function(){this.showPopup=!1},miniLogin:function(){var e=this;t.login({provider:"weixin",success:function(n){console.log("res.code",n.code),e.getOpenidByCode(n.code),e.code=n.code,t.setStorageSync("code",n.code)},fail:function(t){console.log("authError",t)}})},getOpenidByCode:function(e){var n=this;t.$u.http.post("/api/user/getOpenid ",{code:e}).then((function(e){1==e.code&&(n.openidInfo=e.data,t.setStorageSync("openidInfo",e.data))})).catch((function(t){console.log("获取openid失败",t)}))},getPhoneNumber:function(e){if(this.miniLogin(),console.log("e.detail",e.detail),!e.detail.iv)return t.showToast({title:"授权失败,请重新授权",icon:"none",duration:2e3}),this.miniLogin(),!1;var n=t.getStorageSync("openidInfo");if(!n)return this.miniLogin(),t.showToast({title:"未获取到信息,请重新点击授权",icon:"none",duration:2e3}),!1;this.decodeMobile({encryptedData:e.detail.encryptedData,iv:e.detail.iv,sessionKey:n.session_key},n)},decodeMobile:function(e,n){var o=this;t.$u.http.post("/api/user/decodeData",{encryptedData:e.encryptedData,iv:e.iv,sessionKey:e.sessionKey}).then((function(e){console.log("res",e),1==e.code?o.userRegister(e.data.phoneNumber,n.openid):t.showToast({title:e.msg||"解析手机号失败",icon:"none",duration:2e3})})).catch((function(t){}))},userRegister:function(e,n){var o=this,a=this;console.log(t.getStorageInfoSync("code")),t.$u.http.post("/api/user/registerLogin",{mobile:e,openid:n,code:a.code,apptype:"miniapp",platform:"wechat"}).then((function(e){1==e.code?(t.setStorageSync("token",e.data.token),a.getUserInfo(),o.token=e.data.token):(t.showToast({title:e.msg,icon:"none",duration:2e3}),t.clearStorageSync(),a.miniLogin())})).catch((function(t){console.log("error",t)}))},getUserInfo:function(){var e=this;t.$u.http.get("/api/user/index",{}).then((function(n){1==n.code?(t.setStorageSync("userInfo",n.data.user_info),t.showToast({title:"登陆成功",icon:"none",duration:2e3}),e.showPopup=!1,e.userName=n.data.user_info.nickname,e.avatar=n.data.user_info.avatar,t.setStorageSync("niName",n.data.user_info.nickname),e.userinfo=n.data.user_info,e.token=n.data.user_info.token):(e.showPopup=!1,t.showToast({title:"登陆失败",icon:"error",duration:2e3}))})).catch((function(n){console.log("error",n),e.showPopup=!1,t.showToast({title:"登陆失败",icon:"error",duration:2e3})}))},clickTop:function(){this.token?t.navigateTo({url:"/packageA/my/person-detail"}):(this.miniLogin(),this.showPopup=!0)},checkTokenAndRequest:function(){t.getStorageSync("token")&&this.number()},startTimer:function(){var t=this;this.timer||(this.timer=setInterval((function(){t.checkTokenAndRequest()}),1e4))},stopTimer:function(){this.timer&&(clearInterval(this.timer),this.timer=null)},number:function(){var e=this;t.$u.http.get("/api/school/message/message_count",{params:{}}).then((function(n){1==n.code?(e.$store.commit("setNumber",n.data.unread_number),e.unread_number=n.data.unread_number,t.setStorageSync("unread_number",n.data.unread_number)):t.showToast({title:n.msg,icon:"none",duration:2e3})})).catch((function(t){}))}}});e.default=r}).call(this,n("df3c")["default"])},"50dc":function(t,e,n){"use strict";(function(t,e){var o=n("47a9");n("5e3a");o(n("3240"));var a=o(n("597b"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(a.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"597b":function(t,e,n){"use strict";n.r(e);var o=n("692d"),a=n("091b");for(var i in a)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(i);n("aab4");var s=n("828b"),c=Object(s["a"])(a["default"],o["b"],o["c"],!1,null,"361624d2",null,!1,o["a"],void 0);e["default"]=c.exports},"692d":function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o}));var o={uBadge:function(){return Promise.all([n.e("common/vendor"),n.e("node-modules/uview-ui/components/u-badge/u-badge")]).then(n.bind(null,"2a0d"))},uPopup:function(){return Promise.all([n.e("common/vendor"),n.e("node-modules/uview-ui/components/u-popup/u-popup")]).then(n.bind(null,"e6bd"))},lslProtocolPopup:function(){return n.e("uni_modules/lsl-protocol-popup/components/lsl-protocol-popup/lsl-protocol-popup").then(n.bind(null,"a7bf"))},uToast:function(){return n.e("node-modules/uview-ui/components/u-toast/u-toast").then(n.bind(null,"4bda"))}},a=function(){var t=this.$createElement,e=(this._self._c,n("7395"));this.$mp.data=Object.assign({},{$root:{m0:e}})},i=[]},a510:function(t,e,n){},aab4:function(t,e,n){"use strict";var o=n("a510"),a=n.n(o);a.a}},[["50dc","common/runtime","common/vendor"]]]);