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" : "国家文化专网网络注册登录系统",
"appid" : "",
"appid" : "__UNI__329D730",
"description" : "国家文化专网网络注册登录系统",
"versionName" : "2.0.3",
"versionCode" : 203,
@ -72,19 +72,19 @@
"mp-weixin" : {
"appid" : "",
"setting" : {
// TLS
"urlCheck" : true,
// es6es5
"es6" : false,
//
"minified" : true,
// wxml shadow-root
"showShadowRootInWxmlPanel" : true,
//
"minifyWXSS" : true,
// wxml
// uniapppwxml, , , false
"minifyWXML" : false
// TLS
"urlCheck" : true,
// es6es5
"es6" : false,
//
"minified" : true,
// wxml shadow-root
"showShadowRootInWxmlPanel" : true,
//
"minifyWXSS" : true,
// wxml
// uniapppwxml, , , false
"minifyWXML" : false
},
"usingComponents" : true,
"lazyCodeLoading" : "requiredComponents",

7
pages/home.vue

@ -181,7 +181,7 @@
//
import { checkLogin, showError } from '@/core/app'
import * as UserApi from '@/api/user'
import { userInfo } from 'os'
// import { userInfo } from 'os'
export default {
data() {
@ -199,6 +199,7 @@ import { userInfo } from 'os'
this.getUserInfo()
},
methods: {
//
init(){
if(checkLogin()==true){
@ -224,7 +225,7 @@ import { userInfo } from 'os'
.then(result => {
app.userInfo = result.data.userInfo
//
console.log(app.userInfo.grade_id)
this.hasverify = app.userInfo.grade_id>0?true:false
resolve(app.userInfo)
})
@ -248,7 +249,7 @@ import { userInfo } from 'os'
success(res) {
if (res.confirm) {
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--parts">
<view class="gjcode">
+86
<select>
<option class="">+86</option>
</select>
</view>
</view>
<input class="form-item--input" type="number" v-model="mobile" maxlength="11" placeholder="请输入手机号码" />
@ -48,6 +50,9 @@
</template>
<script>
import * as LoginApi from '@/api/login'
import * as Verify from '@/utils/verify'
import store from '@/store'
export default {
@ -70,12 +75,7 @@
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
console.log('login onLoad')
//
// await this.setShowUserInfo()
//
this.isLoad = true
console.log('isLoad', true)
// do nothing
},
methods: {
@ -87,45 +87,57 @@
//
handleLogin() {
const app = this
if (!app.isLoading && app.formValidation(SUBMIT_LOGIN)) {
if (!app.isLoading && app.formValidationName(app.mobile)) {
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>
@ -153,12 +165,13 @@
.form-item {
display: flex;
padding: 18rpx;
border-bottom: 1rpx solid #f3f1f2;
margin-bottom: 30rpx;
height: 126rpx;
&--input {
padding-left: 12rpx;
font-size: 28rpx;
border-bottom: 1rpx solid #f3f1f2;
letter-spacing: 1rpx;
flex: 1;
height: 100%;
@ -181,6 +194,7 @@
padding: 6rpx;
margin-right: 22rpx;
height: 100%;
border-right: 1px solid #034373;
background-color: #F8F8F8;
}
}

7
pages/login/loginsms.vue

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

Loading…
Cancel
Save