183 lines
3.3 KiB
Vue
183 lines
3.3 KiB
Vue
<script>
|
|
import {mapMutations, mapState} from 'vuex'
|
|
import config from "./config.json";
|
|
|
|
export default {
|
|
provide() {
|
|
return {
|
|
root: this,
|
|
}
|
|
},
|
|
onLaunch: function () {
|
|
this.repairWxSDK()
|
|
this.initLoginBtn()
|
|
this.getApps()
|
|
},
|
|
onShow: function () {
|
|
this.initWaterMarker()
|
|
},
|
|
onPageNotFound() {
|
|
},
|
|
computed: {
|
|
...mapState(['user']),
|
|
},
|
|
methods: {
|
|
...mapMutations(['initWaterMarker', 'logout', 'getConfig', 'setApps']),
|
|
goto(params, cb) {
|
|
let {path: url, query: {app}} = this.$route
|
|
params.query = {app, ...(params.query || {})}
|
|
uni.navigateTo({
|
|
url, success: () => {
|
|
this.$router.push({...params})
|
|
cb && cb()
|
|
}
|
|
})
|
|
},
|
|
repairWxSDK() {
|
|
wx = jWeixin
|
|
},
|
|
initLoginBtn() {
|
|
let btn = document.createElement("div")
|
|
btn.id = "__loginBtn"
|
|
btn.innerText = "登录"
|
|
btn.addEventListener("click", () => {
|
|
if (location.pathname == "/pages/login") {
|
|
return this.$u.toast("已在登录页!")
|
|
} else uni.navigateTo({url: "/pages/login?back=" + encodeURIComponent(location.href?.replace(location.origin, ""))})
|
|
})
|
|
btn.addEventListener('touchmove', e => {
|
|
let {clientX, clientY, target: {clientWidth, clientHeight}} = e.touches?.[0],
|
|
{width, height} = screen
|
|
btn.style.right = `${Math.min(Math.max(0, width - clientX - clientWidth), width - clientWidth)}px`
|
|
btn.style.top = `${Math.min(Math.max(0, clientY), height - clientHeight)}px`
|
|
})
|
|
document.body.appendChild(btn)
|
|
},
|
|
getApps() {
|
|
this.setApps(config.apps)
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import 'styles/common';
|
|
|
|
body {
|
|
font-family: 'Microsoft YaHei', serif;
|
|
}
|
|
|
|
uni-page-body {
|
|
min-height: 100%;
|
|
// height: 100vh;
|
|
background: #f5f5f5;
|
|
position: relative;
|
|
}
|
|
|
|
.text-hover {
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.bg-hover {
|
|
background: #eee;
|
|
}
|
|
|
|
div[bottom] {
|
|
position: fixed;
|
|
left: 0;
|
|
bottom: 0;
|
|
width: 100%;
|
|
height: 128px;
|
|
padding: 24px 32px;
|
|
box-sizing: border-box;
|
|
background: #ffffff;
|
|
border-top: 1px solid #d4d4d4;
|
|
display: flex;
|
|
gap: 32px;
|
|
|
|
& > * {
|
|
flex: 1;
|
|
min-width: 0;
|
|
|
|
& + * {
|
|
margin-left: 32px;
|
|
}
|
|
}
|
|
}
|
|
|
|
uni-button {
|
|
border-radius: 4px;
|
|
|
|
&.u-btn--primary {
|
|
background-color: $uni-color-primary !important;
|
|
border-color: $uni-color-primary !important;
|
|
}
|
|
|
|
&:after {
|
|
border-radius: 4px;
|
|
}
|
|
}
|
|
|
|
.fill {
|
|
flex: 1;
|
|
min-width: 0;
|
|
min-height: 0;
|
|
}
|
|
|
|
.u-form-item {
|
|
width: 100%;
|
|
min-height: 100px;
|
|
background: #ffffff;
|
|
padding: 0 32px !important;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
line-height: normal !important;
|
|
|
|
.u-form-item__body {
|
|
height: inherit;
|
|
flex: 1;
|
|
|
|
.u-form-item--left {
|
|
min-height: 100px;
|
|
}
|
|
|
|
.u-form-item--right__content__slot {
|
|
padding-bottom: 10px;
|
|
}
|
|
}
|
|
|
|
.u-form-item__message {
|
|
margin: 15px 0;
|
|
}
|
|
}
|
|
|
|
#__loginBtn {
|
|
position: fixed;
|
|
right: 16px;
|
|
top: 20px;
|
|
background-color: $uni-color-primary;
|
|
color: #fff;
|
|
padding: 8px 16px;
|
|
border-radius: 8px;
|
|
font-size: 24px;
|
|
box-shadow: 0 0 0.61538462em rgb(0 0 0 / 40%);
|
|
z-index: 202206271112;
|
|
}
|
|
|
|
@keyframes mapWarn {
|
|
0% {
|
|
transform: scale(.5);
|
|
opacity: 1
|
|
}
|
|
|
|
30% {
|
|
opacity: .5
|
|
}
|
|
|
|
to {
|
|
transform: scale(1.4);
|
|
opacity: 0
|
|
}
|
|
}
|
|
</style>
|