Commit 4c8169e6 Harvey

注册登录

1 个父辈 fc291a8e
<script> <script>
export default { export default {
onLaunch: function() { onLaunch: function(e1) {
console.log(e1)
console.log('App Launch') console.log('App Launch')
}, },
onShow: function() { onShow: function() {
......
...@@ -11,7 +11,10 @@ router.beforeEach((to, from, next) => { ...@@ -11,7 +11,10 @@ router.beforeEach((to, from, next) => {
}); });
// 全局路由后置守卫 // 全局路由后置守卫
router.afterEach((to, from) => { router.afterEach((to, from) => {
console.log('跳转结束')
//console.log(to)
//console.log(from)
}) })
export { export {
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
"devServer": { "devServer": {
"port": 80, "port": 80,
"host": "0.0.0.0", "host": "0.0.0.0",
"disableHostCheck": true, "disableHostCheck": false,
"https": false, "https": false,
"hotOnly": false, "hotOnly": false,
"proxy": { "proxy": {
......
...@@ -34,6 +34,15 @@ ...@@ -34,6 +34,15 @@
"style": { "style": {
"navigationStyle": "default" "navigationStyle": "default"
} }
},{
"path": "pages/auth/login",
"aliasPath": "/login",
"name": "login",
"desc": "登录页",
"style": {
"navigationBarTitleText": "登录/注册",
"navigationStyle": "default"
}
} }
], ],
"globalStyle": { "globalStyle": {
......
<template>
<view class="body">
<text>首次登录创建新帐号</text>
<view class="input">
<text>手机号</text>
<input type="text" v-model="mobile" placeholder="请填写手机号" placeholder-style="color:#ACACAC;" />
</view>
<view class="input">
<text>验证码</text>
<input type="text" v-model="code" placeholder-style="color:#ACACAC;" placeholder="请填写手机验证码" />
<text :class="'yzm '+yzm.class" @click="sendMobileCode">获取验证码 {{yzm.djs}}</text>
</view>
<button type="default" class="btn" @click="login">下一步</button>
</view>
</template>
<script>
export default {
data() {
return {
mobile: '',
code: '',
yzm: {
class: '',
djs: '',
setIntervalId: 0
}
}
},
async onLoad() {
//console.log(uni.$u)
},
methods: {
async login() {
if (this.mobile.length != 11) {
uni.showToast({
icon: "none",
icon: 'error',
title: "手机号有误",
});
return;
}
if (this.code.length != 6) {
uni.showToast({
icon: "none",
icon: 'error',
title: "验证码有误",
});
return;
}
const res = await uni.$u.request.post({
data: {
query: `mutation{ydn_sms_login(mobile:"${this.mobile}",code:"${this.code}",type:"web")}`
}
}).then(a => a.data.data.ydn_sms_login);
if (res.Error) {
uni.showToast({
title: res.Error,
icon: 'error',
duration: 2000
});
return
}
console.log(res)
},
async sendMobileCode() {
var yzm = this.yzm
if (yzm.class == 'disabled') {
uni.showToast({
title: '请稍后再试试',
icon: 'error',
duration: 2000
});
return
}
yzm.class = 'disabled'
const res = await uni.$u.request.post({
data: {
query: `mutation{ydn_send_mobile_code(mobile:"15574985121",type:7)}`
}
}).then(a => a.data.data.ydn_send_mobile_code);
console.log(res)
if(res.success=='1'){
uni.showToast({
title: '验证码发送成功',
icon: 'success',
duration: 2000
});
}
yzm.setIntervalId = setInterval(() => {
if (yzm.djs == '') yzm.djs = 60;
else yzm.djs--
if (yzm.djs == 0) {
yzm.djs = ''
yzm.class = ''
clearInterval(yzm.setIntervalId)
yzm.setIntervalId = 0
}
}, 999)
}
}
}
</script>
<style>
.body {
font-family: Helvetica;
font-weight: 400;
font-size: 14px;
color: #333333;
padding: 20px;
margin-top: 30px;
}
.input {
display: flex;
margin: 30px 0;
padding: 5px 0;
border-bottom: solid 1px #ACACAC;
}
.input input {
margin-left: 20px;
color: #909399;
}
.input .yzm {
color: #4F6FD9;
}
.input .disabled {
color: rgb(204, 204, 204) !important;
}
.btn {
height: 44px;
margin-top: 30px;
background-color: #D23338;
color: #FFFFFF;
}
</style>
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
//#ifdef H5 //#ifdef H5
$h5.head_tv(this.src) $h5.head_tv(this.src)
var hs=$h5.getHeaders()
console.log(hs)
//#endif //#endif
}, },
methods: { methods: {
......
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
} }
}, },
async onLoad() { async onLoad() {
console.log(window.document.cookie)
const res = await uni.$u.request.post({ const res = await uni.$u.request.post({
data: { data: {
query: `query{lottery_shop_get_posters(module_id:0)}` query: `query{lottery_shop_get_posters(module_id:0)}`
...@@ -64,7 +69,7 @@ ...@@ -64,7 +69,7 @@
}) })
uni.navigateTo({ uni.navigateTo({
url: '/tv/info', url: '/tv/info?zq=zq',
}); });
} }
} }
......
import $ from '@/static/js/jquery-3.3.1.min.js' import $ from '@/static/js/jquery-3.3.1.min.js'
export function go_android_login() { export function go_android_login() {
...@@ -8,3 +7,22 @@ export function go_android_login() { ...@@ -8,3 +7,22 @@ export function go_android_login() {
export function head_tv(url) { export function head_tv(url) {
$(".uni-page-head").eq(0).append(`<div onclick="Android.access2Tv('${url}')" style='font-size:12px;padding:0 5px;margin-right: 8px;height:24px;line-height:24px;margin-top: 3px;background-color: #007AFF;color:#FFFFFF;border-radius:5px;'>TV 投屏</div>`) $(".uni-page-head").eq(0).append(`<div onclick="Android.access2Tv('${url}')" style='font-size:12px;padding:0 5px;margin-right: 8px;height:24px;line-height:24px;margin-top: 3px;background-color: #007AFF;color:#FFFFFF;border-radius:5px;'>TV 投屏</div>`)
} }
export function getHeaders() {
var req = new XMLHttpRequest();
req.open('GET', document.location.href, false);
req.send(null);
var headerArr = req.getAllResponseHeaders().split('\r\n');
var headers = {};
headerArr.forEach(item => {
if (item !== '') {
var index = item.indexOf(':');
var key = item.slice(0, index);
var value = item.slice(index + 1).trim();
headers[key] = value
}
});
return headers
}
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!