Browse Source

修改2

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

28
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,
@ -72,19 +72,19 @@
"mp-weixin" : { "mp-weixin" : {
"appid" : "", "appid" : "",
"setting" : { "setting" : {
// TLS // TLS
"urlCheck" : true, "urlCheck" : true,
// es6es5 // es6es5
"es6" : false, "es6" : false,
// //
"minified" : true, "minified" : true,
// wxml shadow-root // wxml shadow-root
"showShadowRootInWxmlPanel" : true, "showShadowRootInWxmlPanel" : true,
// //
"minifyWXSS" : true, "minifyWXSS" : true,
// wxml // wxml
// uniapppwxml, , , false // uniapppwxml, , , false
"minifyWXML" : false "minifyWXML" : false
}, },
"usingComponents" : true, "usingComponents" : true,
"lazyCodeLoading" : "requiredComponents", "lazyCodeLoading" : "requiredComponents",

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())
} }
} }
}) })

100
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)){
this.$toast('手机号不能为空')
return false
}
if(!Verify.isMobile(str)){
this.$toast('手机号格式不对')
return false
}
return true
},
formValidationPass(str){
if(Verify.isEmpty(str)){
this.$toast('密码不能为空')
return false
}
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)
//
// :
// uni.$emit('syncRefresh', true)
// this.$navTo("pages/home")
//
//setTimeout(() => app.onNavigateBack(1), 2000)
})
.catch(err => {
console.log(err);
})
.finally(() => app.isLoading = false)
}
/**
* 设置当前是否显示微信小程序授权登录
* - 条件1: 只有微信小程序才显示获取用户信息按钮
* - 条件2: 后台设置是否已开启该选项 [后台-客户端-注册设置]
*/
async setShowUserInfo() {
console.log('setShowUserInfo start')
const app = this
// , getUserProfile
const isMpWeixin = app.platform === 'MP-WEIXIN' && wx.canIUse('getUserProfile')
//
await SettingModel.item(SettingKeyEnum.REGISTER.value, false)
.then(setting => {
app.isMpWeixinAuth = isMpWeixin && setting.isOauthMpweixin
console.log('setShowUserInfo complete')
})
},
//
onGetUserInfoSuccess({ oauth, code, userInfo }) {
//
this.partyData = { oauth, code, userInfo }
//
this.onShowRegister()
},
//
onShowRegister() {
//
this.isMpWeixinAuth = false
//
this.isParty = true
}
} }
} }
</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