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

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

@ -147,11 +147,17 @@ export default {
Message.error("请勾选同意《用户协议》和《隐私协议》"); Message.error("请勾选同意《用户协议》和《隐私协议》");
return; return;
} }
const { result } = await ApiPostLogin({ const { result, error } = await ApiPostLogin({
...this.form, ...this.form,
clientId: 1, clientId: 1,
systemId: 3, systemId: 3,
}); });
if (error !== null) {
Message.error(
error.message || "登录失败,请检查手机号或验证码是否正确"
);
return;
}
if (result) { if (result) {
this.dialogTableVisible = false; this.dialogTableVisible = false;
this.$store.commit("setToken", result.token); 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 namespace: yanxuan
spec: spec:
ports: ports:
- port: 3000 - port: $JAR_PORD
protocol: TCP protocol: TCP
targetPort: 3000 targetPort: $JAR_PORD
selector: selector:
app: $IMAGES app: $IMAGES
type: ClusterIP type: ClusterIP

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

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

@ -168,21 +168,22 @@
</div> </div>
</div> </div>
</section> </section>
<UiChosen v-else></UiChosen> <BsChosen v-else></BsChosen>
</div> </div>
</template> </template>
<script> <script>
import UiMoney from "@/components/UiMoney.vue"; import UiMoney from "@/components/UiMoney.vue";
import UiButton from "@/components/UiButton.vue"; import UiButton from "@/components/UiButton.vue";
import UiGoodsItem from "@/components/UiGoodsItem.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 { import {
ApiGetGoodsDetail, ApiGetGoodsDetail,
ApiGetGoodsSkus, ApiGetGoodsSkus,
ApiGetRecommendedGoodsList, ApiGetRecommendedGoodsList,
} from "@/plugins/api/goods"; } from "@/plugins/api/goods";
export default { export default {
componetns: { UiMoney, UiButton, UiGoodsItem, UiChosen }, componetns: { UiMoney, UiButton, UiGoodsItem, BsChosen },
data() { data() {
return { return {
curBuyNum: 1, curBuyNum: 1,
@ -427,6 +428,27 @@ export default {
query, 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> </script>

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

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

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

@ -31,6 +31,10 @@ export const ApiPutUser = (data) =>
* @param {*} data * @param {*} data
*/ */
export const ApiPostLogin = (data) => ToAsyncAwait(axios.post(`${BASE_URL}/user/login`, 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 * @param {*} params

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

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

Loading…
Cancel
Save