Browse Source

新增组件

master
HolyKnightIX 1 year ago
parent
commit
906f89b65f
14 changed files with 227 additions and 35 deletions
  1. BIN
      miniprogram/asset/icon/success.png
  2. +82
    -0
      miniprogram/components/userNumberChkeck.js
  3. +3
    -0
      miniprogram/components/userNumberChkeck.json
  4. +104
    -0
      miniprogram/components/userNumberChkeck.less
  5. +25
    -0
      miniprogram/components/userNumberChkeck.wxml
  6. +0
    -23
      miniprogram/components/userNumberSync.js
  7. +0
    -4
      miniprogram/components/userNumberSync.json
  8. +0
    -1
      miniprogram/components/userNumberSync.less
  9. +0
    -2
      miniprogram/components/userNumberSync.wxml
  10. +5
    -1
      miniprogram/pages/payOrder/payOrder.js
  11. +3
    -1
      miniprogram/pages/payOrder/payOrder.json
  12. +1
    -1
      miniprogram/pages/payOrder/payOrder.less
  13. +3
    -1
      miniprogram/pages/payOrder/payOrder.wxml
  14. +1
    -1
      tsconfig.json

BIN
miniprogram/asset/icon/success.png View File

Before After
Width: 128  |  Height: 128  |  Size: 3.4 KiB

+ 82
- 0
miniprogram/components/userNumberChkeck.js View File

@@ -0,0 +1,82 @@
// components/userNumberSync.ts
import request from '../utils/request'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
value: false
},
},

/**
* 组件的初始数据
*/
data: {
isNotRead: true
},

/**
* 组件的方法列表
*/
methods: {
closeBox(e) {
const id = e.target.id
if (id == 'componentBG') {
this.setData({
show: false
})
}
},

getphonenumber(e) {
const sessionKey = wx.getStorageSync('sessionKey')
this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId)
},

/** 获取手机号授权 */
doGetUserPhone(encryptedData, iv, sessionKey, appId) {
request.post({
url: '/api/user/getUserPhone',
data: {
encryptedData,
iv,
sessionKey,
appId
}
}).then(res => {
console.log(res, 'getUserPhone');
wx.showToast({
title: '登录成功!',
icon: 'success'
})
this.setData({
show: false
})
}).catch(err => {
console.log(err, 'err');
})
},

agreedClick() {
this.setData({
isNotRead: !this.data.isNotRead
})
},

// 跳转至用户协议页面
checkUserProtocol() {
wx.navigateTo({
url: '/pages/userProtocol/userProtocol',
})
},

skip() {
this.setData({
show: false
})
}
}
})

+ 3
- 0
miniprogram/components/userNumberChkeck.json View File

@@ -0,0 +1,3 @@
{
"component": true
}

+ 104
- 0
miniprogram/components/userNumberChkeck.less View File

@@ -0,0 +1,104 @@
/* components/userNumberSync.wxss */
.component {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: all 0.3s;
z-index: -100;

&.active {
background-color: #000000a2;
z-index: 999;
}

.checkBox {
position: fixed;
bottom: -800rpx;
width: 100%;
height: 0rpx;
background-color: #ffffff;
border-radius: 5% 5% 0 0;
transition: all 0.3s;
z-index: -100;

&.active {
bottom: 0;
height: 55%;
z-index: 999;
}

.logo {
width: 200rpx;
height: 200rpx;
margin: 50rpx auto;
margin-bottom: 90rpx;

image {
width: 100%;
}

.title {
text-align: center;
font-weight: 600;
font-size: 50rpx;
color: #4b4b4b;
}
}

.memberNotice {
text-align: center;
font-weight: 200;
}

.getPhoneNumber {
width: 70%;
border-radius: 20rpx;
margin-top: 50rpx;
}

.skip {
text-align: center;
margin: 40rpx 0;
}

.userProtocolModel {
text-align: center;
margin-bottom: 30rpx;

.textInside {
position: relative;

.agreeButton {
position: absolute;
left: 80rpx;
width: 35rpx;
height: 35rpx;
line-height: 35rpx;
border: 1px solid #464646;
border-radius: 50% 50%;
color: #ffffff;
text-align: center;

image {
width: 100%;
height: 100%;
}

&.active {
border: 0px solid #464646;
}
}

.userProtocol {
text-align: center;
color: #929292;
text-decoration: underline;
margin-bottom: 15rpx;
}
}

}
}
}

+ 25
- 0
miniprogram/components/userNumberChkeck.wxml View File

@@ -0,0 +1,25 @@
<!--components/userNumberSync.wxml-->

<view class="{{show ? 'component active' : 'component'}}" bindtap="closeBox" id="componentBG">
<view class="{{show ? 'checkBox active' : 'checkBox'}}">
<view class="logo">
<image src="../asset/icon/tiny-Chat-rotate.png" mode="widthFix" />
<view class="title">小闲聊</view>
</view>

<view class="memberNotice">成为小闲聊会员,享受更多权益</view>

<button open-type="getPhoneNumber" class="getPhoneNumber" type="primary" bindgetphonenumber="getphonenumber" disabled="{{isNotRead}}">微信一键登录</button>
<view class="skip" bindtap="skip">暂时跳过</view>

<view class="userProtocolModel">
<view class="textInside">
<view class="{{isNotRead ? 'agreeButton' : 'agreeButton active'}}" bindtap="agreedClick">
<image wx:if="{{!isNotRead}}" src="../asset/icon/success.png" mode="" />
</view>
<text>我已阅读并同意</text>
<text class="userProtocol" bindtap="checkUserProtocol">《用户协议及隐私政策》</text>
</view>
</view>
</view>
</view>

+ 0
- 23
miniprogram/components/userNumberSync.js View File

@@ -1,23 +0,0 @@
// components/userNumberSync.ts
Component({
/**
* 组件的属性列表
*/
properties: {

},

/**
* 组件的初始数据
*/
data: {

},

/**
* 组件的方法列表
*/
methods: {

}
})

+ 0
- 4
miniprogram/components/userNumberSync.json View File

@@ -1,4 +0,0 @@
{
"component": true,
"usingComponents": {}
}

+ 0
- 1
miniprogram/components/userNumberSync.less View File

@@ -1 +0,0 @@
/* components/userNumberSync.wxss */

+ 0
- 2
miniprogram/components/userNumberSync.wxml View File

@@ -1,2 +0,0 @@
<!--components/userNumberSync.wxml-->
<text>components/userNumberSync.wxml</text>

+ 5
- 1
miniprogram/pages/payOrder/payOrder.js View File

@@ -12,7 +12,8 @@ Page({
orderList: [],
imgUrl: 'https://formall.oss-accelerate.aliyuncs.com/ga/payOrder-1.png',
currentIndex: null,
currentId: ''
currentId: '',
isShowNumberCheck: false
},

/**
@@ -84,6 +85,9 @@ Page({
},

createPayOrder() {
// this.setData({
// isShowNumberCheck: true
// })
const data = {
appId: request.appId
}


+ 3
- 1
miniprogram/pages/payOrder/payOrder.json View File

@@ -1,5 +1,7 @@
{
"navigationBarTitleText": "延续会员",
"navigationBarBackgroundColor": "#ededed",
"usingComponents": {}
"usingComponents": {
"userNumberChkeck": "../../components/userNumberChkeck"
}
}

+ 1
- 1
miniprogram/pages/payOrder/payOrder.less View File

@@ -144,7 +144,7 @@ page {
}

.salePrice {
font-size: 28rpx;
font-size: 25rpx;
margin-bottom: 10rpx;

.lightHigh {


+ 3
- 1
miniprogram/pages/payOrder/payOrder.wxml View File

@@ -36,4 +36,6 @@

<button class="btn" type="primary" bindtap="createPayOrder">立即购买</button>
</view>
</view>
</view>

<userNumberChkeck show="{{isShowNumberCheck}}"></userNumberChkeck>

+ 1
- 1
tsconfig.json View File

@@ -36,7 +36,7 @@
"miniprogram/pages/orderDetail/orderDetail.js",
"miniprogram/pages/userProtocol/userProtocol.js",
"miniprogram/pages/mine/mine.js",
"miniprogram/components/userNumberSync.js",
"miniprogram/components/userNumberChkeck.js",
],
"exclude": [
"node_modules"


Loading…
Cancel
Save