[设置中心完善]
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||||
"version": "0.0",
|
"version": "0.0",
|
||||||
"configurations": [{
|
"configurations": [{
|
||||||
|
"app-plus" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
"default" :
|
"default" :
|
||||||
{
|
{
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
@@ -10,6 +14,10 @@
|
|||||||
{
|
{
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
|
"mp-weixin" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
"type" : "uniCloud"
|
"type" : "uniCloud"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import store from '@/store'
|
|||||||
|
|
||||||
// 基础配置
|
// 基础配置
|
||||||
const config = {
|
const config = {
|
||||||
apiUrl : 'http://api.ahxh.shangkelian.cn/api/',
|
apiUrl : 'https://e-chain.cnskl.com/api/',
|
||||||
timeout : 60000
|
timeout : 60000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
8
main.js
8
main.js
@@ -13,7 +13,13 @@ App.mpType = 'app'
|
|||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
...App
|
...App
|
||||||
})
|
})
|
||||||
app.$mount()
|
// #ifdef H5
|
||||||
|
RouterMount(app,router,'#app')
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef H5
|
||||||
|
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
|
||||||
|
// #endif
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef VUE3
|
// #ifdef VUE3
|
||||||
import { createSSRApp } from 'vue'
|
import { createSSRApp } from 'vue'
|
||||||
|
|||||||
16
pages.json
16
pages.json
@@ -2,18 +2,21 @@
|
|||||||
"pages": [{
|
"pages": [{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"name": "Index",
|
"name": "Index",
|
||||||
|
"aliasPath": "/",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "发现能量"
|
"navigationBarTitleText": "发现能量"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/found/index",
|
"path": "pages/found/index",
|
||||||
"name": "Found",
|
"name": "Found",
|
||||||
|
"auth": true,
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "发现更多"
|
"navigationBarTitleText": "发现更多"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/user/index",
|
"path": "pages/user/index",
|
||||||
"name": "User",
|
"name": "User",
|
||||||
|
"auth": true,
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "节点中心"
|
"navigationBarTitleText": "节点中心"
|
||||||
}
|
}
|
||||||
@@ -71,9 +74,16 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "关联产品"
|
"navigationBarTitleText": "关联产品"
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"path": "pages/login/login",
|
||||||
|
"name": "Login",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "登录"
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/setting/setting",
|
"path": "pages/setting/setting",
|
||||||
"name": "setting",
|
"name": "setting",
|
||||||
|
"auth": true,
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "设置中心"
|
"navigationBarTitleText": "设置中心"
|
||||||
}
|
}
|
||||||
@@ -84,12 +94,6 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "关于我们"
|
"navigationBarTitleText": "关于我们"
|
||||||
}
|
}
|
||||||
},{
|
|
||||||
"path": "pages/login/login",
|
|
||||||
"name": "Login",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText":"登录页面"
|
|
||||||
}
|
|
||||||
}],
|
}],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
|
|||||||
@@ -8,6 +8,11 @@
|
|||||||
import { RouterMount, createRouter } from 'uni-simple-router';
|
import { RouterMount, createRouter } from 'uni-simple-router';
|
||||||
import store from '../store/index'
|
import store from '../store/index'
|
||||||
|
|
||||||
|
// const ROUTESPATH = ROUTES.map(val => {
|
||||||
|
// val.component: ()=> import('@/' + val.path + '.vue')
|
||||||
|
// console.log(val)
|
||||||
|
// })
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
platform: process.env.VUE_APP_PLATFORM,
|
platform: process.env.VUE_APP_PLATFORM,
|
||||||
routes: [...ROUTES]
|
routes: [...ROUTES]
|
||||||
@@ -17,7 +22,10 @@ const router = createRouter({
|
|||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
const token = store.getters.getToken || uni.getStorageSync('token')
|
const token = store.getters.getToken || uni.getStorageSync('token')
|
||||||
// 检查是否需要登录
|
// 检查是否需要登录
|
||||||
if(to.meta.auth && token === ''){
|
if(to.auth && token === ''){
|
||||||
|
next({
|
||||||
|
name: 'Login'
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ module.exports = {
|
|||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
|
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
|
||||||
const tfPages = new TransformPages({
|
const tfPages = new TransformPages({
|
||||||
includes: ['path', 'name', 'aliasPath']
|
includes: ['path', 'name', 'aliasPath', 'auth']
|
||||||
});
|
});
|
||||||
return JSON.stringify(tfPages.routes)
|
return JSON.stringify(tfPages.routes)
|
||||||
}, true)
|
}, true)
|
||||||
|
|||||||
Reference in New Issue
Block a user