├── README.md
├── app.js
├── app.json
├── app.wxss
├── images
├── 1.png
├── 2.png
├── 58b91382af5ce.png
├── 58b91382af631.png
├── 58b91382c80c2.png
├── 58b91382c811f.png
├── account.png
├── accountAct.png
├── address.png
├── address2.png
├── arrowdown.png
├── arrowright.png
├── arrowup.png
├── bac.png
├── close.png
├── delete.png
├── edit.png
├── feiji.png
├── phone.png
├── pic1.png
├── pic2.png
├── serPic1.png
├── serPic2.png
├── serPic3.png
├── serPic4.png
├── serPic5.png
├── serPic6.png
├── serPic7.png
├── serPic8.png
├── tel.png
├── telephone.png
├── time.png
└── tipPic.png
├── pages
├── adDetail
│ ├── adDetail.js
│ ├── adDetail.json
│ ├── adDetail.wxml
│ └── adDetail.wxss
├── detail
│ ├── detail.js
│ ├── detail.json
│ ├── detail.wxml
│ └── detail.wxss
├── edit
│ ├── edit.js
│ ├── edit.json
│ ├── edit.wxml
│ └── edit.wxss
├── editDetail
│ ├── editDetail.js
│ ├── editDetail.json
│ ├── editDetail.wxml
│ └── editDetail.wxss
├── index
│ ├── index(1).json
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── my
│ ├── my.js
│ ├── my.json
│ ├── my.wxml
│ └── my.wxss
├── new
│ ├── new.js
│ ├── new.json
│ ├── new.wxml
│ └── new.wxss
└── publish
│ ├── publish.js
│ ├── publish.json
│ ├── publish.wxml
│ ├── publish.wxss
│ └── publishDetail
│ ├── publishDetail.js
│ ├── publishDetail.json
│ ├── publishDetail.wxml
│ └── publishDetail.wxss
├── style
└── weui.wxss
├── utils
├── animation_library.wxss
├── api.js
├── request.js
└── util.js
├── wxParse.zip
└── wxParse
├── html2json.js
├── htmlparser.js
├── showdown.js
├── wxDiscode.js
├── wxParse.js
├── wxParse.wxml
└── wxParse.wxss
/README.md:
--------------------------------------------------------------------------------
1 | #大连同城信息查询_wxapp
2 |
3 | 主要功能
4 |
5 | (1)可发布同城招聘、房屋租赁、家教服务等信息。
6 |
7 | (2)可查看不同区域下的分类信息战死后。
8 |
9 | (3)可发布同城活动公告,商家可发布广告。
10 |
11 | (4)可查看个人已发布信息,并进行修改编辑。
12 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | var WxParse = require('wxParse/wxParse.js');
2 | var util = require('utils/util.js');
3 | var request = require('utils/request.js');
4 | App({
5 | onLaunch: function () {
6 | },
7 | onShareAppMessage: function () {
8 | return {
9 | success: function (res) {
10 | // 分享成功
11 | console.log(res);
12 | },
13 | fail: function (res) {
14 | // 分享失败
15 | console.log(res);
16 | }
17 | }
18 | },
19 | getUserInfo: function () {
20 | var that = this;
21 | wx.login({
22 | success: function (res) {
23 | console.log(res);
24 |
25 |
26 | if (res.code) {
27 | //发起网络请求
28 | request.login(
29 | {
30 | "code": res.code
31 | }, (res) => {
32 |
33 | console.log(res);
34 | var session_id = res.data.session_id;
35 | that.globalData.session_id = res.data.session_id;
36 | wx.getUserInfo({
37 | success: function (res) {
38 | console.log(11111);
39 | console.log(res);
40 |
41 | request.checkLogin(
42 | {
43 | 'iv': res.iv,
44 | 'encryptedData': res.encryptedData,
45 | 'session_id': session_id
46 | }, (res) => {
47 | console.log(res);
48 | }
49 | )
50 | }
51 | })
52 | }
53 | )
54 | } else {
55 | console.log('获取用户登录态失败!' + res.errMsg)
56 | }
57 | }
58 | });
59 | },
60 | globalData: {
61 | }
62 | })
63 |
64 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/detail/detail",
5 | "pages/adDetail/adDetail",
6 | "pages/publish/publish",
7 | "pages/publish/publishDetail/publishDetail",
8 | "pages/new/new",
9 | "pages/my/my",
10 | "pages/edit/edit",
11 | "pages/editDetail/editDetail"
12 | ],
13 | "window": {
14 | "enablePullDownRefresh": false,
15 | "navigationBarBackgroundColor": "#1A93DF",
16 | "navigationBarTextStyle": "white",
17 | "navigationBarTitleText": "大连同城供求信息"
18 | },
19 | "tabBar": {
20 | "borderStyle": "white",
21 | "color": "#999999",
22 | "selectedColor": "#00A7C9",
23 | "backgroundColor": "#FFFFFF",
24 | "list": [
25 | {
26 | "iconPath": "images\/58b91382af5ce.png",
27 | "selectedIconPath": "images\/58b91382af631.png",
28 | "text": "首页",
29 | "pagePath": "pages/index/index"
30 | },
31 | {
32 | "iconPath": "images\/58b91382c80c2.png",
33 | "selectedIconPath": "images\/58b91382c811f.png",
34 | "text": "发布",
35 | "pagePath": "pages/publish/publish"
36 | },
37 | {
38 | "iconPath": "images/account.png",
39 | "selectedIconPath": "images/accountAct.png",
40 | "text": "我的",
41 | "pagePath": "pages/my/my"
42 | }
43 | ]
44 | },
45 | "networkTimeout": {
46 | "request": 10000,
47 | "connectSocket": 10000,
48 | "uploadFile": 10000,
49 | "downloadFile": 10000
50 | },
51 | "debug": false
52 | }
--------------------------------------------------------------------------------
/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/1.png
--------------------------------------------------------------------------------
/images/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/2.png
--------------------------------------------------------------------------------
/images/58b91382af5ce.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/58b91382af5ce.png
--------------------------------------------------------------------------------
/images/58b91382af631.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/58b91382af631.png
--------------------------------------------------------------------------------
/images/58b91382c80c2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/58b91382c80c2.png
--------------------------------------------------------------------------------
/images/58b91382c811f.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/58b91382c811f.png
--------------------------------------------------------------------------------
/images/account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/account.png
--------------------------------------------------------------------------------
/images/accountAct.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/accountAct.png
--------------------------------------------------------------------------------
/images/address.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/address.png
--------------------------------------------------------------------------------
/images/address2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/address2.png
--------------------------------------------------------------------------------
/images/arrowdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/arrowdown.png
--------------------------------------------------------------------------------
/images/arrowright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/arrowright.png
--------------------------------------------------------------------------------
/images/arrowup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/arrowup.png
--------------------------------------------------------------------------------
/images/bac.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/bac.png
--------------------------------------------------------------------------------
/images/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/close.png
--------------------------------------------------------------------------------
/images/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/delete.png
--------------------------------------------------------------------------------
/images/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/edit.png
--------------------------------------------------------------------------------
/images/feiji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/feiji.png
--------------------------------------------------------------------------------
/images/phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/phone.png
--------------------------------------------------------------------------------
/images/pic1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/pic1.png
--------------------------------------------------------------------------------
/images/pic2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/pic2.png
--------------------------------------------------------------------------------
/images/serPic1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic1.png
--------------------------------------------------------------------------------
/images/serPic2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic2.png
--------------------------------------------------------------------------------
/images/serPic3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic3.png
--------------------------------------------------------------------------------
/images/serPic4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic4.png
--------------------------------------------------------------------------------
/images/serPic5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic5.png
--------------------------------------------------------------------------------
/images/serPic6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic6.png
--------------------------------------------------------------------------------
/images/serPic7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic7.png
--------------------------------------------------------------------------------
/images/serPic8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/serPic8.png
--------------------------------------------------------------------------------
/images/tel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/tel.png
--------------------------------------------------------------------------------
/images/telephone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/telephone.png
--------------------------------------------------------------------------------
/images/time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/time.png
--------------------------------------------------------------------------------
/images/tipPic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/images/tipPic.png
--------------------------------------------------------------------------------
/pages/adDetail/adDetail.js:
--------------------------------------------------------------------------------
1 | var WxParse = require('../../wxParse/wxParse.js');
2 | var request = require('../../utils/request.js');
3 | var app = getApp();
4 | var id;
5 | Page({
6 | data: {},
7 | onShareAppMessage: function () {
8 | return {
9 | success: function (res) {
10 | // 分享成功
11 | console.log(res);
12 | },
13 | fail: function (res) {
14 | // 分享失败
15 | console.log(res);
16 | }
17 | }
18 | },
19 | onLoad: function (options) {
20 | // 页面初始化 options为页面跳转所带来的参数
21 | console.log(options);
22 | id = options.id;
23 | var that = this;
24 | var that = this;
25 | request.getBannerDetial(
26 | {
27 | "session_id": app.globalData.session_id,
28 | "id": id
29 | },
30 | (res) => {
31 | console.log(res);
32 | that.setData({
33 | list: res.data
34 | })
35 | var article = res.data.content;
36 | WxParse.wxParse('article', 'html', article, that, 5);
37 | // var title = res.data.title;
38 | // WxParse.wxParse('title', 'html', title, that, 5);
39 | }
40 | )
41 | },
42 | onShow: function () {
43 |
44 | },
45 | })
--------------------------------------------------------------------------------
/pages/adDetail/adDetail.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/adDetail/adDetail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/pages/adDetail/adDetail.wxss:
--------------------------------------------------------------------------------
1 | /* pages/detail/adDetail.wxss */
--------------------------------------------------------------------------------
/pages/detail/detail.js:
--------------------------------------------------------------------------------
1 | var screenHeight, screenWidth, get_type = 0;
2 | var request = require('../../utils/request.js');
3 | var utils = require('../../utils/util.js');
4 | var app = getApp();
5 | var tid,aid;
6 | var page = 1;
7 | var totalList = [];
8 | Page({
9 | data: {
10 | activeIndex: 0,
11 | list: [],
12 | pubBtn:false,
13 | isEmpty:true,
14 | showTipimg:false,
15 | showTipword:false,
16 | showBtn: false,
17 | showbottom: false,
18 | showCountry: true,
19 | descript:'',
20 | tipWord:'',
21 | lat: '',
22 | lng: '',
23 | },
24 | onShareAppMessage: function () {
25 | return {
26 | success: function (res) {
27 | // 分享成功
28 | console.log(res);
29 | },
30 | fail: function (res) {
31 | // 分享失败
32 | console.log(res);
33 | }
34 | }
35 | },
36 | //获取设备信息,屏幕的高度宽度
37 | onLoad: function (options) {
38 | wx.getSystemInfo({
39 | success: function (res) {
40 | screenHeight = res.windowHeight;
41 | screenWidth = res.windowWidth;
42 | }
43 | });
44 | tid = options.id;
45 | aid = options.aid;
46 |
47 | var that = this;
48 | request.getArea(
49 | { "session_id": app.globalData.session_id },
50 | (res) => {
51 | that.setData({
52 | area: res.data
53 | })
54 | }
55 | ),
56 | request.getTypes(
57 | {
58 | "session_id": app.globalData.session_id,
59 | "id": tid
60 | },
61 | (res) => {
62 | //设置title
63 | wx.setNavigationBarTitle({
64 | title: res.data.tname
65 | })
66 | }
67 | )
68 | request.getUserTypeList(
69 | {
70 | "session_id": app.globalData.session_id,
71 | "tid": tid,
72 | "aid": aid,
73 | "p": page,
74 | },
75 | (res) => {
76 | console.log(res);
77 |
78 | that.setData({
79 | list: res.data.data,
80 | activeIndex:aid
81 | })
82 |
83 | if (res.data.code == "203") {
84 | that.setData({
85 | tipWord: res.data.msg,
86 | showTipimg: true,
87 | showTipword: true,
88 | showbottom: false,
89 | showBtn: true,
90 | showCountry: true,
91 | })
92 | }
93 | },
94 | )
95 | },
96 | onShow: function () {
97 | // 页面显示
98 | var that = this;
99 | this.setData({
100 | itemWidth: '180rpx'
101 | });
102 | request.getUserTypeList(
103 | {
104 | "session_id": app.globalData.session_id,
105 | "tid": tid,
106 | "aid": aid,
107 | "p": page,
108 | },
109 | (res) => {
110 | console.log(res);
111 |
112 | that.setData({
113 | list: res.data.data,
114 | activeIndex: aid
115 | })
116 |
117 | if (res.data.code == "203") {
118 | that.setData({
119 | tipWord: res.data.msg,
120 | showTipimg: true,
121 | showTipword: true,
122 | showbottom: false,
123 | showBtn: true,
124 | showCountry: true,
125 | })
126 | }
127 | })
128 | },
129 | //下拉刷新
130 | onPullDownRefresh: function () {
131 | var that = this;
132 | that.setData({
133 | list: [],
134 | showCountry: false
135 | })
136 | request.getUserTypeList(
137 | {
138 | "session_id": app.globalData.session_id,
139 | "tid": tid,
140 | "aid": that.data.activeIndex,
141 | },
142 | (res) => {
143 | console.log(res);
144 | that.setData({
145 | list: res.data.data,
146 | showCountry:true
147 | })
148 | wx.stopPullDownRefresh(); //停止下拉刷新
149 | },
150 | )
151 |
152 | },
153 |
154 | //上拉加载
155 | onReachBottom: function () {
156 | var that = this;
157 | page += 1;
158 | //(5)判断是不是第一次进来
159 | if (page > 1) {//不是第一次
160 | //非第一次进入
161 |
162 | request.getUserTypeList(
163 | {
164 | "session_id": app.globalData.session_id,
165 | "tid": tid,
166 | "aid": that.data.activeIndex,
167 | "p":page,
168 | },
169 | (res) => {
170 | console.log(res.data);
171 | totalList = that.data.list.concat(res.data.data);
172 | that.setData({
173 | list: totalList
174 | })
175 | //没有数据203
176 | if (res.data.code == "203") {
177 | that.setData({
178 | tipWord: res.data.msg,
179 | showTipimg:true,
180 | showTipword: true,
181 | showbottom: false,
182 | showBtn: true,
183 | showCountry: true,
184 | })
185 | }
186 | //没有更多
187 | if (res.data.code == "202"){
188 | that.setData({
189 | tipWord: res.data.msg,
190 | showTipimg: false,
191 | showTipword: true,
192 | showBtn: false,
193 | showbottom: false,
194 | showCountry: true,
195 | })
196 |
197 | }
198 |
199 | },
200 | )
201 | }
202 |
203 |
204 | },
205 | //地区切换
206 | tabChange: function (e) {
207 | var that = this;
208 | that.setData({
209 | tipWord: "",
210 | showTipimg: false,
211 | showTipword: false,
212 | showBtn: false,
213 | })
214 | get_type = e.currentTarget.dataset.index;
215 | this.setData({
216 | activeIndex: get_type
217 | });
218 | request.getUserTypeList(
219 | {
220 | "session_id": app.globalData.session_id,
221 | "tid": tid,
222 | "aid": that.data.activeIndex,
223 | },
224 | (res) => {
225 | console.log(res);
226 | that.setData({
227 | list: res.data.data
228 | })
229 | if (res.data.code == "203") {
230 | that.setData({
231 | tipWord: res.data.msg,
232 | showTipimg: true,
233 | showTipword: true,
234 | showBtn: true,
235 | showCountry: true,
236 | })
237 | }
238 | },
239 | )
240 | },
241 | //拨打电话
242 | goPhone: function (e) {
243 | wx.makePhoneCall({
244 | phoneNumber: e.currentTarget.dataset.phone
245 | })
246 | },
247 | //打开图片
248 | showPic: function (e) {
249 | var a = [];
250 |
251 | for (let i = 0; i < e.currentTarget.dataset.allpic.length; i++) {
252 | a[i] = e.currentTarget.dataset.ip + e.currentTarget.dataset.allpic[i].logo;
253 | // console.log(a[i]);
254 | }
255 | wx.previewImage({
256 | current: e.currentTarget.dataset.pic, // 当前显示图片的http链接
257 | urls: a// 需要预览的图片http链接列表
258 | })
259 | },
260 | //打开地图
261 | showMap:function(e){
262 | wx.getLocation({
263 | type: 'gcj02', //返回可以用于wx.openLocation的经纬度
264 | success: function (res) {
265 | console.log(res);
266 | console.log(e.target.dataset.lat);
267 | console.log(e.target.dataset.lng);
268 | wx.openLocation({
269 | latitude: parseFloat(e.target.dataset.lat),
270 | longitude: parseFloat(e.target.dataset.lng),
271 | scale: 28
272 | })
273 | }
274 | })
275 | },
276 | //跳转到发布页
277 | goPub:function(){
278 | wx.switchTab({
279 | url: '../publish/publish',
280 | })
281 | }
282 | })
283 |
--------------------------------------------------------------------------------
/pages/detail/detail.json:
--------------------------------------------------------------------------------
1 | {
2 | "enablePullDownRefresh": true
3 | }
--------------------------------------------------------------------------------
/pages/detail/detail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | {{item.nickname}}
21 |
22 |
23 |
24 | {{item.area}}
25 | {{item.money}}
26 |
27 |
28 | [{{item.dd}}]
29 | {{item.descript}}
30 |
31 |
32 | {{item.descript}}
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | {{item.addtime}}
42 |
43 | {{item.address}}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | {{tipWord}}
59 |
60 |
61 |
62 |
63 |
64 |
65 | 小号科技提供技术支持
66 |
67 | http://xiaohao.51cptj.com/
68 |
69 |
70 |
--------------------------------------------------------------------------------
/pages/detail/detail.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: rgb(229, 229, 229);
3 | margin-left: auto;
4 | }
5 |
6 | .float-action {
7 | /*position: absolute;
8 | bottom: 20px;
9 | right: 30px;
10 | width: 50px;
11 | height: 50px;
12 | border-radius: 50%;
13 | box-shadow: 2px 2px 10px #AAA;
14 | background: #1891D4;
15 | z-index: 100;*/
16 | }
17 |
18 | .select-location {
19 | width: 100rpx;
20 | height: 100rpx;
21 | border-radius: 20rpx;
22 | background: #1296db;
23 | position: fixed;
24 | right: 30rpx;
25 | bottom: 20rpx;
26 | line-height: 1;
27 | z-index: 10000;
28 | box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
29 | }
30 |
31 | .body {
32 | width: 750rpx;
33 | position: absolute;
34 | z-index: 1;
35 | }
36 |
37 | .select-location image {
38 | height: 80rpx;
39 | width: 80rpx;
40 | margin-top: 10rpx;
41 | margin-left: 10rpx;
42 | }
43 |
44 | .place {
45 | width: 300rpx;
46 | overflow: hidden;
47 | text-overflow: ellipsis;
48 | white-space: nowrap;
49 | word-wrap: normal;
50 | word-wrap: break-word;
51 | word-break: break-all;
52 | }
53 |
54 | .xscroll_bar {
55 | overflow-y:hidden;
56 | height:88rpx;
57 | line-height:80rpx;
58 | white-space:nowrap;
59 | display:flex;
60 | background:#fff;
61 | position:fixed;
62 | z-index:300;
63 | top: 0;
64 | }
65 |
66 | ::-webkit-scrollbar {
67 | width: 0;
68 | height: 0;
69 | color: transparent;
70 | }
71 |
72 | .menu_item {
73 | text-align: center;
74 | font-size: 30rpx;
75 | color: #7c7c7c;
76 | display: inline-block;
77 | border-bottom: 8rpx solid #fff;
78 | }
79 |
80 |
81 | /*目前暂时不支持伪类,边距的去除只能动态判断*/
82 |
83 | .xscroll_bar .active {
84 | color: #1296db;
85 | /*background: #1296db;*/
86 | border-bottom: 8rpx solid #1296db !important;
87 | }
88 | .con{
89 | position:absolute;
90 | z-index:200;
91 | margin-top:98rpx;
92 | left:0;
93 | right:0;
94 |
95 | }
96 |
97 | /*list样式*/
98 | .detail{
99 | display:flex;
100 | padding:10rpx 20rpx;
101 | margin-top:10rpx;
102 | background:#fff;
103 | position:relative;
104 | z-index:300;
105 |
106 | }
107 | .user_icon{
108 | width: 80rpx;
109 | text-align:center;
110 | margin-right:10rpx;
111 | }
112 | .user{
113 | margin-top:10rpx;
114 | width: 100rpx;
115 | text-align: center;
116 | }
117 | .user_logo {
118 | width: 50rpx;
119 | height: 50rpx;
120 | vertical-align: middle;
121 | border-radius: 50%;
122 | display: block;
123 | margin:0 auto;
124 | }
125 | .user_name {
126 | display: inline-block;
127 | line-height: 30rpx;
128 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
129 | font-size: 22rpx;
130 | color:rgb(178, 178, 178);
131 | }
132 | .user_detail{
133 | flex: 1;
134 | }
135 | .user_detail_top{
136 | /*margin-top:40rpx;*/
137 | }
138 | .user_job{
139 | line-height: 30rpx;
140 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
141 | font-size: 28rpx;
142 | color:rgb(0, 0, 0);
143 | font-weight: bold;
144 | }
145 | .user_money{
146 | float: right;
147 | margin-right: 30rpx;
148 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
149 | font-size: 30rpx;
150 | color:rgb(255, 162, 0);
151 | }
152 | .user_detail_info text{
153 | line-height: 30rpx;
154 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
155 | font-size: 26rpx;
156 | color:rgb(96, 96, 96);
157 | }
158 | .user_detail_pic{
159 | width: 620rpx;
160 | margin-top: 24rpx;
161 | }
162 | .detail_pic {
163 | height: 150rpx;
164 | width: 200rpx;
165 | margin-right: 5rpx;
166 | }
167 | .detail_addr{
168 | font-weight: bold;
169 | margin-right: 5rpx;
170 | }
171 | .addr_date{
172 | line-height: 24rpx;
173 | height: 24rpx;
174 | margin-left: 10rpx;
175 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
176 | font-size: 24rpx;
177 | color:rgb(178, 178, 178);
178 | }
179 | .addr_info{
180 | line-height: 24rpx;
181 | height: 24rpx;
182 | margin-left: 10rpx;
183 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
184 | font-size: 24rpx;
185 | color:rgb(178, 178, 178);
186 | }
187 | .phone_button {
188 | display: inline-block;
189 | float: right;
190 | color: #d81e06;
191 | margin-right: 30rpx;
192 | border-radius: 10rpx;
193 | }
194 |
195 | .phone_pic {
196 | height: 60rpx;
197 | width: 60rpx;
198 | vertical-align: middle;
199 | }
200 |
201 | .addr_time,.addr_icon{
202 | width: 23rpx;
203 | height: 23rpx;
204 | vertical-align: middle;
205 | }
206 | .addr_icon{
207 | margin-left: 40rpx;
208 | }
209 |
210 | /*发布按钮样式*/
211 | .pub_btn{
212 | /*background:#efeff4;*/
213 | /*position:absolute;*/
214 | width:100%;
215 | top: 0;
216 | height: auto;
217 | }
218 | .pub_btn button{
219 | /*position:fixed;*/
220 | width:35%;
221 | margin:0 auto;
222 | left:0;
223 | right:0;
224 | border-radius:0;
225 | background:#1EADCB;
226 | color:#ffffff;
227 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
228 | font-size:28rpx;
229 |
230 | }
231 | .tipbox{
232 | padding-top:240rpx;
233 | }
234 | .tipimg{
235 | text-align: center;
236 | }
237 | .tipimg image{
238 | width: 200rpx;
239 | height: 200rpx;
240 | display: inline-block;
241 | margin-left:28rpx;
242 |
243 | }
244 | .tipBottom{
245 |
246 | color:rgb(136, 136, 136);
247 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
248 | font-size:28rpx;
249 | text-align:center;
250 | background:#E5E5E5;
251 | padding:10rpx 20rpx;
252 | position:relative;
253 | z-index:300;
254 | height:100rpx;
255 | }
256 | .tipBottom2{
257 | background:transparent;
258 | position:relative;
259 | z-index:300;
260 | height:130rpx;
261 | /*bottom:284rpx;*/
262 |
263 | }
264 | .about_bottom{
265 | position: fixed;
266 | bottom: 32rpx;
267 | text-align: center;
268 | margin: 0 auto;
269 | width: 100%;
270 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
271 | font-size: 26rpx;
272 | color:rgb(169, 169, 169);
273 | z-index:100;
274 |
275 | }
--------------------------------------------------------------------------------
/pages/edit/edit.js:
--------------------------------------------------------------------------------
1 | // pages/edit/edit.js
2 | var request = require('../../utils/request.js');
3 | var app = getApp();
4 | Page({
5 | data: {
6 | list: []
7 | },
8 | onShareAppMessage: function () {
9 | return {
10 | success: function (res) {
11 | // 分享成功
12 | console.log(res);
13 | },
14 | fail: function (res) {
15 | // 分享失败
16 | console.log(res);
17 | }
18 | }
19 | },
20 | onLoad: function (options) {
21 | // 页面初始化 options为页面跳转所带来的参数
22 | var that = this;
23 | request.getUserList(
24 | {
25 | "session_id": app.globalData.session_id,
26 | },
27 | (res) => {
28 | console.log(res);
29 | that.setData({
30 | list: res.data.data
31 | })
32 | },
33 | )
34 | },
35 | onReady: function () {
36 | // 页面渲染完成
37 | },
38 | onShow: function () {
39 | // 页面显示
40 | },
41 | onHide: function () {
42 | // 页面隐藏
43 | },
44 | onUnload: function () {
45 | // 页面关闭
46 | },
47 |
48 | //删除一条数据
49 | del: function (e) {
50 | var that = this;
51 | console.log(e.currentTarget.dataset.id);
52 | wx.showModal({
53 | title: '提示',
54 | content: '确定删除?删除后将无法找回',
55 | success: function (res) {
56 | if (res.confirm) {
57 | request.noticeDel(
58 | {
59 | "session_id": app.globalData.session_id,
60 | "id": e.currentTarget.dataset.id
61 | },
62 | (res) => {
63 | console.log(res);
64 | request.getUserList(
65 | {
66 | "session_id": app.globalData.session_id,
67 | },
68 | (res) => {
69 | console.log(res);
70 | that.setData({
71 | list: res.data.data
72 | })
73 | },
74 | )
75 | },
76 | )
77 | } else if (res.cancel) {
78 | console.log('用户点击取消')
79 | }
80 | }
81 | })
82 | },
83 | //编辑数据
84 | edit:function(e){
85 | var that = this;
86 | var editId = e.currentTarget.dataset.id;
87 | wx.navigateTo({
88 | url: '../editDetail/editDetail?editId=' + editId
89 | })
90 |
91 | },
92 |
93 | goPhone: function (e) {
94 | // console.log(e.currentTarget.dataset.phone);
95 | wx.makePhoneCall({
96 | phoneNumber: e.currentTarget.dataset.phone
97 | })
98 | },
99 | showPic: function (e) {
100 | var a = [];
101 | for (let i = 0; i < e.currentTarget.dataset.allpic.length; i++) {
102 | a[i] = e.currentTarget.dataset.ip + e.currentTarget.dataset.allpic[i].logo;
103 | // console.log(a[i]);
104 | }
105 | wx.previewImage({
106 | current: e.currentTarget.dataset.pic, // 当前显示图片的http链接
107 | urls: a// 需要预览的图片http链接列表
108 | })
109 | }
110 | })
--------------------------------------------------------------------------------
/pages/edit/edit.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/edit/edit.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{item.nickname}}
9 |
10 |
11 |
12 | {{item.area}}
13 | {{item.money}}
14 |
15 |
16 | {{item.descript}}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | {{item.addtime}}
26 |
27 | {{item.address}}
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/pages/edit/edit.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: rgb(229, 229, 229);
3 | margin-left: auto;
4 | }
5 |
6 | .float-action {
7 | /*position: absolute;
8 | bottom: 20px;
9 | right: 30px;
10 | width: 50px;
11 | height: 50px;
12 | border-radius: 50%;
13 | box-shadow: 2px 2px 10px #AAA;
14 | background: #1891D4;
15 | z-index: 100;*/
16 | }
17 |
18 | .select-location {
19 | width: 100rpx;
20 | height: 100rpx;
21 | border-radius: 20rpx;
22 | background: #1296db;
23 | position: fixed;
24 | right: 30rpx;
25 | bottom: 20rpx;
26 | line-height: 1;
27 | z-index: 10000;
28 | box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
29 | }
30 |
31 | .body {
32 | width: 750rpx;
33 | position: absolute;
34 | z-index: 1;
35 | }
36 |
37 | .select-location image {
38 | height: 80rpx;
39 | width: 80rpx;
40 | margin-top: 10rpx;
41 | margin-left: 10rpx;
42 | }
43 |
44 | .place {
45 | width: 300rpx;
46 | overflow: hidden;
47 | text-overflow: ellipsis;
48 | white-space: nowrap;
49 | word-wrap: normal;
50 | word-wrap: break-word;
51 | word-break: break-all;
52 | }
53 |
54 | .xscroll_bar {
55 | overflow-y: hidden;
56 | height: 88rpx;
57 | line-height: 80rpx;
58 | white-space: nowrap;
59 | display: flex;
60 | background: #fff;
61 | /*border-bottom: 1rpx solid #bbb;*/
62 | }
63 |
64 | ::-webkit-scrollbar {
65 | width: 0;
66 | height: 0;
67 | color: transparent;
68 | }
69 |
70 | .menu_item {
71 | text-align: center;
72 | font-size: 30rpx;
73 | color: #7c7c7c;
74 | display: inline-block;
75 | border-bottom: 8rpx solid #fff;
76 | }
77 |
78 | .menu_item_border {
79 | /*border-left: 1rpx solid #1296db;*/
80 | }
81 |
82 | /*目前暂时不支持伪类,边距的去除只能动态判断*/
83 |
84 | .xscroll_bar .active {
85 | color: #1296db;
86 | /*background: #1296db;*/
87 | border-bottom: 8rpx solid #1296db !important;
88 | }
89 |
90 | /*list样式*/
91 | .detail{
92 | display: flex;
93 | padding: 10rpx 20rpx;
94 | margin-top: 10rpx;
95 | background: #fff;
96 | }
97 | .user_icon{
98 | width: 80rpx;
99 | text-align:center;
100 |
101 | }
102 | .user{
103 | margin-top:10rpx;
104 | width: 100rpx;
105 | text-align: center;
106 | }
107 | .user_logo {
108 | width: 50rpx;
109 | height: 50rpx;
110 | vertical-align: middle;
111 | border-radius: 50%;
112 | display: block;
113 | margin:0 auto;
114 |
115 | }
116 | .user_name {
117 | display: inline-block;
118 | line-height: 30rpx;
119 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
120 | font-size: 22rpx;
121 | color:rgb(178, 178, 178);
122 | }
123 | .user_detail{
124 | flex: 1;
125 | }
126 | .user_detail_top{
127 | /*margin-top:40rpx;*/
128 | }
129 | .user_job{
130 | line-height: 30rpx;
131 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
132 | font-size: 28rpx;
133 | color:rgb(0, 0, 0);
134 | font-weight: bold;
135 | }
136 | .user_money{
137 | float: right;
138 | margin-right: 30rpx;
139 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
140 | font-size: 30rpx;
141 | color:rgb(255, 162, 0);
142 | }
143 | .user_detail_info text{
144 | line-height: 30rpx;
145 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
146 | font-size: 26rpx;
147 | color:rgb(96, 96, 96);
148 | }
149 | .user_detail_pic{
150 | width: 620rpx;
151 | margin-top: 24rpx;
152 | }
153 | .detail_pic {
154 | height: 150rpx;
155 | width: 200rpx;
156 | margin-right: 5rpx;
157 | }
158 | .addr_date{
159 | line-height: 24rpx;
160 | height: 24rpx;
161 | margin-left: 10rpx;
162 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
163 | font-size: 24rpx;
164 | color:rgb(178, 178, 178);
165 | }
166 | .addr_info{
167 | line-height: 24rpx;
168 | height: 24rpx;
169 | margin-left: 10rpx;
170 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
171 | font-size: 24rpx;
172 | color:rgb(178, 178, 178);
173 | }
174 | .phone_button {
175 | display: inline-block;
176 | color: #d81e06;
177 | margin-right: 10rpx;
178 | border-radius: 10rpx;
179 | float: right;
180 | }
181 |
182 | .phone_pic {
183 | height: 44rpx;
184 | width: 44rpx;
185 | vertical-align: middle;
186 | }
187 |
188 | .addr_time,.addr_icon{
189 | width: 23rpx;
190 | height: 23rpx;
191 | vertical-align: middle;
192 | }
193 | .addr_icon{
194 | margin-left: 10rpx;
195 | }
196 |
197 |
--------------------------------------------------------------------------------
/pages/editDetail/editDetail.js:
--------------------------------------------------------------------------------
1 | // pages/publish/publish.js
2 | var request = require('../../utils/request.js');
3 | var app = getApp();
4 | var tid, aid, area,dd, money, descript, phone, pic = 0;
5 | Page({
6 | data: {
7 | firsrCart: "发布类目",
8 | firsrArea: "发布区域",
9 | showCart: true,
10 | showArea: false,
11 | selectCart: true,
12 | cartChoice: false,
13 | selectArea: false,
14 | showDetail: false,
15 | showMoneyBox: true,
16 | showAreaBox: false,
17 | // 选择地址
18 | address: '',
19 | lat: '',
20 | lng: '',
21 | //发布详情页的数据
22 | imageList: [],
23 | cartid: 1,
24 | areaid: 1,
25 | showInfo: {},
26 | uploadPicBtn: true,
27 | spzz: {
28 | "area": "商铺名称:",
29 | "areaPlaceholder": "(如:湾南里小区便民服务店)",
30 | "money": '商铺租金:',
31 | "moneyPlaceholder": "(如:2000元/月)",
32 | "descript": '商铺描述:',
33 | "descriptPlaceholder": "(如:湾南里小区底商,80平,煤气/燃气、暖气、厨房、卫生间。)",
34 | "phonePlaceholder": "请输入联系电话",
35 | "phone": "联系电话"
36 | },
37 | fwcs: {
38 | "area": "房屋名称:",
39 | "areaPlaceholder": "(如:湾南里小区 三居室 98平米)",
40 | "money": '房屋售价:',
41 | "moneyPlaceholder": "(如:200万)",
42 | "descript": '房屋描述:',
43 | "descriptPlaceholder": "(如:120平米,3室2厅1卫,简单装修,5楼电梯)",
44 | "phonePlaceholder": "请输入联系电话",
45 | "phone": "联系电话"
46 | },
47 | zp: {
48 | "area": "招聘职位:",
49 | "areaPlaceholder": "(如:保姆)",
50 | "money": '职位工资:',
51 | "moneyPlaceholder": "(如:50000元/月)",
52 | "areabox": "招聘地点:",
53 | "areaboxPlaceholder": "(如:湾南里小区)",
54 | "descript": '职位描述:',
55 | "descriptPlaceholder": "(如:需有高等教育背景,为人细心,有相关经验,薪资可议)",
56 | "phonePlaceholder": "请输入联系电话",
57 | "phone": "联系电话"
58 | },
59 | ncp: {
60 | "area": "产品名称:",
61 | "areaPlaceholder": "(如:小麦1000斤)",
62 | "money": '产品售价:',
63 | "moneyPlaceholder": "(如:20元/斤)",
64 | "descript": '详细描述',
65 | "descriptPlaceholder": "(如:请输入农产品信息等。举例:通货水分12分以内,容量780左右,杂志6%以内)",
66 | "phonePlaceholder": "请输入联系电话",
67 | "phone": "联系电话"
68 | },
69 | fwcz: {
70 | "area": "小区名称:",
71 | "areaPlaceholder": "(如:湾南里小区)",
72 | "money": '房屋租金:',
73 | "moneyPlaceholder": "(如:2000元/月)",
74 | "descript": '房屋描述',
75 | "descriptPlaceholder": "(如:三室一厅,押一付三,5层/12层,精装修,可小刀)",
76 | "phonePlaceholder": "请输入联系电话",
77 | "phone": "联系电话"
78 | },
79 | eswp: {
80 | "area": "物品名称:",
81 | "areaPlaceholder": "(如:9成新iPhone7)",
82 | "money": '物品售价:',
83 | "moneyPlaceholder": "(如:6000元)",
84 | "descript": '物品描述:',
85 | "descriptPlaceholder": "(如:亮黑色,128G,去年十月份入手,无刮痕,国行,保修期到今年十二月份。配件齐全。有发票。当面交易,可小刀)",
86 | "phonePlaceholder": "请输入联系电话",
87 | "phone": "联系电话"
88 | },
89 | jyfd: {
90 | "area": "辅导科目",
91 | "areaPlaceholder": "(如:数学1对1专业辅导)",
92 | "money": '收费标准:',
93 | "moneyPlaceholder": "(如:60元/课时)",
94 | "descript": '详细描述',
95 | "descriptPlaceholder": "(如:专业的数学培训,多年教学辅导经验。学生参加奥数竞赛获得优异成绩。只接受晚上一对一辅导,每次两个课时,20课时起报。)",
96 | "phonePlaceholder": "请输入联系电话",
97 | "phone": "联系电话"
98 | },
99 | zhxx: {
100 | "area": "信息标题:",
101 | "areaPlaceholder": "(如:专业疏通下水道)",
102 | "descript": '信息描述:',
103 | "descriptPlaceholder": "(如:常年从事疏通下水道工作,非常专业,上门服务,疏通不成功不收取任何费用。)",
104 | "phonePlaceholder": "请输入联系电话",
105 | "phone": "联系电话"
106 | },
107 | },
108 | //分享功能的实现
109 | onShareAppMessage: function () {
110 | return {
111 | success: function (res) {
112 | // 分享成功
113 | console.log(res);
114 | },
115 | fail: function (res) {
116 | // 分享失败
117 | console.log(res);
118 | }
119 | }
120 | },
121 |
122 | //点击类目
123 | clickCart: function () {
124 | var showCart = this.data.showCart;
125 | if (showCart == true) {
126 | this.setData({
127 | cartChoice: true,
128 | selectCart: false,
129 | showCart: false,
130 | showDetail: false,
131 | })
132 | } else {
133 | this.setData({
134 | cartChoice: false,
135 | selectCart: true,
136 | showCart: true,
137 | showArea: false,
138 | showDetail: false,
139 | })
140 | }
141 | },
142 | //点击切换类目
143 | cartSelect: function (e) {
144 |
145 | this.setData({
146 | firsrCart: e.target.dataset.cart,
147 | showCart: false,
148 | selectCart: false,
149 | showArea: true,
150 | cartid: e.currentTarget.dataset.id,
151 | num1: e.currentTarget.dataset.id
152 | })
153 |
154 | },
155 | //点击选择区域
156 | clickArea: function () {
157 | var showArea = this.data.showArea;
158 | if (showArea == true) {
159 | this.setData({
160 | areaChoice: true,
161 | selectArea: false,
162 | showArea: false,
163 | showDetail: false,
164 | })
165 | } else {
166 | this.setData({
167 | areaChoice: false,
168 | selectArea: true,
169 | showCart: false,
170 | showArea: true,
171 | showDetail: false,
172 | })
173 | }
174 | },
175 | //点击切换区域
176 | areaSelect: function (e) {
177 | this.setData({
178 | firsrArea: e.target.dataset.area,
179 | showArea: false,
180 | selectArea: false,
181 | areaid: e.currentTarget.dataset.id,
182 | //----------显示面板
183 | showDetail: true,
184 | num2: e.currentTarget.dataset.id
185 | })
186 |
187 | //选择数据
188 | var that = this;
189 | switch (that.data.cartid) {
190 | case '1':
191 | that.setData({
192 | showMoneyBox: true,
193 | showAreaBox: false,
194 | showInfo: that.data.spzz
195 | })
196 | break;
197 | case '2':
198 | that.setData({
199 | showMoneyBox: true,
200 | showAreaBox: false,
201 | showInfo: that.data.fwcs
202 | })
203 | break;
204 | case '3':
205 | that.setData({
206 | showMoneyBox: true,
207 | showAreaBox: true,
208 | showInfo: that.data.zp
209 | })
210 | break;
211 | case '4':
212 | that.setData({
213 | showMoneyBox: true,
214 | showAreaBox: false,
215 | showInfo: that.data.ncp
216 | })
217 | break;
218 | case '5':
219 | that.setData({
220 | showMoneyBox: true,
221 | showAreaBox: false,
222 | showInfo: that.data.fwcz
223 | })
224 | break;
225 | case '6':
226 | that.setData({
227 | showMoneyBox: true,
228 | showAreaBox: false,
229 | showInfo: that.data.eswp
230 | })
231 | break;
232 | case '7':
233 | that.setData({
234 | showMoneyBox: true,
235 | showAreaBox: false,
236 | showInfo: that.data.jyfd
237 | })
238 | break;
239 | case '8':
240 | that.setData({
241 | showMoneyBox: false,
242 | showAreaBox: false,
243 | showInfo: that.data.zhxx
244 | })
245 | break;
246 | }
247 |
248 | },
249 |
250 | onLoad: function (options) {
251 | // 页面初始化 options为页面跳转所带来的参数
252 |
253 | console.log(options.editId);
254 | this.setData({
255 | pid: options.editId
256 | })
257 |
258 | // 获取类目列表
259 | var that = this;
260 | request.getType(
261 | { "session_id": app.globalData.session_id },
262 | (res) => {
263 | console.log(res.data);
264 | that.setData({
265 | list: res.data
266 | })
267 |
268 | },
269 | ),
270 | //获取区域列表
271 | request.getArea(
272 | {//"tid": this.data.cartid
273 | },
274 | (res) => {
275 | console.log(res.data);
276 | that.setData({
277 | areaList: res.data
278 | })
279 |
280 | },
281 | //获取当前的订单的发布信息
282 | request.getUserListOne(
283 | { "session_id": app.globalData.session_id,
284 | "id": options.editId
285 | },
286 | (res) => {
287 | console.log(res.data);
288 |
289 | that.setData({
290 | listInfo: res.data,
291 | cartid: res.data.tid,
292 | areaid: res.data.aid,
293 | firsrCart: res.data.tname,
294 | firsrArea: res.data.aname,
295 | address: res.data.address,
296 | dd:res.data.dd,
297 | showCart: false,
298 | showArea: false,
299 | selectCart: false,
300 | cartChoice: false,
301 | selectArea: false,
302 | showDetail: true,
303 | optionsId: options.editId,
304 | piclist: res.data.piclist,
305 | web_server: res.data.web_server
306 | })
307 |
308 | switch (res.data.tid) {
309 | case '1':
310 | that.setData({
311 | showMoneyBox: true,
312 | showAreaBox: false,
313 | showInfo: that.data.spzz
314 | })
315 | break;
316 | case '2':
317 | that.setData({
318 | showMoneyBox: true,
319 | showAreaBox: false,
320 | showInfo: that.data.fwcs
321 | })
322 | break;
323 | case '3':
324 | that.setData({
325 | showMoneyBox: true,
326 | showAreaBox: true,
327 | showInfo: that.data.zp
328 | })
329 | break;
330 | case '4':
331 | that.setData({
332 | showMoneyBox: true,
333 | showAreaBox: false,
334 | showInfo: that.data.ncp
335 | })
336 | break;
337 | case '5':
338 | that.setData({
339 | showMoneyBox: true,
340 | showAreaBox: false,
341 | showInfo: that.data.fwcz
342 | })
343 | break;
344 | case '6':
345 | that.setData({
346 | showMoneyBox: true,
347 | showAreaBox: false,
348 | showInfo: that.data.eswp
349 | })
350 | break;
351 | case '7':
352 | that.setData({
353 | showMoneyBox: true,
354 | showAreaBox: false,
355 | showInfo: that.data.jyfd
356 | })
357 | break;
358 | case '8':
359 | that.setData({
360 | showMoneyBox: false,
361 | showAreaBox: false,
362 | showInfo: that.data.zhxx
363 | })
364 | break;
365 | }
366 | if (res.data.piclist != null && res.data.piclist !=""){
367 | console.log(res.data.piclist);
368 | if (res.data.piclist.length >= 9) {
369 | that.setData({
370 | uploadPicBtn: false
371 | })
372 | }
373 | }
374 | },
375 | ),
376 |
377 |
378 | )
379 | },
380 | onReady: function () {
381 | // 页面渲染完成
382 | },
383 | onShow: function () {
384 | },
385 | onHide: function () {
386 | // 页面隐藏
387 | },
388 | onUnload: function () {
389 | // 页面关闭
390 | },
391 |
392 | // 选择照片
393 | chooseImage: function () {
394 | var that = this;
395 | var tempCount = 8 - (that.data.imageList.length + that.data.piclist.length);
396 | if (tempCount < 1) {
397 | that.setData({
398 | uploadPicBtn: false
399 | })
400 | }
401 | wx.chooseImage({
402 | count: tempCount,
403 | sizeType: 'compressed',
404 | success: function (res) {
405 | console.log(res);
406 | console.log(tempCount);
407 | var tempImageList = that.data.imageList.concat(res.tempFilePaths);
408 | pic = 1;
409 | that.setData({
410 | imageList: tempImageList
411 | })
412 | }
413 | })
414 | },
415 | //预览照片
416 | previewImage: function (e) {
417 | var current = e.target.dataset.src
418 | wx.previewImage({
419 | current: current,
420 | urls: this.data.imageList
421 | })
422 | },
423 | // 删除未上传图片
424 | delPic: function (e) {
425 | var that = this;
426 | var index = e.currentTarget.dataset.index;
427 | that.data.imageList.splice(index, 1);
428 | that.setData({
429 | imageList: that.data.imageList,
430 | uploadPicBtn: true
431 | });
432 |
433 | },
434 | // 删除已上传照片
435 | del: function (e) {
436 | console.log(e.currentTarget.dataset.id);
437 | var that = this;
438 | wx.showModal({
439 | title: '删除图片',
440 | content: '确定删除该图片?',
441 | success: function (res) {
442 | if (res.confirm) {
443 | wx.request({
444 | url: 'https://newerds.51cptj.com/index.php/Home/Index/delete_pic',
445 | data: {
446 | 'id': e.currentTarget.dataset.id
447 | },
448 | method: 'POST',
449 | success: function (res) {
450 | var index = e.currentTarget.dataset.index;
451 | that.data.piclist.splice(index, 1);
452 | that.setData({
453 | piclist: that.data.piclist
454 | });
455 | if (that.data.piclist.length < 9) {
456 | that.setData({
457 | uploadPicBtn: true
458 | })
459 | }
460 | }
461 | })
462 | } else if (res.cancel) {
463 | console.log('用户点击取消')
464 | }
465 | }
466 | })
467 | },
468 | //获取位置
469 | goMap: function () {
470 | var that = this;
471 | wx.chooseLocation({
472 | success: function (res) {
473 | console.log(res);
474 | that.setData({
475 | address: res.address,
476 | lat: res.latitude,
477 | lng: res.longitude
478 | })
479 | },
480 | fail: function (res) {
481 | console.log(res);
482 | }
483 | });
484 | },
485 |
486 | //表单提交
487 | formSubmit: function (e) {
488 | console.log(e.detail.value);//---------测试用
489 | var that = this;
490 | tid = that.data.cartid;
491 | aid = that.data.areaid;
492 | dd = e.detail.value.dd;
493 | area = e.detail.value.area;
494 | money = e.detail.value.money;
495 | descript = e.detail.value.descript;
496 | phone = e.detail.value.phone;
497 | that.cartS();
498 |
499 |
500 | },
501 | //类目判断
502 | cartS: function () {
503 | var that = this;
504 | if (tid != '') {
505 | that.a();
506 | } else {
507 | wx.showToast({
508 | title: '请选择分类',
509 | icon: 'loading',
510 | duration: 1000
511 | })
512 | }
513 |
514 | },
515 | // 地区判断
516 | a: function () {
517 | var that = this;
518 | if (aid != '') {
519 | that.b();
520 | } else {
521 | wx.showToast({
522 | title: '请选择地区',
523 | icon: 'loading',
524 | duration: 1000
525 | })
526 | }
527 | },
528 | // area判断
529 | b: function () {
530 | var that = this;
531 | if (area != '') {
532 | that.c();
533 | } else {
534 | wx.showToast({
535 | title: '请填写' + that.data.showInfo.area,
536 | icon: 'loading',
537 | duration: 1000
538 | })
539 | }
540 | },
541 | // money判断
542 | c: function () {
543 | var that = this;
544 | if (money != '') {
545 | that.d();
546 | } else {
547 | wx.showToast({
548 | title: '请填写' + that.data.showInfo.money,
549 | icon: 'loading',
550 | duration: 1000
551 | })
552 | }
553 | },
554 | // descript判断
555 | d: function () {
556 | var that = this;
557 | if (descript != '') {
558 | that.e();
559 | } else {
560 | wx.showToast({
561 | title: '请填写' + that.data.showInfo.descript,
562 | icon: 'loading',
563 | duration: 1000
564 | })
565 | }
566 | },
567 | // 地址判断
568 | e: function () {
569 | var that = this;
570 | if (location != '') {
571 | that.f();
572 | } else {
573 | wx.showToast({
574 | title: '请选择地址',
575 | icon: 'loading',
576 | duration: 1000
577 | })
578 | }
579 | },
580 | // phone判断
581 | f: function () {
582 | var that = this;
583 | if (phone != '') {
584 | that.upload();
585 | } else {
586 | wx.showToast({
587 | title: '请填写' + that.data.showInfo.phone,
588 | icon: 'loading',
589 | duration: 1000
590 | })
591 | }
592 | },
593 | upload: function () {
594 | var that = this;
595 | console.log(that.data);
596 |
597 | request.editNotice(
598 | {
599 | "session_id": app.globalData.session_id,
600 | 'area': area,
601 | 'money': money,
602 | 'descript': descript,
603 | 'phone': phone,
604 | 'dd':dd,
605 | 'tid': that.data.cartid,
606 | 'aid': that.data.areaid,
607 | 'address': that.data.address,
608 | 'lat': that.data.lat,
609 | 'lng': that.data.lng,
610 | 'id': that.data.optionsId
611 | },
612 | (res) => {
613 |
614 | console.log(res);
615 |
616 |
617 | if (res.data.status == "error") {
618 | wx.showModal({
619 | title: '提示',
620 | content: res.data.msg,
621 | showCancel: false,
622 | success: function (res) {
623 | }
624 | })
625 | } else if (pic == 1) {
626 | var i = 0;
627 | for (i; i < this.data.imageList.length; i++) {
628 | request.addNoticePic(
629 | {
630 | "id": res.data.lastid,
631 | }, that.data.imageList[i],
632 | (res) => {
633 | console.log(res);
634 | if (res.data.status == "error") {
635 | wx.showModal({
636 | title: '提示',
637 | content: res.data.msg,
638 | showCancel: false,
639 | success: function (res) {
640 | }
641 | })
642 | }
643 | },
644 | )
645 | }
646 | if (i = this.data.imageList.length) {
647 | wx.showToast({
648 | title: '修改成功',
649 | icon: 'success',
650 | duration: 800,
651 | complete: setTimeout(function () {
652 | console.log(that.data);
653 |
654 | wx.navigateTo({
655 | url: '../detail/detail?id=' + tid + "&aid=" + aid
656 | })
657 | }, 800)
658 | })
659 | }
660 | } else if (pic == 0) {
661 | wx.showToast({
662 | title: '修改成功',
663 | icon: 'success',
664 | duration: 800,
665 | complete: setTimeout(function () {
666 | wx.navigateTo({
667 | url: '../detail/detail?id=' + tid + "&aid=" + aid
668 | })
669 | }, 800)
670 | })
671 | }
672 | },
673 | )
674 | },
675 |
676 | })
--------------------------------------------------------------------------------
/pages/editDetail/editDetail.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/editDetail/editDetail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/pages/editDetail/editDetail.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: rgb(229, 229, 229);
3 | margin-left: auto;
4 | background-color: #efeff4;
5 | margin-left: auto;
6 | position: absolute;
7 | top: 0;
8 | bottom: 0;
9 | }
10 | .app{
11 | width: 100%;
12 | background:#ffffff;
13 |
14 | }
15 |
16 | /*发布的标题*/
17 | .pub {
18 | display: flex;
19 | text-align: center;
20 | background-color: rgb(255, 255, 255);
21 | height: 88rpx;
22 | line-height: 88rpx;
23 | color: rgb(0, 0, 0);
24 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
25 | font-size: 30rpx;
26 | }
27 | .pubLeft {
28 | width: 50%;
29 | }
30 |
31 | .pubRight {
32 | width: 50%;
33 | }
34 |
35 |
36 | .topimg{
37 | z-index: 100;
38 | position: absolute;
39 | width: 34rpx;
40 | height: 20rpx;
41 | margin:36rpx 20rpx 40rpx 0;
42 | transition: All 0.4s ease;
43 | -webkit-transition: All 0.4s ease;
44 | }
45 | .topimg1{
46 | left:36%;
47 | }
48 | .topimg2{
49 | right:10%;
50 | }
51 |
52 | .selected{
53 | color: #09A6C5;
54 | text-decoration: underline;
55 | }
56 | .pubSelected{
57 | color: #09A6C5;
58 | }
59 |
60 | /*发布样式开始*/
61 | .group_top{
62 | display: flex;
63 | padding:15rpx 20rpx ;
64 | vertical-align: middle;
65 | position: relative;
66 | z-index: 10;
67 | }
68 | .group_line{
69 | border-bottom: 1px solid #EAEAEA;
70 | }
71 | .group_left{
72 | width: 165rpx;
73 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
74 | font-size: 26rpx;
75 | color:rgb(0, 0, 0);
76 | }
77 | .group_right{
78 | width: 100%;
79 | }
80 | .group_right input{
81 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
82 | font-size: 26rpx;
83 | color:rgb(0, 0, 0);
84 | }
85 | .shop_desc{
86 | padding: 10rpx 20rpx;
87 | height:40rpx;
88 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
89 | font-size: 26rpx;
90 | color:rgb(0, 0, 0);
91 | }
92 | .shop_desc_input input{
93 | width: 100%;
94 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
95 | font-size: 26rpx;
96 | color:rgb(0, 0, 0);
97 | }
98 |
99 | .group_pic{
100 | padding:10rpx 20rpx 0rpx;
101 | display: flex;
102 | }
103 | .group_pic_add{
104 | margin-right:10rpx;
105 | }
106 | .group_pic_show{
107 | width: 100%;
108 | margin-top:20rpx;
109 |
110 | }
111 | .group_pic_show image{
112 | width: 116rpx;
113 | height: 116rpx;
114 | margin-right:20rpx;
115 | }
116 | .addr_icon{
117 | width:32rpx;
118 | height: 37rpx;
119 | vertical-align: middle;
120 | display:inline-block;
121 | margin-top:10rpx;
122 |
123 | }
124 | .shop_desc_input .addr_word{
125 | height: 30rpx;
126 | line-height: 30rpx;
127 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
128 | font-size: 28rpx;
129 | color:rgb(0, 0, 0);
130 | width: 86%;
131 | margin-left: 10rpx;
132 | margin-top:10rpx;
133 | }
134 | .text_info textarea{
135 | width: 100%;
136 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
137 | font-size: 26rpx;
138 | color:rgb(0, 0, 0);
139 |
140 | }
141 | .arrow_icon{
142 | width:16rpx;
143 | height: 25rpx;
144 | vertical-align: middle;
145 | display:inline-block;
146 | margin-top:10rpx;
147 | }
148 | .tel_icon{
149 | width: 35rpx;
150 | height: 35rpx;
151 | vertical-align: middle;
152 | display:inline-block;
153 | margin-top:10rpx;
154 | }
155 | .tel_word{
156 | height: 30rpx;
157 | line-height: 30rpx;
158 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
159 | font-size: 28rpx;
160 | color:rgb(0, 0, 0);
161 | margin-left: 10rpx;
162 | }
163 | .pub_btn{
164 | background:#efeff4;
165 | position:absolute;
166 | width:100%;
167 | top: 0;
168 | height: auto;
169 | }
170 | .pub_btn button{
171 | position:fixed;
172 | width:100%;
173 | margin:0 auto;
174 | left:0;
175 | right:0;
176 | bottom:0;
177 | border-radius:0;
178 | background:#1EADCB;
179 | color:#ffffff;
180 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
181 | font-size:28rpx;
182 |
183 | }
184 |
185 |
186 | /*上传图片样式*/
187 |
188 | .del{
189 | position: absolute;
190 | margin-top:-142rpx;
191 | margin-left:102rpx;
192 | z-index: 200;
193 | }
194 | .del image{
195 | width: 30rpx;
196 | height: 30rpx;
197 | }
198 | /*上传图片样式*/
199 |
200 | .del-old {
201 | position:absolute;
202 | top:0;
203 | left:110rpx;
204 | z-index: 900;
205 | }
206 | .del-old image{
207 | width: 30rpx;
208 | height: 30rpx;
209 | }
210 | .scroll_pic{
211 | width:120rpx;
212 | height: 120rpx;
213 | }
214 |
215 | .scroll-view-item {
216 | height: 300rpx;
217 | }
218 |
219 | .scroll-view-item_H {
220 | display:inline-block;
221 | position:relative;
222 | z-index: 100;
223 | padding:20rpx 0 10rpx 0;
224 | margin:0 10rpx 0 10rpx;
225 | }
226 |
227 | .pubpic {
228 | width: 22rpx;
229 | height: 11rpx;
230 | }
231 | .wrap{
232 | background: #ffffff;
233 | }
234 | .middleline{
235 | margin-top: 10rpx;
236 | border: 1px solid #e5e5e5;
237 | height: 62rpx;
238 | }
239 |
240 | .middleview{
241 | height: 14rpx;
242 | background: #efeff4;
243 | }
244 |
245 | .cartbox,.areabox{
246 | text-align: center;
247 | }
248 | .conitem{
249 | height: 86rpx;
250 | line-height: 86rpx;
251 | border-bottom: 1px solid #e5e5e5;
252 | color:rgb(0, 0, 0);
253 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
254 | font-size: 30rpx;
255 | }
256 |
257 |
258 | /*发布样式开始*/
259 | .group_line{
260 | border-bottom: 1px solid #EAEAEA;
261 | }
262 | .group_left{
263 | width: 165rpx;
264 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
265 | font-size: 26rpx;
266 | color:rgb(0, 0, 0);
267 | height: 56rpx;
268 | line-height: 56rpx;
269 | }
270 |
271 | .group_right{
272 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
273 | font-size: 26rpx;
274 | color:rgb(0, 0, 0);
275 | width: 100%;
276 | height: 56rpx;
277 | line-height: 56rpx;
278 | }
279 | .shop_desc{
280 | padding: 10rpx 20rpx;
281 | height:40rpx;
282 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
283 | font-size: 26rpx;
284 | color:rgb(0, 0, 0);
285 | }
286 | .shop_desc_input input{
287 | width: 100%;
288 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
289 | font-size: 26rpx;
290 | color:rgb(0, 0, 0);
291 | }
292 |
293 | .group_pic{
294 | padding:10rpx 20rpx 0rpx;
295 | display: flex;
296 | }
297 | .group_pic_add{
298 | margin-right:10rpx;
299 | }
300 | .group_pic_show{
301 | width: 100%;
302 | margin-top:20rpx;
303 |
304 | }
305 | .group_pic_show image{
306 | width: 116rpx;
307 | height: 116rpx;
308 | margin-right:20rpx;
309 | }
310 | .addr_icon{
311 | width:32rpx;
312 | height: 37rpx;
313 | vertical-align: middle;
314 | display:inline-block;
315 | margin-top:10rpx;
316 |
317 | }
318 | .shop_desc_input .addr_word{
319 | height: 30rpx;
320 | line-height: 30rpx;
321 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
322 | font-size: 26rpx;
323 | color:rgb(0, 0, 0);
324 | width: 86%;
325 | margin-left: 10rpx;
326 | margin-top:10rpx;
327 | }
328 | .text_info textarea{
329 | width: 100%;
330 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
331 | font-size: 26rpx;
332 | color:rgb(0, 0, 0);
333 | }
334 | .arrow_icon{
335 | width:16rpx;
336 | height: 25rpx;
337 | vertical-align: middle;
338 | display:inline-block;
339 | margin-top:10rpx;
340 | }
341 | .tel_icon{
342 | width: 35rpx;
343 | height: 35rpx;
344 | vertical-align: middle;
345 | display:inline-block;
346 | margin-top:10rpx;
347 | }
348 | .tel_word{
349 | height: 30rpx;
350 | line-height: 30rpx;
351 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
352 | font-size: 28rpx;
353 | color:rgb(0, 0, 0);
354 | margin-left: 10rpx;
355 | }
356 | .pub_btn{
357 | background:#efeff4;
358 | position:absolute;
359 | width:100%;
360 | top: 0;
361 | height: auto;
362 | }
363 | .pub_btn button{
364 | position:fixed;
365 | width:100%;
366 | margin:0 auto;
367 | left:0;
368 | right:0;
369 | bottom:0;
370 | border-radius:0;
371 | background:#1EADCB;
372 | color:#ffffff;
373 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
374 | font-size:28rpx;
375 | padding:10rpx 0;
376 | z-index:300;
377 |
378 | }
379 |
380 |
381 |
382 |
--------------------------------------------------------------------------------
/pages/index/index(1).json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | // pages/index/index.js
2 | var request = require('../../utils/request.js');
3 | var app = getApp();
4 | Page({
5 | data: {
6 | imgUrls: [],
7 | pic1: [
8 | {
9 | "id": 1,
10 | "name": '商铺转租',
11 | "pic": '../../images/serPic1.png',
12 | },
13 | {
14 | "id": 2,
15 | "name": '房屋出售',
16 | "pic": '../../images/serPic2.png',
17 | },
18 | {
19 | "id": 3,
20 | "name": '招聘',
21 | "pic": '../../images/serPic3.png',
22 | },
23 | {
24 | "id": 4,
25 | "name": '农产品',
26 | "pic": '../../images/serPic4.png',
27 | },
28 | ],
29 | pic2:[
30 | {
31 | "id": 5,
32 | "name": '房屋出租',
33 | "pic": '../../images/serPic5.png',
34 | },
35 | {
36 | "id": 6,
37 | "name": '二手物品',
38 | "pic": '../../images/serPic6.png'
39 | },
40 | {
41 | "id": 7,
42 | "name": '教育辅导',
43 | "pic": '../../images/serPic7.png'
44 | },
45 | {
46 | "id": 8,
47 | "name": '综合信息',
48 | "pic": '../../images/serPic8.png'
49 | },
50 | ]
51 | },
52 | onShareAppMessage: function () {
53 | return {
54 | success: function (res) {
55 | // 分享成功
56 | console.log(res);
57 | },
58 | fail: function (res) {
59 | // 分享失败
60 | console.log(res);
61 | }
62 | }
63 | },
64 | onLoad: function (options) {
65 | // 页面初始化 options为页面跳转所带来的参数
66 | wx.checkSession({
67 | success: function () {
68 | //session 未过期,并且在本生命周期一直有效
69 | console.log('session 未过期');
70 | app.getUserInfo();
71 | },
72 | fail: function () {
73 | //登录态过期
74 | app.getUserInfo();
75 | }
76 | });
77 | },
78 | onReady: function () {
79 | // 页面渲染完成
80 | },
81 | onShow: function () {
82 | // 页面显示
83 | var that = this;
84 | request.getBanner(
85 | { "session_id": app.globalData.session_id },
86 | (res) => {
87 | console.log(res);
88 | that.setData({
89 | imgUrls: res.data
90 | })
91 | },
92 | );
93 | request.getQupic(
94 | { "session_id": app.globalData.session_id },
95 | (res) => {
96 | console.log(res+"0000000000000000000");
97 | that.setData({
98 | funnyPic: res.data
99 | })
100 | },
101 | )
102 | },
103 | onHide: function () {
104 | // 页面隐藏
105 | },
106 | onUnload: function () {
107 | // 页面关闭
108 | },
109 | goDetail: function (e) {
110 | wx.navigateTo({
111 | url: '../detail/detail?id=' + e.currentTarget.dataset.id
112 | })
113 | },
114 | goBanner: function (e) {
115 | console.log(e.target.dataset.id);
116 | wx.navigateTo({
117 | url: '../adDetail/adDetail?id=' + e.currentTarget.dataset.id
118 | })
119 | }
120 | })
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | {{item.name}}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | {{item.name}}
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 商家活动
34 |
35 |
36 |
37 |
38 |
39 | {{item.title}}
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /* pages/index/index.wxss */
2 | .body{
3 | margin: 0 auto;
4 | padding:20rpx 0rpx 0rpx 40rpx;
5 | display: flex;
6 | flex-direction: row;
7 | }
8 | .body_item{
9 | text-align: center;
10 | margin: 10rpx 36rpx;
11 | display: flex;
12 | flex-direction: column;
13 | justify-content: center;
14 | width: 112rpx;
15 | }
16 | .body_pic{
17 | width: 96rpx;
18 | height: 96rpx;
19 | }
20 | .body_name{
21 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
22 | font-size: 26rpx;
23 | color:rgb(53, 53, 53);
24 | }
25 | .funny_item{
26 | width: 333rpx;
27 | display: inline-block;
28 | text-align: center;
29 | margin-top: 13rpx;
30 | margin-left: 30rpx;
31 | }
32 | .funny_pic{
33 | width: 333rpx;
34 | height: 157rpx;
35 | }
36 | .funny_name{
37 | line-height: 60rpx;
38 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
39 | font-size: 26rpx;
40 | color:rgb(53, 53, 53);
41 | }
42 | .lineBg{
43 | width: 100%;
44 | height:30rpx;
45 | border-top: 1px solid #e5e5e5;
46 | background: #efeff4;
47 | }
48 | .activity {
49 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
50 | font-size: 30rpx;
51 | color:rgb(136, 136, 136);
52 | padding-left: 30rpx;
53 | margin-top: 32rpx;
54 | }
--------------------------------------------------------------------------------
/pages/my/my.js:
--------------------------------------------------------------------------------
1 | // pages/my/my.js
2 | var WxParse = require('../../wxParse/wxParse.js');
3 | var request = require('../../utils/request.js');
4 | var app = getApp();
5 | Page({
6 | data: {},
7 | onShareAppMessage: function () {
8 | return {
9 | success: function (res) {
10 | // 分享成功
11 | console.log(res);
12 | },
13 | fail: function (res) {
14 | // 分享失败
15 | console.log(res);
16 | }
17 | }
18 | },
19 | onLoad: function (options) {
20 | // 页面初始化 options为页面跳转所带来的参数
21 | },
22 | onReady: function () {
23 | // 页面渲染完成
24 | },
25 | onShow: function () {
26 | // 页面显示
27 | var that = this;
28 | request.getUser(
29 | { "session_id": app.globalData.session_id },
30 | (res) => {
31 | console.log(res);
32 | that.setData({
33 | list: res.data
34 | })
35 | },
36 | ),
37 | request.getPeizhi(
38 | { "session_id": app.globalData.session_id },
39 | (res) => {
40 | WxParse.wxParse('xiaoquxx', 'html', res.data.xiaoquxx, that, 5);
41 | },
42 | )
43 | },
44 | onHide: function () {
45 | // 页面隐藏
46 | },
47 | onUnload: function () {
48 | // 页面关闭
49 | }
50 | })
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/pages/my/my.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/my/my.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{list.nickname}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 | 我的发布
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | 小号科技提供技术支持
37 |
38 | http://xiaohao.51cptj.com/
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/pages/my/my.wxss:
--------------------------------------------------------------------------------
1 | @charset 'utf-8';
2 | .wrap{
3 | width: 100%;
4 | background: #efeff4;
5 | position: absolute;
6 | top: 0;
7 | bottom: 0;
8 | }
9 | .app .ele-container {
10 | height: 375rpx;
11 | position: relative;
12 | z-index: 1;
13 | width: 100%;
14 | max-width: 100%;
15 | clear: both;
16 |
17 |
18 | }
19 |
20 | .app .user-center {
21 | width: 100% !important;
22 | height: auto !important;
23 | color: #fff;
24 | font-size: 16px;
25 | }
26 |
27 | .background-ele {
28 | background-repeat: no-repeat;
29 | background-size: 100% 100%;
30 | }
31 |
32 | .show-bac {
33 | height: 367rpx;
34 | width: 100%;
35 | position: absolute;
36 | z-index: 1;
37 | }
38 |
39 | .show-logo {
40 | opacity: 1;
41 | color: rgb(255, 255, 255);
42 | margin-top: 0;
43 | font-size: 18px;
44 | height: 380px;
45 | margin-left: auto;
46 | z-index: 2;
47 | position: absolute;
48 | }
49 |
50 | .app .user-center.with-horizontal-view .show-view {
51 | height: 375rpx;
52 | width: 750rpx;
53 | text-align: center;
54 | }
55 |
56 | .app .user-center .show-view .empty-span {
57 | display: inline-block;
58 | width: 58.59375rpx;
59 | height: 100%;
60 | vertical-align: middle;
61 | }
62 |
63 | .app .user-center .show-view .cover-thumb {
64 | width: 123rpx;
65 | height: 123rpx;
66 | margin-top: 91rpx;
67 | border-radius: 50%;
68 | vertical-align: middle;
69 | }
70 |
71 | .app .user-center .show-view .nickname {
72 | vertical-align: middle;
73 | margin-top: 20rpx;
74 | color: rgb(255, 255, 255);
75 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
76 | font-size: 30rpx;
77 | }
78 |
79 | .app .user-center .show-view .icon-rightarrow {
80 | position: absolute;
81 | top: 50%;
82 | right: 23.4375rpx;
83 | margin-top: -35.15625rpx;
84 | width: 70.3125rpx;
85 | height: 70.3125rpx;
86 | line-height: 70.3125rpx;
87 | font-size: 46.875rpx;
88 | }
89 |
90 | .app .user-center.with-horizontal-view .horizontal-view {
91 | display: block;
92 | }
93 |
94 | .app .user-center .horizontal-view {
95 | border-bottom: 1px solid #eee;
96 | }
97 |
98 | .app .usercenter-mode1 .horizontal-router-container1 {
99 | overflow: hidden;
100 | background: #fff;
101 | font-size: 14px;
102 | }
103 |
104 | .app .usercenter-mode1 .horizontal-router-container1 label {
105 | float: left;
106 | font-size: 20px;
107 | line-height: 30px;
108 | height: 30px;
109 | margin-right: 10px;
110 | }
111 |
112 | .app .usercenter-mode1 .horizontal-router-container1 view {
113 | line-height: 30px;
114 | height: 30px;
115 | padding: 7px 10px;
116 | color: #666;
117 | border-bottom: 1px solid #eee;
118 | background: #fff;
119 | }
120 |
121 | .app .usercenter-mode1 .horizontal-router-container1 .icon-rightarrow {
122 | position: relative;
123 | width: 20px;
124 | height: 30px;
125 | line-height: 20px;
126 | font-size: 16px;
127 | float: right;
128 | color: #aaa;
129 | margin-top: 6px;
130 | margin-right: 0;
131 | }
132 |
133 | Page {
134 | background: #ddd;
135 | }
136 |
137 | .m-t-20 {
138 | margin-top: 200rpx;
139 | }
140 |
141 | .collection-pic {
142 | width: 50rpx !important;
143 | height: 50rpx;
144 | }
145 |
146 | .feiji_icon{
147 | width: 34rpx;
148 | height: 34rpx;
149 | vertical-align: middle;
150 | }
151 |
152 | .feiji_word{
153 | line-height: 60rpx;
154 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
155 | font-size: 30rpx;
156 | color:rgb(0, 0, 0);
157 | margin-left:12rpx ;
158 | }
159 | .about{
160 | padding:40rpx 30rpx;
161 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
162 | font-size: 28rpx;
163 | color:rgb(72, 72, 72);
164 | position: absolute;
165 | top: 450rpx;
166 | z-index: 100;
167 | }
168 | .about_bottom{
169 | position: absolute;
170 | bottom: 32rpx;
171 | text-align: center;
172 | margin: 0 auto;
173 | width: 100%;
174 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
175 | font-size: 26rpx;
176 | color:rgb(169, 169, 169);
177 | }
178 |
--------------------------------------------------------------------------------
/pages/new/new.js:
--------------------------------------------------------------------------------
1 | // pages/new/new.js
2 | var request = require('../../utils/request.js');
3 | var app = getApp();
4 | var tid, aid, area, money, descript, phone, pic = 0;
5 | Page({
6 | data: {
7 | disabled: false,
8 | imageList: [''],
9 | bac: {},
10 | zp: {
11 | "area": "职位",
12 | "areaPlaceholder": "例(司机)",
13 | "money": '工资',
14 | "moneyPlaceholder": "例(4800元/月)",
15 | "descript": '职位描述',
16 | "descriptPlaceholder": "例(某某汽车服务有限公司招聘修理厂前台接待2名,男女不限,会开车懂电脑)最长60字",
17 | "phone": '联系电话',
18 | "phonePlaceholder": "例(13847780952)",
19 | },
20 | cz: {
21 | "area": "小区",
22 | "areaPlaceholder": "例(广厦小区)",
23 | "money": '租金',
24 | "moneyPlaceholder": "例(1800元/月)",
25 | "descript": '房屋描述',
26 | "descriptPlaceholder": "例(120平米,3室2厅1卫,简单装修,5楼电梯)最长60字",
27 | "phone": '联系电话',
28 | "phonePlaceholder": "例(13847780952)",
29 | },
30 | sp: {
31 | "area": "店铺名称",
32 | "areaPlaceholder": "例(烧烤店)",
33 | "money": '转租价格',
34 | "moneyPlaceholder": "例(5万)",
35 | "descript": '房屋描述',
36 | "descriptPlaceholder": "例(平安小区底商,正在营业烧烤店,80平米)最长60字",
37 | "phone": '联系电话',
38 | "phonePlaceholder": "例(13847780952)",
39 | },
40 | esf: {
41 | "area": "小区",
42 | "areaPlaceholder": "例(广厦小区)",
43 | "money": '售价',
44 | "moneyPlaceholder": "例(58万元)",
45 | "descript": '房屋描述',
46 | "descriptPlaceholder": "例(120平米,3室2厅1卫,简单装修,5楼电梯)最长60字",
47 | "phone": '联系电话',
48 | "phonePlaceholder": "例(13847780952)",
49 | },
50 | esc: {
51 | "area": "车型",
52 | "areaPlaceholder": "例(奥迪)",
53 | "money": '售价',
54 | "moneyPlaceholder": "例(28万元)",
55 | "descript": '车辆描述',
56 | "descriptPlaceholder": "例(2015年购买,行驶5万公里,无事故保养好)最长60字",
57 | "phone": '联系电话',
58 | "phonePlaceholder": "例(13847780952)",
59 | },
60 | eswp: {
61 | "area": "物品名称",
62 | "areaPlaceholder": "例(手机)",
63 | "money": '售价',
64 | "moneyPlaceholder": "例(3800元)",
65 | "descript": '物品描述',
66 | "descriptPlaceholder": "例(Iphone7土豪金,128G,九成新)最长60字",
67 | "phone": '联系电话',
68 | "phonePlaceholder": "例(13847780952)",
69 | },
70 | },
71 | onShareAppMessage: function () {
72 | return {
73 | success: function (res) {
74 | // 分享成功
75 | console.log(res);
76 | },
77 | fail: function (res) {
78 | // 分享失败
79 | console.log(res);
80 | }
81 | }
82 | },
83 | onLoad: function (options) {
84 | // 页面初始化 options为页面跳转所带来的参数
85 | var that = this;
86 | console.log(options.id);
87 | tid = options.id;
88 | switch (options.id) {
89 | case '1':
90 | that.setData({
91 | bac: that.data.zp
92 | })
93 | console.log(that.data.bac);
94 | break;
95 | case '2':
96 | that.setData({
97 | bac: that.data.cz
98 | })
99 | break;
100 | case '3':
101 | that.setData({
102 | bac: that.data.sp
103 | })
104 | break;
105 | case '4':
106 | that.setData({
107 | bac: that.data.esf
108 | })
109 | break;
110 | case '5':
111 | that.setData({
112 | bac: that.data.esc
113 | })
114 | break;
115 | case '6':
116 | that.setData({
117 | bac: that.data.eswp
118 | })
119 | break;
120 | }
121 | var that = this;
122 | request.getArea(
123 | { "session_id": app.globalData.session_id },
124 | (res) => {
125 | console.log(res);
126 | that.setData({
127 | area: res.data
128 | })
129 | },
130 | )
131 |
132 | },
133 | onReady: function () {
134 | // 页面渲染完成
135 | },
136 | onShow: function () {
137 | // 页面显示
138 | },
139 | onHide: function () {
140 | // 页面隐藏
141 | },
142 | onUnload: function () {
143 | // 页面关闭
144 | },
145 | formSubmit: function (e) {
146 | var that = this;
147 | area = e.detail.value.area;
148 | money = e.detail.value.money;
149 | descript = e.detail.value.descript;
150 | phone = e.detail.value.phone;
151 | aid = e.detail.value.aid;
152 | that.a();
153 | },
154 | // 选择图片
155 | chooseImage: function () {
156 | var that = this
157 | wx.chooseImage({
158 | count: 6,
159 | success: function (res) {
160 | console.log(res)
161 | pic = 1;
162 | that.setData({
163 | imageList: res.tempFilePaths
164 | })
165 | }
166 | })
167 | },
168 | // 预览图片
169 | previewImage: function (e) {
170 | var current = e.target.dataset.src
171 | wx.previewImage({
172 | current: current,
173 | urls: this.data.imageList
174 | })
175 | },
176 | // 地区判断
177 | a: function () {
178 | var that = this;
179 | if (aid != '') {
180 | that.b();
181 | } else {
182 | wx.showToast({
183 | title: '请选择地区',
184 | icon: 'loading',
185 | duration: 1000
186 | })
187 | }
188 | },
189 | // area判断
190 | b: function () {
191 | var that = this;
192 | if (area != '') {
193 | that.c();
194 | } else {
195 | wx.showToast({
196 | title: '请填写' + that.data.bac.area,
197 | icon: 'loading',
198 | duration: 1000
199 | })
200 | }
201 | },
202 | // money判断
203 | c: function () {
204 | var that = this;
205 | if (money != '') {
206 | that.d();
207 | } else {
208 | wx.showToast({
209 | title: '请填写' + that.data.bac.money,
210 | icon: 'loading',
211 | duration: 1000
212 | })
213 | }
214 | },
215 | // descript判断
216 | d: function () {
217 | var that = this;
218 | if (descript != '') {
219 | that.e();
220 | } else {
221 | wx.showToast({
222 | title: '请填写' + that.data.bac.descript,
223 | icon: 'loading',
224 | duration: 1000
225 | })
226 | }
227 | },
228 | // phone判断
229 | e: function () {
230 | var that = this;
231 | if (phone != '') {
232 | that.upload();
233 | } else {
234 | wx.showToast({
235 | title: '请填写' + that.data.bac.phone,
236 | icon: 'loading',
237 | duration: 1000
238 | })
239 | }
240 | },
241 | upload: function () {
242 | var that = this;
243 | that.setData({
244 | disabled: true
245 | })
246 | request.addNotice(
247 | {
248 | "session_id": app.globalData.session_id,
249 | 'area': area,
250 | 'money': money,
251 | 'descript': descript,
252 | 'phone': phone,
253 | 'tid': tid,
254 | 'aid': aid
255 | },
256 | (res) => {
257 | console.log(res);
258 | if (res.data.status == "error") {
259 | wx.showModal({
260 | title: '提示',
261 | content: res.data.msg,
262 | showCancel: false,
263 | success: function (res) {
264 | }
265 | })
266 | } else if (pic == 1) {
267 | var i = 0;
268 | for (i; i < this.data.imageList.length; i++) {
269 | request.addNoticePic(
270 | {
271 | "id": res.data.lastid,
272 | }, that.data.imageList[i],
273 | (res) => {
274 | console.log(res);
275 | if (res.data.status == "error") {
276 | wx.showModal({
277 | title: '提示',
278 | content: res.data.msg,
279 | showCancel: false,
280 | success: function (res) {
281 | }
282 | })
283 | }
284 | },
285 | )
286 | }
287 | if (i = this.data.imageList.length) {
288 | wx.showToast({
289 | title: '发布成功',
290 | icon: 'success',
291 | duration: 800,
292 | complete: setTimeout(function () {
293 | wx.navigateBack({
294 | delta: 1
295 | })
296 | }, 800)
297 | })
298 | }
299 | } else if (pic == 0) {
300 | wx.showToast({
301 | title: '发布成功',
302 | icon: 'success',
303 | duration: 800,
304 | complete: setTimeout(function () {
305 | wx.navigateBack({
306 | delta: 1
307 | })
308 | }, 800)
309 | })
310 | }
311 | },
312 | )
313 | }
314 | })
315 |
--------------------------------------------------------------------------------
/pages/new/new.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/new/new.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/pages/new/new.wxss:
--------------------------------------------------------------------------------
1 | /* pages/new/new.wxss */
2 | .breakline{
3 | border-width:1px;
4 | border-bottom-style:solid;
5 | margin-top:5px;
6 | margin-left:auto;
7 | margin-right:auto;
8 | width:375px;
9 | border-bottom-color:rgb(204, 204, 204);
10 | }
11 | .form_left{
12 | background-color:rgba(0, 0, 0, 0);
13 | border-color:rgb(34, 34, 34);
14 | border-style:none;
15 | border-width:2px;
16 | color:rgb(0, 0, 0);
17 | font-size:16px;
18 | height:22px;
19 | line-height:22px;
20 | margin-left:11px;
21 | margin-top:9px;
22 | opacity:1;
23 | text-align:left;
24 | }
--------------------------------------------------------------------------------
/pages/publish/publish.js:
--------------------------------------------------------------------------------
1 | // pages/publish/publish.js
2 | var request = require('../../utils/request.js');
3 | var app = getApp();
4 | var tid, aid, area, money, descript, phone, pic = 0;
5 | Page({
6 | data: {
7 | firsrCart:"发布类目",
8 | firsrArea: "发布区域",
9 | showCart: true,
10 | showArea: false,
11 | cartid:1,
12 | areaid:1,
13 | },
14 | //分享功能的实现
15 | onShareAppMessage: function () {
16 | return {
17 | success: function (res) {
18 | // 分享成功
19 | console.log(res);
20 | },
21 | fail: function (res) {
22 | // 分享失败
23 | console.log(res);
24 | }
25 | }
26 | },
27 |
28 | //点击类目
29 | clickCart: function () {
30 | var showCart = this.data.showCart;
31 | if (showCart == true) {
32 | this.setData({
33 | showCart: false,
34 | })
35 | } else {
36 | this.setData({
37 | showCart: true,
38 | showArea: false,
39 | })
40 | }
41 | },
42 | //点击切换类目
43 | cartSelect: function (e) {
44 | this.setData({
45 | firsrCart: e.target.dataset.cart,
46 | showCart: false,
47 | showArea: true,
48 | cartid: e.currentTarget.dataset.id,
49 | num1: e.currentTarget.dataset.id
50 | })
51 |
52 | },
53 | //点击选择区域
54 | clickArea: function () {
55 | var showArea = this.data.showArea;
56 | if (showArea == true) {
57 | this.setData({
58 | showArea: false,
59 | })
60 | } else {
61 | this.setData({
62 | showCart: false,
63 | showArea: true,
64 | })
65 | }
66 | },
67 | //点击切换区域
68 | areaSelect: function (e) {
69 | this.setData({
70 | firsrArea: e.target.dataset.area,
71 | showArea: false,
72 | areaid: e.currentTarget.dataset.id,
73 | //----------显示面板
74 | showDetail:true,
75 | num2: e.currentTarget.dataset.id
76 | })
77 |
78 | console.log(this.data);
79 | wx.navigateTo({
80 | url: 'publishDetail/publishDetail?tid='+this.data.cartid+"&aid="+this.data.areaid,
81 | })
82 | },
83 |
84 |
85 | onLoad: function (options) {
86 | // 页面初始化 options为页面跳转所带来的参数
87 | // 获取类目列表
88 | var that = this;
89 | request.getType(
90 | { "session_id": app.globalData.session_id },
91 | (res) => {
92 | console.log(res);
93 | that.setData({
94 | list: res.data
95 | })
96 |
97 | },
98 | ),
99 | //获取区域列表
100 | request.getArea(
101 | {//"tid": this.data.cartid
102 | },
103 | (res) => {
104 | this.setData({
105 | areaList: res.data
106 | })
107 |
108 | },
109 | )
110 |
111 | },
112 | onReady: function () {
113 | // 页面渲染完成
114 | },
115 | onShow: function () {
116 | //页面加载的时候的重置数据
117 | this.setData({
118 | firsrCart: "发布类目",
119 | firsrArea: "发布区域",
120 | showCart: true,
121 | showArea: false,
122 | })
123 | },
124 | onHide: function () {
125 | // 页面隐藏
126 | },
127 | onUnload: function () {
128 | // 页面关闭
129 | }
130 |
131 | })
--------------------------------------------------------------------------------
/pages/publish/publish.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/publish/publish.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{firsrCart}}
6 |
7 |
8 |
9 |
10 | {{firsrArea}}
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | {{item.tname}}
22 |
23 |
24 |
25 |
26 |
27 |
28 | {{item.tname}}
29 |
30 |
31 |
32 |
33 |
34 | 小号科技提供技术支持
35 |
36 | http://xiaohao.51cptj.com/
37 |
38 |
39 |
--------------------------------------------------------------------------------
/pages/publish/publish.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #efeff4;
3 | margin-left: auto;
4 | position: absolute;
5 | top: 0;
6 | bottom: 0;
7 | }
8 | .app{
9 | width: 100%;
10 | background:#ffffff;
11 |
12 | }
13 | /*发布的标题*/
14 | .pub {
15 | display: flex;
16 | text-align: center;
17 | background-color: rgb(255, 255, 255);
18 | height: 88rpx;
19 | line-height: 88rpx;
20 | /*color: #09A6C5;*/
21 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
22 | font-size: 30rpx;
23 | }
24 | .pubLeft {
25 | width: 50%;
26 | }
27 |
28 | .pubRight {
29 | width: 50%;
30 | }
31 | .pubpic {
32 | width: 22rpx;
33 | height: 11rpx;
34 | }
35 | .wrap{
36 | background: #ffffff;
37 | }
38 | .middleline{
39 | margin-top: 10rpx;
40 | border: 1px solid #e5e5e5;
41 | height: 62rpx;
42 | }
43 |
44 | .middleview{
45 | height: 14rpx;
46 | background: #efeff4;
47 | }
48 |
49 | .cartbox,.areabox{
50 | text-align: center;
51 | }
52 | .conitem{
53 | height: 86rpx;
54 | line-height: 86rpx;
55 | border-bottom: 1px solid #e5e5e5;
56 | color:rgb(0, 0, 0);
57 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
58 | font-size: 30rpx;
59 | }
60 | .topimg{
61 | z-index: 100;
62 | position: absolute;
63 | width: 34rpx;
64 | height: 20rpx;
65 | margin:36rpx 20rpx 40rpx 0;
66 | transition: All 0.4s ease;
67 | -webkit-transition: All 0.4s ease;
68 | }
69 | .topimg1{
70 | left:36%;
71 | }
72 | .topimg2{
73 | right:7%;
74 | }
75 |
76 | .selected{
77 | color: #09A6C5;
78 | text-decoration: underline;
79 | }
80 | .pubSelected{
81 | color: #09A6C5;
82 | }
83 |
84 | .about_bottom{
85 | position: absolute;
86 | bottom: 32rpx;
87 | text-align: center;
88 | margin: 0 auto;
89 | width: 100%;
90 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
91 | font-size: 26rpx;
92 | color:rgb(169, 169, 169);
93 | }
--------------------------------------------------------------------------------
/pages/publish/publishDetail/publishDetail.js:
--------------------------------------------------------------------------------
1 | // pages/publish/publish.js
2 | var request = require('../../../utils/request.js');
3 | var app = getApp();
4 | var tid, aid, area, money,dd, descript, phone, pic = 0;
5 | Page({
6 | data: {
7 | firsrCart: "发布类目",
8 | firsrArea: "发布区域",
9 | showCart: false,
10 | showArea: false,
11 | showDetail: true,
12 | showMoneyBox: true,
13 | showAreaBox: false,
14 | // 选择地址
15 | location: '',
16 | lat: '',
17 | lng: '',
18 | //发布详情页的数据
19 | imageList: [],
20 | cartid: 1,
21 | areaid: 1,
22 | uploadPicBtn:true,
23 | showInfo: {},
24 | spzz: {
25 | "area": "商铺名称:",
26 | "areaPlaceholder": "(如:湾南里小区便民服务店)",
27 | "money": '商铺租金:',
28 | "moneyPlaceholder": "(如:2000元/月)",
29 | "descript": '商铺描述:',
30 | "descriptPlaceholder": "(如:湾南里小区底商,80平,煤气/燃气、暖气、厨房、卫生间。)",
31 | "addrPlaceholder": "请选择地址",
32 | "phonePlaceholder": "请输入联系电话",
33 | "phone": "联系电话"
34 | },
35 | fwcs: {
36 | "area": "房屋名称:",
37 | "areaPlaceholder": "(如:湾南里小区 三居室 98平米)",
38 | "money": '房屋售价:',
39 | "moneyPlaceholder": "(如:200万)",
40 | "descript": '房屋描述:',
41 | "descriptPlaceholder": "(如:120平米,3室2厅1卫,简单装修,5楼电梯)",
42 | "phonePlaceholder": "请输入联系电话",
43 | "phone": "联系电话"
44 | },
45 | zp: {
46 | "area": "招聘职位:",
47 | "areaPlaceholder": "(如:保姆)",
48 | "money": '职位工资:',
49 | "moneyPlaceholder": "(如:50000元/月)",
50 | "areabox":"招聘地点:",
51 | "areaboxPlaceholder":"(如:湾南里小区)",
52 | "descript": '职位描述:',
53 | "descriptPlaceholder": "(如:需有高等教育背景,为人细心,有相关经验,薪资可议)",
54 | "phonePlaceholder": "请输入联系电话",
55 | "phone": "联系电话"
56 | },
57 | ncp: {
58 | "area": "产品名称:",
59 | "areaPlaceholder": "(如:小麦1000斤)",
60 | "money": '产品售价:',
61 | "moneyPlaceholder": "(如:20元/斤)",
62 | "descript": '详细描述:',
63 | "descriptPlaceholder": "(如:请输入农产品信息等。举例:通货水分12分以内,容量780左右,杂志6%以内)",
64 | "phonePlaceholder": "请输入联系电话",
65 | "phone": "联系电话"
66 | },
67 | fwcz: {
68 | "area": "小区名称:",
69 | "areaPlaceholder": "(如:湾南里小区)",
70 | "money": '房屋租金:',
71 | "moneyPlaceholder": "(如:2000元/月)",
72 | "descript": '房屋描述:',
73 | "descriptPlaceholder": "(如:三室一厅,押一付三,5层/12层,精装修,可小刀)",
74 | "phonePlaceholder": "请输入联系电话",
75 | "phone": "联系电话"
76 | },
77 | eswp: {
78 | "area": "物品名称:",
79 | "areaPlaceholder": "(如:9成新iPhone7)",
80 | "money": '物品售价:',
81 | "moneyPlaceholder": "(如:6000元)",
82 | "descript": '物品描述:',
83 | "descriptPlaceholder": "(如:亮黑色,128G,去年十月份入手,无刮痕,国行,保修期到今年十二月份。配件齐全。有发票。当面交易,可小刀)",
84 | "phonePlaceholder": "请输入联系电话",
85 | "phone": "联系电话"
86 | },
87 | jyfd: {
88 | "area": "辅导科目",
89 | "areaPlaceholder": "(如:数学1对1专业辅导)",
90 | "money": '收费标准:',
91 | "moneyPlaceholder": "(如:60元/课时)",
92 | "descript": '详细描述:',
93 | "descriptPlaceholder": "(如:专业的数学培训,多年教学辅导经验。学生参加奥数竞赛获得优异成绩。只接受晚上一对一辅导,每次两个课时,20课时起报。)",
94 | "phonePlaceholder": "请输入联系电话",
95 | "phone": "联系电话"
96 | },
97 | zhxx: {
98 | "area": "信息标题:",
99 | "areaPlaceholder": "(如:专业疏通下水道)",
100 | "descript": '信息描述:',
101 | "descriptPlaceholder": "(如:常年从事疏通下水道工作,非常专业,上门服务,疏通不成功不收取任何费用。)",
102 | "phonePlaceholder": "请输入联系电话",
103 | "phone":"联系电话",
104 |
105 | },
106 | },
107 | //分享功能的实现
108 | onShareAppMessage: function () {
109 | return {
110 | success: function (res) {
111 | // 分享成功
112 | console.log(res);
113 | },
114 | fail: function (res) {
115 | // 分享失败
116 | console.log(res);
117 | }
118 | }
119 | },
120 |
121 | //点击类目
122 | clickCart: function () {
123 | var showCart = this.data.showCart;
124 | if (showCart == true) {
125 | this.setData({
126 | showCart: false,
127 | showDetail: false,
128 | })
129 | } else {
130 | this.setData({
131 | showCart: true,
132 | showArea: false,
133 | showDetail: false,
134 | })
135 | }
136 | },
137 | //点击切换类目
138 | cartSelect: function (e) {
139 |
140 | this.setData({
141 | firsrCart: e.target.dataset.cart,
142 | showCart: false,
143 | showArea: true,
144 | cartid: e.currentTarget.dataset.id,
145 | num1: e.currentTarget.dataset.id
146 | })
147 |
148 | },
149 | //点击选择区域
150 | clickArea: function () {
151 | var showArea = this.data.showArea;
152 | if (showArea == true) {
153 | this.setData({
154 | showArea: false,
155 | showDetail: false,
156 | })
157 | } else {
158 | this.setData({
159 | showCart: false,
160 | showArea: true,
161 | showDetail: false,
162 | })
163 | }
164 | },
165 | //点击切换区域
166 | areaSelect: function (e) {
167 | this.setData({
168 | firsrArea: e.target.dataset.area,
169 | showArea: false,
170 | showDetail: false,
171 | areaid: e.currentTarget.dataset.id,
172 | //----------显示面板
173 | showDetail: true,
174 | num2: e.currentTarget.dataset.id
175 | })
176 |
177 | //选择数据
178 | var that = this;
179 | switch (that.data.cartid) {
180 | case '1':
181 | that.setData({
182 | showMoneyBox: true,
183 | showAreaBox: false,
184 | showInfo: that.data.spzz
185 | })
186 | break;
187 | case '2':
188 | that.setData({
189 | showMoneyBox: true,
190 | showAreaBox: false,
191 | showInfo: that.data.fwcs
192 | })
193 | break;
194 | case '3':
195 | that.setData({
196 | showMoneyBox: true,
197 | showAreaBox:true,
198 | showInfo: that.data.zp
199 | })
200 | break;
201 | case '4':
202 | that.setData({
203 | showMoneyBox: true,
204 | showAreaBox: false,
205 | showInfo: that.data.ncp
206 | })
207 | break;
208 | case '5':
209 | that.setData({
210 | showMoneyBox: true,
211 | showAreaBox: false,
212 | showInfo: that.data.fwcz
213 | })
214 | break;
215 | case '6':
216 | that.setData({
217 | showMoneyBox: true,
218 | showAreaBox: false,
219 | showInfo: that.data.eswp
220 | })
221 | break;
222 | case '7':
223 | that.setData({
224 | showMoneyBox: true,
225 | showAreaBox: false,
226 | showInfo: that.data.jyfd
227 | })
228 | break;
229 | case '8':
230 | that.setData({
231 | showMoneyBox: false,
232 | showAreaBox: false,
233 | showInfo: that.data.zhxx
234 | })
235 | break;
236 | }
237 |
238 |
239 | },
240 |
241 | onLoad: function (options) {
242 | // 页面初始化 options为页面跳转所带来的参数
243 | // 获取类目列表
244 |
245 | console.log(options);
246 |
247 | var that = this;
248 | request.getType(
249 | { "session_id": app.globalData.session_id },
250 | (res) => {
251 | console.log(res);
252 | that.setData({
253 | list: res.data
254 | })
255 |
256 | },
257 | ),
258 | //获取区域列表
259 | request.getArea(
260 | {},
261 | (res) => {
262 | that.setData({
263 | areaList: res.data
264 | })
265 | },
266 | ),
267 | //获取当前的类目和区域
268 | that.setData({
269 | cartid: options.tid,
270 | areaid: options.aid,
271 | })
272 | //获取类目名称
273 | request.getTname(
274 | { "tid": options.tid},
275 | (res) => {
276 | console.log(res)
277 | that.setData({
278 | firsrCart: res.data
279 | })
280 | },
281 | )
282 | //获取区域名称
283 | request.getAname(
284 | { "aid": options.aid },
285 | (res) => {
286 | console.log(res)
287 | that.setData({
288 | firsrArea: res.data
289 | })
290 | },
291 | )
292 | //显示所选中的信息
293 | //选择数据
294 | switch (that.data.cartid) {
295 | case '1':
296 | that.setData({
297 | showMoneyBox: true,
298 | showAreaBox: false,
299 | showInfo: that.data.spzz
300 | })
301 | break;
302 | case '2':
303 | that.setData({
304 | showMoneyBox: true,
305 | showAreaBox: false,
306 | showInfo: that.data.fwcs
307 | })
308 | break;
309 | case '3':
310 | that.setData({
311 | showMoneyBox: true,
312 | showAreaBox: true,
313 | showInfo: that.data.zp
314 | })
315 | break;
316 | case '4':
317 | that.setData({
318 | showMoneyBox: true,
319 | showAreaBox: false,
320 | showInfo: that.data.ncp
321 | })
322 | break;
323 | case '5':
324 | that.setData({
325 | showMoneyBox: true,
326 | showAreaBox: false,
327 | showInfo: that.data.fwcz
328 | })
329 | break;
330 | case '6':
331 | that.setData({
332 | showMoneyBox: true,
333 | showAreaBox: false,
334 | showInfo: that.data.eswp
335 | })
336 | break;
337 | case '7':
338 | that.setData({
339 | showMoneyBox: true,
340 | showAreaBox: false,
341 | showInfo: that.data.jyfd
342 | })
343 | break;
344 | case '8':
345 | that.setData({
346 | showMoneyBox: false,
347 | showAreaBox: false,
348 | showInfo: that.data.zhxx
349 | })
350 | break;
351 | }
352 | //页面展示选择地址
353 | var that = this;
354 | wx.getLocation({
355 | type: 'wgs84',
356 | success: function (res) {
357 | // 成功返回函数
358 | var longitude = res.longitude;
359 | var latitude = res.latitude;
360 | //发送请求通过百度经纬度反查地址信息
361 |
362 | request.getMapList(
363 | {
364 | "lat": latitude,
365 | "lng": longitude,
366 | },
367 | (res) => {
368 | console.log(res)
369 | that.setData({
370 | location: res.data.result.address,
371 | lat: res.data.result.ad_info.location.lat,
372 | lng: res.data.result.ad_info.location.lng,
373 | })
374 | },
375 | )
376 |
377 |
378 | }
379 | })
380 | },
381 | onReady: function () {
382 | },
383 | //页面展示选择地址
384 | onShow: function () {
385 | var that = this;
386 | wx.getLocation({
387 | type: 'wgs84',
388 | success: function (res) {
389 | // 成功返回函数
390 | var longitude = res.longitude;
391 | var latitude = res.latitude;
392 | //发送请求通过百度经纬度反查地址信息
393 |
394 | request.getMapList(
395 | {
396 | "lat": latitude,
397 | "lng": longitude,
398 | },
399 | (res) => {
400 | console.log(res)
401 | that.setData({
402 | location: res.data.result.address,
403 | lat: res.data.result.ad_info.location.lat,
404 | lng: res.data.result.ad_info.location.lng,
405 | })
406 | },
407 | )
408 | }
409 | })
410 |
411 | },
412 | onHide: function () {
413 | // 页面隐藏
414 | },
415 | onUnload: function () {
416 | // 页面关闭
417 | },
418 |
419 | // 选择照片
420 | chooseImage: function () {
421 | var that = this;
422 | var tempCount = 9 - that.data.imageList.length;
423 | if (tempCount < 1){
424 | that.setData({
425 | uploadPicBtn: false
426 | })
427 | }
428 | wx.chooseImage({
429 | count: tempCount,
430 | sizeType: 'compressed',
431 | success: function (res) {
432 | console.log(res);
433 | console.log(tempCount);
434 | var tempImageList = that.data.imageList.concat(res.tempFilePaths);
435 | pic = 1;
436 | that.setData({
437 | imageList: tempImageList
438 | })
439 | if (tempImageList.length == 9){
440 | that.setData({
441 | uploadPicBtn: false
442 | })
443 | }
444 | }
445 | })
446 | },
447 | //预览照片
448 | previewImage: function (e) {
449 | console.log(this.data.imageList);
450 | var current = e.target.dataset.src
451 | wx.previewImage({
452 | current: current,
453 | urls: this.data.imageList
454 | })
455 | },
456 | // 删除未上传图片
457 | delPic: function (e) {
458 | var that = this;
459 | var index = e.currentTarget.dataset.index;
460 | that.data.imageList.splice(index, 1);
461 | that.setData({
462 | imageList: that.data.imageList,
463 | uploadPicBtn: true
464 | });
465 | },
466 | //获取位置
467 | goMap: function () {
468 | var that = this;
469 | wx.chooseLocation({
470 | success: function (res) {
471 | console.log(res);
472 | that.setData({
473 | location: res.name,
474 | lat: res.latitude,
475 | lng: res.longitude
476 | })
477 | },
478 | fail: function (res) {
479 | console.log(res);
480 | console.log(that.data.lat);
481 | }
482 | });
483 | },
484 |
485 | //表单提交
486 | formSubmit: function (e) {
487 | var that = this;
488 | tid = that.data.cartid;
489 | aid = that.data.areaid;
490 | area = e.detail.value.area;
491 | money = e.detail.value.money;
492 | dd = e.detail.value.dd;
493 | descript = e.detail.value.descript;
494 | phone = e.detail.value.phone;
495 | location = e.detail.value.location;
496 | that.cartS();
497 |
498 |
499 | },
500 | //类目判断
501 | cartS: function () {
502 | var that = this;
503 | if (tid != '') {
504 | that.a();
505 | } else {
506 | wx.showToast({
507 | title: '请选择分类',
508 | icon: 'loading',
509 | duration: 1000
510 | })
511 | }
512 |
513 | },
514 | // 地区判断
515 | a: function () {
516 | var that = this;
517 | if (aid != '') {
518 | that.b();
519 | } else {
520 | wx.showToast({
521 | title: '请选择地区',
522 | icon: 'loading',
523 | duration: 1000
524 | })
525 | }
526 | },
527 | // area判断
528 | b: function () {
529 | var that = this;
530 | if (area != '') {
531 | that.c();
532 | } else {
533 | wx.showToast({
534 | title: '请填写' + that.data.showInfo.area,
535 | icon: 'loading',
536 | duration: 1000
537 | })
538 | }
539 | },
540 | // money判断
541 | c: function () {
542 | var that = this;
543 | if (money != '') {
544 | that.d();
545 | } else {
546 | wx.showToast({
547 | title: '请填写' + that.data.showInfo.money,
548 | icon: 'loading',
549 | duration: 1000
550 | })
551 | }
552 | },
553 | // descript判断
554 | d: function () {
555 | var that = this;
556 | if (descript != '') {
557 | that.e();
558 | } else {
559 | wx.showToast({
560 | title: '请填写' + that.data.showInfo.descript,
561 | icon: 'loading',
562 | duration: 1000
563 | })
564 | }
565 | },
566 | // 地址判断
567 | e: function () {
568 | var that = this;
569 | if (location != '') {
570 | that.f();
571 | } else {
572 | wx.showToast({
573 | title: '请选择地址',
574 | icon: 'loading',
575 | duration: 1000
576 | })
577 | }
578 | },
579 | // phone判断
580 | f: function () {
581 | var that = this;
582 | if (phone != '') {
583 | that.upload();
584 | } else {
585 | wx.showToast({
586 | title: '请填写' + that.data.showInfo.phone,
587 | icon: 'loading',
588 | duration: 1000
589 | })
590 | }
591 | },
592 | upload: function () {
593 | var that = this;
594 |
595 | request.addNotice(
596 | {
597 | "session_id": app.globalData.session_id,
598 | 'area': area,
599 | 'money': money,
600 | 'descript': descript,
601 | 'phone': phone,
602 | 'tid': tid,
603 | 'aid': aid,
604 | 'dd':dd,
605 | 'address': that.data.location,
606 | 'lat': that.data.lat,
607 | 'lng': that.data.lng
608 | },
609 | (res) => {
610 | console.log(res);
611 | if (res.data.status == "error") {
612 | wx.showModal({
613 | title: '提示',
614 | content: res.data.msg,
615 | showCancel: false,
616 | success: function (res) {
617 | }
618 | })
619 | } else if (pic == 1) {
620 | var i = 0;
621 | for (i; i < this.data.imageList.length; i++) {
622 | request.addNoticePic(
623 | {
624 | "id": res.data.lastid,
625 | }, that.data.imageList[i],
626 | (res) => {
627 | console.log(res);
628 | if (res.data.status == "error") {
629 | wx.showModal({
630 | title: '提示',
631 | content: res.data.msg,
632 | showCancel: false,
633 | success: function (res) {
634 | }
635 | })
636 | }
637 | },
638 | )
639 | }
640 | if (i = this.data.imageList.length) {
641 | wx.showToast({
642 | title: '发布成功',
643 | icon: 'success',
644 | duration: 800,
645 | complete: setTimeout(function () {
646 | wx.navigateTo({
647 | url: '../../detail/detail?id=' + tid + "&aid=" + aid
648 | })
649 | }, 800)
650 | })
651 | }
652 | } else if (pic == 0) {
653 | wx.showToast({
654 | title: '发布成功',
655 | icon: 'success',
656 | duration: 800,
657 | complete: setTimeout(function () {
658 | wx.navigateTo({
659 | url: '../../detail/detail?id=' + tid + "&aid=" + aid
660 | })
661 | }, 800)
662 | })
663 | }
664 | },
665 | )
666 | },
667 |
668 | })
--------------------------------------------------------------------------------
/pages/publish/publishDetail/publishDetail.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/pages/publish/publishDetail/publishDetail.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/pages/publish/publishDetail/publishDetail.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #efeff4;
3 | margin-left: auto;
4 | position: absolute;
5 | top: 0;
6 | bottom: 0;
7 | }
8 | .app{
9 | width: 100%;
10 | background:#ffffff;
11 |
12 | }
13 | /*发布的标题*/
14 | .pub {
15 | display: flex;
16 | text-align: center;
17 | background-color: rgb(255, 255, 255);
18 | height: 88rpx;
19 | line-height: 88rpx;
20 | /*color: #09A6C5;*/
21 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
22 | font-size: 30rpx;
23 | }
24 | .pubLeft {
25 | width: 50%;
26 | }
27 |
28 | .pubRight {
29 | width: 50%;
30 | }
31 | .pubpic {
32 | width: 22rpx;
33 | height: 11rpx;
34 | }
35 | .wrap{
36 | background: #ffffff;
37 | }
38 | .middleline{
39 | margin-top: 10rpx;
40 | border: 1px solid #e5e5e5;
41 | height: 62rpx;
42 | }
43 |
44 | .middleview{
45 | height: 14rpx;
46 | background: #efeff4;
47 | }
48 |
49 | .cartbox,.areabox{
50 | text-align: center;
51 | }
52 | .conitem{
53 | height: 86rpx;
54 | line-height: 86rpx;
55 | border-bottom: 1px solid #e5e5e5;
56 | color:rgb(0, 0, 0);
57 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
58 | font-size: 30rpx;
59 | }
60 | .topimg{
61 | z-index: 100;
62 | position: absolute;
63 | width: 34rpx;
64 | height: 20rpx;
65 | margin:36rpx 20rpx 40rpx 0;
66 | transition: All 0.4s ease;
67 | -webkit-transition: All 0.4s ease;
68 | }
69 | .topimg1{
70 | left:36%;
71 | }
72 | .topimg2{
73 | right:10%;
74 | }
75 |
76 | .selected{
77 | color: #09A6C5;
78 | text-decoration: underline;
79 | }
80 | .pubSelected{
81 | color: #09A6C5;
82 | }
83 |
84 | /*发布样式开始*/
85 | .group_top{
86 | display: flex;
87 | padding:15rpx 20rpx ;
88 | vertical-align: middle;
89 | position: relative;
90 | z-index: 10;
91 |
92 | }
93 | .group_line{
94 | border-bottom: 1px solid #EAEAEA;
95 | }
96 | .group_left{
97 | width: 200rpx;
98 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
99 | font-size: 28rpx;
100 | color:rgb(0, 0, 0);
101 | line-height:56rpx;
102 | height:56rpx;
103 | }
104 | .group_right{
105 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
106 | font-size: 28rpx;
107 | color:rgb(0, 0, 0);
108 | line-height:56rpx;
109 | height:56rpx;
110 | width: 100%;
111 | }
112 |
113 | .shop_desc{
114 | padding: 10rpx 20rpx;
115 | height:40rpx;
116 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
117 | font-size: 28rpx;
118 | color:rgb(0, 0, 0);
119 | }
120 | .shop_desc_input input{
121 | width: 100%;
122 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
123 | font-size: 28rpx;
124 | color:rgb(0, 0, 0);
125 | }
126 |
127 | .group_pic{
128 | padding:10rpx 20rpx 0rpx;
129 | display: flex;
130 | }
131 | .group_pic_add{
132 | margin-right:10rpx;
133 | }
134 | .group_pic_show{
135 | width: 100%;
136 | margin-top:20rpx;
137 |
138 | }
139 | .group_pic_show image{
140 | width: 116rpx;
141 | height: 116rpx;
142 | margin-right:20rpx;
143 | }
144 | .addr_icon{
145 | width:32rpx;
146 | height: 37rpx;
147 | vertical-align: middle;
148 | display:inline-block;
149 | margin-top:10rpx;
150 |
151 | }
152 | .shop_desc_input .addr_word{
153 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
154 | font-size: 28rpx;
155 | color:rgb(0, 0, 0);
156 | width: 86%;
157 | margin-left: 10rpx;
158 | }
159 | .text_info textarea{
160 | width: 100%;
161 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
162 | font-size: 28rpx;
163 | color:rgb(0, 0, 0);
164 | }
165 | .arrow_icon{
166 | width:16rpx;
167 | height: 25rpx;
168 | vertical-align: middle;
169 | display:inline-block;
170 | margin-top:10rpx;
171 | }
172 | .tel_icon{
173 | width: 35rpx;
174 | height: 35rpx;
175 | vertical-align: middle;
176 | display:inline-block;
177 | margin-top:10rpx;
178 | }
179 | .tel_word{
180 | height: 30rpx;
181 | line-height: 30rpx;
182 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
183 | font-size: 28rpx;
184 | color:rgb(0, 0, 0);
185 | margin-left: 10rpx;
186 | }
187 | .pub_btn{
188 | background:#efeff4;
189 | position:absolute;
190 | width:100%;
191 | top: 0;
192 | height: auto;
193 | }
194 | .pub_btn button{
195 | position:fixed;
196 | width:100%;
197 | margin:0 auto;
198 | left:0;
199 | right:0;
200 | bottom:0;
201 | border-radius:0;
202 | background:#1EADCB;
203 | color:#ffffff;
204 | font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei";
205 | font-size:30rpx;
206 | z-index: 300;
207 |
208 | }
209 |
210 |
211 | /*上传图片样式*/
212 |
213 | .del {
214 | position: absolute;
215 | margin-top:-140rpx;
216 | margin-left:102rpx;
217 |
218 | }
219 | .del image{
220 | width: 30rpx;
221 | height: 30rpx;
222 | }
223 |
--------------------------------------------------------------------------------
/style/weui.wxss:
--------------------------------------------------------------------------------
1 | page {
2 | line-height: 1.6;
3 | font-family: -apple-system-font, "Helvetica Neue", sans-serif;
4 | }
5 | icon {
6 | vertical-align: middle;
7 | }
8 | .weui-cells {
9 | position: relative;
10 | margin-top: 1.17647059em;
11 | background-color: #FFFFFF;
12 | line-height: 88rpx;
13 | font-size: 17px;
14 | }
15 | .weui-cells:before {
16 | content: " ";
17 | position: absolute;
18 | left: 0;
19 | top: 0;
20 | right: 0;
21 | height: 1px;
22 | border-top: 1rpx solid #D9D9D9;
23 | color: #D9D9D9;
24 | }
25 | .weui-cells:after {
26 | content: " ";
27 | position: absolute;
28 | left: 0;
29 | bottom: 0;
30 | right: 0;
31 | height: 1px;
32 | border-bottom: 1rpx solid #D9D9D9;
33 | color: #D9D9D9;
34 | }
35 | .weui-cells__title {
36 | margin-top: .77em;
37 | margin-bottom: .3em;
38 | padding-left: 15px;
39 | padding-right: 15px;
40 | color: #999999;
41 | font-size: 14px;
42 | }
43 | .weui-cells_after-title {
44 | margin-top: 0;
45 | }
46 | .weui-cells__tips {
47 | margin-top: .3em;
48 | color: #999999;
49 | padding-left: 15px;
50 | padding-right: 15px;
51 | font-size: 14px;
52 | }
53 | .weui-cell {
54 | padding: 0 15px;
55 | position: relative;
56 | display: -webkit-box;
57 | display: -webkit-flex;
58 | display: flex;
59 | -webkit-box-align: center;
60 | -webkit-align-items: center;
61 | align-items: center;
62 | }
63 | .weui-cell:before {
64 | content: " ";
65 | position: absolute;
66 | left: 0;
67 | top: 0;
68 | right: 0;
69 | height: 1px;
70 | border-top: 1rpx solid #D9D9D9;
71 | color: #D9D9D9;
72 | left: 15px;
73 | }
74 | .weui-cell:first-child:before {
75 | display: none;
76 | }
77 | .weui-cell_active {
78 | background-color: #ECECEC;
79 | }
80 | .weui-cell_primary {
81 | -webkit-box-align: start;
82 | -webkit-align-items: flex-start;
83 | align-items: flex-start;
84 | }
85 | .weui-cell__bd {
86 | -webkit-box-flex: 1;
87 | -webkit-flex: 1;
88 | flex: 1;
89 | }
90 | .weui-cell__ft {
91 | text-align: right;
92 | color: #999999;
93 | }
94 | .weui-cell_access {
95 | color: inherit;
96 | }
97 | .weui-cell__ft_in-access {
98 | padding-right: 13px;
99 | position: relative;
100 | }
101 | .weui-cell__ft_in-access:after {
102 | content: " ";
103 | display: inline-block;
104 | height: 6px;
105 | width: 6px;
106 | border-width: 2px 2px 0 0;
107 | border-color: #C8C8CD;
108 | border-style: solid;
109 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
110 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
111 | position: relative;
112 | top: -2px;
113 | position: absolute;
114 | top: 50%;
115 | margin-top: -4px;
116 | right: 2px;
117 | }
118 | .weui-cell_link {
119 | color: #586C94;
120 | font-size: 14px;
121 | }
122 | .weui-cell_link:active {
123 | background-color: #ECECEC;
124 | }
125 | .weui-cell_link:first-child:before {
126 | display: block;
127 | }
128 | .weui-icon-radio {
129 | margin-left: 3.2px;
130 | margin-right: 3.2px;
131 | }
132 | .weui-icon-checkbox_circle,
133 | .weui-icon-checkbox_success {
134 | margin-left: 4.6px;
135 | margin-right: 4.6px;
136 | }
137 | .weui-check__label:active {
138 | background-color: #ECECEC;
139 | }
140 | .weui-check {
141 | position: absolute;
142 | left: -9999px;
143 | }
144 | .weui-check__hd_in-checkbox {
145 | padding-right: 0.35em;
146 | }
147 | .weui-cell__ft_in-radio {
148 | padding-left: 0.35em;
149 | }
150 | .weui-cell_input {
151 | padding-top: 0;
152 | padding-bottom: 0;
153 | }
154 | .weui-label {
155 | width: 105px;
156 | word-wrap: break-word;
157 | word-break: break-all;
158 | }
159 | .weui-input {
160 | height: 2.58823529em;
161 | min-height: 2.58823529em;
162 | line-height: 2.58823529em;
163 | }
164 | .weui-toptips {
165 | position: fixed;
166 | -webkit-transform: translateZ(0);
167 | transform: translateZ(0);
168 | top: 0;
169 | left: 0;
170 | right: 0;
171 | padding: 5px;
172 | font-size: 14px;
173 | text-align: center;
174 | color: #FFFFFF;
175 | z-index: 5000;
176 | word-wrap: break-word;
177 | word-break: break-all;
178 | }
179 | .weui-toptips_warn {
180 | background-color: #E64340;
181 | }
182 | .weui-textarea {
183 | display: block;
184 | width: 100%;
185 | }
186 | .weui-textarea-counter {
187 | color: #B2B2B2;
188 | text-align: right;
189 | }
190 | .weui-textarea-counter_warn {
191 | color: #E64340;
192 | }
193 | .weui-cell_warn {
194 | color: #E64340;
195 | }
196 | .weui-form-preview {
197 | position: relative;
198 | background-color: #FFFFFF;
199 | }
200 | .weui-form-preview:before {
201 | content: " ";
202 | position: absolute;
203 | left: 0;
204 | top: 0;
205 | right: 0;
206 | height: 1px;
207 | border-top: 1rpx solid #D9D9D9;
208 | color: #D9D9D9;
209 | }
210 | .weui-form-preview:after {
211 | content: " ";
212 | position: absolute;
213 | left: 0;
214 | bottom: 0;
215 | right: 0;
216 | height: 1px;
217 | border-bottom: 1rpx solid #D9D9D9;
218 | color: #D9D9D9;
219 | }
220 | .weui-form-preview__value {
221 | font-size: 14px;
222 | }
223 | .weui-form-preview__value_in-hd {
224 | font-size: 26px;
225 | }
226 | .weui-form-preview__hd {
227 | position: relative;
228 | padding: 10px 15px;
229 | text-align: right;
230 | line-height: 2.5em;
231 | }
232 | .weui-form-preview__hd:after {
233 | content: " ";
234 | position: absolute;
235 | left: 0;
236 | bottom: 0;
237 | right: 0;
238 | height: 1px;
239 | border-bottom: 1rpx solid #D9D9D9;
240 | color: #D9D9D9;
241 | left: 15px;
242 | }
243 | .weui-form-preview__bd {
244 | padding: 10px 15px;
245 | font-size: .9em;
246 | text-align: right;
247 | color: #999999;
248 | line-height: 2;
249 | }
250 | .weui-form-preview__ft {
251 | position: relative;
252 | line-height: 50px;
253 | display: -webkit-box;
254 | display: -webkit-flex;
255 | display: flex;
256 | }
257 | .weui-form-preview__ft:after {
258 | content: " ";
259 | position: absolute;
260 | left: 0;
261 | top: 0;
262 | right: 0;
263 | height: 1px;
264 | border-top: 1rpx solid #D5D5D6;
265 | color: #D5D5D6;
266 | }
267 | .weui-form-preview__item {
268 | overflow: hidden;
269 | }
270 | .weui-form-preview__label {
271 | float: left;
272 | margin-right: 1em;
273 | min-width: 4em;
274 | color: #999999;
275 | text-align: justify;
276 | text-align-last: justify;
277 | }
278 | .weui-form-preview__value {
279 | display: block;
280 | overflow: hidden;
281 | word-break: normal;
282 | word-wrap: break-word;
283 | }
284 | .weui-form-preview__btn {
285 | position: relative;
286 | display: block;
287 | -webkit-box-flex: 1;
288 | -webkit-flex: 1;
289 | flex: 1;
290 | color: #3CC51F;
291 | text-align: center;
292 | }
293 | .weui-form-preview__btn:after {
294 | content: " ";
295 | position: absolute;
296 | left: 0;
297 | top: 0;
298 | width: 1px;
299 | bottom: 0;
300 | border-left: 1rpx solid #D5D5D6;
301 | color: #D5D5D6;
302 | }
303 | .weui-form-preview__btn:first-child:after {
304 | display: none;
305 | }
306 | .weui-form-preview__btn_active {
307 | background-color: #EEEEEE;
308 | }
309 | .weui-form-preview__btn_default {
310 | color: #999999;
311 | }
312 | .weui-form-preview__btn_primary {
313 | color: #0BB20C;
314 | }
315 | .weui-cell_select {
316 | padding: 0;
317 | }
318 | .weui-select {
319 | position: relative;
320 | padding-left: 15px;
321 | padding-right: 30px;
322 | height: 2.58823529em;
323 | min-height: 2.58823529em;
324 | line-height: 2.58823529em;
325 | border-right: 1rpx solid #D9D9D9;
326 | }
327 | .weui-select:before {
328 | content: " ";
329 | display: inline-block;
330 | height: 6px;
331 | width: 6px;
332 | border-width: 2px 2px 0 0;
333 | border-color: #C8C8CD;
334 | border-style: solid;
335 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
336 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
337 | position: relative;
338 | top: -2px;
339 | position: absolute;
340 | top: 50%;
341 | right: 15px;
342 | margin-top: -4px;
343 | }
344 | .weui-select_in-select-after {
345 | padding-left: 0;
346 | }
347 | .weui-cell__hd_in-select-after,
348 | .weui-cell__bd_in-select-before {
349 | padding-left: 15px;
350 | }
351 | .weui-cell_vcode {
352 | padding-right: 0;
353 | }
354 | .weui-vcode-img {
355 | margin-left: 5px;
356 | height: 2.58823529em;
357 | vertical-align: middle;
358 | }
359 | .weui-vcode-btn {
360 | display: inline-block;
361 | height: 2.58823529em;
362 | margin-left: 5px;
363 | padding: 0 0.6em 0 0.7em;
364 | border-left: 1px solid #E5E5E5;
365 | line-height: 2.58823529em;
366 | vertical-align: middle;
367 | font-size: 17px;
368 | color: #3CC51F;
369 | white-space: nowrap;
370 | }
371 | .weui-vcode-btn:active {
372 | color: #52a341;
373 | }
374 | .weui-cell_switch {
375 | padding-top: 6px;
376 | padding-bottom: 6px;
377 | }
378 | .weui-uploader__hd {
379 | display: -webkit-box;
380 | display: -webkit-flex;
381 | display: flex;
382 | padding-bottom: 10px;
383 | -webkit-box-align: center;
384 | -webkit-align-items: center;
385 | align-items: center;
386 | }
387 | .weui-uploader__title {
388 | -webkit-box-flex: 1;
389 | -webkit-flex: 1;
390 | flex: 1;
391 | }
392 | .weui-uploader__info {
393 | color: #B2B2B2;
394 | }
395 | .weui-uploader__bd {
396 | margin-bottom: -4px;
397 | margin-right: -9px;
398 | overflow: hidden;
399 | }
400 | .weui-uploader__file {
401 | float: left;
402 | margin-right: 9px;
403 | margin-bottom: 9px;
404 | }
405 | .weui-uploader__img {
406 | display: block;
407 | width: 118rpx;
408 | height: 118rpx;
409 | }
410 | .weui-uploader__file_status {
411 | position: relative;
412 | }
413 | .weui-uploader__file_status:before {
414 | content: " ";
415 | position: absolute;
416 | top: 0;
417 | right: 0;
418 | bottom: 0;
419 | left: 0;
420 | background-color: rgba(0, 0, 0, 0.5);
421 | }
422 | .weui-uploader__file-content {
423 | position: absolute;
424 | top: 50%;
425 | left: 50%;
426 | -webkit-transform: translate(-50%, -50%);
427 | transform: translate(-50%, -50%);
428 | color: #FFFFFF;
429 | }
430 | .weui-uploader__input-box {
431 | float: left;
432 | position: relative;
433 | margin-right: 9px;
434 | margin-bottom: 9px;
435 | width:118rpx;
436 | height: 118rpx;
437 | border: 1px solid #D9D9D9;
438 | }
439 | .weui-uploader__input-box:before,
440 | .weui-uploader__input-box:after {
441 | content: " ";
442 | position: absolute;
443 | top: 50%;
444 | left: 50%;
445 | -webkit-transform: translate(-50%, -50%);
446 | transform: translate(-50%, -50%);
447 | background-color: #D9D9D9;
448 | }
449 | .weui-uploader__input-box:before {
450 | width: 2px;
451 | height: 39.5px;
452 | }
453 | .weui-uploader__input-box:after {
454 | width: 39.5px;
455 | height: 2px;
456 | }
457 | .weui-uploader__input-box:active {
458 | border-color: #999999;
459 | }
460 | .weui-uploader__input-box:active:before,
461 | .weui-uploader__input-box:active:after {
462 | background-color: #999999;
463 | }
464 | .weui-uploader__input {
465 | position: absolute;
466 | z-index: 1;
467 | top: 0;
468 | left: 0;
469 | width: 100%;
470 | height: 100%;
471 | opacity: 0;
472 | }
473 | .weui-article {
474 | padding: 20px 15px;
475 | font-size: 15px;
476 | }
477 | .weui-article__section {
478 | margin-bottom: 1.5em;
479 | }
480 | .weui-article__h1 {
481 | font-size: 18px;
482 | font-weight: 400;
483 | margin-bottom: .9em;
484 | }
485 | .weui-article__h2 {
486 | font-size: 16px;
487 | font-weight: 400;
488 | margin-bottom: .34em;
489 | }
490 | .weui-article__h3 {
491 | font-weight: 400;
492 | font-size: 15px;
493 | margin-bottom: .34em;
494 | }
495 | .weui-article__p {
496 | margin: 0 0 .8em;
497 | }
498 | .weui-msg {
499 | padding-top: 36px;
500 | text-align: center;
501 | }
502 | .weui-msg__link {
503 | display: inline;
504 | color: #586C94;
505 | }
506 | .weui-msg__icon-area {
507 | margin-bottom: 30px;
508 | }
509 | .weui-msg__text-area {
510 | margin-bottom: 25px;
511 | padding: 0 20px;
512 | }
513 | .weui-msg__title {
514 | margin-bottom: 5px;
515 | font-weight: 400;
516 | font-size: 20px;
517 | }
518 | .weui-msg__desc {
519 | font-size: 14px;
520 | color: #999999;
521 | }
522 | .weui-msg__opr-area {
523 | margin-bottom: 25px;
524 | }
525 | .weui-msg__extra-area {
526 | margin-bottom: 15px;
527 | font-size: 14px;
528 | color: #999999;
529 | }
530 | @media screen and (min-height: 438px) {
531 | .weui-msg__extra-area {
532 | position: fixed;
533 | left: 0;
534 | bottom: 0;
535 | width: 100%;
536 | text-align: center;
537 | }
538 | }
539 | .weui-flex {
540 | display: -webkit-box;
541 | display: -webkit-flex;
542 | display: flex;
543 | }
544 | .weui-flex__item {
545 | -webkit-box-flex: 1;
546 | -webkit-flex: 1;
547 | flex: 1;
548 | }
549 | .weui-btn {
550 | margin-top: 15px;
551 | }
552 | .weui-btn:first-child {
553 | margin-top: 0;
554 | }
555 | .weui-btn-area {
556 | margin: 1.17647059em 15px 0.3em;
557 | }
558 | .weui-agree {
559 | display: block;
560 | padding: .5em 15px;
561 | font-size: 13px;
562 | }
563 | .weui-agree__text {
564 | color: #999999;
565 | }
566 | .weui-agree__link {
567 | display: inline;
568 | color: #586C94;
569 | }
570 | .weui-agree__checkbox {
571 | position: absolute;
572 | left: -9999px;
573 | }
574 | .weui-agree__checkbox-icon {
575 | position: relative;
576 | top: 2px;
577 | display: inline-block;
578 | border: 1px solid #D1D1D1;
579 | background-color: #FFFFFF;
580 | border-radius: 3px;
581 | width: 11px;
582 | height: 11px;
583 | }
584 | .weui-agree__checkbox-icon-check {
585 | position: absolute;
586 | top: 1px;
587 | left: 1px;
588 | }
589 | .weui-footer {
590 | color: #999999;
591 | font-size: 14px;
592 | text-align: center;
593 | }
594 | .weui-footer_fixed-bottom {
595 | position: fixed;
596 | bottom: .52em;
597 | left: 0;
598 | right: 0;
599 | }
600 | .weui-footer__links {
601 | font-size: 0;
602 | }
603 | .weui-footer__link {
604 | display: inline-block;
605 | vertical-align: top;
606 | margin: 0 .62em;
607 | position: relative;
608 | font-size: 14px;
609 | color: #586C94;
610 | }
611 | .weui-footer__link:before {
612 | content: " ";
613 | position: absolute;
614 | left: 0;
615 | top: 0;
616 | width: 1px;
617 | bottom: 0;
618 | border-left: 1rpx solid #C7C7C7;
619 | color: #C7C7C7;
620 | left: -0.65em;
621 | top: .36em;
622 | bottom: .36em;
623 | }
624 | .weui-footer__link:first-child:before {
625 | display: none;
626 | }
627 | .weui-footer__text {
628 | padding: 0 .34em;
629 | font-size: 12px;
630 | }
631 | .weui-grids {
632 | border-top: 1rpx solid #D9D9D9;
633 | border-left: 1rpx solid #D9D9D9;
634 | overflow: hidden;
635 | }
636 | .weui-grid {
637 | position: relative;
638 | float: left;
639 | padding: 20px 10px;
640 | width: 33.33333333%;
641 | box-sizing: border-box;
642 | border-right: 1rpx solid #D9D9D9;
643 | border-bottom: 1rpx solid #D9D9D9;
644 | }
645 | .weui-grid_active {
646 | background-color: #ECECEC;
647 | }
648 | .weui-grid__icon {
649 | display: block;
650 | width: 28px;
651 | height: 28px;
652 | margin: 0 auto;
653 | }
654 | .weui-grid__label {
655 | margin-top: 5px;
656 | display: block;
657 | text-align: center;
658 | color: #000000;
659 | font-size: 14px;
660 | white-space: nowrap;
661 | text-overflow: ellipsis;
662 | overflow: hidden;
663 | }
664 | .weui-loading {
665 | margin: 0 5px;
666 | width: 20px;
667 | height: 20px;
668 | display: inline-block;
669 | vertical-align: middle;
670 | -webkit-animation: weuiLoading 1s steps(12, end) infinite;
671 | animation: weuiLoading 1s steps(12, end) infinite;
672 | background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;
673 | background-size: 100%;
674 | }
675 | .weui-loading.weui-loading_transparent {
676 | background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E");
677 | }
678 | @-webkit-keyframes weuiLoading {
679 | 0% {
680 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
681 | transform: rotate3d(0, 0, 1, 0deg);
682 | }
683 | 100% {
684 | -webkit-transform: rotate3d(0, 0, 1, 360deg);
685 | transform: rotate3d(0, 0, 1, 360deg);
686 | }
687 | }
688 | @keyframes weuiLoading {
689 | 0% {
690 | -webkit-transform: rotate3d(0, 0, 1, 0deg);
691 | transform: rotate3d(0, 0, 1, 0deg);
692 | }
693 | 100% {
694 | -webkit-transform: rotate3d(0, 0, 1, 360deg);
695 | transform: rotate3d(0, 0, 1, 360deg);
696 | }
697 | }
698 | .weui-badge {
699 | display: inline-block;
700 | padding: .15em .4em;
701 | min-width: 8px;
702 | border-radius: 18px;
703 | background-color: #E64340;
704 | color: #FFFFFF;
705 | line-height: 1.2;
706 | text-align: center;
707 | font-size: 12px;
708 | vertical-align: middle;
709 | }
710 | .weui-badge_dot {
711 | padding: .4em;
712 | min-width: 0;
713 | }
714 | .weui-loadmore {
715 | width: 65%;
716 | margin: 1.5em auto;
717 | line-height: 1.6em;
718 | font-size: 14px;
719 | text-align: center;
720 | }
721 | .weui-loadmore__tips {
722 | display: inline-block;
723 | vertical-align: middle;
724 | }
725 | .weui-loadmore_line {
726 | border-top: 1px solid #E5E5E5;
727 | margin-top: 2.4em;
728 | }
729 | .weui-loadmore__tips_in-line {
730 | position: relative;
731 | top: -0.9em;
732 | padding: 0 .55em;
733 | background-color: #FFFFFF;
734 | color: #999999;
735 | }
736 | .weui-loadmore__tips_in-dot {
737 | position: relative;
738 | padding: 0 .16em;
739 | width: 4px;
740 | height: 1.6em;
741 | }
742 | .weui-loadmore__tips_in-dot:before {
743 | content: " ";
744 | position: absolute;
745 | top: 50%;
746 | left: 50%;
747 | margin-top: -1px;
748 | margin-left: -2px;
749 | width: 4px;
750 | height: 4px;
751 | border-radius: 50%;
752 | background-color: #E5E5E5;
753 | }
754 | .weui-panel {
755 | background-color: #FFFFFF;
756 | margin-top: 10px;
757 | position: relative;
758 | overflow: hidden;
759 | }
760 | .weui-panel:first-child {
761 | margin-top: 0;
762 | }
763 | .weui-panel:before {
764 | content: " ";
765 | position: absolute;
766 | left: 0;
767 | top: 0;
768 | right: 0;
769 | height: 1px;
770 | border-top: 1rpx solid #E5E5E5;
771 | color: #E5E5E5;
772 | }
773 | .weui-panel:after {
774 | content: " ";
775 | position: absolute;
776 | left: 0;
777 | bottom: 0;
778 | right: 0;
779 | height: 1px;
780 | border-bottom: 1rpx solid #E5E5E5;
781 | color: #E5E5E5;
782 | }
783 | .weui-panel__hd {
784 | padding: 14px 15px 10px;
785 | color: #999999;
786 | font-size: 13px;
787 | position: relative;
788 | }
789 | .weui-panel__hd:after {
790 | content: " ";
791 | position: absolute;
792 | left: 0;
793 | bottom: 0;
794 | right: 0;
795 | height: 1px;
796 | border-bottom: 1rpx solid #E5E5E5;
797 | color: #E5E5E5;
798 | left: 15px;
799 | }
800 | .weui-media-box {
801 | padding: 15px;
802 | position: relative;
803 | }
804 | .weui-media-box:before {
805 | content: " ";
806 | position: absolute;
807 | left: 0;
808 | top: 0;
809 | right: 0;
810 | height: 1px;
811 | border-top: 1rpx solid #E5E5E5;
812 | color: #E5E5E5;
813 | left: 15px;
814 | }
815 | .weui-media-box:first-child:before {
816 | display: none;
817 | }
818 | .weui-media-box__title {
819 | font-weight: 400;
820 | font-size: 17px;
821 | width: auto;
822 | overflow: hidden;
823 | text-overflow: ellipsis;
824 | white-space: nowrap;
825 | word-wrap: normal;
826 | word-wrap: break-word;
827 | word-break: break-all;
828 | }
829 | .weui-media-box__desc {
830 | color: #999999;
831 | font-size: 13px;
832 | line-height: 1.2;
833 | overflow: hidden;
834 | text-overflow: ellipsis;
835 | display: -webkit-box;
836 | -webkit-box-orient: vertical;
837 | -webkit-line-clamp: 2;
838 | }
839 | .weui-media-box__info {
840 | margin-top: 15px;
841 | padding-bottom: 5px;
842 | font-size: 13px;
843 | color: #CECECE;
844 | line-height: 1em;
845 | list-style: none;
846 | overflow: hidden;
847 | }
848 | .weui-media-box__info__meta {
849 | float: left;
850 | padding-right: 1em;
851 | }
852 | .weui-media-box__info__meta_extra {
853 | padding-left: 1em;
854 | border-left: 1px solid #CECECE;
855 | }
856 | .weui-media-box__title_in-text {
857 | margin-bottom: 8px;
858 | }
859 | .weui-media-box_appmsg {
860 | display: -webkit-box;
861 | display: -webkit-flex;
862 | display: flex;
863 | -webkit-box-align: center;
864 | -webkit-align-items: center;
865 | align-items: center;
866 | }
867 | .weui-media-box__thumb {
868 | width: 100%;
869 | height: 100%;
870 | vertical-align: top;
871 | }
872 | .weui-media-box__hd_in-appmsg {
873 | margin-right: .8em;
874 | width: 60px;
875 | height: 60px;
876 | line-height: 60px;
877 | text-align: center;
878 | }
879 | .weui-media-box__bd_in-appmsg {
880 | -webkit-box-flex: 1;
881 | -webkit-flex: 1;
882 | flex: 1;
883 | min-width: 0;
884 | }
885 | .weui-media-box_small-appmsg {
886 | padding: 0;
887 | }
888 | .weui-cells_in-small-appmsg {
889 | margin-top: 0;
890 | }
891 | .weui-cells_in-small-appmsg:before {
892 | display: none;
893 | }
894 | .weui-progress {
895 | display: -webkit-box;
896 | display: -webkit-flex;
897 | display: flex;
898 | -webkit-box-align: center;
899 | -webkit-align-items: center;
900 | align-items: center;
901 | }
902 | .weui-progress__bar {
903 | -webkit-box-flex: 1;
904 | -webkit-flex: 1;
905 | flex: 1;
906 | }
907 | .weui-progress__opr {
908 | margin-left: 15px;
909 | font-size: 0;
910 | }
911 | .weui-navbar {
912 | display: -webkit-box;
913 | display: -webkit-flex;
914 | display: flex;
915 | position: absolute;
916 | z-index: 500;
917 | top: 0;
918 | width: 100%;
919 | border-bottom: 1rpx solid #CCCCCC;
920 | }
921 | .weui-navbar__item {
922 | position: relative;
923 | display: block;
924 | -webkit-box-flex: 1;
925 | -webkit-flex: 1;
926 | flex: 1;
927 | padding: 13px 0;
928 | text-align: center;
929 | font-size: 0;
930 | }
931 | .weui-navbar__item.weui-bar__item_on {
932 | color: #1AAD19;
933 | }
934 | .weui-navbar__slider {
935 | position: absolute;
936 | content: " ";
937 | left: 0;
938 | bottom: 0;
939 | width: 6em;
940 | height: 3px;
941 | background-color: #1AAD19;
942 | -webkit-transition: -webkit-transform .3s;
943 | transition: -webkit-transform .3s;
944 | transition: transform .3s;
945 | transition: transform .3s, -webkit-transform .3s;
946 | }
947 | .weui-navbar__title {
948 | display: inline-block;
949 | font-size: 15px;
950 | max-width: 8em;
951 | width: auto;
952 | overflow: hidden;
953 | text-overflow: ellipsis;
954 | white-space: nowrap;
955 | word-wrap: normal;
956 | }
957 | .weui-tab {
958 | position: relative;
959 | height: 100%;
960 | }
961 | .weui-tab__panel {
962 | box-sizing: border-box;
963 | height: 100%;
964 | padding-top: 50px;
965 | overflow: auto;
966 | -webkit-overflow-scrolling: touch;
967 | }
968 | .weui-search-bar {
969 | position: relative;
970 | padding: 8px 10px;
971 | display: -webkit-box;
972 | display: -webkit-flex;
973 | display: flex;
974 | box-sizing: border-box;
975 | background-color: #EFEFF4;
976 | border-top: 1rpx solid #D7D6DC;
977 | border-bottom: 1rpx solid #D7D6DC;
978 | }
979 | .weui-icon-search {
980 | margin-right: 8px;
981 | font-size: inherit;
982 | }
983 | .weui-icon-search_in-box {
984 | position: absolute;
985 | left: 10px;
986 | top: 7px;
987 | }
988 | .weui-search-bar__text {
989 | display: inline-block;
990 | font-size: 14px;
991 | vertical-align: middle;
992 | }
993 | .weui-search-bar__form {
994 | position: relative;
995 | -webkit-box-flex: 1;
996 | -webkit-flex: auto;
997 | flex: auto;
998 | border-radius: 5px;
999 | background: #FFFFFF;
1000 | border: 1rpx solid #E6E6EA;
1001 | }
1002 | .weui-search-bar__box {
1003 | position: relative;
1004 | padding-left: 30px;
1005 | padding-right: 30px;
1006 | width: 100%;
1007 | box-sizing: border-box;
1008 | z-index: 1;
1009 | }
1010 | .weui-search-bar__input {
1011 | height: 28px;
1012 | line-height: 28px;
1013 | font-size: 14px;
1014 | }
1015 | .weui-icon-clear {
1016 | position: absolute;
1017 | top: 0;
1018 | right: 0;
1019 | padding: 7px 8px;
1020 | font-size: 0;
1021 | }
1022 | .weui-search-bar__label {
1023 | position: absolute;
1024 | top: 0;
1025 | right: 0;
1026 | bottom: 0;
1027 | left: 0;
1028 | z-index: 2;
1029 | border-radius: 3px;
1030 | text-align: center;
1031 | color: #9B9B9B;
1032 | background: #FFFFFF;
1033 | line-height: 28px;
1034 | }
1035 | .weui-search-bar__cancel-btn {
1036 | margin-left: 10px;
1037 | line-height: 28px;
1038 | color: #09BB07;
1039 | white-space: nowrap;
1040 | }
1041 |
--------------------------------------------------------------------------------
/utils/api.js:
--------------------------------------------------------------------------------
1 | // 主地址
2 | const api = 'https://newerds.51cptj.com/index.php/Home/Index/';
3 | // 登录
4 | const v1 = 'login';
5 | function login() {
6 | return api + v1;
7 | };
8 | // 获取Banner
9 | const v2 = 'getBanner';
10 | function getBanner() {
11 | return api + v2;
12 | };
13 | // 保存用户信息
14 | const v3 = 'check_login';
15 | function checkLogin() {
16 | return api + v3;
17 | };
18 | // 个人中心
19 | const v4 = 'getUser';
20 | function getUser() {
21 | return api + v4;
22 | };
23 | // 分类列表信息
24 | const v5 = 'getType';
25 | function getType() {
26 | return api + v5;
27 | };
28 | // 获取区域列表
29 | const v6 = 'getArea';
30 | function getArea() {
31 | return api + v6;
32 | };
33 | // 发布新需求
34 | const v7 = 'addNotice';
35 | function addNotice() {
36 | return api + v7;
37 | };
38 | // 获取便民信息列表
39 | const v8 = 'getUserTypeList';
40 | function getUserTypeList() {
41 | return api + v8;
42 | };
43 | // 获取个人发布列表
44 | const v9 = 'getUserList';
45 | function getUserList() {
46 | return api + v9;
47 | };
48 | // 删除个人已发布信息
49 | const v10 = 'noticeDel';
50 | function noticeDel() {
51 | return api + v10;
52 | };
53 | // 获取商家活动详情图
54 | const v11 = 'getQupic';
55 | function getQupic() {
56 | return api + v11;
57 | };
58 | // 获取Banner详情
59 | const v12 = 'getBannerDetial';
60 | function getBannerDetial() {
61 | return api + v12;
62 | };
63 | const v13 = 'deal_many_pic';
64 | function addNoticePic() {
65 | return api + v13;
66 | };
67 | //获取个人发布单条信息
68 | const v14 = 'noticeList';
69 | function getUserListOne() {
70 | return api + v14;
71 | };
72 | //获取公司配置信息
73 | const v15 = 'getPeizhi';
74 | function getPeizhi() {
75 | return api + v15;
76 | };
77 |
78 | //获取类目信息
79 | const v16 = 'getTypes';
80 | function getTypes() {
81 | return api + v16;
82 | };
83 |
84 |
85 | //修改发布信息
86 | const v17 = 'editNotice';
87 | function editNotice() {
88 | return api + v17;
89 | };
90 |
91 | //获取类目
92 | const v18 = 'getTname';
93 | function getTname() {
94 | return api + v18;
95 | };
96 | //获取区域
97 | const v19 = 'getAname';
98 | function getAname() {
99 | return api + v19;
100 | };
101 | //获取默认地区
102 | const v20 = 'getMapList';
103 | function getMapList() {
104 | return api + v20;
105 | };
106 |
107 |
108 | module.exports = {
109 | login: login,
110 | getBanner: getBanner,
111 | checkLogin: checkLogin,
112 | getUser: getUser,
113 | getType: getType,
114 | getArea: getArea,
115 | addNotice: addNotice,
116 | getUserTypeList: getUserTypeList,
117 | getUserList: getUserList,
118 | noticeDel: noticeDel,
119 | getQupic: getQupic,
120 | getBannerDetial:getBannerDetial,
121 | addNoticePic:addNoticePic,
122 | getUserListOne: getUserListOne,
123 | getPeizhi: getPeizhi,
124 | getTypes: getTypes,
125 | editNotice: editNotice,
126 | getTname: getTname,
127 | getAname: getAname,
128 | getMapList: getMapList
129 | };
--------------------------------------------------------------------------------
/utils/request.js:
--------------------------------------------------------------------------------
1 | var api = require('./api.js');
2 | var app = getApp();
3 | /**
4 | * 网络请求方法
5 | * @param url {string} 请求url
6 | * @param data {object} 参数
7 | * @param successCallback {function} 成功回调函数
8 | * @param errorCallback {function} 失败回调函数
9 | * @param completeCallback {function} 完成回调函数
10 | * @returns {void}
11 | */
12 |
13 | function requestData(url, data0, successCallback, errorCallback) {
14 | wx.request({
15 | url: url,
16 | method: 'POST',
17 | data: data0,
18 | success: function (res) {
19 | successCallback(res);
20 | },
21 | error: function (res) {
22 | errorCallback(res);
23 | },
24 | });
25 | }
26 | function requestDataPic(url, data0, imageList, successCallback, errorCallback) {
27 | wx.uploadFile({
28 | url: url,
29 | filePath: imageList,
30 | name: 'file',
31 | formData: data0,
32 | success: function (res) {
33 | successCallback(res);
34 | },
35 | error: function (res) {
36 | errorCallback(res);
37 | },
38 | })
39 | }
40 | // 授权登录
41 | function login(data0, successCallback, errorCallback) {
42 | requestData(api.login(), data0, successCallback, errorCallback);
43 | }
44 | // 获取Banner
45 | function getBanner(data0, successCallback, errorCallback) {
46 | requestData(api.getBanner(), data0, successCallback, errorCallback);
47 | }
48 | // 存储用户信息
49 | function checkLogin(data, successCallback, errorCallback) {
50 | requestData(api.checkLogin(), data, successCallback, errorCallback);
51 | }
52 | // 个人中心
53 | function getUser(data, successCallback, errorCallback) {
54 | requestData(api.getUser(), data, successCallback, errorCallback);
55 | }
56 | // 分类列表信息
57 | function getType(data, successCallback, errorCallback) {
58 | requestData(api.getType(), data, successCallback, errorCallback);
59 | }
60 | // 获取区域列表
61 | function getArea(data, successCallback, errorCallback) {
62 | requestData(api.getArea(), data, successCallback, errorCallback);
63 | }
64 | // 发布新需求
65 | function addNotice(data, successCallback, errorCallback) {
66 | requestData(api.addNotice(), data, successCallback, errorCallback);
67 | }
68 | // 修改一条需求
69 | function editNotice(data, successCallback, errorCallback) {
70 | requestData(api.editNotice(), data, successCallback, errorCallback);
71 | }
72 | // 发布新需求(有图)
73 | function addNoticePic(data, imageList, successCallback, errorCallback) {
74 | requestDataPic(api.addNoticePic(), data, imageList, successCallback, errorCallback);
75 | }
76 | // 获取便民信息列表
77 | function getUserTypeList(data, successCallback, errorCallback) {
78 | requestData(api.getUserTypeList(), data, successCallback, errorCallback);
79 | }
80 | // 获取个人发布列表
81 | function getUserList(data, successCallback, errorCallback) {
82 | requestData(api.getUserList(), data, successCallback, errorCallback);
83 | }
84 | // 获取个人发布列表单条信息
85 | function getUserListOne(data, successCallback, errorCallback) {
86 | requestData(api.getUserListOne(), data, successCallback, errorCallback);
87 | }
88 | // 删除个人已发布信息
89 | function noticeDel(data, successCallback, errorCallback) {
90 | requestData(api.noticeDel(), data, successCallback, errorCallback);
91 | }
92 | // 获取每日趣图
93 | function getQupic(data, successCallback, errorCallback) {
94 | requestData(api.getQupic(), data, successCallback, errorCallback);
95 | }
96 | // 获取Banner详情
97 | function getBannerDetial(data, successCallback, errorCallback) {
98 | requestData(api.getBannerDetial(), data, successCallback, errorCallback);
99 | }
100 | // 获取公司配置信息
101 | function getPeizhi(data, successCallback, errorCallback) {
102 | requestData(api.getPeizhi(), data, successCallback, errorCallback);
103 | }
104 | // 获取类目信息
105 | function getTypes(data, successCallback, errorCallback) {
106 | requestData(api.getTypes(), data, successCallback, errorCallback);
107 | }
108 | // 获取类目名称
109 | function getTname(data, successCallback, errorCallback) {
110 | requestData(api.getTname(), data, successCallback, errorCallback);
111 | }
112 | // 获取地区名称
113 | function getAname(data, successCallback, errorCallback) {
114 | requestData(api.getAname(), data, successCallback, errorCallback);
115 | }
116 |
117 | // 获取默认地区
118 | function getMapList(data, successCallback, errorCallback) {
119 | requestData(api.getMapList(), data, successCallback, errorCallback);
120 | }
121 |
122 |
123 | module.exports = {
124 | login: login,
125 | getBanner: getBanner,
126 | checkLogin: checkLogin,
127 | getUser: getUser,
128 | getType: getType,
129 | getArea: getArea,
130 | addNotice: addNotice,
131 | getUserTypeList: getUserTypeList,
132 | getUserList: getUserList,
133 | getUserListOne: getUserListOne,
134 | noticeDel: noticeDel,
135 | getQupic: getQupic,
136 | getBannerDetial: getBannerDetial,
137 | addNoticePic: addNoticePic,
138 | getPeizhi: getPeizhi,
139 | getTypes: getTypes,
140 | editNotice: editNotice,
141 | getTname: getTname,
142 | getAname: getAname,
143 | getMapList: getMapList
144 | };
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | function formatTime(date) {
2 | if(!date){
3 | date = new Date();
4 | }
5 |
6 | var year = date.getFullYear()
7 | var month = date.getMonth() + 1
8 | var day = date.getDate()
9 |
10 | var hour = date.getHours()
11 | var minute = date.getMinutes()
12 | var second = date.getSeconds();
13 |
14 |
15 | return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
16 | }
17 |
18 | function formatNumber(n) {
19 | n = n.toString()
20 | return n[1] ? n : '0' + n
21 | }
22 |
23 | function isPlainObject(obj) {
24 | for (var name in obj) {
25 | return false;
26 | }
27 | return true;
28 | }
29 |
30 | function isPhoneNumber(num) {
31 | return /^1\d{10}$/.test(num);
32 | }
33 |
34 | module.exports = {
35 | formatTime: formatTime,
36 | isPlainObject: isPlainObject,
37 | isPhoneNumber: isPhoneNumber
38 | }
39 |
40 |
41 | //截取字符串长度替换--处理title过长的问题
42 | function cutTitleString(title, start, end) {
43 | if (title.length > end) {
44 | title = title.substring(start, end) + "···";
45 | }
46 | return title;
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/wxParse.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JamesZZH/dalian/a9ffd85040036a3178db33bc21cbcb1694a4367a/wxParse.zip
--------------------------------------------------------------------------------
/wxParse/html2json.js:
--------------------------------------------------------------------------------
1 | /**
2 | * html2Json 改造来自: https://github.com/Jxck/html2json
3 | *
4 | *
5 | * author: Di (微信小程序开发工程师)
6 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7 | * 垂直微信小程序开发交流社区
8 | *
9 | * github地址: https://github.com/icindy/wxParse
10 | *
11 | * for: 微信小程序富文本解析
12 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13 | */
14 |
15 | var __placeImgeUrlHttps = "https";
16 | var __emojisReg = '';
17 | var __emojisBaseSrc = '';
18 | var __emojis = {};
19 | var wxDiscode = require('./wxDiscode.js');
20 | var HTMLParser = require('./htmlparser.js');
21 | // Empty Elements - HTML 5
22 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
23 | // Block Elements - HTML 5
24 | var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
25 |
26 | // Inline Elements - HTML 5
27 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
28 |
29 | // Elements that you can, intentionally, leave open
30 | // (and which close themselves)
31 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
32 |
33 | // Attributes that have their values filled in disabled="disabled"
34 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
35 |
36 | // Special Elements (can contain anything)
37 | var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
38 | function makeMap(str) {
39 | var obj = {}, items = str.split(",");
40 | for (var i = 0; i < items.length; i++)
41 | obj[items[i]] = true;
42 | return obj;
43 | }
44 |
45 | function q(v) {
46 | return '"' + v + '"';
47 | }
48 |
49 | function removeDOCTYPE(html) {
50 | return html
51 | .replace(/<\?xml.*\?>\n/, '')
52 | .replace(/<.*!doctype.*\>\n/, '')
53 | .replace(/<.*!DOCTYPE.*\>\n/, '');
54 | }
55 |
56 |
57 | function html2json(html, bindName) {
58 | //处理字符串
59 | html = removeDOCTYPE(html);
60 | html = wxDiscode.strDiscode(html);
61 | //生成node节点
62 | var bufArray = [];
63 | var results = {
64 | node: bindName,
65 | nodes: [],
66 | images:[],
67 | imageUrls:[]
68 | };
69 | HTMLParser(html, {
70 | start: function (tag, attrs, unary) {
71 | //debug(tag, attrs, unary);
72 | // node for this element
73 | var node = {
74 | node: 'element',
75 | tag: tag,
76 | };
77 |
78 | if (block[tag]) {
79 | node.tagType = "block";
80 | } else if (inline[tag]) {
81 | node.tagType = "inline";
82 | } else if (closeSelf[tag]) {
83 | node.tagType = "closeSelf";
84 | }
85 |
86 | if (attrs.length !== 0) {
87 | node.attr = attrs.reduce(function (pre, attr) {
88 | var name = attr.name;
89 | var value = attr.value;
90 | if (name == 'class') {
91 | console.dir(value);
92 | // value = value.join("")
93 | node.classStr = value;
94 | }
95 | // has multi attibutes
96 | // make it array of attribute
97 | if (name == 'style') {
98 | console.dir(value);
99 | // value = value.join("")
100 | node.styleStr = value;
101 | }
102 | if (value.match(/ /)) {
103 | value = value.split(' ');
104 | }
105 |
106 |
107 | // if attr already exists
108 | // merge it
109 | if (pre[name]) {
110 | if (Array.isArray(pre[name])) {
111 | // already array, push to last
112 | pre[name].push(value);
113 | } else {
114 | // single value, make it array
115 | pre[name] = [pre[name], value];
116 | }
117 | } else {
118 | // not exist, put it
119 | pre[name] = value;
120 | }
121 |
122 | return pre;
123 | }, {});
124 | }
125 |
126 | //对img添加额外数据
127 | if (node.tag === 'img') {
128 | node.imgIndex = results.images.length;
129 | var imgUrl = node.attr.src;
130 | imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
131 | node.attr.src = imgUrl;
132 | node.from = bindName;
133 | results.images.push(node);
134 | results.imageUrls.push(imgUrl);
135 | }
136 | //临时记录source资源
137 | if(node.tag === 'source'){
138 | results.source = node.attr.src;
139 | }
140 |
141 | if (unary) {
142 | // if this tag dosen't have end tag
143 | // like
144 | // add to parents
145 | var parent = bufArray[0] || results;
146 | if (parent.nodes === undefined) {
147 | parent.nodes = [];
148 | }
149 | parent.nodes.push(node);
150 | } else {
151 | bufArray.unshift(node);
152 | }
153 | },
154 | end: function (tag) {
155 | //debug(tag);
156 | // merge into parent tag
157 | var node = bufArray.shift();
158 | if (node.tag !== tag) console.error('invalid state: mismatch end tag');
159 |
160 | //当有缓存source资源时于于video补上src资源
161 | if(node.tag === 'video' && results.source){
162 | node.attr.src = results.source;
163 | delete result.source;
164 | }
165 |
166 | if (bufArray.length === 0) {
167 | results.nodes.push(node);
168 | } else {
169 | var parent = bufArray[0];
170 | if (parent.nodes === undefined) {
171 | parent.nodes = [];
172 | }
173 | parent.nodes.push(node);
174 | }
175 | },
176 | chars: function (text) {
177 | //debug(text);
178 | var node = {
179 | node: 'text',
180 | text: text,
181 | textArray:transEmojiStr(text)
182 | };
183 |
184 | if (bufArray.length === 0) {
185 | results.nodes.push(node);
186 | } else {
187 | var parent = bufArray[0];
188 | if (parent.nodes === undefined) {
189 | parent.nodes = [];
190 | }
191 | parent.nodes.push(node);
192 | }
193 | },
194 | comment: function (text) {
195 | //debug(text);
196 | // var node = {
197 | // node: 'comment',
198 | // text: text,
199 | // };
200 | // var parent = bufArray[0];
201 | // if (parent.nodes === undefined) {
202 | // parent.nodes = [];
203 | // }
204 | // parent.nodes.push(node);
205 | },
206 | });
207 | return results;
208 | };
209 |
210 | function transEmojiStr(str){
211 | // var eReg = new RegExp("["+__reg+' '+"]");
212 | // str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
213 |
214 | var emojiObjs = [];
215 | //如果正则表达式为空
216 | if(__emojisReg.length == 0 || !__emojis){
217 | var emojiObj = {}
218 | emojiObj.node = "text";
219 | emojiObj.text = str;
220 | array = [emojiObj];
221 | return array;
222 | }
223 | //这个地方需要调整
224 | str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
225 | var eReg = new RegExp("[:]");
226 | var array = str.split(eReg);
227 | for(var i = 0; i < array.length; i++){
228 | var ele = array[i];
229 | var emojiObj = {};
230 | if(__emojis[ele]){
231 | emojiObj.node = "element";
232 | emojiObj.tag = "emoji";
233 | emojiObj.text = __emojis[ele];
234 | emojiObj.baseSrc= __emojisBaseSrc;
235 | }else{
236 | emojiObj.node = "text";
237 | emojiObj.text = ele;
238 | }
239 | emojiObjs.push(emojiObj);
240 | }
241 |
242 | return emojiObjs;
243 | }
244 |
245 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
246 | __emojisReg = reg;
247 | __emojisBaseSrc=baseSrc;
248 | __emojis=emojis;
249 | }
250 |
251 | module.exports = {
252 | html2json: html2json,
253 | emojisInit:emojisInit
254 | };
255 |
256 |
--------------------------------------------------------------------------------
/wxParse/htmlparser.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
4 | *
5 | * author: Di (微信小程序开发工程师)
6 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
7 | * 垂直微信小程序开发交流社区
8 | *
9 | * github地址: https://github.com/icindy/wxParse
10 | *
11 | * for: 微信小程序富文本解析
12 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
13 | */
14 | // Regular Expressions for parsing tags and attributes
15 | var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
16 | endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
17 | attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
18 |
19 | // Empty Elements - HTML 5
20 | var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
21 |
22 | // Block Elements - HTML 5
23 | var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
24 |
25 | // Inline Elements - HTML 5
26 | var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
27 |
28 | // Elements that you can, intentionally, leave open
29 | // (and which close themselves)
30 | var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
31 |
32 | // Attributes that have their values filled in disabled="disabled"
33 | var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
34 |
35 | // Special Elements (can contain anything)
36 | var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
37 |
38 | function HTMLParser(html, handler) {
39 | var index, chars, match, stack = [], last = html;
40 | stack.last = function () {
41 | return this[this.length - 1];
42 | };
43 |
44 | while (html) {
45 | chars = true;
46 |
47 | // Make sure we're not in a script or style element
48 | if (!stack.last() || !special[stack.last()]) {
49 |
50 | // Comment
51 | if (html.indexOf("");
53 |
54 | if (index >= 0) {
55 | if (handler.comment)
56 | handler.comment(html.substring(4, index));
57 | html = html.substring(index + 3);
58 | chars = false;
59 | }
60 |
61 | // end tag
62 | } else if (html.indexOf("") == 0) {
63 | match = html.match(endTag);
64 |
65 | if (match) {
66 | html = html.substring(match[0].length);
67 | match[0].replace(endTag, parseEndTag);
68 | chars = false;
69 | }
70 |
71 | // start tag
72 | } else if (html.indexOf("<") == 0) {
73 | match = html.match(startTag);
74 |
75 | if (match) {
76 | html = html.substring(match[0].length);
77 | match[0].replace(startTag, parseStartTag);
78 | chars = false;
79 | }
80 | }
81 |
82 | if (chars) {
83 | index = html.indexOf("<");
84 | var text = ''
85 | while (index === 0) {
86 | text += "<";
87 | html = html.substring(1);
88 | index = html.indexOf("<");
89 | }
90 | text += index < 0 ? html : html.substring(0, index);
91 | html = index < 0 ? "" : html.substring(index);
92 |
93 | if (handler.chars)
94 | handler.chars(text);
95 | }
96 |
97 | } else {
98 |
99 | html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
100 | text = text.replace(/|/g, "$1$2");
101 | if (handler.chars)
102 | handler.chars(text);
103 |
104 | return "";
105 | });
106 |
107 |
108 | parseEndTag("", stack.last());
109 | }
110 |
111 | if (html == last)
112 | throw "Parse Error: " + html;
113 | last = html;
114 | }
115 |
116 | // Clean up any remaining tags
117 | parseEndTag();
118 |
119 | function parseStartTag(tag, tagName, rest, unary) {
120 | tagName = tagName.toLowerCase();
121 |
122 | if (block[tagName]) {
123 | while (stack.last() && inline[stack.last()]) {
124 | parseEndTag("", stack.last());
125 | }
126 | }
127 |
128 | if (closeSelf[tagName] && stack.last() == tagName) {
129 | parseEndTag("", tagName);
130 | }
131 |
132 | unary = empty[tagName] || !!unary;
133 |
134 | if (!unary)
135 | stack.push(tagName);
136 |
137 | if (handler.start) {
138 | var attrs = [];
139 |
140 | rest.replace(attr, function (match, name) {
141 | var value = arguments[2] ? arguments[2] :
142 | arguments[3] ? arguments[3] :
143 | arguments[4] ? arguments[4] :
144 | fillAttrs[name] ? name : "";
145 |
146 | attrs.push({
147 | name: name,
148 | value: value,
149 | escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
150 | });
151 | });
152 |
153 | if (handler.start) {
154 | handler.start(tagName, attrs, unary);
155 | }
156 |
157 | }
158 | }
159 |
160 | function parseEndTag(tag, tagName) {
161 | // If no tag name is provided, clean shop
162 | if (!tagName)
163 | var pos = 0;
164 |
165 | // Find the closest opened tag of the same type
166 | else {
167 | tagName = tagName.toLowerCase();
168 | for (var pos = stack.length - 1; pos >= 0; pos--)
169 | if (stack[pos] == tagName)
170 | break;
171 | }
172 | if (pos >= 0) {
173 | // Close all the open elements, up the stack
174 | for (var i = stack.length - 1; i >= pos; i--)
175 | if (handler.end)
176 | handler.end(stack[i]);
177 |
178 | // Remove the open elements from the stack
179 | stack.length = pos;
180 | }
181 | }
182 | };
183 |
184 |
185 | function makeMap(str) {
186 | var obj = {}, items = str.split(",");
187 | for (var i = 0; i < items.length; i++)
188 | obj[items[i]] = true;
189 | return obj;
190 | }
191 |
192 | module.exports = HTMLParser;
193 |
--------------------------------------------------------------------------------
/wxParse/wxDiscode.js:
--------------------------------------------------------------------------------
1 | // HTML 支持的数学符号
2 | function strNumDiscode(str){
3 | str = str.replace(/∀/g, '∀');
4 | str = str.replace(/∂/g, '∂');
5 | str = str.replace(/&exists;/g, '∃');
6 | str = str.replace(/∅/g, '∅');
7 | str = str.replace(/∇/g, '∇');
8 | str = str.replace(/∈/g, '∈');
9 | str = str.replace(/∉/g, '∉');
10 | str = str.replace(/∋/g, '∋');
11 | str = str.replace(/∏/g, '∏');
12 | str = str.replace(/∑/g, '∑');
13 | str = str.replace(/−/g, '−');
14 | str = str.replace(/∗/g, '∗');
15 | str = str.replace(/√/g, '√');
16 | str = str.replace(/∝/g, '∝');
17 | str = str.replace(/∞/g, '∞');
18 | str = str.replace(/∠/g, '∠');
19 | str = str.replace(/∧/g, '∧');
20 | str = str.replace(/∨/g, '∨');
21 | str = str.replace(/∩/g, '∩');
22 | str = str.replace(/∩/g, '∪');
23 | str = str.replace(/∫/g, '∫');
24 | str = str.replace(/∴/g, '∴');
25 | str = str.replace(/∼/g, '∼');
26 | str = str.replace(/≅/g, '≅');
27 | str = str.replace(/≈/g, '≈');
28 | str = str.replace(/≠/g, '≠');
29 | str = str.replace(/≤/g, '≤');
30 | str = str.replace(/≥/g, '≥');
31 | str = str.replace(/⊂/g, '⊂');
32 | str = str.replace(/⊃/g, '⊃');
33 | str = str.replace(/⊄/g, '⊄');
34 | str = str.replace(/⊆/g, '⊆');
35 | str = str.replace(/⊇/g, '⊇');
36 | str = str.replace(/⊕/g, '⊕');
37 | str = str.replace(/⊗/g, '⊗');
38 | str = str.replace(/⊥/g, '⊥');
39 | str = str.replace(/⋅/g, '⋅');
40 | return str;
41 | }
42 |
43 | //HTML 支持的希腊字母
44 | function strGreeceDiscode(str){
45 | str = str.replace(/Α/g, 'Α');
46 | str = str.replace(/Β/g, 'Β');
47 | str = str.replace(/Γ/g, 'Γ');
48 | str = str.replace(/Δ/g, 'Δ');
49 | str = str.replace(/Ε/g, 'Ε');
50 | str = str.replace(/Ζ/g, 'Ζ');
51 | str = str.replace(/Η/g, 'Η');
52 | str = str.replace(/Θ/g, 'Θ');
53 | str = str.replace(/Ι/g, 'Ι');
54 | str = str.replace(/Κ/g, 'Κ');
55 | str = str.replace(/Λ/g, 'Λ');
56 | str = str.replace(/Μ/g, 'Μ');
57 | str = str.replace(/Ν/g, 'Ν');
58 | str = str.replace(/Ξ/g, 'Ν');
59 | str = str.replace(/Ο/g, 'Ο');
60 | str = str.replace(/Π/g, 'Π');
61 | str = str.replace(/Ρ/g, 'Ρ');
62 | str = str.replace(/Σ/g, 'Σ');
63 | str = str.replace(/Τ/g, 'Τ');
64 | str = str.replace(/Υ/g, 'Υ');
65 | str = str.replace(/Φ/g, 'Φ');
66 | str = str.replace(/Χ/g, 'Χ');
67 | str = str.replace(/Ψ/g, 'Ψ');
68 | str = str.replace(/Ω/g, 'Ω');
69 |
70 | str = str.replace(/α/g, 'α');
71 | str = str.replace(/β/g, 'β');
72 | str = str.replace(/γ/g, 'γ');
73 | str = str.replace(/δ/g, 'δ');
74 | str = str.replace(/ε/g, 'ε');
75 | str = str.replace(/ζ/g, 'ζ');
76 | str = str.replace(/η/g, 'η');
77 | str = str.replace(/θ/g, 'θ');
78 | str = str.replace(/ι/g, 'ι');
79 | str = str.replace(/κ/g, 'κ');
80 | str = str.replace(/λ/g, 'λ');
81 | str = str.replace(/μ/g, 'μ');
82 | str = str.replace(/ν/g, 'ν');
83 | str = str.replace(/ξ/g, 'ξ');
84 | str = str.replace(/ο/g, 'ο');
85 | str = str.replace(/π/g, 'π');
86 | str = str.replace(/ρ/g, 'ρ');
87 | str = str.replace(/ς/g, 'ς');
88 | str = str.replace(/σ/g, 'σ');
89 | str = str.replace(/τ/g, 'τ');
90 | str = str.replace(/υ/g, 'υ');
91 | str = str.replace(/φ/g, 'φ');
92 | str = str.replace(/χ/g, 'χ');
93 | str = str.replace(/ψ/g, 'ψ');
94 | str = str.replace(/ω/g, 'ω');
95 | str = str.replace(/ϑ/g, 'ϑ');
96 | str = str.replace(/ϒ/g, 'ϒ');
97 | str = str.replace(/ϖ/g, 'ϖ');
98 | str = str.replace(/·/g, '·');
99 | return str;
100 | }
101 |
102 | //
103 |
104 | function strcharacterDiscode(str){
105 | // 加入常用解析
106 | str = str.replace(/ /g, ' ');
107 | str = str.replace(/"/g, "'");
108 | str = str.replace(/&/g, '&');
109 | // str = str.replace(/</g, '‹');
110 | // str = str.replace(/>/g, '›');
111 |
112 | str = str.replace(/</g, '<');
113 | str = str.replace(/>/g, '>');
114 |
115 | return str;
116 | }
117 |
118 | // HTML 支持的其他实体
119 | function strOtherDiscode(str){
120 | str = str.replace(/Œ/g, 'Œ');
121 | str = str.replace(/œ/g, 'œ');
122 | str = str.replace(/Š/g, 'Š');
123 | str = str.replace(/š/g, 'š');
124 | str = str.replace(/Ÿ/g, 'Ÿ');
125 | str = str.replace(/ƒ/g, 'ƒ');
126 | str = str.replace(/ˆ/g, 'ˆ');
127 | str = str.replace(/˜/g, '˜');
128 | str = str.replace(/ /g, '');
129 | str = str.replace(/ /g, '');
130 | str = str.replace(/ /g, '');
131 | str = str.replace(//g, '');
132 | str = str.replace(//g, '');
133 | str = str.replace(//g, '');
134 | str = str.replace(//g, '');
135 | str = str.replace(/–/g, '–');
136 | str = str.replace(/—/g, '—');
137 | str = str.replace(/‘/g, '‘');
138 | str = str.replace(/’/g, '’');
139 | str = str.replace(/‚/g, '‚');
140 | str = str.replace(/“/g, '“');
141 | str = str.replace(/”/g, '”');
142 | str = str.replace(/„/g, '„');
143 | str = str.replace(/†/g, '†');
144 | str = str.replace(/‡/g, '‡');
145 | str = str.replace(/•/g, '•');
146 | str = str.replace(/…/g, '…');
147 | str = str.replace(/‰/g, '‰');
148 | str = str.replace(/′/g, '′');
149 | str = str.replace(/″/g, '″');
150 | str = str.replace(/‹/g, '‹');
151 | str = str.replace(/›/g, '›');
152 | str = str.replace(/‾/g, '‾');
153 | str = str.replace(/€/g, '€');
154 | str = str.replace(/™/g, '™');
155 |
156 | str = str.replace(/←/g, '←');
157 | str = str.replace(/↑/g, '↑');
158 | str = str.replace(/→/g, '→');
159 | str = str.replace(/↓/g, '↓');
160 | str = str.replace(/↔/g, '↔');
161 | str = str.replace(/↵/g, '↵');
162 | str = str.replace(/⌈/g, '⌈');
163 | str = str.replace(/⌉/g, '⌉');
164 |
165 | str = str.replace(/⌊/g, '⌊');
166 | str = str.replace(/⌋/g, '⌋');
167 | str = str.replace(/◊/g, '◊');
168 | str = str.replace(/♠/g, '♠');
169 | str = str.replace(/♣/g, '♣');
170 | str = str.replace(/♥/g, '♥');
171 |
172 | str = str.replace(/♦/g, '♦');
173 |
174 | return str;
175 | }
176 |
177 | function strMoreDiscode(str){
178 | str = str.replace(/\r\n/g,"");
179 | str = str.replace(/\n/g,"");
180 |
181 | str = str.replace(/code/g,"wxxxcode-style");
182 | return str;
183 | }
184 |
185 | function strDiscode(str){
186 | str = strNumDiscode(str);
187 | str = strGreeceDiscode(str);
188 | str = strcharacterDiscode(str);
189 | str = strOtherDiscode(str);
190 | str = strMoreDiscode(str);
191 | return str;
192 | }
193 | function urlToHttpUrl(url,rep){
194 |
195 | var patt1 = new RegExp("^//");
196 | var result = patt1.test(url);
197 | if(result){
198 | url = rep+":"+url;
199 | }
200 | return url;
201 | }
202 |
203 | module.exports = {
204 | strDiscode:strDiscode,
205 | urlToHttpUrl:urlToHttpUrl
206 | }
--------------------------------------------------------------------------------
/wxParse/wxParse.js:
--------------------------------------------------------------------------------
1 | /**
2 | * author: Di (微信小程序开发工程师)
3 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
4 | * 垂直微信小程序开发交流社区
5 | *
6 | * github地址: https://github.com/icindy/wxParse
7 | *
8 | * for: 微信小程序富文本解析
9 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
10 | */
11 |
12 | /**
13 | * utils函数引入
14 | **/
15 | import showdown from './showdown.js';
16 | import HtmlToJson from './html2json.js';
17 | /**
18 | * 配置及公有属性
19 | **/
20 | /**
21 | * 主函数入口区
22 | **/
23 | function wxParse(bindName = 'wxParseData', type='html', data='
数据不能为空
', target,imagePadding) {
24 | var that = target;
25 | var transData = {};//存放转化后的数据
26 | if (type == 'html') {
27 | transData = HtmlToJson.html2json(data, bindName);
28 | // console.log(JSON.stringify(transData, ' ', ' '));
29 | } else if (type == 'md' || type == 'markdown') {
30 | var converter = new showdown.Converter();
31 | var html = converter.makeHtml(data);
32 | transData = HtmlToJson.html2json(html, bindName);
33 | console.log(JSON.stringify(transData, ' ', ' '));
34 | }
35 | transData.view = {};
36 | transData.view.imagePadding = 0;
37 | if(typeof(imagePadding) != 'undefined'){
38 | transData.view.imagePadding = imagePadding
39 | }
40 | var bindData = {};
41 | bindData[bindName] = transData;
42 | that.setData(bindData)
43 | that.wxParseImgLoad = wxParseImgLoad;
44 | that.wxParseImgTap = wxParseImgTap;
45 | }
46 | // 图片点击事件
47 | function wxParseImgTap(e) {
48 | var that = this;
49 | var nowImgUrl = e.target.dataset.src;
50 | var tagFrom = e.target.dataset.from;
51 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
52 | wx.previewImage({
53 | current: nowImgUrl, // 当前显示图片的http链接
54 | urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
55 | })
56 | }
57 | }
58 |
59 | /**
60 | * 图片视觉宽高计算函数区
61 | **/
62 | function wxParseImgLoad(e) {
63 | var that = this;
64 | var tagFrom = e.target.dataset.from;
65 | var idx = e.target.dataset.idx;
66 | if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
67 | calMoreImageInfo(e, idx, that, tagFrom)
68 | }
69 | }
70 | // 假循环获取计算图片视觉最佳宽高
71 | function calMoreImageInfo(e, idx, that, bindName) {
72 | var temData = that.data[bindName];
73 | if (temData.images.length == 0) {
74 | return;
75 | }
76 | var temImages = temData.images;
77 | //因为无法获取view宽度 需要自定义padding进行计算,稍后处理
78 | var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
79 | temImages[idx].width = recal.imageWidth;
80 | temImages[idx].height = recal.imageheight;
81 | temData.images = temImages;
82 | var bindData = {};
83 | bindData[bindName] = temData;
84 | that.setData(bindData);
85 | }
86 |
87 | // 计算视觉优先的图片宽高
88 | function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
89 | //获取图片的原始长宽
90 | var windowWidth = 0, windowHeight = 0;
91 | var autoWidth = 0, autoHeight = 0;
92 | var results = {};
93 | wx.getSystemInfo({
94 | success: function (res) {
95 | var padding = that.data[bindName].view.imagePadding;
96 | windowWidth = res.windowWidth-2*padding;
97 | windowHeight = res.windowHeight;
98 | //判断按照那种方式进行缩放
99 | console.log("windowWidth" + windowWidth);
100 | if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
101 | autoWidth = windowWidth;
102 | console.log("autoWidth" + autoWidth);
103 | autoHeight = (autoWidth * originalHeight) / originalWidth;
104 | console.log("autoHeight" + autoHeight);
105 | results.imageWidth = autoWidth;
106 | results.imageheight = autoHeight;
107 | } else {//否则展示原来的数据
108 | results.imageWidth = originalWidth;
109 | results.imageheight = originalHeight;
110 | }
111 | }
112 | })
113 | return results;
114 | }
115 |
116 | function wxParseTemArray(temArrayName,bindNameReg,total,that){
117 | var array = [];
118 | var temData = that.data;
119 | var obj = null;
120 | for(var i = 0; i < total; i++){
121 | var simArr = temData[bindNameReg+i].nodes;
122 | array.push(simArr);
123 | }
124 |
125 | temArrayName = temArrayName || 'wxParseTemArray';
126 | obj = JSON.parse('{"'+ temArrayName +'":""}');
127 | obj[temArrayName] = array;
128 | that.setData(obj);
129 | }
130 |
131 | /**
132 | * 配置emojis
133 | *
134 | */
135 |
136 | function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
137 | HtmlToJson.emojisInit(reg,baseSrc,emojis);
138 | }
139 |
140 | module.exports = {
141 | wxParse: wxParse,
142 | wxParseTemArray:wxParseTemArray,
143 | emojisInit:emojisInit
144 | }
145 |
146 |
147 |
--------------------------------------------------------------------------------
/wxParse/wxParse.wxss:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * author: Di (微信小程序开发工程师)
4 | * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
5 | * 垂直微信小程序开发交流社区
6 | *
7 | * github地址: https://github.com/icindy/wxParse
8 | *
9 | * for: 微信小程序富文本解析
10 | * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
11 | */
12 |
13 | .wxParse{
14 | margin: 0 5px;
15 | font-family: Helvetica,sans-serif;
16 | font-size: 28rpx;
17 | color: #666;
18 | line-height: 1.8;
19 | }
20 | view{
21 | word-break:break-all; overflow:auto;
22 | }
23 | .wxParse-inline{
24 | display: inline;
25 | margin: 0;
26 | padding: 0;
27 | }
28 | /*//标题 */
29 | .wxParse-div{margin: 0;padding: 0;}
30 | .wxParse-h1{ font-size:2em; margin: .67em 0 }
31 | .wxParse-h2{ font-size:1.5em; margin: .75em 0 }
32 | .wxParse-h3{ font-size:1.17em; margin: .83em 0 }
33 | .wxParse-h4{ margin: 1.12em 0}
34 | .wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
35 | .wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
36 |
37 | .wxParse-h1 {
38 | font-size: 18px;
39 | font-weight: 400;
40 | margin-bottom: .9em;
41 | }
42 | .wxParse-h2 {
43 | font-size: 16px;
44 | font-weight: 400;
45 | margin-bottom: .34em;
46 | }
47 | .wxParse-h3 {
48 | font-weight: 400;
49 | font-size: 15px;
50 | margin-bottom: .34em;
51 | }
52 | .wxParse-h4 {
53 | font-weight: 400;
54 | font-size: 14px;
55 | margin-bottom: .24em;
56 | }
57 | .wxParse-h5 {
58 | font-weight: 400;
59 | font-size: 13px;
60 | margin-bottom: .14em;
61 | }
62 | .wxParse-h6 {
63 | font-weight: 400;
64 | font-size: 12px;
65 | margin-bottom: .04em;
66 | }
67 |
68 | .wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder }
69 |
70 | .wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
71 | .wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
72 | .wxParse-pre{white-space:pre}
73 | .wxParse-big{font-size:1.17em}
74 | .wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
75 | .wxParse-sub{vertical-align:sub}
76 | .wxParse-sup{vertical-align:super}
77 | .wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
78 | /*wxparse-自定义个性化的css样式*/
79 | /*增加video的css样式*/
80 | .wxParse-strong,.wxParse-s{display: inline}
81 | .wxParse-a{
82 | color: deepskyblue;
83 | word-break:break-all;
84 | overflow:auto;
85 | }
86 |
87 | .wxParse-video{
88 | text-align: center;
89 | margin: 10px 0;
90 | }
91 |
92 | .wxParse-video-video{
93 | width:100%;
94 | }
95 |
96 | .wxParse-img{
97 | background-color: #efefef;
98 | overflow: hidden;
99 | }
100 |
101 | .wxParse-blockquote {
102 | margin: 0;
103 | padding:10px 0 10px 5px;
104 | font-family:Courier, Calibri,"宋体";
105 | background:#f5f5f5;
106 | border-left: 3px solid #dbdbdb;
107 | }
108 |
109 | .wxParse-code,.wxParse-wxxxcode-style{
110 | display: inline;
111 | background:#f5f5f5;
112 | }
113 | .wxParse-ul{
114 | margin: 20rpx 10rpx;
115 | }
116 |
117 | .wxParse-li,.wxParse-li-inner{
118 | display: flex;
119 | align-items: baseline;
120 | margin: 10rpx 0;
121 | }
122 | .wxParse-li-text{
123 |
124 | align-items: center;
125 | line-height: 20px;
126 | }
127 |
128 | .wxParse-li-circle{
129 | display: inline-flex;
130 | width: 5px;
131 | height: 5px;
132 | background-color: #333;
133 | margin-right: 5px;
134 | }
135 |
136 | .wxParse-li-square{
137 | display: inline-flex;
138 | width: 10rpx;
139 | height: 10rpx;
140 | background-color: #333;
141 | margin-right: 5px;
142 | }
143 | .wxParse-li-ring{
144 | display: inline-flex;
145 | width: 10rpx;
146 | height: 10rpx;
147 | border: 2rpx solid #333;
148 | border-radius: 50%;
149 | background-color: #fff;
150 | margin-right: 5px;
151 | }
152 |
153 | /*.wxParse-table{
154 | width: 100%;
155 | height: 400px;
156 | }
157 | .wxParse-thead,.wxParse-tfoot,.wxParse-tr{
158 | display: flex;
159 | flex-direction: row;
160 | }
161 | .wxParse-th,.wxParse-td{
162 | display: flex;
163 | width: 580px;
164 | overflow: auto;
165 | }*/
166 |
167 | .wxParse-u {
168 | text-decoration: underline;
169 | }
170 | .wxParse-hide{
171 | display: none;
172 | }
173 | .WxEmojiView{
174 | align-items: center;
175 | }
176 | .wxEmoji{
177 | width: 16px;
178 | height:16px;
179 | }
180 | .wxParse-tr{
181 | display: flex;
182 | border-right:1px solid #e0e0e0;
183 | border-bottom:1px solid #e0e0e0;
184 | }
185 | .wxParse-th,
186 | .wxParse-td{
187 | flex:1;
188 | padding:5px;
189 | font-size:28rpx;
190 | border-left:1px solid #e0e0e0;
191 | word-break: break-all;
192 | }
193 | .wxParse-td:last{
194 | border-top:1px solid #e0e0e0;
195 | }
196 | .wxParse-th{
197 | background:#f0f0f0;
198 | border-top:1px solid #e0e0e0;
199 | }
200 |
201 |
--------------------------------------------------------------------------------