初始化
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<image class="logo" @click="goSub" src="/static/logo.png"></image>
|
||||
<view class="">
|
||||
<Inputli @input="changeTrigger" v-model="form.name" />
|
||||
<Inputli @click="onClickName" v-model="form.age" :type="number" :maxlength="11" />
|
||||
<Inputli @click="onClickName" v-model="form.sex" />
|
||||
<Selectli v-model="form.sex" label="性123别" :array="sexArr" />
|
||||
<Dateli v-model="form.startTime" />
|
||||
|
||||
<button @click="onClickSave">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { uploadImage } from '../../api/uploadImage.js';
|
||||
import { rulesIdCard, rulesPhone } from '../../com/index.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: 'Hello',
|
||||
imgArr: [],
|
||||
form: {
|
||||
name: '张三2',
|
||||
age: 18,
|
||||
sex: '',
|
||||
startTime: ''
|
||||
},
|
||||
sexArr: [],
|
||||
// 分页
|
||||
total: 0,
|
||||
pageSize: 7,
|
||||
PageNum: 1,
|
||||
isLoading: false, // 是否正在加载数据,
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$setNavigationBar('钉钉示例模板页面');
|
||||
setTimeout(() => {
|
||||
this.sexArr = [
|
||||
{
|
||||
name: '男',
|
||||
id: 1
|
||||
},
|
||||
{
|
||||
name: '女',
|
||||
id: 2
|
||||
},
|
||||
{
|
||||
name: '未知',
|
||||
id: 3
|
||||
}
|
||||
];
|
||||
}, 2000);
|
||||
},
|
||||
onLoad() {
|
||||
console.log(this.$calculator(60, 0.3, '+'));
|
||||
},
|
||||
// 上拉加载
|
||||
onReachBottom() {
|
||||
if (this.PageNum * this.pageSize >= this.total) {
|
||||
// 证明没有下一页的数据了
|
||||
return this.$msg('没有数据啦!');
|
||||
}
|
||||
if (this.isLoading) return;
|
||||
},
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
console.log('下拉刷新了');
|
||||
dd.stopPullDownRefresh();
|
||||
},
|
||||
methods: {
|
||||
// 登录
|
||||
async signIn() {
|
||||
if (uni.getStorageSync('token')) {
|
||||
console.log('获取列表数据');
|
||||
} else {
|
||||
let a = await this.$login();
|
||||
console.log('获取列表数据');
|
||||
}
|
||||
},
|
||||
onClickSave() {
|
||||
const res = this.$showModel('提交函数');
|
||||
res.then(
|
||||
() => {
|
||||
console.log('成功了执行');
|
||||
},
|
||||
() => {
|
||||
console.log('点了取消执行');
|
||||
}
|
||||
);
|
||||
console.log(this.form);
|
||||
console.log(this.sex);
|
||||
},
|
||||
onClickName(a) {
|
||||
// console.log(a)
|
||||
},
|
||||
changeTrigger() {
|
||||
console.log('11111');
|
||||
},
|
||||
goSub() {
|
||||
console.log(888);
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 200rpx;
|
||||
width: 200rpx;
|
||||
margin-top: 200rpx;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.text-area {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
color: #8f8f94;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view style="text-align: center;">
|
||||
<image style="width: 120upx;height: 120upx;margin-top: 140upx;border-radius:50%;border: 1px solid #dedfe0;" src="../../static/logo.png"></image>
|
||||
<view style="font-size: 28upx;margin-top: 32upx">泸州市江阳区新时代文明实践中心</view>
|
||||
<button class="confirm-btn" @click="wxGetUserInfo">微信登录</button>
|
||||
<view class="cancal-btn" @click="onClickCancal">取消登录</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { login, postLogin } from '@/api/user/userApi.js'; //用户中心接口
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
user: {
|
||||
//用户信息
|
||||
headerImg: '', //头像
|
||||
username: '', //昵称 username
|
||||
isEnterprise: 0 // 0 是用户 1是商家
|
||||
},
|
||||
isBackUrl: false // 返回哪里 true 返回领取页面 false 返回 user页面
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.isBackUrl = option.isback;
|
||||
},
|
||||
methods: {
|
||||
// 点击取消
|
||||
onClickCancal() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
//授权获取微信用户信息
|
||||
wxGetUserInfo() {
|
||||
//新版本使用
|
||||
var self = this;
|
||||
uni.getUserProfile({
|
||||
desc: '登录',
|
||||
success: data1 => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: loginRes => {
|
||||
console.log(loginRes);
|
||||
const code = loginRes.code; //获取code
|
||||
uni.showLoading({ title: '正在登录' });
|
||||
postLogin(code).then(res => {
|
||||
console.log(res);
|
||||
if (res.code == 200) {
|
||||
self.$com.setCacheToken('userInfo', res.userInfo); //储存用户信息
|
||||
self.$com.setCacheToken('token', res.data.access_token); //储存用户token
|
||||
uni.showToast({ title: '登录成功' });
|
||||
uni.navigateBack();
|
||||
}
|
||||
uni.hideLoading();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: error => {
|
||||
uni.showToast({
|
||||
title: '您取消了授权,登录失败',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.footer {
|
||||
padding-left: 140upx;
|
||||
margin-top: 32upx;
|
||||
font-size: 24upx;
|
||||
color: #666666;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.send-msg {
|
||||
border-radius: 30px;
|
||||
color: black;
|
||||
background: white;
|
||||
height: 30px;
|
||||
font-size: 14px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.container {
|
||||
top: 0;
|
||||
padding-top: 50px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
image {
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
.cancal-btn {
|
||||
width: 200px;
|
||||
height: 42px;
|
||||
line-height: 42px;
|
||||
border-radius: 30px;
|
||||
margin: 0 auto;
|
||||
margin-top: 60upx;
|
||||
border: 2rpx solid rgb(220, 223, 230);
|
||||
color: rgb(220, 223, 230);
|
||||
}
|
||||
.confirm-btn {
|
||||
width: 200px;
|
||||
height: 42px;
|
||||
line-height: 42px;
|
||||
border-radius: 30px;
|
||||
margin-top: 260upx;
|
||||
// background-color: $main-color;
|
||||
color: #fff;
|
||||
// font-size: $font-lg;
|
||||
|
||||
&:after {
|
||||
border-radius: 60px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user