Initial commit
This commit is contained in:
@@ -5,10 +5,12 @@ Page({
|
||||
user: {},
|
||||
isFormOpen: false,
|
||||
isDevtools: false,
|
||||
region: [],
|
||||
formData: {
|
||||
name: '',
|
||||
phone: '',
|
||||
age: '',
|
||||
city: '',
|
||||
company_name: '',
|
||||
position: '',
|
||||
wechat_nickname: '',
|
||||
@@ -17,8 +19,15 @@ Page({
|
||||
},
|
||||
onLoad(options) {
|
||||
try {
|
||||
const sys = wx.getSystemInfoSync()
|
||||
this.setData({ isDevtools: sys.platform === 'devtools' })
|
||||
let isDevtools = false
|
||||
if (wx.getDeviceInfo) {
|
||||
const info = wx.getDeviceInfo()
|
||||
isDevtools = info.platform === 'devtools'
|
||||
} else {
|
||||
const sys = wx.getSystemInfoSync()
|
||||
isDevtools = sys.platform === 'devtools'
|
||||
}
|
||||
this.setData({ isDevtools })
|
||||
} catch (e) {}
|
||||
// 检查是否已登录
|
||||
const app = getApp();
|
||||
@@ -64,10 +73,12 @@ Page({
|
||||
},
|
||||
initFormData(user) {
|
||||
this.setData({
|
||||
region: user.city ? user.city.split(' ') : [],
|
||||
formData: {
|
||||
name: user.name,
|
||||
phone: user.phone,
|
||||
age: user.age,
|
||||
city: user.city,
|
||||
company_name: user.company_name,
|
||||
position: user.position,
|
||||
wechat_nickname: user.wechat_nickname,
|
||||
@@ -86,10 +97,12 @@ Page({
|
||||
.then((data) => {
|
||||
this.setData({
|
||||
user: data,
|
||||
region: data.city ? data.city.split(' ') : [],
|
||||
formData: {
|
||||
name: data.name,
|
||||
phone: data.phone,
|
||||
age: data.age,
|
||||
city: data.city,
|
||||
company_name: data.company_name,
|
||||
position: data.position,
|
||||
wechat_nickname: data.wechat_nickname,
|
||||
@@ -114,6 +127,13 @@ Page({
|
||||
})
|
||||
})
|
||||
},
|
||||
onCityChange(e) {
|
||||
const val = e.detail.value;
|
||||
this.setData({
|
||||
region: val,
|
||||
'formData.city': val.join(' ')
|
||||
});
|
||||
},
|
||||
handleInput(e) {
|
||||
const field = e.currentTarget.dataset.field;
|
||||
const value = e.detail.value;
|
||||
|
||||
Reference in New Issue
Block a user