Browse Source

修改2

master
453530270@qq.com 2 years ago
parent
commit
f7d359109d
  1. 2
      manifest.json
  2. 7
      pages/home.vue
  3. 92
      pages/login/index.vue
  4. 7
      pages/login/loginsms.vue

2
manifest.json

@ -1,6 +1,6 @@
{ {
"name" : "国家文化专网网络注册登录系统", "name" : "国家文化专网网络注册登录系统",
"appid" : "", "appid" : "__UNI__329D730",
"description" : "国家文化专网网络注册登录系统", "description" : "国家文化专网网络注册登录系统",
"versionName" : "2.0.3", "versionName" : "2.0.3",
"versionCode" : 203, "versionCode" : 203,

7
pages/home.vue

@ -181,7 +181,7 @@
// //
import { checkLogin, showError } from '@/core/app' import { checkLogin, showError } from '@/core/app'
import * as UserApi from '@/api/user' import * as UserApi from '@/api/user'
import { userInfo } from 'os' // import { userInfo } from 'os'
export default { export default {
data() { data() {
@ -199,6 +199,7 @@ import { userInfo } from 'os'
this.getUserInfo() this.getUserInfo()
}, },
methods: { methods: {
// //
init(){ init(){
if(checkLogin()==true){ if(checkLogin()==true){
@ -224,7 +225,7 @@ import { userInfo } from 'os'
.then(result => { .then(result => {
app.userInfo = result.data.userInfo app.userInfo = result.data.userInfo
// //
console.log(app.userInfo.grade_id)
this.hasverify = app.userInfo.grade_id>0?true:false this.hasverify = app.userInfo.grade_id>0?true:false
resolve(app.userInfo) resolve(app.userInfo)
}) })
@ -248,7 +249,7 @@ import { userInfo } from 'os'
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
store.dispatch('Logout', {}) store.dispatch('Logout', {})
.then(result => app.onRefreshPage()) .then(result => app.init())
} }
} }
}) })

92
pages/login/index.vue

@ -11,7 +11,9 @@
<view class="form-item"> <view class="form-item">
<view class="form-item--parts"> <view class="form-item--parts">
<view class="gjcode"> <view class="gjcode">
+86 <select>
<option class="">+86</option>
</select>
</view> </view>
</view> </view>
<input class="form-item--input" type="number" v-model="mobile" maxlength="11" placeholder="请输入手机号码" /> <input class="form-item--input" type="number" v-model="mobile" maxlength="11" placeholder="请输入手机号码" />
@ -48,6 +50,9 @@
</template> </template>
<script> <script>
import * as LoginApi from '@/api/login'
import * as Verify from '@/utils/verify'
import store from '@/store'
export default { export default {
@ -70,12 +75,7 @@
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
async onLoad(options) { async onLoad(options) {
console.log('login onLoad') // do nothing
//
// await this.setShowUserInfo()
//
this.isLoad = true
console.log('isLoad', true)
}, },
methods: { methods: {
@ -87,45 +87,57 @@
// //
handleLogin() { handleLogin() {
const app = this const app = this
if (!app.isLoading && app.formValidation(SUBMIT_LOGIN)) { if (!app.isLoading && app.formValidationName(app.mobile)) {
app.submitLogin() app.submitLogin()
} }
}, },
//todo
/** formValidationName(str){
* 设置当前是否显示微信小程序授权登录 if(Verify.isEmpty(str)){
* - 条件1: 只有微信小程序才显示获取用户信息按钮 this.$toast('手机号不能为空')
* - 条件2: 后台设置是否已开启该选项 [后台-客户端-注册设置] return false
*/ }
async setShowUserInfo() { if(!Verify.isMobile(str)){
console.log('setShowUserInfo start') this.$toast('手机号格式不对')
const app = this return false
// , getUserProfile }
const isMpWeixin = app.platform === 'MP-WEIXIN' && wx.canIUse('getUserProfile') return true
//
await SettingModel.item(SettingKeyEnum.REGISTER.value, false)
.then(setting => {
app.isMpWeixinAuth = isMpWeixin && setting.isOauthMpweixin
console.log('setShowUserInfo complete')
})
}, },
// formValidationPass(str){
onGetUserInfoSuccess({ oauth, code, userInfo }) { if(Verify.isEmpty(str)){
// this.$toast('密码不能为空')
this.partyData = { oauth, code, userInfo } return false
// }
this.onShowRegister() return true
}, },
//
submitLogin(){
const app = this
app.isLoading = true
store.dispatch('Login', {
smsCode: app.code,
mobile: app.newPhone
// isParty: false,
// partyData: ""
})
.then(result => {
//
app.$toast(result.message)
//
// // :
onShowRegister() { // uni.$emit('syncRefresh', true)
// // this.$navTo("pages/home")
this.isMpWeixinAuth = false //
// //setTimeout(() => app.onNavigateBack(1), 2000)
this.isParty = true })
.catch(err => {
console.log(err);
})
.finally(() => app.isLoading = false)
} }
} }
} }
</script> </script>
@ -153,12 +165,13 @@
.form-item { .form-item {
display: flex; display: flex;
padding: 18rpx; padding: 18rpx;
border-bottom: 1rpx solid #f3f1f2;
margin-bottom: 30rpx; margin-bottom: 30rpx;
height: 126rpx; height: 126rpx;
&--input { &--input {
padding-left: 12rpx;
font-size: 28rpx; font-size: 28rpx;
border-bottom: 1rpx solid #f3f1f2;
letter-spacing: 1rpx; letter-spacing: 1rpx;
flex: 1; flex: 1;
height: 100%; height: 100%;
@ -181,6 +194,7 @@
padding: 6rpx; padding: 6rpx;
margin-right: 22rpx; margin-right: 22rpx;
height: 100%; height: 100%;
border-right: 1px solid #034373;
background-color: #F8F8F8; background-color: #F8F8F8;
} }
} }

7
pages/login/loginsms.vue

@ -30,7 +30,7 @@
</view> </view>
<!-- 密码登录 --> <!-- 密码登录 -->
<view class="vfcode">密码登录</view> <view class="vfcode" @click="gtsms('upass')" >密码登录</view>
<!-- logo --> <!-- logo -->
<view class="vbottom"> <view class="vbottom">
@ -67,7 +67,10 @@ import store from '@/store'
}, },
methods: { methods: {
//goto smslogin
gtsms(){
this.$navTo("pages/login/index")
},
// //
handleLogin() { handleLogin() {
const app = this const app = this

Loading…
Cancel
Save