2daada2a by simon

版本提交

1 parent 9e02268d
......@@ -17,7 +17,6 @@ App({
config: config,
router: router,
store: store,
onLaunch: function () {},
globalData: {
indexInfo: null,
userInfo: null,
......@@ -28,6 +27,34 @@ App({
posterWishList: [], //海报用
giftData: null, // 实物奖 userTabel prizeDetail用
},
onLaunch: function () {
this.share();
},
//重写分享方法
share: function () {
//监听路由切换
//间接实现全局设置分享内容
wx.onAppRoute(function (res) {
//获取加载的页面
let pages = getCurrentPages();
//获取当前页面的对象
let view = pages[pages.length - 1];
let data;
if (view) {
data = view.data;
if (!data.isOverShare) {
data.isOverShare = true;
view.onShareAppMessage = function (res) {
//分享配置
return {
title: '弹弹弹 看你有多弹',
path: 'pages/index/index'
};
};
}
}
})
},
// 获取用户基本信息
queryIndex(query = {
auth: true
......
......@@ -6,6 +6,7 @@
"pages/authorize/authorize",
"pages/coop/coop",
"pages/register/register",
"pages/login/login",
"pages/wish/wish",
"pages/create-wish/create-wish",
"pages/question/question",
......
......@@ -21,7 +21,7 @@ Component({
// 去注册页面
toRegister() {
app.router.push({
path: "register"
path: "login"
})
}
}
......
......@@ -17,7 +17,7 @@ Page({
wishInfo: {},
wishList: [],
coopInfo: {},
canShake: false,
canShake: true,
},
onShareAppMessage() {},
onLoad(options) {
......@@ -31,7 +31,7 @@ Page({
initData() {
app.queryIndex().then((result) => {
// 判断是否需要授权
if (result.isNeedAuth) {
if (result.isNeedAuth == 1) {
app.router.push({
path: "authorize",
query: {
......@@ -39,9 +39,12 @@ Page({
}
})
} else {
// this.queryWishbillDetail();
// this.initShake();
}
this.queryWishbillDetail();
this.initShake();
}
})
},
// 添加摇一摇
......@@ -52,6 +55,7 @@ Page({
return
}
if (res.x > 1) { //偏移量为2时触发,有的使用1
// 触发摇一摇
_this.queryWishbillAssist();
}
......@@ -66,9 +70,9 @@ Page({
},
// 助力
queryWishbillAssist() {
this.setData({
canShake: false
})
// this.setData({
// canShake: false
// })
app.post({
url: app.api.wishbillAssist,
data: {
......
......@@ -39,7 +39,6 @@ Page({
this.isPageVisible = false;
},
onLoad(options) {
console.log("cwish------");
this.initData();
},
initData() {
......
......@@ -18,7 +18,7 @@ Page({
})
})
},
// 开始互动游戏
// 开始互动游戏 判断是否会员
onStartHandler() {
let {
wishBillCode
......
let Date = require('../../utils/date.js');
let Utils = require('../../utils/util.js');
let app = getApp();
Page({
data: {
tipsInnerText: "",
redirect: "createWish", // 注册完的重定向页面
tipsRegisteredVisible: false,
tipsCommonVisible: false,
// form start
name: "",
mobile: "",
verifyCode: "",
birthday: "",
password: "",
sex: -1,
sexList: [{
label: "女",
value: 0
},
{
label: "男",
value: 1
},
],
isTerms: false,
// form end
auth_time: 0,
sendAuthCode: true,
/*布尔值,通过v-show控制显示‘获取按钮’还是‘倒计时’ */
},
onShareAppMessage() {},
onLoad(options) {
let {
redirect
} = options;
if (redirect) {
this.setData({
redirect
})
}
this.initData();
},
initData() {},
showLog(msg) {
wx.showToast({
title: msg,
icon: "none"
})
},
// 登陆
doLogin() {
let _this = this;
this.checkForm().then((result) => {
// 注册
let data = {
mobile: this.data.mobile,
verifyCode: this.data.verifyCode,
}
app.post({
url: app.api.crmLogin,
data: data
}).then((result) => {
if (result.status == 1) {
wx.showModal({
title: "登陆成功",
content: "继续生成我的心愿单",
confirmText: "马上前往",
showCancel: false,
success(res) {
app.router.push({
openType: "redirectTo",
path: _this.data.redirect
})
}
})
} else if (result.status == 0) {
this.setData({
tipsInnerText: "短信验证码错误",
tipsCommonVisible: true,
})
} else if (result.status == 2) {
this.setData({
tipsInnerText: "账号不存在",
tipsCommonVisible: true,
})
} else {
this.setData({
tipsInnerText: "登陆失败",
tipsCommonVisible: true,
})
}
});
})
},
// 注册
doRegister() {
let _this = this;
this.checkForm().then((result) => {
// 注册
let data = {
mobile: this.data.mobile,
name: this.data.name,
birthday: this.data.birthday,
verifyCode: this.data.verifyCode,
password: this.data.password,
sex: this.data.sex,
}
app.post({
url: app.api.crmRegister,
data: data
}).then((result) => {
if (result.status == 1) {
wx.showModal({
title: "登陆成功",
content: "继续生成我的心愿单",
confirmText: "马上前往",
showCancel: false,
success(res) {
app.router.push({
openType: "redirectTo",
path: _this.data.redirect
})
}
})
} else {
this.setData({
tipsInnerText: result.errMsg,
tipsCommonVisible: true,
})
}
});
})
},
// 表单检查
checkForm() {
return new Promise((resolve, reject) => {
if (!this.data.mobile) {
this.showLog("请输入手机号码");
reject();
} else if (!Utils.checkMobile(this.data.mobile)) {
this.showLog("请输正确手机号码");
reject();
} else if (!this.data.verifyCode) {
this.showLog("请输入验证码");
reject();
} else {
resolve();
}
});
},
// 是否同意条款
onTermsHandler() {
console.log("onTermsHandler");
this.setData({
isTerms: !this.data.isTerms
})
},
// 跳转至会员条款
onPolicyHandler() {},
// 跳转到注册页面
toRegisterHandler() {
app.router.push({
openType: "redirectTo",
path: "register"
})
},
// 获取验证码
reqGetSmsRequest() {
if (!this.data.sendAuthCode) return;
let mobile = this.data.mobile
if (!mobile || !Utils.checkMobile(mobile)) {
this.showLog("请输入正确的手机号码");
return
}
this.getAuthCode();
app.post({
url: app.api.mobileVerifyCode,
data: {
picVerifyCode: "",
mobile: mobile,
forRegister: 0
}
}).then((result) => {
wx.showToast({
title: "短信发送成功",
icon: "none"
})
});
},
// 倒数
getAuthCode() {
let _this = this;
_this.setData({
sendAuthCode: false,
auth_time: 60
})
var auth_timetimer = setInterval(() => {
_this.setData({
auth_time: _this.data.auth_time - 1
})
if (_this.data.auth_time <= 0) {
_this.setData({
sendAuthCode: true
});
clearInterval(auth_timetimer)
}
}, 1000)
},
bindMobileInput(e) {
this.setData({
"mobile": e.detail.value
})
},
bindNameInput(e) {
this.setData({
name: e.detail.value
})
},
bindBirthdayInput(e) {
this.setData({
birthday: e.detail.value
})
},
bindPasswordInput(e) {
this.setData({
password: e.detail.value
})
},
bindVerifyCodeInput(e) {
this.setData({
verifyCode: e.detail.value
})
},
bindBirthdayChange(e) {
this.setData({
birthday: e.detail.value
})
},
onSexRadioChange(e) {
this.setData({
sex: e.detail.value
})
console.log("sex:", this.data.sex);
},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide_mask":
this.setData({
tipsRegisteredVisible: false,
tipsCommonVisible: false
})
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "登陆",
"usingComponents": {
"tips-register-ed-comp": "../../component/tips-register-ed-comp/tips-register-ed-comp",
"tips-common-comp": "../../component/tips-common-comp/tips-common-comp",
"van-popup": "../../ui/vant-weapp/popup/index"
}
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
$formWidth:560px;
.page {
.bgc {
background-color: #fff2ef;
}
.bg {}
.main {
.top-space {
height: 74px;
}
.content {
position: relative;
// logo
.logo {
width: 235px;
height: 122px;
margin: 0 auto;
.img {
width: 235px;
height: 122px;
}
}
// 表单
.form {
width: $formWidth;
margin: 36px auto 0;
.table {
.ipt {
margin-bottom: 20px;
color: #ba3138;
width: $formWidth;
height: 80px;
border-radius: 40px;
border: solid 1px #db9a9d;
background-color: #ffffff;
display: flex;
justify-content: space-between;
&-icon {
width: 74px;
height: 80px;
@extend .fcc;
.icon {
width: 30px;
}
}
&-input {
flex: 1;
@extend .bb;
height: 80px;
font-size: 28px;
padding-right: 24px;
}
&-verify {
@extend .fcc;
font-size: 30px;
padding: 0 32px;
}
}
}
.radio-group {
font-size: 28px;
color: #ba3138;
color: #db9a9d;
radio .wx-radio-input {
/* 自定义样式.... */
height: 32px;
width: 32px;
}
}
}
// 拼图
.puzzle {
margin-top: 32px;
$borderRadius: 32px;
width: $formWidth;
border-radius: $borderRadius;
border: solid 1px #db9a9d;
.plz {
@include border-top-radius($borderRadius);
width: $formWidth;
height: 183px;
image {
@include border-top-radius($borderRadius);
width: $formWidth;
height: 183px;
}
}
.slider {
width: 560px;
height: 70px;
border-top: solid 1px #db9a9d;
background-color: #ffffff;
@include border-bottom-radius($borderRadius);
}
}
// 隐私条款
.policy {
margin-left: 40px;
margin-top: 22px;
color: #333333;
font-size: 28px;
display: flex;
align-items: center;
.check {
width: 28px;
height: 28px;
margin-right: 12px;
background-color: #b83138;
border-radius: 14px;
@extend .fcc;
image {
width: 18px;
height: 13px;
}
}
.t1 {}
.t2 {
color: #b83138;
}
}
// 注册按钮
.register-btn {
margin: 68px auto 0;
@include btc($formWidth, 100px);
color: #ffffff;
font-size: 36px;
border-radius: 50px;
background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138);
}
.accout-tips {
margin-top: 24px;
text-align: center;
font-size: 24px;
.t1 {
color: #b83138;
}
}
}
}
}
.placeholder {
color: rgba(186, 49, 56, 0.5);
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<view class="app__content main">
<view class="top-space"></view>
<view class="content">
<!-- logo -->
<view class="logo">
<image class="img" mode="widthFix" src="../../image/oss/register/logo.png" />
</view>
<!-- 表单 -->
<view class="form">
<view class="table">
<!-- 手机号 -->
<view class="ipt">
<view class="ipt-icon">
<image class="icon" mode="widthFix" src="../../image/oss/register/reg-icon-mobile.png" />
</view>
<input value="{{mobile}}" bindinput="bindMobileInput" class="ipt-input" placeholder="手机号" placeholder-class="placeholder" />
</view>
<!-- 验证码 -->
<view class="ipt">
<view class="ipt-icon">
<image class="icon" mode="widthFix" src="../../image/oss/register/reg-icon-verify.png" />
</view>
<input value="{{verifyCode}}" bindinput="bindVerifyCodeInput" class="ipt-input" placeholder="验证码" placeholder-class="placeholder" />
<view bindtap="reqGetSmsRequest" class="ipt-verify">
{{sendAuthCode ? "获取验证码": auth_time+"(s)"}}
</view>
</view>
</view>
<!-- 条款/政策 -->
<!-- <view class="policy">
<span bindtap="onTermsHandler" class="check">
<image wx:if="{{isTerms}}" mode="widthFix" src="../../image/oss/register/check-c1.png" />
</span>
<span bindtap="onTermsHandler" class="t1">我同意</span>
<span bindtap="onPolicyHandler" class="t2">《丸美会员注册绑定条款》</span>
</view> -->
<!-- 注册按钮 -->
<view bindtap="doLogin" class="register-btn">登陆</view>
<view bindtap="toRegisterHandler" class="accout-tips">
还不是会员
<span class="t1">立即注册>></span>
</view>
</view>
</view>
</view>
</view>
<van-popup show="{{ tipsRegisteredVisible }}">
<tips-register-ed-comp bind:evtcomp="evtcomp"></tips-register-ed-comp>
</van-popup>
<van-popup show="{{ tipsCommonVisible }}">
<tips-common-comp bind:evtcomp="evtcomp" inner-text="{{tipsInnerText}}"></tips-common-comp>
</van-popup>
......@@ -2,6 +2,7 @@ import Poster from '../../miniprogram_dist/poster/poster';
let app = getApp();
Page({
data: {
isOverShare: true,
imageUrl: "", // 海报图片
wxShareTitle: "", // 分享标题
wxCodePath: "", // 微信二维码参数地址,分享链接公用
......@@ -43,7 +44,7 @@ Page({
let nickname = app.globalData.userInfo && app.globalData.userInfo.nickname || "";
let billCode = app.globalData.indexInfo.wishBillCode;
let wxShareTitle = nickname + `正在参加丸美眼霜节心愿单活动,需要你的倾情相助!`;
let wxCodePath = `/pages/coop/coop?billCode=${billCode}&s=share`
let wxCodePath = `/pages/coop/coop?code=${billCode}&s=share`
this.setData({
wxCodePath: wxCodePath,
wxShareTitle: wxShareTitle
......
......@@ -32,6 +32,14 @@ Page({
},
onShareAppMessage() {},
onLoad(options) {
let {
redirect
} = options;
if (redirect) {
this.setData({
redirect
})
}
this.initData();
},
initData() {},
......@@ -119,8 +127,13 @@ Page({
})
},
// 跳转至会员条款
onPolicyHandler() {
onPolicyHandler() {},
// 跳转到登陆页面
toLoginHandler() {
app.router.push({
openType: "redirectTo",
path: "login"
})
},
// 获取验证码
reqGetSmsRequest() {
......
......@@ -156,6 +156,16 @@ $formWidth:560px;
border-radius: 50px;
background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138);
}
.accout-tips {
margin-top: 24px;
text-align: center;
font-size: 24px;
.t1 {
color: #b83138;
}
}
}
}
}
......
......@@ -76,6 +76,10 @@
</view>
<!-- 注册按钮 -->
<view bindtap="doRegister" class="register-btn">注册</view>
<view bindtap="toLoginHandler" class="accout-tips">
已有账号,
<span class="t1">立即登陆>></span>
</view>
</view>
</view>
</view>
......
......@@ -25,12 +25,22 @@ Page({
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
let userInfo = app.globalData.userInfo;
let billCode = app.globalData.indexInfo.wishBillCode;
let title = `${userInfo.nickname}正在参加丸美眼霜节心愿单活动,需要你的倾情相助!`;
let path = `/pages/coop/coop?code=${billCode}&s=share`
return {
title,
path
}
} else {
//分享配置
return {
title: '弹弹弹 看你有多弹',
path: 'pages/index/index'
};
}
},
onLoad(options) {},
onShow() {
......
......@@ -11,6 +11,7 @@ const routerPath = {
prizeDetail: '/pages/prize-detail/prize-detail', // 券详情
coop: '/pages/coop/coop', // 协作页/好友查看
register: '/pages/register/register', // 注册
login: '/pages/login/login', // 登陆
authorize: '/pages/authorize/authorize', // 授权
newWelfare: '/pages/new-welfare/new-welfare', // 新人福利
example: '/pages/example/example',
......