diff --git a/assets/css/style.less b/assets/css/style.less
index 5c4efe8..4f05928 100644
--- a/assets/css/style.less
+++ b/assets/css/style.less
@@ -2135,7 +2135,7 @@ flex: 0 2.4*100rpx;
.shoppingCart .footer .checkAll {
font-size: 0.28*100rpx;
color: #282828;
- margin-left: 0.6*100rpx;
+ margin-left: 0.1*100rpx;
}
.shoppingCart .footer .money {
diff --git a/main.js b/main.js
index 671b2b0..77f891d 100644
--- a/main.js
+++ b/main.js
@@ -76,28 +76,32 @@ Object.defineProperty(Vue.prototype, '$yroute', {
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
-
-
// #ifdef H5
// H5编译的代码
-Vue.prototype.$deviceType = 'h5'
+Vue.prototype.$deviceType = 'h5'
+store.commit('UPDATE_DEVICETYPE','h5')
// #endif
// #ifdef APP-PLUS
-// App平台编译的代码
-Vue.prototype.$deviceType = 'app'
+// App平台编译的代码
+console.log('App平台编译的代码')
+Vue.prototype.$deviceType = 'app'
+store.commit('UPDATE_DEVICETYPE','app')
Vue.prototype.$platform = uni.getSystemInfoSync().platform
// #endif
// #ifdef MP-WEIXIN
-// 微信小程序编译的代码
-Vue.prototype.$deviceType = 'weixin'
+// 微信小程序编译的代码
+console.log('微信小程序编译的代码')
+Vue.prototype.$deviceType = 'weixin'
+store.commit('UPDATE_DEVICETYPE','weixin')
// #endif
-
-console.log(wx,121212)
-console.log(Vue.prototype.$deviceType)
-// if(wx){
-// Vue.prototype.$deviceType = 'weixin'
-// }
-
+
+// !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用
+// 建议通过 store 去获取 $deviceType 可以保证 template 中取到的值有效
+// import { mapState, mapMutations, mapActions } from 'vuex';
+// computed: {
+// ...mapState(['$deviceType'])
+// },
+
app.$mount()
diff --git a/pages/activity/GoodsSeckill/index.vue b/pages/activity/GoodsSeckill/index.vue
index 77f91a0..7cb0176 100644
--- a/pages/activity/GoodsSeckill/index.vue
+++ b/pages/activity/GoodsSeckill/index.vue
@@ -1,223 +1,201 @@
-
-
-
-
-
-
- {{ item.time }}
- {{ item.state }}
-
-
- 活动已结束
-
- 活动即将开始
-
-
-
-
-
-
-
-
-
- 限时价
-
-
-
-
-
-
-
- 马上抢
- 已售磬
- 即将开始
- 已结束
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ item.time }}
+ {{ item.state }}
+
+
+
+
+
+ 活动已结束
+
+ 活动即将开始
+
+
+
+
+
+
+
+ 限时价
+
+
+
+
+
+
+
+ 马上抢
+ 已售磬
+ 即将开始
+ 已结束
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/authorization/index.vue b/pages/authorization/index.vue
index f823cab..7064644 100644
--- a/pages/authorization/index.vue
+++ b/pages/authorization/index.vue
@@ -1,214 +1,209 @@
-
-
- 您还未允许微信登录授权,请点击下方按钮允许微信授权登录。
-
-
-
+
+
+
+ 您还未允许微信登录授权,请点击下方按钮允许微信授权登录。
+
+
+
+
-
-
-
- 请先登录
-
+
+
+ 请先登录
+
+
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 7d8b7c1..730a67d 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -1,313 +1,269 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 最新
- {{ item.info }}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ item.name }}
-
-
-
-
-
-
- 热门榜单
-
-
- 更多
-
-
-
-
-
-
-
-
-
-
- {{ item.storeName }}
- ¥{{ item.price }}
-
-
-
-
-
-
-
-
- 精品推荐
-
-
- 更多
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 最新
+ {{ item.info }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+ 热门榜单
+
+ 更多
+
+
+
+
+
+
+
+
+ {{ item.storeName }}
+ ¥{{ item.price }}
+
+
+
+
+
+
+
+ 精品推荐
+
+ 更多
+
+
+
+
+
-
-
-
-
- 首发新品
- NEW~
-
-
-
- 更多
-
-
-
-
-
-
-
-
-
-
- {{ item.storeName }}
- ¥{{ item.price }}
-
-
-
-
-
-
-
-
- 促销单品
-
-
- 更多
-
-
-
-
-
-
-
+
+
+
+
+ 首发新品
+ NEW~
+
+
+
+ 更多
+
+
+
+
+
+
+
+
+ {{ item.storeName }}
+ ¥{{ item.price }}
+
+
+
+
+
+
+
+ 促销单品
+
+ 更多
+
+
+
+
+
+
+
+
diff --git a/pages/shop/ShoppingCart/index.vue b/pages/shop/ShoppingCart/index.vue
index 5114bda..07cde0b 100644
--- a/pages/shop/ShoppingCart/index.vue
+++ b/pages/shop/ShoppingCart/index.vue
@@ -1,135 +1,110 @@
-
-
-
-
- 100%正品保证
-
-
- 所有商品精挑细选
-
-
- 售后无忧
-
-
-
-
- 购物数量
- {{ count }}
-
- {{ footerswitch ? "取消" : "管理" }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ item.productInfo.storeName }}
- 属性:{{ item.productInfo.attrInfo.suk }}
- ¥{{ item.truePrice }}
-
-
- -
- {{ item.cartNum }}
- +
- +
-
-
-
-
-
-
-
- 失效商品
-
-
- 清空
-
-
-
-
-
- 失效
-
-
-
-
-
- {{ item.productInfo.storeName }}
- 属性:{{ item.productInfo.attrInfo.suk }}
-
- 该商品已下架
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
- ¥{{ countmoney }}
- 立即下单
-
-
- 收藏
- 删除
-
-
-
-
-
+
+
+
+
+
+
+
+ ¥{{ countmoney }}
+ 立即下单
+
+
+ 收藏
+ 删除
+
+
+
+
+
+
diff --git a/store/index.js b/store/index.js
index d509251..bba8473 100644
--- a/store/index.js
+++ b/store/index.js
@@ -5,105 +5,126 @@ Vue.use(Vuex);
const debug = process.env.NODE_ENV !== "production";
import store from "@/utils/store/cookie";
-import { getUserInfo } from "@/api/user";
+import {
+ getUserInfo
+} from "@/api/user";
import dialog from "@/utils/dialog";
const LOGIN_KEY = "login_status";
const vuexStore = new Vuex.Store({
- state: {
- // 是否已经在授权页面
- isAuthorizationPage: false,
- // 是否授权
- isAuthorization: false,
- token: store.get(LOGIN_KEY) || null,
- userInfo: store.get('userInfo')
- },
- mutations: {
- SHOW_FOOTER(state) {
- state.footer = true;
- },
- HIDE_FOOTER(state) {
- state.footer = false;
- },
- SHOW_HOME(state) {
- state.home = true;
- },
- HIDE_HOME(state) {
- state.home = false;
- },
- OPEN_HOME(state) {
- state.homeActive = true;
- },
- CLOSE_HOME(state) {
- state.homeActive = false;
- },
- CHANGE_TABTAR(state, index) {
- state.tabtarIndex = index;
- },
- LOGIN(state, token, expires_time) {
- state.token = token;
- store.set(LOGIN_KEY, token, expires_time);
- },
- LOGOUT(state) {
- state.token = null;
- state.userInfo = null
- store.clearAll()
- },
- BACKGROUND_COLOR(state, color) {
- state.color = color;
- // document.body.style.backgroundColor = color;
- },
- UPDATE_USERINFO(state, userInfo) {
- state.userInfo = userInfo;
- },
- UPDATE_AUTHORIZATIONPAGE(state, isAuthorizationPage) {
- state.isAuthorizationPage = isAuthorizationPage;
- },
- UPDATE_AUTHORIZATION(state, isAuthorization) {
- state.isAuthorization = isAuthorization;
- },
- },
- actions: {
- USERINFO({ state, commit }, force) {
- if (state.userInfo !== null && !force)
- return Promise.resolve(state.userInfo);
- else
- return new Promise(reslove => {
- getUserInfo().then(res => {
- commit("UPDATE_USERINFO", res.data);
- reslove(res.data);
- });
- }).catch(() => {
- dialog.error("获取信息失败!");
- });
- },
- changeLogin({ state, commit }, data, date) {
- commit("LOGIN", data, date);
- },
- setUserInfo({ state, commit }, user) {
- commit("UPDATE_USERINFO", user);
- if (user) {
- store.set('userInfo', user)
- } else {
- store.set('userInfo', null)
- }
- },
- changeAuthorizationPage({ state, commit }, index) {
- commit("UPDATE_AUTHORIZATIONPAGE", index);
- },
- changeAuthorization({ state, commit }, index) {
- commit("UPDATE_AUTHORIZATION", index);
- },
- },
- getters: {
- isAuthorizationPage: state => state.isAuthorizationPage,
- isAuthorization: state => state.isAuthorization,
- token: state => state.token,
- isLogin: state => !!state.token,
- userInfo: state => state.userInfo || {},
- },
- strict: debug
+ state: {
+ // 是否已经在授权页面
+ isAuthorizationPage: false,
+ // 是否授权
+ isAuthorization: false,
+ token: store.get(LOGIN_KEY) || null,
+ userInfo: store.get('userInfo'),
+ $deviceType: null,
+ },
+ mutations: {
+ SHOW_FOOTER(state) {
+ state.footer = true;
+ },
+ HIDE_FOOTER(state) {
+ state.footer = false;
+ },
+ SHOW_HOME(state) {
+ state.home = true;
+ },
+ HIDE_HOME(state) {
+ state.home = false;
+ },
+ OPEN_HOME(state) {
+ state.homeActive = true;
+ },
+ CLOSE_HOME(state) {
+ state.homeActive = false;
+ },
+ CHANGE_TABTAR(state, index) {
+ state.tabtarIndex = index;
+ },
+ LOGIN(state, token, expires_time) {
+ state.token = token;
+ store.set(LOGIN_KEY, token, expires_time);
+ },
+ LOGOUT(state) {
+ state.token = null;
+ state.userInfo = null
+ store.clearAll()
+ },
+ BACKGROUND_COLOR(state, color) {
+ state.color = color;
+ // document.body.style.backgroundColor = color;
+ },
+ UPDATE_USERINFO(state, userInfo) {
+ state.userInfo = userInfo;
+ },
+ UPDATE_AUTHORIZATIONPAGE(state, isAuthorizationPage) {
+ state.isAuthorizationPage = isAuthorizationPage;
+ },
+ UPDATE_AUTHORIZATION(state, isAuthorization) {
+ state.isAuthorization = isAuthorization;
+ },
+ UPDATE_DEVICETYPE(state, $deviceType) {
+ state.$deviceType = $deviceType;
+ },
+ },
+ actions: {
+ USERINFO({
+ state,
+ commit
+ }, force) {
+ if (state.userInfo !== null && !force)
+ return Promise.resolve(state.userInfo);
+ else
+ return new Promise(reslove => {
+ getUserInfo().then(res => {
+ commit("UPDATE_USERINFO", res.data);
+ reslove(res.data);
+ });
+ }).catch(() => {
+ dialog.error("获取信息失败!");
+ });
+ },
+ changeLogin({
+ state,
+ commit
+ }, data, date) {
+ commit("LOGIN", data, date);
+ },
+ setUserInfo({
+ state,
+ commit
+ }, user) {
+ commit("UPDATE_USERINFO", user);
+ if (user) {
+ store.set('userInfo', user)
+ } else {
+ store.set('userInfo', null)
+ }
+ },
+ changeAuthorizationPage({
+ state,
+ commit
+ }, index) {
+ commit("UPDATE_AUTHORIZATIONPAGE", index);
+ },
+ changeAuthorization({
+ state,
+ commit
+ }, index) {
+ commit("UPDATE_AUTHORIZATION", index);
+ },
+ },
+ getters: {
+ isAuthorizationPage: state => state.isAuthorizationPage,
+ isAuthorization: state => state.isAuthorization,
+ token: state => state.token,
+ isLogin: state => !!state.token,
+ userInfo: state => state.userInfo || {},
+ },
+ strict: debug
});
-export default vuexStore
+export default vuexStore
diff --git a/utils/index.js b/utils/index.js
index f919897..b2beca1 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -117,7 +117,6 @@ export const replaceLogin = (msg) => {
icon: 'none',
duration: 2000
});
- console.log(Vue.prototype.$deviceType)
// 这里代表已经失去登录状态以及401强制推出登录了
store.commit('LOGOUT')
console.log(uni, 989)
diff --git a/utils/request.js b/utils/request.js
index 6bb0b15..bde4257 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -45,7 +45,7 @@ function baseRequest(options) {
...option
}).then(res => {
console.log(res)
- console.log(url,params,data, ...option)
+ // console.log(url,params,data, ...option)
const data = res.data || {};
if (res.status !== 200)
return Promise.reject({ msg: "请求失败", res, data });