Merge branch 'master' of http://114.215.101.231:8099/miniprogram/jiuzidian into Branch_zhu
# Conflicts: # app.json # pages/homeblock/shuxing/shuxing.js # pages/homeblock/shuxing/shuxing.json # pages/homeblock/shuxing/shuxing.wxml # pages/homeblock/shuxing/shuxing.wxss # pages/homeblock/video/video.js # pages/homeblock/video/video.wxml # pages/homeblock/video/video.wxss # pages/myblock/jifenjilu/jifenjilu.json # pages/myblock/jifenjilu/jifenjilu.wxml # pages/myblock/jifenjilu/jifenjilu.wxss # pages/myblock/niangjiulist/niangjiulist.js # pages/myblock/niangjiulist/niangjiulist.json # pages/myblock/niangjiulist/niangjiulist.wxml # pages/myblock/niangjiulist/niangjiulist.wxss # pages/myblock/pingjia/pingjia.js # pages/myblock/pingjia/pingjia.json # pages/myblock/pingjia/pingjia.wxml # pages/myblock/pingjia/pingjia.wxss # pages/myblock/shezhimima/shezhimima.js # pages/myblock/shezhimima/shezhimima.json # pages/myblock/shezhimima/shezhimima.wxml # pages/myblock/shezhimima/shezhimima.wxss
正在显示
57 个修改的文件
包含
2914 行增加
和
72 行删除
@@ -34,6 +34,11 @@ | @@ -34,6 +34,11 @@ | ||
34 | "pages/myblock/shezhimima/shezhimima", | 34 | "pages/myblock/shezhimima/shezhimima", |
35 | "pages/homeblock/video/video", | 35 | "pages/homeblock/video/video", |
36 | "pages/homeblock/shuxing/shuxing", | 36 | "pages/homeblock/shuxing/shuxing", |
37 | + "pages/homeblock/selectcity/selectcity", | ||
38 | + "pages/findblock/zhuanjiapinjiu/zhuanjiapinjiu", | ||
39 | + "pages/findblock/zhuanjiapinjiudetail/zhuanjiapinjiudetail", | ||
40 | + "pages/findblock/niangjiushi/niangjiushi", | ||
41 | + "pages/findblock/jiudandetail/jiudandetail", | ||
37 | "pages/myblock/history/history" | 42 | "pages/myblock/history/history" |
38 | ], | 43 | ], |
39 | "window": { | 44 | "window": { |
img/aicon_29@2x.png
0 → 100644
3.2 KB
img/cicon17@2x.png
0 → 100644
2.5 KB
@@ -14,6 +14,9 @@ Page({ | @@ -14,6 +14,9 @@ Page({ | ||
14 | interval: 2000, | 14 | interval: 2000, |
15 | duration: 1000, | 15 | duration: 1000, |
16 | currentSwiper: 0, | 16 | currentSwiper: 0, |
17 | + banner:[], | ||
18 | + list:[], | ||
19 | + news: [] | ||
17 | }, | 20 | }, |
18 | 21 | ||
19 | /** | 22 | /** |
@@ -23,6 +26,35 @@ Page({ | @@ -23,6 +26,35 @@ Page({ | ||
23 | this.setData({ | 26 | this.setData({ |
24 | url: app.globalData.url | 27 | url: app.globalData.url |
25 | }) | 28 | }) |
29 | + | ||
30 | + | ||
31 | + }, | ||
32 | + | ||
33 | + //获取发现列表 | ||
34 | + getfindlist(){ | ||
35 | + | ||
36 | + let that = this; | ||
37 | + let url = 'index/Find/index', params = { | ||
38 | + | ||
39 | + | ||
40 | + } | ||
41 | + app.post(url, params).then((res) => { | ||
42 | + console.log(res); | ||
43 | + that.setData({ | ||
44 | + imgUrls:res.banner, | ||
45 | + list:res.list, | ||
46 | + news:res.news | ||
47 | + }) | ||
48 | + | ||
49 | + console.log(that.data.news) | ||
50 | + console.log(that.data.list) | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + }).catch((err) => { | ||
55 | + | ||
56 | + }) | ||
57 | + | ||
26 | }, | 58 | }, |
27 | swiperChange: function (e) { | 59 | swiperChange: function (e) { |
28 | this.setData({ | 60 | this.setData({ |
@@ -41,7 +73,7 @@ Page({ | @@ -41,7 +73,7 @@ Page({ | ||
41 | * 生命周期函数--监听页面显示 | 73 | * 生命周期函数--监听页面显示 |
42 | */ | 74 | */ |
43 | onShow: function () { | 75 | onShow: function () { |
44 | - | 76 | + this.getfindlist() |
45 | }, | 77 | }, |
46 | 78 | ||
47 | /** | 79 | /** |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange"> | 2 | <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange"> |
3 | <block wx:for="{{imgUrls}}" wx:key="doct"> | 3 | <block wx:for="{{imgUrls}}" wx:key="doct"> |
4 | <swiper-item style="border-radius:10px;"> | 4 | <swiper-item style="border-radius:10px;"> |
5 | - <image src="{{item}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" /> | 5 | + <image src="{{item.image}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" /> |
6 | </swiper-item> | 6 | </swiper-item> |
7 | </block> | 7 | </block> |
8 | </swiper> | 8 | </swiper> |
@@ -34,26 +34,26 @@ | @@ -34,26 +34,26 @@ | ||
34 | 34 | ||
35 | </view> | 35 | </view> |
36 | 36 | ||
37 | -<view class="tast"> | 37 | +<view class="tast" wx:for="{{news}}" wx:key=''> |
38 | <view class="tastimg"> | 38 | <view class="tastimg"> |
39 | - <image src="{{url}}aicon_25@2x.png"></image> | 39 | + <image src="{{item.thumb}}"></image> |
40 | </view> | 40 | </view> |
41 | 41 | ||
42 | <view class="tastcontent"> | 42 | <view class="tastcontent"> |
43 | - <view class="tasttitle">石库门·海上繁华</view> | ||
44 | - <view class="tasttext">海派风味:开坛飘香,入口爽滑</view> | 43 | + <view class="tasttitle">{{item.title}}</view> |
44 | + <view class="tasttext">{{item.description}}</view> | ||
45 | </view> | 45 | </view> |
46 | 46 | ||
47 | </view> | 47 | </view> |
48 | 48 | ||
49 | -<view class="wineblock"> | 49 | +<view class="wineblock" wx:for="{{list}}" wx:key=""> |
50 | <view class="middlehead"> | 50 | <view class="middlehead"> |
51 | <view class="rilihead"> | 51 | <view class="rilihead"> |
52 | <view class="rili"> | 52 | <view class="rili"> |
53 | - <image src="{{url}}aicon_46x.png"></image> | 53 | + <image src="{{item.icon}}"></image> |
54 | </view> | 54 | </view> |
55 | <view class="jiudan"> | 55 | <view class="jiudan"> |
56 | - 酒单推荐 | 56 | + {{item.name}} |
57 | </view> | 57 | </view> |
58 | </view> | 58 | </view> |
59 | 59 | ||
@@ -65,7 +65,7 @@ | @@ -65,7 +65,7 @@ | ||
65 | </view> | 65 | </view> |
66 | 66 | ||
67 | </view> | 67 | </view> |
68 | - <view class="winetitle">年轻人生日party必备酒单</view> | 68 | + <view class="winetitle">{{item.article.share_content}}</view> |
69 | 69 | ||
70 | <view class="wineimg"> | 70 | <view class="wineimg"> |
71 | <image src="{{url}}aicon_64.png"></image> | 71 | <image src="{{url}}aicon_64.png"></image> |
@@ -84,13 +84,13 @@ | @@ -84,13 +84,13 @@ | ||
84 | <view class="winerighttouimg"> | 84 | <view class="winerighttouimg"> |
85 | <image src="{{url}}aicon_66x.png"></image> | 85 | <image src="{{url}}aicon_66x.png"></image> |
86 | </view> | 86 | </view> |
87 | - <view class="winezan">18</view> | 87 | + <view class="winezan">{{item.article.good_count}}</view> |
88 | </view> | 88 | </view> |
89 | <view class="winerighttou"> | 89 | <view class="winerighttou"> |
90 | <view class="winerighttouimg"> | 90 | <view class="winerighttouimg"> |
91 | <image src="{{url}}aicon_67x.png"></image> | 91 | <image src="{{url}}aicon_67x.png"></image> |
92 | </view> | 92 | </view> |
93 | - <view class="winezan">54</view> | 93 | + <view class="winezan">{{item.article.comment_count}}</view> |
94 | </view> | 94 | </view> |
95 | 95 | ||
96 | <view class="winerighttou"> | 96 | <view class="winerighttou"> |
@@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
104 | </view> | 104 | </view> |
105 | 105 | ||
106 | </view> | 106 | </view> |
107 | -<view class="wineblock"> | 107 | +<!-- <view class="wineblock"> |
108 | <view class="middlehead"> | 108 | <view class="middlehead"> |
109 | <view class="rilihead"> | 109 | <view class="rilihead"> |
110 | <view class="pin"> | 110 | <view class="pin"> |
@@ -220,4 +220,4 @@ | @@ -220,4 +220,4 @@ | ||
220 | 220 | ||
221 | </view> | 221 | </view> |
222 | 222 | ||
223 | -</view> | ||
223 | +</view> --> |
pages/findblock/jiudandetail/jiudandetail.js
0 → 100644
1 | +// pages/findblock/jiudandetail/jiudandetail.js | ||
2 | +const app=getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + url:'' | ||
10 | + }, | ||
11 | + | ||
12 | + /** | ||
13 | + * 生命周期函数--监听页面加载 | ||
14 | + */ | ||
15 | + onLoad: function (options) { | ||
16 | + this.setData({ | ||
17 | + url: app.globalData.url | ||
18 | + }) | ||
19 | + }, | ||
20 | + | ||
21 | + /** | ||
22 | + * 生命周期函数--监听页面初次渲染完成 | ||
23 | + */ | ||
24 | + onReady: function () { | ||
25 | + | ||
26 | + }, | ||
27 | + | ||
28 | + /** | ||
29 | + * 生命周期函数--监听页面显示 | ||
30 | + */ | ||
31 | + onShow: function () { | ||
32 | + | ||
33 | + }, | ||
34 | + | ||
35 | + /** | ||
36 | + * 生命周期函数--监听页面隐藏 | ||
37 | + */ | ||
38 | + onHide: function () { | ||
39 | + | ||
40 | + }, | ||
41 | + | ||
42 | + /** | ||
43 | + * 生命周期函数--监听页面卸载 | ||
44 | + */ | ||
45 | + onUnload: function () { | ||
46 | + | ||
47 | + }, | ||
48 | + | ||
49 | + /** | ||
50 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
51 | + */ | ||
52 | + onPullDownRefresh: function () { | ||
53 | + | ||
54 | + }, | ||
55 | + | ||
56 | + /** | ||
57 | + * 页面上拉触底事件的处理函数 | ||
58 | + */ | ||
59 | + onReachBottom: function () { | ||
60 | + | ||
61 | + }, | ||
62 | + | ||
63 | + /** | ||
64 | + * 用户点击右上角分享 | ||
65 | + */ | ||
66 | + onShareAppMessage: function () { | ||
67 | + | ||
68 | + } | ||
69 | +}) |
1 | +<view class="jiudandetailhead"> | ||
2 | + <view class="edtaileft"> | ||
3 | + <view class="edtaileftimg"> | ||
4 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
5 | + </view> | ||
6 | + <view class="editmiddle"> | ||
7 | + <view class="middletop">万丈红尘一人醉</view> | ||
8 | + <view class="middlebottom">lv12</view> | ||
9 | + </view> | ||
10 | + | ||
11 | + </view> | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + <view class="atten">关注</view> | ||
16 | +</view> |
1 | +.jiudandetailhead{ | ||
2 | + display:flex; | ||
3 | + align-items: center; | ||
4 | + justify-content: space-between; | ||
5 | + padding: 30rpx; | ||
6 | + box-sizing: border-box; | ||
7 | + | ||
8 | +} | ||
9 | + | ||
10 | +.edtaileftimg{ | ||
11 | + width:96rpx; | ||
12 | + height:96rpx; | ||
13 | + font-size: 0 | ||
14 | +} | ||
15 | + | ||
16 | +image{ | ||
17 | + width:100%; | ||
18 | + height:100%; | ||
19 | +} | ||
20 | +.edtaileft{ | ||
21 | + display:flex; | ||
22 | + align-items: center; | ||
23 | +} | ||
24 | +.editmiddle{ | ||
25 | + margin-let: | ||
26 | +} |
pages/findblock/niangjiushi/niangjiushi.js
0 → 100644
1 | +// pages/findblock/niangjiushi/niangjiushi.js | ||
2 | +const app=getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + url:'' | ||
10 | + }, | ||
11 | + | ||
12 | + /** | ||
13 | + * 生命周期函数--监听页面加载 | ||
14 | + */ | ||
15 | + onLoad: function (options) { | ||
16 | + this.setData({ | ||
17 | + url: app.globalData.url | ||
18 | + }) | ||
19 | + }, | ||
20 | + | ||
21 | + /** | ||
22 | + * 生命周期函数--监听页面初次渲染完成 | ||
23 | + */ | ||
24 | + onReady: function () { | ||
25 | + | ||
26 | + }, | ||
27 | + | ||
28 | + /** | ||
29 | + * 生命周期函数--监听页面显示 | ||
30 | + */ | ||
31 | + onShow: function () { | ||
32 | + | ||
33 | + }, | ||
34 | + | ||
35 | + /** | ||
36 | + * 生命周期函数--监听页面隐藏 | ||
37 | + */ | ||
38 | + onHide: function () { | ||
39 | + | ||
40 | + }, | ||
41 | + | ||
42 | + /** | ||
43 | + * 生命周期函数--监听页面卸载 | ||
44 | + */ | ||
45 | + onUnload: function () { | ||
46 | + | ||
47 | + }, | ||
48 | + | ||
49 | + /** | ||
50 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
51 | + */ | ||
52 | + onPullDownRefresh: function () { | ||
53 | + | ||
54 | + }, | ||
55 | + | ||
56 | + /** | ||
57 | + * 页面上拉触底事件的处理函数 | ||
58 | + */ | ||
59 | + onReachBottom: function () { | ||
60 | + | ||
61 | + }, | ||
62 | + | ||
63 | + /** | ||
64 | + * 用户点击右上角分享 | ||
65 | + */ | ||
66 | + onShareAppMessage: function () { | ||
67 | + | ||
68 | + } | ||
69 | +}) |
pages/findblock/niangjiushi/niangjiushi.json
0 → 100644
pages/findblock/niangjiushi/niangjiushi.wxml
0 → 100644
1 | +<view class="niangjiulist"> | ||
2 | + <view class="niangjiuitem"> | ||
3 | + <view class="teachimg"> | ||
4 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
5 | + </view> | ||
6 | + <view class="jiuname">徐强</view> | ||
7 | + | ||
8 | + <view class="atten">关注</view> | ||
9 | + | ||
10 | + <view class="jiubottom"> | ||
11 | + <view class="jiuleft"> | ||
12 | + <view class="jiuleftimg"> | ||
13 | + <image src="{{url}}/aicon_66x.png"></image> | ||
14 | + </view> | ||
15 | + <view class="jiuzan">618</view> | ||
16 | + </view> | ||
17 | + | ||
18 | + <view class="jiumiddle"> | ||
19 | + <view class="middleimg"> | ||
20 | + <image src="{{url}}/aicon_67x.png"></image> | ||
21 | + </view> | ||
22 | + <view class="tiao">54</view> | ||
23 | + </view> | ||
24 | + | ||
25 | + <view class="jiuright"> | ||
26 | + <image src="{{url}}/aicon_68x.png"></image> | ||
27 | + </view> | ||
28 | + </view> | ||
29 | + </view> | ||
30 | + <view class="niangjiuitem"> | ||
31 | + <view class="teachimg"> | ||
32 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
33 | + </view> | ||
34 | + <view class="jiuname">徐强</view> | ||
35 | + | ||
36 | + <view class="atten">关注</view> | ||
37 | + | ||
38 | + <view class="jiubottom"> | ||
39 | + <view class="jiuleft"> | ||
40 | + <view class="jiuleftimg"> | ||
41 | + <image src="{{url}}/aicon_66x.png"></image> | ||
42 | + </view> | ||
43 | + <view class="jiuzan">618</view> | ||
44 | + </view> | ||
45 | + | ||
46 | + <view class="jiumiddle"> | ||
47 | + <view class="middleimg"> | ||
48 | + <image src="{{url}}/aicon_67x.png"></image> | ||
49 | + </view> | ||
50 | + <view class="tiao">54</view> | ||
51 | + </view> | ||
52 | + | ||
53 | + <view class="jiuright"> | ||
54 | + <image src="{{url}}/aicon_68x.png"></image> | ||
55 | + </view> | ||
56 | + </view> | ||
57 | + </view> | ||
58 | + <view class="niangjiuitem"> | ||
59 | + <view class="teachimg"> | ||
60 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
61 | + </view> | ||
62 | + <view class="jiuname">徐强</view> | ||
63 | + | ||
64 | + <view class="atten">关注</view> | ||
65 | + | ||
66 | + <view class="jiubottom"> | ||
67 | + <view class="jiuleft"> | ||
68 | + <view class="jiuleftimg"> | ||
69 | + <image src="{{url}}/aicon_66x.png"></image> | ||
70 | + </view> | ||
71 | + <view class="jiuzan">618</view> | ||
72 | + </view> | ||
73 | + | ||
74 | + <view class="jiumiddle"> | ||
75 | + <view class="middleimg"> | ||
76 | + <image src="{{url}}/aicon_67x.png"></image> | ||
77 | + </view> | ||
78 | + <view class="tiao">54</view> | ||
79 | + </view> | ||
80 | + | ||
81 | + <view class="jiuright"> | ||
82 | + <image src="{{url}}/aicon_68x.png"></image> | ||
83 | + </view> | ||
84 | + </view> | ||
85 | + </view> | ||
86 | + <view class="niangjiuitem"> | ||
87 | + <view class="teachimg"> | ||
88 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
89 | + </view> | ||
90 | + <view class="jiuname">徐强</view> | ||
91 | + | ||
92 | + <view class="atten">关注</view> | ||
93 | + | ||
94 | + <view class="jiubottom"> | ||
95 | + <view class="jiuleft"> | ||
96 | + <view class="jiuleftimg"> | ||
97 | + <image src="{{url}}/aicon_66x.png"></image> | ||
98 | + </view> | ||
99 | + <view class="jiuzan">618</view> | ||
100 | + </view> | ||
101 | + | ||
102 | + <view class="jiumiddle"> | ||
103 | + <view class="middleimg"> | ||
104 | + <image src="{{url}}/aicon_67x.png"></image> | ||
105 | + </view> | ||
106 | + <view class="tiao">54</view> | ||
107 | + </view> | ||
108 | + | ||
109 | + <view class="jiuright"> | ||
110 | + <image src="{{url}}/aicon_68x.png"></image> | ||
111 | + </view> | ||
112 | + </view> | ||
113 | + </view> | ||
114 | + <view class="niangjiuitem"> | ||
115 | + <view class="teachimg"> | ||
116 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
117 | + </view> | ||
118 | + <view class="jiuname">徐强</view> | ||
119 | + | ||
120 | + <view class="atten">关注</view> | ||
121 | + | ||
122 | + <view class="jiubottom"> | ||
123 | + <view class="jiuleft"> | ||
124 | + <view class="jiuleftimg"> | ||
125 | + <image src="{{url}}/aicon_66x.png"></image> | ||
126 | + </view> | ||
127 | + <view class="jiuzan">618</view> | ||
128 | + </view> | ||
129 | + | ||
130 | + <view class="jiumiddle"> | ||
131 | + <view class="middleimg"> | ||
132 | + <image src="{{url}}/aicon_67x.png"></image> | ||
133 | + </view> | ||
134 | + <view class="tiao">54</view> | ||
135 | + </view> | ||
136 | + | ||
137 | + <view class="jiuright"> | ||
138 | + <image src="{{url}}/aicon_68x.png"></image> | ||
139 | + </view> | ||
140 | + </view> | ||
141 | + </view> | ||
142 | +</view> |
pages/findblock/niangjiushi/niangjiushi.wxss
0 → 100644
1 | +.niangjiulist{ | ||
2 | + display:flex; | ||
3 | + flex-wrap:wrap; | ||
4 | +} | ||
5 | + | ||
6 | +.teachimg{ | ||
7 | + width:120rpx; | ||
8 | + height:120rpx; | ||
9 | + font-size: 0; | ||
10 | + border-radius:50%; | ||
11 | + margin:40rpx auto 0; | ||
12 | + | ||
13 | +} | ||
14 | +.teachimg image{ | ||
15 | + width:100%; | ||
16 | + height:100%; | ||
17 | + border-radius:50%; | ||
18 | +} | ||
19 | +.niangjiuitem{ | ||
20 | + width:366rpx; | ||
21 | + height:386rpx; | ||
22 | + border-bottom: 1rpx solid #f5f5f5; | ||
23 | + | ||
24 | +} | ||
25 | +.niangjiuitem:nth-child(n){ | ||
26 | + border-right:1rpx solid #f5f5f5 | ||
27 | +} | ||
28 | +.jiuname{ | ||
29 | + color:#1A1A1A; | ||
30 | + font-size: 28rpx; | ||
31 | + text-align: center; | ||
32 | + margin-top:14rpx; | ||
33 | +} | ||
34 | +.atten{ | ||
35 | + width:100rpx; | ||
36 | + margin:20rpx auto 0; | ||
37 | +} | ||
38 | +.jiubottom{ | ||
39 | + display:flex; | ||
40 | + align-items: center; | ||
41 | + justify-content: space-around; | ||
42 | + margin-top:23rpx; | ||
43 | +} | ||
44 | +.jiuleft{ | ||
45 | + display:flex; | ||
46 | + align-items: center | ||
47 | +} | ||
48 | +.jiumiddle{ | ||
49 | + display:flex; | ||
50 | + align-items: center | ||
51 | +} | ||
52 | +.jiuleftimg{ | ||
53 | + width:30rpx; | ||
54 | + height:28rpx; | ||
55 | + font-size: 0 | ||
56 | +} | ||
57 | +image{ | ||
58 | + width:100%; | ||
59 | + height:100%; | ||
60 | +} | ||
61 | +.jiuzan{ | ||
62 | + color:#666666; | ||
63 | + font-size: 28rpx; | ||
64 | + margin-left:16rpx; | ||
65 | +} | ||
66 | +.middleimg{ | ||
67 | + width:29rpx; | ||
68 | + height:27rpx; | ||
69 | + font-size: 0 | ||
70 | +} | ||
71 | +.tiao{ | ||
72 | + color:#666666; | ||
73 | + font-size: 28rpx; | ||
74 | + margin-left:16rpx; | ||
75 | +} | ||
76 | +.jiuright{ | ||
77 | + width:26rpx; | ||
78 | + height:26rpx; | ||
79 | + font-size: 0 | ||
80 | +} |
1 | +// pages/findblock/zhuanjiapinjiu/zhuanjiapinjiu.js | ||
2 | +const app=getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + url:'' | ||
10 | + }, | ||
11 | + | ||
12 | + /** | ||
13 | + * 生命周期函数--监听页面加载 | ||
14 | + */ | ||
15 | + onLoad: function (options) { | ||
16 | + this.setData({ | ||
17 | + url: app.globalData.url | ||
18 | + }) | ||
19 | + }, | ||
20 | + | ||
21 | + /** | ||
22 | + * 生命周期函数--监听页面初次渲染完成 | ||
23 | + */ | ||
24 | + onReady: function () { | ||
25 | + | ||
26 | + }, | ||
27 | + | ||
28 | + /** | ||
29 | + * 生命周期函数--监听页面显示 | ||
30 | + */ | ||
31 | + onShow: function () { | ||
32 | + | ||
33 | + }, | ||
34 | + | ||
35 | + /** | ||
36 | + * 生命周期函数--监听页面隐藏 | ||
37 | + */ | ||
38 | + onHide: function () { | ||
39 | + | ||
40 | + }, | ||
41 | + | ||
42 | + /** | ||
43 | + * 生命周期函数--监听页面卸载 | ||
44 | + */ | ||
45 | + onUnload: function () { | ||
46 | + | ||
47 | + }, | ||
48 | + | ||
49 | + /** | ||
50 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
51 | + */ | ||
52 | + onPullDownRefresh: function () { | ||
53 | + | ||
54 | + }, | ||
55 | + | ||
56 | + /** | ||
57 | + * 页面上拉触底事件的处理函数 | ||
58 | + */ | ||
59 | + onReachBottom: function () { | ||
60 | + | ||
61 | + }, | ||
62 | + | ||
63 | + /** | ||
64 | + * 用户点击右上角分享 | ||
65 | + */ | ||
66 | + onShareAppMessage: function () { | ||
67 | + | ||
68 | + } | ||
69 | +}) |
1 | +<view class="wineblock"> | ||
2 | + | ||
3 | + <view class="winetitle">浓香酒酿酒大师:沈才宏</view> | ||
4 | + | ||
5 | + <view class="wineimg"> | ||
6 | + <image src="{{url}}aicon_64.png"></image> | ||
7 | + </view> | ||
8 | + | ||
9 | + <view class="winebottom"> | ||
10 | + <view class="winebottomleft"> | ||
11 | + <view class="winebottomleftimg"> | ||
12 | + <image src="{{url}}aicon_65x.png"></image> | ||
13 | + </view> | ||
14 | + <view class="wineeng">WinesBook</view> | ||
15 | + </view> | ||
16 | + <view class="winebottonright"> | ||
17 | + | ||
18 | + <view class="winerighttou"> | ||
19 | + <view class="winerighttouimg"> | ||
20 | + <image src="{{url}}aicon_66x.png"></image> | ||
21 | + </view> | ||
22 | + <view class="winezan">18</view> | ||
23 | + </view> | ||
24 | + <view class="winerighttou"> | ||
25 | + <view class="winerighttouimg"> | ||
26 | + <image src="{{url}}aicon_67x.png"></image> | ||
27 | + </view> | ||
28 | + <view class="winezan">54</view> | ||
29 | + </view> | ||
30 | + | ||
31 | + <view class="winerighttou"> | ||
32 | + <view class="winerighttouimg"> | ||
33 | + <image src="{{url}}aicon_68x.png"></image> | ||
34 | + </view> | ||
35 | + | ||
36 | + </view> | ||
37 | + </view> | ||
38 | + | ||
39 | + </view> | ||
40 | + | ||
41 | +</view> | ||
42 | +<view class="wineblock"> | ||
43 | + | ||
44 | + <view class="winetitle">浓香酒酿酒大师:沈才宏</view> | ||
45 | + | ||
46 | + <view class="wineimg"> | ||
47 | + <image src="{{url}}aicon_64.png"></image> | ||
48 | + </view> | ||
49 | + | ||
50 | + <view class="winebottom"> | ||
51 | + <view class="winebottomleft"> | ||
52 | + <view class="winebottomleftimg"> | ||
53 | + <image src="{{url}}aicon_65x.png"></image> | ||
54 | + </view> | ||
55 | + <view class="wineeng">WinesBook</view> | ||
56 | + </view> | ||
57 | + <view class="winebottonright"> | ||
58 | + | ||
59 | + <view class="winerighttou"> | ||
60 | + <view class="winerighttouimg"> | ||
61 | + <image src="{{url}}aicon_66x.png"></image> | ||
62 | + </view> | ||
63 | + <view class="winezan">18</view> | ||
64 | + </view> | ||
65 | + <view class="winerighttou"> | ||
66 | + <view class="winerighttouimg"> | ||
67 | + <image src="{{url}}aicon_67x.png"></image> | ||
68 | + </view> | ||
69 | + <view class="winezan">54</view> | ||
70 | + </view> | ||
71 | + | ||
72 | + <view class="winerighttou"> | ||
73 | + <view class="winerighttouimg"> | ||
74 | + <image src="{{url}}aicon_68x.png"></image> | ||
75 | + </view> | ||
76 | + | ||
77 | + </view> | ||
78 | + </view> | ||
79 | + | ||
80 | + </view> | ||
81 | + | ||
82 | +</view> |
1 | +.winetitle{ | ||
2 | + color:#1A1A1A; | ||
3 | + font-size: 28rpx; | ||
4 | + margin-left:36rpx; | ||
5 | + font-weight: bold | ||
6 | +} | ||
7 | +.wineimg{ | ||
8 | + width:686rpx; | ||
9 | + height:300rpx; | ||
10 | + margin:30rpx auto 0; | ||
11 | +} | ||
12 | +.winebottom{ | ||
13 | + display:flex; | ||
14 | + justify-content: space-between; | ||
15 | + align-items: center; | ||
16 | + padding: 0 32rpx; | ||
17 | + box-sizing: border-box; | ||
18 | + margin-top:30rpx; | ||
19 | +} | ||
20 | +.winebottomleftimg{ | ||
21 | + width:60rpx; | ||
22 | + height:60rpx; | ||
23 | + font-size: 0 | ||
24 | +} | ||
25 | +.winebottomleft{ | ||
26 | + display:flex; | ||
27 | + align-items: center | ||
28 | +} | ||
29 | +.winebottonright{ | ||
30 | + width:345rpx; | ||
31 | + display:flex; | ||
32 | + align-items: center; | ||
33 | + justify-content: space-around | ||
34 | +} | ||
35 | +.winerighttouimg{ | ||
36 | + width:30rpx; | ||
37 | + height:28rpx; | ||
38 | + font-size: 0 | ||
39 | +} | ||
40 | +.winerighttou{ | ||
41 | + display:flex; | ||
42 | + align-items: center | ||
43 | +} | ||
44 | +.wineeng{ | ||
45 | + color:#666666; | ||
46 | + font-size: 28rpx; | ||
47 | + margin-left: 20rpx; | ||
48 | +} | ||
49 | +.winezan{ | ||
50 | + color:#666666; | ||
51 | + font-size:28rpx; | ||
52 | + margin-left:5rpx; | ||
53 | +} | ||
54 | +.wineblock{ | ||
55 | + border-bottom: 1rpx solid #f5f5f5; | ||
56 | + padding-bottom: 30rpx; | ||
57 | + margin-top:33rpx; | ||
58 | +} | ||
59 | +.pin{ | ||
60 | + width:16rpx; | ||
61 | + height:32rpx; | ||
62 | + font-size: 0 | ||
63 | +} |
1 | +// pages/findblock/zhuanjiapinjiudetail/zhuanjiapinjiudetail.js | ||
2 | +const app=getApp() | ||
3 | +Page({ | ||
4 | + | ||
5 | + /** | ||
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + url:'' | ||
10 | + }, | ||
11 | + | ||
12 | + /** | ||
13 | + * 生命周期函数--监听页面加载 | ||
14 | + */ | ||
15 | + onLoad: function (options) { | ||
16 | + this.setData({ | ||
17 | + url: app.globalData.url | ||
18 | + }) | ||
19 | + | ||
20 | + }, | ||
21 | + | ||
22 | + /** | ||
23 | + * 生命周期函数--监听页面初次渲染完成 | ||
24 | + */ | ||
25 | + onReady: function () { | ||
26 | + | ||
27 | + }, | ||
28 | + | ||
29 | + /** | ||
30 | + * 生命周期函数--监听页面显示 | ||
31 | + */ | ||
32 | + onShow: function () { | ||
33 | + | ||
34 | + }, | ||
35 | + | ||
36 | + /** | ||
37 | + * 生命周期函数--监听页面隐藏 | ||
38 | + */ | ||
39 | + onHide: function () { | ||
40 | + | ||
41 | + }, | ||
42 | + | ||
43 | + /** | ||
44 | + * 生命周期函数--监听页面卸载 | ||
45 | + */ | ||
46 | + onUnload: function () { | ||
47 | + | ||
48 | + }, | ||
49 | + | ||
50 | + /** | ||
51 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
52 | + */ | ||
53 | + onPullDownRefresh: function () { | ||
54 | + | ||
55 | + }, | ||
56 | + | ||
57 | + /** | ||
58 | + * 页面上拉触底事件的处理函数 | ||
59 | + */ | ||
60 | + onReachBottom: function () { | ||
61 | + | ||
62 | + }, | ||
63 | + | ||
64 | + /** | ||
65 | + * 用户点击右上角分享 | ||
66 | + */ | ||
67 | + onShareAppMessage: function () { | ||
68 | + | ||
69 | + } | ||
70 | +}) |
1 | +<view class="detailhead"> | ||
2 | + <view class="liuliang">播放将消耗7.72MB流量,是否需要在WIFI环境下播放</view> | ||
3 | + <view class="goon">继续播放</view> | ||
4 | +</view> | ||
5 | + | ||
6 | +<view class="winebottom"> | ||
7 | + <view class="winebottomleft"> | ||
8 | + <view class="winebottomleftimg"> | ||
9 | + <image src="{{url}}aicon_65x.png"></image> | ||
10 | + </view> | ||
11 | + <view class="wineeng">WinesBook</view> | ||
12 | + </view> | ||
13 | + <view class="winebottonright"> | ||
14 | + | ||
15 | + <view class="winerighttou zantou"> | ||
16 | + <view class="winerighttouimg"> | ||
17 | + <image src="{{url}}aicon_66x.png"></image> | ||
18 | + </view> | ||
19 | + <view class="winezan">12</view> | ||
20 | + </view> | ||
21 | + | ||
22 | + | ||
23 | + <view class="winerighttou"> | ||
24 | + <view class="winerighttouimg"> | ||
25 | + <image src="{{url}}aicon_68x.png"></image> | ||
26 | + </view> | ||
27 | + | ||
28 | + </view> | ||
29 | + </view> | ||
30 | + | ||
31 | +</view> | ||
32 | + | ||
33 | + | ||
34 | +<view class="commentlist"> | ||
35 | + <view class="commentitem"> | ||
36 | + <view class="commentleft"> | ||
37 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
38 | + </view> | ||
39 | + | ||
40 | + <view class="commentright"> | ||
41 | + <view class="rightname">小叶子</view> | ||
42 | + <view class="rightdate">2019年11月5日</view> | ||
43 | + <view class="righttext">我怎么这么好看</view> | ||
44 | + </view> | ||
45 | + </view> | ||
46 | + <view class="commentitem"> | ||
47 | + <view class="commentleft"> | ||
48 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
49 | + </view> | ||
50 | + | ||
51 | + <view class="commentright"> | ||
52 | + <view class="rightname">小叶子</view> | ||
53 | + <view class="rightdate">2019年11月5日</view> | ||
54 | + <view class="righttext">我怎么这么好看</view> | ||
55 | + </view> | ||
56 | + </view> | ||
57 | + <view class="commentitem"> | ||
58 | + <view class="commentleft"> | ||
59 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
60 | + </view> | ||
61 | + | ||
62 | + <view class="commentright"> | ||
63 | + <view class="rightname">小叶子</view> | ||
64 | + <view class="rightdate">2019年11月5日</view> | ||
65 | + <view class="righttext">我怎么这么好看</view> | ||
66 | + </view> | ||
67 | + </view> | ||
68 | + <view class="commentitem"> | ||
69 | + <view class="commentleft"> | ||
70 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
71 | + </view> | ||
72 | + | ||
73 | + <view class="commentright"> | ||
74 | + <view class="rightname">小叶子</view> | ||
75 | + <view class="rightdate">2019年11月5日</view> | ||
76 | + <view class="righttext">我怎么这么好看</view> | ||
77 | + </view> | ||
78 | + </view> | ||
79 | + <view class="commentitem"> | ||
80 | + <view class="commentleft"> | ||
81 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
82 | + </view> | ||
83 | + | ||
84 | + <view class="commentright"> | ||
85 | + <view class="rightname">小叶子</view> | ||
86 | + <view class="rightdate">2019年11月5日</view> | ||
87 | + <view class="righttext">我怎么这么好看</view> | ||
88 | + </view> | ||
89 | + </view> | ||
90 | + <view class="commentitem"> | ||
91 | + <view class="commentleft"> | ||
92 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
93 | + </view> | ||
94 | + | ||
95 | + <view class="commentright"> | ||
96 | + <view class="rightname">小叶子</view> | ||
97 | + <view class="rightdate">2019年11月5日</view> | ||
98 | + <view class="righttext">我怎么这么好看</view> | ||
99 | + </view> | ||
100 | + </view> | ||
101 | + <view class="commentitem"> | ||
102 | + <view class="commentleft"> | ||
103 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
104 | + </view> | ||
105 | + | ||
106 | + <view class="commentright"> | ||
107 | + <view class="rightname">小叶子</view> | ||
108 | + <view class="rightdate">2019年11月5日</view> | ||
109 | + <view class="righttext">我怎么这么好看</view> | ||
110 | + </view> | ||
111 | + </view> | ||
112 | + <view class="commentitem"> | ||
113 | + <view class="commentleft"> | ||
114 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
115 | + </view> | ||
116 | + | ||
117 | + <view class="commentright"> | ||
118 | + <view class="rightname">小叶子</view> | ||
119 | + <view class="rightdate">2019年11月5日</view> | ||
120 | + <view class="righttext">我怎么这么好看</view> | ||
121 | + </view> | ||
122 | + </view> | ||
123 | + | ||
124 | + | ||
125 | + | ||
126 | +</view> | ||
127 | +<view class="pingjiabottom"> | ||
128 | + <view class="pbleft"> | ||
129 | + <input placeholder='输入评论的内容' placeholder-class='enterping' /> | ||
130 | + </view> | ||
131 | + | ||
132 | + <view class="pbright">发送</view> | ||
133 | +</view> |
1 | +.detailhead { | ||
2 | + width: 750rpx; | ||
3 | + height: 483rpx; | ||
4 | + background: #000; | ||
5 | + overflow: hidden; | ||
6 | +} | ||
7 | + | ||
8 | +.liuliang { | ||
9 | + color: #fff; | ||
10 | + font-size: 24rpx; | ||
11 | + text-align: center; | ||
12 | + margin-top: 164rpx; | ||
13 | +} | ||
14 | + | ||
15 | +.goon { | ||
16 | + width: 206rpx; | ||
17 | + height: 64rpx; | ||
18 | + background: rgba(52, 52, 52, 1); | ||
19 | + border-radius: 4rpx; | ||
20 | + color: #fff; | ||
21 | + font-size: 26rpx; | ||
22 | + text-align: center; | ||
23 | + line-height: 64rpx; | ||
24 | + margin: 26rpx auto 0; | ||
25 | +} | ||
26 | + | ||
27 | +.winebottom { | ||
28 | + display: flex; | ||
29 | + justify-content: space-between; | ||
30 | + align-items: center; | ||
31 | + padding: 30rpx 32rpx; | ||
32 | + box-sizing: border-box; | ||
33 | + border-bottom: 1rpx solid #f5f5f5; | ||
34 | +} | ||
35 | + | ||
36 | +.winebottomleftimg { | ||
37 | + width: 60rpx; | ||
38 | + height: 60rpx; | ||
39 | + font-size: 0; | ||
40 | +} | ||
41 | + | ||
42 | +.winebottomleft { | ||
43 | + display: flex; | ||
44 | + align-items: center; | ||
45 | +} | ||
46 | + | ||
47 | +.winebottonright { | ||
48 | + width: 345rpx; | ||
49 | + display: flex; | ||
50 | + align-items: center; | ||
51 | + justify-content: flex-end; | ||
52 | +} | ||
53 | + | ||
54 | +.winerighttouimg { | ||
55 | + width: 30rpx; | ||
56 | + height: 28rpx; | ||
57 | + font-size: 0; | ||
58 | +} | ||
59 | + | ||
60 | +.winerighttou { | ||
61 | + display: flex; | ||
62 | + align-items: center; | ||
63 | +} | ||
64 | + | ||
65 | +.zantou { | ||
66 | + margin-right: 50rpx; | ||
67 | +} | ||
68 | + | ||
69 | +.wineeng { | ||
70 | + color: #666; | ||
71 | + font-size: 28rpx; | ||
72 | + margin-left: 20rpx; | ||
73 | +} | ||
74 | + | ||
75 | +.winezan { | ||
76 | + color: #666; | ||
77 | + font-size: 28rpx; | ||
78 | + margin-left: 5rpx; | ||
79 | +} | ||
80 | + | ||
81 | +.wineblock { | ||
82 | + border-bottom: 14rpx solid #f2f2f2; | ||
83 | + padding-bottom: 30rpx; | ||
84 | +} | ||
85 | + | ||
86 | +.pin { | ||
87 | + width: 16rpx; | ||
88 | + height: 32rpx; | ||
89 | + font-size: 0; | ||
90 | +} | ||
91 | + | ||
92 | +.commentlist { | ||
93 | + padding: 0 30rpx; | ||
94 | + box-sizing: border-box; | ||
95 | + padding-bottom: 100rpx; | ||
96 | +} | ||
97 | + | ||
98 | +.commentitem { | ||
99 | + display: flex; | ||
100 | + padding: 40rpx 0; | ||
101 | + box-sizing: border-box; | ||
102 | + border-bottom: 1rpx solid #f5f5f5; | ||
103 | +} | ||
104 | + | ||
105 | +.commentleft { | ||
106 | + width: 60rpx; | ||
107 | + height: 60rpx; | ||
108 | + font-size: 0; | ||
109 | + border-radius: 50%; | ||
110 | +} | ||
111 | + | ||
112 | +image { | ||
113 | + width: 100%; | ||
114 | + height: 100%; | ||
115 | + border-radius: 50%; | ||
116 | +} | ||
117 | + | ||
118 | +.commentright { | ||
119 | + margin-left: 20rpx; | ||
120 | +} | ||
121 | + | ||
122 | +.rightname { | ||
123 | + color: #666; | ||
124 | + font-size: 28rpx; | ||
125 | +} | ||
126 | + | ||
127 | +.rightdate { | ||
128 | + color: #999; | ||
129 | + font-size: 24rpx; | ||
130 | + margin-top: 14rpx; | ||
131 | +} | ||
132 | + | ||
133 | +.righttext { | ||
134 | + color: #1a1a1a; | ||
135 | + font-size: 28rpx; | ||
136 | + margin-top: 23rpx; | ||
137 | +} | ||
138 | + | ||
139 | +.pingjiabottom { | ||
140 | + width: 750rpx; | ||
141 | + height: 86rpx; | ||
142 | + display: flex; | ||
143 | + align-items: center; | ||
144 | + justify-content: space-between; | ||
145 | + padding: 16rpx 30rpx; | ||
146 | + box-sizing: border-box; | ||
147 | + position: fixed; | ||
148 | + bottom: 0rpx; | ||
149 | + background: #fff; | ||
150 | + border-top: 1rpx solid #f5f5f5; | ||
151 | +} | ||
152 | + | ||
153 | +.pbleft { | ||
154 | + width: 531rpx; | ||
155 | + height: 60rpx; | ||
156 | + background: rgba(242, 242, 242, 1); | ||
157 | + border-radius: 5rpx; | ||
158 | + color: #999; | ||
159 | + font-size: 26rpx; | ||
160 | + padding: 0 26rpx; | ||
161 | + line-height: 60rpx; | ||
162 | + box-sizing: border-box; | ||
163 | +} | ||
164 | + | ||
165 | +.pbleft input { | ||
166 | + width: 531rpx; | ||
167 | + height: 60rpx; | ||
168 | + padding: 0 26rpx; | ||
169 | + line-height: 60rpx; | ||
170 | + box-sizing: border-box; | ||
171 | +} | ||
172 | + | ||
173 | +.enterping { | ||
174 | + color: #999; | ||
175 | + font-size: 2F6rpx; | ||
176 | +} | ||
177 | + | ||
178 | +.pbright { | ||
179 | + width: 120rpx; | ||
180 | + height: 60rpx; | ||
181 | + background: rgba(232, 24, 37, 1); | ||
182 | + border-radius: 30rpx; | ||
183 | + color: #fff; | ||
184 | + font-size: 26rpx; | ||
185 | + text-align: center; | ||
186 | + line-height: 60rpx; | ||
187 | +} |
@@ -654,6 +654,12 @@ Page({ | @@ -654,6 +654,12 @@ Page({ | ||
654 | // this.gethomeindex() | 654 | // this.gethomeindex() |
655 | }, | 655 | }, |
656 | 656 | ||
657 | + choseaddress(){ | ||
658 | + wx.navigateTo({ | ||
659 | + url: '/pages/homeblock/selectcity/selectcity', | ||
660 | + }) | ||
661 | + }, | ||
662 | + | ||
657 | 663 | ||
658 | /** | 664 | /** |
659 | * 生命周期函数--监听页面初次渲染完成 | 665 | * 生命周期函数--监听页面初次渲染完成 |
@@ -666,6 +672,13 @@ Page({ | @@ -666,6 +672,13 @@ Page({ | ||
666 | * 生命周期函数--监听页面显示 | 672 | * 生命周期函数--监听页面显示 |
667 | */ | 673 | */ |
668 | onShow: function() { | 674 | onShow: function() { |
675 | + let city = wx.getStorageSync("cityname"); | ||
676 | + console.log(city) | ||
677 | + if(city!=''){ | ||
678 | + this.setData({ | ||
679 | + currentCity: city | ||
680 | + }) | ||
681 | + } | ||
669 | // this.getshailist() | 682 | // this.getshailist() |
670 | }, | 683 | }, |
671 | 684 |
@@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
64 | </view> | 64 | </view> |
65 | <view class="heatop"> | 65 | <view class="heatop"> |
66 | <view class="head"> | 66 | <view class="head"> |
67 | - <view class="address"> | 67 | + <view class="address" bindtap="choseaddress"> |
68 | <view class="addressimg"> | 68 | <view class="addressimg"> |
69 | <image src='{{url}}bicon_01x.png'></image> | 69 | <image src='{{url}}bicon_01x.png'></image> |
70 | </view> | 70 | </view> |
@@ -304,6 +304,12 @@ Page({ | @@ -304,6 +304,12 @@ Page({ | ||
304 | url: '/pages/homeblock/evalutecontent/evalutecontent?wineid='+this.data.id, | 304 | url: '/pages/homeblock/evalutecontent/evalutecontent?wineid='+this.data.id, |
305 | }) | 305 | }) |
306 | }, | 306 | }, |
307 | + //进入属性页面 | ||
308 | + entershu(){ | ||
309 | + wx.navigateTo({ | ||
310 | + url: '/pages/homeblock/shuxing/shuxing', | ||
311 | + }) | ||
312 | + }, | ||
307 | 313 | ||
308 | /** | 314 | /** |
309 | * 生命周期函数--监听页面初次渲染完成 | 315 | * 生命周期函数--监听页面初次渲染完成 |
pages/homeblock/selectcity/selectcity.js
0 → 100644
1 | +// import qqmap from '../../utils/map.js'; | ||
2 | +const app = getApp() | ||
3 | + | ||
4 | +Page({ | ||
5 | + data: { | ||
6 | + //下面是字母排序 | ||
7 | + letter: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"], | ||
8 | + cityListId: '', | ||
9 | + //下面是城市列表信息,这里只是模拟数据 | ||
10 | + citylist: [{ "letter": "A", "data": [{ "id": "v7", "cityName": "安徽" }] }, { "letter": "B", "data": [{ "id": "v10", "cityName": "巴中" }, { "id": "v4", "cityName": "包头" }, { "id": "v1", "cityName": "北京" }] }, { "letter": "C", "data": [{ "id": "v15", "cityName": "成都" }] }, { "letter": "D", "data": [{ "id": "v21", "cityName": "稻城" }] }, { "letter": "G", "data": [{ "id": "v17", "cityName": "广州" }, { "id": "v29", "cityName": "桂林" }] }, { "letter": "H", "data": [{ "id": "v9", "cityName": "海南" }, { "id": "v3", "cityName": "呼和浩特" }] }, { "letter": "L", "data": [{ "id": "v24", "cityName": "洛阳" }, { "id": "v20", "cityName": "拉萨" }, { "id": "v14", "cityName": "丽江" }] }, { "letter": "M", "data": [{ "id": "v13", "cityName": "眉山" }] }, { "letter": "N", "data": [{ "id": "v27", "cityName": "南京" }] }, { "letter": "S", "data": [{ "id": "v18", "cityName": "三亚" }, { "id": "v2", "cityName": "上海" }] }, { "letter": "T", "data": [{ "id": "v5", "cityName": "天津" }] }, { "letter": "W", "data": [{ "id": "v12", "cityName": "乌鲁木齐" }, { "id": "v25", "cityName": "武汉" }] }, { "letter": "X", "data": [{ "id": "v23", "cityName": "西安" }, { "id": "v28", "cityName": "香港" }, { "id": "v19", "cityName": "厦门" }] }, { "letter": "Z", "data": [{ "id": "v8", "cityName": "张家口" }] }], | ||
11 | + //下面是热门城市数据,模拟数据 | ||
12 | + newcity: ['北京', '上海', '广州', '深圳', '成都', '杭州'], | ||
13 | + // citySel: '全国', | ||
14 | + locateCity: '', | ||
15 | + currentCity:'', | ||
16 | + history_list:[], | ||
17 | + hot_list:[] | ||
18 | + }, | ||
19 | + //获取用户当前位置 | ||
20 | + getcity() { | ||
21 | + let that = this; | ||
22 | + wx.getLocation({ | ||
23 | + type: 'gcj02', | ||
24 | + success: function (res) { | ||
25 | + // 经纬度 | ||
26 | + var latitude = res.latitude | ||
27 | + var longitude = res.longitude | ||
28 | + | ||
29 | + var aK = that.data.aK | ||
30 | + wx.request({ | ||
31 | + url: 'https://api.map.baidu.com/geocoder/v2/?ak=y8jPDTMIuAnaVscUztce1RKfNx8v5sok&location=' + latitude + ',' + longitude + '&output=json', | ||
32 | + data: {}, | ||
33 | + header: { | ||
34 | + 'content-type': 'application/json' | ||
35 | + }, | ||
36 | + success: function (res) { | ||
37 | + console.log('1234567890', res) | ||
38 | + var province = res.data.result.addressComponent.province; | ||
39 | + let district = res.data.result.addressComponent.district | ||
40 | + that.setData({ | ||
41 | + currentCity: province | ||
42 | + }) | ||
43 | + wx.setStorageSync('city', province) | ||
44 | + wx.request({ | ||
45 | + // url: 'xxx' + city, | ||
46 | + // data: {}, | ||
47 | + // header: { | ||
48 | + // 'content-type': 'application/json' | ||
49 | + // }, | ||
50 | + // success: function (res) { | ||
51 | + // that.setData({ | ||
52 | + // county: res.data, | ||
53 | + // }) | ||
54 | + // }, | ||
55 | + }) | ||
56 | + } | ||
57 | + }) | ||
58 | + | ||
59 | + }, | ||
60 | + fail: function () { | ||
61 | + wx.showToast({ | ||
62 | + title: '授权失败,请打开GPS重新进入页面授权', | ||
63 | + icon: 'none', | ||
64 | + duration: 2000 | ||
65 | + }) | ||
66 | + } | ||
67 | + }) | ||
68 | + }, | ||
69 | + | ||
70 | + //点击城市 | ||
71 | + cityTap(e) { | ||
72 | + console.log(e) | ||
73 | + const val = e.currentTarget.dataset.val || '', | ||
74 | + types = e.currentTarget.dataset.types || '', | ||
75 | + Index = e.currentTarget.dataset.index || '', | ||
76 | + that = this; | ||
77 | + let city = this.data.citySel; | ||
78 | + let newcity = e.currentTarget.dataset.val.cityName; | ||
79 | + console.log(newcity) | ||
80 | + if (newcity != undefined) { | ||
81 | + wx.setStorageSync("cityname", newcity); | ||
82 | + } | ||
83 | + | ||
84 | + | ||
85 | + let url = 'index/Index/set_city', params = { | ||
86 | + city: newcity, | ||
87 | + | ||
88 | + } | ||
89 | + app.post(url, params).then((res) => { | ||
90 | + console.log(res); | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + }).catch((err) => { | ||
95 | + | ||
96 | + }) | ||
97 | + | ||
98 | + wx.navigateBack({ | ||
99 | + checked:true | ||
100 | + }) | ||
101 | + }, | ||
102 | + | ||
103 | + //点击热门城市 | ||
104 | + cityTaphot(e){ | ||
105 | + console.log(e) | ||
106 | + let newcity = e.currentTarget.dataset.val; | ||
107 | + console.log(newcity) | ||
108 | + if (newcity != undefined) { | ||
109 | + wx.setStorageSync("cityname", newcity); | ||
110 | + } | ||
111 | + | ||
112 | + | ||
113 | + let url = 'index/Index/set_city', params = { | ||
114 | + city: newcity, | ||
115 | + | ||
116 | + } | ||
117 | + app.post(url, params).then((res) => { | ||
118 | + console.log(res); | ||
119 | + | ||
120 | + | ||
121 | + | ||
122 | + }).catch((err) => { | ||
123 | + | ||
124 | + }) | ||
125 | + | ||
126 | + wx.navigateBack({ | ||
127 | + checked: true | ||
128 | + }) | ||
129 | + }, | ||
130 | + //点击历史记录 | ||
131 | + cityTaphistory(e){ | ||
132 | + let newcity = e.currentTarget.dataset.val; | ||
133 | + console.log(newcity) | ||
134 | + if (newcity != undefined) { | ||
135 | + wx.setStorageSync("cityname", newcity); | ||
136 | + } | ||
137 | + | ||
138 | + wx.navigateBack({ | ||
139 | + checked: true | ||
140 | + }) | ||
141 | + }, | ||
142 | + //点击城市字母 | ||
143 | + letterTap(e) { | ||
144 | + const Item = e.currentTarget.dataset.item; | ||
145 | + this.setData({ | ||
146 | + cityListId: Item | ||
147 | + }); | ||
148 | + console.log("..............." + this.data.cityListId); | ||
149 | + }, | ||
150 | + //调用定位 | ||
151 | + | ||
152 | + //获取热门城市 | ||
153 | + | ||
154 | + gethotcity() { | ||
155 | + let that = this; | ||
156 | + var url = 'index/Index/get_city'; | ||
157 | + var params = { | ||
158 | + } | ||
159 | + app.post(url, params).then((res) => { | ||
160 | + console.log(res); | ||
161 | + that.setData({ | ||
162 | + hot_list: res.hot_city, | ||
163 | + history_list: res.history_list | ||
164 | + }) | ||
165 | + | ||
166 | + console.log(that.data.newcity) | ||
167 | + | ||
168 | + | ||
169 | + }).catch((err) => { | ||
170 | + | ||
171 | + }) | ||
172 | + | ||
173 | + }, | ||
174 | + | ||
175 | + onShow() { | ||
176 | + console.log(getApp()); | ||
177 | + let that = this, | ||
178 | + cityOrTime = wx.getStorageSync('locatecity') || {}, | ||
179 | + time = new Date().getTime(), | ||
180 | + city = ''; | ||
181 | + if (!cityOrTime.time || (time - cityOrTime.time > 1800000)) {//每隔30分钟请求一次定位 | ||
182 | + | ||
183 | + } else {//如果未满30分钟,那么直接从本地缓存里取值 | ||
184 | + that.setData({ | ||
185 | + locateCity: cityOrTime.city | ||
186 | + }) | ||
187 | + } | ||
188 | + that.getcity() | ||
189 | + | ||
190 | + that.gethotcity() | ||
191 | + | ||
192 | + } | ||
193 | +}) |
pages/homeblock/selectcity/selectcity.json
0 → 100644
pages/homeblock/selectcity/selectcity.wxml
0 → 100644
1 | +<view class='city_box'> | ||
2 | + <view class='city_left'> | ||
3 | + <scroll-view scroll-y style='width:100%;height:100%;' scroll-with-animation scroll-into-view='{{cityListId}}'> | ||
4 | + <view class='city_locate' data-types='locate' catchtap='cityTap'> | ||
5 | + <!-- <text class='city_locate_title'>自动定位</text> | ||
6 | + <text class='city_locate_text' style='{{!locateCity&&"color:#33b9ff;"}}'>{{locateCity||'点击定位'}}</text> --> | ||
7 | + | ||
8 | + <view class="slecity"> | ||
9 | + <image src='{{url}}bicon_01x.png'></image> | ||
10 | + </view> | ||
11 | + | ||
12 | + <view>{{currentCity}}</view> | ||
13 | + </view> | ||
14 | + <!-- <view class='national' data-types='national' catchtap='cityTap'>全国</view> --> | ||
15 | + <view class='new_city'> | ||
16 | + <view class='new_city_title'>历史访问城市</view> | ||
17 | + <view class='new_city_box'> | ||
18 | + <view class="nodata" wx:if="{{history_list.length==0}}">暂无数据</view> | ||
19 | + <block wx:else> | ||
20 | + <text class='new_city_text' wx:for='{{history_list}}' wx:key='this' data-types='new' catchtap='cityTaphistory' data-val='{{item}}'>{{item}}</text> | ||
21 | + </block> | ||
22 | + </view> | ||
23 | + </view> | ||
24 | + | ||
25 | + <view class='new_city'> | ||
26 | + <view class='new_city_title'>热门城市</view> | ||
27 | + <view class='new_city_box'> | ||
28 | + <text class='new_city_text' wx:for='{{hot_list}}' wx:key='this' data-types='new' catchtap='cityTaphot' data-val='{{item}}'>{{item}}</text> | ||
29 | + </view> | ||
30 | + </view> | ||
31 | + | ||
32 | + <view class='city_list_box'> | ||
33 | + <block wx:for='{{citylist}}' wx:key='this' wx:for-item='letterItem' wx:for-index='letterIndex'> | ||
34 | + <view class='city_first_letter' id='{{letterItem.letter}}'>{{letterItem.letter}}</view> | ||
35 | + <text class='city_name' wx:for='{{letterItem.data}}' wx:key='this' data-types='list' catchtap='cityTap' data-index='{{index}}' data-val='{{item}}'>{{item.cityName}}</text> | ||
36 | + </block> | ||
37 | + </view> | ||
38 | + </scroll-view> | ||
39 | + </view> | ||
40 | + <view class='city_right'> | ||
41 | + <text class='letter_item' wx:for='{{letter}}' wx:key='this' catchtap='letterTap' data-item='{{item}}'>{{item}}</text> | ||
42 | + </view> | ||
43 | +</view> |
pages/homeblock/selectcity/selectcity.wxss
0 → 100644
1 | +page{ | ||
2 | + height:100% | ||
3 | +} | ||
4 | + | ||
5 | +.city_box{ | ||
6 | + height:100%; | ||
7 | + background: #fff; | ||
8 | + display: flex; | ||
9 | +} | ||
10 | +.city_left{ | ||
11 | + flex: 1; | ||
12 | +} | ||
13 | +.city_right{ | ||
14 | + width: 60rpx; | ||
15 | + display: flex; | ||
16 | + flex-direction: column; | ||
17 | + justify-content: space-around; | ||
18 | +} | ||
19 | +.letter_item{ | ||
20 | + flex: 1; | ||
21 | + display: block; | ||
22 | + font-size: 24rpx; | ||
23 | + color: #33B9FF; | ||
24 | + text-align: center; | ||
25 | +} | ||
26 | +.city_locate,.national{ | ||
27 | + height: 80rpx; | ||
28 | + line-height: 80rpx; | ||
29 | + border-bottom: 1px solid #efefef; | ||
30 | + font-size: 28rpx; | ||
31 | + color: #333; | ||
32 | + padding-left: 25rpx; | ||
33 | +} | ||
34 | +.city_locate_title{ | ||
35 | + color: #999; | ||
36 | + margin-right: 20rpx; | ||
37 | +} | ||
38 | +.new_city{ | ||
39 | + background: #efefef; | ||
40 | + font-size: 28rpx; | ||
41 | +} | ||
42 | +.new_city_title{ | ||
43 | + line-height: 60rpx; | ||
44 | + color: #999; | ||
45 | + padding-left: 25rpx; | ||
46 | + /* margin-bottom: 20rpx; */ | ||
47 | +} | ||
48 | +.new_city_box{ | ||
49 | + display: flex; | ||
50 | + flex-wrap: wrap; | ||
51 | + background: #fff; | ||
52 | +} | ||
53 | +.new_city_text{ | ||
54 | + width: 200rpx; | ||
55 | + text-align: center; | ||
56 | + line-height: 70rpx; | ||
57 | + background: #fff; | ||
58 | + border-radius: 35rpx; | ||
59 | + margin:0 0 22rpx 22rpx; | ||
60 | +} | ||
61 | +.city_first_letter{ | ||
62 | + line-height: 60rpx; | ||
63 | + height: 60rpx; | ||
64 | + padding-left: 25rpx; | ||
65 | + font-size: 28rpx; | ||
66 | + background: #eee; | ||
67 | + color: #999; | ||
68 | + | ||
69 | +} | ||
70 | +.city_name{ | ||
71 | + display: block; | ||
72 | + line-height: 80rpx; | ||
73 | + height: 80rpx; | ||
74 | + border-bottom: 1px solid #efefef; | ||
75 | + font-size: 28rpx; | ||
76 | + color: #333; | ||
77 | + padding-left: 25rpx; | ||
78 | +} | ||
79 | +.city_locate{ | ||
80 | + display:flex; | ||
81 | + align-items: center | ||
82 | +} | ||
83 | +.slecity{ | ||
84 | + width:20rpx; | ||
85 | + height:24rpx; | ||
86 | + font-size:0 | ||
87 | +} | ||
88 | +.slecity image{ | ||
89 | + width:100%; | ||
90 | + height:100%; | ||
91 | +} | ||
92 | +.nodata{ | ||
93 | + color:#999; | ||
94 | + font-size: 30rpx; | ||
95 | + text-align: center; | ||
96 | + width:750rpx; | ||
97 | + padding: 20rpx 0; | ||
98 | +} |
@@ -10,7 +10,8 @@ Page({ | @@ -10,7 +10,8 @@ Page({ | ||
10 | page:1, | 10 | page:1, |
11 | list:[], | 11 | list:[], |
12 | video:'', | 12 | video:'', |
13 | - date:'' | 13 | + date:'', |
14 | + url:'' | ||
14 | }, | 15 | }, |
15 | 16 | ||
16 | /** | 17 | /** |
@@ -18,10 +19,11 @@ Page({ | @@ -18,10 +19,11 @@ Page({ | ||
18 | */ | 19 | */ |
19 | onLoad: function (options) { | 20 | onLoad: function (options) { |
20 | this.setData({ | 21 | this.setData({ |
21 | - id:options.wineid | 22 | + id:options.wineid, |
23 | + url: app.globalData.url, | ||
22 | }) | 24 | }) |
23 | 25 | ||
24 | - this.getshortvideo() | 26 | + |
25 | }, | 27 | }, |
26 | //获取短视频 | 28 | //获取短视频 |
27 | getshortvideo(){ | 29 | getshortvideo(){ |
@@ -50,7 +52,51 @@ Page({ | @@ -50,7 +52,51 @@ Page({ | ||
50 | 52 | ||
51 | }) | 53 | }) |
52 | }, | 54 | }, |
55 | +//进入视频 | ||
56 | + entervideo(e){ | ||
57 | + let that = this; | ||
58 | + let vurl=e.currentTarget.dataset.url; | ||
59 | + | ||
60 | + | ||
53 | 61 | ||
62 | + let url = 'index/Wine/wine_video_view', params = { | ||
63 | + wine_id: that.data.id | ||
64 | + | ||
65 | + } | ||
66 | + app.post(url, params).then((res) => { | ||
67 | + console.log(res); | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + }).catch((err) => { | ||
72 | + | ||
73 | + }) | ||
74 | + | ||
75 | + wx.navigateTo({ | ||
76 | + url: '/pages/homeblock/video/video?url='+vurl, | ||
77 | + }) | ||
78 | + }, | ||
79 | + | ||
80 | + shortentervideo(e){ | ||
81 | + let that=this; | ||
82 | + let id=e.currentTarget.dataset.id | ||
83 | + let vurl = e.currentTarget.dataset.url; | ||
84 | + let url = 'index/Wine/comment_video_view', params = { | ||
85 | + wine_id: that.data.id, | ||
86 | + comment_id:id | ||
87 | + } | ||
88 | + app.post(url, params).then((res) => { | ||
89 | + console.log(res); | ||
90 | + | ||
91 | + | ||
92 | + | ||
93 | + }).catch((err) => { | ||
94 | + | ||
95 | + }) | ||
96 | + wx.navigateTo({ | ||
97 | + url: '/pages/homeblock/video/video?url=' + vurl, | ||
98 | + }) | ||
99 | + }, | ||
54 | 100 | ||
55 | formatDate(datetime) { | 101 | formatDate(datetime) { |
56 | // 获取年月日时分秒值 slice(-2)过滤掉大于10日期前面的0 | 102 | // 获取年月日时分秒值 slice(-2)过滤掉大于10日期前面的0 |
@@ -81,7 +127,7 @@ Page({ | @@ -81,7 +127,7 @@ Page({ | ||
81 | * 生命周期函数--监听页面显示 | 127 | * 生命周期函数--监听页面显示 |
82 | */ | 128 | */ |
83 | onShow: function () { | 129 | onShow: function () { |
84 | - | 130 | + this.getshortvideo() |
85 | }, | 131 | }, |
86 | 132 | ||
87 | /** | 133 | /** |
1 | <view class="biaozhuantitle">{{video.name}}</view> | 1 | <view class="biaozhuantitle">{{video.name}}</view> |
2 | 2 | ||
3 | +<view class="guangimg" bindtap="entervideo" data-url="{{video.url}}"> | ||
4 | + <image src="{{video.video_image}}"></image> | ||
5 | + | ||
6 | + <view class="boimg"> | ||
7 | + <image src="{{url}}/aicon_70x.png"></image> | ||
8 | + </view> | ||
9 | +</view> | ||
10 | + | ||
11 | + | ||
12 | +<!-- <video src="{{video.url}}" controls class="video" object-fit="fill"></video> --> | ||
3 | 13 | ||
4 | -<video src="{{video.url}}" controls class="video" object-fit="fill"></video> | ||
5 | <view class="bofangnum"> | 14 | <view class="bofangnum"> |
6 | <view class="bofangleft"> | 15 | <view class="bofangleft"> |
7 | {{video.times}}次播放 | 16 | {{video.times}}次播放 |
@@ -13,22 +22,21 @@ | @@ -13,22 +22,21 @@ | ||
13 | <view class="biaozhuantitle xiaovideo">小视频</view> | 22 | <view class="biaozhuantitle xiaovideo">小视频</view> |
14 | <view class="shortvideobox"> | 23 | <view class="shortvideobox"> |
15 | <view class="videoitem" wx:for='{{list}}' wx:key=''> | 24 | <view class="videoitem" wx:for='{{list}}' wx:key=''> |
16 | - <video src="{{item.video}}" class="itemvid" controls object-fit="fill"></video> | 25 | + |
26 | + <view class="itemvid" bindtap="shortentervideo" data-url="{{item.video}}" data-id="{{item.id}}"> | ||
27 | + <image src="{{item.video_image}}"></image> | ||
28 | + <view class="boimg"> | ||
29 | + <image src="{{url}}/aicon_70x.png"></image> | ||
30 | + </view> | ||
31 | + </view> | ||
32 | + <!-- <video src="{{item.video}}" class="itemvid" controls object-fit="fill"></video> --> | ||
17 | 33 | ||
18 | <view class="videoittitle">{{item.content}}</view> | 34 | <view class="videoittitle">{{item.content}}</view> |
19 | <view class=""> | 35 | <view class=""> |
20 | 36 | ||
21 | </view> | 37 | </view> |
22 | </view> | 38 | </view> |
23 | - <!-- <view class="videoitem"> | ||
24 | - <video src="/video/vi.mp4" class="itemvid" controls object-fit="fill"></video> | ||
25 | - </view> | ||
26 | - <view class="videoitem"> | ||
27 | - <video src="/video/vi.mp4" class="itemvid" controls object-fit="fill"></video> | ||
28 | - </view> | ||
29 | - <view class="videoitem"> | ||
30 | - <video src="/video/vi.mp4" class="itemvid" controls object-fit="fill"></video> | ||
31 | - </view> --> | 39 | + |
32 | 40 | ||
33 | 41 | ||
34 | 42 |
@@ -60,3 +60,19 @@ page{ | @@ -60,3 +60,19 @@ page{ | ||
60 | 60 | ||
61 | 61 | ||
62 | } | 62 | } |
63 | +.guangimg{ | ||
64 | + width:686rpx; | ||
65 | + height:300rpx; | ||
66 | + margin:32rpx auto 0; | ||
67 | + position: relative; | ||
68 | + | ||
69 | +} | ||
70 | +.boimg{ | ||
71 | + width:100rpx; | ||
72 | + height:100rpx; | ||
73 | + font-size: 0; | ||
74 | + position: absolute; | ||
75 | + top:50%; | ||
76 | + left:50%; | ||
77 | + transform: translate(-50%,-50%) | ||
78 | +} |
1 | // pages/homeblock/shuxing/shuxing.js | 1 | // pages/homeblock/shuxing/shuxing.js |
2 | +const app = getApp() | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | data: { | 8 | data: { |
8 | - | 9 | + url: '', |
10 | + user_list: [], | ||
11 | + list: [], | ||
12 | + type: 1, | ||
13 | + arr: [] | ||
9 | }, | 14 | }, |
10 | 15 | ||
11 | /** | 16 | /** |
12 | * 生命周期函数--监听页面加载 | 17 | * 生命周期函数--监听页面加载 |
13 | */ | 18 | */ |
14 | - onLoad: function (options) { | 19 | + onLoad: function(options) { |
20 | + this.setData({ | ||
21 | + url: app.globalData.url, | ||
22 | + }) | ||
23 | + | ||
24 | + this.getcanshu() | ||
25 | + }, | ||
26 | + qingchu() { | ||
27 | + this.setData({ | ||
28 | + type: 2 | ||
29 | + }) | ||
30 | + }, | ||
31 | + //获取酒品参数 | ||
32 | + getcanshu() { | ||
33 | + let that = this; | ||
34 | + let url = 'index/Wine/wine_attr', | ||
35 | + params = { | ||
36 | + | ||
37 | + } | ||
38 | + app.post(url, params).then((res) => { | ||
39 | + console.log(res); | ||
40 | + that.setData({ | ||
41 | + user_list: res.user_list, | ||
42 | + list: res.list | ||
43 | + }) | ||
44 | + | ||
45 | + let allarr = []; | ||
46 | + let usearr = [] | ||
47 | + | ||
48 | + let newlist = that.data.list; | ||
49 | + for (var obj of newlist) { | ||
50 | + obj.sel = false, | ||
51 | + allarr.push(obj.id) | ||
52 | + } | ||
53 | + | ||
54 | + that.setData({ | ||
55 | + list: newlist | ||
56 | + }) | ||
57 | + let newuserlist = that.data.user_list; | ||
58 | + for (var obj of newuserlist) { | ||
59 | + obj.sel = false; | ||
60 | + usearr.push(obj.id) | ||
61 | + } | ||
62 | + | ||
63 | + that.setData({ | ||
64 | + user_list: newuserlist | ||
65 | + }) | ||
66 | + | ||
67 | + console.log(allarr) | ||
68 | + console.log(usearr) | ||
69 | + //判断所有属性里有没有默认属性 | ||
70 | + let newuserlist1 = that.data.user_list; | ||
71 | + let newlist1 = that.data.list; | ||
72 | + | ||
73 | + | ||
74 | + let arr = [] | ||
75 | + | ||
76 | + for (var i = 0; i < allarr.length; i++) { | ||
77 | + | ||
78 | + if (usearr.indexOf(allarr[i]) == -1) { | ||
79 | + arr.push(allarr[i]) | ||
80 | + } | ||
81 | + } | ||
82 | + | ||
83 | + for (var i = 0; i < newlist1.length; i++) { | ||
84 | + for (var j = 0; j < arr.length; j++) { | ||
85 | + if (newlist1[i].id == arr[j]) { | ||
86 | + newlist1[i].sel=true | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + } | ||
91 | + that.setData({ | ||
92 | + list:newlist1 | ||
93 | + }) | ||
94 | + | ||
95 | + }).catch((err) => { | ||
96 | + | ||
97 | + }) | ||
98 | + }, | ||
99 | + //删除 | ||
100 | + shanchu(e) { | ||
101 | + let id = e.currentTarget.dataset.id; | ||
102 | + this.setData({ | ||
103 | + type: 3 | ||
104 | + }) | ||
105 | + let newuser_list = this.data.user_list; | ||
106 | + for (var i = 0; i < newuser_list.length; i++) { | ||
107 | + if (id == newuser_list[i].id) { | ||
108 | + newuser_list.splice(i, 1) | ||
109 | + } | ||
110 | + } | ||
15 | 111 | ||
112 | + this.setData({ | ||
113 | + user_list: newuser_list | ||
114 | + | ||
115 | + }) | ||
116 | + let newlist = this.data.list; | ||
117 | + for (var obj of newlist) { | ||
118 | + if (id == obj.id) { | ||
119 | + obj.sel = true | ||
120 | + } | ||
121 | + } | ||
122 | + | ||
123 | + this.setData({ | ||
124 | + list: newlist | ||
125 | + }) | ||
16 | }, | 126 | }, |
17 | 127 | ||
128 | + //长按事件 | ||
129 | + handleLongPress(e) { | ||
130 | + | ||
131 | + this.setData({ | ||
132 | + type:3 | ||
133 | + }) | ||
134 | + let id = e.currentTarget.dataset.id; | ||
135 | + | ||
136 | + let newlist = this.data.list; | ||
137 | + let newuser_list = this.data.user_list | ||
138 | + for (var obj of newlist) { | ||
139 | + if (obj.id == id) { | ||
140 | + if (obj.sel == true) { | ||
141 | + obj.sel = false; | ||
142 | + newuser_list.push(obj) | ||
143 | + } | ||
144 | + | ||
145 | + } | ||
146 | + } | ||
147 | + | ||
148 | + this.setData({ | ||
149 | + list: newlist, | ||
150 | + user_list: newuser_list | ||
151 | + }) | ||
152 | + }, | ||
153 | + | ||
154 | + //完成事件 | ||
155 | + finish() { | ||
156 | + let that = this; | ||
157 | + let arr = []; | ||
158 | + let newuser_list = that.data.user_list; | ||
159 | + for (var obj of newuser_list) { | ||
160 | + arr.push(obj.id) | ||
161 | + } | ||
162 | + console.log(arr) | ||
163 | + | ||
164 | + if (arr.indexOf(-1) == -1) { | ||
165 | + wx.showToast({ | ||
166 | + title: '基本参数无法取消', | ||
167 | + icon: 'none' | ||
168 | + }) | ||
169 | + } else if (arr.indexOf(-2) == -1) { | ||
170 | + wx.showToast({ | ||
171 | + title: '生产企业无法取消', | ||
172 | + icon: 'none' | ||
173 | + }) | ||
174 | + } else if (arr.indexOf(-3) == -1) { | ||
175 | + wx.showToast({ | ||
176 | + title: '酿酒师无法取消', | ||
177 | + icon: 'none' | ||
178 | + }) | ||
179 | + } else if (arr.indexOf(-4) == -1) { | ||
180 | + wx.showToast({ | ||
181 | + title: '专业品评无法取消', | ||
182 | + icon: 'none' | ||
183 | + }) | ||
184 | + } else if (arr.indexOf(-5) == -1) { | ||
185 | + wx.showToast({ | ||
186 | + title: '独具匠心无法取消', | ||
187 | + icon: 'none' | ||
188 | + }) | ||
189 | + } else { | ||
190 | + let url = 'index/Wine/change_attr_order', | ||
191 | + params = { | ||
192 | + attr_array: arr, | ||
193 | + | ||
194 | + } | ||
195 | + app.post(url, params).then((res) => { | ||
196 | + console.log(res); | ||
197 | + wx.showToast({ | ||
198 | + title: '修改成功', | ||
199 | + icon:'none' | ||
200 | + }) | ||
201 | + | ||
202 | + setTimeout(function() { | ||
203 | + wx.navigateBack({ | ||
204 | + checked: true | ||
205 | + }) | ||
206 | + }, 1500) | ||
207 | + | ||
208 | + | ||
209 | + | ||
210 | + }).catch((err) => { | ||
211 | + | ||
212 | + }) | ||
213 | + } | ||
214 | + | ||
215 | + }, | ||
18 | /** | 216 | /** |
19 | * 生命周期函数--监听页面初次渲染完成 | 217 | * 生命周期函数--监听页面初次渲染完成 |
20 | */ | 218 | */ |
21 | - onReady: function () { | 219 | + onReady: function() { |
22 | 220 | ||
23 | }, | 221 | }, |
24 | 222 | ||
25 | /** | 223 | /** |
26 | * 生命周期函数--监听页面显示 | 224 | * 生命周期函数--监听页面显示 |
27 | */ | 225 | */ |
28 | - onShow: function () { | 226 | + onShow: function() { |
29 | 227 | ||
30 | }, | 228 | }, |
31 | 229 | ||
32 | /** | 230 | /** |
33 | * 生命周期函数--监听页面隐藏 | 231 | * 生命周期函数--监听页面隐藏 |
34 | */ | 232 | */ |
35 | - onHide: function () { | 233 | + onHide: function() { |
36 | 234 | ||
37 | }, | 235 | }, |
38 | 236 | ||
39 | /** | 237 | /** |
40 | * 生命周期函数--监听页面卸载 | 238 | * 生命周期函数--监听页面卸载 |
41 | */ | 239 | */ |
42 | - onUnload: function () { | 240 | + onUnload: function() { |
43 | 241 | ||
44 | }, | 242 | }, |
45 | 243 | ||
46 | /** | 244 | /** |
47 | * 页面相关事件处理函数--监听用户下拉动作 | 245 | * 页面相关事件处理函数--监听用户下拉动作 |
48 | */ | 246 | */ |
49 | - onPullDownRefresh: function () { | 247 | + onPullDownRefresh: function() { |
50 | 248 | ||
51 | }, | 249 | }, |
52 | 250 | ||
53 | /** | 251 | /** |
54 | * 页面上拉触底事件的处理函数 | 252 | * 页面上拉触底事件的处理函数 |
55 | */ | 253 | */ |
56 | - onReachBottom: function () { | 254 | + onReachBottom: function() { |
57 | 255 | ||
58 | }, | 256 | }, |
59 | 257 | ||
60 | /** | 258 | /** |
61 | * 用户点击右上角分享 | 259 | * 用户点击右上角分享 |
62 | */ | 260 | */ |
63 | - onShareAppMessage: function () { | 261 | + onShareAppMessage: function() { |
64 | 262 | ||
65 | } | 263 | } |
66 | }) | 264 | }) |
1 | -<!--pages/homeblock/shuxing/shuxing.wxml--> | ||
2 | -<text>pages/homeblock/shuxing/shuxing.wxml</text> | 1 | +<view class="clear" wx:if="{{type==1}}" bindtap="qingchu">清除</view> |
2 | +<view class="clear" wx:if="{{type==2}}">编辑</view> | ||
3 | +<view class="clear" wx:if="{{type==3}}" bindtap="finish">完成</view> | ||
4 | + | ||
5 | +<view class="morenshu"> | ||
6 | + <view class="moren">默认属性</view> | ||
7 | + <view class="longan">长按可拖动排序</view> | ||
8 | +</view> | ||
9 | + | ||
10 | +<view class="shubox"> | ||
11 | + <view class="shuitem" wx:for="{{user_list}}" wx:key=""> | ||
12 | + {{item.name}} | ||
13 | + | ||
14 | + <view class="cancelmg" wx:if="{{type!=1}}" bindtap="shanchu" data-id="{{item.id}}"> | ||
15 | + <image src="{{url}}/bicon_09x.png"></image> | ||
16 | + </view> | ||
17 | + </view> | ||
18 | + | ||
19 | +</view> | ||
20 | + | ||
21 | + | ||
22 | +<view class="morenshu allshu"> | ||
23 | + <view class="moren">所有属性</view> | ||
24 | + <view class="longan">长按可拖动排序</view> | ||
25 | +</view> | ||
26 | + | ||
27 | + | ||
28 | +<view class="shubox"> | ||
29 | + <view class="allshuitem {{item.sel==true?'selitem':''}}" wx:for="{{list}}" wx:key="" | ||
30 | +bindlongpress="handleLongPress" data-id="{{item.id}}">{{item.name}}</view> | ||
31 | + | ||
32 | +</view> |
1 | -/* pages/homeblock/shuxing/shuxing.wxss */ | ||
1 | +page{ | ||
2 | + background: #F2F2F2; | ||
3 | + padding: 0 33rpx; | ||
4 | + box-sizing: border-box | ||
5 | +} | ||
6 | + | ||
7 | +.clear{ | ||
8 | + color:#E81825; | ||
9 | + font-size: 28rpx; | ||
10 | + display:flex; | ||
11 | + justify-content: flex-end; | ||
12 | + | ||
13 | + margin-top:20rpx; | ||
14 | + | ||
15 | +} | ||
16 | +.moren{ | ||
17 | + color:#1A1A1A; | ||
18 | + font-size: 32rpx; | ||
19 | + font-weight: bold | ||
20 | +} | ||
21 | +.morenshu{ | ||
22 | + display:flex; | ||
23 | + align-items: center; | ||
24 | + justify-content: space-between | ||
25 | +} | ||
26 | +.longan{ | ||
27 | + color:#999999; | ||
28 | + font-size: 26rpx; | ||
29 | +} | ||
30 | +.shubox{ | ||
31 | + display:flex; | ||
32 | + flex-wrap: wrap; | ||
33 | + align-items: center; | ||
34 | + margin-top:29rpx; | ||
35 | +} | ||
36 | +.shuitem{ | ||
37 | + margin-right:20rpx; | ||
38 | + padding:10rpx 20rpx; | ||
39 | + box-sizing: border-box; | ||
40 | + background: #FAFAFA; | ||
41 | + color:#666666; | ||
42 | + font-size: 26rpx; | ||
43 | + margin-top:16rpx; | ||
44 | + position: relative | ||
45 | +} | ||
46 | +.allshuitem{ | ||
47 | + margin-right:20rpx; | ||
48 | + padding:10rpx 20rpx; | ||
49 | + box-sizing: border-box; | ||
50 | + background: #EBEBEB; | ||
51 | + color:#CCCCCC; | ||
52 | + font-size: 26rpx; | ||
53 | + margin-top:16rpx; | ||
54 | + position: relative | ||
55 | +} | ||
56 | +.cancelmg{ | ||
57 | + width:22rpx; | ||
58 | + height:22rpx; | ||
59 | + font-size: 0; | ||
60 | + border-radius:50%; | ||
61 | + position: absolute; | ||
62 | + right:-10rpx; | ||
63 | + top:-10rpx; | ||
64 | + | ||
65 | +} | ||
66 | +.cancelmg image{ | ||
67 | + width:100%; | ||
68 | + height:100%; | ||
69 | + border-radius:50%; | ||
70 | + | ||
71 | +} | ||
72 | +.allshu{ | ||
73 | + margin-top:60rpx; | ||
74 | +} | ||
75 | +.selitem{ | ||
76 | + background: #fff; | ||
77 | + color:#666666 | ||
78 | +} |
@@ -5,16 +5,23 @@ Page({ | @@ -5,16 +5,23 @@ Page({ | ||
5 | * 页面的初始数据 | 5 | * 页面的初始数据 |
6 | */ | 6 | */ |
7 | data: { | 7 | data: { |
8 | - | 8 | + videourl:'' |
9 | }, | 9 | }, |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * 生命周期函数--监听页面加载 | 12 | * 生命周期函数--监听页面加载 |
13 | */ | 13 | */ |
14 | onLoad: function (options) { | 14 | onLoad: function (options) { |
15 | - | 15 | + this.setData({ |
16 | + videourl:options.url | ||
17 | + }) | ||
18 | + }, | ||
19 | + end(){ | ||
20 | + console.log(43347889) | ||
21 | + wx.navigateBack({ | ||
22 | + checked:true | ||
23 | + }) | ||
16 | }, | 24 | }, |
17 | - | ||
18 | /** | 25 | /** |
19 | * 生命周期函数--监听页面初次渲染完成 | 26 | * 生命周期函数--监听页面初次渲染完成 |
20 | */ | 27 | */ |
1 | -<!--pages/myblock/jifenjilu/jifenjilu.wxml--> | ||
2 | -<text>pages/myblock/jifenjilu/jifenjilu.wxml</text> | 1 | +<view class="jilubox"> |
2 | + <view class="jiluitem"> | ||
3 | + <view class="jiluleft"> | ||
4 | + <view class="jilutext">评论</view> | ||
5 | + <view class="jiludate">2019-02-28 11:23</view> | ||
6 | + </view> | ||
7 | + | ||
8 | + <view class="jiluright"> | ||
9 | + <view class="righttop">+100.00</view> | ||
10 | + | ||
11 | + <view class="righttext">已成功</view> | ||
12 | + </view> | ||
13 | + </view> | ||
14 | + <view class="jiluitem"> | ||
15 | + <view class="jiluleft"> | ||
16 | + <view class="jilutext">评论</view> | ||
17 | + <view class="jiludate">2019-02-28 11:23</view> | ||
18 | + </view> | ||
19 | + | ||
20 | + <view class="jiluright"> | ||
21 | + <view class="righttop">+100.00</view> | ||
22 | + | ||
23 | + <view class="righttext">已成功</view> | ||
24 | + </view> | ||
25 | + </view> | ||
26 | + <view class="jiluitem"> | ||
27 | + <view class="jiluleft"> | ||
28 | + <view class="jilutext">评论</view> | ||
29 | + <view class="jiludate">2019-02-28 11:23</view> | ||
30 | + </view> | ||
31 | + | ||
32 | + <view class="jiluright"> | ||
33 | + <view class="righttop">+100.00</view> | ||
34 | + | ||
35 | + <view class="righttext">已成功</view> | ||
36 | + </view> | ||
37 | + </view> | ||
38 | + <view class="jiluitem"> | ||
39 | + <view class="jiluleft"> | ||
40 | + <view class="jilutext">评论</view> | ||
41 | + <view class="jiludate">2019-02-28 11:23</view> | ||
42 | + </view> | ||
43 | + | ||
44 | + <view class="jiluright"> | ||
45 | + <view class="righttop">+100.00</view> | ||
46 | + | ||
47 | + <view class="righttext">已成功</view> | ||
48 | + </view> | ||
49 | + </view> | ||
50 | + <view class="jiluitem"> | ||
51 | + <view class="jiluleft"> | ||
52 | + <view class="jilutext">评论</view> | ||
53 | + <view class="jiludate">2019-02-28 11:23</view> | ||
54 | + </view> | ||
55 | + | ||
56 | + <view class="jiluright"> | ||
57 | + <view class="righttop">+100.00</view> | ||
58 | + | ||
59 | + <view class="righttext">已成功</view> | ||
60 | + </view> | ||
61 | + </view> | ||
62 | + <view class="jiluitem"> | ||
63 | + <view class="jiluleft"> | ||
64 | + <view class="jilutext">评论</view> | ||
65 | + <view class="jiludate">2019-02-28 11:23</view> | ||
66 | + </view> | ||
67 | + | ||
68 | + <view class="jiluright"> | ||
69 | + <view class="righttop">+100.00</view> | ||
70 | + | ||
71 | + <view class="righttext">已成功</view> | ||
72 | + </view> | ||
73 | + </view> | ||
74 | + <view class="jiluitem"> | ||
75 | + <view class="jiluleft"> | ||
76 | + <view class="jilutext">评论</view> | ||
77 | + <view class="jiludate">2019-02-28 11:23</view> | ||
78 | + </view> | ||
79 | + | ||
80 | + <view class="jiluright"> | ||
81 | + <view class="righttop">+100.00</view> | ||
82 | + | ||
83 | + <view class="righttext">已成功</view> | ||
84 | + </view> | ||
85 | + </view> | ||
86 | +</view> |
1 | -/* pages/myblock/jifenjilu/jifenjilu.wxss */ | ||
1 | + | ||
2 | +.jilubox{ | ||
3 | + padding:0 35rpx; | ||
4 | + box-sizing: border-box; | ||
5 | +} | ||
6 | +.jiluitem{ | ||
7 | + display:flex; | ||
8 | + align-items: center; | ||
9 | + justify-content: space-between; | ||
10 | +} | ||
11 | +.jilutext{ | ||
12 | + color:#1A1A1A; | ||
13 | + font-size:32rpx; | ||
14 | +} | ||
15 | +.jiludate{ | ||
16 | + color:#999999; | ||
17 | + font-size:24rpx; | ||
18 | + margin-top:22rpx; | ||
19 | +} | ||
20 | +.righttop{ | ||
21 | + color:#FF5344; | ||
22 | + font-size: 32rpx; | ||
23 | +} | ||
24 | +.righttext{ | ||
25 | + color:#666666; | ||
26 | + font-size: 26rpx; | ||
27 | + margin-top:22rpx; | ||
28 | + text-align: center | ||
29 | + | ||
30 | +} | ||
31 | +.jiluitem{ | ||
32 | + padding: 42rpx 0; | ||
33 | + box-sizing: border-box; | ||
34 | + border-bottom:1rpx solid #f5f5f5; | ||
35 | +} |
1 | // pages/myblock/niangjiulist/niangjiulist.js | 1 | // pages/myblock/niangjiulist/niangjiulist.js |
2 | +const app=getApp() | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | data: { | 8 | data: { |
8 | - | 9 | + url:'' |
9 | }, | 10 | }, |
10 | 11 | ||
11 | /** | 12 | /** |
12 | * 生命周期函数--监听页面加载 | 13 | * 生命周期函数--监听页面加载 |
13 | */ | 14 | */ |
14 | onLoad: function (options) { | 15 | onLoad: function (options) { |
15 | - | 16 | + this.setData({ |
17 | + url: app.globalData.url, | ||
18 | + }) | ||
16 | }, | 19 | }, |
17 | 20 | ||
18 | /** | 21 | /** |
1 | -<!--pages/myblock/niangjiulist/niangjiulist.wxml--> | ||
2 | -<text>pages/myblock/niangjiulist/niangjiulist.wxml</text> | 1 | +<view class="niangjiulist"> |
2 | + <view class="niangjiuitem"> | ||
3 | + <view class="niangjiuleft"> | ||
4 | + <view class="njiuimg"> | ||
5 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
6 | + </view> | ||
7 | + | ||
8 | + <view class="leftname">徐强</view> | ||
9 | + <view class="duigou" style="margin-left:20rpx;"> | ||
10 | + <image src="{{url}}aicon_20x.png"></image> | ||
11 | + </view> | ||
12 | + </view> | ||
13 | + | ||
14 | + <view class="atten">关注</view> | ||
15 | + </view> | ||
16 | + <view class="niangjiuitem"> | ||
17 | + <view class="niangjiuleft"> | ||
18 | + <view class="njiuimg"> | ||
19 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
20 | + </view> | ||
21 | + | ||
22 | + <view class="leftname">徐强</view> | ||
23 | + <view class="duigou" style="margin-left:20rpx;"> | ||
24 | + <image src="{{url}}aicon_20x.png"></image> | ||
25 | + </view> | ||
26 | + </view> | ||
27 | + | ||
28 | + <view class="atten">关注</view> | ||
29 | + </view> | ||
30 | + <view class="niangjiuitem"> | ||
31 | + <view class="niangjiuleft"> | ||
32 | + <view class="njiuimg"> | ||
33 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
34 | + </view> | ||
35 | + | ||
36 | + <view class="leftname">徐强</view> | ||
37 | + <view class="duigou" style="margin-left:20rpx;"> | ||
38 | + <image src="{{url}}aicon_20x.png"></image> | ||
39 | + </view> | ||
40 | + </view> | ||
41 | + | ||
42 | + <view class="atten">关注</view> | ||
43 | + </view> | ||
44 | + <view class="niangjiuitem"> | ||
45 | + <view class="niangjiuleft"> | ||
46 | + <view class="njiuimg"> | ||
47 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
48 | + </view> | ||
49 | + | ||
50 | + <view class="leftname">徐强</view> | ||
51 | + <view class="duigou" style="margin-left:20rpx;"> | ||
52 | + <image src="{{url}}aicon_20x.png"></image> | ||
53 | + </view> | ||
54 | + </view> | ||
55 | + | ||
56 | + <view class="atten">关注</view> | ||
57 | + </view> | ||
58 | + <view class="niangjiuitem"> | ||
59 | + <view class="niangjiuleft"> | ||
60 | + <view class="njiuimg"> | ||
61 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
62 | + </view> | ||
63 | + | ||
64 | + <view class="leftname">徐强</view> | ||
65 | + <view class="duigou" style="margin-left:20rpx;"> | ||
66 | + <image src="{{url}}aicon_20x.png"></image> | ||
67 | + </view> | ||
68 | + </view> | ||
69 | + | ||
70 | + <view class="alatten">关注</view> | ||
71 | + </view> | ||
72 | +</view> |
1 | -/* pages/myblock/niangjiulist/niangjiulist.wxss */ | ||
1 | + | ||
2 | +.niangjiuitem{ | ||
3 | + display:flex; | ||
4 | + align-items: center; | ||
5 | + justify-content: space-between; | ||
6 | + padding: 32rpx 0; | ||
7 | + box-sizing: border-box; | ||
8 | + border-bottom:1rpx solid #f5f5f5; | ||
9 | + | ||
10 | +} | ||
11 | + | ||
12 | +.duigou{ | ||
13 | + width:24rpx; | ||
14 | + height:24rpx; | ||
15 | + font-size: 0; | ||
16 | + margin-left:8rpx; | ||
17 | +} | ||
18 | + | ||
19 | + | ||
20 | +.niangjiulist{ | ||
21 | + padding: 0 32rpx; | ||
22 | +} | ||
23 | +.njiuimg{ | ||
24 | + width:60rpx; | ||
25 | + height:60rpx; | ||
26 | + font-size: 0; | ||
27 | + border-radius: 50% | ||
28 | +} | ||
29 | + | ||
30 | +.njiuimg image{ | ||
31 | + border-radius:50%; | ||
32 | +} | ||
33 | +.niangjiuleft{ | ||
34 | + display:flex; | ||
35 | + align-items: center; | ||
36 | +} | ||
37 | +.leftname{ | ||
38 | + color:#1A1A1A; | ||
39 | + font-size: 28rpx; | ||
40 | + margin-left:30rpx; | ||
41 | +} | ||
42 | +.alatten{ | ||
43 | + padding:0 20rpx; | ||
44 | + height:50rpx; | ||
45 | + background:#B3B3B3; | ||
46 | + border-radius:2rpx; | ||
47 | + font-size:26rpx; | ||
48 | + color:#fff; | ||
49 | + text-align:center; | ||
50 | + line-height:50rpx; | ||
51 | + | ||
52 | +} |
1 | // pages/myblock/pingjia/pingjia.js | 1 | // pages/myblock/pingjia/pingjia.js |
2 | +const app=getApp(); | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | data: { | 8 | data: { |
8 | - | 9 | + url:'' |
9 | }, | 10 | }, |
10 | 11 | ||
11 | /** | 12 | /** |
12 | * 生命周期函数--监听页面加载 | 13 | * 生命周期函数--监听页面加载 |
13 | */ | 14 | */ |
14 | onLoad: function (options) { | 15 | onLoad: function (options) { |
15 | - | 16 | + this.setData({ |
17 | + url: app.globalData.url | ||
18 | + }) | ||
16 | }, | 19 | }, |
17 | 20 | ||
18 | /** | 21 | /** |
1 | -<!--pages/myblock/pingjia/pingjia.wxml--> | ||
2 | -<text>pages/myblock/pingjia/pingjia.wxml</text> | 1 | +<view class="commentlist"> |
2 | + <view class="commentitem"> | ||
3 | + <view class="commentleft"> | ||
4 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
5 | + </view> | ||
6 | + | ||
7 | + <view class="commentright"> | ||
8 | + <view class="rightname">小叶子</view> | ||
9 | + <view class="rightdate">2019年11月5日</view> | ||
10 | + <view class="righttext">我怎么这么好看</view> | ||
11 | + </view> | ||
12 | + </view> | ||
13 | + <view class="commentitem"> | ||
14 | + <view class="commentleft"> | ||
15 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
16 | + </view> | ||
17 | + | ||
18 | + <view class="commentright"> | ||
19 | + <view class="rightname">小叶子</view> | ||
20 | + <view class="rightdate">2019年11月5日</view> | ||
21 | + <view class="righttext">我怎么这么好看</view> | ||
22 | + </view> | ||
23 | + </view> | ||
24 | + <view class="commentitem"> | ||
25 | + <view class="commentleft"> | ||
26 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
27 | + </view> | ||
28 | + | ||
29 | + <view class="commentright"> | ||
30 | + <view class="rightname">小叶子</view> | ||
31 | + <view class="rightdate">2019年11月5日</view> | ||
32 | + <view class="righttext">我怎么这么好看</view> | ||
33 | + </view> | ||
34 | + </view> | ||
35 | + <view class="commentitem"> | ||
36 | + <view class="commentleft"> | ||
37 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
38 | + </view> | ||
39 | + | ||
40 | + <view class="commentright"> | ||
41 | + <view class="rightname">小叶子</view> | ||
42 | + <view class="rightdate">2019年11月5日</view> | ||
43 | + <view class="righttext">我怎么这么好看</view> | ||
44 | + </view> | ||
45 | + </view> | ||
46 | + <view class="commentitem"> | ||
47 | + <view class="commentleft"> | ||
48 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
49 | + </view> | ||
50 | + | ||
51 | + <view class="commentright"> | ||
52 | + <view class="rightname">小叶子</view> | ||
53 | + <view class="rightdate">2019年11月5日</view> | ||
54 | + <view class="righttext">我怎么这么好看</view> | ||
55 | + </view> | ||
56 | + </view> | ||
57 | + <view class="commentitem"> | ||
58 | + <view class="commentleft"> | ||
59 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
60 | + </view> | ||
61 | + | ||
62 | + <view class="commentright"> | ||
63 | + <view class="rightname">小叶子</view> | ||
64 | + <view class="rightdate">2019年11月5日</view> | ||
65 | + <view class="righttext">我怎么这么好看</view> | ||
66 | + </view> | ||
67 | + </view> | ||
68 | + <view class="commentitem"> | ||
69 | + <view class="commentleft"> | ||
70 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
71 | + </view> | ||
72 | + | ||
73 | + <view class="commentright"> | ||
74 | + <view class="rightname">小叶子</view> | ||
75 | + <view class="rightdate">2019年11月5日</view> | ||
76 | + <view class="righttext">我怎么这么好看</view> | ||
77 | + </view> | ||
78 | + </view> | ||
79 | + <view class="commentitem"> | ||
80 | + <view class="commentleft"> | ||
81 | + <image src="{{url}}/aicon_77@2x.png"></image> | ||
82 | + </view> | ||
83 | + | ||
84 | + <view class="commentright"> | ||
85 | + <view class="rightname">小叶子</view> | ||
86 | + <view class="rightdate">2019年11月5日</view> | ||
87 | + <view class="righttext">我怎么这么好看</view> | ||
88 | + </view> | ||
89 | + </view> | ||
90 | + | ||
91 | + | ||
92 | + | ||
93 | +</view> | ||
94 | +<view class="pingjiabottom"> | ||
95 | + <view class="pbleft"> | ||
96 | + <input placeholder='输入评论的内容' placeholder-class='enterping' /> | ||
97 | + </view> | ||
98 | + | ||
99 | + <view class="pbright">发送</view> | ||
100 | +</view> |
1 | -/* pages/myblock/pingjia/pingjia.wxss */ | ||
1 | +.commentlist{ | ||
2 | + padding: 0 30rpx; | ||
3 | + box-sizing: border-box; | ||
4 | + padding-bottom: 100rpx; | ||
5 | +} | ||
6 | +.commentitem{ | ||
7 | + display:flex; | ||
8 | + padding: 40rpx 0; | ||
9 | + box-sizing: border-box; | ||
10 | + border-bottom:1rpx solid #f5f5f5; | ||
11 | + | ||
12 | + | ||
13 | +} | ||
14 | +.commentleft{ | ||
15 | + width:60rpx; | ||
16 | + height:60rpx; | ||
17 | + font-size: 0; | ||
18 | + border-radius:50%; | ||
19 | + | ||
20 | +} | ||
21 | +image{ | ||
22 | + width:100%; | ||
23 | + height:100%; | ||
24 | + border-radius: 50%; | ||
25 | +} | ||
26 | +.commentright{ | ||
27 | + margin-left:20rpx; | ||
28 | +} | ||
29 | +.rightname{ | ||
30 | + color:#666666; | ||
31 | + font-size: 28rpx; | ||
32 | + | ||
33 | +} | ||
34 | +.rightdate{ | ||
35 | + color:#999999; | ||
36 | + font-size: 24rpx; | ||
37 | + margin-top:14rpx; | ||
38 | +} | ||
39 | +.righttext{ | ||
40 | + color:#1A1A1A; | ||
41 | + font-size: 28rpx; | ||
42 | + margin-top:23rpx; | ||
43 | +} | ||
44 | +.pingjiabottom{ | ||
45 | + width:750rpx; | ||
46 | + height:86rpx; | ||
47 | + display:flex; | ||
48 | + align-items: center; | ||
49 | + justify-content: space-between; | ||
50 | + padding: 16rpx 30rpx; | ||
51 | + box-sizing: border-box; | ||
52 | + position: fixed; | ||
53 | + bottom:0rpx; | ||
54 | + background: #fff; | ||
55 | + border-top:1rpx solid #f5f5f5; | ||
56 | +} | ||
57 | +.pbleft{ | ||
58 | + width:531rpx; | ||
59 | + height:60rpx; | ||
60 | + background:rgba(242,242,242,1); | ||
61 | + border-radius:5rpx; | ||
62 | + color:#999999; | ||
63 | + font-size: 26rpx; | ||
64 | + padding: 0 26rpx; | ||
65 | + line-height: 60rpx; | ||
66 | + box-sizing: border-box | ||
67 | +} | ||
68 | +.pbleft input{ | ||
69 | + width:531rpx; | ||
70 | + height:60rpx; | ||
71 | + padding: 0 26rpx; | ||
72 | + line-height: 60rpx; | ||
73 | + box-sizing: border-box | ||
74 | + | ||
75 | +} | ||
76 | +.enterping{ | ||
77 | + color:#999999; | ||
78 | + font-size: 26rpx | ||
79 | +} | ||
80 | +.pbright{ | ||
81 | + width:120rpx; | ||
82 | + height:60rpx; | ||
83 | + background:rgba(232,24,37,1); | ||
84 | + border-radius:30rpx; | ||
85 | + color:#fff; | ||
86 | + font-size: 26rpx; | ||
87 | + text-align: center; | ||
88 | + line-height: 60rpx; | ||
89 | +} |
1 | // pages/myblock/shezhimima/shezhimima.js | 1 | // pages/myblock/shezhimima/shezhimima.js |
2 | +const app=getApp() | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | /** | 5 | /** |
5 | * 页面的初始数据 | 6 | * 页面的初始数据 |
6 | */ | 7 | */ |
7 | data: { | 8 | data: { |
8 | - | 9 | + url:'' |
9 | }, | 10 | }, |
10 | 11 | ||
11 | /** | 12 | /** |
12 | * 生命周期函数--监听页面加载 | 13 | * 生命周期函数--监听页面加载 |
13 | */ | 14 | */ |
14 | onLoad: function (options) { | 15 | onLoad: function (options) { |
16 | + this.setData({ | ||
17 | + url: app.globalData.url | ||
18 | + }) | ||
15 | 19 | ||
16 | }, | 20 | }, |
17 | 21 |
1 | -<!--pages/myblock/shezhimima/shezhimima.wxml--> | ||
2 | -<text>pages/myblock/shezhimima/shezhimima.wxml</text> | 1 | +<view class="setmima"> |
2 | + <view class="setmimaleft"> | ||
3 | + <input placeholder='设置密码' placeholder-class='shemi'/> | ||
4 | + | ||
5 | + </view> | ||
6 | + <view class="mimaeye"> | ||
7 | + <image src="{{url}}/bicon_14x.png"></image> | ||
8 | + </view> | ||
9 | +</view> | ||
10 | + | ||
11 | +<view class="que">确认</view> | ||
12 | + | ||
13 | +<view class="needmi">需要有6-20位数字、字母或符号组成,至少两种</view> | ||
14 | + | ||
15 | +<view class="mimasuccess">密码设置成功</view> |
1 | -/* pages/myblock/shezhimima/shezhimima.wxss */ | ||
1 | +page{ | ||
2 | + background: #F2F2F2 | ||
3 | +} | ||
4 | +.setmima{ | ||
5 | + width:540rpx; | ||
6 | + height:120rpx; | ||
7 | + background:rgba(255,255,255,1); | ||
8 | + border-radius:5rpx; | ||
9 | + margin:206rpx auto 0; | ||
10 | + display:flex; | ||
11 | + align-items: center; | ||
12 | + justify-content: space-between; | ||
13 | + padding: 0 30rpx; | ||
14 | + box-sizing: border-box | ||
15 | +} | ||
16 | +.setmimaleft{ | ||
17 | + width:420rpx; | ||
18 | + color:#1A1A1A; | ||
19 | + font-size: 30rpx; | ||
20 | + | ||
21 | +} | ||
22 | +.shemi{ | ||
23 | + color:#1A1A1A; | ||
24 | + font-size: 30rpx; | ||
25 | +} | ||
26 | +.mimaeye{ | ||
27 | + width:34rpx; | ||
28 | + height:16rpx; | ||
29 | + font-size: 0 | ||
30 | +} | ||
31 | +.que{ | ||
32 | + width:540rpx; | ||
33 | + height:100rpx; | ||
34 | + background:rgba(232,24,37,1); | ||
35 | + border-radius:50rpx; | ||
36 | + color:#fff; | ||
37 | + font-size: 30rpx; | ||
38 | + text-align: center; | ||
39 | + line-height: 100rpx; | ||
40 | + margin:90rpx auto 0; | ||
41 | +} | ||
42 | +.needmi{ | ||
43 | + color:#999999; | ||
44 | + font-size: 24rpx; | ||
45 | + text-align: center; | ||
46 | + margin-top:32rpx; | ||
47 | +} | ||
48 | +.mimasuccess{ | ||
49 | + width:290rpx; | ||
50 | + height:60rpx; | ||
51 | + background:rgba(0,0,0,1); | ||
52 | + opacity:0.8; | ||
53 | + border-radius:10rpx; | ||
54 | + color:#fff; | ||
55 | + font-size: 24rpx; | ||
56 | + text-align: center; | ||
57 | + line-height: 60rpx; | ||
58 | + margin:468rpx auto 0; | ||
59 | +} |
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | "list": [] | 49 | "list": [] |
50 | }, | 50 | }, |
51 | "miniprogram": { | 51 | "miniprogram": { |
52 | - "current": 30, | 52 | + "current": 35, |
53 | "list": [ | 53 | "list": [ |
54 | { | 54 | { |
55 | "id": -1, | 55 | "id": -1, |
@@ -265,6 +265,41 @@ | @@ -265,6 +265,41 @@ | ||
265 | "id": -1, | 265 | "id": -1, |
266 | "name": "属性", | 266 | "name": "属性", |
267 | "pathName": "pages/homeblock/shuxing/shuxing", | 267 | "pathName": "pages/homeblock/shuxing/shuxing", |
268 | + "query": "", | ||
269 | + "scene": null | ||
270 | + }, | ||
271 | + { | ||
272 | + "id": -1, | ||
273 | + "name": "选择城市", | ||
274 | + "pathName": "pages/homeblock/selectcity/selectcity", | ||
275 | + "query": "", | ||
276 | + "scene": null | ||
277 | + }, | ||
278 | + { | ||
279 | + "id": -1, | ||
280 | + "name": "专家酒品", | ||
281 | + "pathName": "pages/findblock/zhuanjiapinjiu/zhuanjiapinjiu", | ||
282 | + "query": "", | ||
283 | + "scene": null | ||
284 | + }, | ||
285 | + { | ||
286 | + "id": -1, | ||
287 | + "name": "专家酒品详情", | ||
288 | + "pathName": "pages/findblock/zhuanjiapinjiudetail/zhuanjiapinjiudetail", | ||
289 | + "query": "", | ||
290 | + "scene": null | ||
291 | + }, | ||
292 | + { | ||
293 | + "id": -1, | ||
294 | + "name": "酿酒师", | ||
295 | + "pathName": "pages/findblock/niangjiushi/niangjiushi", | ||
296 | + "query": "", | ||
297 | + "scene": null | ||
298 | + }, | ||
299 | + { | ||
300 | + "id": -1, | ||
301 | + "name": "酒单详情", | ||
302 | + "pathName": "pages/findblock/jiudandetail/jiudandetail", | ||
268 | "scene": null | 303 | "scene": null |
269 | } | 304 | } |
270 | ] | 305 | ] |
wxParse/html2json.js
0 → 100644
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 | +function trimHtml(html) { | ||
57 | + return html | ||
58 | + // .replace(/\r?\n+/g, '') | ||
59 | + .replace(/<!--.*?-->/ig, '') | ||
60 | + .replace(/\/\*.*?\*\//ig, '') | ||
61 | + .replace(/[ ]+</ig, '<') | ||
62 | +} | ||
63 | + | ||
64 | + | ||
65 | +function html2json(html, bindName) { | ||
66 | + //处理字符串 | ||
67 | + html = removeDOCTYPE(html); | ||
68 | + // html = trimHtml(html); | ||
69 | + // html = wxDiscode.strDiscode(html); | ||
70 | + //生成node节点 | ||
71 | + var bufArray = []; | ||
72 | + var results = { | ||
73 | + node: bindName, | ||
74 | + nodes: [], | ||
75 | + images:[], | ||
76 | + imageUrls:[] | ||
77 | + }; | ||
78 | + var index = 0; | ||
79 | + HTMLParser(html, { | ||
80 | + start: function (tag, attrs, unary) { | ||
81 | + //debug(tag, attrs, unary); | ||
82 | + // node for this element | ||
83 | + var node = { | ||
84 | + node: 'element', | ||
85 | + tag: tag, | ||
86 | + }; | ||
87 | + | ||
88 | + if (bufArray.length === 0) { | ||
89 | + node.index = index.toString() | ||
90 | + index += 1 | ||
91 | + } else { | ||
92 | + var parent = bufArray[0]; | ||
93 | + if (parent.nodes === undefined) { | ||
94 | + parent.nodes = []; | ||
95 | + } | ||
96 | + node.index = parent.index + '.' + parent.nodes.length | ||
97 | + } | ||
98 | + | ||
99 | + if (block[tag]) { | ||
100 | + node.tagType = "block"; | ||
101 | + } else if (inline[tag]) { | ||
102 | + node.tagType = "inline"; | ||
103 | + } else if (closeSelf[tag]) { | ||
104 | + node.tagType = "closeSelf"; | ||
105 | + } | ||
106 | + | ||
107 | + if (attrs.length !== 0) { | ||
108 | + node.attr = attrs.reduce(function (pre, attr) { | ||
109 | + var name = attr.name; | ||
110 | + var value = attr.value; | ||
111 | + if (name == 'class') { | ||
112 | + // console.dir(value); | ||
113 | + // value = value.join("") | ||
114 | + node.classStr = value; | ||
115 | + } | ||
116 | + // has multi attibutes | ||
117 | + // make it array of attribute | ||
118 | + if (name == 'style') { | ||
119 | + // console.dir(value); | ||
120 | + // value = value.join("") | ||
121 | + node.styleStr = value; | ||
122 | + } | ||
123 | + if (value.match(/ /)) { | ||
124 | + value = value.split(' '); | ||
125 | + } | ||
126 | + | ||
127 | + | ||
128 | + // if attr already exists | ||
129 | + // merge it | ||
130 | + if (pre[name]) { | ||
131 | + if (Array.isArray(pre[name])) { | ||
132 | + // already array, push to last | ||
133 | + pre[name].push(value); | ||
134 | + } else { | ||
135 | + // single value, make it array | ||
136 | + pre[name] = [pre[name], value]; | ||
137 | + } | ||
138 | + } else { | ||
139 | + // not exist, put it | ||
140 | + pre[name] = value; | ||
141 | + } | ||
142 | + | ||
143 | + return pre; | ||
144 | + }, {}); | ||
145 | + } | ||
146 | + | ||
147 | + //对img添加额外数据 | ||
148 | + if (node.tag === 'img') { | ||
149 | + node.imgIndex = results.images.length; | ||
150 | + var imgUrl = node.attr.src; | ||
151 | + if (imgUrl[0] == '') { | ||
152 | + imgUrl.splice(0, 1); | ||
153 | + } | ||
154 | + imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps); | ||
155 | + node.attr.src = imgUrl; | ||
156 | + node.from = bindName; | ||
157 | + results.images.push(node); | ||
158 | + results.imageUrls.push(imgUrl); | ||
159 | + } | ||
160 | + | ||
161 | + // 处理font标签样式属性 | ||
162 | + if (node.tag === 'font') { | ||
163 | + var fontSize = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; | ||
164 | + var styleAttrs = { | ||
165 | + 'color': 'color', | ||
166 | + 'face': 'font-family', | ||
167 | + 'size': 'font-size' | ||
168 | + }; | ||
169 | + if (!node.attr.style) node.attr.style = []; | ||
170 | + if (!node.styleStr) node.styleStr = ''; | ||
171 | + for (var key in styleAttrs) { | ||
172 | + if (node.attr[key]) { | ||
173 | + var value = key === 'size' ? fontSize[node.attr[key]-1] : node.attr[key]; | ||
174 | + node.attr.style.push(styleAttrs[key]); | ||
175 | + node.attr.style.push(value); | ||
176 | + node.styleStr += styleAttrs[key] + ': ' + value + ';'; | ||
177 | + } | ||
178 | + } | ||
179 | + } | ||
180 | + | ||
181 | + //临时记录source资源 | ||
182 | + if(node.tag === 'source'){ | ||
183 | + results.source = node.attr.src; | ||
184 | + } | ||
185 | + | ||
186 | + if (unary) { | ||
187 | + // if this tag doesn't have end tag | ||
188 | + // like <img src="hoge.png"/> | ||
189 | + // add to parents | ||
190 | + var parent = bufArray[0] || results; | ||
191 | + if (parent.nodes === undefined) { | ||
192 | + parent.nodes = []; | ||
193 | + } | ||
194 | + parent.nodes.push(node); | ||
195 | + } else { | ||
196 | + bufArray.unshift(node); | ||
197 | + } | ||
198 | + }, | ||
199 | + end: function (tag) { | ||
200 | + //debug(tag); | ||
201 | + // merge into parent tag | ||
202 | + var node = bufArray.shift(); | ||
203 | + if (node.tag !== tag) console.error('invalid state: mismatch end tag'); | ||
204 | + | ||
205 | + //当有缓存source资源时于于video补上src资源 | ||
206 | + if(node.tag === 'video' && results.source){ | ||
207 | + node.attr.src = results.source; | ||
208 | + delete results.source; | ||
209 | + } | ||
210 | + | ||
211 | + if (bufArray.length === 0) { | ||
212 | + results.nodes.push(node); | ||
213 | + } else { | ||
214 | + var parent = bufArray[0]; | ||
215 | + if (parent.nodes === undefined) { | ||
216 | + parent.nodes = []; | ||
217 | + } | ||
218 | + parent.nodes.push(node); | ||
219 | + } | ||
220 | + }, | ||
221 | + chars: function (text) { | ||
222 | + //debug(text); | ||
223 | + var node = { | ||
224 | + node: 'text', | ||
225 | + text: text, | ||
226 | + textArray:transEmojiStr(text) | ||
227 | + }; | ||
228 | + | ||
229 | + if (bufArray.length === 0) { | ||
230 | + node.index = index.toString() | ||
231 | + index += 1 | ||
232 | + results.nodes.push(node); | ||
233 | + } else { | ||
234 | + var parent = bufArray[0]; | ||
235 | + if (parent.nodes === undefined) { | ||
236 | + parent.nodes = []; | ||
237 | + } | ||
238 | + node.index = parent.index + '.' + parent.nodes.length | ||
239 | + parent.nodes.push(node); | ||
240 | + } | ||
241 | + }, | ||
242 | + comment: function (text) { | ||
243 | + //debug(text); | ||
244 | + // var node = { | ||
245 | + // node: 'comment', | ||
246 | + // text: text, | ||
247 | + // }; | ||
248 | + // var parent = bufArray[0]; | ||
249 | + // if (parent.nodes === undefined) { | ||
250 | + // parent.nodes = []; | ||
251 | + // } | ||
252 | + // parent.nodes.push(node); | ||
253 | + }, | ||
254 | + }); | ||
255 | + return results; | ||
256 | +}; | ||
257 | + | ||
258 | +function transEmojiStr(str){ | ||
259 | + // var eReg = new RegExp("["+__reg+' '+"]"); | ||
260 | +// str = str.replace(/\[([^\[\]]+)\]/g,':$1:') | ||
261 | + | ||
262 | + var emojiObjs = []; | ||
263 | + //如果正则表达式为空 | ||
264 | + if(__emojisReg.length == 0 || !__emojis){ | ||
265 | + var emojiObj = {} | ||
266 | + emojiObj.node = "text"; | ||
267 | + emojiObj.text = str; | ||
268 | + array = [emojiObj]; | ||
269 | + return array; | ||
270 | + } | ||
271 | + //这个地方需要调整 | ||
272 | + str = str.replace(/\[([^\[\]]+)\]/g,':$1:') | ||
273 | + var eReg = new RegExp("[:]"); | ||
274 | + var array = str.split(eReg); | ||
275 | + for(var i = 0; i < array.length; i++){ | ||
276 | + var ele = array[i]; | ||
277 | + var emojiObj = {}; | ||
278 | + if(__emojis[ele]){ | ||
279 | + emojiObj.node = "element"; | ||
280 | + emojiObj.tag = "emoji"; | ||
281 | + emojiObj.text = __emojis[ele]; | ||
282 | + emojiObj.baseSrc= __emojisBaseSrc; | ||
283 | + }else{ | ||
284 | + emojiObj.node = "text"; | ||
285 | + emojiObj.text = ele; | ||
286 | + } | ||
287 | + emojiObjs.push(emojiObj); | ||
288 | + } | ||
289 | + | ||
290 | + return emojiObjs; | ||
291 | +} | ||
292 | + | ||
293 | +function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){ | ||
294 | + __emojisReg = reg; | ||
295 | + __emojisBaseSrc=baseSrc; | ||
296 | + __emojis=emojis; | ||
297 | +} | ||
298 | + | ||
299 | +module.exports = { | ||
300 | + html2json: html2json, | ||
301 | + emojisInit:emojisInit | ||
302 | +}; | ||
303 | + |
wxParse/htmlparser.js
0 → 100644
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("<!--") == 0) { | ||
52 | + index = 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(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/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; |
-
请 注册 或 登录 后发表评论