diff --git a/App.vue b/App.vue
index c2bfef9..4c622fd 100644
--- a/App.vue
+++ b/App.vue
@@ -3,8 +3,36 @@
globalData: {
navbarHeight: 44,
},
- onLaunch: function() {
+ onLaunch: async function() {
this.globalData.navbarHeight = uni.getSystemInfoSync().safeArea.top
+
+ uni.login({
+ provider: 'weixin', //使用微信登录
+ success: async (loginRes) => {
+ try {
+ const {token} = await this.$u.api.appletLogin({
+ code: loginRes.code
+ })
+ this.$u.vuex('vuex_token', token)
+ const { user } = await this.$u.api.getUserInfo()
+ this.$u.vuex('vuex_user', user)
+ } catch (err) {
+ console.error(err)
+ }
+ },
+ fail:err => {
+ console.log(err)
+ }
+ });
+ // const token = this.vuex_token ? this.vuex_token : uni.getStorageSync('lifeData')?.vuex_token;
+ // if (token) {
+ // try {
+ // const { user } = await this.$u.api.getUserInfo()
+ // this.$u.vuex('vuex_user', user)
+ // } catch (err) {
+ // console.error(err)
+ // }
+ // }
},
onShow: function() {
},
diff --git a/common/config.js b/common/config.js
index 9a977cf..09b06db 100644
--- a/common/config.js
+++ b/common/config.js
@@ -1,17 +1,17 @@
-const mode = 'devOnline'; //devLocal:本地测试、devOnline:线上测试、production:生产环境
+const mode = 'devLocal'; //devLocal:本地测试、devOnline:线上测试、production:生产环境
let ROOTPATH = ''; //域名
switch (mode) {
case 'devLocal':
- ROOTPATH = "http://192.168.2.5:61111"
+ ROOTPATH = "https://zhiyuan-test.ali251.langye.net"
break;
case 'devOnline':
- ROOTPATH = "https://xxxxx.cn"
+ ROOTPATH = "https://zhiyuan-test.ali251.langye.net"
break;
case 'production':
- ROOTPATH = "https://xxxxx.cn"
+ ROOTPATH = "http://zhiyuan-test.ali251.langye.net"
break;
default:
throw new Error('未配置环境');
console.log(`未配置环境`);
}
-export { ROOTPATH }
\ No newline at end of file
+export { ROOTPATH }
diff --git a/common/http.api.js b/common/http.api.js
index f3c4e20..a0b7388 100644
--- a/common/http.api.js
+++ b/common/http.api.js
@@ -2,15 +2,40 @@
let apiApp = {
}
+const apiUser = {
+ appletLogin: '/api/mobile/user/applet-login',
+ updateUser: '/api/mobile/user/update-user',
+ getUserInfo: '/api/mobile/user/get-user-info',
+ mobile: '/api/mobile/user/mobile',
+ config: '/api/mobile/user/config',
+ bindMobile: '/api/mobile/user/bind-mobile',
+ sendSms: '/api/mobile/user/send-sms'
+}
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作
const install = (Vue, vm) => {
//api方法
+ const appletLogin = (params = {}) => vm.$u.get(apiUser.appletLogin, params)
+ const updateUser = (params = {}) => vm.$u.post(apiUser.updateUser, params)
+ const getUserInfo = (params = {}) => vm.$u.get(apiUser.getUserInfo, params)
+ const mobile = (params = {}) => vm.$u.get(apiUser.mobile, params)
+ const config = (params = {}) => vm.$u.get(apiUser.config, params)
+ const bindMobile = (params = {}) => vm.$u.post(apiUser.bindMobile, params)
+ const sendSms = (params = {}) => vm.$u.get(apiUser.sendSms, params)
+ //
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
vm.$u.api = {
-
+ // 用户相关
+ appletLogin,
+ updateUser,
+ getUserInfo,
+ mobile,
+ config,
+ bindMobile,
+ sendSms,
+ //
};
}
diff --git a/manifest.json b/manifest.json
index 90bb5c2..ddae50a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,5 +1,5 @@
{
- "name" : "uni",
+ "name" : "新飞跃",
"appid" : "__UNI__080F140",
"description" : "",
"versionName" : "1.0.0",
@@ -50,7 +50,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "",
+ "appid" : "wx140b95cca3f6b00f",
"setting" : {
"urlCheck" : false
},
diff --git a/package_sub/pages/StudentInfo/StudentInfo.vue b/package_sub/pages/StudentInfo/StudentInfo.vue
index 3739b02..3e0dcd7 100644
--- a/package_sub/pages/StudentInfo/StudentInfo.vue
+++ b/package_sub/pages/StudentInfo/StudentInfo.vue
@@ -3,31 +3,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 点击获取
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -38,23 +58,23 @@
初始成绩
-
-
+
+
一模成绩
-
-
+
+
估分成绩
-
-
+
+
精准成绩
-
-
+
+
@@ -70,19 +90,253 @@
'letter-spacing': '5rpx',
'width': '450rpx',
'margin': '130rpx auto 0'
- }">保存
+ }"
+ @click="submit">保存
+
+ form.sex = e[0].value">
+ form.middle_exam_year = e.year">
+
@@ -163,4 +417,30 @@ export default {
margin-top: 20rpx;
}
}
+.btn-normal {
+ display: block;
+ margin: 0;
+ padding: 0;
+ line-height: normal;
+ background: none;
+ border-radius: 0;
+ box-shadow: none;
+ border: none;
+ font-size: unset;
+ text-align: unset;
+ overflow: visible;
+ color: inherit;
+
+ image {
+ width: 120rpx;
+ height: 120rpx;
+ border-radius: 100%;
+ border: 2px solid #fff;
+ margin-right: 30rpx;
+ }
+}
+
+.btn-normal::after {
+ border: none
+}
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 6e5ab55..16f9064 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -14,8 +14,9 @@
shape="circle"
:hair-line="false"
ripple
+ open-type="getPhoneNumber"
:custom-style="{...btnStyle,'color': '#fff','background':'#e47829'}"
- @click="authLogin">一键登录
+ @getphonenumber="authLogin">一键登录
登录
+ }"
+ @click="mobileLogin">登录
@@ -129,28 +131,86 @@ export default {
mobile: '',
code: ''
},
- rules: {}
+ rules: {
+ mobile: [
+ {
+ required: true,
+ message: '请填写手机号',
+ trigger: ['change','blur']
+ }
+ ],
+ code: [
+ {
+ required: true,
+ message: '请填写验证码',
+ trigger: ['change','blur']
+ }
+ ]
+ }
};
},
methods: {
- getCode() {
+ async mobileLogin() {
+ if (!this.form.code) {
+ this.$refs.uToast.show({
+ title: '请先填写验证码',
+ type: 'warning',
+ duration: '2000'
+ })
+ return
+ }
+ if (!this.isAuth) {
+ this.$refs.uToast.show({
+ title: '请先阅读协议',
+ type: 'warning',
+ duration: '2000'
+ })
+ return
+ }
+ try {
+ const res = await this.$u.api.bindMobile(this.form)
+ this.$u.vuex('vuex_user', res)
+ this.$u.route({
+ type: 'switchTab',
+ url: '/pages/index/index'
+ })
+ } catch (err) {
+ console.error(err)
+ }
+ },
+ async getCode() {
+ if (!this.form.mobile) {
+ this.$refs.uToast.show({
+ title: '请先填写手机号',
+ type: 'warning',
+ duration: '2000'
+ })
+ return
+ }
if(this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
- uni.showLoading({
- title: '正在获取验证码'
- })
- setTimeout(() => {
+ try {
+ uni.showLoading({
+ title: '正在获取验证码'
+ })
+ const res = await this.$u.api.sendSms({
+ mobile: this.form.mobile
+ })
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
this.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
- }, 2000);
+ } catch (err) {
+ console.error(err)
+ } finally {
+ uni.hideLoading();
+ }
} else {
this.$u.toast('倒计时结束后再发送');
}
},
- authLogin(e) {
+ async authLogin(e) {
if (!this.isAuth) {
this.$refs.uToast.show({
title: '请先阅读协议',
@@ -159,24 +219,32 @@ export default {
})
return
}
- uni.login({
- provider: 'weixin', //使用微信登录
- success: async (loginRes) => {
- try {
- const {token} = await this.$u.api.login({
- code: loginRes.code
+ if (this.vuex_user.mobile) {
+ this.$u.route({
+ type: 'switchTab',
+ url: '/pages/index/index'
+ })
+ }
+ try {
+ if (e.detail.code) {
+ const res = await this.$u.api.mobile({
+ code: e.detail.code
+ })
+ if (res.mobile) {
+ await this.$u.api.updateUser({
+ mobile: res.mobile
})
- this.$u.vuex('vuex_token', token)
const { user } = await this.$u.api.getUserInfo()
this.$u.vuex('vuex_user', user)
this.$u.route({
type: 'switchTab',
url: '/pages/index/index'
})
- } catch (err) {
}
}
- });
+ } catch (err) {
+ console.error(err)
+ }
},
openPrivacyContract() {
wx.openPrivacyContract({
@@ -190,7 +258,29 @@ export default {
},
});
},
- }
+ },
+ onShow() {
+ if (!this.vuex_token) {
+ uni.login({
+ provider: 'weixin', //使用微信登录
+ success: async (loginRes) => {
+ try {
+ const {token} = await this.$u.api.appletLogin({
+ code: loginRes.code
+ })
+ this.$u.vuex('vuex_token', token)
+ const { user } = await this.$u.api.getUserInfo()
+ this.$u.vuex('vuex_user', user)
+ } catch (err) {
+ console.error(err)
+ }
+ },
+ fail:err => {
+ console.log(err)
+ }
+ });
+ }
+ },
}
diff --git a/pages/me/me.vue b/pages/me/me.vue
index 93c0743..d27b5c9 100644
--- a/pages/me/me.vue
+++ b/pages/me/me.vue
@@ -4,9 +4,9 @@
-
+
- {{ vuex_user.name }}
+ {{ vuex_user.nickname || '微信用户' }}
去登录
@@ -40,7 +40,7 @@
-
+
退出登录
@@ -56,6 +56,25 @@
export default {
data() {
return {};
+ },
+ methods: {
+ logout() {
+ uni.showModal({
+ title: '提示',
+ content: '确认退出?',
+ success: status => {
+ if (status.confirm) {
+ this.$u.vuex('vuex_token', '')
+ this.$u.vuex('vuex_user', {})
+ uni.setStorageSync('lifeData', {})
+ this.$u.route({
+ url: '/pages/login/login',
+ type: 'tab'
+ })
+ }
+ }
+ })
+ }
}
}
diff --git a/uview-ui/components/u-form/u-form.vue b/uview-ui/components/u-form/u-form.vue
index bdbafaf..17f8ad3 100644
--- a/uview-ui/components/u-form/u-form.vue
+++ b/uview-ui/components/u-form/u-form.vue
@@ -88,7 +88,7 @@ export default {
},
methods: {
setRules(rules) {
- this.rules = rules;
+ console.log(this.rules)
},
// 清空所有u-form-item组件的内容,本质上是调用了u-form-item组件中的resetField()方法
resetFields() {
diff --git a/uview-ui/components/u-select/u-select.vue b/uview-ui/components/u-select/u-select.vue
index 1285845..f6c4fab 100644
--- a/uview-ui/components/u-select/u-select.vue
+++ b/uview-ui/components/u-select/u-select.vue
@@ -35,6 +35,7 @@
{{confirmText}}
+