index.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. "use strict";
  2. var common_vendor = require("../../common/vendor.js");
  3. var api_user = require("../../api/user.js");
  4. var store_index = require("../../store/index.js");
  5. var api_drugReport = require("../../api/drugReport.js");
  6. require("../../common/request.js");
  7. require("../../store/modules.js");
  8. require("../../store/modules/timStore.js");
  9. const wxAuth = () => "../components/wxAuth.js";
  10. const _sfc_main = {
  11. components: {
  12. wxAuth
  13. },
  14. data() {
  15. return {
  16. wxShow: false,
  17. isLogin: false,
  18. show: false,
  19. statusBarHeight: common_vendor.index.getStorageSync("menuInfo").statusBarHeight,
  20. user: {
  21. nickName: "\u767B\u5F55/\u6CE8\u518C",
  22. phone: "",
  23. integral: 0,
  24. balance: 0
  25. }
  26. };
  27. },
  28. onLoad() {
  29. },
  30. onShow() {
  31. this.$isLogin().then((res) => {
  32. if (res) {
  33. common_vendor.index.$emit("refreshIM");
  34. this.getUserInfo();
  35. }
  36. }, (rej) => {
  37. });
  38. },
  39. onReachBottom() {
  40. },
  41. onPageScroll(e) {
  42. },
  43. methods: {
  44. updateUser() {
  45. this.wxShow = false;
  46. this.getUserInfo();
  47. },
  48. wxAuthOpen() {
  49. this.wxShow = true;
  50. var that = this;
  51. setTimeout(function() {
  52. that.$refs.wxauth.getUserInfo();
  53. });
  54. },
  55. wxAuthClose() {
  56. this.wxShow = false;
  57. },
  58. doIM() {
  59. console.log(110);
  60. common_vendor.index.showLoading({
  61. title: "\u5904\u7406\u4E2D..."
  62. });
  63. api_drugReport.getUserFollowDoctor().then((res) => {
  64. if (res.code == 200) {
  65. if (res.data != null) {
  66. var data = res.data;
  67. var param = { followId: res.data.followId };
  68. api_drugReport.startDrugReport(param).then((res2) => {
  69. common_vendor.index.hideLoading();
  70. var id = "C2CD-" + data.followDoctorId;
  71. store_index.store.commit("timStore/setOrderId", data.orderId);
  72. store_index.store.commit("timStore/setFollowId", data.followId);
  73. store_index.store.commit("timStore/setImType", 2);
  74. store_index.store.commit("timStore/setConversationID", id);
  75. common_vendor.index.$TUIKit.TUIConversationServer.setMessageRead(id);
  76. common_vendor.index.$TUIKit.TUIConversationServer.getConversationProfile(id).then((res3) => {
  77. var _a;
  78. console.log(res3);
  79. const { conversation } = res3.data;
  80. store_index.store.commit("timStore/setConversation", conversation);
  81. let url = "/pages/TUIKit/TUIPages/TUIChat/index";
  82. conversation.userProfile;
  83. url = `${url}?conversationName=${((_a = conversation.userProfile.nick) == null ? void 0 : _a.nick) || conversation.userProfile.userID}`;
  84. common_vendor.index.redirectTo({ url });
  85. }).catch((err) => {
  86. common_vendor.index.hideLoading();
  87. console.warn("\u83B7\u53D6 group profile \u5F02\u5E38 = ", err);
  88. });
  89. }, (rej) => {
  90. });
  91. } else {
  92. common_vendor.index.hideLoading();
  93. common_vendor.index.showToast({
  94. icon: "none",
  95. title: "\u5F53\u524D\u6CA1\u6709\u836F\u5E08\u4E3A\u60A8\u670D\u52A1"
  96. });
  97. }
  98. } else {
  99. common_vendor.index.hideLoading();
  100. common_vendor.index.showToast({
  101. icon: "none",
  102. title: "\u8BF7\u6C42\u5931\u8D25"
  103. });
  104. }
  105. }, (rej) => {
  106. });
  107. },
  108. toIM() {
  109. var that = this;
  110. this.$isLogin().then((res) => {
  111. console.log(res);
  112. if (res) {
  113. that.doIM();
  114. } else {
  115. common_vendor.index.navigateTo({
  116. url: "/pages/auth/login"
  117. });
  118. }
  119. });
  120. },
  121. callPhone() {
  122. common_vendor.index.makePhoneCall({
  123. phoneNumber: "18696558100"
  124. });
  125. },
  126. toCompany() {
  127. this.$isLogin().then((res) => {
  128. console.log(res);
  129. if (res) {
  130. var token = common_vendor.index.getStorageSync("CompanyUserToken");
  131. if (token) {
  132. common_vendor.index.navigateTo({
  133. url: "/pages_company/index"
  134. });
  135. } else {
  136. common_vendor.index.navigateTo({
  137. url: "/pages_company/login"
  138. });
  139. }
  140. } else {
  141. common_vendor.index.navigateTo({
  142. url: "/pages/auth/login"
  143. });
  144. }
  145. });
  146. },
  147. showLogout() {
  148. this.show = true;
  149. },
  150. hideLogout() {
  151. this.show = false;
  152. },
  153. logout() {
  154. this.$logout();
  155. common_vendor.index.$TUIKit.logout();
  156. if (common_vendor.index.$TUICallKit != null) {
  157. common_vendor.index.$TUICallKit.logout();
  158. }
  159. common_vendor.index.reLaunch({
  160. url: "/pages/index/index",
  161. animationType: "pop-in",
  162. animationDuration: 100
  163. });
  164. this.isLogin = false;
  165. },
  166. getUserInfo() {
  167. api_user.getUserInfo().then((res) => {
  168. if (res.code == 200) {
  169. if (res.user != null) {
  170. this.isLogin = true;
  171. this.user = res.user;
  172. console.log(this.user.nickName.substr(0, 4));
  173. if (this.user.isWeixinAuth == 0) {
  174. this.wxAuthOpen();
  175. }
  176. }
  177. } else {
  178. common_vendor.index.showToast({
  179. icon: "none",
  180. title: "\u8BF7\u6C42\u5931\u8D25"
  181. });
  182. }
  183. }, (rej) => {
  184. });
  185. },
  186. navTo(url) {
  187. common_vendor.index.navigateTo({
  188. url
  189. });
  190. },
  191. loginNavTo(url) {
  192. this.$isLogin().then((res) => {
  193. console.log(res);
  194. if (res) {
  195. common_vendor.index.navigateTo({
  196. url
  197. });
  198. } else {
  199. common_vendor.index.navigateTo({
  200. url: "/pages/auth/login"
  201. });
  202. }
  203. });
  204. }
  205. }
  206. };
  207. if (!Array) {
  208. const _component_wx_auth = common_vendor.resolveComponent("wx-auth");
  209. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  210. const _easycom_u_modal2 = common_vendor.resolveComponent("u-modal");
  211. (_component_wx_auth + _easycom_u_popup2 + _easycom_u_modal2)();
  212. }
  213. const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
  214. const _easycom_u_modal = () => "../../uni_modules/uview-plus/components/u-modal/u-modal.js";
  215. if (!Math) {
  216. (_easycom_u_popup + _easycom_u_modal)();
  217. }
  218. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  219. return common_vendor.e({
  220. a: $data.statusBarHeight,
  221. b: $data.user.avatar == null ? "https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/90d9eb0f8f87482b977611eb36b66d82.jpg" : $data.user.avatar,
  222. c: common_vendor.t($data.user.nickName),
  223. d: $data.user.phone != ""
  224. }, $data.user.phone != "" ? {
  225. e: common_vendor.t(_ctx.$parsePhone($data.user.phone))
  226. } : {}, {
  227. f: common_vendor.t($data.user.integral),
  228. g: common_vendor.o(($event) => $options.loginNavTo("/pages_user/integral")),
  229. h: common_vendor.o(($event) => $options.loginNavTo("/pages_user/personInfo")),
  230. i: common_vendor.o(($event) => $options.loginNavTo("/pages_order/inquiryOrderList")),
  231. j: common_vendor.o(($event) => $options.loginNavTo("/pages_order/storeOrderList")),
  232. k: common_vendor.o(($event) => $options.loginNavTo("/pages_order/packageOrderList")),
  233. l: common_vendor.o(($event) => $options.loginNavTo("/pages_order/storeOrderRefundList")),
  234. m: common_vendor.o(($event) => $options.loginNavTo("/pages_user/myDoctorList")),
  235. n: common_vendor.o(($event) => $options.loginNavTo("/pages_order/prescribeList")),
  236. o: common_vendor.o(($event) => $options.loginNavTo("/pages_user/followList")),
  237. p: common_vendor.o(($event) => $options.toIM()),
  238. q: common_vendor.o(($event) => $options.navTo("/pages_user/drugReportList")),
  239. r: common_vendor.o(($event) => $options.loginNavTo("/pages_user/patient")),
  240. s: common_vendor.o(($event) => $options.loginNavTo("/pages_user/address")),
  241. t: common_vendor.o(($event) => $options.loginNavTo("/pages_user/healthRecords/index")),
  242. v: common_vendor.o(($event) => $options.loginNavTo("/pages_user/tongue/tongueList")),
  243. w: common_vendor.o(($event) => $options.loginNavTo("/pages_user/addHealthButler")),
  244. x: common_vendor.o(($event) => $options.loginNavTo("/pages_user/myCouponList")),
  245. y: common_vendor.o(($event) => $options.loginNavTo("/pages_company/couponList?couponType=6")),
  246. z: common_vendor.o(($event) => $options.loginNavTo("/pages_user/cert")),
  247. A: common_vendor.o(($event) => $options.loginNavTo("/pages_user/price")),
  248. B: common_vendor.o(($event) => $options.navTo("/pages_user/about")),
  249. C: common_vendor.o(($event) => $options.loginNavTo("/pages_user/registerDoctor?type=1")),
  250. D: common_vendor.o(($event) => $options.loginNavTo("/pages_user/registerDoctor?type=2")),
  251. E: common_vendor.o(($event) => $options.toCompany()),
  252. F: $data.isLogin
  253. }, $data.isLogin ? {
  254. G: common_vendor.o(($event) => $options.showLogout())
  255. } : {}, {
  256. H: common_vendor.sr("wxauth", "137d5072-1,137d5072-0"),
  257. I: common_vendor.o(($event) => $options.updateUser()),
  258. J: common_vendor.o($options.wxAuthClose),
  259. K: common_vendor.o($options.wxAuthOpen),
  260. L: common_vendor.p({
  261. bgColor: "#f6f6f6",
  262. safeAreaInsetBottom: false,
  263. round: 15,
  264. mode: "bottom",
  265. show: $data.wxShow
  266. }),
  267. M: common_vendor.o(($event) => $options.hideLogout()),
  268. N: common_vendor.o(($event) => $options.logout()),
  269. O: common_vendor.p({
  270. show: $data.show,
  271. title: "\u63D0\u793A",
  272. showCancelButton: true,
  273. content: "\u786E\u8BA4\u9000\u51FA\u5417?"
  274. })
  275. });
  276. }
  277. 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"]]);
  278. _sfc_main.__runtimeHooks = 1;
  279. wx.createPage(MiniProgramPage);