feat(): 我的功能模块

master
李神峰 2024-11-07 16:41:17 +08:00
parent 7aeb4aa5a0
commit 73788ce9f0
5 changed files with 16 additions and 30 deletions

View File

@ -3,19 +3,17 @@
onLaunch: function() { onLaunch: function() {
const token = { const token = {
loginName: uni.getStorageSync('loginName'), loginName: uni.getStorageSync('loginName'),
secretKey: uni.getStorageSync('secretKey'), secretKey: uni.getStorageSync('Gs-Token'),
} }
if (token.secretKey){ if (token.secretKey){
uni.reLaunch({ uni.reLaunch({
url: '/pages/homeIndex/index' url: '/pages/homeIndex/index'
}) })
console.log(token.secretKey,'App Launch')
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
// url:'/pages/mypage/mypage' // url:'/pages/mypage/mypage'
}) })
console.log(token.secretKey,'App Launch2')
} }
}, },

28
main.js
View File

@ -6,28 +6,11 @@ import App from './App'
import { import {
$http $http
} from '@escook/request-miniprogram' } from '@escook/request-miniprogram'
Vue.config.productionTip = false Vue.config.productionTip = false
uni.$http = $http uni.$http = $http
// $http.baseUrl = 'http://local.gunshiiot.com:18083'
$http.baseUrl = 'http://local.gunshiiot.com:18083' $http.baseUrl = 'http://local.gunshiiot.com:18083'
// 请求拦截器 // 请求拦截器
$http.beforeRequest = function(options) { $http.beforeRequest = function (options) {
// uni.showLoading({
// title: '数据加载中'
// })
// if (
// options.url.indexOf('/gunshiApp/xfflood/doLogin') == -1
// && options.url.indexOf('/gunshiApp/xfflood/getLoginInfo') == -1
// && options.url.indexOf('/gunshiApp/xfflood/my/info/getByUserId') == -1
// && options.url.indexOf('/gunshiApp/xfflood/bzProjectManipulationRecord/file/get/') == -1
// ) {
// // uni.showLoading({
// // title: '数据加载中'
// // })
// }
if (options.url.indexOf('/doLogin') == -1) { if (options.url.indexOf('/doLogin') == -1) {
options.header = { options.header = {
'Authorization': 'Bearer ' + uni.getStorageSync('Gs-Token') 'Authorization': 'Bearer ' + uni.getStorageSync('Gs-Token')
@ -35,10 +18,15 @@ $http.beforeRequest = function(options) {
} }
} }
// 响应拦截器 // 响应拦截器
$http.afterRequest = function(options) { $http.afterRequest = function (options) {
if (options.data.code == 405) {
uni.redirectTo({
url: '/pages/login/login'
})
}
// uni.hideLoading() // uni.hideLoading()
} }
uni.$showMsg = function(title = '数据请求失败了', duration = 1500) { uni.$showMsg = function (title = '数据请求失败了', duration = 1500) {
return uni.showToast({ return uni.showToast({
title, title,
duration, duration,

View File

@ -1,6 +1,6 @@
{ {
"name" : "咸丰水利", "name" : "小玉潭水库",
"appid" : "__UNI__CB311EF", "appid" : "__UNI__7573222",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -18,10 +18,10 @@
}, },
"modules" : { "modules" : {
"VideoPlayer" : {}, "VideoPlayer" : {},
"Contacts" : {},
"Messaging" : {}, "Messaging" : {},
"Camera" : {}, "Camera" : {},
"Maps" : {} "Maps" : {},
"Contacts" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {

View File

@ -9,7 +9,7 @@
</u-navbar> </u-navbar>
<view class="" style="margin-top: 44px;;background-color: #f0f0f0;border-top: 1px solid #f0f0f0;"> <view class="" style="margin-top: 44px;;background-color: #f0f0f0;border-top: 1px solid #f0f0f0;">
<view style="padding:0 10px,backgroundColor:#fff"> <view style="padding:0 10px,backgroundColor:#fff">
<view class="time-ranger"> <view class="time-ranger" style="padding:10px;background-color: #fff;">
<view class="start-time"> <view class="start-time">
<text>开始时间</text> <text>开始时间</text>
<text @click="showTime=true" style="margin-left:15%;color:#3399ef">{{startTime}}</text> <text @click="showTime=true" style="margin-left:15%;color:#3399ef">{{startTime}}</text>
@ -23,7 +23,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="" v-for="item in list" style="margin: 10px;background-color: #fff;padding: 10px;"> <view class="" v-for="(item,index) in list" :key="index" style="margin: 10px;background-color: #fff;padding: 10px;">
<view class="item"> <view class="item">
<view class="align-center"> <view class="align-center">
<view class="blueTiao"> <view class="blueTiao">

View File

@ -84,7 +84,7 @@
} }
} },
}, },
} }
</script> </script>