2daada2a by simon

版本提交

1 parent 9e02268d
...@@ -17,7 +17,6 @@ App({ ...@@ -17,7 +17,6 @@ App({
17 config: config, 17 config: config,
18 router: router, 18 router: router,
19 store: store, 19 store: store,
20 onLaunch: function () {},
21 globalData: { 20 globalData: {
22 indexInfo: null, 21 indexInfo: null,
23 userInfo: null, 22 userInfo: null,
...@@ -28,6 +27,34 @@ App({ ...@@ -28,6 +27,34 @@ App({
28 posterWishList: [], //海报用 27 posterWishList: [], //海报用
29 giftData: null, // 实物奖 userTabel prizeDetail用 28 giftData: null, // 实物奖 userTabel prizeDetail用
30 }, 29 },
30 onLaunch: function () {
31 this.share();
32 },
33 //重写分享方法
34 share: function () {
35 //监听路由切换
36 //间接实现全局设置分享内容
37 wx.onAppRoute(function (res) {
38 //获取加载的页面
39 let pages = getCurrentPages();
40 //获取当前页面的对象
41 let view = pages[pages.length - 1];
42 let data;
43 if (view) {
44 data = view.data;
45 if (!data.isOverShare) {
46 data.isOverShare = true;
47 view.onShareAppMessage = function (res) {
48 //分享配置
49 return {
50 title: '弹弹弹 看你有多弹',
51 path: 'pages/index/index'
52 };
53 };
54 }
55 }
56 })
57 },
31 // 获取用户基本信息 58 // 获取用户基本信息
32 queryIndex(query = { 59 queryIndex(query = {
33 auth: true 60 auth: true
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 "pages/authorize/authorize", 6 "pages/authorize/authorize",
7 "pages/coop/coop", 7 "pages/coop/coop",
8 "pages/register/register", 8 "pages/register/register",
9 "pages/login/login",
9 "pages/wish/wish", 10 "pages/wish/wish",
10 "pages/create-wish/create-wish", 11 "pages/create-wish/create-wish",
11 "pages/question/question", 12 "pages/question/question",
......
...@@ -21,7 +21,7 @@ Component({ ...@@ -21,7 +21,7 @@ Component({
21 // 去注册页面 21 // 去注册页面
22 toRegister() { 22 toRegister() {
23 app.router.push({ 23 app.router.push({
24 path: "register" 24 path: "login"
25 }) 25 })
26 } 26 }
27 } 27 }
......
...@@ -17,7 +17,7 @@ Page({ ...@@ -17,7 +17,7 @@ Page({
17 wishInfo: {}, 17 wishInfo: {},
18 wishList: [], 18 wishList: [],
19 coopInfo: {}, 19 coopInfo: {},
20 canShake: false, 20 canShake: true,
21 }, 21 },
22 onShareAppMessage() {}, 22 onShareAppMessage() {},
23 onLoad(options) { 23 onLoad(options) {
...@@ -31,7 +31,7 @@ Page({ ...@@ -31,7 +31,7 @@ Page({
31 initData() { 31 initData() {
32 app.queryIndex().then((result) => { 32 app.queryIndex().then((result) => {
33 // 判断是否需要授权 33 // 判断是否需要授权
34 if (result.isNeedAuth) { 34 if (result.isNeedAuth == 1) {
35 app.router.push({ 35 app.router.push({
36 path: "authorize", 36 path: "authorize",
37 query: { 37 query: {
...@@ -39,9 +39,12 @@ Page({ ...@@ -39,9 +39,12 @@ Page({
39 } 39 }
40 }) 40 })
41 } else { 41 } else {
42 this.queryWishbillDetail(); 42 // this.queryWishbillDetail();
43 this.initShake(); 43 // this.initShake();
44 } 44 }
45
46 this.queryWishbillDetail();
47 this.initShake();
45 }) 48 })
46 }, 49 },
47 // 添加摇一摇 50 // 添加摇一摇
...@@ -52,6 +55,7 @@ Page({ ...@@ -52,6 +55,7 @@ Page({
52 return 55 return
53 } 56 }
54 if (res.x > 1) { //偏移量为2时触发,有的使用1 57 if (res.x > 1) { //偏移量为2时触发,有的使用1
58
55 // 触发摇一摇 59 // 触发摇一摇
56 _this.queryWishbillAssist(); 60 _this.queryWishbillAssist();
57 } 61 }
...@@ -66,9 +70,9 @@ Page({ ...@@ -66,9 +70,9 @@ Page({
66 }, 70 },
67 // 助力 71 // 助力
68 queryWishbillAssist() { 72 queryWishbillAssist() {
69 this.setData({ 73 // this.setData({
70 canShake: false 74 // canShake: false
71 }) 75 // })
72 app.post({ 76 app.post({
73 url: app.api.wishbillAssist, 77 url: app.api.wishbillAssist,
74 data: { 78 data: {
......
...@@ -39,7 +39,6 @@ Page({ ...@@ -39,7 +39,6 @@ Page({
39 this.isPageVisible = false; 39 this.isPageVisible = false;
40 }, 40 },
41 onLoad(options) { 41 onLoad(options) {
42 console.log("cwish------");
43 this.initData(); 42 this.initData();
44 }, 43 },
45 initData() { 44 initData() {
......
...@@ -18,7 +18,7 @@ Page({ ...@@ -18,7 +18,7 @@ Page({
18 }) 18 })
19 }) 19 })
20 }, 20 },
21 // 开始互动游戏 21 // 开始互动游戏 判断是否会员
22 onStartHandler() { 22 onStartHandler() {
23 let { 23 let {
24 wishBillCode 24 wishBillCode
......
1 let Date = require('../../utils/date.js');
2 let Utils = require('../../utils/util.js');
3
4 let app = getApp();
5 Page({
6 data: {
7 tipsInnerText: "",
8 redirect: "createWish", // 注册完的重定向页面
9 tipsRegisteredVisible: false,
10 tipsCommonVisible: false,
11 // form start
12 name: "",
13 mobile: "",
14 verifyCode: "",
15 birthday: "",
16 password: "",
17 sex: -1,
18 sexList: [{
19 label: "女",
20 value: 0
21 },
22 {
23 label: "男",
24 value: 1
25 },
26 ],
27 isTerms: false,
28 // form end
29 auth_time: 0,
30 sendAuthCode: true,
31 /*布尔值,通过v-show控制显示‘获取按钮’还是‘倒计时’ */
32 },
33 onShareAppMessage() {},
34 onLoad(options) {
35 let {
36 redirect
37 } = options;
38 if (redirect) {
39 this.setData({
40 redirect
41 })
42 }
43 this.initData();
44 },
45 initData() {},
46 showLog(msg) {
47 wx.showToast({
48 title: msg,
49 icon: "none"
50 })
51 },
52 // 登陆
53 doLogin() {
54 let _this = this;
55 this.checkForm().then((result) => {
56 // 注册
57 let data = {
58 mobile: this.data.mobile,
59 verifyCode: this.data.verifyCode,
60 }
61 app.post({
62 url: app.api.crmLogin,
63 data: data
64 }).then((result) => {
65 if (result.status == 1) {
66 wx.showModal({
67 title: "登陆成功",
68 content: "继续生成我的心愿单",
69 confirmText: "马上前往",
70 showCancel: false,
71 success(res) {
72 app.router.push({
73 openType: "redirectTo",
74 path: _this.data.redirect
75 })
76 }
77 })
78 } else if (result.status == 0) {
79 this.setData({
80 tipsInnerText: "短信验证码错误",
81 tipsCommonVisible: true,
82 })
83 } else if (result.status == 2) {
84 this.setData({
85 tipsInnerText: "账号不存在",
86 tipsCommonVisible: true,
87 })
88 } else {
89 this.setData({
90 tipsInnerText: "登陆失败",
91 tipsCommonVisible: true,
92 })
93 }
94 });
95 })
96 },
97 // 注册
98 doRegister() {
99 let _this = this;
100 this.checkForm().then((result) => {
101 // 注册
102 let data = {
103 mobile: this.data.mobile,
104 name: this.data.name,
105 birthday: this.data.birthday,
106 verifyCode: this.data.verifyCode,
107 password: this.data.password,
108 sex: this.data.sex,
109 }
110 app.post({
111 url: app.api.crmRegister,
112 data: data
113 }).then((result) => {
114 if (result.status == 1) {
115 wx.showModal({
116 title: "登陆成功",
117 content: "继续生成我的心愿单",
118 confirmText: "马上前往",
119 showCancel: false,
120 success(res) {
121 app.router.push({
122 openType: "redirectTo",
123 path: _this.data.redirect
124 })
125 }
126 })
127 } else {
128 this.setData({
129 tipsInnerText: result.errMsg,
130 tipsCommonVisible: true,
131 })
132 }
133 });
134 })
135 },
136 // 表单检查
137 checkForm() {
138 return new Promise((resolve, reject) => {
139 if (!this.data.mobile) {
140 this.showLog("请输入手机号码");
141 reject();
142 } else if (!Utils.checkMobile(this.data.mobile)) {
143 this.showLog("请输正确手机号码");
144 reject();
145 } else if (!this.data.verifyCode) {
146 this.showLog("请输入验证码");
147 reject();
148 } else {
149 resolve();
150 }
151 });
152 },
153 // 是否同意条款
154 onTermsHandler() {
155 console.log("onTermsHandler");
156 this.setData({
157 isTerms: !this.data.isTerms
158 })
159 },
160 // 跳转至会员条款
161 onPolicyHandler() {},
162 // 跳转到注册页面
163 toRegisterHandler() {
164 app.router.push({
165 openType: "redirectTo",
166 path: "register"
167 })
168 },
169 // 获取验证码
170 reqGetSmsRequest() {
171 if (!this.data.sendAuthCode) return;
172 let mobile = this.data.mobile
173 if (!mobile || !Utils.checkMobile(mobile)) {
174 this.showLog("请输入正确的手机号码");
175 return
176 }
177 this.getAuthCode();
178 app.post({
179 url: app.api.mobileVerifyCode,
180 data: {
181 picVerifyCode: "",
182 mobile: mobile,
183 forRegister: 0
184 }
185 }).then((result) => {
186 wx.showToast({
187 title: "短信发送成功",
188 icon: "none"
189 })
190 });
191 },
192 // 倒数
193 getAuthCode() {
194 let _this = this;
195 _this.setData({
196 sendAuthCode: false,
197 auth_time: 60
198 })
199 var auth_timetimer = setInterval(() => {
200 _this.setData({
201 auth_time: _this.data.auth_time - 1
202 })
203 if (_this.data.auth_time <= 0) {
204 _this.setData({
205 sendAuthCode: true
206 });
207 clearInterval(auth_timetimer)
208 }
209 }, 1000)
210 },
211
212 bindMobileInput(e) {
213 this.setData({
214 "mobile": e.detail.value
215 })
216 },
217 bindNameInput(e) {
218 this.setData({
219 name: e.detail.value
220 })
221 },
222 bindBirthdayInput(e) {
223 this.setData({
224 birthday: e.detail.value
225 })
226 },
227 bindPasswordInput(e) {
228 this.setData({
229 password: e.detail.value
230 })
231 },
232 bindVerifyCodeInput(e) {
233 this.setData({
234 verifyCode: e.detail.value
235 })
236 },
237 bindBirthdayChange(e) {
238 this.setData({
239 birthday: e.detail.value
240 })
241 },
242 onSexRadioChange(e) {
243 this.setData({
244 sex: e.detail.value
245 })
246 console.log("sex:", this.data.sex);
247 },
248
249 // 子组件事件
250 evtcomp(evt) {
251 let {
252 name,
253 data
254 } = evt.detail;
255 switch (name) {
256
257 case "_evt_hide_mask":
258 this.setData({
259 tipsRegisteredVisible: false,
260 tipsCommonVisible: false
261 })
262 break;
263
264 default:
265 break;
266 }
267 },
268 })
1 {
2 "navigationBarTitleText": "登陆",
3 "usingComponents": {
4 "tips-register-ed-comp": "../../component/tips-register-ed-comp/tips-register-ed-comp",
5 "tips-common-comp": "../../component/tips-common-comp/tips-common-comp",
6 "van-popup": "../../ui/vant-weapp/popup/index"
7 }
8 }
1 @import '../../assets/scss/mixins';
2 @import '../../assets/scss/utils';
3
4
5 $formWidth:560px;
6
7 .page {
8 .bgc {
9 background-color: #fff2ef;
10 }
11
12 .bg {}
13
14 .main {
15 .top-space {
16 height: 74px;
17 }
18
19 .content {
20 position: relative;
21
22 // logo
23 .logo {
24 width: 235px;
25 height: 122px;
26 margin: 0 auto;
27
28 .img {
29 width: 235px;
30 height: 122px;
31 }
32 }
33
34 // 表单
35 .form {
36 width: $formWidth;
37 margin: 36px auto 0;
38
39 .table {
40 .ipt {
41 margin-bottom: 20px;
42 color: #ba3138;
43 width: $formWidth;
44 height: 80px;
45 border-radius: 40px;
46 border: solid 1px #db9a9d;
47 background-color: #ffffff;
48 display: flex;
49 justify-content: space-between;
50
51 &-icon {
52 width: 74px;
53 height: 80px;
54 @extend .fcc;
55
56 .icon {
57 width: 30px;
58 }
59 }
60
61 &-input {
62 flex: 1;
63 @extend .bb;
64 height: 80px;
65 font-size: 28px;
66 padding-right: 24px;
67 }
68
69 &-verify {
70 @extend .fcc;
71 font-size: 30px;
72 padding: 0 32px;
73 }
74 }
75 }
76
77 .radio-group {
78 font-size: 28px;
79 color: #ba3138;
80 color: #db9a9d;
81
82 radio .wx-radio-input {
83 /* 自定义样式.... */
84 height: 32px;
85 width: 32px;
86 }
87
88 }
89 }
90
91 // 拼图
92 .puzzle {
93 margin-top: 32px;
94 $borderRadius: 32px;
95 width: $formWidth;
96 border-radius: $borderRadius;
97 border: solid 1px #db9a9d;
98
99 .plz {
100 @include border-top-radius($borderRadius);
101 width: $formWidth;
102 height: 183px;
103
104 image {
105 @include border-top-radius($borderRadius);
106 width: $formWidth;
107 height: 183px;
108 }
109 }
110
111 .slider {
112 width: 560px;
113 height: 70px;
114 border-top: solid 1px #db9a9d;
115 background-color: #ffffff;
116 @include border-bottom-radius($borderRadius);
117 }
118 }
119
120 // 隐私条款
121 .policy {
122 margin-left: 40px;
123 margin-top: 22px;
124 color: #333333;
125 font-size: 28px;
126 display: flex;
127 align-items: center;
128
129 .check {
130 width: 28px;
131 height: 28px;
132 margin-right: 12px;
133 background-color: #b83138;
134 border-radius: 14px;
135 @extend .fcc;
136
137 image {
138 width: 18px;
139 height: 13px;
140 }
141 }
142
143 .t1 {}
144
145 .t2 {
146 color: #b83138;
147 }
148 }
149
150 // 注册按钮
151 .register-btn {
152 margin: 68px auto 0;
153 @include btc($formWidth, 100px);
154 color: #ffffff;
155 font-size: 36px;
156 border-radius: 50px;
157 background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138);
158 }
159
160 .accout-tips {
161 margin-top: 24px;
162 text-align: center;
163 font-size: 24px;
164
165 .t1 {
166 color: #b83138;
167 }
168 }
169 }
170 }
171 }
172
173 .placeholder {
174 color: rgba(186, 49, 56, 0.5);
175 }
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">
7 <!-- logo -->
8 <view class="logo">
9 <image class="img" mode="widthFix" src="../../image/oss/register/logo.png" />
10 </view>
11 <!-- 表单 -->
12 <view class="form">
13 <view class="table">
14 <!-- 手机号 -->
15 <view class="ipt">
16 <view class="ipt-icon">
17 <image class="icon" mode="widthFix" src="../../image/oss/register/reg-icon-mobile.png" />
18 </view>
19 <input value="{{mobile}}" bindinput="bindMobileInput" class="ipt-input" placeholder="手机号" placeholder-class="placeholder" />
20 </view>
21 <!-- 验证码 -->
22 <view class="ipt">
23 <view class="ipt-icon">
24 <image class="icon" mode="widthFix" src="../../image/oss/register/reg-icon-verify.png" />
25 </view>
26 <input value="{{verifyCode}}" bindinput="bindVerifyCodeInput" class="ipt-input" placeholder="验证码" placeholder-class="placeholder" />
27 <view bindtap="reqGetSmsRequest" class="ipt-verify">
28 {{sendAuthCode ? "获取验证码": auth_time+"(s)"}}
29 </view>
30 </view>
31 </view>
32 <!-- 条款/政策 -->
33 <!-- <view class="policy">
34 <span bindtap="onTermsHandler" class="check">
35 <image wx:if="{{isTerms}}" mode="widthFix" src="../../image/oss/register/check-c1.png" />
36 </span>
37 <span bindtap="onTermsHandler" class="t1">我同意</span>
38 <span bindtap="onPolicyHandler" class="t2">《丸美会员注册绑定条款》</span>
39 </view> -->
40 <!-- 注册按钮 -->
41 <view bindtap="doLogin" class="register-btn">登陆</view>
42 <view bindtap="toRegisterHandler" class="accout-tips">
43 还不是会员
44 <span class="t1">立即注册>></span>
45 </view>
46 </view>
47 </view>
48 </view>
49 </view>
50 <van-popup show="{{ tipsRegisteredVisible }}">
51 <tips-register-ed-comp bind:evtcomp="evtcomp"></tips-register-ed-comp>
52 </van-popup>
53 <van-popup show="{{ tipsCommonVisible }}">
54 <tips-common-comp bind:evtcomp="evtcomp" inner-text="{{tipsInnerText}}"></tips-common-comp>
55 </van-popup>
...@@ -2,6 +2,7 @@ import Poster from '../../miniprogram_dist/poster/poster'; ...@@ -2,6 +2,7 @@ import Poster from '../../miniprogram_dist/poster/poster';
2 let app = getApp(); 2 let app = getApp();
3 Page({ 3 Page({
4 data: { 4 data: {
5 isOverShare: true,
5 imageUrl: "", // 海报图片 6 imageUrl: "", // 海报图片
6 wxShareTitle: "", // 分享标题 7 wxShareTitle: "", // 分享标题
7 wxCodePath: "", // 微信二维码参数地址,分享链接公用 8 wxCodePath: "", // 微信二维码参数地址,分享链接公用
...@@ -43,7 +44,7 @@ Page({ ...@@ -43,7 +44,7 @@ Page({
43 let nickname = app.globalData.userInfo && app.globalData.userInfo.nickname || ""; 44 let nickname = app.globalData.userInfo && app.globalData.userInfo.nickname || "";
44 let billCode = app.globalData.indexInfo.wishBillCode; 45 let billCode = app.globalData.indexInfo.wishBillCode;
45 let wxShareTitle = nickname + `正在参加丸美眼霜节心愿单活动,需要你的倾情相助!`; 46 let wxShareTitle = nickname + `正在参加丸美眼霜节心愿单活动,需要你的倾情相助!`;
46 let wxCodePath = `/pages/coop/coop?billCode=${billCode}&s=share` 47 let wxCodePath = `/pages/coop/coop?code=${billCode}&s=share`
47 this.setData({ 48 this.setData({
48 wxCodePath: wxCodePath, 49 wxCodePath: wxCodePath,
49 wxShareTitle: wxShareTitle 50 wxShareTitle: wxShareTitle
......
...@@ -32,6 +32,14 @@ Page({ ...@@ -32,6 +32,14 @@ Page({
32 }, 32 },
33 onShareAppMessage() {}, 33 onShareAppMessage() {},
34 onLoad(options) { 34 onLoad(options) {
35 let {
36 redirect
37 } = options;
38 if (redirect) {
39 this.setData({
40 redirect
41 })
42 }
35 this.initData(); 43 this.initData();
36 }, 44 },
37 initData() {}, 45 initData() {},
...@@ -119,8 +127,13 @@ Page({ ...@@ -119,8 +127,13 @@ Page({
119 }) 127 })
120 }, 128 },
121 // 跳转至会员条款 129 // 跳转至会员条款
122 onPolicyHandler() { 130 onPolicyHandler() {},
123 131 // 跳转到登陆页面
132 toLoginHandler() {
133 app.router.push({
134 openType: "redirectTo",
135 path: "login"
136 })
124 }, 137 },
125 // 获取验证码 138 // 获取验证码
126 reqGetSmsRequest() { 139 reqGetSmsRequest() {
......
...@@ -156,6 +156,16 @@ $formWidth:560px; ...@@ -156,6 +156,16 @@ $formWidth:560px;
156 border-radius: 50px; 156 border-radius: 50px;
157 background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138); 157 background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138);
158 } 158 }
159
160 .accout-tips {
161 margin-top: 24px;
162 text-align: center;
163 font-size: 24px;
164
165 .t1 {
166 color: #b83138;
167 }
168 }
159 } 169 }
160 } 170 }
161 } 171 }
......
...@@ -76,6 +76,10 @@ ...@@ -76,6 +76,10 @@
76 </view> 76 </view>
77 <!-- 注册按钮 --> 77 <!-- 注册按钮 -->
78 <view bindtap="doRegister" class="register-btn">注册</view> 78 <view bindtap="doRegister" class="register-btn">注册</view>
79 <view bindtap="toLoginHandler" class="accout-tips">
80 已有账号,
81 <span class="t1">立即登陆>></span>
82 </view>
79 </view> 83 </view>
80 </view> 84 </view>
81 </view> 85 </view>
......
...@@ -25,12 +25,22 @@ Page({ ...@@ -25,12 +25,22 @@ Page({
25 if (res.from === 'button') { 25 if (res.from === 'button') {
26 // 来自页面内转发按钮 26 // 来自页面内转发按钮
27 console.log(res.target) 27 console.log(res.target)
28 let userInfo = app.globalData.userInfo;
29 let billCode = app.globalData.indexInfo.wishBillCode;
30 let title = `${userInfo.nickname}正在参加丸美眼霜节心愿单活动,需要你的倾情相助!`;
31 let path = `/pages/coop/coop?code=${billCode}&s=share`
32 return {
33 title,
34 path
35 }
36 } else {
37 //分享配置
38 return {
39 title: '弹弹弹 看你有多弹',
40 path: 'pages/index/index'
41 };
28 } 42 }
29 let userInfo = app.globalData.userInfo; 43
30 let title = `${userInfo.nickname}正在参加丸美眼霜节心愿单活动,需要你的倾情相助!`;
31 return {
32 title,
33 }
34 }, 44 },
35 onLoad(options) {}, 45 onLoad(options) {},
36 onShow() { 46 onShow() {
......
...@@ -11,6 +11,7 @@ const routerPath = { ...@@ -11,6 +11,7 @@ const routerPath = {
11 prizeDetail: '/pages/prize-detail/prize-detail', // 券详情 11 prizeDetail: '/pages/prize-detail/prize-detail', // 券详情
12 coop: '/pages/coop/coop', // 协作页/好友查看 12 coop: '/pages/coop/coop', // 协作页/好友查看
13 register: '/pages/register/register', // 注册 13 register: '/pages/register/register', // 注册
14 login: '/pages/login/login', // 登陆
14 authorize: '/pages/authorize/authorize', // 授权 15 authorize: '/pages/authorize/authorize', // 授权
15 newWelfare: '/pages/new-welfare/new-welfare', // 新人福利 16 newWelfare: '/pages/new-welfare/new-welfare', // 新人福利
16 example: '/pages/example/example', 17 example: '/pages/example/example',
......