first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:27:25 +08:00
commit 85b89ccea7
1694 changed files with 168292 additions and 0 deletions

55
pages/me/auth.vue Normal file
View File

@@ -0,0 +1,55 @@
<template>
<view style="padding: 30rpx;">
<u-button type="primary" @click="oauth">微信授权</u-button>
</view>
</template>
<script>
import {
API_URL,
STATIC_URL
} from '@/env'
let self;
export default {
data() {
return {
form: {
mobile: '',
code: ''
},
}
},
onLoad(option) {
self = this;
if (option && option.code) {
self.form.code = option.code;
self.codelogin();
} else {
const pages = getCurrentPages() // 获取栈实例
let route = 'pages/index/index';
if (pages.length > 1) {
route = pages[pages.length - 2].route; // 获取当前页面的数据,包含页面路由
}
uni.setStorageSync('login_back_path', route);
}
},
methods: {
codelogin() {
self.$http.post('/app/v10/auth/wxoauthlogin', self.form).then(res => {
if (res.success) {
location.href = '/' + uni.getStorageSync('login_back_path');
}
})
},
oauth() {
location.href = API_URL + '/app/v10/auth/wxoauth';
}
}
}
</script>
<style lang="scss">
</style>

243
pages/me/getBackAccount.vue Normal file
View File

@@ -0,0 +1,243 @@
<template>
<view class="t-login">
<u-navbar :autoBack="true"></u-navbar>
<!-- 页面装饰图片 -->
<image class="img-a" src="@/static/2.png"></image>
<image class="img-b" src="@/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">{{ title }}</view>
<form class="cl">
<view class="t-a">
<image src="@/static/sj.png"></image>
<input type="number" placeholder="请输入手机号" maxlength="11" v-model="form.mobile" />
</view>
<view class="t-a">
<image src="@/static/yz.png"></image>
<input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="form.code" />
<view v-if="showText" class="t-c" @click="getCode()">发送短信</view>
<view v-else class="t-c" style="background-color: #a7a7a7">重新发送({{ second }})</view>
</view>
</form>
<button class="b_register" @tap="userlogin()"> </button>
</view>
</template>
<script>
export default {
data() {
return {
check: [],
title: '找回用户名 ', //填写logo或者app名称也可以用欢迎回来看您需求
second: 60, //默认60秒
showText: true, //判断短信是否发送
form: {
mobile: '',
code: ''
}
};
},
onLoad() {},
methods: {
login() {
uni.navigateBack();
},
userlogin() {
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
if (!this.form.code) return uni.showToast({ title: '请输入验证码', icon: 'none' });
this.$http.post('/shop/v10/auth/username', this.form).then((res) => {
if (res.code == 0) {
if (res.data.length == 0) {
uni.showModal({
title: '提示',
content: '该手机号还未注册',
showCancel: false,
confirmText: '我知道了'
});
} else {
uni.showModal({
title: '已找回用户名',
content: res.data.join(','),
showCancel: false,
confirmText: '确认',
success: () => {
uni.setClipboardData({
data: res.data.join(','), //要被复制的内容
success: () => {
//复制成功的回调函数
uni.showToast({
//提示
title: '已复制用户名'
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
}
});
}
});
}
}
});
},
//获取短信验证码
getCode() {
var that = this;
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
var interval = setInterval(() => {
that.showText = false;
var times = that.second - 1;
//that.second = times<10?'0'+times:times ;//小于10秒补 0
that.second = times;
}, 1000);
setTimeout(() => {
clearInterval(interval);
that.second = 60;
that.showText = true;
}, 60000);
//这里请求后台获取短信验证码
uni.showLoading({
title: '正在获取验证码'
});
this.$http.get('/com/sms/sendcode', this.form).then((res) => {
if (res.success) {
uni.hideLoading();
uni.$u.toast('验证码已发送有效期5分钟');
that.showText = false;
}
});
}
}
};
</script>
<style>
page {
background-color: #fff;
}
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
z-index: -1;
}
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
z-index: -1;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
.t-login .b_login {
font-size: 28rpx;
background: rgba(86, 119, 252, 0.6);
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
margin-top: 30rpx;
}
.t-login .b_register {
font-size: 28rpx;
background: #5677fc;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 250rpx 0 120rpx 0;
font-weight: bold;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
z-index: 999;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>

400
pages/me/index.vue Normal file
View File

@@ -0,0 +1,400 @@
<template>
<view>
<view class="top-backgroup">
<image src="https://resource.tuniaokj.com/images/my/my-bg4.png" mode="widthFix" class="backgroud-image"></image>
</view>
<view class="p-30" style="margin-top: -450rpx; padding-bottom: 150rpx" :style="{ paddingTop: statusBarHeight }">
<view class="flex-ac header" @click="$utils.tn('/pages/me/setting', true)">
<image class="header_img" v-if="user.avatar_url" :src="user.avatar_url"></image>
<image class="header_img" v-else src="/static/mr.png"></image>
<view class="header_tit" v-if="user.nickname || user.username">
<view class="header_tit_nick">{{ user.nickname }}</view>
<view class="header_tit_acee">{{ user.username }}</view>
</view>
<view class="header_tit" v-else>
<view class="header_tit_nick" style="margin-bottom: 0rpx">点击登录</view>
</view>
<image class="header_you" src="/static/sett.png" mode="widthFix"></image>
</view>
<view class="member tn-shadow-blur">
<view class="member_left">
<view class="member_left_1">{{ device.cur_level.name }}</view>
<view class="member_left_2">
<u-line-progress
v-if="user.vip < 3 || user === null"
:percentage="(device.all_device_num / device.up_level.num) * 100"
:showText="false"
height="7"
:activeColor="'#f1c68e'"
:inactiveColor="'#fff'"
></u-line-progress>
<u-line-progress v-else :percentage="100" :showText="false" height="7" :activeColor="'#f1c68e'" :inactiveColor="'#fff'"></u-line-progress>
</view>
<view v-if="user.vip < 3 || user === null" class="member_left_3">
再购买{{ device.up_level.num - device.all_device_num }}台充电桩可升级{{ device.up_level.name || '' }}
</view>
<view v-else class="member_left_3">已到最高级</view>
</view>
<!-- <button @click="$utils.tn('/pages/goods/detail?id=1')" class="member_right tn-shadow-blur">去下单</button> -->
</view>
<!-- <view class="p-t20 miney_g bgf br10 mt30 wallpaper-shadow">
<u-grid :border="false" align="center">
<u-grid-item bgColor="#fff" @click="$utils.tn('/pages/resourceBundle/resourceBundle', true)">
<view>{{ user.money || 0.0 }}</view>
<view class="fs28">余额</view>
</u-grid-item>
<u-grid-item bgColor="#fff" @click="$utils.tn('/pages/device/index', true)">
<view>{{ user.device_num || 0 }}</view>
<view class="fs28">充电桩</view>
</u-grid-item>
<u-grid-item bgColor="#fff" @click="$utils.tn('/pages/option/index', true)">
<view>{{ user.option || 0.0 }}</view>
<view class="fs28">期望值</view>
</u-grid-item>
</u-grid>
</view> -->
<view style="display: flex; align-items: center; justify-content: space-between">
<view class="wallpaper-shadow b_yubiao" style="width: 330rpx" @click="$utils.tn('/pages/resourceBundle/resourceBundle', true)">
<image style="width: 70rpx; height: 70rpx" src="/static/b_ye.png"></image>
<view class="b_yubiao_right">
<view style="margin-bottom: 15rpx; font-weight: bold">余额</view>
<view>{{ user.money || 0.0 }}</view>
</view>
</view>
<view class="wallpaper-shadow b_yubiao" style="width: 330rpx" @click="$utils.tn('/pages/device/index', true)">
<image src="/static/b_cd.png"></image>
<view class="b_yubiao_right">
<view style="margin-bottom: 15rpx; font-weight: bold">充电桩</view>
<view>{{ user.device_num || 0 }}</view>
</view>
</view>
</view>
<view class="wallpaper-shadow tn-margin-top-lg tn-padding-top-sm tn-padding-bottom-sm tn-bg-white">
<view class="tn-flex tn-flex-row-center tn-radius tn-padding-top">
<view class="tn-padding-sm tn-margin-xs tn-radius" @click="$utils.tn('/pages/order/index', true)">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/order.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">订单</text>
</view>
</view>
</view>
<view class="tn-padding-sm tn-margin-xs tn-radius" @click="$utils.tn('/pages/resourceBundle/resourceBundle', true)">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/ye.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">余额</text>
</view>
</view>
</view>
<view class="tn-padding-sm tn-margin-xs tn-radius" @click="$utils.tn('/pages/device/index', true)">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/cdz.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">充电桩</text>
</view>
</view>
</view>
<view class="tn-padding-sm tn-margin-xs tn-radius" @click="$utils.tn('/pages/wallet/list', true)">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/zd.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">账单</text>
</view>
</view>
</view>
</view>
<view class="tn-flex tn-flex-row-center tn-radius tn-padding-top">
<view class="tn-padding-sm tn-margin-xs tn-radius" @click="$utils.tn('/pages/team/index', true)">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/yqjl.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">邀请记录</text>
</view>
</view>
</view>
<view class="tn-padding-sm tn-margin-xs tn-radius" @click="$utils.tn('/pages/share/index', true)">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/fxhb.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">分享海报</text>
</view>
</view>
</view>
<!-- @click="$utils.call('4008005326')" -->
<view class="tn-padding-sm tn-margin-xs tn-radius">
<button open-type="contact" style="all: unset">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<view class="t12_icon">
<image src="/static/lxkf.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">联系客服</text>
</view>
</view>
</button>
</view>
<!-- @click="$utils.logOut()" -->
<view class="tn-padding-sm tn-margin-xs tn-radius">
<view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
<!-- <view class="t12_icon">
<image src="/static/tcdl.png"></image>
</view>
<view class="tn-text-center">
<text class="tn-text-ellipsis">退出登录</text>
</view> -->
</view>
</view>
</view>
</view>
<!-- <view class="means-a mt30" @click="$utils.tn('/pages/admin/shop/index', true)">
<view class="means-a-list">
<view class="tit">投资人</view>
<view class="means-zhuomi">
<view class="means-zhuomi-tit" v-if="userInfo.mobile">{{ userInfo.mobile }}</view>
<image src="/static/icon/youdao.png"></image>
</view>
</view>
<view class="means-a-list" style="border: 0;" @click="$utils.tn('/pages/admin/order/index', true)">
<view class="tit">订单</view>
<view class="means-zhuomi">
<view class="means-zhuomi-tit" v-if="userInfo.mobile">{{ userInfo.mobile }}</view>
<image src="/static/icon/youdao.png"></image>
</view>
</view>
</view> -->
<view v-if="user.vip > 0" style="background-color: #f6faff; padding: 30rpx; border-radius: 10rpx; margin-top: 30rpx">
<view style="font-size: 30rpx; color: #999999; text-align: center;margin-bottom: 20rpx;">
邀请码{{ user.invite_code }}
<text style="text-decoration:underline;margin-left: 30rpx;" @click="$utils.copy(user.invite_code)">复制</text>
</view>
<view class="u-flex u-flex-xy-center">
<u--image :src="user.appcode" radius="20rpx" width="440rpx" height="440rpx"></u--image>
</view>
<view style="height: 10rpx"></view>
<view style="font-size: 30rpx; color: #999999; text-align: center">长按保存或者转发</view>
</view>
</view>
</view>
</template>
<script>
import { getUser, setUser } from '@/com/storage/auth.js';
export default {
data() {
return {
statusBarHeight: 20,
user: null,
device: {
all_device_num: 0,
team_device_num: 0,
cur_level: {
name: '普通用户',
level: 0
},
up_level: {
name: '',
level: 0,
num: 0
}
},
pshop: null
};
},
watch: {
'$store.state.auth.user'(newVal, oldVal) {
console.log(newVal);
console.log('watch');
if (!newVal.id) return (this.user = null);
this.user = newVal;
}
},
onLoad() {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 44 + 'px';
console.log(this.statusBarHeight);
},
async onShow() {
this.user = uni.getStorageSync('user') || null;
if (!this.user.id) return (this.user = null);
if (await this.$utils.token()) return true;
this.getuser();
},
methods: {
getuser() {
this.$http.get('/shop/v10/user/info').then(({ data, success }) => {
if (success) {
this.device = data.device;
this.pshop = data.pshop;
this.$store.commit('auth/setUser', data.info);
}
});
}
}
};
</script>
<style lang="scss">
.header {
&_img {
width: 140rpx;
height: 140rpx;
margin-right: 30rpx;
border-radius: 50%;
}
&_tit {
flex: 1;
&_nick {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
&_acee {
font-size: 28rpx;
}
}
&_you {
width: 40rpx;
height: 40rpx;
}
}
.member {
margin-top: 50rpx;
border-radius: 15rpx;
padding: 20rpx 40rpx;
position: relative;
background: linear-gradient(-120deg, #3e445a, #31374a, #2b3042, #262b3c);
display: flex;
align-items: center;
&_left {
flex: 1;
margin-right: 20rpx;
&_1 {
color: #fff;
font-weight: bold;
font-size: 32rpx;
}
&_2 {
margin: 20rpx 0;
}
&_3 {
color: #fff;
font-size: 24rpx;
}
}
&_right {
all: unset;
background-color: #f1c68e;
color: #634738;
width: 160rpx;
border-radius: 30rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx 0;
overflow: visible;
}
}
.tn-flex {
display: flex;
}
.tn-padding-sm {
width: 25%;
}
.tn-padding-sm {
margin: 10rpx;
}
.t12_icon {
image {
width: 60rpx;
height: 60rpx;
}
}
.tn-flex-direction-column {
flex-direction: column;
align-items: center;
}
.tn-text-ellipsis {
font-size: 26rpx;
}
.means-a {
width: 100%;
background: #ffffff;
border-radius: 15rpx;
padding: 0 25rpx;
.means-a-list {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
min-height: 100rpx;
background-color: #ffffff;
padding: 0;
border: 0;
border-bottom: 1rpx solid #f6f6f6;
.tit {
font-size: 30rpx;
color: #333;
}
.header {
width: 140rpx;
height: 140rpx;
margin-bottom: 20rpx;
border-radius: 50%;
}
.nickname {
font-size: 30rpx;
color: #222222;
}
.means-zhuomi {
display: flex;
align-items: center;
image {
width: 11rpx;
height: 21rpx;
}
}
}
}
.b_yubiao {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 20rpx;
image {
width: 48rpx;
height: 48rpx;
}
&_right {
display: flex;
flex-direction: column;
align-items: flex-end;
}
}
</style>

192
pages/me/login.vue Normal file
View File

@@ -0,0 +1,192 @@
<template>
<view class="t-login">
<u-navbar :autoBack="true"></u-navbar>
<!-- 页面装饰图片 -->
<image class="img-a" src="/static/2.png"></image>
<image class="img-b" src="/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">{{ title }}</view>
<form class="cl">
<view class="t-a">
<image src="/static/icon/acee.png"></image>
<input placeholder="请输入用户名" maxlength="32" v-model="form.username" />
</view>
<view class="t-a">
<image src="/static/icon/pass.png"></image>
<input style="margin-bottom: 20rpx;" type="password" maxlength="32" placeholder="请输入密码" v-model="form.password" />
</view>
<view class="u-flex u-flex-reverse" style="margin-bottom: 20rpx;">
<view @click="$utils.tn('/pages/me/getBackAccount')">
<u--text color="#5677fc" text="找回用户名"></u--text>
</view>
<view @click="$utils.tn('/pages/me/password')" style="margin-right: 25rpx">
<u--text color="#5677fc" text="忘记密码"></u--text>
</view>
</view>
<button class="b_login" @click="login()"> </button>
<button class="b_register" @tap="register()"> </button>
</form>
</view>
</template>
<script>
export default {
data() {
return {
title: '欢迎回来!', //填写logo或者app名称也可以用欢迎回来看您需求
form: {
username: '',
password: ''
}
};
},
onLoad() {},
methods: {
async login() {
if (!this.form.username) return uni.showToast({ title: '请输入用户名', icon: 'none' });
if (!this.form.password) return uni.showToast({ title: '请输入密码', icon: 'none' });
// 注册
try {
let { data } = await this.$http.post('/shop/v10/auth/login', this.form);
this.$store.commit('auth/setUser', data.user);
this.$store.commit('auth/setToken', data.token);
uni.navigateBack();
} catch (e) {
console.log(e);
}
},
register() {
uni.navigateTo({ url: '/pages/me/logon' });
}
}
};
</script>
<style>
page {
background-color: #fff;
}
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
}
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
.t-login .b_login {
font-size: 28rpx;
background: #5677fc;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
.t-login .b_register {
font-size: 28rpx;
background: rgba(86, 119, 252, 0.6);
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
margin-top: 30rpx;
}
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 300rpx 0 120rpx 0;
font-weight: bold;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>

256
pages/me/logon.vue Normal file
View File

@@ -0,0 +1,256 @@
<template>
<view class="t-login">
<u-navbar :autoBack="true"></u-navbar>
<!-- 页面装饰图片 -->
<image class="img-a" src="@/static/2.png"></image>
<image class="img-b" src="@/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">{{ title }}</view>
<form class="cl">
<view class="t-a">
<image src="/static/icon/acee.png"></image>
<input type="text" placeholder="请输入用户名" maxlength="32" v-model="form.username" />
</view>
<view class="t-a">
<image src="/static/icon/pass.png"></image>
<input type="password" placeholder="请输入密码" maxlength="32" v-model="form.password" />
</view>
<view class="t-a">
<image src="/static/icon/yqs.png"></image>
<input type="text" placeholder="请输入邀请码" v-model="form.invite_code" />
</view>
<view class="t-a">
<image src="@/static/sj.png"></image>
<input type="number" placeholder="请输入手机号" maxlength="11" v-model="form.mobile" />
</view>
<view class="t-a">
<image src="@/static/yz.png"></image>
<input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="form.code" />
<view v-if="showText" class="t-c" @click="getCode()">发送短信</view>
<view v-else class="t-c" style="background-color: #a7a7a7">重新发送({{ second }})</view>
</view>
</form>
<view class="u-flex u-flex-xy-center" style="font-size: 26rpx; font-weight: 800; width: 650rpx; margin-left: -25rpx; margin-bottom: 20rpx">
<u-checkbox-group v-model="check" shape="square">
<u-checkbox labelSize="28rpx" label="我已阅读并同意" :name="1"></u-checkbox>
</u-checkbox-group>
<navigator url="/pages/policy/user" style="color: dodgerblue" open-type="navigate">用户注册服务协议</navigator>
<navigator url="/pages/policy/privacy" style="color: dodgerblue" open-type="navigate">隐私政策</navigator>
</view>
<button class="b_register" @tap="register()"> </button>
<button class="b_login" @tap="login()"> </button>
</view>
</template>
<script>
export default {
data() {
return {
check: [],
title: '欢迎回来!', //填写logo或者app名称也可以用欢迎回来看您需求
second: 60, //默认60秒
showText: true, //判断短信是否发送
form: {
username: '',
password: '',
mobile: '',
code: '',
invite_code: ''
}
};
},
onLoad(option) {
var self = this;
if (option && option.invite_code) {
self.form.invite_code = option.invite_code;
}
const invite_code = uni.getStorageSync('invite_code');
console.log(invite_code);
if (invite_code && invite_code != 'undefined') {
self.form.invite_code = invite_code;
} else {
self.form.invite_code = '';
}
},
methods: {
login() {
uni.navigateBack();
},
register() {
if (this.check.length < 1) return uni.showToast({ title: '请阅读并同意《用户注册服务协议》《隐私政策》', icon: 'none' });
if (!this.form.username) return uni.showToast({ title: '请输入用户名', icon: 'none' });
if (!this.form.password) return uni.showToast({ title: '请输入密码', icon: 'none' });
if (!this.form.invite_code) return uni.showToast({ title: '请输入邀请码', icon: 'none' });
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
// if (!uni.$u.test.mobile(this.form.phone)) return uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
if (!this.form.code) return uni.showToast({ title: '请输入验证码', icon: 'none' });
this.$http.get('/shop/v10/auth/logon', this.form).then((res) => {
if (res.success) {
uni.navigateBack();
}
});
},
//获取短信验证码
getCode() {
console.log(123456);
var that = this;
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
var interval = setInterval(() => {
that.showText = false;
var times = that.second - 1;
//that.second = times<10?'0'+times:times ;//小于10秒补 0
that.second = times;
console.log(times);
}, 1000);
setTimeout(() => {
clearInterval(interval);
that.second = 60;
that.showText = true;
}, 60000);
//这里请求后台获取短信验证码
uni.showLoading({
title: '正在获取验证码'
});
this.$http.get('/com/sms/sendcode', this.form).then((res) => {
if (res.success) {
uni.hideLoading();
uni.$u.toast('验证码已发送有效期5分钟');
that.showText = false;
}
});
}
}
};
</script>
<style>
page {
background-color: #fff;
}
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
z-index: -1;
}
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
z-index: -1;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
.t-login .b_login {
font-size: 28rpx;
background: rgba(86, 119, 252, 0.6);
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
margin-top: 30rpx;
}
.t-login .b_register {
font-size: 28rpx;
background: #5677fc;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 250rpx 0 120rpx 0;
font-weight: bold;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
z-index: 999;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>

254
pages/me/mobile.vue Normal file
View File

@@ -0,0 +1,254 @@
<template>
<view class="t-login">
<u-navbar :autoBack="true"></u-navbar>
<!-- 页面装饰图片 -->
<image class="img-a" src="@/static/2.png"></image>
<image class="img-b" src="@/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">{{ title }}</view>
<form class="cl">
<view class="t-a">
<image src="/static/icon/acee.png"></image>
<input type="number" placeholder="请输入原手机号" maxlength="11" v-model="form.old_mobile" />
</view>
<view class="t-a">
<image src="@/static/yz.png"></image>
<input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="form.old_code" />
<view v-if="showTextOld" class="t-c" @click="getCode('old', form.old_mobile)">发送短信</view>
<view v-else class="t-c" style="background-color: #a7a7a7">重新发送({{ secondOld }})</view>
</view>
<view class="t-a">
<image src="/static/icon/pass.png"></image>
<input type="password" placeholder="请输入登录密码" maxlength="32" v-model="form.password" />
</view>
<view class="t-a">
<image src="@/static/sj.png"></image>
<input type="number" placeholder="请输入新手机号" maxlength="11" v-model="form.new_mobile" />
</view>
<view class="t-a">
<image src="@/static/yz.png"></image>
<input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="form.new_code" />
<view v-if="showTextNew" class="t-c" @click="getCode('new', form.new_mobile)">发送短信</view>
<view v-else class="t-c" style="background-color: #a7a7a7">重新发送({{ secondNew }})</view>
</view>
</form>
<button class="b_register" @tap="register()"> </button>
</view>
</template>
<script>
export default {
data() {
return {
check: [],
title: '修改手机号!', //填写logo或者app名称也可以用欢迎回来看您需求
secondOld: 60, //默认60秒
secondNew: 60, //默认60秒
showTextOld: true, //判断短信是否发送
showTextNew: true, //判断短信是否发送
form: {
new_mobile: '',
new_code: '',
old_code: '',
old_mobile: '',
password: ''
}
};
},
onLoad() {},
methods: {
login() {
uni.navigateBack();
},
register() {
if (!this.form.old_mobile) return uni.showToast({ title: '请输入原手机号', icon: 'none' });
if (!this.form.old_code) return uni.showToast({ title: '请输入原手机号验证码', icon: 'none' });
if (!this.form.password) return uni.showToast({ title: '请输入密码', icon: 'none' });
if (!this.form.new_mobile) return uni.showToast({ title: '请输入新手机号', icon: 'none' });
if (!this.form.new_code) return uni.showToast({ title: '请输入新手机号验证码', icon: 'none' });
this.$http.post('/shop/v10/user/mobile', this.form).then((res) => {
if (res.code == 0) {
uni.navigateBack({
delta: 2,
complete: () => {
setTimeout(() => {
this.$store.commit('auth/resetUser');
this.$store.commit('auth/resetToken');
uni.navigateTo({
url: `/pages/me/login`
});
}, 100);
}
});
}
});
},
//获取短信验证码
getCode(type, phone) {
var that = this;
var second = type == 'old' ? 'secondOld' : 'secondNew';
var showText = type == 'old' ? 'showTextOld' : 'showTextNew';
if (!phone) return uni.showToast({ title: '请输入手机号', icon: 'none' });
if (phone.length != 11) return uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
var interval = setInterval(() => {
that[showText] = false;
var times = that[second] - 1;
that[second] = times;
}, 1000);
setTimeout(() => {
clearInterval(interval);
that[second] = 60;
that[showText] = true;
}, 60000);
//这里请求后台获取短信验证码
uni.showLoading({
title: '正在获取验证码'
});
this.$http
.get('/com/sms/sendcode', {
mobile: phone
})
.then((res) => {
if (res.success) {
uni.hideLoading();
uni.$u.toast('验证码已发送有效期5分钟');
that[showText] = false;
}
});
}
}
};
</script>
<style>
page {
background-color: #fff;
}
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
z-index: -1;
}
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
z-index: -1;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
.t-login .b_login {
font-size: 28rpx;
background: rgba(86, 119, 252, 0.6);
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
margin-top: 30rpx;
}
.t-login .b_register {
font-size: 28rpx;
background: #5677fc;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 250rpx 0 120rpx 0;
font-weight: bold;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
z-index: 999;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>

227
pages/me/password.vue Normal file
View File

@@ -0,0 +1,227 @@
<template>
<view class="t-login">
<u-navbar :autoBack="true"></u-navbar>
<!-- 页面装饰图片 -->
<image class="img-a" src="@/static/2.png"></image>
<image class="img-b" src="@/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">{{ title }}</view>
<form class="cl">
<view class="t-a">
<image src="/static/icon/acee.png"></image>
<input type="text" placeholder="请输入用户名" maxlength="32" v-model="form.username" />
</view>
<view class="t-a">
<image src="@/static/sj.png"></image>
<input type="number" placeholder="请输入手机号" maxlength="11" v-model="form.mobile" />
</view>
<view class="t-a">
<image src="@/static/yz.png"></image>
<input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="form.code" />
<view v-if="showText" class="t-c" @click="getCode()">发送短信</view>
<view v-else class="t-c" style="background-color: #a7a7a7">重新发送({{ second }})</view>
</view>
<view class="t-a">
<image src="/static/icon/pass.png"></image>
<input placeholder="请输入密码" maxlength="32" v-model="form.password" />
</view>
</form>
<button class="b_register" @tap="userlogin()"> </button>
</view>
</template>
<script>
export default {
data() {
return {
check: [],
title: '重置密码 ', //填写logo或者app名称也可以用欢迎回来看您需求
second: 60, //默认60秒
showText: true, //判断短信是否发送
form: {
username: '',
password: '',
mobile: '',
code: '',
}
};
},
onLoad() {},
methods: {
login() {
uni.navigateBack();
},
userlogin() {
if (!this.form.username) return uni.showToast({ title: '请输入用户名', icon: 'none' });
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
if (!this.form.code) return uni.showToast({ title: '请输入验证码', icon: 'none' });
if (!this.form.password) return uni.showToast({ title: '请输入密码', icon: 'none' });
this.$http.get('/shop/v10/auth/password', this.form).then((res) => {
if (res.success) {
uni.showToast({ title: '重置成功', icon: 'none' });
uni.navigateBack();
}
});
},
//获取短信验证码
getCode() {
var that = this;
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
var interval = setInterval(() => {
that.showText = false;
var times = that.second - 1;
//that.second = times<10?'0'+times:times ;//小于10秒补 0
that.second = times;
}, 1000);
setTimeout(() => {
clearInterval(interval);
that.second = 60;
that.showText = true;
}, 60000);
//这里请求后台获取短信验证码
uni.showLoading({
title: '正在获取验证码'
});
this.$http.get('/com/sms/sendcode', this.form).then((res) => {
if (res.success) {
uni.hideLoading();
uni.$u.toast('验证码已发送有效期5分钟');
that.showText = false;
}
});
}
}
};
</script>
<style>
page {
background-color: #fff;
}
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
z-index: -1;
}
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
z-index: -1;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
.t-login .b_login {
font-size: 28rpx;
background: rgba(86, 119, 252, 0.6);
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
margin-top: 30rpx;
}
.t-login .b_register {
font-size: 28rpx;
background: #5677fc;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 250rpx 0 120rpx 0;
font-weight: bold;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
z-index: 999;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>

192
pages/me/setting.vue Normal file
View File

@@ -0,0 +1,192 @@
<template>
<view class="xkl-com-bg">
<view style="padding-top: 30rpx;">
<view class="means-a">
<view class="means-a-list" style="justify-content: center;padding-top: 30rpx;">
<!-- <view class="tit">头像</view> -->
<image :src="userInfo.avatar_url" v-if="userInfo.avatar_url" class="header" @click="infoHeader"></image>
<image src="/static/mr.png" v-else class="header" @click="infoHeader"></image>
</view>
<view class="means-a-list" style="justify-content: center;">
<!-- <view class="tit">昵称</view> -->
<view class="nickname" @click="infoHeader">{{userInfo.nickname}}</view>
<u-icon name="edit-pen" size="24" @click="infoHeader"></u-icon>
</view>
<!-- @click="toUser" -->
<view class="means-a-list">
<view class="tit">用户名</view>
<view class="means-zhuomi">
<view class="means-zhuomi-tit" v-if="userInfo.username">{{userInfo.username}}</view>
<!-- <view class="means-zhuomi-tit" v-else>请输入</view> -->
<!-- <image src="/static/icon/youdao.png"></image> -->
</view>
</view>
<!-- @click="mobileUp" -->
<view class="means-a-list">
<view class="tit">手机号</view>
<view class="means-zhuomi">
<view class="means-zhuomi-tit" v-if="userInfo.mobile">{{userInfo.mobile}}</view>
<!-- <image src="/static/icon/youdao.png"></image> -->
</view>
</view>
<!-- <view class="means-a-list">
<view class="tit">退出登录</view>
<image src="/static/icon/youdao.png" style="width: 11rpx;height: 21rpx;"></image>
</view> -->
</view>
</view>
<view style="height: 80rpx;"></view>
<u-button text="退出登录" size="normal" type="error" @click="logout()"></u-button>
<wx-user-info-modal v-model="showAuthorizationModal" :header="userInfo.avatar_url" :nickname="userInfo.nickname"
@updated="updatedUserInfoEvent"></wx-user-info-modal>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" :inputType="'text'" mode="input" title="请输入用户名" placeholder="请输入用户名"
@confirm="dialogInputConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import WxUserInfoModal from '@/uni_modules/tuniaoui-wx-user-info/components/tuniaoui-wx-user-info/tuniaoui-wx-user-info.vue'
export default {
components: {
WxUserInfoModal
},
data() {
return {
showAuthorizationModal: false,
}
},
computed: {
userInfo() {
return this.$store.state.auth.user
}
},
onLoad() {
console.log(this.userInfo);
},
methods: {
toUser(){
// $refs.inputDialog.open()
uni.navigateTo({
url:'/pages/me/userName?phone=' + this.userInfo.mobile
})
},
mobileUp(){
uni.navigateTo({
url:'/pages/me/mobile?phone=' + this.userInfo.mobile
})
},
logout() {
this.$http.get('/shop/v10/auth/logout').then(({
data
}) => {
this.$store.commit('auth/resetUser');
this.$store.commit('auth/resetToken');
uni.redirectTo({
url: '/pages/me/login'
});
})
},
dialogInputConfirm(e) {
console.log(e);
},
infoHeader() {
console.log(123456);
this.showAuthorizationModal = true
},
updatedUserInfoEvent(e) {
this.$http.post('/shop/v10/user/update', {
avatar_url: e.avatar,
nickname: e.nickname
}).then(({
data,
success,
msg
}) => {
if (success) {
this.$store.commit('auth/setUser', data);
uni.showToast({
title: msg,
icon: 'none'
})
// this.sendshow();
}
})
this.showAuthorizationModal = false
console.log(e);
}
}
}
</script>
<style lang="scss">
view {
box-sizing: border-box;
}
.means-a {
width: 100%;
background: #FFFFFF;
border-radius: 15rpx;
padding: 25rpx;
.means-a-list {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
min-height: 100rpx;
background-color: #FFFFFF;
padding: 0;
border: 0;
.tit {
font-size: 30rpx;
color: #999999;
}
.header {
width: 140rpx;
height: 140rpx;
margin-bottom: 20rpx;
border-radius: 50%;
}
.nickname {
font-size: 30rpx;
color: #222222;
}
.means-zhuomi {
display: flex;
align-items: center;
.zuomi {
width: 189rpx;
height: 36rpx;
border: 1rpx solid #4D4590;
border-radius: 5rpx;
text-align: center;
line-height: 36rpx;
color: #4D4590;
font-size: 22rpx;
}
.means-zhuomi-tit {
margin: 0 30rpx;
font-size: 28rpx;
color: #999999;
}
image {
width: 11rpx;
height: 21rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,130 @@
<template>
<view style="padding: 30rpx;">
<u--form labelPosition="left" :model="form" :rules="rules" errorType="border-bottom" ref="uForm"
labelWidth="150rpx">
<u-form-item label="用户名" prop="username" borderBottom>
<u--input v-model="form.username" border="none" placeholder="请输入用户名"></u--input>
</u-form-item>
<u-form-item label="登录密码" prop="password" borderBottom>
<u--input v-model="form.password" type="password" border="none" placeholder="请输入登录密码"></u--input>
</u-form-item>
<u-form-item label="手机号" prop="mobile" borderBottom>
<u--input v-model="form.mobile" type="number" border="none" disabled
disabledColor="#FFF"></u--input>
</u-form-item>
<u-form-item label="验证码" prop="code" borderBottom>
<u-code-input v-model="form.code" :maxlength="4" mode="line"></u-code-input>
<view slot="right">
<u-toast ref="uToast"></u-toast>
<u-code :seconds="code.seconds" ref="uCode" @change="codeChange"></u-code>
<u-button type="primary" @tap="getCode">{{code.tips}}</u-button>
</view>
</u-form-item>
</u--form>
<view style="height: 80rpx;"></view>
<u-button type="primary" @click="upMobile">完成</u-button>
</view>
</template>
<script>
export default {
data() {
return {
form: {
mobile: "",
code: '',
username: "",
password: ""
},
rules: {
'username': {
type: 'string',
required: true,
message: '请输入用户名',
trigger: ['blur', 'change']
},
'password': {
type: 'string',
required: true,
message: '请输入登录密码',
trigger: ['blur', 'change']
},
'mobile': {
type: 'string',
required: true,
message: '请输入手机号',
trigger: ['blur', 'change']
},
'code': {
type: 'string',
required: true,
message: '请输入验证码',
trigger: ['blur', 'change']
},
},
code: {
tips: '获取验证码',
// refCode: null,
seconds: 60,
}
}
},
onLoad(options) {
this.form.mobile = options.phone
},
methods: {
upMobile() {
this.$refs.uForm.validate().then(res => {
this.$http.post('/shop/v10/user/username', this.form).then((res) => {
if (res.code == 0) {
uni.navigateBack({
delta: 2,
complete: () => {
setTimeout(() => {
this.$store.commit('auth/resetUser');
this.$store.commit('auth/resetToken');
uni.navigateTo({
url: `/pages/me/login`,
})
}, 100)
},
})
}
})
}).catch(errors => {
uni.$u.toast(errors[0].message)
})
},
codeChange(text) {
this.code.tips = text;
},
getCode() {
if (this.form.mobile.length != 11) {
uni.$u.toast('请输入手机号');
return;
}
if (this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码'
})
this.$http.get('/com/sms/sendcode', this.form).then(res => {
if (res.success) {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送有效期5分钟');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}
})
} else {
uni.$u.toast('倒计时结束后再发送');
}
},
}
}
</script>
<style>
</style>

240
pages/me/userName.vue Normal file
View File

@@ -0,0 +1,240 @@
<template>
<view class="t-login">
<u-navbar :autoBack="true"></u-navbar>
<!-- 页面装饰图片 -->
<image class="img-a" src="@/static/2.png"></image>
<image class="img-b" src="@/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">{{ title }}</view>
<form class="cl">
<view class="t-a">
<image src="/static/icon/acee.png"></image>
<input type="text" placeholder="请输入用户名" maxlength="32" v-model="form.username" />
</view>
<view class="t-a">
<image src="/static/icon/pass.png"></image>
<input type="number" placeholder="请输入密码" maxlength="32" v-model="form.password" />
</view>
<view class="t-a">
<image src="@/static/sj.png"></image>
<input type="number" placeholder="请输入手机号" maxlength="11" v-model="form.mobile" />
</view>
<view class="t-a">
<image src="@/static/yz.png"></image>
<input type="number" name="code" maxlength="6" placeholder="请输入验证码" v-model="form.code" />
<view v-if="showText" class="t-c" @click="getCode()">发送短信</view>
<view v-else class="t-c" style="background-color: #a7a7a7">重新发送({{ second }})</view>
</view>
</form>
<button class="b_register" @tap="register()"> </button>
</view>
</template>
<script>
export default {
data() {
return {
check: [],
title: '修改用户名!', //填写logo或者app名称也可以用欢迎回来看您需求
second: 60, //默认60秒
showText: true, //判断短信是否发送
form: {
username: '',
password: '',
mobile: '',
code: '',
invite_code: ''
}
};
},
onLoad() {},
methods: {
login() {
uni.navigateBack();
},
register() {
if (!this.form.username) return uni.showToast({ title: '请输入用户名', icon: 'none' });
if (!this.form.password) return uni.showToast({ title: '请输入密码', icon: 'none' });
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
if (!this.form.code) return uni.showToast({ title: '请输入验证码', icon: 'none' });
this.$http.post('/shop/v10/user/username', this.form).then((res) => {
if (res.code == 0) {
uni.navigateBack({
delta: 2,
complete: () => {
setTimeout(() => {
this.$store.commit('auth/resetUser');
this.$store.commit('auth/resetToken');
uni.navigateTo({
url: `/pages/me/login`
});
}, 100);
}
});
}
});
},
//获取短信验证码
getCode() {
console.log(123456);
var that = this;
var interval = setInterval(() => {
that.showText = false;
var times = that.second - 1;
//that.second = times<10?'0'+times:times ;//小于10秒补 0
that.second = times;
console.log(times);
}, 1000);
setTimeout(() => {
clearInterval(interval);
that.second = 60;
that.showText = true;
}, 60000);
//这里请求后台获取短信验证码
if (!this.form.mobile) return uni.showToast({ title: '请输入手机号', icon: 'none' });
uni.showLoading({
title: '正在获取验证码'
});
this.$http.get('/com/sms/sendcode', this.form).then((res) => {
if (res.success) {
uni.hideLoading();
uni.$u.toast('验证码已发送有效期5分钟');
that.showText = false;
}
});
}
}
};
</script>
<style>
page {
background-color: #fff;
}
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
z-index: -1;
}
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
z-index: -1;
}
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
.t-login .b_login {
font-size: 28rpx;
background: rgba(86, 119, 252, 0.6);
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
margin-top: 30rpx;
}
.t-login .b_register {
font-size: 28rpx;
background: #5677fc;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
.t-login .t-a {
position: relative;
}
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 250rpx 0 120rpx 0;
font-weight: bold;
}
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #5677fc;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
z-index: 999;
}
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
}
</style>