抖音c端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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