Browse Source

feat: 设置状态栏

test2
xuesinan 4 years ago
parent
commit
9871356013
  1. 19
      CHANGELOG.md
  2. 7
      manifest.json
  3. 26
      pages/index/index.vue
  4. 124
      utils/request.js

19
CHANGELOG.md

@ -1,17 +1,8 @@
# 1.0.0 (2022-01-14) # 1.0.0 (2022-01-17)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | app.vue | [970cf9a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/970cf9a)
- | first commit | [8dc26de](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8dc26de)
project | 日常任务面板添加 | [b3f16ff](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/b3f16ff)
theme | theme demo | [9175758](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9175758)
- | vue3 | [12ed2ad](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12ed2ad)
- | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b3efd8)
- | 手机号登录 | [a198527](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a198527)
- | 手机号登录 | [8f455da](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f455da)
- | 手机号登录 | [565585b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/565585b)
- | 表单验证 | [8f3bc1e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f3bc1e) - | 表单验证 | [8f3bc1e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8f3bc1e)
- | 插件的填写提交,编辑与删除 | [84390d5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/84390d5) - | 插件的填写提交,编辑与删除 | [84390d5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/84390d5)
- | 插件的填写与提交,修改与删除 | [d461252](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d461252) - | 插件的填写与提交,修改与删除 | [d461252](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d461252)
@ -19,6 +10,7 @@
- | 登录、日历页小绿点、二级项目列表 | [e676cf0](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e676cf0) - | 登录、日历页小绿点、二级项目列表 | [e676cf0](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e676cf0)
- | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc) - | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc)
- | 获取手机唯一码 | [3f60cf8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3f60cf8) - | 获取手机唯一码 | [3f60cf8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3f60cf8)
- | 将时间轴改成swiper滑动 | [12384f9](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12384f9)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6) - | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91) - | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91)
- | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005) - | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005)
@ -55,6 +47,7 @@
--|--|-- --|--|--
- | 插件接口修改 | [53c6b90](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/53c6b90) - | 插件接口修改 | [53c6b90](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/53c6b90)
- | 解决warning | [dcb0079](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/dcb0079) - | 解决warning | [dcb0079](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/dcb0079)
- | 日历列表H5在手机端不显示 | [0b4ae72](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/0b4ae72)
- | 删除多余的引入 | [050b12a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/050b12a) - | 删除多余的引入 | [050b12a](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/050b12a)
- | 上个提交导致的bug | [7524b24](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/7524b24) - | 上个提交导致的bug | [7524b24](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/7524b24)
- | 时间轴任务 | [98abdf6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/98abdf6) - | 时间轴任务 | [98abdf6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/98abdf6)
@ -69,11 +62,6 @@
### 📦 持续集成 ### 📦 持续集成
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | ci update | [d38262e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d38262e)
- | drone | [8cddc7b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/8cddc7b)
- | 修改.drone.yml | [f5b52e3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/f5b52e3)
- | 更新drone.yml | [63ec5a3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/63ec5a3)
- | 更新drone.yml | [a57d598](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a57d598)
- | 测试ci | [6ab95f8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6ab95f8) - | 测试ci | [6ab95f8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6ab95f8)
- | 测试ci' | [d25f2a7](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d25f2a7) - | 测试ci' | [d25f2a7](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/d25f2a7)
- | 更新drone.yml | [63ec5a3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/63ec5a3) - | 更新drone.yml | [63ec5a3](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/63ec5a3)
@ -113,3 +101,4 @@
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | Initial commit | [52b8f49](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/52b8f49) - | Initial commit | [52b8f49](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/52b8f49)

7
manifest.json

@ -81,7 +81,12 @@
"splashscreen" : { "splashscreen" : {
"androidStyle" : "common" "androidStyle" : "common"
} }
} },
"safearea": {
"bottom": {
"offset": "none"
}
}
}, },
/* */ /* */
"quickapp" : {}, "quickapp" : {},

26
pages/index/index.vue

@ -1,10 +1,21 @@
<template> <template>
<!-- 这里是适配的状态栏的代码 -->
<view class="statbar">
<view class="status_bar"></view>
</view>
<!-- <view class="flex flex-col h-full bg-gray-50" @click="openAuth"> --> <!-- <view class="flex flex-col h-full bg-gray-50" @click="openAuth"> -->
<view class="flex flex-col h-full bg-gray-50"> <view class="flex flex-col h-full bg-gray-50">
<view class="relative"> <view class="relative">
<!-- <view class="relative" @touchmove="onMove"> --> <!-- <view class="relative" @touchmove="onMove"> -->
<!-- 日历 --> <!-- 日历 -->
<Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" /> <Calendar
@selected-change="onDateChange"
:show-back="true"
ref="calendar"
@handleFindPoint="handleFindPoint"
/>
<!-- 上传 导入wbs --> <!-- 上传 导入wbs -->
<Upload @success="onUploadSuccess" @error="onUploadError" /> <Upload @success="onUploadSuccess" @error="onUploadError" />
</view> </view>
@ -119,7 +130,18 @@
} }
</script> </script>
<style> <style lang="scss" scoped>
.statbar {
width: 750rpx;
height: var(--status-bar-height);
.status_bar {
height: var(--status-bar-height);
width: 100%;
position: absolute;
}
}
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

124
utils/request.js

@ -1,73 +1,73 @@
import store from '@/store/index.js'; import store from '@/store/index.js';
import storage from '@/utils/storage.js'; import storage from '@/utils/storage.js';
import ui from '@/utils/ui.js'; import ui from '@/utils/ui.js';
export function setupHttp(app) { export function setupHttp(app) {
app.config.globalProperties.$u.http.setConfig({ app.config.globalProperties.$u.http.setConfig({
baseUrl: '', baseUrl: '',
showLoading: true, // 是否显示请求中的loading showLoading: true, // 是否显示请求中的loading
loadingText: '玩命加载中...', loadingText: '玩命加载中...',
loadingTime: 800, loadingTime: 800,
loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透 loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
// 配置请求头信息 // 配置请求头信息
header: { header: {
'content-type': 'application/json;charset=UTF-8' 'content-type': 'application/json;charset=UTF-8'
}, },
}); });
// 请求拦截部分,如配置,每次请求前都会执行
app.config.globalProperties.$u.http.interceptor.request = config => {
const token = store.state.user.token || storage.getStorageSync('anyringToken');
if (token) {
config.header.Authorization = `Bearer ${token}`;
}
// 请求拦截部分,如配置,每次请求前都会执行 uni.getSystemInfo({
app.config.globalProperties.$u.http.interceptor.request = config => { success: function(res) {
const token = store.state.user.token || storage.getStorageSync('anyringToken'); config.header.deviceId = res.deviceId;
if (token) { }
config.header.Authorization = `Bearer ${token}`;
}
uni.getSystemInfo({
success: function (res) {
config.header.deviceId = res.deviceId;
}
}) })
return config; return config;
}; };
// 响应拦截,如配置,每次请求结束都会执行本方法 // 响应拦截,如配置,每次请求结束都会执行本方法
app.config.globalProperties.$u.http.interceptor.response = res => { app.config.globalProperties.$u.http.interceptor.response = res => {
if (res.code === 200) { if (res.code === 200) {
// res为服务端返回值,可能有code,result等字段 // res为服务端返回值,可能有code,result等字段
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
// 如果配置了originalData为true,请留意这里的返回值 // 如果配置了originalData为true,请留意这里的返回值
if (res.tokenObj.token) { if (res.tokenObj.token) {
storage.setStorageSync('anyringToken', res.tokenObj.token || ''); storage.setStorageSync('anyringToken', res.tokenObj.token || '');
store.commit('user/setToken', res.tokenObj.token); store.commit('user/setToken', res.tokenObj.token);
} }
return res.data; return res.data;
} else if (res.code === 401) { } else if (res.code === 401) {
// 假设201为token失效,这里跳转登录 // 假设201为token失效,这里跳转登录
ui.showToast('验证失败,请重新登录'); ui.showToast('验证失败,请重新登录');
setTimeout(() => { setTimeout(() => {
// 此为uView的方法,详见路由相关文档 // 此为uView的方法,详见路由相关文档
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/login' url: '/pages/user/login'
}) })
}, 1500); }, 1500);
return false; return false;
} else { } else {
// 如果返回false,则会调用Promise的reject回调, // 如果返回false,则会调用Promise的reject回调,
// 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值
return false; return false;
} }
}; };
app.config.globalProperties.$u.post = (url, param = {}, header = {}) => { app.config.globalProperties.$u.post = (url, param = {}, header = {}) => {
return app.config.globalProperties.$u.http.request({ return app.config.globalProperties.$u.http.request({
url, url,
method: 'POST', method: 'POST',
header, header,
data: { data: {
param param
}, },
}); });
}; };
} }

Loading…
Cancel
Save