抖音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. this.setData({
  44. showPhoem: paramData.detail,
  45. })
  46. tt.showToast({
  47. title: '授权成功', // 内容
  48. icon: 'none', // 图标
  49. success: (res) => {
  50. },
  51. fail: (res) => {
  52. },
  53. });
  54. },
  55. getmemberId: function (token) {
  56. Http.get({
  57. url: config.api.getScore,
  58. data: {
  59. token: token
  60. }
  61. }).then(res => {
  62. if (res.data.avatarUrl || res.data.nickName) {
  63. this.setData({
  64. avatarUrl: res.data.avatarUrl,
  65. nickName: res.data.nickName,
  66. })
  67. }
  68. }).catch(err => {
  69. tt.showModal({
  70. title: '提示',
  71. content: err.message,
  72. showCancel: false
  73. })
  74. })
  75. },
  76. setBox(paramData) {
  77. this.setData({
  78. showPhoem: paramData.detail
  79. })
  80. tt.reLaunch({
  81. url: "/index/index",
  82. success(res) {
  83. console.log(`${res}`);
  84. app.globalData.selected = 0
  85. },
  86. fail(err) {
  87. console.log(`navigateTo调用失败`,err);
  88. },
  89. });
  90. // tt.showToast({
  91. // title: '取消授权', // 内容
  92. // icon: 'none', // 图标
  93. // success: (res) => {
  94. // },
  95. // fail: (res) => {
  96. // },
  97. // });
  98. },
  99. onShow: function (options) {
  100. this.setData({
  101. mouldType:app.globalData.mouldType
  102. })
  103. this.getmemberId()
  104. Http.get({
  105. url: config.api.checkUserStatus,
  106. data: {
  107. token: app.globalData.token
  108. }
  109. }).then(res => {
  110. Http.get({
  111. url: config.api.checkPhoneStatus,
  112. }).then(res => {
  113. this.setData({
  114. text:res.data.phone
  115. })
  116. }).catch(err => {
  117. if(app.globalData.ifCongPh==1){
  118. tt.navigateTo({
  119. url: '/pages/getPhone/getPhone?mineFlag=mine',
  120. });
  121. }else{
  122. this.setData({
  123. showPhoem:true
  124. })
  125. }
  126. })
  127. }).catch(err => {
  128. if (err.code == 11004) {//未授权抖音
  129. app.globalData.type = 'uc'
  130. tt.navigateTo({
  131. url: '/pages/getuserinfo/getuserinfo',
  132. });
  133. }
  134. })
  135. }
  136. })