抖音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.

157 lines
3.1 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. onShow: function (options) {
  101. this.setData({
  102. mouldType:app.globalData.mouldType
  103. })
  104. this.getmemberId()
  105. Http.get({
  106. url: config.api.checkUserStatus,
  107. data: {
  108. token: app.globalData.token
  109. }
  110. }).then(res => {
  111. Http.get({
  112. url: config.api.checkPhoneStatus,
  113. }).then(res => {
  114. this.setData({
  115. text:res.data.phone
  116. })
  117. }).catch(err => {
  118. if(app.globalData.ifCongPh==1){
  119. tt.navigateTo({
  120. url: '/pages/getPhone/getPhone?mineFlag=mine',
  121. });
  122. }else{
  123. this.setData({
  124. showPhoem:true
  125. })
  126. }
  127. })
  128. }).catch(err => {
  129. if (err.code == 11004) {//未授权抖音
  130. app.globalData.type = 'uc'
  131. tt.navigateTo({
  132. url: '/pages/getuserinfo/getuserinfo',
  133. });
  134. }
  135. })
  136. }
  137. })