Merge branch 'msb_test' into feature/task1.0.0-0507-zz

merge-requests/42/merge
张征 2 years ago
commit 83dd6c4a3f

@ -1,81 +1,81 @@
<template>
<div class="chosen">
<div class="chosen-title flex flex-between flex-middle">
<h3 class="chosen-title--txt">为你精选</h3>
<div class="chosen-title--btn flex" @click="getRecommendedGoodsList()">
<img src="@/assets/img/goods/each.png" alt="切换推荐" />
<span>换一组</span>
</div>
</div>
<div class="chosen-list">
<UiGoodsItem
:item="item"
v-for="item in recommendedData"
:key="item.id"
></UiGoodsItem>
</div>
</div>
</template>
<script>
import { ApiGetRecommendedGoodsList } from "@/plugins/api/goods";
import UiGoodsItem from "@/components/UiGoodsItem.vue";
export default {
components: { UiGoodsItem },
data() {
return {
recommendedData: [],
};
},
created() {
this.getRecommendedGoodsList();
},
methods: {
async getRecommendedGoodsList() {
let vm = this;
let res = await ApiGetRecommendedGoodsList();
vm.recommendedData = res.result;
},
},
};
</script>
<style lang="scss" scoped>
.chosen {
width: 100%;
padding: 30px 0 40px;
background: #f8f8f8;
&-title {
@include layout-box;
&--txt {
font-size: 24px;
font-family: Microsoft YaHei-Bold, Microsoft YaHei;
font-weight: bold;
color: #333333;
}
&--btn {
width: 140px;
cursor: pointer;
img {
width: 27px;
height: 27px;
margin-right: 5px;
}
span {
font-size: 18px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #999999;
}
}
}
&-list {
@include layout-box;
padding-top: 40px;
display: grid;
grid-template-columns: repeat(auto-fill, 232px);
justify-content: space-between;
grid-row-gap: 10px;
}
}
</style>
<template>
<div class="chosen">
<div class="chosen-title flex flex-between flex-middle">
<h3 class="chosen-title--txt">为你精选</h3>
<div class="chosen-title--btn flex" @click="getRecommendedGoodsList()">
<img src="@/assets/img/goods/each.png" alt="切换推荐" />
<span>换一组</span>
</div>
</div>
<div class="chosen-list">
<UiGoodsItem
:item="item"
v-for="item in recommendedData"
:key="item.id"
></UiGoodsItem>
</div>
</div>
</template>
<script>
import { ApiGetRecommendedGoodsList } from "@/plugins/api/goods";
import UiGoodsItem from "@/components/UiGoodsItem.vue";
export default {
components: { UiGoodsItem },
data() {
return {
recommendedData: [],
};
},
created() {
this.getRecommendedGoodsList();
},
methods: {
async getRecommendedGoodsList() {
let vm = this;
let res = await ApiGetRecommendedGoodsList();
vm.recommendedData = res.result;
},
},
};
</script>
<style lang="scss" scoped>
.chosen {
width: 100%;
padding: 30px 0 40px;
background: #f8f8f8;
&-title {
@include layout-box;
&--txt {
font-size: 24px;
font-family: Microsoft YaHei-Bold, Microsoft YaHei;
font-weight: bold;
color: #333333;
}
&--btn {
width: 140px;
cursor: pointer;
img {
width: 27px;
height: 27px;
margin-right: 5px;
}
span {
font-size: 18px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #999999;
}
}
}
&-list {
@include layout-box;
padding-top: 40px;
display: grid;
grid-template-columns: repeat(auto-fill, 232px);
justify-content: space-between;
grid-row-gap: 10px;
}
}
</style>

@ -147,11 +147,17 @@ export default {
Message.error("请勾选同意《用户协议》和《隐私协议》");
return;
}
const { result } = await ApiPostLogin({
const { result, error } = await ApiPostLogin({
...this.form,
clientId: 1,
systemId: 3,
});
if (error !== null) {
Message.error(
error.message || "登录失败,请检查手机号或验证码是否正确"
);
return;
}
if (result) {
this.dialogTableVisible = false;
this.$store.commit("setToken", result.token);

@ -0,0 +1,77 @@
<!--
* @Description使用请参考https://element.eleme.cn/#/zh-CN/component/pagination
-->
<template>
<div class="bs-pagination flex flex-right">
<el-pagination
background
v-bind="$attrs"
:current-page="currentPage"
:page-size="pageSize"
:layout="layout"
:total="total"
@size-change="$emit('size-change', $event)"
@current-change="$emit('current-change', $event)"
>
</el-pagination>
<slot></slot>
</div>
</template>
<script>
export default {
name: "BsPagination",
props: {
total: {
type: Number,
default: 0,
},
pageSize: {
type: Number,
default: 0,
},
layout: {
type: String,
default: "prev, pager, next, jumper",
},
currentPage: {
type: Number,
default: 0,
},
},
};
</script>
<style lang="scss" scoped>
.bs-pagination {
@include layout-box;
margin-top: 60px;
/deep/.el-pagination {
.btn-prev,
.btn-next {
width: 32px;
height: 32px;
background: #ffffff;
border-radius: 2px;
border: 1px solid rgba(0, 0, 0, 0.2);
}
.el-pagination__jump {
color: #333333;
}
.el-pager {
.number {
width: 32px;
height: 32px;
line-height: 32px;
font-size: 14px;
background: #ffffff;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 2px;
}
.active {
color: #ffffff;
background: #ff512b;
border: none;
}
}
}
}
</style>

@ -1,10 +0,0 @@
<!--
* @Author: ch
* @Date: 2022-05-07 22:57:24
* @LastEditors: ch
* @LastEditTime: 2022-05-07 22:57:39
* @Description: file content
-->
<template>
<el-radio/>
</template>

@ -46,9 +46,9 @@ metadata:
namespace: yanxuan
spec:
ports:
- port: 3000
- port: $JAR_PORD
protocol: TCP
targetPort: 3000
targetPort: $JAR_PORD
selector:
app: $IMAGES
type: ClusterIP

@ -122,7 +122,7 @@ export default {
this.$router.push("/account/address");
break;
case MENU_VALUE.LOGON_OUT:
this.$store.commit("setLoginOut");
this.$store.dispatch("logout");
}
},

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-05-03 22:41:15
* @LastEditors: ch
* @LastEditTime: 2022-05-12 17:36:08
* @LastEditTime: 2022-05-12 18:11:55
* @Description: file content
-->
<template>
@ -72,19 +72,21 @@
</div>
</div>
</div>
<BsChosen></BsChosen>
</div>
</template>
<script>
import {ApiGetCartList, ApiDeleteCartGoods, ApiPutCartNum} from '@/plugins/api/cart';
import {Debounce} from '@/plugins/utils';
import UIGoodsInfo from '../../components/UIGoodsInfo.vue';
import UiButton from '../../components/UiButton.vue';
import UiMoney from '../../components/UiMoney.vue';
import UiEmpty from '../../components/UiEmpty.vue';
import UiLoading from '../../components/UiLoading.vue';
import UIGoodsInfo from '@/components/UIGoodsInfo.vue';
import UiButton from '@/components/UiButton.vue';
import UiMoney from '@/components/UiMoney.vue';
import UiEmpty from '@/components/UiEmpty.vue';
import UiLoading from '@/components/UiLoading.vue';
import BsChosen from '@/components/BsChosen.vue';
export default {
components: { UIGoodsInfo, UiButton, UiMoney, UiEmpty, UiLoading },
components: { UIGoodsInfo, UiButton, UiMoney, UiEmpty, UiLoading, BsChosen },
data(){
return {
isLoading : false,
@ -104,7 +106,6 @@ export default {
tempPrice += unitPrice * (item.number || 0)
});
return (tempPrice / 100).toFixed(2);
},
//
normalList(){
@ -276,6 +277,7 @@ export default {
td{
text-align: center;
padding: 40px 0;
border-bottom: 1px solid #ddd;
}
}
.operation{

@ -168,21 +168,22 @@
</div>
</div>
</section>
<UiChosen v-else></UiChosen>
<BsChosen v-else></BsChosen>
</div>
</template>
<script>
import UiMoney from "@/components/UiMoney.vue";
import UiButton from "@/components/UiButton.vue";
import UiGoodsItem from "@/components/UiGoodsItem.vue";
import UiChosen from "@/components/UiChosen.vue";
import BsChosen from "@/components/BsChosen.vue";
import {ApiPutAddCart} from "@/plugins/api/cart";
import {
ApiGetGoodsDetail,
ApiGetGoodsSkus,
ApiGetRecommendedGoodsList,
} from "@/plugins/api/goods";
export default {
componetns: { UiMoney, UiButton, UiGoodsItem, UiChosen },
componetns: { UiMoney, UiButton, UiGoodsItem, BsChosen },
data() {
return {
curBuyNum: 1,
@ -427,6 +428,27 @@ export default {
query,
});
},
/**
* 加入购物车
*/
async addCart(){
if(!this.curSku.skuId){
this.$message.error("请选择规格~");
return false;
}
const {error, result} = await ApiPutAddCart({
productSkuId : this.curSku.skuId,
productId : this.detailData.id,
number : this.curBuyNum
});
if(error){
this.$message.error(error.message);
return false;
}
this.$message.success('加入购物车成功~');
// this.$Router.push('/cart');
},
},
};
</script>

@ -70,7 +70,7 @@
<img class="main-none-img" src="@/assets/img/goods/none.png" alt="" />
<p class="main-none-txt">没有搜到你想要的商品哦换个关键词试试</p>
</main>
<UiChosen></UiChosen>
<BsChosen></BsChosen>
</div>
</template>
<script>
@ -81,9 +81,9 @@ import {
} from "@/plugins/api/goods";
import Sort from "./module/SortItem.vue";
import UiGoodsItem from "@/components/UiGoodsItem.vue";
import UiChosen from '@/components/UiChosen.vue';
import BsChosen from '@/components/BsChosen.vue';
export default {
components: { Sort, UiGoodsItem,UiChosen },
components: { Sort, UiGoodsItem,BsChosen },
data() {
return {
navActive: 0,

@ -34,6 +34,12 @@
:key="item.id"
></UiGoodsItem>
</div>
<UiPagination
:current-page="currentPage"
:page-size="query.length"
:total="total"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
@ -42,6 +48,7 @@
<script>
import UiGoodsItem from "@/components/UiGoodsItem.vue";
import UiPagination from "@/components/UiPagination.vue";
import {
ApiGetHomeSeckill,
ApiGetCurrentTime,
@ -58,7 +65,7 @@ const SECKILL_COUNT = 20; // 秒杀商品数
const NEW_COUNT = 5; //
export default {
components: { Banner, Seckil, Pick, UiGoodsItem },
components: { Banner, Seckil, Pick, UiGoodsItem, UiPagination },
async asyncData() {
//
const { result: seckillData } = await ApiGetHomeSeckill();
@ -102,11 +109,12 @@ export default {
return {
query: {
pageIndex: 1,
length: 15,
length: 20,
},
selectProducts: [],
total: 0,
loading: false,
currentPage: 0,
};
},
created() {
@ -129,9 +137,13 @@ export default {
if (result) {
const { total, records } = result;
this.total = total;
this.selectProducts = this.selectProducts.concat(records);
this.selectProducts = records;
}
},
handleCurrentChange(page) {
this.query.pageIndex = page;
this.getSelectProducts();
},
},
};
</script>

@ -75,22 +75,20 @@
</div>
<!-- 分页 -->
<div class="seckill-pagination flex flex-right">
<el-pagination
background
<UiPagination
:current-page="currentPage"
:page-size="query.length"
layout="prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
<el-button class="btn-confirm">确定</el-button>
<el-button class="btn-confirm">确定</el-button>
</UiPagination>
</div>
<DialogEnd :visible="seckillEndVisible" @close="handleClose" />
</div>
</template>
<script>
import UiPagination from "@/components/UiPagination.vue";
import {
ApiGetSeckillTimes,
ApiGetSeckillGoods,
@ -103,7 +101,7 @@ const PAGE_SIZE = 16;
export default {
name: "Sckill",
components: { TabBar, DialogEnd },
components: { TabBar, DialogEnd, UiPagination },
data() {
return {
bkgSckill: require("~/assets/img/sckill/bkg-large.png"),
@ -263,10 +261,6 @@ export default {
onJumpGoodsDetail(id) {
this.$router.push(`/goods/detail/${id}`);
},
handleSizeChange(size) {
this.query.length = size;
this.getGoodsList();
},
handleCurrentChange(page) {
this.query.pageIndex = page;
this.getGoodsList();
@ -396,35 +390,6 @@ export default {
}
.seckill-pagination {
margin-top: 60px;
/deep/.el-pagination {
.btn-prev,
.btn-next {
width: 32px;
height: 32px;
background: #ffffff;
border-radius: 2px;
border: 1px solid rgba(0, 0, 0, 0.2);
}
.el-pagination__jump {
color: #333333;
}
.el-pager {
.number {
width: 32px;
height: 32px;
line-height: 32px;
font-size: 14px;
background: #ffffff;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 2px;
}
.active {
color: #ffffff;
background: #ff512b;
border: none;
}
}
}
.btn-confirm {
width: 81px;
height: 32px;

@ -31,6 +31,10 @@ export const ApiPutUser = (data) =>
* @param {*} data
*/
export const ApiPostLogin = (data) => ToAsyncAwait(axios.post(`${BASE_URL}/user/login`, data));
/**
* 退出登录
*/
export const ApiPostLogout = () => ToAsyncAwait(axiosTk.get(`${BASE_URL}/user/logout`));
/**
* 获取手机验证码
* @param {*} params

@ -16,15 +16,15 @@ export default function ({$axios, store, route}, inject) {
config.headers.Authorization = store.state.token;
return config;
});
$axiosTk.onResponse(response => {
$axiosTk.onResponse(async response => {
const result = response.data;
if(response.status === 200){
if(result.code === 'SUCCESS'){
return result.data;
}
if(result.code === 'TOKEN_FAIL'){
alert('这里要弹登录')
store.commit('setLoginOut');
await store.dispatch('logout');
store.commit('setLoginVisible');
return result;
}
return Promise.reject(result);

@ -6,7 +6,7 @@
* @Description: file content
*/
import { TOKEN_KEY } from "@/constants";
import { ApiGetCurrentUser } from "@/plugins/api/account";
import { ApiGetCurrentUser, ApiPostLogout } from "@/plugins/api/account";
const ONE_DAY = 86400000; // 一天的毫秒数 24 * 60 * 60 * 1000;
const state = () => ({
@ -48,6 +48,12 @@ const actions = {
commit("setUserInfo", result);
}
},
// 退出登录
async logout({ commit }) {
await ApiPostLogout();
commit("setLoginOut");
},
};
export { state, mutations, actions };

Loading…
Cancel
Save