Browse Source

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

master
ltlzx 4 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. 38
      pages/login/changePwd.vue
  6. 59
      pages/login/verifyEmail.vue
  7. 53
      pages/productDetails/index.vue

1
pages/account/addAddress.vue

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

16
pages/account/address.vue

@ -33,14 +33,26 @@
</template> </template>
<script> <script>
import {defaultRequest2} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
list:[]
} }
}, },
methods:{ 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> </script>

73
pages/account/myProfile.vue

@ -4,30 +4,31 @@
<view class="profile_item profile_item1"> <view class="profile_item profile_item1">
<text>Photo</text> <text>Photo</text>
<view class="profile_item_right"> <view class="profile_item_right">
<img src="/static/img/logo.png" alt="" class="head_img"> <image src="../../static/img/logo.png" mode="" class="head_img" v-show="!user_info.isLogin"></image>
<img src="/static/img/right1.png" alt="" class="right_img"> <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> </view>
<view class="profile_item "> <view class="profile_item " @click="$refs.inputDialog.open()">
<text>Name</text> <text>Name</text>
<view class="profile_item_right"> <view class="profile_item_right">
<text>mayzhang</text> <text>{{user_info.nickname}}</text>
<img src="/static/img/right1.png" alt="" class="right_img"> <image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view> </view>
</view> </view>
<view class="profile_item "> <view class="profile_item ">
<text>Email</text> <text>Email</text>
<view class="profile_item_right"> <view class="profile_item_right">
<img src="/static/img/gantan.png" alt="" class="right_img1"> <image src="../../static/img/gantan.png" alt="" class="right_img1" v-if="user_info.is_validated==0"></image>
<text>unverified</text> <text>{{user_info.is_validated==0?'unverified':user_info.email}}</text>
<img src="/static/img/right1.png" alt="" class="right_img"> <image src="../../static/img/right1.png" alt="" class="right_img"></image>
</view> </view>
</view> </view>
<navigator url="/pages/login/changePwd" > <navigator :url="'/pages/login/verifyEmail?type=0&email='+user_info.email" >
<view class="profile_item "> <view class="profile_item ">
<text>Change Password</text> <text>Change Password</text>
<view class="profile_item_right"> <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>
</view> </view>
</navigator> </navigator>
@ -35,30 +36,74 @@
<text>Ship to</text> <text>Ship to</text>
<view class="profile_item_right"> <view class="profile_item_right">
<text>United States</text> <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>
</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> </view>
</template> </template>
<script> <script>
import {defaultRequest2} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
user_info:{
isLogin:false,
},
query:{
_action:'updateinfo',
nickname:''
}
} }
}, },
methods:{ 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> </script>
<style lang="scss" scoped> <style>
page{ page{
border-top: 13.33rpx #F7F7F7 solid; border-top: 13.33rpx #F7F7F7 solid;
padding-left: 26.67rpx; padding-left: 26.67rpx;
} }
</style>
<style lang="scss" scoped>
.profile_item{ .profile_item{
width: 100%; width: 100%;
display: flex; display: flex;

16
pages/account/settings.vue

@ -22,7 +22,7 @@
</view> </view>
<view class="set_button"> <view class="set_button">
<button>SIGN OUT</button> <button @click="signOut">SIGN OUT</button>
</view> </view>
<view class="edition"> <view class="edition">
<view class="edition_title">CHIC BUYER</view> <view class="edition_title">CHIC BUYER</view>
@ -32,6 +32,7 @@
</template> </template>
<script> <script>
import {defaultRequest2} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
@ -39,7 +40,18 @@
} }
}, },
methods:{ 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> </script>

38
pages/login/changePwd.vue

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

59
pages/login/verifyEmail.vue

@ -2,12 +2,12 @@
<view> <view>
<view class="login"> <view class="login">
<view class="verify_tips"> <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> </view>
<input type="text" class="login_input" placeholder="Enter code"> <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> <view class="tips" v-show="isErr">The code is incorrect.</view>
<button class="login_submit" @click="isShow=true">CONTINUE</button> <button class="login_submit" :disabled="isLogin" @click="goPage">CONTINUE</button>
<view class="verify_text">Resend code</view> <view class="verify_text" @click="sendresetcode">Resend code</view>
</view> </view>
<view class="mask" v-show="isShow" @click="isShow=false"></view> <view class="mask" v-show="isShow" @click="isShow=false"></view>
<view class="verify_popup" v-show="isShow"> <view class="verify_popup" v-show="isShow">
@ -24,27 +24,62 @@
</template> </template>
<script> <script>
import {defaultRequest} from '../../api/index.js' import {defaultRequest,defaultRequest2} from '../../api/index.js'
export default { export default {
data() { data() {
return { return {
isShow:false, isShow:false,
isErr:false, isErr:false,
isLogin:true,
username:'',
type:'',
resetcode:'',
query:{ query:{
_action:'sendmessagesforvalidation', _action:'sendresetcode',
username:'xxxx@xx.com', username:'',
password:'' password:'',
} }
} }
}, },
methods:{ 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) { onLoad(e) {
console.info(e) console.info(e)
this.query.username=e.email this.type=e.type
if(e.type!=0){
this.query.password=e.password this.query.password=e.password
this.sendMsg() this.query.username=e.email
}else{
}
this.username=e.email
this.sendresetcode()
} }
} }
</script> </script>

53
pages/productDetails/index.vue

@ -14,15 +14,16 @@
</block> </block>
</uni-nav-bar> </uni-nav-bar>
<view class="uni-margin-wrap"> <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 class="swiper" @change="gridSwiper" :circular="true">
<swiper-item> <swiper-item v-for="(item,index ) in goodsDate.gallery_list" :key="index">
<view class="swiper-item"> <view class="swiper-item">
<image :src="item.img_url" class="swiper-item-image" mode=""></image>
<!-- <img src="" alt="" class="swiper-item-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> </view>
</swiper-item> </swiper-item>
<swiper-item> <!-- <swiper-item>
<view class="swiper-item uni-bg-green"> <view class="swiper-item uni-bg-green">
<view class="vedioControl"> <view class="vedioControl">
<image src="/static/img/suspend.png" mode="" class="vedioControl_play"></image> <image src="/static/img/suspend.png" mode="" class="vedioControl_play"></image>
@ -38,7 +39,7 @@
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<view class="swiper-item uni-bg-blue">C</view> <view class="swiper-item uni-bg-blue">C</view>
</swiper-item> </swiper-item> -->
</swiper> </swiper>
</uni-swiper-dot> </uni-swiper-dot>
</view> </view>
@ -55,7 +56,8 @@
</view> </view>
<view class="goods_info"> <view class="goods_info">
<view class="goods_info_price"> <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"> <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/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> <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"> <view class="evaluate">
<uni-rate size="18" :value="4" active-color="red" :is-fill="false"/> <uni-rate size="18" :value="4" active-color="red" :is-fill="false"/>
<view class="evaluate_text">4.0</view> <view class="evaluate_text">4.0</view>
<text>(24reviews)</text> <text>({{goodsDate.comment_summary[0].commentcount}}reviews)</text>
</view> </view>
<view class="variations"> <view class="variations">
<view class="variations_title"> <view class="variations_title">
@ -312,24 +314,13 @@
_action:'getgoodsdetail', _action:'getgoodsdetail',
goods_id:'' goods_id:''
}, },
info: [{ 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: ''
}
],
isCart:false, isCart:false,
goodsDate:{}, goodsDate:{
comment_summary:[
{comment_summary:'',commentlabel: ""}
]
},
user_info:{} user_info:{}
} }
}, },
@ -375,18 +366,22 @@
console.info(res) console.info(res)
if(res.error==0){ if(res.error==0){
this.goodsDate=res.data this.goodsDate=res.data
this.goodsDate.gallery_list.map(item=>{
item.content=''
})
} }
}) })
}, },
addCart(){ addCart(){
this.isCart=true this.isCart=true
}, },
//
gridSwiper(e){ gridSwiper(e){
if(e.detail.current==1){ // if(e.detail.current==1){
this.isVedio=true // this.isVedio=true
}else{ // }else{
this.isVedio=false // this.isVedio=false
} // }
this.current = e.detail.current this.current = e.detail.current
}, },
confirm(){ confirm(){

Loading…
Cancel
Save