|
- const app = getApp()
- const navigationBarHeight = (getApp().statusBarHeight + 44) + "px";
- const Http = require("../utils/HttpBasics");
- const config = require("../config/config");
- const imgurl = require("../utils/imgurl");
- Page({
- data: {
- navigationBarHeight,
- showPhoem: false,
- phoemFalg: true,//授权手机标记
- },
- showPhoemBtn() {
- this.setData({
- showPhoem: true
- })
- },
- go(e) {
- if (this.data.phoemFalg) {
- tt.showToast({
- title: '请授权手机号', // 内容
- icon: 'none', // 图标
- success: (res) => {
-
- },
- fail: (res) => {
-
- },
- });
- } else {
- let url = e.currentTarget.dataset.url
- console.log(url);
- if(url=='/pages/order/index/index?id=all'){
- tt.navigateTo({
- url: url,
- success: (res) => {
-
- },
- fail: (res) => {
-
- },
- });
- }else{
- tt.navigateTo({
- url: url, // 指定页面的 url
- success: (res) => {
-
- },
- fail: (res) => {
-
- },
- });
- }
-
- }
-
- },
- setPhone(paramData) {//子组件调用这个方法说明手机号已经授权成功
- this.setData({
- showPhoem: paramData.detail,
- phoemFalg: false
- })
- tt.showToast({
- title: '授权成功', // 内容
- icon: 'none', // 图标
- success: (res) => {
-
- },
- fail: (res) => {
-
- },
- });
- },
-
- setBox(paramData) {
- this.setData({
- showPhoem: paramData.detail
- })
- tt.showToast({
- title: '取消授权', // 内容
- icon: 'none', // 图标
- success: (res) => {
-
- },
- fail: (res) => {
-
- },
- });
- },
- onLoad: function (options) {
- let _this = this
- Http.get({//判断是否授权抖音
- url: config.api.checkPhoneStatus,
-
- }).then(res => {
- this.setData({
- phoemFalg: false
- })
- }).catch(err => {
- console.log(err, "我出错了")
- })
-
-
- tt.getUserInfo({
- withCredentials: true,
- success: function (res) {
- _this.setData({
- userData: res.userInfo
- })
- Http.post({
- url: config.api.getUserInfo,
- data: {
- encryptedData: res.encryptedData,
- iv: res.iv
- }
- }).then(res => {
- }).catch(err => {
- tt.showToast({
- title: err.message ? err.message : err.data,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- },
- fail(res) {
- tt.navigateTo({
- url: 'pages/index/index' // 指定页面的url
- });
- },
- })
- }
- })
|