diff --git a/common/http.api.js b/common/http.api.js
index 911d8c6..2eb97b2 100644
--- a/common/http.api.js
+++ b/common/http.api.js
@@ -1,8 +1,10 @@
import configService from '@/common/config.service.js';
const install = (Vue, vm) => {
- vm.$api.wxLogin = async (params = {}) => await vm.$u.get('/wxUser/wxPhoneLogin', params);// 手机号一键登录
- // vm.$api.wxLogin = async (params = {}) => await vm.$u.get('/wxUser/wxPhoneLogin', params);// 手机号一键登录
+ // 用户管理
+ vm.$api.wxLogin = async (params = {}) => await vm.$u.get('/acUser/wxPhoneLogin', params);// 手机号一键登录
+ vm.$api.login = async (params = {}) => await vm.$u.get('/acUser/phoneLogin', params);// 手机号登录
+ vm.$api.register = async (params = {}) => await vm.$u.get('/acUser/phoneRegister', params);// 手机号注册
// 留言板
vm.$api.addMessage = async (params = {}) => await vm.$u.post('/cpMessage', params);// 添加留言
diff --git a/pages/mobile_web/home/home.vue b/pages/mobile_web/home/home.vue
index cc83bc8..8995777 100644
--- a/pages/mobile_web/home/home.vue
+++ b/pages/mobile_web/home/home.vue
@@ -160,11 +160,12 @@ export default {
swiperList:[
{
picture: configService.fileUrl + 'pixel/home/banner.png',
- path: 'https://docs.qq.com/doc/DSXpVWGlJb01BS0VO'
+ path: 'http://8.138.171.103/vueAdmin/#article/content?id=154'
},
{
picture: configService.fileUrl + 'pixel/home/banner.png',
- path: 'https://baidu.com/'
+ // path: 'https://baidu.com/'
+ path: 'http://8.138.171.103/vueAdmin/#article/content?id=158'
}
],
// 推荐作品图标
diff --git a/pages/mobile_web/my/child_pages/login.vue b/pages/mobile_web/my/child_pages/login.vue
index c176b88..c3d9c39 100644
--- a/pages/mobile_web/my/child_pages/login.vue
+++ b/pages/mobile_web/my/child_pages/login.vue
@@ -20,11 +20,54 @@
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ current ? '注册' : '登录' }}
+
+
+
+
+ 我已阅读并同意服务协议、隐私权政策
+
+
+
+
+
+
@@ -43,6 +86,89 @@
logo: 'logo.png',
// 顶部距离等级
topLevel: 0,
+ // tabs标签栏
+ list: [
+ {name: '用户登录'},
+ {name: '手机注册'}
+ ],
+ // 当前tabs下标
+ current: 0,
+ // 输入框左上角动图
+ lgHead: ['fly.gif','sprint.gif','spitfire.gif'],
+ // 是否刚刚切换过tabs
+ justChange: false,
+ // 登录表单
+ loginForm: {
+ username: '',
+ password: ''
+ },
+ // 登录验证规则
+ loginRules: {
+ username: [
+ {
+ required: true,
+ message: '请输入手机号',
+ trigger: 'blur'
+ },
+ {
+ validator: (rule, value, callback) => {
+ return this.$u.test.mobile(value);
+ },
+ message: '手机号格式不正确',
+ trigger: ['blur']
+ }
+ ],
+ password: [
+ {
+ required: true,
+ message: '请输入密码',
+ trigger: 'blur'
+ }
+ ]
+ },
+ registerRules: {
+ username: [
+ {
+ required: true,
+ message: '请输入手机号',
+ trigger: 'blur'
+ },
+ {
+ validator: (rule, value, callback) => {
+ return this.$u.test.mobile(value);
+ },
+ message: '手机号格式不正确',
+ trigger: ['blur']
+ }
+ ],
+ password: [
+ {
+ required: true,
+ message: '请输入密码',
+ trigger: 'blur'
+ }
+ ],
+ confirmPassword: [
+ {
+ required: true,
+ message: '请输入确认密码',
+ trigger: 'blur'
+ },
+ {
+ validator: (rule, value, callback) => {
+ return this.loginForm.password !== '' && this.loginForm.password === value;
+ },
+ message: '两次密码输入不同',
+ trigger: ['blur']
+ }
+ ]
+ },
+ // 加载
+ dotLoading: false,
+ // 是否记住密码
+ isChecked: false,
+ // 是否同意协议、政策
+ isAgreed: false
}
},
// #ifndef H5
@@ -70,11 +196,73 @@
window.onscroll = null;
},
// #endif
+ onReady() {
+ this.$refs.loginForm.setRules(this.loginRules);
+ },
methods:{
// 返回
back(){
uni.navigateBack();
},
+ // 切换方式
+ change(index) {
+ this.current = index;
+ this.$refs.loginForm.setRules(index? this.registerRules : this.loginRules);
+ // 如果已经触发喷火,不再设置
+ if(this.justChange) return;
+ this.justChange = true;
+ setTimeout(()=>{
+ this.justChange = false;
+ },2010);
+ },
+ // 点击龙
+ handleClickDragon(){
+ // 如果已经触发喷火,不再设置
+ if(this.justChange) return;
+ this.justChange = true;
+ setTimeout(()=>{
+ this.justChange = false;
+ },2100);
+ },
+ // 提交
+ submit(){
+ if(!this.isAgreed){
+ this.$refs.uToast.show({type: 'warning',title: "请阅读并勾选同意协议!"});
+ return;
+ }
+ try{
+ let that = this;
+ this.dotLoading = true;
+ this.$refs.loginForm.validate(async(valid) => {
+ if (valid) {
+ // 判断注册或登录的表单值,进行调整匹配
+ if(!that.current) delete that.loginForm.confirmPassword;
+ let res = await that.$api[that.current?'register':'login'](that.loginForm);
+ if(res.success){
+ that.$refs.loginForm.resetFields();
+ if(!that.current){
+ that.$u.vuex('vuex_token', res.data.token);
+ that.$u.vuex('user_message', JSON.stringify(res.data.user));
+ uni.navigateBack({complete() {
+ setTimeout(()=>{
+ uni.showToast({icon: 'none', title: '登录成功!'});
+ })
+ }});
+ }else{
+ that.$refs.uToast.show({type: 'success',title: "注册成功,请登录"});
+ that.current = 0;
+ }
+ }else{
+ that.$refs.uToast.show({type: 'error',
+ title: that.current?`${res.data}!`:"手机号或密码错误!"});
+ }
+ }
+ });
+ }catch(e){}
+ finally{
+ this.dotLoading = false;
+ }
+ }
},
onLoad(options) {
this.loading = false;
@@ -117,7 +305,70 @@
height: 45rpx;
}
}
+ .lg-head{
+ margin: 80rpx 40rpx 32rpx;
+ image{
+ margin-left: -100rpx;
+ width: 50%;
+ height: 320rpx;
+ }
+ }
+ }
+ .lg-content{
+ // flex: 1;
+ margin: -100rpx 40rpx 32rpx;
+ background: linear-gradient(rgba(254,253,255,0.4), rgba(46,172,238,0.2));
+ border-radius: 20rpx;
+ color: #f9f9f9;
+ padding: 40rpx 25rpx 20rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ .lgc-top{
+ width: 100%;
+ margin-bottom: 35rpx;
+ }
+ }
+}
+.pixel-form{
+ margin: 30rpx;
+ .pixel-input{
+ width: 320rpx;
+ }
+}
+.lgc-btn{
+ margin-top: 50rpx;
+ background-image: linear-gradient(to right, #6190E8 0%, #A7BFE8 51%, #6190E8 100%);
+ box-shadow: 0 0 20rpx #eee;
+ background-size: 200% auto;
+ text-transform: uppercase;
+ color: white;
+ border: none;
+}
+.lgc-bottom{
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 40rpx;
+ margin-bottom: 140rpx;
+ color: #ded3c9;
+ .lgcb-left{
+ display: flex;
+ align-items: center;
+ line-height: 50rpx;
+ }
+ .lgcb-right{
+ line-height: 50rpx;
+ }
+}
+.lgc-agreement{
+ margin-top: 60rpx;
+ margin-bottom: 30rpx;
+ color: #ded3c9;
+ display: flex;
+ align-items: center;
+ text{
+ color: #6894e8;
}
-
}
\ No newline at end of file
diff --git a/pages/mobile_web/my/my.vue b/pages/mobile_web/my/my.vue
index 4346b9f..61b1eba 100644
--- a/pages/mobile_web/my/my.vue
+++ b/pages/mobile_web/my/my.vue
@@ -144,6 +144,8 @@ export default {
// path: '',
// }
],
+ // 用户信息
+ // userMessage: this.$store.state.vuex_token === ''?{}:JSON.parse(this.$store.state.user_message),
// 是否登录
isLogin: this.$store.state.vuex_token,
}