|
|
|
@ -1,8 +1,13 @@ |
|
|
|
// pages/home/setting/index.js
|
|
|
|
import { finalizeToken } from "../../api/user" |
|
|
|
import { $wuxDialog } from '../../../components/index' |
|
|
|
import { |
|
|
|
postRelation, |
|
|
|
getBaseInfo |
|
|
|
} from '../../api/ztb' |
|
|
|
const event = require('../../../utils/event') |
|
|
|
const storage = require('../../../utils/storage') |
|
|
|
const util = require('../../../utils/util') |
|
|
|
const app = getApp() |
|
|
|
|
|
|
|
Page({ |
|
|
|
@ -12,13 +17,24 @@ Page({ |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
kg: app.globalData.kg, |
|
|
|
version: 2 |
|
|
|
version: 2, |
|
|
|
userInfo: { |
|
|
|
bizUserId:null, |
|
|
|
bizUserName:null |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad: function (options) { |
|
|
|
getBaseInfo().then(res => { |
|
|
|
this.setData({ |
|
|
|
userInfo: res.data, |
|
|
|
bizUserId:res.data.bizUserId, |
|
|
|
bizUserName:res.data.bizUserName, |
|
|
|
}) |
|
|
|
}) |
|
|
|
var pages = getCurrentPages() |
|
|
|
for (let index = 0; index < pages.length; index++) { |
|
|
|
const element = pages[index] |
|
|
|
@ -62,5 +78,38 @@ Page({ |
|
|
|
} |
|
|
|
}] |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
showDialog: function (e1) { |
|
|
|
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') |
|
|
|
var that = this |
|
|
|
var placeholderName = '' |
|
|
|
if (e1.currentTarget.dataset.tag == '业务人员邀请码') { |
|
|
|
placeholderName = that.data.userInfo.bizUserId |
|
|
|
} |
|
|
|
this.wuxDialog.prompt({ |
|
|
|
resetOnClose: true, |
|
|
|
title: e1.currentTarget.dataset.tag, |
|
|
|
placeholder: placeholderName || '请输入' + e1.currentTarget.dataset.tag, |
|
|
|
maxlength: 18, |
|
|
|
onConfirm(e, response) { |
|
|
|
if (util.isEmpty(response)) { |
|
|
|
util.showToast('请输入' + e1.currentTarget.dataset.tag) |
|
|
|
return |
|
|
|
} |
|
|
|
if (e1.currentTarget.dataset.tag == '业务人员邀请码') { |
|
|
|
postRelation(response).then(result => { |
|
|
|
//成功回调
|
|
|
|
wx.hideLoading() |
|
|
|
}).catch(err => { |
|
|
|
//异常回调
|
|
|
|
wx.hideLoading() |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}) |