"use strict"; var common_vendor = require("../../common/vendor.js"); var api_user = require("../../api/user.js"); var store_index = require("../../store/index.js"); var api_drugReport = require("../../api/drugReport.js"); require("../../common/request.js"); require("../../store/modules.js"); require("../../store/modules/timStore.js"); const wxAuth = () => "../components/wxAuth.js"; const _sfc_main = { components: { wxAuth }, data() { return { wxShow: false, isLogin: false, show: false, statusBarHeight: common_vendor.index.getStorageSync("menuInfo").statusBarHeight, user: { nickName: "\u767B\u5F55/\u6CE8\u518C", phone: "", integral: 0, balance: 0 } }; }, onLoad() { }, onShow() { this.$isLogin().then((res) => { if (res) { common_vendor.index.$emit("refreshIM"); this.getUserInfo(); } }, (rej) => { }); }, onReachBottom() { }, onPageScroll(e) { }, methods: { updateUser() { this.wxShow = false; this.getUserInfo(); }, wxAuthOpen() { this.wxShow = true; var that = this; setTimeout(function() { that.$refs.wxauth.getUserInfo(); }); }, wxAuthClose() { this.wxShow = false; }, doIM() { console.log(110); common_vendor.index.showLoading({ title: "\u5904\u7406\u4E2D..." }); api_drugReport.getUserFollowDoctor().then((res) => { if (res.code == 200) { if (res.data != null) { var data = res.data; var param = { followId: res.data.followId }; api_drugReport.startDrugReport(param).then((res2) => { common_vendor.index.hideLoading(); var id = "C2CD-" + data.followDoctorId; store_index.store.commit("timStore/setOrderId", data.orderId); store_index.store.commit("timStore/setFollowId", data.followId); store_index.store.commit("timStore/setImType", 2); store_index.store.commit("timStore/setConversationID", id); common_vendor.index.$TUIKit.TUIConversationServer.setMessageRead(id); common_vendor.index.$TUIKit.TUIConversationServer.getConversationProfile(id).then((res3) => { var _a; console.log(res3); const { conversation } = res3.data; store_index.store.commit("timStore/setConversation", conversation); let url = "/pages/TUIKit/TUIPages/TUIChat/index"; conversation.userProfile; url = `${url}?conversationName=${((_a = conversation.userProfile.nick) == null ? void 0 : _a.nick) || conversation.userProfile.userID}`; common_vendor.index.redirectTo({ url }); }).catch((err) => { common_vendor.index.hideLoading(); console.warn("\u83B7\u53D6 group profile \u5F02\u5E38 = ", err); }); }, (rej) => { }); } else { common_vendor.index.hideLoading(); common_vendor.index.showToast({ icon: "none", title: "\u5F53\u524D\u6CA1\u6709\u836F\u5E08\u4E3A\u60A8\u670D\u52A1" }); } } else { common_vendor.index.hideLoading(); common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); }, toIM() { var that = this; this.$isLogin().then((res) => { console.log(res); if (res) { that.doIM(); } else { common_vendor.index.navigateTo({ url: "/pages/auth/login" }); } }); }, callPhone() { common_vendor.index.makePhoneCall({ phoneNumber: "18696558100" }); }, toCompany() { this.$isLogin().then((res) => { console.log(res); if (res) { var token = common_vendor.index.getStorageSync("CompanyUserToken"); if (token) { common_vendor.index.navigateTo({ url: "/pages_company/index" }); } else { common_vendor.index.navigateTo({ url: "/pages_company/login" }); } } else { common_vendor.index.navigateTo({ url: "/pages/auth/login" }); } }); }, showLogout() { this.show = true; }, hideLogout() { this.show = false; }, logout() { this.$logout(); common_vendor.index.$TUIKit.logout(); if (common_vendor.index.$TUICallKit != null) { common_vendor.index.$TUICallKit.logout(); } common_vendor.index.reLaunch({ url: "/pages/index/index", animationType: "pop-in", animationDuration: 100 }); this.isLogin = false; }, getUserInfo() { api_user.getUserInfo().then((res) => { if (res.code == 200) { if (res.user != null) { this.isLogin = true; this.user = res.user; console.log(this.user.nickName.substr(0, 4)); if (this.user.isWeixinAuth == 0) { this.wxAuthOpen(); } } } else { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); }, navTo(url) { common_vendor.index.navigateTo({ url }); }, loginNavTo(url) { this.$isLogin().then((res) => { console.log(res); if (res) { common_vendor.index.navigateTo({ url }); } else { common_vendor.index.navigateTo({ url: "/pages/auth/login" }); } }); } } }; if (!Array) { const _component_wx_auth = common_vendor.resolveComponent("wx-auth"); const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup"); const _easycom_u_modal2 = common_vendor.resolveComponent("u-modal"); (_component_wx_auth + _easycom_u_popup2 + _easycom_u_modal2)(); } const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js"; const _easycom_u_modal = () => "../../uni_modules/uview-plus/components/u-modal/u-modal.js"; if (!Math) { (_easycom_u_popup + _easycom_u_modal)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: $data.statusBarHeight, b: $data.user.avatar == null ? "https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/90d9eb0f8f87482b977611eb36b66d82.jpg" : $data.user.avatar, c: common_vendor.t($data.user.nickName), d: $data.user.phone != "" }, $data.user.phone != "" ? { e: common_vendor.t(_ctx.$parsePhone($data.user.phone)) } : {}, { f: common_vendor.t($data.user.integral), g: common_vendor.o(($event) => $options.loginNavTo("/pages_user/integral")), h: common_vendor.o(($event) => $options.loginNavTo("/pages_user/personInfo")), i: common_vendor.o(($event) => $options.loginNavTo("/pages_order/inquiryOrderList")), j: common_vendor.o(($event) => $options.loginNavTo("/pages_order/storeOrderList")), k: common_vendor.o(($event) => $options.loginNavTo("/pages_order/packageOrderList")), l: common_vendor.o(($event) => $options.loginNavTo("/pages_order/storeOrderRefundList")), m: common_vendor.o(($event) => $options.loginNavTo("/pages_user/myDoctorList")), n: common_vendor.o(($event) => $options.loginNavTo("/pages_order/prescribeList")), o: common_vendor.o(($event) => $options.loginNavTo("/pages_user/followList")), p: common_vendor.o(($event) => $options.toIM()), q: common_vendor.o(($event) => $options.navTo("/pages_user/drugReportList")), r: common_vendor.o(($event) => $options.loginNavTo("/pages_user/patient")), s: common_vendor.o(($event) => $options.loginNavTo("/pages_user/address")), t: common_vendor.o(($event) => $options.loginNavTo("/pages_user/healthRecords/index")), v: common_vendor.o(($event) => $options.loginNavTo("/pages_user/tongue/tongueList")), w: common_vendor.o(($event) => $options.loginNavTo("/pages_user/addHealthButler")), x: common_vendor.o(($event) => $options.loginNavTo("/pages_user/myCouponList")), y: common_vendor.o(($event) => $options.loginNavTo("/pages_company/couponList?couponType=6")), z: common_vendor.o(($event) => $options.loginNavTo("/pages_user/cert")), A: common_vendor.o(($event) => $options.loginNavTo("/pages_user/price")), B: common_vendor.o(($event) => $options.navTo("/pages_user/about")), C: common_vendor.o(($event) => $options.loginNavTo("/pages_user/registerDoctor?type=1")), D: common_vendor.o(($event) => $options.loginNavTo("/pages_user/registerDoctor?type=2")), E: common_vendor.o(($event) => $options.toCompany()), F: $data.isLogin }, $data.isLogin ? { G: common_vendor.o(($event) => $options.showLogout()) } : {}, { H: common_vendor.sr("wxauth", "137d5072-1,137d5072-0"), I: common_vendor.o(($event) => $options.updateUser()), J: common_vendor.o($options.wxAuthClose), K: common_vendor.o($options.wxAuthOpen), L: common_vendor.p({ bgColor: "#f6f6f6", safeAreaInsetBottom: false, round: 15, mode: "bottom", show: $data.wxShow }), M: common_vendor.o(($event) => $options.hideLogout()), N: common_vendor.o(($event) => $options.logout()), O: common_vendor.p({ show: $data.show, title: "\u63D0\u793A", showCancelButton: true, content: "\u786E\u8BA4\u9000\u51FA\u5417?" }) }); } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-137d5072"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages/user/index.vue"]]); _sfc_main.__runtimeHooks = 1; wx.createPage(MiniProgramPage);