index.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  4. __name: "index",
  5. setup(__props) {
  6. var _a;
  7. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  8. const openid = common_vendor.computed(() => {
  9. return common_vendor.index.getStorageSync("openid");
  10. });
  11. const agree = common_vendor.ref(false);
  12. const otherLogin = () => {
  13. if (agree.value) {
  14. if (openid.value) {
  15. common_vendor.index.getUserProfile({
  16. desc: "用于展示",
  17. success: async function(res) {
  18. let parmas = {
  19. openid: openid.value,
  20. nickname: res.userInfo.nickName + common_vendor.hooks().valueOf()
  21. };
  22. const arr = await $api(`matchUser`, "POST", parmas);
  23. if (arr.code === 200) {
  24. common_vendor.index.navigateBack({
  25. delta: 1
  26. });
  27. } else {
  28. common_vendor.index.showToast({
  29. title: arr.msg,
  30. icon: "error"
  31. });
  32. }
  33. },
  34. fail: function(err) {
  35. console.log(err);
  36. }
  37. });
  38. } else {
  39. common_vendor.index.showToast({
  40. title: "系统更新中,请稍后再试!",
  41. icon: "none"
  42. });
  43. }
  44. } else {
  45. common_vendor.index.showToast({
  46. title: "请阅读并同意用户协议和隐私政策",
  47. icon: "none"
  48. });
  49. }
  50. };
  51. const toAgree = () => {
  52. common_vendor.index.navigateTo({
  53. url: `/pagesHome/agree/index`
  54. });
  55. };
  56. const changeAgree = () => {
  57. agree.value = !agree.value;
  58. };
  59. return (_ctx, _cache) => {
  60. return {
  61. a: common_vendor.o(($event) => otherLogin()),
  62. b: agree.value,
  63. c: common_vendor.o(($event) => toAgree()),
  64. d: common_vendor.o(changeAgree)
  65. };
  66. };
  67. }
  68. });
  69. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d08ef7d4"], ["__file", "D:/project/足球比赛/match_applet/pages/login/index.vue"]]);
  70. wx.createPage(MiniProgramPage);