Commit 295f625f authored by 王建威's avatar 王建威

商城优化

parent 8da02f81
No preview for this file type
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
"disableHostCheck": true, "disableHostCheck": true,
"proxy": { "proxy": {
"/uni/api": { "/uni/api": {
"target": "http://39.96.85.45:9093/", "target": "http://10.0.0.52:6564/",
"changeOrigin": true, "changeOrigin": true,
"secure": false, "secure": false,
"pathRewrite": { "pathRewrite": {
......
...@@ -506,6 +506,11 @@ ...@@ -506,6 +506,11 @@
"supports-color": "^2.0.0" "supports-color": "^2.0.0"
} }
}, },
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
},
"chokidar": { "chokidar": {
"version": "2.1.8", "version": "2.1.8",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
...@@ -701,6 +706,11 @@ ...@@ -701,6 +706,11 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true "dev": true
}, },
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
},
"d": { "d": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
...@@ -2233,8 +2243,7 @@ ...@@ -2233,8 +2243,7 @@
"is-buffer": { "is-buffer": {
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
"dev": true
}, },
"is-data-descriptor": { "is-data-descriptor": {
"version": "0.1.4", "version": "0.1.4",
...@@ -2690,6 +2699,16 @@ ...@@ -2690,6 +2699,16 @@
} }
} }
}, },
"md5": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
"integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=",
"requires": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
}
},
"merge-stream": { "merge-stream": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/merge-stream/download/merge-stream-2.0.0.tgz", "resolved": "https://registry.npm.taobao.org/merge-stream/download/merge-stream-2.0.0.tgz",
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
}, },
"dependencies": { "dependencies": {
"jweixin-module": "^1.6.0", "jweixin-module": "^1.6.0",
"md5": "^2.2.1",
"moment": "^2.24.0" "moment": "^2.24.0"
} }
} }
...@@ -4,30 +4,29 @@ ...@@ -4,30 +4,29 @@
<TopBar title="账号设置"/> <TopBar title="账号设置"/>
<view class="account_base_info flex"> <view class="account_base_info flex">
<view class="flex flex_center"> <view class="flex flex_center">
<image class="portrait" :src="$defaultPortrait"></image> <image class="portrait" :src="data.portrait || $defaultPortrait" @click="uploadImage()"></image>
<view class="flex flex_center base_info"> <view class="flex flex_center base_info">
<text class="customer_name">谛宝多多_北京测试</text> <text class="customer_name">{{data.customer_name}}</text>
<text class="custommer_integral">总积分:121…</text> <text class="custommer_integral">总积分:{{data.total_integral}}</text>
</view> </view>
</view> </view>
<text class="eosfont right_icon">&#xe608;</text>
</view> </view>
<view class="flex set_item"> <view class="flex set_item" @click="changeAddress()">
<text class="set_title">收货地址管理</text> <text class="set_title">收货地址管理</text>
<text class="eosfont right_icon">&#xe608;</text> <text class="eosfont right_icon">&#xe608;</text>
</view> </view>
<view class="flex set_item"> <view class="flex set_item" @click="changePass('phone')">
<text class="set_title">更换绑定手机号</text> <text class="set_title">更换绑定手机号</text>
<view class="flex" style="align-items: center;"> <view class="flex" style="align-items: center;">
<text class="phone_num">1212121</text> <text class="phone_num">{{data.phone_mob.replace(/(\d{3})\d*(\d{4})/,"$1****$2")}}</text>
<text class="eosfont right_icon">&#xe608;</text> <text class="eosfont right_icon">&#xe608;</text>
</view> </view>
</view> </view>
<view class="flex set_item"> <view class="flex set_item" @click="changePass('pay')">
<text class="set_title">修改支付密码</text> <text class="set_title">修改支付密码</text>
<text class="eosfont right_icon">&#xe608;</text> <text class="eosfont right_icon">&#xe608;</text>
</view> </view>
<view class="flex set_item"> <view class="flex set_item" @click="changePass('login')">
<text class="set_title">修改登录密码</text> <text class="set_title">修改登录密码</text>
<text class="eosfont right_icon">&#xe608;</text> <text class="eosfont right_icon">&#xe608;</text>
</view> </view>
...@@ -38,10 +37,76 @@ ...@@ -38,10 +37,76 @@
<script> <script>
import TopBar from '../../components/TopBar/TopBar'; import TopBar from '../../components/TopBar/TopBar';
import { php } from '../../common/host.js';
export default { export default {
data() { data() {
return { return {
data: {
portrait: '',
customer_name: '',
total_integral: '',
phone_mob: ''
}
}
},
onLoad() {
uni.request({
url: '/uni/api/member/profile',
method: 'GET',
dataType: 'json',
success: (res) => {
this.data = res.data.data
}
})
},
methods: {
changeAddress() {
this.$jump(`${php}app=my_address`);
},
changePass(type) {
if(type === 'phone') {
this.$jump(`/pages/setinfo/setinfo?type=${type}&phone=${this.data.phone_mob}`);
return
}
this.$jump(`/pages/setinfo/setinfo?type=${type}`)
},
uploadImage() {
uni.chooseImage({
sizeType: ['compress'],
count:1,
success: (res) => {
const tempFilePaths = res.tempFilePaths;
uni.showLoading({
title: '上传中'
})
uni.uploadFile({
url: '/uni/api/resources',
filePath: tempFilePaths[0],
name: 'file',
success: (uploadFileRes) => {
const data = JSON.parse(uploadFileRes.data)
uni.request({
url: '/uni/api/member/change_portrait',
method: 'POST',
data: {
portrait: data.data
},
dataType: 'json',
success: (result) => {
if(result.data.code === 0) {
uni.hideLoading();
uni.showToast({
title: '头像修改成功',
icon: 'none'
});
this.data.portrait = data.data;
}
}
})
}
});
}
})
} }
}, },
components: { components: {
...@@ -100,6 +165,7 @@ ...@@ -100,6 +165,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 24rpx; padding: 0 24rpx;
border-bottom: 1Px solid #d5d5d5;
.set_title { .set_title {
font-size: 28rpx; font-size: 28rpx;
color: #212121; color: #212121;
...@@ -112,13 +178,20 @@ ...@@ -112,13 +178,20 @@
margin-right: 16rpx; margin-right: 16rpx;
} }
} }
.set_item:last-child {
border-bottom: none;
}
} }
.log_out { .log_out {
height: 92rpx; height: 92rpx;
width: 100%;
line-height: 92rpx; line-height: 92rpx;
background-color: #fff; background-color: #fff;
text-align: center; text-align: center;
color: #212121; color: #212121;
font-size: 28rpx; font-size: 28rpx;
position: fixed;
bottom: 0;
left: 0;
} }
</style> </style>
<template>
<view class="main">
<TopBar title="修改登录密码"/>
<view>
<view class="set_title">请输入旧登录密码</view>
<input password class="set_input" v-model="old_password" placeholder="输入旧密码">
<view class="set_title" style="margin-top: 40rpx;">设置新登录密码</view>
<view class="set_tip">密码至少包含字母/数字,长度不小于6位</view>
<input password class="set_input" v-model="new_password" placeholder="设置6位登录密码">
<input password class="set_input" v-model="new_password_repeat" placeholder="再一次输入登录密码">
<view class="conform_btn" @click="checkPass()">确认</view>
</view>
<view class="success_page" v-if="changeSuccess">
<image src="../../../static/common/icon_chenggong@2x.png"></image>
<text>修改成功!</text>
<view class="conform_btn" @click="returnHome()">确认</view>
</view>
</view>
</template>
<script>
import TopBar from '@/components/TopBar/TopBar';
import md5 from 'md5';
import { php } from '@/common/host.js';
export default {
data() {
return {
old_password: '',
new_password: '',
new_password_repeat: '',
changeSuccess: false
}
},
methods: {
checkPass() {
const reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,}$/;
if(this.new_password !== this.new_password_repeat) {
uni.showToast({
title: '两次密码输入不一致',
icon: 'none'
});
return
}
if(!reg.test(this.new_password)) {
uni.showToast({
title: '密码至少包含字母/数字,长度不小于6位',
icon: 'none',
duration: 2000
});
return
}
uni.request({
url: '/uni/api/member/change_password',
method: 'POST',
data: {
old_password: md5(this.old_password),
newpassword: md5(this.new_password),
confirm_password: md5(this.new_password_repeat)
},
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
uni.removeStorage({
key: 'goods_type'
});
this.changeSuccess = true;
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
}
})
},
returnHome() {
this.$jump(`${php}app=member&act=logout&synlogout=1`);
}
},
components: {
TopBar
}
}
</script>
<style lang="less" scoped>
.main {
padding: 80rpx 40rpx 0;
.set_title {
font-size: 32rpx;
color: #212121;
line-height: 44rpx;
margin-top: 24rpx;
}
.set_tip {
color: #7C7C7C;
font-size: 26rpx;
line-height: 36rpx;
margin-top: 4rpx;
}
.set_input {
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
background-color: #f5f5f5;
padding-left: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
margin-top: 20rpx;
}
.set_input::placeholder {
color: #aeaeae;
}
.conform_btn {
background-color: #FFCD00;
border-radius: 16rpx;
text-align: center;
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
margin: 80rpx auto 0;
font-size: 30rpx;
}
.success_page {
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
left: 0;
top: 0;
z-index: 10;
width: 100%;
height: 100vh;
background-color: #fff;
image {
width: 152rpx;
height: 152rpx;
margin-top: 282rpx;
}
text {
font-size: 32rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
line-height: 44rpx;
margin: 16rpx auto 78rpx;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="main">
<TopBar title="修改支付密码"/>
<view>
<view class="set_title" style="margin-top: 40rpx;">请完成以下认证</view>
<view class="set_tip">验证后更换支付密码</view>
<input password class="set_input" v-model="old_password" placeholder="请输入旧支付密码">
<view class="set_title" style="margin-top: 40rpx;">设置新的支付密码</view>
<input password class="set_input" v-model="new_password" placeholder="设置6位支付密码">
<input password class="set_input" v-model="new_password_repeat" placeholder="再一次输入支付密码">
<view class="btn" style="margin-top: 80rpx;" @click="checkPass()">确认</view>
</view>
<view class="success_page" v-if="changeSuccess">
<image src="../../../static/common/icon_chenggong@2x.png"></image>
<text>修改成功!</text>
<view class="btn" @click="returnHome()">确认</view>
</view>
</view>
</template>
<script>
import TopBar from '@/components/TopBar/TopBar';
import md5 from 'md5';
export default {
data() {
return {
old_password: '',
new_password: '',
new_password_repeat: '',
changeSuccess: false
}
},
methods: {
checkPass() {
if(this.new_password !== this.new_password_repeat) {
uni.showToast({
title: '两次密码输入不一致',
icon: 'none'
});
return
}
if(this.new_password.length < 6) {
uni.showToast({
title: '请设置6位支付密码',
icon: 'none',
duration: 2000
});
return
}
uni.request({
url: '/uni/api/member/change_payword',
method: 'POST',
data: {
old_password: md5(this.old_password),
newpassword: md5(this.new_password),
confirm_password: md5(this.new_password_repeat)
},
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
this.changeSuccess = true;
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
}
})
},
returnHome() {
this.$jump('/pages/setaccount/setaccount', 2);
}
},
components: {
TopBar
}
}
</script>
<style lang="less" scoped>
.main {
padding: 80rpx 40rpx 0;
.set_title {
font-size: 32rpx;
color: #212121;
line-height: 44rpx;
margin-top: 24rpx;
}
.set_tip {
color: #7C7C7C;
font-size: 26rpx;
line-height: 36rpx;
margin-top: 4rpx;
}
.set_input {
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
background-color: #f5f5f5;
padding-left: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
margin-top: 20rpx;
}
.set_input::placeholder {
color: #aeaeae;
}
.btn {
background-color: #FFCD00;
border-radius: 16rpx;
text-align: center;
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
margin: 162rpx auto 0;
font-size: 30rpx;
}
.success_page {
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
left: 0;
top: 0;
z-index: 10;
width: 100%;
height: 100vh;
background-color: #fff;
image {
width: 152rpx;
height: 152rpx;
margin-top: 282rpx;
}
text {
font-size: 32rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
line-height: 44rpx;
margin: 16rpx auto 78rpx;
}
}
}
</style>
<template>
<view class="main">
<TopBar title="更换绑定手机"/>
<view v-if="!next">
<view class="set_title">请完成以下认证</view>
<view class="set_subtitle">请输入{{phone.replace(/(\d{3})\d*(\d{4})/,"$1****$2")}}收到的短信验证码</view>
<view class="flex confirm_box">
<input type="text" class="code_input" v-model="code" placeholder="请输入手机验证码">
<text class="get_code" v-if="codeFlag" @click="getCode()">获取验证码</text>
<text v-else class="get_code grey_bg">{{countdown}}</text>
</view>
<view class="nextstep" @click="nextStep()">下一步</view>
</view>
<view v-else>
<view class="set_title">请输入新手机号码</view>
<view class="set_tip">验证号码后即可更换绑定手机</view>
<input type="text" class="set_input" v-model="newPhone" placeholder="请输入新更换的手机号">
<view class="flex confirm_box">
<input type="text" class="code_input" v-model="newCode" placeholder="请输入手机验证码">
<text class="get_code" v-if="newPhoneCodeFlag" @click="getNewCode()">获取验证码</text>
<text v-else class="get_code grey_bg">{{newCountDown}}</text>
</view>
<view class="nextstep" style="margin-top: 108rpx;" @click="confirm()">确认</view>
</view>
<view class="success_page" v-if="changeSuccess">
<image src="../../../static/common/icon_chenggong@2x.png"></image>
<text>修改成功!</text>
<view class="nextstep" @click="returnHome()">确认</view>
</view>
</view>
</template>
<script>
import TopBar from '@/components/TopBar/TopBar';
export default {
data() {
return {
codeFlag: true,
newPhoneCodeFlag: true,
countdown: '(60)重新获取',
newCountDown: '(60)重新获取',
next: false,
code: '',
newPhone: '',
newCode: '',
changeSuccess: false
}
},
props: {
phone: {
type: String
}
},
methods: {
getCode() {
if(this.codeFlag) {
uni.request({
url: `/uni/api/mobile_msg/change/${this.phone}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
uni.showToast({
title: '短信已发送',
icon: 'none'
})
}
}
});
let seconds = 60;
this.codeFlag = false;
let timer = setInterval(() => {
seconds-=1;
this.countdown = `(${seconds})重新获取`;
if(seconds === 0) {
clearInterval(timer);
this.codeFlag = true;
this.countdown = '(60)重新获取';
}
}, 1000);
}
},
getNewCode() {
if(!/^1[3456789]\d{9}$/.test(this.newPhone)) {
uni.showToast({
title: '手机号不正确',
icon: 'none'
})
return
}
if(this.newPhoneCodeFlag) {
uni.request({
url: `/uni/api/mobile_msg/change/${this.newPhone}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
uni.showToast({
title: '短信已发送',
icon: 'none'
})
}
}
});
let seconds = 60;
this.newPhoneCodeFlag = false;
let timer = setInterval(() => {
seconds-=1;
this.newCountDown = `(${seconds})重新获取`;
if(seconds === 0) {
clearInterval(timer);
this.codeFlag = true;
this.newCountDown = '(60)重新获取';
}
}, 1000);
}
},
nextStep() {
uni.request({
url: `/uni/api/member/check_code/${this.code}`,
method: 'GET',
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
this.next = true;
this.countdown = '(60)重新获取';
}
}
})
},
confirm() {
uni.request({
url: `/uni/api/member/change_mobile`,
method: 'POST',
data: {
code: this.newCode,
phone_mob: this.newPhone
},
dataType: 'json',
success: (res) => {
if(res.data.code === 0) {
this.changeSuccess = true;
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
}
})
},
returnHome() {
this.$jump('/pages/setaccount/setaccount', 2);
}
},
components: {
TopBar
}
}
</script>
<style lang="less" scoped>
.main {
padding: 80rpx 40rpx 0;
.flex {
display: flex;
}
.set_title {
font-size: 32rpx;
color: #212121;
line-height: 44rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
margin-top: 40rpx;
}
.set_tip {
color: #7C7C7C;
font-size: 26rpx;
line-height: 36rpx;
margin-top: 4rpx;
}
.set_subtitle {
font-size: 28rpx;
color: #212121;
line-height: 40rpx;
margin-top: 16rpx;
font-size: 30rpx;
}
.set_input {
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
background-color: #f5f5f5;
padding-left: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
margin-top: 32rpx;
}
.set_input::placeholder {
color: #aeaeae;
}
.confirm_box {
justify-content: space-between;
margin-top: 24rpx;
.code_input {
width: 400rpx;
height: 88rpx;
line-height: 88rpx;
background-color: #f5f5f5;
color: #212121;
font-size: 30rpx;
padding-left: 20rpx;
box-sizing: border-box;
border-radius: 8rpx;
}
.code_input::placeholder {
color: #aeaeae;
}
.get_code {
width: 250rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 30rpx;
background-color: #FFCD00;
border-radius: 16rpx;
}
.grey_bg {
background-color: #ECECEC;
color: #7c7c7c;
}
}
.nextstep {
background-color: #FFCD00;
border-radius: 16rpx;
text-align: center;
width: 670rpx;
height: 88rpx;
line-height: 88rpx;
margin: 208rpx auto 0;
font-size: 30rpx;
}
.success_page {
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
left: 0;
top: 0;
z-index: 10;
width: 100%;
height: 100vh;
background-color: #fff;
image {
width: 152rpx;
height: 152rpx;
margin-top: 282rpx;
}
text {
font-size: 32rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
line-height: 44rpx;
margin: 16rpx auto 78rpx;
}
}
}
</style>
<template> <template>
<view class="main">
<TopBar />
<view> <view>
<view class="set_title">请完成以下认证</view> <ChangePhone v-if="type === 'phone'" :phone="phone" />
<view class="set_subtitle">请输入131****0038收到的短信验证码</view> <ChangeLoginPass v-if="type === 'login'" />
<view class="flex"></view> <ChangePayPass v-if="type === 'pay'" />
</view>
</view> </view>
</template> </template>
<script> <script>
import TopBar from '../../components/TopBar/TopBar' import ChangePhone from './components/changephone.vue';
import ChangeLoginPass from './components/changeLoginPass.vue';
import ChangePayPass from './components/changePayPass.vue';
export default { export default {
data() { data() {
return { return {
type: '',
phone: ''
} }
}, },
onLoad(option) {
this.type = option.type;
this.phone = option.phone || '';
},
components: { components: {
TopBar ChangePhone,
ChangeLoginPass,
ChangePayPass
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.main {
padding: 80rpx 40rpx 0;
.flex {
}
.set_title {
font-size: 32rpx;
color: #212121;
line-height: 44rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
}
.set_subtitle {
font-size: 28rpx;
color: #212121;
line-height: 40rpx;
margin-top: 16rpx;
}
}
</style> </style>
\ No newline at end of file
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment