806d3c4a by simon

版本提交

1 parent 5f588c45
Showing 367 changed files with 1689 additions and 401 deletions
...@@ -8,18 +8,20 @@ let store = require('./utils/stroage'); ...@@ -8,18 +8,20 @@ let store = require('./utils/stroage');
8 require('./http/mock-data'); 8 require('./http/mock-data');
9 9
10 App({ 10 App({
11 get: fetchApi.fetch, 11 get: fetchApi.fetch,
12 post: (params) => { 12 post: (params) => {
13 params.method = 'post'; 13 params.method = 'post';
14 return fetchApi.fetch(params); 14 return fetchApi.fetch(params);
15 }, 15 },
16 api: api, 16 api: api,
17 config: config, 17 config: config,
18 router: router, 18 router: router,
19 store: store, 19 store: store,
20 onLaunch: function () {}, 20 onLaunch: function () {},
21 globalData: { 21 globalData: {
22 indexInfo: null, 22 indexInfo: null,
23 userInfo: null 23 userInfo: null,
24 } 24 wxcode: store.getItem("wxcode"),
25 tlMemberCode: ""
26 }
25 }) 27 })
......
1 { 1 {
2 "pages": [ 2 "pages": [
3 "pages/index/index", 3 "pages/index/index",
4 "pages/example/example", 4 "pages/authorize/authorize",
5 "pages/more/more" 5 "pages/wish/wish",
6 ], 6 "pages/create-wish/create-wish",
7 "window": { 7 "pages/new-welfare/new-welfare",
8 "backgroundTextStyle": "light", 8 "pages/user-table/user-table",
9 "navigationBarBackgroundColor": "#fff", 9 "pages/rank/rank",
10 "navigationBarTitleText": "心愿单", 10 "pages/poster/poster",
11 "navigationBarTextStyle": "black" 11 "pages/coop/coop",
12 }, 12 "pages/example/example",
13 "tabBar": { 13 "pages/more/more"
14 "color": "#7A7E83", 14 ],
15 "selectedColor": "#CF4646", 15 "window": {
16 "borderStyle": "black", 16 "backgroundTextStyle": "light",
17 "backgroundColor": "#ffffff", 17 "navigationBarBackgroundColor": "#fff",
18 "list": [{ 18 "navigationBarTitleText": "心愿单",
19 "pagePath": "pages/index/index", 19 "navigationBarTextStyle": "black"
20 "iconPath": "image/tabbar/home_D.png", 20 }
21 "selectedIconPath": "image/tabbar/home.png",
22 "text": "介绍"
23 },
24 {
25 "pagePath": "pages/more/more",
26 "iconPath": "image/tabbar/set_D.png",
27 "selectedIconPath": "image/tabbar/set.png",
28 "text": "更多"
29 }
30 ]
31 }
32 } 21 }
......
...@@ -19,68 +19,68 @@ ...@@ -19,68 +19,68 @@
19 // @lazysprite "filetype"; 19 // @lazysprite "filetype";
20 20
21 .test { 21 .test {
22 background-image: url(%ASSETS_IMG%/qr-r.jpg); 22 background-image: url(%ASSETS_IMG%/qr-r.jpg);
23 } 23 }
24 24
25 .app { 25 .app {
26 height: 100%; 26 height: 100%;
27 justify-content: space-between; 27 justify-content: space-between;
28 // text-align: center; 28 // text-align: center;
29 box-sizing: border-box; 29 box-sizing: border-box;
30 font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif, FZY3JW-GB1-0; 30 font-family: SourceHanSansCN, -apple-system-font, Helvetica Neue, Helvetica, sans-serif, FZY3JW-GB1-0;
31 } 31 }
32 32
33 .app__width { 33 .app__width {
34 width: 750px; 34 width: 750px;
35 } 35 }
36 36
37 .app__width { 37 .app__width {
38 width: 750px; 38 width: 750px;
39 } 39 }
40 40
41 .app__inner { 41 .app__inner {
42 margin: 20px; 42 margin: 20px;
43 } 43 }
44 44
45 .app__title { 45 .app__title {
46 font-size: $fontSize; 46 font-size: $fontSize;
47 line-height: $fontSize + 4px; 47 line-height: $fontSize + 4px;
48 font-weight: bold; 48 font-weight: bold;
49 padding-bottom: 10px; 49 padding-bottom: 10px;
50 margin-bottom: 20px; 50 margin-bottom: 20px;
51 border-bottom: .5px solid #EEEEEE; 51 border-bottom: .5px solid #EEEEEE;
52 } 52 }
53 53
54 .app__desc { 54 .app__desc {
55 font-size: $fontSizeSmaller; 55 font-size: $fontSizeSmaller;
56 line-height: $fontSizeSmaller +2px; 56 line-height: $fontSizeSmaller +2px;
57 margin-bottom: 20px; 57 margin-bottom: 20px;
58 color: $colorGray; 58 color: $colorGray;
59 } 59 }
60 60
61 .app__bgc { 61 .app__bgc {
62 position: fixed; 62 position: fixed;
63 background-color: #ffffff; 63 background-color: #ffffff;
64 width: 100%; 64 width: 100%;
65 height: 100%; 65 height: 100%;
66 } 66 }
67 67
68 .app__bg { 68 .app__bg {
69 position: absolute; 69 position: absolute;
70 width: 100%; 70 width: 100%;
71 height: 100%; 71 height: 100%;
72 } 72 }
73 73
74 .app__top-shadow { 74 .app__top-shadow {
75 position: fixed; 75 position: fixed;
76 width: 750px; 76 width: 750px;
77 height: 1px; 77 height: 1px;
78 box-shadow: 0px 4px 0.9px 0.1px rgba(6, 0, 1, 0.07); 78 box-shadow: 0px 4px 0.9px 0.1px rgba(6, 0, 1, 0.07);
79 background-color: #ffffff; 79 background-color: #ffffff;
80 } 80 }
81 81
82 .app__content { 82 .app__content {
83 position: relative; 83 position: relative;
84 } 84 }
85 85
86 86
...@@ -88,26 +88,31 @@ ...@@ -88,26 +88,31 @@
88 // web font icon 88 // web font icon
89 89
90 @font-face { 90 @font-face {
91 font-family: "iconfont"; 91 font-family: "iconfont";
92 src:url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAOsAAsAAAAAB6gAAANdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqDDIJmATYCJAMMCwgABCAFhG0HORuvBsgOJUHBwIABAAlgPHyN/f7c3UVEk0mi+3QSQxJNJCoexUrxUhhKIyT4UsKbL89+kizTNWb3wyt7UkR96ayA4xev1q04fZzIa32ey/Gt5wc26luWy5iT9qKFAcYBBbQ3RgEFWiAJesPYlRdxn0C9YccRqxl5ZcBCYSwLxJFS3gwsUk6lpj7UCtUle4t4Yqo2XaeXAHj0vx//QUhYkFRlxtq1w/Q2kPRz+iOmhipDoM51Gx7PD3aIjBlAITZLgxuoMDODUq8YTerLqxUhjRU3GgFfqeqrzT88kiCqGbWNYAJlEz+nbQmJP1h91rUZVMPcGeAZM51XhqohJw97O/vO23paqy3T6coNhsqQ1esr3nVWF19mTZ3YnOwtWwPk5bvMfvYCQV11V+xUzZx02tPO6H02TtP0y4dn5a7M9ravfPvs/poNl43TTmVrW87O66dcKzd3myo2Tjo5rW07l6+fcXXd3KmUDdBKXH240GtvAAw49qfa2BeatkTevUsumTJX5pzRRVy781FXe+YP15YALi0+kkDHQRm8OLz2sP/U1NGjIPxKdyVpafxHpKWvbajtddvnaxmZHLP0XGY1d2wvLarJWrd3LMD6Q1DiSPHusrPgvOxtlAKDyt7bk32nH3emP+npcwo2dKU/Vj040Jn2+HTvAU5VFtOf5vZDf683NVrpbEvIO7N3IX421A40MRbmdVIPQGXQhMi7/+o3vjanTBtt4/7Vygr4/p/GIHW7aqBWorXqz7QVQMVYCK4xXLnISlup57Ntpvcth3Ju8j8aod2b/tauu8+FWl0xkhpDyGqNEIWZQZUG86hWawH1pmUebtBBQolShynjAKHVFSTNPpG1ekUU5jWqdPuGaq1Bod56OJ7ZYCyUdKqEmjFqgy3dUNkqCozlwXRQX4Lk7VyzlNT4XAWSNMo4DA4IyuYzkYCkMTZoOuQhGDOQkUQeZoDHEMeJUC2JKtSKAxQYq2MCA5myFwW0ijygrZAgzTCkDdSiG6TUSiRg3MEYnft8CUSuHaeZVNNTka6ASDSUo0PBAgS1IDKNQquea3lGo4NcCAxjQAyJiAdlgFkIhyOC1OWzVJBWWABFj5RajECzH9PWGDC/mX++Q1DPGJsjRY6i5hgx1hSNwhTxatwNAAAAAA==') format('woff2'), 92 src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAOsAAsAAAAAB6gAAANdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqDDIJmATYCJAMMCwgABCAFhG0HORuvBsgOJUHBwIABAAlgPHyN/f7c3UVEk0mi+3QSQxJNJCoexUrxUhhKIyT4UsKbL89+kizTNWb3wyt7UkR96ayA4xev1q04fZzIa32ey/Gt5wc26luWy5iT9qKFAcYBBbQ3RgEFWiAJesPYlRdxn0C9YccRqxl5ZcBCYSwLxJFS3gwsUk6lpj7UCtUle4t4Yqo2XaeXAHj0vx//QUhYkFRlxtq1w/Q2kPRz+iOmhipDoM51Gx7PD3aIjBlAITZLgxuoMDODUq8YTerLqxUhjRU3GgFfqeqrzT88kiCqGbWNYAJlEz+nbQmJP1h91rUZVMPcGeAZM51XhqohJw97O/vO23paqy3T6coNhsqQ1esr3nVWF19mTZ3YnOwtWwPk5bvMfvYCQV11V+xUzZx02tPO6H02TtP0y4dn5a7M9ravfPvs/poNl43TTmVrW87O66dcKzd3myo2Tjo5rW07l6+fcXXd3KmUDdBKXH240GtvAAw49qfa2BeatkTevUsumTJX5pzRRVy781FXe+YP15YALi0+kkDHQRm8OLz2sP/U1NGjIPxKdyVpafxHpKWvbajtddvnaxmZHLP0XGY1d2wvLarJWrd3LMD6Q1DiSPHusrPgvOxtlAKDyt7bk32nH3emP+npcwo2dKU/Vj040Jn2+HTvAU5VFtOf5vZDf683NVrpbEvIO7N3IX421A40MRbmdVIPQGXQhMi7/+o3vjanTBtt4/7Vygr4/p/GIHW7aqBWorXqz7QVQMVYCK4xXLnISlup57Ntpvcth3Ju8j8aod2b/tauu8+FWl0xkhpDyGqNEIWZQZUG86hWawH1pmUebtBBQolShynjAKHVFSTNPpG1ekUU5jWqdPuGaq1Bod56OJ7ZYCyUdKqEmjFqgy3dUNkqCozlwXRQX4Lk7VyzlNT4XAWSNMo4DA4IyuYzkYCkMTZoOuQhGDOQkUQeZoDHEMeJUC2JKtSKAxQYq2MCA5myFwW0ijygrZAgzTCkDdSiG6TUSiRg3MEYnft8CUSuHaeZVNNTka6ASDSUo0PBAgS1IDKNQquea3lGo4NcCAxjQAyJiAdlgFkIhyOC1OWzVJBWWABFj5RajECzH9PWGDC/mX++Q1DPGJsjRY6i5hgx1hSNwhTxatwNAAAAAA==') format('woff2'),
93 } 93 }
94 94
95 .iconfont { 95 .iconfont {
96 font-family: "iconfont" !important; 96 font-family: "iconfont" !important;
97 font-size: 16px; 97 font-size: 16px;
98 font-style: normal; 98 font-style: normal;
99 -webkit-font-smoothing: antialiased; 99 -webkit-font-smoothing: antialiased;
100 -moz-osx-font-smoothing: grayscale; 100 -moz-osx-font-smoothing: grayscale;
101 } 101 }
102 102
103 .iconrefresh:before { 103 .iconrefresh:before {
104 content: "\e874"; 104 content: "\e874";
105 } 105 }
106 106
107 .iconempty:before { 107 .iconempty:before {
108 content: "\e6a6"; 108 content: "\e6a6";
109 } 109 }
110 110
111 .drop-down-item :last-child { 111 .drop-down-item :last-child {
112 border-bottom: none; 112 border-bottom: none;
113 }
114
115
116 .van-popup {
117 background-color: transparent !important;
113 } 118 }
......
...@@ -8,75 +8,95 @@ ...@@ -8,75 +8,95 @@
8 * 8 *
9 */ 9 */
10 10
11 // 居中按钮样式
12 @mixin btn-center($width, $height) {
13 width: $width;
14 height: $height;
15 line-height: $height;
16 text-align: center;
17 }
18
19 // 超过多少行自动省略 默认一行
20 @mixin ellipsis($line:1) {
21 display: -webkit-box;
22 word-break: break-all;
23 -webkit-box-orient: vertical;
24 -webkit-line-clamp: $line;
25 overflow: hidden;
26 text-overflow: ellipsis;
27 }
28
11 // 文字截取 29 // 文字截取
12 @mixin text-overflow() { 30 @mixin text-overflow() {
13 overflow: hidden; 31 overflow: hidden;
14 white-space: normal; 32 white-space: normal;
15 text-overflow: ellipsis; 33 text-overflow: ellipsis;
16 word-break: break-all; 34 word-break: break-all;
17 word-wrap: normal; 35 word-wrap: normal;
18 } 36 }
19 37
20 @mixin word-break() { 38 @mixin word-break() {
21 word-break: break-all; 39 word-break: break-all;
22 word-wrap: break-word; 40 word-wrap: break-word;
23 white-space: normal; 41 white-space: normal;
24 } 42 }
25 43
26 // No wrap 44 // No wrap
27 @mixin no-wrap() { 45 @mixin no-wrap() {
28 word-break: normal; 46 word-break: normal;
29 word-wrap: normal; 47 word-wrap: normal;
30 white-space: nowrap; 48 white-space: nowrap;
31 } 49 }
32 50
33 // 清除浮动 51 // 清除浮动
34 @mixin clearfix() { 52 @mixin clearfix() {
35 &:before, 53
36 &:after { 54 &:before,
37 content: " "; // 1 55 &:after {
38 display: table; // 2 56 content: " "; // 1
39 } 57 display: table; // 2
40 &:after { 58 }
41 clear: both; 59
42 } 60 &:after {
61 clear: both;
62 }
43 } 63 }
44 64
45 // Single side border-radius 65 // Single side border-radius
46 @mixin border-top-radius($radius) { 66 @mixin border-top-radius($radius) {
47 border-top-right-radius: $radius; 67 border-top-right-radius: $radius;
48 border-top-left-radius: $radius; 68 border-top-left-radius: $radius;
49 } 69 }
50 70
51 @mixin border-right-radius($radius) { 71 @mixin border-right-radius($radius) {
52 border-bottom-right-radius: $radius; 72 border-bottom-right-radius: $radius;
53 border-top-right-radius: $radius; 73 border-top-right-radius: $radius;
54 } 74 }
55 75
56 @mixin border-bottom-radius($radius) { 76 @mixin border-bottom-radius($radius) {
57 border-bottom-right-radius: $radius; 77 border-bottom-right-radius: $radius;
58 border-bottom-left-radius: $radius; 78 border-bottom-left-radius: $radius;
59 } 79 }
60 80
61 @mixin border-left-radius($radius) { 81 @mixin border-left-radius($radius) {
62 border-bottom-left-radius: $radius; 82 border-bottom-left-radius: $radius;
63 border-top-left-radius: $radius; 83 border-top-left-radius: $radius;
64 } 84 }
65 85
66 // Center-align a block level element 86 // Center-align a block level element
67 @mixin center-block() { 87 @mixin center-block() {
68 display: block; 88 display: block;
69 margin-left: auto; 89 margin-left: auto;
70 margin-right: auto; 90 margin-right: auto;
71 } 91 }
72 92
73 // CSS image replacement 93 // CSS image replacement
74 // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 94 // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
75 @mixin hide-text() { 95 @mixin hide-text() {
76 font-size: 0; 96 font-size: 0;
77 line-height: 0; 97 line-height: 0;
78 color: transparent; 98 color: transparent;
79 text-shadow: none; 99 text-shadow: none;
80 background-color: transparent; 100 background-color: transparent;
81 border: 0; 101 border: 0;
82 } 102 }
......
...@@ -39,3 +39,5 @@ $fontSizeSmall: 28px; ...@@ -39,3 +39,5 @@ $fontSizeSmall: 28px;
39 $fontSizeSmaller: 24px; 39 $fontSizeSmaller: 24px;
40 $fontSizeLarge: 36px; 40 $fontSizeLarge: 36px;
41 $fontSizeLarger: 44px; 41 $fontSizeLarger: 44px;
42
43 $pageBottom:80px;
......
1 Component({
2 properties: {
3 // 这里定义了innerText属性,属性值可以在组件使用时指定
4 innerText: {
5 type: String,
6 value: 'default value',
7 }
8 },
9 data: {
10 // 这里是一些组件内部数据
11 someData: {}
12 },
13 methods: {
14 // 这里是一个自定义方法
15 customMethod() {
16 this.triggerEvent('evtcomp', {
17 name: "_evt_custom"
18 })
19 },
20 // 隐藏蒙层
21 hideMask() {
22 this.triggerEvent('evtcomp', {
23 name: "_evt_hide_authorize"
24 });
25 }
26 }
27 })
1 .comp-item{
2 width: 557px;
3 height: 505px;
4 border-radius: 10px;
5 background-color: #ffffff;
6 }
1 <view class="comp-item">
2
3 </view>
...@@ -12,6 +12,16 @@ Component({ ...@@ -12,6 +12,16 @@ Component({
12 }, 12 },
13 methods: { 13 methods: {
14 // 这里是一个自定义方法 14 // 这里是一个自定义方法
15 customMethod() {} 15 customMethod() {
16 this.triggerEvent('evtcomp', {
17 name: "_evt_custom"
18 })
19 },
20 // 隐藏蒙层
21 hideMask() {
22 this.triggerEvent('evtcomp', {
23 name: "_evt_hide_product_detail_mask"
24 });
25 }
16 } 26 }
17 }) 27 })
......
1 <view class="demo-item">demo-item</view> 1 <view class="comp-item">comp-item</view>
......
1 Component({
2 properties: {
3 // 这里定义了innerText属性,属性值可以在组件使用时指定
4 innerText: {
5 type: String,
6 value: 'default value',
7 }
8 },
9 data: {
10 // 这里是一些组件内部数据
11 someData: {}
12 },
13 methods: {
14 // 这里是一个自定义方法
15 customMethod() {
16 this.triggerEvent('evtcomp', {
17 name: "_evt_custom"
18 })
19 },
20 // 隐藏蒙层
21 hideMask() {
22 this.triggerEvent('evtcomp', {
23 name: "_evt_hide_product_detail_mask"
24 });
25 }
26 }
27 })
1 .comp-item {
2 .bg {
3 position: absolute;
4 width: 654px;
5 height: 911px;
6 }
7 }
1 <view class="comp-item">
2 <image class="bg" src="../../image/rule/rule_c1.png" mode="widthFix" />
3 </view>
1 module.exports = { 1 module.exports = {
2 mockApi: 'http://mock.simonfungc.com', 2 mockApi: 'http://mock.simonfungc.com',
3 Dev: { 3 Dev: {
4 baseApi: 'https://dev-api.xxx.com' 4 baseApi: 'https://ow.go.qudone.com'
5 }, 5 },
6 Test: { 6 Test: {
7 baseApi: 'https://test-api.xxx.com' 7 baseApi: 'https://test-api.xxx.com'
...@@ -10,6 +10,6 @@ module.exports = { ...@@ -10,6 +10,6 @@ module.exports = {
10 baseApi: 'https://slave-api.xxx.com' 10 baseApi: 'https://slave-api.xxx.com'
11 }, 11 },
12 Prod: { 12 Prod: {
13 baseApi: 'https://api.xxx.com' 13 baseApi: 'https://api.k.wxpai.cn/bizproxy'
14 } 14 }
15 } 15 }
......
1 module.exports = { 1 module.exports = {
2 index: '/xxx/index', // Index 接口 2 login: '/warubiEyeCreamApi/app/login', // 通过wxcode换取sessionId
3 decrypt: '/xxx/decrypt', // 解析用户信息 3 index: '/warubiEyeCreamApi/app/index', // Index 接口
4 register: '/warubiEyeCreamApi/app/register', // 注册(用户授权)
4 } 5 }
......
1 let config = require('./../config'); 1 let config = require('./../config');
2 let Store = require('./../utils/stroage'); 2 let Store = require('./../utils/stroage');
3 const reason = '服务异常,请稍后重试'; 3 let Router = require('./../router/index');
4 const errMsg = '服务异常,请稍后重试';
4 5
5 // 检查并获取sessionid sid:是否需要验证sessionId 6 // 检查并获取sessionid
6 function checkSessionId(sid) { 7 function checkSessionId() {
7 return new Promise((resolve, reject) => { 8 return new Promise((resolve, reject) => {
8 if (!sid) { 9 let sessionId = Store.getItem('sessionId');
9 resolve(); 10 if (sessionId) {
10 return; 11 resolve();
11 } 12 } else {
12 let sessionId = Store.getItem('sessionId'); 13 // 没有sessionId则获取并埋值
13 if (sessionId) { 14 wx.login({
14 resolve(sessionId); 15 success: function (res) {
15 } else { 16 console.log("wxlogin:", res);
16 // 身份失效 17 Store.setItem('wxcode', res.code);
17 //登陆失效的回调 18 let baseUrl = config.NET_CONFIG.baseApi;
18 // Store.clear("sessionId"); 19 wx.request({
19 // wx.reLaunch({ 20 url: baseUrl + '/warubiEyeCreamApi/app/login',
20 // // url: '/pages/authorize/authorize' 21 data: {
21 // url: '/pages/login/login', 22 code: res.code
22 // }) 23 },
23 } 24 method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
24 }); 25 // header: {}, // 设置请求的 header
26 success: function (res2) {
27 let {
28 code,
29 content
30 } = res2.data;
31 if (code == 200 && content.sessionId) {
32 Store.setItem('sessionId', content.sessionId);
33 resolve();
34 } else {
35 wx.showToast({
36 title: errMsg,
37 icon: 'none'
38 });
39 reject();
40 }
41 // console.log("sid:", Store.getItem('sessionId'));
42 // resolve();
43 }
44 })
45 }
46 });
47 }
48 });
25 } 49 }
26 50
27 const fetch = function ({ 51 const fetch = function ({
28 loading = false, 52 loading = false,
29 toast = true, 53 toast = true,
30 sid = true, 54 sid = true,
31 mode, 55 auth = true,
32 isMock, 56 mode,
33 url, 57 isMock,
34 data, 58 url,
35 method 59 data,
60 method
36 }) { 61 }) {
37 // 自定义参数 62 // 自定义参数
38 // const clientInfo = { 63 // const clientInfo = {
39 // user_id: 1 64 // user_id: 1
40 // } 65 // }
41 // 日志埋点不需要出现loading 66 // 日志埋点不需要出现loading
42 if (loading && mode != 'log') wx.showLoading(); 67 if (loading && mode != 'log') wx.showLoading();
43 // if (loading && mode != 'log') Util.showLoading(); 68 // if (loading && mode != 'log') Util.showLoading();
44 69
45 // 新建promise对象 70 // 新建promise对象
46 let promise = new Promise((resolve, reject) => { 71 let promise = new Promise((resolve, reject) => {
47 /** 72 /**
48 * isMock设置单个接口Mock开启 73 * isMock设置单个接口Mock开启
49 * mode:目前针对不同业务的接口进行处理,log标识本地埋点上传 74 * mode:目前针对不同业务的接口进行处理,log标识本地埋点上传
50 */ 75 */
51 let baseUrl = config.NET_CONFIG.baseApi; 76 let baseUrl = config.NET_CONFIG.baseApi;
52 if (isMock && mode != 'log') { 77 if (isMock && mode != 'log') {
53 baseUrl = config.MOCKAPI; //环境配置 78 baseUrl = config.MOCKAPI; //环境配置
54 } 79 }
55 80
56 checkSessionId().then((result) => { 81 checkSessionId().then((result) => {
57 if (sid) { 82 // if (sid) {
58 url += "?sessionId=" + Store.getItem("sessionId") 83 // url += "?sessionId=" + Store.getItem("sessionId")
59 } 84 // }
60 // console.log("url:", url); 85 // url += "?sessionId=" + Store.getItem("sessionId")
61 wx.request({ 86 // console.log("url:", url);
62 url: baseUrl + url, //请求地址 87 wx.request({
63 data: data, //自定义参数 88 url: baseUrl + url, //请求地址
64 method: method || 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT 89 data: data, //自定义参数
65 // header: {}, // 设置请求的 header的默认参数,根据项目需求添加 90 method: method || 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
66 // header: { 91 header: {
67 // 'clientInfo': JSON.stringify(clientInfo), 92 sessionId: Store.getItem("sessionId")
68 // 'Server-Token':'xxx' 93 }, // 设置请求的 header的默认参数,根据项目需求添加
69 // }, 94 // header: {
70 success: function (result) { 95 // 'clientInfo': JSON.stringify(clientInfo),
71 // 日志上传不需要处理结果 96 // 'Server-Token':'xxx'
72 if (mode == 'log') return; 97 // },
73 let res = result.data; 98 success: function (result) {
74 // 登陆失效拦截,根据项目需要添加自己的配置 99 // 日志上传不需要处理结果
75 if (res.code == 404) { 100 if (mode == 'log') return;
76 // wx.showToast({ 101 let res = result.data;
77 // title: '当前登陆失效,请重新登陆', 102 // 登陆失效拦截,根据项目需要添加自己的配置
78 // icon: 'none', 103 if (res.code == 404) {
79 // mask: true, 104 // wx.showToast({
80 // success: () => { 105 // title: '当前登陆失效,请重新登陆',
81 // return; 106 // icon: 'none',
82 // } 107 // mask: true,
83 // }) 108 // success: () => {
84 //登陆失效的回调 109 // return;
85 Store.clear("sessionId"); 110 // }
86 wx.reLaunch({ 111 // })
87 url: '/pages/authorize/authorize' 112 //登陆失效的回调
88 }) 113 Store.clear("sessionId");
89 } 114 wx.reLaunch({
90 // 内部统一的成功code拦截码 115 url: '/pages/authorize/authorize'
91 if (res.code === 200) { 116 })
92 if (loading) { 117 return;
93 wx.hideLoading();
94 }
95 // resolve(res);
96 // 直接返回content
97 resolve(res.content);
98 } else {
99 // 有些特殊状况不需要toast 需要弹窗
100 if (toast) {
101 wx.showToast({
102 title: res.errMsg || errMsg,
103 icon: 'none'
104 })
105 } else {
106 wx.hideLoading();
107 }
108 // 返回错误信息
109 reject(res);
110 }
111 },
112 fail: function (e = {
113 CODE: -1,
114 msg: errMsg,
115 errMsg
116 }) {
117 let msg = e.errMsg;
118 if (e.errMsg == 'request:fail timeout') {
119 msg = '服务请求超时,请稍后重试'
120 }
121 wx.showToast({
122 title: msg,
123 icon: 'none'
124 });
125 reject(e)
126 },
127 complete: function () {
128 // complete
129 }
130 })
131 })
132 118
133 119 // Router.push({
134 }); 120 // path: "authorize",
135 return promise; 121 // openType: "reLaunch",
122 // query: {
123 // status: '404'
124 // }
125 // })
126 }
127 // 内部统一的成功code拦截码
128 if (res.code === 200) {
129 if (loading) {
130 wx.hideLoading();
131 }
132 // resolve(res);
133 // 直接返回content
134 resolve(res.content);
135 } else {
136 // 有些特殊状况不需要toast 需要弹窗
137 if (toast) {
138 wx.showToast({
139 title: res.errMsg || errMsg,
140 icon: 'none'
141 })
142 } else {
143 wx.hideLoading();
144 }
145 // 返回错误信息
146 reject(res);
147 }
148 },
149 fail: function (e = {
150 CODE: -1,
151 msg: errMsg,
152 errMsg
153 }) {
154 let msg = e.errMsg;
155 if (e.errMsg == 'request:fail timeout') {
156 msg = '服务请求超时,请稍后重试'
157 }
158 wx.showToast({
159 title: msg,
160 icon: 'none'
161 });
162 reject(e)
163 },
164 complete: function () {
165 // complete
166 }
167 })
168 })
169 });
170 return promise;
136 } 171 }
137 172
138 module.exports = { 173 module.exports = {
139 fetch 174 fetch
140 } 175 }
......
...@@ -2,79 +2,82 @@ let app = getApp(); ...@@ -2,79 +2,82 @@ let app = getApp();
2 let config = require('../../config'); 2 let config = require('../../config');
3 3
4 Page({ 4 Page({
5 data: { 5 data: {
6 authorized: true, 6 authorized: false,
7 canIUse: wx.canIUse('button.open-type.getUserInfo') 7 canIUse: wx.canIUse('button.open-type.getUserInfo')
8 }, 8 },
9 onLoad(options) {}, 9 onShareAppMessage() {},
10 onReady() { 10 onReady() {
11 wx.showLoading(); 11 wx.showLoading();
12 this.autoAuth(); 12 this.autoAuth();
13 }, 13 },
14 bindGetUserInfo(e) { 14 onLoad(options) {},
15 wx.showLoading(); 15 onShow() {},
16 this.getUserInfo(e.detail); 16 bindGetUserInfo(e) {
17 }, 17 wx.showLoading();
18 // 点openType==userInfo 手动登陆 18 this.getUserInfo(e.detail);
19 getUserInfo(e) { 19 },
20 let _this = this; 20 getUserInfo(e) {
21 // 直接就能拿到 userInfo 21 let _this = this;
22 app.globalData.userInfo = e.userInfo; 22 app.globalData.userInfo = e.userInfo;
23 wx.login({ 23 app.post({
24 success: function (res) { 24 url: app.api.register,
25 app.post({ 25 sid: false,
26 url: app.api.decrypt, 26 data: {
27 data: { 27 encryptedData: e.encryptedData,
28 encryptedData: e.encryptedData, 28 iv: e.iv,
29 iv: e.iv, 29 code: app.globalData.wxcode,
30 code: res.code 30 tlMemberCode: app.globalData.tlMemberCode
31 } 31 }
32 }).then((res2) => { 32 }).then((res2) => {
33 _this.autoAuth(); 33 _this.autoAuth();
34 }).catch((err) => {}) 34 }).catch((err) => {})
35 } 35 },
36 }); 36 // 刷新首页数据
37 }, 37 refreshIndexData() {
38 // 刷新首页数据 38 return new Promise((resolve, reject) => {
39 refreshIndexData() { 39 app.post({
40 return new Promise((resolve, reject) => { 40 url: app.api.index,
41 app.post({ 41 data: {}
42 url: app.api.index, 42 }).then((res) => {
43 data: {} 43 app.globalData.indexInfo = res;
44 }).then((res) => { 44 resolve(res)
45 app.globalData.indexInfo = res; 45 }).catch((err) => {
46 resolve(res) 46 console.log("index err:", err);
47 }).catch((err) => { 47 });
48 console.log("index err:", err); 48 });
49 }); 49 },
50 }); 50 // 自动授权
51 }, 51 autoAuth() {
52 // 判断结果去首页 52 let _this = this;
53 autoAuth() { 53 this.refreshIndexData().then((result) => {
54 // 调用自动登陆方法 54 if (result.isNeedAuth == 1) {
55 let _this = this; 55 // 未授权
56 this.refreshIndexData().then((result) => { 56 wx.login({
57 let indexInfo = app.globalData.indexInfo; 57 success: function (res) {
58 // 自动登陆成功 58 app.store.setItem("wxcode", res.code);
59 let loginSuc = true; 59 }
60 if (loginSuc) { 60 });
61 // 登陆成功跳转到首页 61 wx.hideLoading();
62 setTimeout(() => { 62 _this.setData({
63 app.router.push({ 63 authorized: false
64 path: 'index', 64 })
65 query: {}, 65 } else {
66 duration: 0, 66 // 已经授权
67 openType: "redirect" 67 // setTimeout(() => {
68 }) 68 _this.toIndex();
69 wx.hideLoading(); 69 wx.hideLoading();
70 }, 3000); 70 // }, 2000);
71 } else { 71 }
72 // 登陆失败,隐藏loading自动登陆 72 });
73 wx.hideLoading(); 73 },
74 this.setData({ 74 // 跳转到首页
75 authorized: false 75 toIndex() {
76 }) 76 app.router.push({
77 } 77 path: "index",
78 }); 78 openType: "redirect"
79 } 79 })
80 wx.hideLoading();
81 }
82
80 }) 83 })
......
1 @import '../../assets/scss/mixins'; 1 @import '../../assets/scss/mixins';
2 2
3 .page { 3 .page {
4 position: relative; 4 position: relative;
5 overflow: hidden; 5 overflow: hidden;
6 6
7 .bgc {} 7 .bgc {
8 // background-color: transparent;
9 // background-color: black;
10 background-color: #fafafc;
11 }
8 12
9 .bg {}
10 13
14 .main {
11 15
16 position: relative;
12 17
18 .top-space {
19 height: 60px;
20 }
13 21
14 .main {
15 22
16 .login-wrap { 23 .login {
17 padding-top: 946px; 24 position: relative;
25 width: 650px;
26 margin: 0 auto;
27 text-align: center;
18 28
19 .login-btn { 29 &-logo {
20 width: 340px; 30 width: 140px;
21 height: 80px; 31 height: 140px;
22 line-height: 80px; 32 }
23 border-radius: 40px; 33
24 border: solid 3px #4bc2ed; 34 &-name {
25 margin: 0 auto; 35 margin-top: 32px;
26 font-size: 36px; 36 font-size: 32px;
27 color: #4bc2ed; 37 color: #333333;
28 text-align: center; 38 }
29 background-color: transparent; 39
30 } 40 &-line {
31 } 41 margin-top: 70px;
32 } 42 width: 650px;
43 height: 2px;
44 background-color: #eaeaec;
45 }
46
47 &-title {
48 margin-top: 40px;
49 font-size: 32px;
50 text-align: left;
51 color: #333333;
52 }
53
54
55 &-tips {
56 margin-top: 28px;
57 font-size: 26px;
58 text-align: left;
59 color: #666666;
60 }
61
62 &-btn {
63 margin-top: 102px;
64 width: 650px;
65 height: 90px;
66 line-height: 90px;
67 border-radius: 8px;
68 background-color: #00c200;
69 font-size: 32px;
70 color: #ffffff;
71 }
72
73 }
74
75 }
33 76
34 } 77 }
......
1 <navbar navbar-data='{{navbarData}}'></navbar>
2 <view style='height: {{barHeight}}px'></view>
1 <view class="page-authorize page"> 3 <view class="page-authorize page">
2 <view class="app__bgc bgc"></view> 4 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view> 5 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> --> 6 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main"> 7 <view class="app__content main">
6 <view class="login-wrap"> 8 <view class="top-space"></view>
7 <button class="login-btn" wx:if="{{!authorized}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> 9 <view class="login">
8 同意微信授权 10 <image class="login-logo" src="../../image/logo.png" mode="aspectFit" />
9 </button> 11 <view class="login-name">丸美</view>
10 </view> 12 <view class="login-line"></view>
11 </view> 13 <view class="login-title">完整体验小程序功能,需要您的微信授权</view>
14 <view class="login-tips">· 获取您的公开信息(昵称、头像等)</view>
15 <button type="default" class="login-btn" wx:if="{{!authorized}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">
16 确认授权
17 </button>
18 </view>
19 </view>
12 </view> 20 </view>
......
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 let app = getApp();
2 Page({
3 data: {
4 ruleVisible: true,
5 },
6 onShareAppMessage() {},
7 onLoad(options) {}
8 })
1 {
2 "navigationBarTitleText": "丸美心愿单",
3 "usingComponents": {
4 "rule-comp": "../../component/rule-comp/rule-comp",
5 "van-popup": "../../ui/vant-weapp/popup/index"
6 }
7 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <view class="app__content main">
5 <view class="top-space"></view>
6 <view class="content">create-wish</view>
7 </view>
8 </view>
9 <van-popup show="{{ ruleVisible }}">
10 <rule-comp bind:evtcomp="evtcomp"></rule-comp>
11 </van-popup>
1 let app = getApp(); 1 let app = getApp();
2 Page({ 2 Page({
3 data: {}, 3 data: {},
4 onLoad(options) {} 4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
5 }) 21 })
......
1 { 1 {
2 "navigationBarTitleText": "more" 2 "navigationBarTitleText": "more"
3 } 3 }
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
2 @import '../../assets/scss/utils'; 2 @import '../../assets/scss/utils';
3 3
4 .page { 4 .page {
5 .bgc {} 5 .bgc {}
6 6
7 .bg {} 7 .bg {}
8 8
9 .main { 9 .main {
10 .top-space { 10 .top-space {
11 height: 0px; 11 height: 0px;
12 } 12 }
13 13
14 .content { 14 .content {
15 position: relative; 15 position: relative;
16 }
17 } 16 }
17 }
18 } 18 }
......
1 <view class="page"> 1 <view class="page">
2 <view class="app__bgc bgc"></view> 2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view> 3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> --> 4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main"> 5 <view class="app__content main">
6 <view class="top-space"></view> 6 <view class="top-space"></view>
7 <view class="content"></view> 7 <view class="content"></view>
8 </view> 8 </view>
9 </view> 9 </view>
......
1 let app = getApp(); 1 let app = getApp();
2 Page({ 2 Page({
3 data: {}, 3 data: {
4 onLoad(options) {} 4 authorized: true,
5 canIUse: wx.canIUse('button.open-type.getUserInfo')
6 },
7 onShareAppMessage() {},
8 onLoad(options) {},
9 // 子组件事件
10 evtcomp(evt) {
11 let {
12 name,
13 data
14 } = evt.detail;
15 switch (name) {
16
17 case "_evt_hide":
18 break;
19
20 default:
21 break;
22 }
23 },
24 // 开始互动游戏
25 onStartHandler() {
26 let path = "createWish";
27 app.router.push({
28 path: "createWish"
29 })
30 }
5 }) 31 })
......
1 { 1 {
2 "navigationBarTitleText": "index" 2 "navigationBarTitleText": "我的心愿单",
3 "usingComponents": {
4 "authorize-comp": "../../component/authorize-comp/authorize-comp",
5 "van-popup": "../../ui/vant-weapp/popup/index"
6 }
3 } 7 }
......
...@@ -2,17 +2,58 @@ ...@@ -2,17 +2,58 @@
2 @import '../../assets/scss/utils'; 2 @import '../../assets/scss/utils';
3 3
4 .page { 4 .page {
5 .bgc {} 5 .bgc {
6 image {
7 width: 100%;
8 height: 100%;
9 }
10 }
11
12 .bg {
13 image {
14 position: absolute;
15 width: 750px;
16 height: 1303px;
17 top: -130px;
18 }
19 }
20
21 .decoration {
22 position: relative;
6 23
7 .bg {} 24 .d1 {
25 position: absolute;
26 width: 160px;
27 height: 192px;
28 top: 0;
29 left: 0;
30 }
31
32 .d2 {
33 position: fixed;
34 width: 301px;
35 height: 195px;
36 left: 0;
37 bottom: 0;
38 }
39 }
8 40
9 .main { 41 .main {
10 .top-space { 42 .top-space {
11 height: 0px; 43 height: 1042px;
12 } 44 }
13 45
14 .content { 46 .content {
15 position: relative; 47 .btn {
16 } 48 position: relative;
49 margin: 0 auto;
50 @include btn-center(336px, 88px);
51 border-radius: 44px;
52 background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138);
53 font-weight: 300;
54 font-size: 32px;
55 color: #fff;
56 }
17 } 57 }
58 }
18 } 59 }
......
1 <view class="page"> 1 <view class="page">
2 <view class="app__bgc bgc"></view> 2 <view class="app__bgc bgc">
3 <view class="app__bg bg"></view> 3 <image src="../../image/index/index_c1.png" mode="scaleToFill" />
4 <!-- <view class="app__top-shadow"></view> --> 4 </view>
5 <view class="app__content main"> 5 <view class="app__bg bg">
6 <view class="top-space"></view> 6 <image src="../../image/index/index_c2.png" mode="scaleToFill" />
7 <view class="content"></view> 7 </view>
8 </view> 8 <view class="decoration">
9 <image class="d1" src="../../image/index/index_c4.png" mode="widthFix" />
10 <image class="d2" src="../../image/index/index_c3.png" mode="widthFix" />
11 </view>
12 <view class="app__content main">
13 <view class="top-space"></view>
14 <view class="content">
15 <!-- 已授权 直接到下一步操作 -->
16 <button class="btn" wx:if="{{authorized}}" bindtap="onStartHandler">马上测弹力值</button>
17 <!-- 未授权 拉起授权弹窗 -->
18 <!-- <button class="btn" wx:else open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">马上测弹力值2</button> -->
19 </view>
20 </view>
21
9 </view> 22 </view>
23 <!-- <van-popup show="{{ authorizeVisible }}" >
24 <authorize-comp bind:evtcomp="evtcomp"></authorize-comp>
25 </van-popup> -->
......
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 let app = getApp();
2 Page({
3 data: {},
4 onShareAppMessage() {},
5 onLoad(options) {},
6 // 子组件事件
7 evtcomp(evt) {
8 let {
9 name,
10 data
11 } = evt.detail;
12 switch (name) {
13
14 case "_evt_hide":
15 break;
16
17 default:
18 break;
19 }
20 },
21 })
1 {
2 "navigationBarTitleText": "more"
3 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4 .page {
5 .bgc {}
6
7 .bg {}
8
9 .main {
10 .top-space {
11 height: 0px;
12 }
13
14 .content {
15 position: relative;
16 }
17 }
18 }
1 <view class="page">
2 <view class="app__bgc bgc"></view>
3 <view class="app__bg bg"></view>
4 <!-- <view class="app__top-shadow"></view> -->
5 <view class="app__content main">
6 <view class="top-space"></view>
7 <view class="content"></view>
8 </view>
9 </view>
1 const routerPath = { 1 const routerPath = {
2 index: '/pages/index/index', // 首页 2 index: '/pages/index/index', // 首页
3 wish: '/pages/wish/wish', // 创建心愿单 3 wish: '/pages/wish/wish', // 心愿单
4 createWish: '/pages/create-wish/create-wish', // 创建心愿单 4 createWish: '/pages/create-wish/create-wish', // 创建心愿单
5 newWelfare: '/pages/new-welfare/new-welfare', // 新人福利 5 newWelfare: '/pages/new-welfare/new-welfare', // 新人福利
6 userTable: '/pages/user-table/user-table', // 用户表单 6 userTable: '/pages/user-table/user-table', // 用户表单
7 rank: '/pages/rank/rank', // 排行榜 7 rank: '/pages/rank/rank', // 排行榜
8 index: '/pages/poster/poster', // 海报页 8 poster: '/pages/poster/poster', // 海报页
9 coop: '/pages/coop/coop', // 协作页/好友查看 9 coop: '/pages/coop/coop', // 协作页/好友查看
10 register: '/pages/register/register', // 注册 10 register: '/pages/register/register', // 注册
11 authorize: '/pages/authorize/authorize', // 授权 11 authorize: '/pages/authorize/authorize', // 授权
......
1 import { VantComponent } from '../common/component';
2 import { safeArea } from '../mixins/safe-area';
3 VantComponent({
4 mixins: [safeArea()],
5 props: {
6 show: Boolean,
7 title: String,
8 cancelText: String,
9 zIndex: {
10 type: Number,
11 value: 100
12 },
13 actions: {
14 type: Array,
15 value: []
16 },
17 overlay: {
18 type: Boolean,
19 value: true
20 },
21 closeOnClickOverlay: {
22 type: Boolean,
23 value: true
24 }
25 },
26 methods: {
27 onSelect(event) {
28 const { index } = event.currentTarget.dataset;
29 const item = this.data.actions[index];
30 if (item && !item.disabled && !item.loading) {
31 this.$emit('select', item);
32 }
33 },
34 onCancel() {
35 this.$emit('cancel');
36 },
37 onClose() {
38 this.$emit('close');
39 }
40 }
41 });
1 {
2 "component": true,
3 "usingComponents": {
4 "van-icon": "../icon/index",
5 "van-popup": "../popup/index",
6 "van-loading": "../loading/index"
7 }
8 }
1 <wxs src="../wxs/utils.wxs" module="utils" />
2
3 <van-popup
4 show="{{ show }}"
5 position="bottom"
6 z-index="{{ zIndex }}"
7 overlay="{{ overlay }}"
8 custom-class="van-action-sheet"
9 safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
10 close-on-click-overlay="{{ closeOnClickOverlay }}"
11 bind:close="onClose"
12 >
13 <view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
14 {{ title }}
15 <van-icon
16 name="close"
17 custom-class="van-action-sheet__close"
18 bind:click="onClose"
19 />
20 </view>
21 <view wx:if="{{ actions && actions.length }}">
22 <!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
23 <button
24 wx:for="{{ actions }}"
25 wx:key="index"
26 open-type="{{ item.openType }}"
27 class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
28 hover-class="van-action-sheet__item--hover"
29 data-index="{{ index }}"
30 bind:tap="onSelect"
31 >
32 <block wx:if="{{ !item.loading }}">
33 {{ item.name }}
34 <text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
35 </block>
36 <van-loading wx:else size="20px" />
37 </button>
38 </view>
39 <slot />
40 <view
41 wx:if="{{ cancelText }}"
42 class="van-action-sheet__cancel"
43 hover-class="van-action-sheet__cancel--hover"
44 hover-stay-time="70"
45 bind:tap="onCancel"
46 >
47 {{ cancelText }}
48 </view>
49 </van-popup>
1 @import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel:before{display:block;height:10px;background-color:#f8f8f8;content:" "}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80}.van-action-sheet__header{font-size:16px;font-weight:500;line-height:44px;text-align:center}.van-action-sheet__close{position:absolute!important;top:0;right:0;padding:0 15px;font-size:18px!important;line-height:inherit!important;color:#999}
...\ No newline at end of file ...\ No newline at end of file
1 import { VantComponent } from '../common/component';
2 VantComponent({
3 classes: ['active-class', 'toolbar-class', 'column-class'],
4 props: {
5 title: String,
6 value: String,
7 loading: Boolean,
8 cancelButtonText: String,
9 confirmButtonText: String,
10 itemHeight: {
11 type: Number,
12 value: 44
13 },
14 visibleItemCount: {
15 type: Number,
16 value: 5
17 },
18 columnsNum: {
19 type: [String, Number],
20 value: 3
21 },
22 areaList: {
23 type: Object,
24 value: {}
25 }
26 },
27 data: {
28 columns: [{ values: [] }, { values: [] }, { values: [] }],
29 displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
30 },
31 watch: {
32 value(value) {
33 this.code = value;
34 this.setValues();
35 },
36 areaList: 'setValues',
37 columnsNum(value) {
38 this.set({
39 displayColumns: this.data.columns.slice(0, +value)
40 });
41 }
42 },
43 methods: {
44 getPicker() {
45 if (this.picker == null) {
46 this.picker = this.selectComponent('.van-area__picker');
47 }
48 return this.picker;
49 },
50 onCancel(event) {
51 this.emit('cancel', event.detail);
52 },
53 onConfirm(event) {
54 this.emit('confirm', event.detail);
55 },
56 emit(type, detail) {
57 detail.values = detail.value;
58 delete detail.value;
59 this.$emit(type, detail);
60 },
61 onChange(event) {
62 const { index, picker, value } = event.detail;
63 this.code = value[index].code;
64 this.setValues().then(() => {
65 this.$emit('change', {
66 picker,
67 values: picker.getValues(),
68 index
69 });
70 });
71 },
72 getConfig(type) {
73 const { areaList } = this.data;
74 return (areaList && areaList[`${type}_list`]) || {};
75 },
76 getList(type, code) {
77 let result = [];
78 if (type !== 'province' && !code) {
79 return result;
80 }
81 const list = this.getConfig(type);
82 result = Object.keys(list).map(code => ({
83 code,
84 name: list[code]
85 }));
86 if (code) {
87 // oversea code
88 if (code[0] === '9' && type === 'city') {
89 code = '9';
90 }
91 result = result.filter(item => item.code.indexOf(code) === 0);
92 }
93 return result;
94 },
95 getIndex(type, code) {
96 let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
97 const list = this.getList(type, code.slice(0, compareNum - 2));
98 // oversea code
99 if (code[0] === '9' && type === 'province') {
100 compareNum = 1;
101 }
102 code = code.slice(0, compareNum);
103 for (let i = 0; i < list.length; i++) {
104 if (list[i].code.slice(0, compareNum) === code) {
105 return i;
106 }
107 }
108 return 0;
109 },
110 setValues() {
111 const county = this.getConfig('county');
112 let code = this.code || Object.keys(county)[0] || '';
113 const province = this.getList('province');
114 const city = this.getList('city', code.slice(0, 2));
115 const picker = this.getPicker();
116 if (!picker) {
117 return;
118 }
119 const stack = [];
120 stack.push(picker.setColumnValues(0, province, false));
121 stack.push(picker.setColumnValues(1, city, false));
122 if (city.length && code.slice(2, 4) === '00') {
123 ;
124 [{ code }] = city;
125 }
126 stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
127 return Promise.all(stack)
128 .catch(() => { })
129 .then(() => picker.setIndexes([
130 this.getIndex('province', code),
131 this.getIndex('city', code),
132 this.getIndex('county', code)
133 ]))
134 .catch(() => { });
135 },
136 getValues() {
137 const picker = this.getPicker();
138 return picker ? picker.getValues().filter(value => !!value) : [];
139 },
140 getDetail() {
141 const values = this.getValues();
142 const area = {
143 code: '',
144 country: '',
145 province: '',
146 city: '',
147 county: ''
148 };
149 if (!values.length) {
150 return area;
151 }
152 const names = values.map((item) => item.name);
153 area.code = values[values.length - 1].code;
154 if (area.code[0] === '9') {
155 area.country = names[1] || '';
156 area.province = names[2] || '';
157 }
158 else {
159 area.province = names[0] || '';
160 area.city = names[1] || '';
161 area.county = names[2] || '';
162 }
163 return area;
164 },
165 reset() {
166 this.code = '';
167 return this.setValues();
168 }
169 }
170 });
1 {
2 "component": true,
3 "usingComponents": {
4 "van-picker": "../picker/index"
5 }
6 }
1 <van-picker
2 class="van-area__picker"
3 active-class="active-class"
4 toolbar-class="toolbar-class"
5 column-class="column-class"
6 show-toolbar
7 value-key="name"
8 title="{{ title }}"
9 loading="{{ loading }}"
10 columns="{{ displayColumns }}"
11 item-height="{{ itemHeight }}"
12 visible-item-count="{{ visibleItemCount }}"
13 cancel-button-text="{{ cancelButtonText }}"
14 confirm-button-text="{{ confirmButtonText }}"
15 bind:change="onChange"
16 bind:confirm="onConfirm"
17 bind:cancel="onCancel"
18 />
1 @import '../common/index.wxss';
...\ No newline at end of file ...\ No newline at end of file
1 import { VantComponent } from '../common/component';
2 import { isNumber } from '../common/utils';
3 VantComponent({
4 relation: {
5 name: 'badge',
6 type: 'descendant',
7 linked(target) {
8 this.badges.push(target);
9 this.setActive();
10 },
11 unlinked(target) {
12 this.badges = this.badges.filter(item => item !== target);
13 this.setActive();
14 }
15 },
16 props: {
17 active: {
18 type: Number,
19 value: 0
20 }
21 },
22 watch: {
23 active: 'setActive'
24 },
25 beforeCreate() {
26 this.badges = [];
27 this.currentActive = -1;
28 },
29 methods: {
30 setActive(badge) {
31 let { active } = this.data;
32 const { badges } = this;
33 if (badge && !isNumber(badge)) {
34 active = badges.indexOf(badge);
35 }
36 if (active === this.currentActive) {
37 return;
38 }
39 if (this.currentActive !== -1 && badges[this.currentActive]) {
40 this.$emit('change', active);
41 badges[this.currentActive].setActive(false);
42 }
43 if (badges[active]) {
44 badges[active].setActive(true);
45 this.currentActive = active;
46 }
47 }
48 }
49 });
1 <view class="van-badge-group van-hairline--top-bottom custom-class">
2 <slot />
3 </view>
1 @import '../common/index.wxss';.van-badge-group{width:85px}
...\ No newline at end of file ...\ No newline at end of file
1 import { VantComponent } from '../common/component';
2 VantComponent({
3 relation: {
4 type: 'ancestor',
5 name: 'badge-group'
6 },
7 props: {
8 info: null,
9 title: String
10 },
11 methods: {
12 onClick() {
13 const group = this.getRelationNodes('../badge-group/index')[0];
14 if (group) {
15 group.setActive(this);
16 }
17 },
18 setActive(active) {
19 this.set({ active });
20 }
21 }
22 });
1 {
2 "component": true,
3 "usingComponents": {
4 "van-info": "../info/index"
5 }
6 }
1 <wxs src="../wxs/utils.wxs" module="utils" />
2
3 <view
4 class="{{ utils.bem('badge', { active }) }} van-hairline custom-class"
5 hover-class="van-badge--hover"
6 hover-stay-time="70"
7 bind:tap="onClick"
8 >
9 <view class="van-badge__text">
10 <van-info
11 wx:if="{{ info !== null }}"
12 info="{{ info }}"
13 custom-style="right: 4px"
14 />
15 {{ title }}
16 </view>
17 </view>
1 @import '../common/index.wxss';.van-badge{display:block;padding:20px 12px 20px 9px;overflow:hidden;font-size:14px;line-height:1.4;color:#7d7e80;word-break:break-all;background-color:#f8f8f8;border-left:3px solid transparent;box-sizing:border-box;-webkit-user-select:none;user-select:none}.van-badge--hover{background-color:#f2f3f5}.van-badge:after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active:after{border-right-width:1px}.van-badge--active,.van-badge--active.van-badge--hover{background-color:#fff}.van-badge__text{position:relative}
...\ No newline at end of file ...\ No newline at end of file
1 import { VantComponent } from '../common/component';
2 import { button } from '../mixins/button';
3 import { openType } from '../mixins/open-type';
4 VantComponent({
5 mixins: [button, openType],
6 classes: ['hover-class', 'loading-class'],
7 props: {
8 plain: Boolean,
9 block: Boolean,
10 round: Boolean,
11 square: Boolean,
12 loading: Boolean,
13 hairline: Boolean,
14 disabled: Boolean,
15 loadingText: String,
16 type: {
17 type: String,
18 value: 'default'
19 },
20 size: {
21 type: String,
22 value: 'normal'
23 },
24 loadingSize: {
25 type: String,
26 value: '20px'
27 }
28 },
29 methods: {
30 onClick() {
31 if (!this.data.disabled && !this.data.loading) {
32 this.$emit('click');
33 }
34 }
35 }
36 });
1 {
2 "component": true,
3 "usingComponents": {
4 "van-loading": "../loading/index"
5 }
6 }
...\ No newline at end of file ...\ No newline at end of file
1 <wxs src="../wxs/utils.wxs" module="utils" />
2
3 <button
4 id="{{ id }}"
5 class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
6 open-type="{{ openType }}"
7 hover-class="van-button--active hover-class"
8 lang="{{ lang }}"
9 business-id="{{ businessId }}"
10 session-from="{{ sessionFrom }}"
11 send-message-title="{{ sendMessageTitle }}"
12 send-message-path="{{ sendMessagePath }}"
13 send-message-img="{{ sendMessageImg }}"
14 show-message-card="{{ showMessageCard }}"
15 app-parameter="{{ appParameter }}"
16 aria-label="{{ ariaLabel }}"
17 bindtap="onClick"
18 bindgetuserinfo="bindGetUserInfo"
19 bindcontact="bindContact"
20 bindgetphonenumber="bindGetPhoneNumber"
21 binderror="bindError"
22 bindlaunchapp="bindLaunchApp"
23 bindopensetting="bindOpenSetting"
24 >
25 <block wx:if="{{ loading }}">
26 <van-loading
27 custom-class="loading-class"
28 size="{{ loadingSize }}"
29 color="{{ type === 'default' ? '#c9c9c9' : '' }}"
30 />
31 <view
32 wx:if="{{ loadingText }}"
33 class="van-button__loading-text"
34 >
35 {{ loadingText }}
36 </view>
37 </block>
38 <slot wx:else />
39 </button>
1 @import '../common/index.wxss';.van-button{position:relative;display:inline-block;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;box-sizing:border-box;border-radius:2px;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;background-color:#000;border:inherit;border-color:#000;border-radius:inherit;content:" ";opacity:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #eee}.van-button--primary{color:#fff;background-color:#07c160;border:1px solid #07c160}.van-button--info{color:#fff;background-color:#1989fa;border:1px solid #1989fa}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#ff976a;border:1px solid #ff976a}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#07c160}.van-button--plain.van-button--info{color:#1989fa}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#ff976a}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;min-width:60px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__loading-text{margin-left:5px;display:inline-block;vertical-align:middle}.van-button--hairline{border-width:0;padding-top:1px}.van-button--hairline:after{border-width:1px;border-color:inherit;border-radius:4px}.van-button--hairline.van-button--round:after{border-radius:10em}.van-button--hairline.van-button--square:after{border-radius:0}
...\ No newline at end of file ...\ No newline at end of file
1 import { link } from '../mixins/link';
2 import { VantComponent } from '../common/component';
3 VantComponent({
4 classes: [
5 'num-class',
6 'desc-class',
7 'thumb-class',
8 'title-class',
9 'price-class',
10 'origin-price-class',
11 ],
12 mixins: [link],
13 props: {
14 tag: String,
15 num: String,
16 desc: String,
17 thumb: String,
18 title: String,
19 price: String,
20 centered: Boolean,
21 lazyLoad: Boolean,
22 thumbLink: String,
23 originPrice: String,
24 thumbMode: {
25 type: String,
26 value: 'aspectFit'
27 },
28 currency: {
29 type: String,
30 value: '¥'
31 }
32 },
33 methods: {
34 onClickThumb() {
35 this.jumpLink('thumbLink');
36 }
37 }
38 });
1 {
2 "component": true,
3 "usingComponents": {
4 "van-tag": "../tag/index"
5 }
6 }
1 <wxs src="../wxs/utils.wxs" module="utils" />
2
3 <view class="custom-class van-card">
4 <view class="{{ utils.bem('card__header', { center: centered }) }}">
5 <view class="van-card__thumb" bind:tap="onClickThumb">
6 <image
7 wx:if="{{ thumb }}"
8 src="{{ thumb }}"
9 mode="{{ thumbMode }}"
10 lazy-load="{{ lazyLoad }}"
11 class="van-card__img thumb-class"
12 />
13 <slot name="thumb" />
14 <van-tag
15 wx:if="{{ tag }}"
16 mark
17 type="danger"
18 custom-class="van-card__tag"
19 >
20 {{ tag }}
21 </van-tag>
22 </view>
23
24 <view class="van-card__content">
25 <view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
26 <slot wx:else name="title" />
27
28 <view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
29 <slot wx:else name="desc" />
30
31 <slot name="tags" />
32
33 <view class="van-card__bottom">
34 <view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
35 <view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
36 <view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
37 </view>
38 </view>
39 </view>
40
41 <view class="van-card__footer">
42 <slot name="footer" />
43 </view>
44 </view>
1 @import '../common/index.wxss';.van-card{position:relative;padding:5px 15px;font-size:12px;color:#333;background-color:#fafafa;box-sizing:border-box}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;width:90px;height:90px;margin-right:10px;-webkit-flex:none;flex:none}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;min-width:0;-webkit-flex:1;flex:1}.van-card__desc,.van-card__title{word-break:break-all}.van-card__title{font-weight:700;line-height:16px}.van-card__desc{color:#7d7e80}.van-card__bottom,.van-card__desc{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#f44}.van-card__origin-price{display:inline-block;margin-left:5px;font-size:10px;color:#7d7e80;text-decoration:line-through}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{width:100%;text-align:right;-webkit-flex:none;flex:none}
...\ No newline at end of file ...\ No newline at end of file
1 import { VantComponent } from '../common/component';
2 VantComponent({
3 props: {
4 title: String,
5 border: {
6 type: Boolean,
7 value: true
8 }
9 }
10 });
1 {
2 "component": true
3 }
...\ No newline at end of file ...\ No newline at end of file