Browse Source

新增退出登录、修改昵称、重置密码、优化商城详情

master
ltlzx 3 years ago
parent
commit
fc1c69ef7b
  1. 1
      pages/account/addAddress.vue
  2. 16
      pages/account/address.vue
  3. 73
      pages/account/myProfile.vue
  4. 16
      pages/account/settings.vue
  5. 44
      pages/login/changePwd.vue
  6. 61
      pages/login/verifyEmail.vue
  7. 53
      pages/productDetails/index.vue

1
pages/account/addAddress.vue

@ -103,6 +103,7 @@
</template>
<script>
import {defaultRequest2} from '../../api/index.js'
export default {
data() {
return {

16
pages/account/address.vue

@ -33,14 +33,26 @@
</template>
<script>
import {defaultRequest2} from '../../api/index.js'
export default {
data() {
return {
list:[]
}
},
methods:{
getList(){
let data={_action:'cleargoodsbrowsehistory'}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
this.list=res.data
}
})
}
},
onLoad() {
this.getList()
}
}
</script>

73
pages/account/myProfile.vue

@ -4,30 +4,31 @@
<view class="profile_item profile_item1">
<text>Photo</text>
<view class="profile_item_right">
<img src="/static/img/logo.png" alt="" class="head_img">
<img src="/static/img/right1.png" alt="" class="right_img">
<image src="../../static/img/logo.png" mode="" class="head_img" v-show="!user_info.isLogin"></image>
<image :src="user_info.user_head?user_info.user_head:user_info.headicons[5]" mode="" class="head_img" v-if="user_info.isLogin"></image>
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<view class="profile_item ">
<view class="profile_item " @click="$refs.inputDialog.open()">
<text>Name</text>
<view class="profile_item_right">
<text>mayzhang</text>
<img src="/static/img/right1.png" alt="" class="right_img">
<text>{{user_info.nickname}}</text>
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<view class="profile_item ">
<text>Email</text>
<view class="profile_item_right">
<img src="/static/img/gantan.png" alt="" class="right_img1">
<text>unverified</text>
<img src="/static/img/right1.png" alt="" class="right_img">
<image src="../../static/img/gantan.png" alt="" class="right_img1" v-if="user_info.is_validated==0"></image>
<text>{{user_info.is_validated==0?'unverified':user_info.email}}</text>
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<navigator url="/pages/login/changePwd" >
<navigator :url="'/pages/login/verifyEmail?type=0&email='+user_info.email" >
<view class="profile_item ">
<text>Change Password</text>
<view class="profile_item_right">
<img src="/static/img/right1.png" alt="" class="right_img">
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
</navigator>
@ -35,30 +36,74 @@
<text>Ship to</text>
<view class="profile_item_right">
<text>United States</text>
<img src="/static/img/right1.png" alt="" class="right_img">
<image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view>
</view>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="输入内容"
placeholder="请输入姓名" @confirm="dialogInputConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import {defaultRequest2} from '../../api/index.js'
export default {
data() {
return {
user_info:{
isLogin:false,
},
query:{
_action:'updateinfo',
nickname:''
}
}
},
methods:{
getUserInfo(){
let data={_action:'getinfo'}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
res.data.isLogin=true
this.user_info=res.data
uni.setStorageSync('user_info',this.user_info)
}else{
this.user_info=uni.getStorageSync('user_info')
}
})
},
dialogInputConfirm(val){
this.query.nickname=val
defaultRequest2(this.query).then(res=>{
console.info(res)
if(res.error==0){
uni.showToast({
title:'修改成功',
icon:'none'
})
this.getUserInfo()
}
})
}
},
onLoad() {
this.user_info=uni.getStorageSync('user_info')
this.getUserInfo()
}
}
</script>
<style lang="scss" scoped>
<style>
page{
border-top: 13.33rpx #F7F7F7 solid;
padding-left: 26.67rpx;
}
</style>
<style lang="scss" scoped>
.profile_item{
width: 100%;
display: flex;

16
pages/account/settings.vue

@ -22,7 +22,7 @@
</view>
<view class="set_button">
<button>SIGN OUT</button>
<button @click="signOut">SIGN OUT</button>
</view>
<view class="edition">
<view class="edition_title">CHIC BUYER</view>
@ -32,6 +32,7 @@
</template>
<script>
import {defaultRequest2} from '../../api/index.js'
export default {
data() {
return {
@ -39,7 +40,18 @@
}
},
methods:{
signOut(){
let data={_action:'logout'}
defaultRequest2(data).then(res=>{
console.info(res)
if(res.error==0){
uni.clearStorageSync()
uni.reLaunch({
url:'../login/index'
})
}
})
}
}
}
</script>

44
pages/login/changePwd.vue

@ -1,27 +1,53 @@
<template>
<view>
<view class="login">
<input type="text" class="login_input" placeholder="New password">
<input type="text" class="login_input" placeholder="Confirm password">
<button class="login_submit" @click="submit">SUBMIT</button>
<input type="text" class="login_input" placeholder="New password" v-model="query.password1" @input="verificationLogin">
<input type="text" class="login_input" placeholder="Confirm password" v-model="query.password2" @input="verificationLogin">
<button class="login_submit" :disabled="isLogin" @click="submit">SUBMIT</button>
</view>
</view>
</template>
<script>
import {defaultRequest} from '../../api/index.js'
export default {
data() {
return {
query:{
_action:'resetuserpwd',
username:'',
password1:'',
password2:'',
resetcode:''
},
isLogin:true,
}
},
methods:{
submit(){
uni.showToast({
title: 'password is changed',
icon:'none'
});
}
defaultRequest(this.query).then(res=>{
console.info(res)
if(res.error==0){
uni.showToast({
title:res.message,
icon:'none'
})
}
})
},
//
verificationLogin(){
if(this.query.password1&& this.query.password2){
this.isLogin=false
}else{
this.isLogin=true
}
},
},
onLoad(e) {
console.info(e)
this.query.username=e.username
this.query.resetcode=e.resetcode
}
}
</script>

61
pages/login/verifyEmail.vue

@ -2,12 +2,12 @@
<view>
<view class="login">
<view class="verify_tips">
To verify your email,we've send a verification code to {{query.username}}
To verify your email,we've send a verification code to {{username}}
</view>
<input type="text" class="login_input" placeholder="Enter code">
<view class="tips" v-show="!isErr">The code is incorrect.</view>
<button class="login_submit" @click="isShow=true">CONTINUE</button>
<view class="verify_text">Resend code</view>
<input type="text" class="login_input" placeholder="Enter code" v-model="resetcode" @input="verificationLogin">
<view class="tips" v-show="isErr">The code is incorrect.</view>
<button class="login_submit" :disabled="isLogin" @click="goPage">CONTINUE</button>
<view class="verify_text" @click="sendresetcode">Resend code</view>
</view>
<view class="mask" v-show="isShow" @click="isShow=false"></view>
<view class="verify_popup" v-show="isShow">
@ -24,27 +24,62 @@
</template>
<script>
import {defaultRequest} from '../../api/index.js'
import {defaultRequest,defaultRequest2} from '../../api/index.js'
export default {
data() {
return {
isShow:false,
isErr:false,
isLogin:true,
username:'',
type:'',
resetcode:'',
query:{
_action:'sendmessagesforvalidation',
username:'xxxx@xx.com',
password:''
_action:'sendresetcode',
username:'',
password:'',
}
}
},
methods:{
goPage(){
console.info(this.username)
uni.navigateTo({
url:'changePwd?resetcode='+this.resetcode+'&username='+this.username
})
},
sendresetcode(){
defaultRequest(this.query).then(res=>{
console.info(res)
if(res.error==0){
uni.showToast({
title:res.message,
icon:'none'
})
this.isShow=true
}
})
},
//
verificationLogin(){
if(this.resetcode){
this.isLogin=false
}else{
this.isLogin=true
}
},
},
onLoad(e) {
console.info(e)
this.query.username=e.email
this.query.password=e.password
this.sendMsg()
this.type=e.type
if(e.type!=0){
this.query.password=e.password
this.query.username=e.email
}else{
}
this.username=e.email
this.sendresetcode()
}
}
</script>

53
pages/productDetails/index.vue

@ -14,15 +14,16 @@
</block>
</uni-nav-bar>
<view class="uni-margin-wrap">
<uni-swiper-dot :info="info" :current="current" field="content" mode="nav" class="page_padding " :class="isVedio?'showVedio':''" >
<uni-swiper-dot :info="goodsDate.gallery_list" :current="current" field="content" mode="nav" class="page_padding " :class="isVedio?'showVedio':''" >
<swiper class="swiper" @change="gridSwiper" :circular="true">
<swiper-item>
<swiper-item v-for="(item,index ) in goodsDate.gallery_list" :key="index">
<view class="swiper-item">
<image :src="item.img_url" class="swiper-item-image" mode=""></image>
<!-- <img src="" alt="" class="swiper-item-image"> -->
<image src="../../static/img/play.png" class="vedio_play" mode=""></image>
<!-- <image src="../../static/img/play.png" class="vedio_play" mode="" ></image> -->
</view>
</swiper-item>
<swiper-item>
<!-- <swiper-item>
<view class="swiper-item uni-bg-green">
<view class="vedioControl">
<image src="/static/img/suspend.png" mode="" class="vedioControl_play"></image>
@ -38,7 +39,7 @@
</swiper-item>
<swiper-item>
<view class="swiper-item uni-bg-blue">C</view>
</swiper-item>
</swiper-item> -->
</swiper>
</uni-swiper-dot>
</view>
@ -55,7 +56,8 @@
</view>
<view class="goods_info">
<view class="goods_info_price">
<text>US${{goodsDate.shop_price}}</text>
<text>US${{goodsDate.is_promote==0? goodsDate.shop_price :goodsDate.promote_price}}</text>
<view class="info_price_right">
<image src="/static/img/like.png" mode="" v-show="goodsDate.is_attention==0" @click="addLike(goodsDate.id)"></image>
<image src="../../static/img/like1.png" mode="" v-show="goodsDate.is_attention==1" @click="removeLike(goodsDate.id)"></image>
@ -66,7 +68,7 @@
<view class="evaluate">
<uni-rate size="18" :value="4" active-color="red" :is-fill="false"/>
<view class="evaluate_text">4.0</view>
<text>(24reviews)</text>
<text>({{goodsDate.comment_summary[0].commentcount}}reviews)</text>
</view>
<view class="variations">
<view class="variations_title">
@ -312,24 +314,13 @@
_action:'getgoodsdetail',
goods_id:''
},
info: [{
colorClass: 'uni-bg-red',
url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
content: ''
},
{
colorClass: 'uni-bg-green',
url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
content: ''
},
{
colorClass: 'uni-bg-blue',
url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg',
content: ''
}
],
info: [],
isCart:false,
goodsDate:{},
goodsDate:{
comment_summary:[
{comment_summary:'',commentlabel: ""}
]
},
user_info:{}
}
},
@ -375,18 +366,22 @@
console.info(res)
if(res.error==0){
this.goodsDate=res.data
this.goodsDate.gallery_list.map(item=>{
item.content=''
})
}
})
},
addCart(){
this.isCart=true
},
//
gridSwiper(e){
if(e.detail.current==1){
this.isVedio=true
}else{
this.isVedio=false
}
// if(e.detail.current==1){
// this.isVedio=true
// }else{
// this.isVedio=false
// }
this.current = e.detail.current
},
confirm(){

Loading…
Cancel
Save