抖音c端
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

161 satır
3.2 KiB

  1. const app = getApp()
  2. const navigationBarHeight = (getApp().statusBarHeight + 50) + "px";
  3. const Http = require("../utils/HttpBasics");
  4. const config = require("../config/config");
  5. const imgurl = require("../utils/imgurl");
  6. Page({
  7. data: {
  8. navigationBarHeight,
  9. showPhoem: false,
  10. text: "授权手机号",
  11. avatarUrl: "",
  12. nickName: "",
  13. mouldType: 1,
  14. },
  15. showPhoemBtn() {
  16. tt.navigateTo({
  17. url: '/pages/getPhone/getPhone?mineFlag=mine',
  18. });
  19. },
  20. go(e) {
  21. let url = e.currentTarget.dataset.url
  22. console.log(url);
  23. if (url == '/pages/order/index/index?id=all') {
  24. app.globalData.ifshowtab = false
  25. tt.navigateTo({
  26. url: url,
  27. success: (res) => {
  28. },
  29. fail: (res) => {
  30. },
  31. });
  32. } else {
  33. tt.navigateTo({
  34. url: url, // 指定页面的 url
  35. success: (res) => {
  36. },
  37. fail: (res) => {
  38. },
  39. });
  40. }
  41. },
  42. setPhone(paramData) {
  43. //子组件调用这个方法说明手机号已经授权成功
  44. this.setData({
  45. showPhoem: paramData.detail,
  46. })
  47. tt.showToast({
  48. title: '授权成功', // 内容
  49. icon: 'none', // 图标
  50. success: (res) => {
  51. },
  52. fail: (res) => {
  53. },
  54. });
  55. },
  56. getmemberId: function (token) {
  57. Http.get({
  58. url: config.api.getScore,
  59. data: {
  60. token: token
  61. }
  62. }).then(res => {
  63. if (res.data.avatarUrl || res.data.nickName) {
  64. this.setData({
  65. avatarUrl: res.data.avatarUrl,
  66. nickName: res.data.nickName,
  67. })
  68. }
  69. }).catch(err => {
  70. tt.showModal({
  71. title: '提示',
  72. content: err.message,
  73. showCancel: false
  74. })
  75. })
  76. },
  77. setBox(paramData) {
  78. this.setData({
  79. showPhoem: paramData.detail
  80. })
  81. tt.reLaunch({
  82. url: "/index/index",
  83. success(res) {
  84. console.log(`${res}`);
  85. app.globalData.selected = 0
  86. },
  87. fail(err) {
  88. console.log(`navigateTo调用失败`, err);
  89. },
  90. });
  91. // tt.showToast({
  92. // title: '取消授权', // 内容
  93. // icon: 'none', // 图标
  94. // success: (res) => {
  95. // },
  96. // fail: (res) => {
  97. // },
  98. // });
  99. },
  100. goSetUserInfo() {
  101. tt.navigateTo({
  102. url: '/pages/getuserinfo/getuserinfo?mineFlag=mine',
  103. });
  104. },
  105. onShow: function (options) {
  106. this.setData({
  107. mouldType: app.globalData.mouldType
  108. })
  109. this.getmemberId()
  110. Http.get({
  111. url: config.api.checkUserStatus,
  112. data: {
  113. token: app.globalData.token
  114. }
  115. }).then(res => {
  116. Http.get({
  117. url: config.api.checkPhoneStatus,
  118. }).then(res => {
  119. this.setData({
  120. text: res.data.phone
  121. })
  122. }).catch(err => {
  123. if (app.globalData.ifCongPh == 1) {
  124. tt.navigateTo({
  125. url: '/pages/getPhone/getPhone?mineFlag=mine',
  126. });
  127. } else {
  128. this.setData({
  129. showPhoem: true
  130. })
  131. }
  132. })
  133. }).catch(err => {
  134. if (err.code == 11004) { //未授权抖音
  135. app.globalData.type = 'uc'
  136. tt.navigateTo({
  137. url: '/pages/getuserinfo/getuserinfo?mineFlag=mine',
  138. });
  139. }
  140. })
  141. }
  142. })