diff --git a/components/my-login/my-login.vue b/components/my-login/my-login.vue
new file mode 100755
index 0000000..90e7bdc
--- /dev/null
+++ b/components/my-login/my-login.vue
@@ -0,0 +1,106 @@
+
+
+
+
+ 登录后尽享更多权益
+
+
+
+
+
+
diff --git a/components/my-search/my-search.vue b/components/my-search/my-search.vue
new file mode 100755
index 0000000..45d1870
--- /dev/null
+++ b/components/my-search/my-search.vue
@@ -0,0 +1,74 @@
+
+
+ 请选择演练场景
+
+
+
+
+
+ 搜索场景
+
+
+
+
+
+
+
+
diff --git a/components/my-userinfo/my-userinfo.vue b/components/my-userinfo/my-userinfo.vue
new file mode 100755
index 0000000..7c273a4
--- /dev/null
+++ b/components/my-userinfo/my-userinfo.vue
@@ -0,0 +1,183 @@
+
+
+
+
+
+ {{userinfo.nickName}}
+
+
+
+
+
+
+
+
+ 8
+ 收藏的店铺
+
+
+ 14
+ 收藏的商品
+
+
+ 18
+ 关注的商品
+
+
+ 84
+ 足迹
+
+
+
+
+
+
+
+ 我的订单
+
+
+
+
+ 待付款
+
+
+
+ 待收货
+
+
+
+ 退款/退货
+
+
+
+ 全部订单
+
+
+
+
+
+
+
+ 收货地址
+
+
+
+ 联系客服
+
+
+
+ 退出登录
+
+
+
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
index 31b1016..5bb89f4 100644
--- a/main.js
+++ b/main.js
@@ -2,6 +2,7 @@
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
+import store from '@/store/store.js'
//导入网络请求的包
import {$http} from '@escook/request-miniprogram'
@@ -16,6 +17,7 @@ $http.beforeRequest = function(options) {
})
}
+
$http.afterRequest = function(options) {
uni.hideLoading()
}
@@ -33,7 +35,8 @@ Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
- ...App
+ ...App,
+ store
})
app.$mount()
// #endif
diff --git a/mixins/tabbar-badge.js b/mixins/tabbar-badge.js
new file mode 100755
index 0000000..d89dcad
--- /dev/null
+++ b/mixins/tabbar-badge.js
@@ -0,0 +1,23 @@
+import { mapGetters } from 'vuex'
+
+export default {
+ computed: {
+ ...mapGetters('m_cart', ['total'])
+ },
+ watch: {
+ total() {
+ this.setBadge()
+ }
+ },
+ onShow() {
+ this.setBadge()
+ },
+ methods: {
+ setBadge() {
+ uni.setTabBarBadge({
+ index: 2,
+ text: this.total + ''
+ })
+ }
+ }
+}
diff --git a/pages.json b/pages.json
index e10c702..07da6f8 100644
--- a/pages.json
+++ b/pages.json
@@ -20,7 +20,8 @@
"style" :
{
"navigationBarTitleText" : "全民演练",
- "enablePullDownRefresh" : false
+ "enablePullDownRefresh" : false,
+ "navigationStyle": "custom"
}
},
{
@@ -31,6 +32,22 @@
"enablePullDownRefresh" : false
}
}],
+ "subPackages": [
+ {
+ "root": "subpkg",
+ "pages": [
+ {
+ "path": "list/list",
+ "style" :
+ {
+ "navigationBarTitleText" : "场景演练",
+ "navigationBarTextStyle": "black",
+ "enablePullDownRefresh" : false
+ }
+ }
+ ]
+ }
+ ],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "全民演练",
diff --git a/pages/index/index.vue b/pages/index/index.vue
index f252c4f..96cfad6 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -6,16 +6,13 @@
-
-
+
@@ -28,6 +25,8 @@
return {
//顶部图片
topImg: "",
+ leftImg: "",
+ rightImg: "",
//轮播图数据列表
swiperList: [],
//场景入口
@@ -43,22 +42,30 @@
const {
data: res
- } = await uni.$http.post('/small/customImage/listAll')
+ } = await uni.$http.post('/small/customImage/listAll',{page:'home'})
if (!res.success) return uni.$showMsg()
res.data.forEach(item=>{
- item.uploadPath = 'http://localhost:85' +item.uploadPath
+ item.uploadPath = uni.$http.baseUrl +item.uploadPath
if (item.position === "top"){
this.topImg = item.uploadPath
- } else if(item.position === "middle"){
+ } else if(item.position.indexOf("banner") !=-1){
this.swiperList.push(item.uploadPath)
- } else if(item.position === "bottom"){
- this.sceneList.push(item.uploadPath)
+ } else if(item.position.indexOf("bottom-left") !=-1){
+ this.leftImg = item.uploadPath
+ } else if(item.position.indexOf("bottom-right") !=-1){
+ this.rightImg = item.uploadPath
}
})
-
+ this.sceneList.push(this.leftImg)
+ this.sceneList.push(this.rightImg)
uni.$showMsg('数据请求成功!')
},
+ navClickHandler(item) {
+ uni.navigateTo({
+ url: '/subpkg/list/list'
+ })
+ },
}
}
@@ -66,13 +73,13 @@
+
diff --git a/pages/scan/scan.vue b/pages/scan/scan.vue
index 6cc1cbf..3740b45 100644
--- a/pages/scan/scan.vue
+++ b/pages/scan/scan.vue
@@ -6,10 +6,27 @@
diff --git a/store/store.js b/store/store.js
new file mode 100644
index 0000000..f212b44
--- /dev/null
+++ b/store/store.js
@@ -0,0 +1,15 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+import moduleUser from '@/store/user.js'
+
+Vue.use(Vuex)
+
+const store = new Vuex.Store({
+ modules: {
+ // 挂载用户的 vuex 模块,模块内成员的访问路径被调整为 m_user,例如:
+ // 用户模块中 user 数组的访问路径是 m_user/user
+ 'm_user': moduleUser
+ }
+})
+
+export default store
diff --git a/store/user.js b/store/user.js
new file mode 100755
index 0000000..f82e50e
--- /dev/null
+++ b/store/user.js
@@ -0,0 +1,56 @@
+export default {
+ // 开启命名空间
+ namespaced: true,
+
+ // 数据
+ state: () => ({
+ address: JSON.parse(uni.getStorageSync('address') || '{}'),
+ token: uni.getStorageSync('token') || '',
+ // 用户的信息对象
+ userinfo: JSON.parse(uni.getStorageSync('userinfo') || '{}'),
+ // 重定向的 Object 对象
+ redirectInfo: null
+ }),
+
+ // 方法
+ mutations: {
+ // 更新收货地址
+ updateAddress(state, address) {
+ state.address = address
+
+ this.commit('m_user/saveAddressToStorage')
+ },
+ // 持久化存储 address
+ saveAddressToStorage(state) {
+ uni.setStorageSync('address', JSON.stringify(state.address))
+ },
+ updateUserInfo(state, userinfo) {
+ state.userinfo = userinfo
+
+ this.commit('m_user/saveUserInfoToStorage')
+ },
+ saveUserInfoToStorage(state) {
+ uni.setStorageSync('userinfo', JSON.stringify(state.userinfo))
+ },
+ updateToken(state, token) {
+ state.token = token
+ this.commit('m_user/saveTokenToStorage')
+ },
+ saveTokenToStorage(state) {
+ uni.setStorageSync('token', state.token)
+ },
+ updateRedirectInfo(state, info) {
+ state.redirectInfo = info
+ console.log(state.redirectInfo)
+ }
+ },
+
+ getters: {
+ // 收货地址
+ addstr(state) {
+ if (!state.address.provinceName) return ''
+
+ return state.address.provinceName + state.address.cityName + state.address.countyName + state.address.detailInfo
+ }
+ }
+}
diff --git a/subpkg/list/list.vue b/subpkg/list/list.vue
new file mode 100644
index 0000000..2fc01d0
--- /dev/null
+++ b/subpkg/list/list.vue
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请选择演练场景
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+