diff --git a/package.json b/package.json index f21f34a..8266f86 100644 --- a/package.json +++ b/package.json @@ -29,12 +29,13 @@ "vue-content-loader": "^0.2.3", "vue-router": "^3.5.1", "vue-scrollto": "^2.20.0", - "vuex": "^3.6.2" + "vuex": "^3.6.2", + "weixin-js-sdk": "^1.6.5" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.5.11", "@vue/cli-plugin-eslint": "^4.5.11", - "@vue/cli-service": "^4.5.11", + "@vue/cli-service": "^4.5.19", "babel-eslint": "^10.1.0", "babel-plugin-import": "^1.13.3", "cross-env": "^7.0.3", @@ -46,13 +47,14 @@ "eslint-plugin-vue": "^6.2.2", "less": "^3.13.1", "less-loader": "^5.0.0", - "postcss-mobile-forever": "^0.0.1", + "postcss-px-to-viewport": "^1.1.1", "postcss-preset-env": "^6.7.0", "sass": "^1.32.10", "sass-loader": "^9.0.3", "svg-sprite-loader": "^4.2.1", "svgo": "^1.3.2", - "vue-template-compiler": "^2.6.12" + "vue-template-compiler": "^2.6.12", + "mini-css-extract-plugin": "2.5.3" }, "browserslist": [ "> 1%", diff --git a/postcss.config.js b/postcss.config.js index 4761f10..ed64934 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -2,16 +2,22 @@ module.exports = { plugins: { // https://github.com/csstools/postcss-preset-env 'postcss-preset-env': {}, - // https://github.com/wswmsword/postcss-mobile-forever - 'postcss-mobile-forever': { - viewportWidth: file => /vant[\\/]/.test(file) ? 375 : 750, - maxDisplayWidth: 560, + // https://github.com/evrone/postcss-px-to-viewport/blob/master/README_CN.md + 'postcss-px-to-viewport': { + unitToConvert: 'px', + viewportWidth: 750, unitPrecision: 3, propList: ['*'], - selectorBlackList: ['.ignore'], - rootContainingBlockSelectorList: ['van-popup--bottom'], - disableLandscape: true, - disableDesktop: true + viewportUnit: 'vw', + fontViewportUnit: 'vw', + selectorBlackList: ['.ignore', 'van'], + minPixelValue: 1, + mediaQuery: false, + replace: true, + exclude: [], + landscape: false, + landscapeUnit: 'vw', + landscapeWidth: 568 } } } diff --git a/src/api/login.js b/src/api/login.js index a2e20c4..ba963c4 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -7,11 +7,11 @@ export function getCaptcha() { }) } -export function getMailCode(data) { +export function getMobileCode(data) { return request({ - url: '/sendEmailCode', + url: '/genMobileCode', method: 'post', data, - timeout: 20000 + timeout: 5000 }) } diff --git a/src/api/order.js b/src/api/order.js index cb23acb..41b8f11 100644 --- a/src/api/order.js +++ b/src/api/order.js @@ -65,3 +65,26 @@ export function orderConfirm(orderId) { }) } +export function orderCoupon(data) { + return request({ + url: `/coupon/list`, + method: 'get', + params: data + }) +} + +export function orderCouponMy(data) { + return request({ + url: `/coupon/myList`, + method: 'get', + params: data + }) +} + +export function orderReceive(data) { + return request({ + url: '/coupon/receive', + method: 'post', + data + }) +} diff --git a/src/components/GoodsItem/index.vue b/src/components/GoodsItem/index.vue index 0ee4b1b..0fcc8f7 100644 --- a/src/components/GoodsItem/index.vue +++ b/src/components/GoodsItem/index.vue @@ -4,16 +4,19 @@

{{ title }}

- ¥{{ price | yuan }} - ¥{{ discount | yuan }} + ¥{{ price | yuan }} + +
+
+ 已售:{{ virtualSales || 0 }}
加入购物车 @@ -74,7 +74,7 @@ export default { width: 510px; height: 240px; .desc__top { - margin-top: 10px; + margin-top: 30px; .desc__top__title { font-size: $small; color: $black; diff --git a/src/components/Wx/index.js b/src/components/Wx/index.js index f281106..e2b1013 100644 --- a/src/components/Wx/index.js +++ b/src/components/Wx/index.js @@ -19,11 +19,13 @@ export async function initWechatWebview() { jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData'] // 必填,需要使用的JS接口列表 }) wx.error(function(res) { - alert('wx error: ' + res) + // alert('wx error: ' + res) // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 }) } catch (e) { console.log(e) + return false } + return true } Vue.prototype.wxJsSdkInit = initWechatWebview diff --git a/src/main.js b/src/main.js index f07ff7a..1120440 100644 --- a/src/main.js +++ b/src/main.js @@ -15,6 +15,7 @@ import './permission' // import vant import '@/components/Vant' +import '@/components/Wx' // import fontAwesome import '@/components/fontAwesome' // register common components globally diff --git a/src/permission.js b/src/permission.js index f7cc3d0..34ea159 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,7 +4,7 @@ import { Toast } from 'vant' import { getToken } from '@/utils/auth' // get token from cookie import { pathMatcher } from '@/utils/index' -const whiteList = ['/login', '/registry', '/', '/index', '/category', '/detail/**', '/diamondGoodsList/**', '/search/**'] // 白名单 +const whiteList = ['/login', '/registry', '/', '/index', '/category', '/detail/**', '/diamondGoodsList/**', '/search/**', '/order/coupon'] // 白名单 router.beforeEach(async(to, from, next) => { // 设置标题 @@ -39,6 +39,7 @@ router.beforeEach(async(to, from, next) => { } } else { if (pathMatcher(whiteList, to.path)) { + console.log(to.path) next() } else { // 反之则去登录页面 diff --git a/src/router/index.js b/src/router/index.js index 091fd47..a44f322 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -30,7 +30,7 @@ const routes = [ { path: '/registry', name: 'Registry', - component: () => import('@/views/auth/registry'), + component: () => import('@/views/auth/login'), meta: { title: '注册' } @@ -262,6 +262,26 @@ const routes = [ props: true, component: () => import('@/views/order/payStatus') }, + // 优惠券 + { + path: '/order/coupon', + name: 'coupon', + component: () => import('@/views/order/coupon'), + meta: { + title: '优惠券', + showTab: true + } + }, + // 优惠券 + { + path: '/order/my', + name: 'couponMy', + component: () => import('@/views/order/my'), + meta: { + title: '优惠券', + showTab: true + } + }, // 评论页面 { path: '/goodsComment/:orderGoodsId/:goodsId', diff --git a/src/store/modules/user.js b/src/store/modules/user.js index d643634..dddc9ac 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -22,9 +22,9 @@ const mutations = { const actions = { // 登录 login({ commit }, userInfo) { - const { mobile, password } = userInfo + const { mobile, yzm } = userInfo return new Promise((resolve, reject) => { - login({ mobile, password }) + login({ mobile, yzm }) .then(res => { const { data } = res commit('SET_TOKEN', data) diff --git a/src/utils/request.js b/src/utils/request.js index d96ef5c..6202fe1 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -53,6 +53,9 @@ service.interceptors.response.use( if (res.code === 5001) { return Promise.reject(new Error(res.msg || 'Error')) } + if (res.code === 50148) { + return res + } Toast.fail(res.msg) return Promise.reject(new Error(res.msg || 'Error')) } else { diff --git a/src/views/auth/login.vue b/src/views/auth/login.vue index 4adc1e1..cd94f1d 100644 --- a/src/views/auth/login.vue +++ b/src/views/auth/login.vue @@ -1,39 +1,47 @@ @@ -139,9 +194,47 @@ export default { } .form { - // background: red; + margin-top:200px; padding: 24px; - // margin-top: 50px; + .title-big{ + font-size: 42px; + color: #000; + font-weight: normal; + padding: 0 20px 20px 20px; + } + .title { + color: #b6b6b6; + padding: 0 20px 40px 20px; + } + ::v-deep .van-cell{ + border-bottom: 1px solid #b6b6b6; + line-height: 40px; + } + ::v-deep .van-cell:after{ + display: none; + } + } + ::v-deep .van-checkbox{ + position: absolute; + bottom: -40vh; + left: 50%; + transform: translateX(-50%); + width: max-content; + + .van-checkbox__label{ + color: #b6b6b6; + } + } + + .submitDiv{ + margin:15vw auto 0; + width: max-content; + } + .submitBtn{ + background-color: crimson; + border: none; + width:500px; + font-size: 30px; } } diff --git a/src/views/auth/registry.vue b/src/views/auth/registry.vue deleted file mode 100644 index 33dd4d8..0000000 --- a/src/views/auth/registry.vue +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - diff --git a/src/views/cart/modules/Tabbar.vue b/src/views/cart/modules/Tabbar.vue index ade1852..b0d037a 100644 --- a/src/views/cart/modules/Tabbar.vue +++ b/src/views/cart/modules/Tabbar.vue @@ -69,6 +69,6 @@ export default { box-shadow: var(--submit-bar-shadow); } .van-submit-bar { - bottom: 100px; + bottom: 50px; } diff --git a/src/views/category/index.vue b/src/views/category/index.vue index 20e3416..5591baa 100644 --- a/src/views/category/index.vue +++ b/src/views/category/index.vue @@ -16,7 +16,7 @@ - {{ single.text }} + {{ single.text }}
@@ -108,6 +108,9 @@ export default { } } } + .textName{ + margin-top: 20px; + } } } diff --git a/src/views/detail/index.vue b/src/views/detail/index.vue index d854c06..41590d3 100644 --- a/src/views/detail/index.vue +++ b/src/views/detail/index.vue @@ -1,9 +1,9 @@ @@ -14,7 +15,7 @@ diff --git a/src/views/detail/modules/Section.vue b/src/views/detail/modules/Section.vue index eabd979..34ead95 100644 --- a/src/views/detail/modules/Section.vue +++ b/src/views/detail/modules/Section.vue @@ -15,7 +15,7 @@ :value="selectedAddress.address || '选择收货地址'" @click="handleAddress" /> - + - + @@ -61,14 +61,14 @@