diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 07c1d5f..4bbcf3c 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,6 +2,10 @@ // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 "version": "0.0", "configurations": [{ + "app-plus" : + { + "launchtype" : "local" + }, "default" : { "launchtype" : "local" @@ -10,6 +14,10 @@ { "launchtype" : "local" }, + "mp-weixin" : + { + "launchtype" : "local" + }, "type" : "uniCloud" } ] diff --git a/apis/index.js b/apis/index.js index ec79c85..76f9f15 100644 --- a/apis/index.js +++ b/apis/index.js @@ -9,7 +9,7 @@ import store from '@/store' // 基础配置 const config = { - apiUrl : 'http://api.ahxh.shangkelian.cn/api/', + apiUrl : 'https://e-chain.cnskl.com/api/', timeout : 60000 } diff --git a/apis/interfaces/login.js b/apis/interfaces/login.js deleted file mode 100644 index 88fce9c..0000000 --- a/apis/interfaces/login.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Web-zdx - * moduleName: 登录(手机号) - */ - -import { request } from '../index' - -// 手机号登陆接口 -const login = (data) => { - return request({ - url: 'user/socialite/login/wechat/mini', - method: 'POST', - data: data - }) -} -// 修改用户信息 -const wechatbind = (data) => { - return request({ - url: 'user/socialite/wechatbind', - method: 'PUT', - data: data - }) -} - -// 修改用户头像或昵称 -const resetUserInfo = (data) => { - return request({ - url: 'user/' + data.key, - method: 'PUT', - data: { - value: data.value - } - }) -} - -// 获取用户的Openid -const getOpenid = (code) => { - return request({ - url: 'user/socialite/login/wechat/openid', - method: 'GET', - data: { - code: code - } - }) - -} -// 隐私条款 -const agreementSecret = (data) => { - return request({ - url: 'articles/agreement/secret' - }) -} - -// 注册协议 -const agreementLogin = (data) => { - return request({ - url: 'articles/agreement/login' - }) -} - -// 获取用户设置中心的信息 -const getUserSettingInfo = () => { - return request({ - url: 'user/setting' - }) -} - -export { - login, - wechatbind, - getOpenid, - agreementSecret, - agreementLogin, - resetUserInfo, - getUserSettingInfo -} diff --git a/main.js b/main.js index 7ab0ff0..11f608a 100644 --- a/main.js +++ b/main.js @@ -12,8 +12,14 @@ Vue.prototype.$store = store App.mpType = 'app' const app = new Vue({ ...App -}) -app.$mount() +}) +// #ifdef H5 + RouterMount(app,router,'#app') +// #endif + +// #ifndef H5 + app.$mount(); //为了兼容小程序及app端必须这样写才有效果 +// #endif // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' diff --git a/pages.json b/pages.json index 100cc80..961899c 100644 --- a/pages.json +++ b/pages.json @@ -1,121 +1,125 @@ { "pages": [{ - "path": "pages/index/index", - "name": "Index", - "style": { - "navigationBarTitleText":"发现能量" + "path": "pages/index/index", + "name": "Index", + "aliasPath": "/", + "style": { + "navigationBarTitleText": "发现能量" } }, { - "path": "pages/found/index", - "name": "Found", - "style": { - "navigationBarTitleText":"发现更多" + "path": "pages/found/index", + "name": "Found", + "auth": true, + "style": { + "navigationBarTitleText": "发现更多" } }, { - "path": "pages/user/index", - "name": "User", - "style": { - "navigationBarTitleText":"节点中心" + "path": "pages/user/index", + "name": "User", + "auth": true, + "style": { + "navigationBarTitleText": "节点中心" } }, { - "path": "pages/instrument/basics", - "name": "instrumentBasics", - "style": { - "navigationBarTitleText":"企业基础信息" + "path": "pages/instrument/basics", + "name": "instrumentBasics", + "style": { + "navigationBarTitleText": "企业基础信息" } }, { - "path": "pages/goods/management", - "name": "goodsManagement", - "style": { - "navigationBarTitleText":"商品权证管理" + "path": "pages/goods/management", + "name": "goodsManagement", + "style": { + "navigationBarTitleText": "商品权证管理" } }, { - "path": "pages/goods/addClassify", - "name": "goodsaddClassify", - "style": { - "navigationBarTitleText":"发布商品类目" + "path": "pages/goods/addClassify", + "name": "goodsaddClassify", + "style": { + "navigationBarTitleText": "发布商品类目" } }, { - "path": "pages/goods/add", - "name": "goodsAdd", - "style": { - "navigationBarTitleText":"商品权证创建" + "path": "pages/goods/add", + "name": "goodsAdd", + "style": { + "navigationBarTitleText": "商品权证创建" } }, { - "path": "pages/goods/goodsAuth", - "name": "goodsAddAuth", - "style": { - "navigationBarTitleText":"商品权证认证" - } + "path": "pages/goods/goodsAuth", + "name": "goodsAddAuth", + "style": { + "navigationBarTitleText": "商品权证认证" + } }, { - "path": "pages/coupons/management", - "name": "couponsManagement", - "style": { - "navigationBarTitleText":"创建优惠券" - } + "path": "pages/coupons/management", + "name": "couponsManagement", + "style": { + "navigationBarTitleText": "创建优惠券" + } }, { - "path": "pages/coupons/add", - "name": "couponsAdd", - "style": { - "navigationBarTitleText":"创建优惠券" - } + "path": "pages/coupons/add", + "name": "couponsAdd", + "style": { + "navigationBarTitleText": "创建优惠券" + } }, { - "path": "pages/coupons/magDetails", - "name": "couponsDetails", - "style": { - "navigationBarTitleText":"优惠券管理" - } + "path": "pages/coupons/magDetails", + "name": "couponsDetails", + "style": { + "navigationBarTitleText": "优惠券管理" + } + }, { + "path": "pages/coupons/selectGoods", + "name": "couponsSelectGoods", + "style": { + "navigationBarTitleText": "关联产品" + } + }, { + "path": "pages/login/login", + "name": "Login", + "style": { + "navigationBarTitleText": "登录" + } }, { - "path": "pages/coupons/selectGoods", - "name": "couponsSelectGoods", - "style": { - "navigationBarTitleText":"关联产品" - } - },{ "path": "pages/setting/setting", "name": "setting", + "auth": true, "style": { - "navigationBarTitleText":"设置中心" + "navigationBarTitleText": "设置中心" } - },{ + }, { "path": "pages/setting/aboutUs", "name": "aboutUs", "auth": true, "style": { - "navigationBarTitleText":"关于我们" - } - },{ - "path": "pages/login/login", - "name": "Login", - "style": { - "navigationBarTitleText":"登录页面" + "navigationBarTitleText": "关于我们" } }], "globalStyle": { "navigationStyle": "custom", "backgroundColor": "#F5F5F5" }, - "tabBar": { - "borderStyle": "white", - "backgroundColor": "#FFFFFF", - "selectedColor" : "#774ffd", - "iconWidth":"26px", - "spacing": "0", - "height":"60px", + "tabBar": { + "borderStyle": "white", + "backgroundColor": "#FFFFFF", + "selectedColor": "#774ffd", + "iconWidth": "26px", + "spacing": "0", + "height": "60px", "list": [{ - "text": "发现能量", - "iconPath":"static/tabBar/tabBar_icon_00.png", - "selectedIconPath":"static/tabBar/tabBar_show_00.png", + "text": "发现能量", + "iconPath": "static/tabBar/tabBar_icon_00.png", + "selectedIconPath": "static/tabBar/tabBar_show_00.png", "pagePath": "pages/index/index" }, { - "text": "发现更多", - "iconPath":"static/tabBar/tabBar_icon_01.png", - "selectedIconPath":"static/tabBar/tabBar_show_01.png", + "text": "发现更多", + "iconPath": "static/tabBar/tabBar_icon_01.png", + "selectedIconPath": "static/tabBar/tabBar_show_01.png", "pagePath": "pages/found/index" }, { - "text": "节点中心", - "iconPath":"static/tabBar/tabBar_icon_02.png", - "selectedIconPath":"static/tabBar/tabBar_show_02.png", + "text": "节点中心", + "iconPath": "static/tabBar/tabBar_icon_02.png", + "selectedIconPath": "static/tabBar/tabBar_show_02.png", "pagePath": "pages/user/index" }] }, diff --git a/router/index.js b/router/index.js index 0a49f76..7bfd15d 100644 --- a/router/index.js +++ b/router/index.js @@ -8,6 +8,11 @@ import { RouterMount, createRouter } from 'uni-simple-router'; import store from '../store/index' +// const ROUTESPATH = ROUTES.map(val => { +// val.component: ()=> import('@/' + val.path + '.vue') +// console.log(val) +// }) + const router = createRouter({ platform: process.env.VUE_APP_PLATFORM, routes: [...ROUTES] @@ -17,7 +22,10 @@ const router = createRouter({ router.beforeEach((to, from, next) => { const token = store.getters.getToken || uni.getStorageSync('token') // 检查是否需要登录 - if(to.meta.auth && token === ''){ + if(to.auth && token === ''){ + next({ + name: 'Login' + }) return } next(); diff --git a/vue.config.js b/vue.config.js index 7a5c084..29287c3 100644 --- a/vue.config.js +++ b/vue.config.js @@ -10,7 +10,7 @@ module.exports = { new webpack.DefinePlugin({ ROUTES: webpack.DefinePlugin.runtimeValue(() => { const tfPages = new TransformPages({ - includes: ['path', 'name', 'aliasPath'] + includes: ['path', 'name', 'aliasPath', 'auth'] }); return JSON.stringify(tfPages.routes) }, true)