抖音c端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

164 行
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. goSetUserInfo() {
  57. tt.navigateTo({
  58. url: '/pages/getuserinfo/getuserinfo?mineFlag=mine',
  59. });
  60. },
  61. getmemberId: function (token) {
  62. Http.get({
  63. url: config.api.getScore,
  64. data: {
  65. token: token
  66. }
  67. }).then(res => {
  68. if (res.data.avatarUrl || res.data.nickName) {
  69. this.setData({
  70. avatarUrl: res.data.avatarUrl,
  71. nickName: res.data.nickName,
  72. })
  73. }
  74. }).catch(err => {
  75. tt.showModal({
  76. title: '提示',
  77. content: err.message,
  78. showCancel: false
  79. })
  80. })
  81. },
  82. setBox(paramData) {
  83. this.setData({
  84. showPhoem: paramData.detail
  85. })
  86. tt.reLaunch({
  87. url: "/index/index",
  88. success(res) {
  89. console.log(`${res}`);
  90. app.globalData.selected = 0
  91. },
  92. fail(err) {
  93. console.log(`navigateTo调用失败`, err);
  94. },
  95. });
  96. // tt.showToast({
  97. // title: '取消授权', // 内容
  98. // icon: 'none', // 图标
  99. // success: (res) => {
  100. // },
  101. // fail: (res) => {
  102. // },
  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',
  138. });
  139. }
  140. })
  141. }
  142. })