diff --git a/Dockerfile b/Dockerfile index 1a27724..c59aafb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /workload COPY nuxt.config.js /workload/nuxt.config.js COPY package.json /workload/package.json COPY .nuxt /workload/.nuxt +COPY static /workload/static RUN npm config set registry https://registry.npm.taobao.org \ && npm install diff --git a/assets/img/home/icon-message.png b/assets/img/home/icon-message.png new file mode 100644 index 0000000..0c74a3d Binary files /dev/null and b/assets/img/home/icon-message.png differ diff --git a/assets/img/layout/icon-message-light.png b/assets/img/layout/icon-message-light.png new file mode 100644 index 0000000..d914729 Binary files /dev/null and b/assets/img/layout/icon-message-light.png differ diff --git a/assets/img/layout/icon-order-light.png b/assets/img/layout/icon-order-light.png new file mode 100644 index 0000000..844802b Binary files /dev/null and b/assets/img/layout/icon-order-light.png differ diff --git a/assets/img/layout/icon-phone-light.png b/assets/img/layout/icon-phone-light.png new file mode 100644 index 0000000..7fa48d7 Binary files /dev/null and b/assets/img/layout/icon-phone-light.png differ diff --git a/assets/img/sckill/bkg-large.png b/assets/img/sckill/bkg-large.png index bbb8f65..80c794a 100644 Binary files a/assets/img/sckill/bkg-large.png and b/assets/img/sckill/bkg-large.png differ diff --git a/components/BsAddress.vue b/components/BsAddress.vue index a34308c..b74d846 100644 --- a/components/BsAddress.vue +++ b/components/BsAddress.vue @@ -73,7 +73,7 @@ type="textarea" :rows="3" class="max-ipt" - maxlength="60" + maxlength="30" >
@@ -93,11 +93,14 @@ :class="!isAccount ? 'flex-column' : ''" > 设为默认地址 -
+
取消 item.isDefault); vm.curAddressListItem = curIndex > -1 ? vm.addressList[curIndex] : vm.addressList[0]; vm.$emit("getList", vm.addressList); vm.$emit("emitAddress", vm.curAddressListItem); } else { + vm.defaultAddress = true; vm.isOperation = true; } console.log("获取收货地址", res); @@ -242,6 +255,9 @@ export default { vm.$set(vm.selectData.area, "value", editItem.area); vm.$set(vm.selectData.city, "value", editItem.city); vm.$set(vm.selectData.province, "value", editItem.province); + vm.$set(vm.selectData.area, "code", editItem.areaCode); + vm.$set(vm.selectData.city, "code", editItem.cityCode); + vm.$set(vm.selectData.province, "code", editItem.provinceCode); vm.$set(vm, "detailAddress", editItem.detailAddress); vm.$set(vm, "defaultAddress", editItem.isDefault); vm.$set(vm, "addressUser", editItem.name); @@ -254,11 +270,12 @@ export default { this.dialogVisible = false; }, onSelected(data) { - console.log(data); this.selectData = data; }, async onAddAddress() { let vm = this; + let curItem = vm.addressList[vm.editIndex] + console.log(`vm.addressPhone != curItem.phone`,vm.addressPhone , curItem); if (!vm.selectData?.area?.code) { vm.$message.error("请选择所在区域~"); return; @@ -271,7 +288,7 @@ export default { vm.$message.error("请输入收货人~"); return; } - if (!IsPhone(vm.addressPhone)) { + if (!IsPhone(vm.addressPhone) && vm.addressPhone != curItem.phone) { vm.$message.error("请输入收货人手机号码~"); return; } @@ -410,6 +427,9 @@ export default { margin-right: 38px; } } + .clearmargin { + margin: 0 0 0 20px; + } } } diff --git a/components/BsChosen.vue b/components/BsChosen.vue index 1d74d0d..308f9c6 100644 --- a/components/BsChosen.vue +++ b/components/BsChosen.vue @@ -17,7 +17,7 @@
@@ -213,6 +233,11 @@ export default { width: 164px; height: 28px; margin-right: 50px; + cursor: pointer; + img { + width: 100%; + height: 100%; + } } .bar-header-wrap__icons { cursor: pointer; @@ -222,7 +247,7 @@ export default { } .header-wrap-icons__shop { position: relative; - margin-left: 14px; + margin-left: 20px; .wrap-icons-shop__tip { position: absolute; left: 18px; @@ -283,10 +308,11 @@ export default { @include layout-box; background: #ffffff; .bar-header-box__wrap { - height: 42px; + height: 40px; font-size: 14px; margin-bottom: 38px; padding-right: 50px; + cursor: pointer; .header-box-wrap__logo { width: 244px; height: 100%; @@ -297,6 +323,7 @@ export default { .search-input { width: 551px; z-index: 1; + border-radius: 4px; /deep/.el-input__inner:focus { border-color: #ff512b; } @@ -305,7 +332,7 @@ export default { width: 77px; margin-left: -2px; background: linear-gradient(270deg, #ffa25a 0%, #ff7f39 100%); - border-radius: 0px 8px 8px 0px; + border-radius: 0px 4px 4px 0px; z-index: 2; cursor: pointer; img { @@ -327,6 +354,9 @@ export default { font-size: 16px; color: #666666; cursor: pointer; + &:hover { + color: #ff875b; + } } } } diff --git a/middleware/redirect.js b/middleware/redirect.js new file mode 100644 index 0000000..f31f846 --- /dev/null +++ b/middleware/redirect.js @@ -0,0 +1,10 @@ +export default function ({ app, route, redirect }) { + if (!app.store.state.token) { + // 未登录直接打开需要登录的页面,跳转首页 + const needLoginPage = [/\/account/, /\/cart/]; + const result = needLoginPage.some((item) => item.test(route.path)); + if (result) { + redirect("/"); + } + } +} diff --git a/nuxt.config.js b/nuxt.config.js index c9c4aef..1288de9 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -19,7 +19,7 @@ export default { { name: 'format-detection', content: 'telephone=no' } ], link: [ - { rel: 'icon', type: 'image/x-icon', href: '/logo.png' } + { rel: 'icon', type: 'image/x-icon', href: '/logo.ico' } ] }, router: { @@ -29,7 +29,8 @@ export default { path: '/', component: resolve(__dirname, 'pages/index/index.vue') }) - } + }, + middleware: ['redirect'] }, // Global CSS: https://go.nuxtjs.dev/config-css @@ -45,7 +46,8 @@ export default { '@plugins/axiosTk.js', '@plugins/vue-inject.js', '@/plugins/v-distpicker', - '@/plugins/router' + '@/plugins/router', + '@/plugins/im' ], // Auto import components: https://go.nuxtjs.dev/config-components diff --git a/pages/account/index/message.vue b/pages/account/index/message.vue index cf66be9..3275547 100644 --- a/pages/account/index/message.vue +++ b/pages/account/index/message.vue @@ -11,7 +11,7 @@

消息通知

-
+
- {{ item.payload.title || `马士兵严选上新啦` }} + {{ JSON.parse(item.payload).title || `` }} {{ item.createTimeStamp }}
{{ - item.payload.content || - `马士兵严选上新啦!!走过路过不要错过,大家快来看看...` + JSON.parse(item.payload).content || + `` }}
@@ -40,58 +40,15 @@ import { mapState } from "vuex"; export default { data() { - return { - Socket: null, - msgList: [], - }; + return {}; }, computed: { - ...mapState(["token"]), + ...mapState(["token","socketMsgData"]), }, - mounted() { - // let url = `ws://192.168.10.93:8090/ws?client=eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjQwNzA4ODAwMDAsImlkIjoyLCJ0aW1lIjoxNjUyNDQyMDIyMjE4fQ.ybPvJ-pkywqzBgAK9Lv_7yme50cGhtTvzVcfp-kLyjlzKpsgcvQrhd_FhCHZo-eUEN-OuotoLblU94UMa_oKZ1TU78gjzPWeUpUO9LZVOs0HKIxeFmPbJTe0js5Ckw79p8uTNyO6p9DmZTb3TsX9OmoNoeTDkZLMiJsIXEi9eRU&type=1`; - let url = `wss://k8s-horse-gateway.mashibing.cn/ws?client=${this.token}&type=1`; - this.socket(url); - }, - methods: { - socket(url) { - let vm = this; - vm.Socket = new WebSocket(url); - vm.Socket.onopen = () => { - let traceId = Math.random(); - vm.Socket.send( - `{"traceId":${traceId},traceType:1,"content":{"size": 100}}` - ); - }; - vm.Socket.onclose = () => { - vm.Socket = null; - }; - vm.Socket.onerror = () => { - if (vm.Socket.readyState !== 3) { - if (vm.reconnection > 3) { - // vm.$message.error("链接失败!"); - return; - } - } - }; - vm.Socket.onmessage = (e) => { - if (e.data == `pong`) { - return; - } - let msg = JSON.parse(e.data); - console.log("websocket收到消息", msg); - if (msg.traceType == 1) { - let traceId = Math.random(); - let sys = msg.content.sessionVOS.find((item) => item.type != 3); - let str = `{"traceId":${traceId},traceType:2,"content":{"sessionId":${sys.id}}}`; - vm.Socket.send(str); - } - if (msg.traceType == 2) { - vm.msgList = msg.content; - } - }; - }, + mounted(){ + console.log(`socketMsgData`,this.$store.state) }, + methods: {}, }; diff --git a/pages/account/index/order/saleAfter/list.vue b/pages/account/index/order/saleAfter/list.vue index e69de29..a69994a 100644 --- a/pages/account/index/order/saleAfter/list.vue +++ b/pages/account/index/order/saleAfter/list.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/pages/account/index/userInfo.vue b/pages/account/index/userInfo.vue index e00f4a5..9a22876 100644 --- a/pages/account/index/userInfo.vue +++ b/pages/account/index/userInfo.vue @@ -92,9 +92,21 @@ export default { computed: { ...mapState(["userInfo", "token"]), }, + watch: { + userInfo: { + deep: true, + handler(val) { + if (val && Object.keys(val).length > 0) { + this.initData(); + } + }, + }, + }, created() { - this.initData(); this.getOssConfig(); + if (this.userInfo && Object.keys(this.userInfo).length > 0) { + this.initData(); + } }, methods: { initData() { diff --git a/pages/goods/detail/_id.vue b/pages/goods/detail/_id.vue index b53ae9a..467365a 100644 --- a/pages/goods/detail/_id.vue +++ b/pages/goods/detail/_id.vue @@ -1,14 +1,51 @@