806d3c4a by simon

版本提交

1 parent 5f588c45
Showing 367 changed files with 1398 additions and 110 deletions
...@@ -20,6 +20,8 @@ App({ ...@@ -20,6 +20,8 @@ App({
20 onLaunch: function () {}, 20 onLaunch: function () {},
21 globalData: { 21 globalData: {
22 indexInfo: null, 22 indexInfo: null,
23 userInfo: null 23 userInfo: null,
24 wxcode: store.getItem("wxcode"),
25 tlMemberCode: ""
24 } 26 }
25 }) 27 })
......
1 { 1 {
2 "pages": [ 2 "pages": [
3 "pages/index/index", 3 "pages/index/index",
4 "pages/authorize/authorize",
5 "pages/wish/wish",
6 "pages/create-wish/create-wish",
7 "pages/new-welfare/new-welfare",
8 "pages/user-table/user-table",
9 "pages/rank/rank",
10 "pages/poster/poster",
11 "pages/coop/coop",
4 "pages/example/example", 12 "pages/example/example",
5 "pages/more/more" 13 "pages/more/more"
6 ], 14 ],
...@@ -9,24 +17,5 @@ ...@@ -9,24 +17,5 @@
9 "navigationBarBackgroundColor": "#fff", 17 "navigationBarBackgroundColor": "#fff",
10 "navigationBarTitleText": "心愿单", 18 "navigationBarTitleText": "心愿单",
11 "navigationBarTextStyle": "black" 19 "navigationBarTextStyle": "black"
12 },
13 "tabBar": {
14 "color": "#7A7E83",
15 "selectedColor": "#CF4646",
16 "borderStyle": "black",
17 "backgroundColor": "#ffffff",
18 "list": [{
19 "pagePath": "pages/index/index",
20 "iconPath": "image/tabbar/home_D.png",
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 } 20 }
32 } 21 }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
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 {
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
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 {
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
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";
...@@ -111,3 +111,8 @@ ...@@ -111,3 +111,8 @@
111 .drop-down-item :last-child { 111 .drop-down-item :last-child {
112 border-bottom: none; 112 border-bottom: none;
113 } 113 }
114
115
116 .van-popup {
117 background-color: transparent !important;
118 }
......
...@@ -8,6 +8,24 @@ ...@@ -8,6 +8,24 @@
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;
...@@ -32,11 +50,13 @@ ...@@ -32,11 +50,13 @@
32 50
33 // 清除浮动 51 // 清除浮动
34 @mixin clearfix() { 52 @mixin clearfix() {
53
35 &:before, 54 &:before,
36 &:after { 55 &:after {
37 content: " "; // 1 56 content: " "; // 1
38 display: table; // 2 57 display: table; // 2
39 } 58 }
59
40 &:after { 60 &:after {
41 clear: both; 61 clear: both;
42 } 62 }
......
...@@ -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 resolve();
10 return;
11 }
12 let sessionId = Store.getItem('sessionId'); 9 let sessionId = Store.getItem('sessionId');
13 if (sessionId) { 10 if (sessionId) {
14 resolve(sessionId); 11 resolve();
15 } else { 12 } else {
16 // 身份失效 13 // 没有sessionId则获取并埋值
17 //登陆失效的回调 14 wx.login({
18 // Store.clear("sessionId"); 15 success: function (res) {
19 // wx.reLaunch({ 16 console.log("wxlogin:", res);
20 // // url: '/pages/authorize/authorize' 17 Store.setItem('wxcode', res.code);
21 // url: '/pages/login/login', 18 let baseUrl = config.NET_CONFIG.baseApi;
22 // }) 19 wx.request({
20 url: baseUrl + '/warubiEyeCreamApi/app/login',
21 data: {
22 code: res.code
23 },
24 method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
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 });
23 } 47 }
24 }); 48 });
25 } 49 }
...@@ -28,6 +52,7 @@ const fetch = function ({ ...@@ -28,6 +52,7 @@ const fetch = function ({
28 loading = false, 52 loading = false,
29 toast = true, 53 toast = true,
30 sid = true, 54 sid = true,
55 auth = true,
31 mode, 56 mode,
32 isMock, 57 isMock,
33 url, 58 url,
...@@ -54,15 +79,18 @@ const fetch = function ({ ...@@ -54,15 +79,18 @@ const fetch = function ({
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 // }
85 // url += "?sessionId=" + Store.getItem("sessionId")
60 // console.log("url:", url); 86 // console.log("url:", url);
61 wx.request({ 87 wx.request({
62 url: baseUrl + url, //请求地址 88 url: baseUrl + url, //请求地址
63 data: data, //自定义参数 89 data: data, //自定义参数
64 method: method || 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT 90 method: method || 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
65 // header: {}, // 设置请求的 header的默认参数,根据项目需求添加 91 header: {
92 sessionId: Store.getItem("sessionId")
93 }, // 设置请求的 header的默认参数,根据项目需求添加
66 // header: { 94 // header: {
67 // 'clientInfo': JSON.stringify(clientInfo), 95 // 'clientInfo': JSON.stringify(clientInfo),
68 // 'Server-Token':'xxx' 96 // 'Server-Token':'xxx'
...@@ -86,6 +114,15 @@ const fetch = function ({ ...@@ -86,6 +114,15 @@ const fetch = function ({
86 wx.reLaunch({ 114 wx.reLaunch({
87 url: '/pages/authorize/authorize' 115 url: '/pages/authorize/authorize'
88 }) 116 })
117 return;
118
119 // Router.push({
120 // path: "authorize",
121 // openType: "reLaunch",
122 // query: {
123 // status: '404'
124 // }
125 // })
89 } 126 }
90 // 内部统一的成功code拦截码 127 // 内部统一的成功code拦截码
91 if (res.code === 200) { 128 if (res.code === 200) {
...@@ -129,8 +166,6 @@ const fetch = function ({ ...@@ -129,8 +166,6 @@ const fetch = function ({
129 } 166 }
130 }) 167 })
131 }) 168 })
132
133
134 }); 169 });
135 return promise; 170 return promise;
136 } 171 }
......
...@@ -3,37 +3,35 @@ let config = require('../../config'); ...@@ -3,37 +3,35 @@ 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 onLoad(options) {},
15 onShow() {},
14 bindGetUserInfo(e) { 16 bindGetUserInfo(e) {
15 wx.showLoading(); 17 wx.showLoading();
16 this.getUserInfo(e.detail); 18 this.getUserInfo(e.detail);
17 }, 19 },
18 // 点openType==userInfo 手动登陆
19 getUserInfo(e) { 20 getUserInfo(e) {
20 let _this = this; 21 let _this = this;
21 // 直接就能拿到 userInfo
22 app.globalData.userInfo = e.userInfo; 22 app.globalData.userInfo = e.userInfo;
23 wx.login({
24 success: function (res) {
25 app.post({ 23 app.post({
26 url: app.api.decrypt, 24 url: app.api.register,
25 sid: false,
27 data: { 26 data: {
28 encryptedData: e.encryptedData, 27 encryptedData: e.encryptedData,
29 iv: e.iv, 28 iv: e.iv,
30 code: res.code 29 code: app.globalData.wxcode,
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 }
36 });
37 }, 35 },
38 // 刷新首页数据 36 // 刷新首页数据
39 refreshIndexData() { 37 refreshIndexData() {
...@@ -49,32 +47,37 @@ Page({ ...@@ -49,32 +47,37 @@ Page({
49 }); 47 });
50 }); 48 });
51 }, 49 },
52 // 判断结果去首页 50 // 自动授权
53 autoAuth() { 51 autoAuth() {
54 // 调用自动登陆方法
55 let _this = this; 52 let _this = this;
56 this.refreshIndexData().then((result) => { 53 this.refreshIndexData().then((result) => {
57 let indexInfo = app.globalData.indexInfo; 54 if (result.isNeedAuth == 1) {
58 // 自动登陆成功 55 // 未授权
59 let loginSuc = true; 56 wx.login({
60 if (loginSuc) { 57 success: function (res) {
61 // 登陆成功跳转到首页 58 app.store.setItem("wxcode", res.code);
62 setTimeout(() => { 59 }
63 app.router.push({ 60 });
64 path: 'index',
65 query: {},
66 duration: 0,
67 openType: "redirect"
68 })
69 wx.hideLoading();
70 }, 3000);
71 } else {
72 // 登陆失败,隐藏loading自动登陆
73 wx.hideLoading(); 61 wx.hideLoading();
74 this.setData({ 62 _this.setData({
75 authorized: false 63 authorized: false
76 }) 64 })
65 } else {
66 // 已经授权
67 // setTimeout(() => {
68 _this.toIndex();
69 wx.hideLoading();
70 // }, 2000);
77 } 71 }
78 }); 72 });
73 },
74 // 跳转到首页
75 toIndex() {
76 app.router.push({
77 path: "index",
78 openType: "redirect"
79 })
80 wx.hideLoading();
79 } 81 }
82
80 }) 83 })
......
...@@ -4,31 +4,74 @@ ...@@ -4,31 +4,74 @@
4 position: relative; 4 position: relative;
5 overflow: hidden; 5 overflow: hidden;
6 6
7 .bgc {} 7 .bgc {
8 8 // background-color: transparent;
9 .bg {} 9 // background-color: black;
10 background-color: #fafafc;
11 }
10 12
11 13
14 .main {
12 15
16 position: relative;
13 17
14 .main { 18 .top-space {
19 height: 60px;
20 }
15 21
16 .login-wrap {
17 padding-top: 946px;
18 22
19 .login-btn { 23 .login {
20 width: 340px; 24 position: relative;
21 height: 80px; 25 width: 650px;
22 line-height: 80px;
23 border-radius: 40px;
24 border: solid 3px #4bc2ed;
25 margin: 0 auto; 26 margin: 0 auto;
26 font-size: 36px;
27 color: #4bc2ed;
28 text-align: center; 27 text-align: center;
29 background-color: transparent; 28
29 &-logo {
30 width: 140px;
31 height: 140px;
30 } 32 }
33
34 &-name {
35 margin-top: 32px;
36 font-size: 32px;
37 color: #333333;
38 }
39
40 &-line {
41 margin-top: 70px;
42 width: 650px;
43 height: 2px;
44 background-color: #eaeaec;
31 } 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
32 } 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" />
11 <view class="login-name">丸美</view>
12 <view class="login-line"></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 确认授权
9 </button> 17 </button>
10 </view> 18 </view>
11 </view> 19 </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 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;
23
24 .d1 {
25 position: absolute;
26 width: 160px;
27 height: 192px;
28 top: 0;
29 left: 0;
30 }
6 31
7 .bg {} 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 {
47 .btn {
15 position: relative; 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 }
16 } 57 }
17 } 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__bg bg">
6 <image src="../../image/index/index_c2.png" mode="scaleToFill" />
7 </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>
5 <view class="app__content main"> 12 <view class="app__content main">
6 <view class="top-space"></view> 13 <view class="top-space"></view>
7 <view class="content"></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>
8 </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