001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
var config = require('../../utils/config.js')
var mta = require('../../utils/mta_analysis.js')
var utils=require('../../utils/util')
var dataC; // 保存所有城市列表
var allCity; // 保存所有城市列表
var currentProvince; // 滚轮当前指向的省
var currentCity;
var currentArea;
var enterProvince; // 按下确定键后,保存到这里,用于发送请求
var enterCity;
var enterArea;
var remoteAvatar = ''; // 头像路径
var remoteVideo = '';
var remotePics = [];
Page({
data: {
shopName: '',
shopPhone: '',
shopAddress: '',
pics: [],
showOrHide: 'show',
locationStr:"请选择您的城市",
shopIntroduce:"",
nian:'',
yue:'',
ri:''
},
onLoad: function (options) {
var that = this;
var dataC=utils.getData();
console.log(dataC.p[0]);
currentProvince = dataC.p[0];
console.log(currentProvince);
},
onReady: function () {
mta.rptMain();
},
showCityPicker: function () {
if (!currentProvince) {
currentProvince = dataC.p[0];
console.log(currentProvince);
currentCity = dataC.c[currentProvince][0];
currentArea = dataC.a[currentCity][0];
}
this.setData({
showOrHide: 'show',
provinces: dataC.p,
citys: dataC.c[currentProvince],
areas: dataC.a[currentCity]
})
},
scrollProvince: function (e) {
var dY = e.detail.scrollTop;
var a = Math.round(dY / 20); // 移动的整位
currentProvince = dataC.p[a]; // 选中的省
currentCity = dataC.c[currentProvince][0] // 选中的城市
currentArea = dataC.a[currentCity][0]; // 选中的区
this.setData({
citys: dataC.c[currentProvince],
areas: dataC.a[currentCity]
})
},
scrollCity: function (e) {
var dY = e.detail.scrollTop;
var a = Math.round(dY / 20); // 移动的整位
currentCity = dataC.c[currentProvince][a] // 选中的城市
currentArea = dataC.a[currentCity][0]; // 选中的区
this.setData({
areas: dataC.a[currentCity]
})
},
scrollArea: function (e) {
var dY = e.detail.scrollTop;
var a = Math.round(dY / 20); // 移动的整位
currentArea = dataC.a[currentCity][a]; // 选中的区
},
cancelPick: function () {
this.setData({
showOrHide: 'hide'
})
},
enterPick: function () {
enterProvince = currentProvince;
enterCity = currentCity;
enterArea = currentArea;
this.setData({
showOrHide: 'hide',
locationStr: enterProvince + " " + enterCity + " " + enterArea
})
},
formSubmit: function (e) {
var that = this;
// 检查所有参数是否完整
if (!this.data.avatarSrc) {
wx.showToast({
title: '头像不能为空',
duration: 2000
})
}
if (!e.detail.value.shopName) {
wx.showToast({
title: '商铺名称不能为空',
duration: 2000
})
}
if (!e.detail.value.sellerPhone) {
wx.showToast({
title: '手机号不能为空',
duration: 2000
})
}
if (!this.data.locationStr || !e.detail.value.shopAddress) {
wx.showToast({
title: '商铺地址不能为空',
duration: 2000
})
}
if (!e.detail.value.introduction) {
wx.showToast({
title: '介绍不能为空',
duration: 2000
})
}
if (this.data.pics.length < 3) {
wx.showToast({
title: '繁育环境照片最少3张',
duration: 2000
})
}
},
})
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
var utils = require('../../utils/util');
const p = [];//省
const a = [];//市
const c = [];//区,县
var riqi;//日期
var val;//下标
Page({
data: {
boxHide:"box-show",
showBox:"hide-show"
},
onLoad: function (options) {
var dataC = utils.getData();
p.push(dataC.p);//province
a.push(dataC.a);//area
c.push(dataC.c);//city
},
bindChange: function (e) {
val = e.detail.value;
riqi = this.data;
this.setData({
months: c[0][riqi.years[val[0]]],
days: a[0][riqi.months[val[1]]]
})
},
yes: function () {//获取城市信息
if (typeof (riqi) == "undefined") {
this.setData({
nian: "黑龙江省",
yue: "大兴安岭地区",
ri: "塔河县"
})
} else {
this.setData({
nian: this.data.years[val[0]],
yue: this.data.months[val[1]],
ri: this.data.days[val[2]]
})
}
},
cancelPick: function () {
this.setData({
boxHide:"box-show",
showBox:"hide-show"
})
},
enterPick: function () {
console.log(c[0][p[0][0]][0]);
this.setData({
boxHide:"box-hide",
showBox:"show-box",
years: p[0],
months: c[0][p[0][0]],
days: a[0][c[0][p[0][0]][0]]
})
},
enter: function () {
if (typeof (riqi) == "undefined") {
this.setData({
nian: "黑龙江省",
yue: "大兴安岭地区",
ri: "塔河县"
})
} else {
this.setData({
nian: this.data.years[val[0]],
yue: this.data.months[val[1]],
ri: this.data.days[val[2]]
})
}
}
});
|