修改基础样式
parent
e275e1ca7e
commit
1ed3b84887
386
src/App.vue
386
src/App.vue
|
|
@ -1,288 +1,192 @@
|
||||||
<script>
|
<script>
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs'
|
||||||
import useAuthUser from '@/utils/hooks/useAuthUser';
|
import useAuthUser from '@/utils/hooks/useAuthUser'
|
||||||
import { submitCode2Session } from '@/api/xinjiang_guess';
|
import { submitCode2Session } from '@/api/xinjiang_guess'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
globalData: {},
|
globalData: {},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
},
|
},
|
||||||
onShow: async function () {
|
onShow: async function () {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
|
|
||||||
if (uni.canIUse('getUpdateManager')) {
|
if (uni.canIUse('getUpdateManager')) {
|
||||||
const updateManager = uni.getUpdateManager();
|
const updateManager = uni.getUpdateManager()
|
||||||
updateManager.onCheckForUpdate(function (res) {
|
updateManager.onCheckForUpdate(function (res) {
|
||||||
// 请求完新版本信息的回调
|
// 请求完新版本信息的回调
|
||||||
if (res.hasUpdate) {
|
if (res.hasUpdate) {
|
||||||
updateManager.onUpdateReady(function () {
|
updateManager.onUpdateReady(function () {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
title: '更新提示',
|
title: '更新提示',
|
||||||
content: '新版本已经准备好,是否重启应用?',
|
content: '新版本已经准备好,是否重启应用?',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
|
// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||||
updateManager.applyUpdate()
|
updateManager.applyUpdate()
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
updateManager.onUpdateFailed(function () {
|
updateManager.onUpdateFailed(function () {
|
||||||
// 新的版本下载失败
|
// 新的版本下载失败
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '已经有新版本了哟~',
|
title: '已经有新版本了哟~',
|
||||||
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
|
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('checkSession', this.checkSession());
|
console.log('checkSession', this.checkSession())
|
||||||
if (!this.checkSession()) {
|
if (!this.checkSession()) {
|
||||||
await this.login(true);
|
await this.login(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('App globalData', this.globalData);
|
console.log('App globalData', this.globalData)
|
||||||
},
|
},
|
||||||
onHide: function () {
|
onHide: function () {
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkSession() {
|
checkSession() {
|
||||||
const expire_in = this.globalData.expire_in;
|
const expire_in = this.globalData.expire_in
|
||||||
if (!expire_in) {
|
if (!expire_in) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expire_in) {
|
if (expire_in) {
|
||||||
let isExpired = dayjs().isAfter(dayjs(expire_in))
|
let isExpired = dayjs().isAfter(dayjs(expire_in))
|
||||||
console.log('isExpired', isExpired);
|
console.log('isExpired', isExpired)
|
||||||
if (isExpired) {
|
if (isExpired) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
let willExpired = dayjs().add(6, 'hour').isAfter(dayjs(expire_in))
|
let willExpired = dayjs().add(6, 'hour').isAfter(dayjs(expire_in))
|
||||||
console.log('willExpired', willExpired);
|
console.log('willExpired', willExpired)
|
||||||
if (willExpired) {
|
if (willExpired) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
},
|
},
|
||||||
login() {
|
login() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const codeResp = await wx.login()
|
const codeResp = await wx.login()
|
||||||
const wxLoginResp = await submitCode2Session({ code: codeResp.code });
|
const wxLoginResp = await submitCode2Session({ code: codeResp.code })
|
||||||
const data = wxLoginResp.data;
|
const data = wxLoginResp.data
|
||||||
|
|
||||||
this.globalData.api_token = data?.api_token;
|
this.globalData.api_token = data?.api_token
|
||||||
this.globalData.expire_in = data?.expire_in;
|
this.globalData.expire_in = data?.expire_in
|
||||||
this.globalData.user = data?.user;
|
this.globalData.user = data?.user
|
||||||
this.globalData.isLogin = !!this.globalData.api_token;
|
this.globalData.isLogin = !!this.globalData.api_token
|
||||||
this.globalData.isNeedBindPhone = !!this.globalData.user?.is_need_bind_phone;
|
this.globalData.isNeedBindPhone =
|
||||||
|
!!this.globalData.user?.is_need_bind_phone
|
||||||
|
|
||||||
const pages = getCurrentPages();
|
const pages = getCurrentPages()
|
||||||
const page = pages[pages.length - 1];
|
const page = pages[pages.length - 1]
|
||||||
|
|
||||||
if (page.$page) {
|
if (page.$page) {
|
||||||
console.log('current page: ', page.$page.fullPath);
|
console.log('current page: ', page.$page.fullPath)
|
||||||
} else {
|
} else {
|
||||||
console.log('current page: ', page.route);
|
console.log('current page: ', page.route)
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve();
|
resolve()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err)
|
||||||
reject();
|
reject()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
@import "uview-plus/index.scss";
|
@import 'uview-plus/index.scss';
|
||||||
|
|
||||||
page {
|
page {
|
||||||
background-color: #f3f3f3;
|
background-color: #f3f3f3;
|
||||||
}
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
button[type=primary],
|
button[type='primary'],
|
||||||
button[plain],
|
button[plain],
|
||||||
button[type=primary][plain],
|
button[type='primary'][plain],
|
||||||
button::after {
|
button::after {
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面布局相关 外边距
|
// 页面布局相关 外边距
|
||||||
|
|
||||||
|
|
||||||
.pt-24 {
|
|
||||||
padding-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.m-16 {
|
|
||||||
margin: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-white {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-red {
|
|
||||||
color: #e91f35;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-4e {
|
|
||||||
color: #4e4e4e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-primary {
|
|
||||||
color: #525252;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-black {
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-bold {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mb-10 {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-col {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-1 {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.justify-between {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.items-center {
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-base {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-sm {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-xs {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-white {
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rounded {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rounded-lg {
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-box {
|
.block-box {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
box-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.1);
|
box-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.1);
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 公共样式封装
|
// 公共样式封装
|
||||||
.board {
|
.board {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 12px 32px;
|
padding: 12px 32px;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 10px 26px 2px;
|
padding: 10px 26px 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background-color: #182c5f;
|
background-color: #182c5f;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
background-color: #d3d3d3;
|
background-color: #d3d3d3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary-sm {
|
.btn-primary-sm {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
padding: 0px !important;
|
padding: 0px !important;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
border-radius: 20px !important;
|
border-radius: 20px !important;
|
||||||
box-shadow: 1px 0.4px 1px #e91f35;
|
box-shadow: 1px 0.4px 1px #e91f35;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img {
|
.img {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
line-height: 80px;
|
line-height: 80px;
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
|
||||||
|
|
||||||
// 多行文本最后一行展示省略号
|
|
||||||
.ellipsis {
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodata {
|
.nodata {
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
.fixed{
|
|
||||||
position: fixed;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="bg-white wrap">
|
<view class="bg-white wrap">
|
||||||
<view class="image mb-10" v-if="data.cover">
|
<view class="image mb-2.5" v-if="data.cover">
|
||||||
<image class="image" :src="data.cover" mode="aspectFill" />
|
<image class="image" :src="data.cover" mode="aspectFill" />
|
||||||
</view>
|
</view>
|
||||||
<view class="p-16 title-bar flex-1" v-if="data">
|
<view class="p-16 title-bar flex-1" v-if="data">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="page-setting">
|
<view class="page-setting">
|
||||||
<view class="setting-box">
|
<view class="setting-box">
|
||||||
<view class="block-box bg-white rounded">
|
<view class="block-box bg-white rounded-4px">
|
||||||
<view class="flex text-primary items-center cell text-base">
|
<view class="flex text-primary items-center cell text-base">
|
||||||
<text class="text">头像</text>
|
<text class="text">头像</text>
|
||||||
<button class="menu-item-btn" openType="chooseAvatar" @chooseavatar="handleChooseAvatar">
|
<button class="menu-item-btn" openType="chooseAvatar" @chooseavatar="handleChooseAvatar">
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,14 @@
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
<view v-for="(block, index) in menus" :key="index">
|
<view v-for="(block, index) in menus" :key="index">
|
||||||
<view class="block-box bg-white rounded">
|
<view class="block-box bg-white rounded-4px">
|
||||||
<view v-for="(item, index) in block" :key="index">
|
<view v-for="(item, index) in block" :key="index">
|
||||||
<view
|
<view
|
||||||
class="flex text-primary items-center cell text-base"
|
class="flex text-primary items-center cell text-base"
|
||||||
@click="goToMenuPage(item)"
|
@click="goToMenuPage(item)"
|
||||||
v-if="!item.openType"
|
v-if="!item.openType"
|
||||||
>
|
>
|
||||||
<image class="icon mr-12" :src="item.icon" />
|
<image class="icon mr-12px" :src="item.icon" />
|
||||||
<view class="menu-item" :openType="item.openType">
|
<view class="menu-item" :openType="item.openType">
|
||||||
<text class="text">{{ item.text }}</text>
|
<text class="text">{{ item.text }}</text>
|
||||||
<text class="extra" v-if="item.extra">{{ item.extra }}</text>
|
<text class="extra" v-if="item.extra">{{ item.extra }}</text>
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
class="flex text-primary items-center cell text-base"
|
class="flex text-primary items-center cell text-base"
|
||||||
v-if="item.openType"
|
v-if="item.openType"
|
||||||
>
|
>
|
||||||
<image class="icon mr-12" :src="item.icon" />
|
<image class="icon mr-12px" :src="item.icon" />
|
||||||
<up-button class="menu-item-btn" :openType="item.openType">
|
<up-button class="menu-item-btn" :openType="item.openType">
|
||||||
<text class="text">{{ item.text }}</text>
|
<text class="text">{{ item.text }}</text>
|
||||||
<text class="extra" v-if="item.extra">{{ item.extra }}</text>
|
<text class="extra" v-if="item.extra">{{ item.extra }}</text>
|
||||||
|
|
@ -233,9 +233,7 @@ const upCallback = (mescroll) => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.mr-12 {
|
|
||||||
margin-right: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|
|
||||||
|
|
@ -105,9 +105,7 @@ const upCallback = (mescroll) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.mt-8 {
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.m-title {
|
.m-title {
|
||||||
margin: 8px 0 10px;
|
margin: 8px 0 10px;
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,13 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
colors: {
|
colors: {
|
||||||
primary: '#ee2c37',
|
'4e': '#4e4e4e',
|
||||||
|
primary: '#525252',
|
||||||
|
black: '#000000',
|
||||||
},
|
},
|
||||||
spacing: {
|
spacing: {
|
||||||
'base': '30rpx'
|
'base': '30rpx',
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rules: [
|
rules: [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue