登录页面图片验证处理

This commit is contained in:
2022-10-11 16:48:16 +08:00
parent c20f6cd005
commit 83fe74d948
49 changed files with 7451 additions and 6571 deletions

BIN
pages/.DS_Store vendored

Binary file not shown.

View File

@@ -1,56 +1,75 @@
<template>
<view class="content">
<oct-address
:lists="addressList"
:pattern="true"
:isEdit="edit"
editColor="#34CE98"
:btnStyle="{'backgroundColor': '#34CE98'}"
@onAddress="onInfo"
@onAdd="$Router.push({name: 'AddressEdit'})"
/>
<!-- -->
</view>
</template>
<script>
import { list } from '@/apis/interfaces/address'
export default {
data() {
return {
edit : true,
addressList: []
};
},
onShow(){
this.edit = this.$Route.query.type === 'edit'
list().then(res => {
this.addressList = res
})
},
methods: {
onInfo(val){
if(this.edit){
this.$Router.push({
name : 'AddressEdit',
params : {
id : val.address_id
}
})
}else{
this.$store.commit('setAddress', val)
this.$Router.back()
}
}
}
};
</script>
<style lang="scss">
.content{
background: #F3F6FB;
overflow: hidden;
min-height: 100vh;
}
<template>
<view class="content">
<oct-address :lists="addressList" :pattern="true" :isEdit="edit" editColor="#34CE98"
:btnStyle="{'backgroundColor': '#34CE98'}" @onAddress="onInfo"
@onAdd="$Router.push({name: 'AddressEdit'})" />
<!-- -->
</view>
</template>
<script>
import {
list
} from '@/apis/interfaces/address'
export default {
data() {
return {
edit: true,
addressList: [],
task_id: '',
};
},
onShow() {
this.edit = this.$Route.query.type === 'edit'
this.task_id = this.$Route.query.task_id
list().then(res => {
this.addressList = res
})
},
methods: {
onInfo(val) {
if (this.edit) {
this.$Router.push({
name: 'AddressEdit',
params: {
id: val.address_id
}
})
} else {
console.log('back........', this.task_id)
if (this.task_id != '') {
uni.showModal({
title: '温馨提示',
content: '是否确认将该商品发货到这个位置',
confirmColor: '#34ce98',
confirmText: '我确定',
cancelColor: '#999',
cancelText: '再想想',
success: (res) => {
if (res.confirm) {
console.log('调用该接口。。。。');
uni.navigateBack();
}
if (res.cancel) {
uni.navigateBack();
}
}
})
return;
}
this.$store.commit('setAddress', val)
this.$Router.back()
}
}
}
};
</script>
<style lang="scss">
.content {
background: #F3F6FB;
overflow: hidden;
min-height: 100vh;
}
</style>

View File

@@ -11,10 +11,10 @@
</view>
<view class="auth-input auth-code">
<input v-model="code" type="number" maxlength="4" placeholder="输入验证码">
<button :disabled="getSms" size="mini" @click="getPhoneCode()">{{sendCode}}</button>
<button :disabled="getSms" size="mini" @click="getCaptcha">{{sendCode}}</button>
</view>
<view class="auth-input" v-if="isShowParent">
<input v-model="parentId" placeholder="输入邀请码,选填">
<input v-model="parentId" placeholder="输入邀请码">
</view>
<view class="auth-button">
<button @click="login('code')">登录</button>
@@ -24,9 +24,18 @@
hover-class="none" url="/pages/vip/agreement?id=4">隐私政策</navigator>
</view>
<view class="auth-other" v-if="isKeyAuth">
<button @click="login('Akey')">使用本机号码一键登录</button>
</view>
</view>
<u-popup :show="showCaptchaCode" :round='10' mode='center' @close='close' @open="open">
<view class="showImgCode">
<view class="title"> 图片验证码 </view>
<image class="cover" @click="getCaptcha()" :src="captchaImg" mode="widthFix" />
<input class="input" v-model="captchaCode" maxlength="6" placeholder="验证码" />
<view class="btn" @click="sureImgCode"> 确认验证码 </view>
</view>
</u-popup>
</view>
</template>
@@ -34,7 +43,8 @@
import {
smsAuth,
getInvitationSms,
keyAuth
keyAuth,
captcha,
} from '@/apis/interfaces/auth.js'
export default {
data() {
@@ -46,7 +56,11 @@
sendCode: '获取验证码',
isShowParent: false,
isKeyAuth: false,
shareId: ''
shareId: '',
captchaImg: '',
captchaKey: '',
captchaCode: '',
showCaptchaCode: false, // 是否显示图片验证弹窗
};
},
onShow() {
@@ -57,7 +71,6 @@
this.parentId = args.split('invitation')[1]
}
}, 100);
uni.showLoading({
title: '加载中...',
mask: true
@@ -74,8 +87,65 @@
})
},
methods: {
open() {
},
close() {
this.showCaptchaCode = false
},
// 弹窗确认验证码
sureImgCode() {
if (this.captchaCode != '' && this.captchaCode.length == 4) {
this.showCaptchaCode = false;
this.getPhoneCode();
return;
}
uni.showToast({
title: '请核对图片验证码',
icon: 'none',
mask: true,
duration: 2000
})
},
// 获取图片验证码
getCaptcha() {
if (this.phone.length != 11) {
uni.showToast({
title: '请核对手机号码',
icon: 'none',
mask: true,
duration: 2000,
})
return;
}
this.showCaptchaCode = true;
captcha().then(res => {
this.captchaKey = res.key;
this.captchaImg = res.img;
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon: 'none',
mask: true,
duration: 2000,
})
})
},
// 获取验证码
getPhoneCode() {
if (this.phone.length != 11) {
uni.showToast({
title: '请核对手机号码',
icon: 'none',
mask: true,
duration: 2000,
})
return;
}
uni.showLoading({
title: '加载中...',
mask: true
@@ -84,6 +154,8 @@
let smsTime = 60;
getInvitationSms({
mobileNo: this.phone,
captcha_key: this.captchaKey,
captcha: this.captchaCode,
}).then(res => {
uni.showToast({
title: res.message,
@@ -92,6 +164,8 @@
this.isShowParent = res.is_show_parent
this.getSms = true;
this.sendCode = smsTime + 's后重新获取';
this.captchaKey = ''
this.captchaCode = ''
outTime = setInterval(() => {
if (smsTime <= 1) {
this.getSms = false;
@@ -103,6 +177,9 @@
smsTime -= 1;
}, 1000);
}).catch((err) => {
console.log(err)
this.captchaCode = ''
this.captchaKey = ''
uni.showToast({
title: err.message,
icon: "none",
@@ -115,20 +192,23 @@
uni.showLoading({
title: '登录中'
})
smsAuth({
let data = {
mobileNo: this.phone,
code: this.code,
parent_id: this.parentId
}).then((res) => {
}
console.log(data);
smsAuth(data).then((res) => {
this.setAuthToken(res.token_type + ' ' + res.access_token, res.is_new)
uni.hideLoading()
}).catch((err) => {
console.log(err)
uni.showToast({
title: err.message,
icon: "none",
});
});
return
return;
}
if (type === 'Akey') {
this.onKeyLogin()
@@ -199,8 +279,8 @@
uni.setStorageSync('isnew', 1)
if (this.shareId != '' && this.shareId != undefined) {
setTimeout(() => {
uni.hideLoading()
plus.runtime.arguments = null;
uni.hideLoading()
plus.runtime.arguments = null;
plus.runtime.arguments = '';
uni.reLaunch({
url: '/pages/group-book/success/success?access=1&id=' + this.shareId
@@ -245,6 +325,28 @@
color: white;
}
.auth-img-code {
display: flex;
flex-direction: row;
align-items: center;
border-radius: 50rpx;
margin-top: 40rpx;
background: white;
height: 100rpx;
input {
height: 100rpx;
font-size: 32rpx;
padding: 0 50rpx;
flex: 1;
}
image {
width: 180rpx;
margin-right: 50rpx;
}
}
.auth-input {
background: white;
height: 100rpx;
@@ -330,5 +432,43 @@
}
}
}
.showImgCode {
width: 600rpx;
padding: 50rpx 30rpx;
display: flex;
flex-direction: column;
.title {
text-align: center;
font-size: 40rpx;
font-weight: bold;
}
.cover {
width: 100%;
padding: 50rpx 0;
height: 150rpx;
}
.input {
border-radius: 6rpx;
border: solid 1rpx #cacaca;
padding: 30rpx 0;
text-align: center;
font-size: 34rpx;
}
.btn {
background-color: #34ce98;
color: #fff;
font-weight: bold;
border-radius: 10rpx;
margin-top: 30rpx;
text-align: center;
padding: 30rpx 0;
font-size: 36rpx;
}
}
}
</style>

Binary file not shown.

Binary file not shown.

View File

@@ -4,34 +4,35 @@
<view class="top">
<image class="bg" src="/static/mission/diwen.png" mode="widthFix" />
<view class="userinfo">
<view class="nickname">张三丰</view>
</view>
<view class="avatar">
<image src="/static/background/supplier_back.png" mode="aspectFill" />
<view class="nickname" >{{user.nickname}}</view>
</view>
<view class="avatar" > <image :src="user.avatar" mode="aspectFill" /> </view>
<view class="count">
<view class="count-item" @click="onTab('GetDt')">
<view class="number">123 </view>
<view class="number">{{user.DtScore}} </view>
<view class="des"> 已领DT积分 </view>
</view>
<view class="line"></view>
<view class="count-item" @click="onTab('GetGoods')">
<view class="number">123 </view>
<view class="number">{{user.goodsNum}} </view>
<view class="des"> 已领商品 </view>
</view>
</view>
</view>
<!-- 看视频 得积分 -->
<!-- 看视频 得积分 -->
<!--
giftCode:item.me.code, // 任务是否完成 1 已完成 2 未完成
is_gift :item.me.is_gift, // 1已领取 0 未领取
gift_type:item.gift_type.code, //1商品 2 dt 积分
-->
<view class="list-content" v-if="videos.length>0">
<view class="title">
<image class="bind" src="/static/mission/icon-right.png" mode="widthFix" />
<view class="name">看视频得奖励</view>
<image class="bind" src="/static/mission/icon-left.png" mode="widthFix" />
<view class="right-title" @click="change('1')">
<image :class="['change',canRotate0?'rotateChange':'']" src="/static/mission/change.png"
mode="widthFix" />
换一换
<view class="right-title" @click="change('1')" >
<block v-if="videoHasMore"> <image :class="['change',canRotate0?'rotateChange':'']" src="/static/mission/change.png" mode="widthFix" /> 换一换 </block>
</view>
</view>
<block>
@@ -39,30 +40,42 @@
<image class='icon' src="/static/mission/video.png" mode="widthFix" />
<view class="list-item">
<view class="list-item-left">
<view class="item-title">{{item.title}}<span
v-if="item.gift_type && item.gift_type.code == 2">+{{item.attach_gift.price}}</span>
</view>
<view class="item-title">{{item.title}}<span v-if="item.gift_type && item.gift_type.code == 2">+{{item.attach_gift.price}}</span> </view>
<view class="item-des"> {{item.description}}</view>
</view>
<view class="list-item-right">
<view class="btn" @click="goPlay(item.task_id)">观看</view>
<view class="count" v-if="item.type && item.type.code == 1 ">
({{item.me.number}}/{{item.attach_type.num}}</view>
<view class="btn" v-if="item.me.code == 0 || item.me.code == 2" @click="goPlay(item.task_id)">完成</view>
<block v-if="item.me && item.me.code == 1">
<block v-if="item.gift_type && item.gift_type.code == 1">
<view class="btn" v-if="item.me && item.me.is_gift == 0" @click="goAdr(item.task_id)">完善收货</view>
<view class="btn" v-if="item.me && item.me.is_gift == 1" >已完成</view>
</block>
<block v-if="item.gift_type && item.gift_type.code == 2">
<view class="btn">已完成</view>
</block>
</block>
<view class="count" v-if="item.type && item.type.code == 1 "> ({{item.me.number}}/{{item.attach_type.num}}</view>
</view>
</view>
</view>
</block>
</view>
<!-- 做任务 得积分 -->
<!-- 做任务 得积分 -->
<!--
giftCode:item.me.code, // 任务是否完成 1 已完成 2完成一半 0未开始
is_gift :item.me.is_gift, // 1已领取 0 未领取
gift_type:item.gift_type.code, //1商品 2 dt 积分
-->
<view class="list-content">
<view class="title" style="margin-top:30rpx;">
<image class="bind" src="/static/mission/icon-right.png" mode="widthFix" />
<view class="name">做任务得积分</view>
<image class="bind" src="/static/mission/icon-left.png" mode="widthFix" />
<view class="right-title" @click="change('2')">
<image :class="['change',canRotate1?'rotateChange':'']" src="/static/mission/change.png"
mode="widthFix" /> 换一换
<view class="right-title" @click="change('2')" >
<block v-if="missionsHasMore">
<image :class="['change',canRotate1?'rotateChange':'']" src="/static/mission/change.png" mode="widthFix" /> 换一换
</block>
</view>
</view>
<block v-if="missions.length>0">
@@ -70,12 +83,12 @@
<image class='icon' src="/static/mission/mission.png" mode="widthFix" />
<view class="list-item">
<view class="list-item-left">
<view class="item-title">看视频<span>+100</span></view>
<view class="item-des"> 观看2分钟视频可得15DT积分一天封顶150DT积分</view>
<view class="item-title">{{item.title}}<span v-if="item.gift_type && item.gift_type.code == 2">+{{item.attach_gift.price}}</span> </view>
<view class="item-des"> {{item.description}}</view>
</view>
<view class="list-item-right">
<view class="btn">去观看</view>
<view class="count">(0/10</view>
<view class="btn" @click="goWebView(item.task_id)">去完成</view>
<!-- <view class="count">({{item.me.number}}/{{item.attach_type.num}}</view> -->
</view>
</view>
</view>
@@ -85,40 +98,73 @@
</template>
<script>
import {
list
} from '@/apis/interfaces/mission.js'
import {list,user} from '@/apis/interfaces/mission.js'
import eventBus from '@/utils/eventBus.js'
export default {
data() {
return {
videos: [1, 2, 3],
videos: [],
videoPage: 1,
videoHasMore: true,
missions: [1, 2, 3],
missions: [],
missionsPage: 1,
missionsHasMore: true,
canRotate0: false,
canRotate1: false,
canRotate1: false,
user:{},
};
},
onLoad() {
this.getVideoList(1)
onLoad() {
this.getUser();
this.getList(1);
// this.getList(2);
eventBus.$on('played', (data)=> {
let index = this.videos.findIndex((item) => item.task_id == data.task_id);
this.videos[index].me.number = data.number
this.videos[index].me.is_gift = data.is_gift
this.videos[index].me.code = data.code
});
},
destroyed() {
eventBus.$off('played')
},
methods: {
getUser(){
user().then(res=>{
res.base.DtScore = res.DtScore
res.base.goodsNum = res.goodsNum
this.user = res.base
}).catch(err=>{
uni.showToast({
title: err.message,
icon: 'none',
mask: true,
duration: 2000,
})
})
},
goPlay(id) {
uni.navigateTo({
url: '/pages/mission/videoPlay/videoPlay?id=' + id,
})
},
goAdr(id){
uni.navigateTo({
url:'/pages/address/index?task_id='+id
})
},
goWebView(id){
uni.navigateTo({
url: '/pages/mission/webview/webview?id=' + id,
})
},
getVideoList(type) {
getList(type) {
let data = {
page: type == 1 ? this.videoPage : this.missionsPage,
type: type,
}
list(data).then(res => {
console.log(res)
list(data).then(res => {
if (type == 1) {
if (this.videoPage == 1) {
this.videos = [];
@@ -129,8 +175,8 @@
}
if (type == 2) {
if (this.videoPage == 1) {
this.videos = [];
if (this.missionsPage == 1) {
this.missions = [];
}
this.missionsHasMore = res.page.has_more;
this.missions = res.data
@@ -154,7 +200,7 @@
} else {
this.videoPage = 1;
}
this.getVideoList(1);
this.getList(1);
break;
case '2':
// if(this.videoHasMore){
@@ -225,15 +271,15 @@
box-sizing: border-box;
position: relative;
top: 10rpx;
z-index: 2;
z-index: 2;
image {
width: 160rpx;
image {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
box-shadow: 0 2rpx 20rpx 2rpx rgba(255, 0, 0, 0.3);
border: solid 10rpx rgba(255, 255, 255, 0.8);
background-color: rgba(255, 0, 0, 0.1);
background-color: #fff;
}
}
@@ -285,7 +331,7 @@
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
justify-content: center;
box-sizing: border-box;
position: relative;
padding: 0 $padding;
@@ -299,9 +345,9 @@
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
justify-content: flex-end;
box-sizing: border-box;
font-size: 26rpx;
font-size: 26rpx;
color: #626675;
.change {

View File

@@ -4,24 +4,31 @@
<view class="currentDown">
<view class="currentDownItem">
<view>视频</view>
<view class="line"> </view>
<view>{{duration>0?duration+'秒后':''}}可获得奖励</view>
<block>
<view class="line"> </view>
<view> {{duration>0?duration+' 秒后可':'已'}}获得奖励</view>
</block>
</view>
<view class="currentDownItem">
<u-icon :name="muted?'volume-off':'volume'" color='#fff' @click='muted =! muted' />
<view class="line"> </view>
<view> 关闭</view>
<block v-if="duration>0">
<u-icon :name="muted?'volume-off':'volume'" color='#fff' @click='muted =! muted' />
<view class="line"> </view>
</block>
<view @click="close"> 关闭</view>
</view>
</view>
</view>
<video v-if="src!=''" @timeupdate='timeupdate' class="video" :src="src" :controls='false' autoplay direction='0' :muted='muted' />
<video v-if="src!=''" @timeupdate='timeupdate' class="video" :src="src" :controls='false' autoplay direction='0'
:muted='muted' />
</view>
</template>
<script>
import {
getVideoUrl
getVideoUrl,
execute,
} from '@/apis/interfaces/mission.js'
import eventBus from '@/utils/eventBus.js'
export default {
data() {
return {
@@ -29,9 +36,12 @@
src: '',
muted: false, // 静音播放
duration: 0,
id: '',
canClose: false,
};
},
onLoad(e) {
this.id = e.id;
getVideoUrl(e.id).then(res => {
this.src = res
}).catch(res => {
@@ -46,8 +56,51 @@
})
},
methods: {
close() {
if (!this.canClose) {
uni.navigateBack()
return;
}
if (this.duration > 0) {
uni.showModal({
title: '暂未获得奖励',
content: ' 是否继续观看视频',
cancelText: '放弃',
confirmText: '继续',
confirmColor: '#34ce98',
cancelColor: '#999',
success: (res) => {
if (res.confirm) {
return;
}
if (res.cancel) {
uni.navigateBack();
return;
}
}
})
} else {
this.executeBtn()
}
},
executeBtn() {
execute(this.id).then(res => {
res.task_id= this.id
eventBus.$emit('played', res);
uni.navigateBack();
}).catch(err => {
console.log(err)
uni.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: true,
})
})
},
timeupdate(e) {
this.duration = parseInt(e.detail.duration - e.detail.currentTime)
this.duration = parseInt(parseInt(e.detail.duration) - parseInt(e.detail.currentTime));
this.canClose = true;
}
},
}

View File

@@ -0,0 +1,39 @@
<template>
<view>
<web-view :src="src" />
</view>
</template>
<script>
import {
getVideoUrl
} from '@/apis/interfaces/mission.js'
import eventBus from '@/utils/eventBus.js'
export default {
data() {
return {
id: '',
src:''
};
},
onLoad(e) {
this.id = e.id;
getVideoUrl(e.id).then(res => {
this.src = res
}).catch(res => {
uni.showModal({
title: '视频播放出错',
confirmText: '立即返回',
showCancel: false,
success: (res) => {
uni.navigateBack()
}
})
})
},
}
</script>
<style lang="scss">
</style>

View File

@@ -28,8 +28,8 @@
<view class="price">
{{goods.price.show}}<text>DT积分</text>
<span class='del' v-if="shop_vip.status">{{goods.original_price}} DT积分</span>
</view>
<!-- vip 商品及普通商品展示库存量 -->
</view>
<!-- vip 商品及普通商品展示库存量 -->
<view class="sales" v-if="goods.skus && !goods.is_active">库存量{{goods.skus[0].stock}}</view>
<!-- 拼团商品展示已拼数量及参团数 -->
<view class="_pin" v-if="goods.is_active">
@@ -76,7 +76,8 @@
<view class="nickname"> {{item.names}}</view>
</view>
<view class="btn" v-if="goods.active.can_join || item.can_share" @click="toPin(item)">
{{ item.can_share?'去分享':'去拼单'}}</view>
{{ item.can_share?'去分享':'去拼单'}}
</view>
<view class="noneBtn" v-else @click="showPinToast">去拼单</view>
</view>
</block>
@@ -137,7 +138,8 @@
<view class="nickname"> {{item.names}}</view>
</view>
<view class="btn" v-if="goods.active.can_join || item.can_share" @click="toPin(item)">
{{ item.can_share?'去分享':'去拼单'}}</view>
{{ item.can_share?'去分享':'去拼单'}}
</view>
<view class="noneBtn" v-else @click="showPinToast">去拼单</view>
</view>
</block>
@@ -150,9 +152,13 @@
<view scroll-y="true" class="content-2">
<view class="title"> 参与{{collageitem.names}}的拼单 </view>
<view class="number">仅剩<span>{{collageitem.surplus}}</span>个名额</view>
<view class="avatars" v-for="(item,index) in collageitem.details" :key='index'>
<image :class="['avatar',item.master?'pin':'']" :src="item.cover" mode="aspectFill" />
<image class="wen" src="/static/book/wen.png" mode="aspectFill" />
<view class="avatars">
<block v-for="(item,index) in collageitem.details" :key='item.id'>
<image :class="['avatar',item.master?'pin':'']" :src="item.cover" mode="aspectFill" />
</block>
<block v-for="(item,index) in collageitem.surplus" :key='index'>
<image class="wen" src="/static/book/wen.png" mode="aspectFill" />
</block>
</view>
<view class="applyPin" @click="applyPin"> 参与拼单 </view>
</view>
@@ -321,8 +327,8 @@
icon: 'none'
})
},
success: (res) => {
this.collageitem = {}
success: (res) => {
this.collageitem = {}
}
})
break;
@@ -347,8 +353,8 @@
})
break;
}
},
},
// 弹出 拼团不可点
showPinToast() {
uni.showToast({
@@ -387,11 +393,12 @@
}
}
this.specselect = newlist
},
toVip(){
uni.navigateTo({
url: '/pages/store/vip/index/index?id=' + this.goods.shop.shop_id + '&identityId=' + this.goods.shop_vip.card.identity_id,
})
},
toVip() {
uni.navigateTo({
url: '/pages/store/vip/index/index?id=' + this.goods.shop.shop_id + '&identityId=' + this
.goods.shop_vip.card.identity_id,
})
},
// 会员商品领取
vipBuy() {

View File

@@ -28,7 +28,7 @@
</u-scroll-list>
<!-- 拼团广告图 -->
<!-- <view class="collage" v-if="collage_banner!=''">
<!-- <view class="collage" v-if="collage_banner!=''">
<image @click="goCollage" :src="collage_banner" mode="widthFix" />
</view> -->