"...java/me/zhengjie/git@ustchcs.com:gujinli1118/eladmin.git" did not exist on "8cb96509a0d29882be906240f7b21f93baf644c5"
Commit 74126a92 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-vue: 注释debugger

parent 9b217226
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
this.isSkuBuy && this.$emit('skuBuy', data); this.isSkuBuy && this.$emit('skuBuy', data);
}, },
selectSkuData(data) { selectSkuData(data) {
debugger // debugger
if (data.selectedSkuComb) { if (data.selectedSkuComb) {
data.selectedSkuComb.sku_str = data.selectedSkuComb.props_str_arr data.selectedSkuComb.sku_str = data.selectedSkuComb.props_str_arr
.map(str => str.match(/[^:]*:([^:]*)/)[1]) .map(str => str.match(/[^:]*:([^:]*)/)[1])
......
<template> <template>
<div class="item_list over-hide"> <div class="item_list over-hide">
<form action="/search"> <form action="/search">
<van-search <van-search
placeholder="请输入商品名称" placeholder="请输入商品名称"
v-model="searchVal" v-model="searchVal"
@click="$router.push({ name: 'search' })" @click="$router.push({ name: 'search' })"
showAction showAction
/> />
</form> </form>
<van-tabs v-model="tabActive" @disabled="toggleFilterModal(true)"> <van-tabs v-model="tabActive" @disabled="toggleFilterModal(true)">
<van-tab <van-tab
v-for="(tab, tabIndex) in tabsItem" v-for="(tab, tabIndex) in tabsItem"
:title="tab.name" :title="tab.name"
:key="tab.type" :key="tab.type"
:disabled="tab.sort === false" :disabled="tab.sort === false"
> >
<InfinityScroll <InfinityScroll
:ref="'tabScrolls' + tabIndex" :ref="'tabScrolls' + tabIndex"
class="full-page scroll-wrap fix-height" class="full-page scroll-wrap fix-height"
:beforeRequest="beforeRequest" :beforeRequest="beforeRequest"
:apiUrl="listApi" :apiUrl="listApi"
@onLoad="onLoad(tabIndex, $event)" @onLoad="onLoad(tabIndex, $event)"
> >
<item-group> <item-group>
<item-card-hori <item-card-hori
v-for="(item, i) in tab.items" v-for="(item, i) in tab.items"
:key="i" :key="i"
:goods="item" :goods="item"
@click="itemClick(item.id)" @click="itemClick(item.id)"
/> />
</item-group> </item-group>
</InfinityScroll> </InfinityScroll>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
<van-popup class="filterItem" v-model="filterItemShow" position="right"> <van-popup class="filterItem" v-model="filterItemShow" position="right">
<ul> <ul>
<li <li
v-for="(li, i) in filterItem" v-for="(li, i) in filterItem"
:key="i" :key="i"
@click="filterMethod(i)" @click="filterMethod(i)"
:class="{filter_active: li.isActive}" :class="{filter_active: li.isActive}"
> >
{{li.name}} {{li.name}}
<van-icon name="success" v-show="li.isActive" class="float-r"/> <van-icon name="success" v-show="li.isActive" class="float-r"/>
</li> </li>
</ul> </ul>
</van-popup> </van-popup>
<!-- <transition name="fade"> <!-- <transition name="fade">
<van-icon <van-icon
name="arrowupcircle" name="arrowupcircle"
class="backTop" class="backTop"
@click.native="backTop" @click.native="backTop"
v-show="showArrow" v-show="showArrow"
/> />
</transition>--> </transition>-->
</div> </div>
</template> </template>
<script> <script>
import { GOODS_SEARCH } from '@/api/goods'; import { GOODS_SEARCH } from '@/api/goods';
import ItemGroup from '@/vue/components/item-group'; import ItemGroup from '@/vue/components/item-group';
import ItemCardHori from '@/vue/components/item-card-hori/'; import ItemCardHori from '@/vue/components/item-card-hori/';
import { Search, Tab, Tabs, Popup } from 'vant'; import { Search, Tab, Tabs, Popup } from 'vant';
// import { throttle } from 'lodash'; // import { throttle } from 'lodash';
import InfinityScroll from '@/vue/components/infinity-scroll'; import InfinityScroll from '@/vue/components/infinity-scroll';
export default { export default {
name: 'Item-list', name: 'Item-list',
props: { props: {
keyword: { keyword: {
type: String, type: String,
default: '' default: ''
}, },
itemClass: { itemClass: {
type: [String, Number], type: [String, Number],
default: '' default: ''
} }
}, },
data() { data() {
return { return {
listApi: GOODS_SEARCH, listApi: GOODS_SEARCH,
shop_id: 1, shop_id: 1,
tabActive: 0, tabActive: 0,
tabsItem: [ tabsItem: [
{ name: '默认', sort: '', items: [] }, { name: '默认', sort: '', items: [] },
{ name: '销量', sort: 'sold_quantity', items: [] }, { name: '销量', sort: 'sold_quantity', items: [] },
{ name: '最新', sort: 'created_at', items: [] } { name: '最新', sort: 'created_at', items: [] }
// { name: '筛选', sort: false, items: [] } // { name: '筛选', sort: false, items: [] }
], ],
is_haitao: 0, is_haitao: 0,
filterItem: [ filterItem: [
{ {
name: '全部', name: '全部',
filterType: 2, filterType: 2,
isActive: true isActive: true
}, },
{ {
name: '店铺商品', name: '店铺商品',
filterType: 0, filterType: 0,
isActive: false isActive: false
}, },
{ {
name: '海淘商品', name: '海淘商品',
filterType: 1, filterType: 1,
isActive: false isActive: false
} }
], ],
isHaitao: 2, isHaitao: 2,
searchVal: '', searchVal: '',
filterItemShow: false filterItemShow: false
// showArrow: false // showArrow: false
}; };
}, },
computed: { computed: {
sortVal() { sortVal() {
const { tabActive: i } = this; const { tabActive: i } = this;
return this.tabsItem[i].sort; return this.tabsItem[i].sort;
} }
}, },
created() { created() {
// this.scrollShowArrow = throttle(this.scrollShowArrow, 100); // this.scrollShowArrow = throttle(this.scrollShowArrow, 100);
}, },
methods: { methods: {
onLoad(i, items) { onLoad(i, items) {
this.tabsItem[i].items.push(...items); this.tabsItem[i].items.push(...items);
}, },
beforeRequest() { beforeRequest() {
return { return {
params: { params: {
q: this.searchVal, q: this.searchVal,
shop_id: this.shop_id, shop_id: this.shop_id,
cid: this.itemClass, cid: this.itemClass,
sort: this.sortVal, sort: this.sortVal,
is_haitao: this.isHaitao is_haitao: this.isHaitao
} }
}; };
}, },
// 滚动容器改变, 导致滚动监听失效, 暂时先注释了 // 滚动容器改变, 导致滚动监听失效, 暂时先注释了
// eventListen(isBind = true) { // eventListen(isBind = true) {
// if (isBind) { // if (isBind) {
// this.$el.addEventListener('scroll', this.scrollShowArrow); // this.$el.addEventListener('scroll', this.scrollShowArrow);
// } else { // } else {
// this.$el.removeEventListener('scroll', this.scrollShowArrow); // this.$el.removeEventListener('scroll', this.scrollShowArrow);
// } // }
// }, // },
// scrollShowArrow() { // scrollShowArrow() {
// this.showArrow = this.$el.scrollTop > 120; // this.showArrow = this.$el.scrollTop > 120;
// }, // },
activeFilter(i) { activeFilter(i) {
this.filterItem.forEach((item, index) => { this.filterItem.forEach((item, index) => {
item.isActive = i === index; item.isActive = i === index;
}); });
}, },
resetActiveTab() { resetActiveTab() {
const { tabActive: i } = this; const { tabActive: i } = this;
this.tabsItem[i].items = []; this.tabsItem[i].items = [];
const targetScroll = this.$refs[`tabScrolls${i}`][0]; const targetScroll = this.$refs[`tabScrolls${i}`][0];
debugger; // debugger;
targetScroll && targetScroll.resetInit(); targetScroll && targetScroll.resetInit();
}, },
toggleFilterModal(status) { toggleFilterModal(status) {
this.filterItemShow = status; this.filterItemShow = status;
}, },
filterMethod(i) { filterMethod(i) {
const filterType = this.filterItem[i].filterType; const filterType = this.filterItem[i].filterType;
if (filterType === this.isHaitao) return; if (filterType === this.isHaitao) return;
this.isHaitao = filterType; this.isHaitao = filterType;
this.activeFilter(i); this.activeFilter(i);
this.toggleFilterModal(false); this.toggleFilterModal(false);
this.resetActiveTab(); this.resetActiveTab();
}, },
// backTop() { // backTop() {
// this.$el.scrollTop = 0; // this.$el.scrollTop = 0;
// }, // },
itemClick(id) { itemClick(id) {
this.$router.push({ name: 'detail', params: { itemId: id } }); this.$router.push({ name: 'detail', params: { itemId: id } });
} }
}, },
components: { components: {
InfinityScroll, InfinityScroll,
[ItemGroup.name]: ItemGroup, [ItemGroup.name]: ItemGroup,
[ItemCardHori.name]: ItemCardHori, [ItemCardHori.name]: ItemCardHori,
[Tab.name]: Tab, [Tab.name]: Tab,
[Tabs.name]: Tabs, [Tabs.name]: Tabs,
[Search.name]: Search, [Search.name]: Search,
[Popup.name]: Popup [Popup.name]: Popup
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.fade-enter, .fade-enter,
.fade-leave-to { .fade-leave-to {
opacity: 0; opacity: 0;
} }
.fade-enter-active, .fade-enter-active,
.fade-leave-active { .fade-leave-active {
transition: all 0.5s; transition: all 0.5s;
} }
.fix-height { .fix-height {
padding-bottom: 88px; padding-bottom: 88px;
} }
.over-hide { .over-hide {
overflow: hidden; overflow: hidden;
} }
.item_list { .item_list {
background-color: #fff; background-color: #fff;
padding-bottom: 0; padding-bottom: 0;
} }
.fixedTop { .fixedTop {
position: fixed; position: fixed;
width: 100%; width: 100%;
top: 0; top: 0;
z-index: 999; z-index: 999;
} }
.items_loading { .items_loading {
margin: 0 auto; margin: 0 auto;
} }
.filterItem { .filterItem {
width: 40%; width: 40%;
height: 100%; height: 100%;
li { li {
padding: 10px; padding: 10px;
&.filter_active { &.filter_active {
color: $red; color: $red;
} }
} }
} }
.backTop { .backTop {
position: fixed; position: fixed;
right: 20px; right: 20px;
bottom: 20px; bottom: 20px;
font-size: 24px; font-size: 24px;
} }
</style> </style>
<template> <template>
<div class="item_list"> <div class="item_list">
<form action="/search" class="fixedTop"> <form action="/search" class="fixedTop">
<van-search placeholder="请输入商品名称" v-model="searchVal" @search="resetInit" showAction/> <van-search placeholder="请输入商品名称" v-model="searchVal" @search="resetInit" showAction/>
</form> </form>
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
:immediate-check="false" :immediate-check="false"
:offset="100" :offset="100"
@load="loadMore" @load="loadMore"
> >
<item-group> <item-group>
<item-card-hori <item-card-hori
v-for="(item) in items" v-for="(item) in items"
:key="item.id" :key="item.id"
:goods="item" :goods="item"
@click="itemClick(item.id)" @click="itemClick(item.id)"
/> />
</item-group> </item-group>
</van-list> </van-list>
<is-empty v-if="items.length === 0">抱歉,没有找到符合条件商品</is-empty> <is-empty v-if="items.length === 0">抱歉,没有找到符合条件商品</is-empty>
<transition name="fade"> <transition name="fade">
<van-icon name="arrowupcircle" class="backTop" @click.native="backTop" v-show="showArrow"></van-icon> <van-icon name="arrowupcircle" class="backTop" @click.native="backTop" v-show="showArrow"></van-icon>
</transition> </transition>
</div> </div>
</template> </template>
<script> <script>
import { GOODS_SEARCH } from '@/api/goods'; import { GOODS_SEARCH } from '@/api/goods';
import ItemGroup from '@/vue/components/item-group/'; import ItemGroup from '@/vue/components/item-group/';
import IsEmpty from '@/vue/components/is-empty/'; import IsEmpty from '@/vue/components/is-empty/';
import ItemCardHori from '@/vue/components/item-card-hori/'; import ItemCardHori from '@/vue/components/item-card-hori/';
import { Search, List } from 'vant'; import { Search, List } from 'vant';
import _ from 'lodash'; import _ from 'lodash';
import loadMore from '@/vue/mixin/list-load-more'; import loadMore from '@/vue/mixin/list-load-more';
import scrollFixed from '@/vue/mixin/scroll-fixed'; import scrollFixed from '@/vue/mixin/scroll-fixed';
export default { export default {
name: 'Item-list', name: 'Item-list',
props: { props: {
keyword: { keyword: {
type: String, type: String,
default: '' default: ''
} }
}, },
mixins: [loadMore, scrollFixed], mixins: [loadMore, scrollFixed],
data() { data() {
return { return {
isEmpty: false, isEmpty: false,
shop_id: '', shop_id: '',
searchVal: '', searchVal: '',
showArrow: false showArrow: false
}; };
}, },
activated() { activated() {
this.searchVal = this.keyword; this.searchVal = this.keyword;
this.resetInit(); this.resetInit();
this.eventListen(); this.eventListen();
}, },
deactivated() { deactivated() {
document document
.getElementById('app') .getElementById('app')
.removeEventListener('scroll', this.scrollShowArrow); .removeEventListener('scroll', this.scrollShowArrow);
}, },
created() { created() {
this.initData(); this.initData();
this.scrollShowArrow = _.throttle(this.scrollShowArrow, 100); this.scrollShowArrow = _.throttle(this.scrollShowArrow, 100);
}, },
methods: { methods: {
initData() { initData() {
debugger; // debugger;
this.items = []; this.items = [];
return this.$reqGet( return this.$reqGet(
`/wx/goods/list`, `/wx/goods/list`,
{ {
keyword: this.searchVal, keyword: this.searchVal,
page: 1, page: 1,
size: 100, size: 100,
sort: 'name', sort: 'name',
order: 'desc', order: 'desc',
categoryId: 0 categoryId: 0
}, },
{ {
hideLoading: true hideLoading: true
} }
).then(res => { ).then(res => {
const { goodsList, filterCategoryList } = res.data.data; const { goodsList, filterCategoryList } = res.data.data;
_.each(goodsList, v => { _.each(goodsList, v => {
v.pic_url = v.picUrl; v.pic_url = v.picUrl;
}); });
this.items.push(...goodsList); this.items.push(...goodsList);
// return page; // return page;
}); });
}, },
eventListen() { eventListen() {
document document
.getElementById('app') .getElementById('app')
.addEventListener('scroll', this.scrollShowArrow); .addEventListener('scroll', this.scrollShowArrow);
}, },
scrollShowArrow() { scrollShowArrow() {
this.showArrow = document.getElementById('app').scrollTop > 120; this.showArrow = document.getElementById('app').scrollTop > 120;
}, },
backTop() { backTop() {
document.getElementById('app').scrollTop = 0; document.getElementById('app').scrollTop = 0;
}, },
itemClick(i) { itemClick(i) {
this.$router.push({ name: 'detail', params: { itemId: i } }); this.$router.push({ name: 'detail', params: { itemId: i } });
} }
}, },
components: { components: {
[ItemGroup.name]: ItemGroup, [ItemGroup.name]: ItemGroup,
[ItemCardHori.name]: ItemCardHori, [ItemCardHori.name]: ItemCardHori,
[Search.name]: Search, [Search.name]: Search,
[List.name]: List, [List.name]: List,
[IsEmpty.name]: IsEmpty [IsEmpty.name]: IsEmpty
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.fade-enter, .fade-enter,
.fade-leave-to { .fade-leave-to {
opacity: 0; opacity: 0;
} }
.fade-enter-active, .fade-enter-active,
.fade-leave-active { .fade-leave-active {
transition: all 0.5s; transition: all 0.5s;
} }
.item_list { .item_list {
background-color: #fff; background-color: #fff;
padding-top: 50px; padding-top: 50px;
box-sizing: border-box; box-sizing: border-box;
} }
.fixedTop { .fixedTop {
position: fixed; position: fixed;
width: 100%; width: 100%;
top: 0; top: 0;
z-index: 999; z-index: 999;
} }
.items_loading { .items_loading {
margin: 0 auto; margin: 0 auto;
} }
.backTop { .backTop {
position: fixed; position: fixed;
right: 20px; right: 20px;
bottom: 20px; bottom: 20px;
font-size: 24px; font-size: 24px;
} }
</style> </style>
<template> <template>
<div class="user_collect"> <div class="user_collect">
<form action="/search" class="fixedTop"> <form action="/search" class="fixedTop">
<van-search placeholder="请输入商品名称" v-model="searchVal"/> <van-search placeholder="请输入商品名称" v-model="searchVal"/>
</form> </form>
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
:immediate-check="false" :immediate-check="false"
:offset="100" :offset="100"
@load="loadMore" @load="loadMore"
> >
<item-group> <item-group>
<item-card-hori <item-card-hori
v-for="(item, i) in items" v-for="(item, i) in items"
:style="{backgroundColor: !item.goods_status && '#fcfcfc'}" :style="{backgroundColor: !item.goods_status && '#fcfcfc'}"
:key="i" :key="i"
:goods="item" :goods="item"
@click="itemClick(i,item)" @click="itemClick(i,item)"
> >
<van-icon <van-icon
name="lajitong" name="lajitong"
slot="footer" slot="footer"
@click.stop="cancelCollect($event, i,item)" @click.stop="cancelCollect($event, i,item)"
style="float: right;" style="float: right;"
/> />
</item-card-hori> </item-card-hori>
</item-group> </item-group>
</van-list> </van-list>
<is-empty v-if="isEmpty">没有商品收藏</is-empty> <is-empty v-if="isEmpty">没有商品收藏</is-empty>
<!-- <div class="clear_invalid" v-if="items.length" @click="clearInvalid"> <!-- <div class="clear_invalid" v-if="items.length" @click="clearInvalid">
<van-icon name="lajitong"/>清除失效商品 <van-icon name="lajitong"/>清除失效商品
</div>--> </div>-->
</div> </div>
</template> </template>
<script> <script>
import { GOODS_COLLECT_LIST } from '@/api/user'; import { GOODS_COLLECT_LIST } from '@/api/user';
import ItemGroup from '@/vue/components/item-group/'; import ItemGroup from '@/vue/components/item-group/';
import ItemCardHori from '@/vue/components/item-card-hori/'; import ItemCardHori from '@/vue/components/item-card-hori/';
import IsEmpty from '@/vue/components/is-empty/'; import IsEmpty from '@/vue/components/is-empty/';
import { Search, List } from 'vant'; import { Search, List } from 'vant';
import loadMore from '@/vue/mixin/list-load-more'; import loadMore from '@/vue/mixin/list-load-more';
import scrollFixed from '@/vue/mixin/scroll-fixed'; import scrollFixed from '@/vue/mixin/scroll-fixed';
export default { export default {
mixins: [loadMore, scrollFixed], mixins: [loadMore, scrollFixed],
data() { data() {
return { return {
shop_id: 1, shop_id: 1,
items: [], items: [],
searchVal: '' searchVal: ''
}; };
}, },
created() { created() {
this.resetInit(); this.resetInit();
}, },
methods: { methods: {
initData() { initData() {
return this.$reqGet( return this.$reqGet(
'/wx/collect/list?type=0&page=1&size=100', '/wx/collect/list?type=0&page=1&size=100',
{}, {},
{ {
hideLoading: true hideLoading: true
} }
).then(res => { ).then(res => {
debugger; // debugger;
const { collectList, page } = res.data.data; const { collectList, page } = res.data.data;
this.items.push(...collectList); this.items.push(...collectList);
return page; return page;
}); });
}, },
cancelCollect(event, i, item) { cancelCollect(event, i, item) {
this.$dialog.confirm({ message: '是否取消收藏该商品' }).then(() => { this.$dialog.confirm({ message: '是否取消收藏该商品' }).then(() => {
this.$reqPost( this.$reqPost(
'/wx/collect/addordelete', '/wx/collect/addordelete',
{ valueId: item.valueId, type: 0 }, { valueId: item.valueId, type: 0 },
{ {
hideLoading: true hideLoading: true
} }
).then(res => { ).then(res => {
this.items.splice(i, 1); this.items.splice(i, 1);
}); });
}); });
}, },
clearInvalid() { clearInvalid() {
this.$dialog.confirm({ message: '确定清除所有失效商品吗?' }); this.$dialog.confirm({ message: '确定清除所有失效商品吗?' });
}, },
itemClick(i, item) { itemClick(i, item) {
// const item_id = this.items[i].item_id; // const item_id = this.items[i].item_id;
// const status = this.items[i].goods_status; // const status = this.items[i].goods_status;
// status && // status &&
this.$router.push(`/items/detail/${item.valueId}`); this.$router.push(`/items/detail/${item.valueId}`);
// !status && this.$toast('该商品已失效'); // !status && this.$toast('该商品已失效');
} }
}, },
components: { components: {
[ItemGroup.name]: ItemGroup, [ItemGroup.name]: ItemGroup,
[ItemCardHori.name]: ItemCardHori, [ItemCardHori.name]: ItemCardHori,
[Search.name]: Search, [Search.name]: Search,
[IsEmpty.name]: IsEmpty, [IsEmpty.name]: IsEmpty,
[List.name]: List [List.name]: List
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.clear_invalid { .clear_invalid {
width: 120px; width: 120px;
color: $font-color-gray; color: $font-color-gray;
border: 1px solid $font-color-gray; border: 1px solid $font-color-gray;
margin: 0 auto; margin: 0 auto;
text-align: center; text-align: center;
padding: 5px 3px; padding: 5px 3px;
margin-top: 20px; margin-top: 20px;
border-radius: 3px; border-radius: 3px;
} }
</style> </style>
<template> <template>
<div class="user_information"> <div class="user_information">
<van-cell-group> <van-cell-group>
<van-cell title="头像" class="cell_middle"> <van-cell title="头像" class="cell_middle">
<van-uploader :afterRead="avatarAfterRead"> <van-uploader :afterRead="avatarAfterRead">
<div class="user_avatar_upload"> <div class="user_avatar_upload">
<img <img
:src="avatar + '?x-oss-process=image/resize,m_fill,h_50,w_50'" :src="avatar + '?x-oss-process=image/resize,m_fill,h_50,w_50'"
alt="你的头像" alt="你的头像"
v-if="avatar" v-if="avatar"
> >
<van-icon name="camera_full" v-else></van-icon> <van-icon name="camera_full" v-else></van-icon>
</div> </div>
</van-uploader> </van-uploader>
</van-cell> </van-cell>
<!-- <van-cell title="背景图" to="/user/information/setbg" isLink></van-cell> --> <!-- <van-cell title="背景图" to="/user/information/setbg" isLink></van-cell> -->
<!-- <van-cell title="昵称" to="/user/information/setNickname" :value="nickName" isLink/> --> <!-- <van-cell title="昵称" to="/user/information/setNickname" :value="nickName" isLink/> -->
<!-- <van-cell title="性别" :value="genderText" @click="showSex = true" isLink/> --> <!-- <van-cell title="性别" :value="genderText" @click="showSex = true" isLink/> -->
<!-- <van-cell title="密码设置" to="/user/information/setPassword" isLink/> --> <!-- <van-cell title="密码设置" to="/user/information/setPassword" isLink/> -->
<!-- <van-cell title="手机号" to="/user/information/setMobile" :value="mobile" isLink></van-cell> --> <!-- <van-cell title="手机号" to="/user/information/setMobile" :value="mobile" isLink></van-cell> -->
<van-cell title="背景图" isLink></van-cell> <van-cell title="背景图" isLink></van-cell>
<van-cell title="昵称" :value="nickName" isLink/> <van-cell title="昵称" :value="nickName" isLink/>
<van-cell title="性别" isLink/> <van-cell title="性别" isLink/>
<!-- <van-cell title="密码设置" to="/user/information/setPassword" isLink/> --> <!-- <van-cell title="密码设置" to="/user/information/setPassword" isLink/> -->
<van-cell title="手机号" :value="mobile" isLink></van-cell> <van-cell title="手机号" :value="mobile" isLink></van-cell>
</van-cell-group> </van-cell-group>
<van-button class="bottom_btn" @click="loginOut" type="primary" bottomAction>退出登录</van-button> <van-button class="bottom_btn" @click="loginOut" type="primary" bottomAction>退出登录</van-button>
<van-popup v-model="showSex" position="bottom"> <van-popup v-model="showSex" position="bottom">
<van-picker <van-picker
showToolbar showToolbar
:columns="sexColumns" :columns="sexColumns"
title="选择性别" title="选择性别"
@cancel="showSex = false" @cancel="showSex = false"
@confirm="onSexConfirm" @confirm="onSexConfirm"
/> />
</van-popup> </van-popup>
</div> </div>
</template> </template>
<script> <script>
import { Uploader, Picker, Popup, Button } from 'vant'; import { Uploader, Picker, Popup, Button } from 'vant';
import { USER_PROFILE } from '@/api/user'; import { USER_PROFILE } from '@/api/user';
import { removeLocalStorage } from 'core/utils/local-storage'; import { removeLocalStorage } from 'core/utils/local-storage';
import { getLocalStorage } from 'core/utils/local-storage'; import { getLocalStorage } from 'core/utils/local-storage';
export default { export default {
data() { data() {
return { return {
sexColumns: [ sexColumns: [
{ {
values: ['保密', '', ''], values: ['保密', '', ''],
defaultIndex: 0 defaultIndex: 0
} }
], ],
showSex: false, showSex: false,
avatar: '', avatar: '',
nickName: '', nickName: '',
gender: -1, gender: -1,
mobile: '' mobile: ''
}; };
}, },
computed: { computed: {
genderText() { genderText() {
const text = ['保密', '', '']; const text = ['保密', '', ''];
return text[this.gender] || ''; return text[this.gender] || '';
} }
}, },
created() { created() {
this.getUserInfo(); this.getUserInfo();
}, },
methods: { methods: {
avatarAfterRead(file) { avatarAfterRead(file) {
console.log(file); console.log(file);
}, },
onSexConfirm(value, index) { onSexConfirm(value, index) {
this.$reqPut(USER_PROFILE, { this.$reqPut(USER_PROFILE, {
gender: index[0] gender: index[0]
}).then(res => { }).then(res => {
this.gender = res.data.data.gender; this.gender = res.data.data.gender;
this.showSex = false; this.showSex = false;
}); });
}, },
getUserInfo() { getUserInfo() {
const infoData = getLocalStorage( const infoData = getLocalStorage(
'nickName', 'nickName',
'background_image', 'background_image',
'avatar' 'avatar'
); );
debugger; // debugger;
this.avatar = infoData.avatar; this.avatar = infoData.avatar;
this.nickName = infoData.nickName; this.nickName = infoData.nickName;
// this.gender = infoData.gender; // this.gender = infoData.gender;
// this.mobile = infoData.mobile; // this.mobile = infoData.mobile;
}, },
loginOut() { loginOut() {
removeLocalStorage( removeLocalStorage(
'Authorization', 'Authorization',
// 'user_id', // 'user_id',
'avatar', 'avatar',
// 'background_image', // 'background_image',
'nickName' 'nickName'
); );
this.$router.push({ name: 'home' }); this.$router.push({ name: 'home' });
} }
}, },
components: { components: {
[Button.name]: Button, [Button.name]: Button,
[Uploader.name]: Uploader, [Uploader.name]: Uploader,
[Picker.name]: Picker, [Picker.name]: Picker,
[Popup.name]: Popup [Popup.name]: Popup
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.user_information { .user_information {
.user_avatar_upload { .user_avatar_upload {
position: relative; position: relative;
width: 50px; width: 50px;
height: 50px; height: 50px;
border: 1px solid $border-color; border: 1px solid $border-color;
img { img {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
} }
i { i {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 20px; font-size: 20px;
color: $border-color; color: $border-color;
} }
} }
} }
</style> </style>
...@@ -16,7 +16,7 @@ export default { ...@@ -16,7 +16,7 @@ export default {
methods: { methods: {
async resetInit() { async resetInit() {
this.resetData(); this.resetData();
debugger; // debugger;
const page = await this.initData(); const page = await this.initData();
this.$nextTick(() => { this.$nextTick(() => {
this.setPages(page); this.setPages(page);
......
Supports Markdown
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