diff --git a/.idea/ehs_mp2.iml b/.idea/ehs_mp2.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/ehs_mp2.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a0ad843 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..e95ff16 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Logout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35,13 +36,42 @@ - + + 第三方登录 - + @@ -57,12 +87,15 @@ export default { data() { return { + wxcode: null, agreement: false, - checkedShow: false, + checkedShow: true, key: "", img: "", username: '', password: '', + phoneNumber: '', + message: '', code: "", isShow: true, myTopBgSrc: require("../../static/login/my-bg.jpg"), @@ -70,6 +103,11 @@ userContent: '', privacyContent: '', wxShow: false, + isPassword: true, + isMessage: false, + codeTips: "获取验证码", + testUrl: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf7d6140f507466be&redirect_uri=http%3A%2F%2Fqyjy.ctc-zc.com&response_type=code&scope=snsapi_base#wechat_redirect', + } }, onLoad() { @@ -132,7 +170,67 @@ }) }, - // + mpLogin() { + // #ifdef H5 + this.getWxCode() + // #endif + // #ifdef MP-WEIXIN + uni.showLoading({ + title: '微信登录中...', + mask: true + }) + uni.login({ + provider: 'weixin', + success: (loginRes) => { + this.$u.api.wxmplogin({ + code: loginRes.code + }).then(res => { + this.$u.vuex('vuex_token', res.access) + this.$u.api.getUserInfo().then(res => { + uni.hideLoading() + uni.showToast({ + title: "登录成功", + icon: "none" + }) + uni.reLaunch({ + url: "/pages/home/home" + }) + this.$u.vuex('vuex_user', res) + // 修改资源请求地址 + // this.$u.vuex('vuex_user.avatar', this.vuex_user.avatar + + // '?token=' + this.vuex_token) + }) + }).catch(e => { + uni.setStorageSync('wxmp_openid', e.data.wxmp_openid) + uni.hideLoading() + uni.showToast({ + title: "暂未绑定微信!", + icon: "none" + }) + }) + } + }); + // #endif + }, + // 获取code + // 先判断url中有没有code,如果有code,表明已经授权,如果没有code,跳转微信授权链接 + getWxCode() { + // 截取地址中的code,如果没有code就去微信授权,如果已经获取到code了就直接把code传给后台获取openId + let code = this.getUrlCode('code') + if (code === null || code === '') { + window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + this.vuex_appid + + '&redirect_uri=' + encodeURIComponent(this.vuex_login) + + '&response_type=code&scope=snsapi_base&state=1#wechat_redirect' + // redirect_uri是授权成功后,跳转的url地址,微信会帮我们跳转到该链接,并且通过?的形式拼接code,这里需要用encodeURIComponent对链接进行处理。 + // 如果配置参数一一对应,那么此时已经通过回调地址刷新页面后,你就会再地址栏中看到code了。 + // http://127.0.0.1/pages/views/profile/login/login?code=001BWV4J1lRzz00H4J1J1vRE4J1BWV4q&state=1 + } else { + this.wxcode = code + this.wxcodeLogin() + } + // } + }, + updateCidFn(username) { var data = { userCid: uni.getStorageSync('setcid'), @@ -186,33 +284,69 @@ }; return true; }, + changeLogType(index) { + if (index === 'password') { + this.isPassword = true; + this.isMessage = false; + } else { + this.isPassword = false; + this.isMessage = true; + } + }, formSubmit(e) { var that = this; const obj = e.target.value; if (!that.checkedParams(obj)) return; debugger; console.log(obj) - that.$u.api.login(obj).then(res=>{ + that.$u.api.login(obj).then(res => { that.$u.vuex('vuex_token', res.access) that.$u.vuex('vuex_refresh', res.refresh) // let data = {openid: uni.getStorageSync('wxmp_openid')} // that.$u.api.bindmp(data).then(res=>{}) - that.$u.api.getUserInfo().then(res=>{ + that.$u.api.getUserInfo().then(res => { that.$u.vuex('vuex_user', res) // 修改资源请求地址 }) uni.reLaunch({ - url:'/pages/home/home_' + url: '/pages/home/home_' }) - } - ).catch(e=>{ + }).catch(e => { console.log(e) uni.showToast({ - title:'账户密码错误', - icon:'none' + title: '账户密码错误', + icon: 'none' }) }) - } + }, + + codeChange(text) { + this.codeTips = text; + }, + // 获取验证码 + getCode() { + debugger; + if (this.phoneNumber !== '') { + uni.showLoading({ + title: '正在获取验证码', + mask: true + }) + this.$u.api.getCode({ + phone: 16619852123 + }).then(res => { + setTimeout(() => { + uni.hideLoading(); + // 这里此提示会被this.start()方法中的提示覆盖 + this.$u.toast('验证码已发送'); + // 通知验证码组件内部开始倒计时 + this.$refs.uCode.start(); + }, 2000); + }) + } else { + // this.$u.toast('倒计时结束后再发送'); + this.$u.toast('请输入手机号'); + } + }, } } @@ -322,8 +456,12 @@ padding: 62rpx; } + .typeText { + margin-right: 20rpx; + } + .active { - font-size: 38rpx; + font-size: 34rpx; line-height: 72rpx; color: #2c6fd9; font-weight: bold; @@ -333,7 +471,7 @@ .active::after { display: block; content: ""; - width: 42rpx; + width: 100%; height: 6rpx; background-color: #2c6fd9; border-radius: 3rpx; @@ -355,6 +493,10 @@ margin-bottom: 56rpx; } + .loginItemInput { + border-radius: 0 88rpx 88rpx 0; + } + .code-img-item { padding-left: 72rpx; } @@ -389,6 +531,20 @@ background-color: #EEEEEE; } + .getMessageCode { + width: fit-content; + position: absolute; + top: 10%; + right: 20rpx; + height: 80%; + color: #ffffff; + font-size: 26rpx; + border-color: #19be6b; + background-color: #19be6b; + z-index: 100; + border-radius: 36rpx !important; + } + .login-btn, .register-btn { width: 635rpx; diff --git a/pages/login/login_password.vue b/pages/login/login_password.vue index f96b4b7..2fc6811 100644 --- a/pages/login/login_password.vue +++ b/pages/login/login_password.vue @@ -60,7 +60,9 @@ export default { }, onReady() { this.$refs.uForm.setRules(this.rules); + // #ifdef MP-WEIXIN uni.hideHomeButton() + // #endif }, computed: { inputStyle() { @@ -79,10 +81,19 @@ export default { this.$u.api.login(this.loginForm).then( res=>{ this.$u.vuex('vuex_token', res.access) + // #ifdef MP-WEIXIN let data = {openid: uni.getStorageSync('wxmp_openid')} this.$u.api.bindmp(data).then(res=>{}) + // #endif + // #ifdef H5 + let data = {openid: uni.getStorageSync('wx_openid')} + if(data){ + this.$u.api.bindwx(data).then(res=>{}) + } + // #endif this.$u.api.getUserInfo().then(res=>{ this.$u.vuex('vuex_user', res) + // 修改资源请求地址 }) uni.reLaunch({ diff --git a/pages/my/my.vue b/pages/my/my.vue index acfb489..5f9c5ec 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -13,12 +13,16 @@ - + {{vuex_user.name}} - {{vuex_user.type}} + + + + + @@ -28,6 +32,7 @@ 我的申请 + @@ -43,6 +48,7 @@ + diff --git a/pages/my/my_.vue b/pages/my/my_.vue index 2058709..7762ffe 100644 --- a/pages/my/my_.vue +++ b/pages/my/my_.vue @@ -1,101 +1,451 @@ - - + -c \ No newline at end of file diff --git a/pages/workSpace/list/opreation.vue b/pages/workSpace/list/opreation.vue new file mode 100644 index 0000000..d907575 --- /dev/null +++ b/pages/workSpace/list/opreation.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/pages/workSpace/list/rpj.vue b/pages/workSpace/list/rpj.vue new file mode 100644 index 0000000..649f75d --- /dev/null +++ b/pages/workSpace/list/rpj.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/pages/workSpace/list/visit.vue b/pages/workSpace/list/visit.vue new file mode 100644 index 0000000..f149934 --- /dev/null +++ b/pages/workSpace/list/visit.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/pages/workSpace/workSpace.vue b/pages/workSpace/workSpace.vue index a30a4a1..8e44d3b 100644 --- a/pages/workSpace/workSpace.vue +++ b/pages/workSpace/workSpace.vue @@ -1,10 +1,11 @@