main
123456 4 months ago
parent 34f3bde38d
commit ba1a5ef6c8
  1. 28
      androidPrivacy.json
  2. 45
      api/index.js
  3. 52
      api/request.js
  4. 20
      manifest.json
  5. 112
      pages/login/index.vue
  6. 1
      新建文本文档.txt

@ -0,0 +1,28 @@
{
"version" : "1",
"prompt" : "template",
"title" : "服务协议与隐私政策",
"message" : "\t <br/>\r\r
\t <a href=\"https://admin.njshengsong.cn/pages/users/user_about/index?from=sys_user_agree\">《用户协议》</a> 与 <a href=\"https://admin.njshengsong.cn/pages/users/user_about/index?from=sys_userr_privacy\">《隐私政策》</a>了解详细信息。如你同意,请点击“我同意”开始接受我们的服务。",
"buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意",
"second" : {
"title" : "确认提示",
"message" : "进入应用前,你需先同意<a href=\"https://admin.njshengsong.cn/pages/users/user_about/index?from=sys_user_agree\">《用户协议》</a> 与 <a href=\"https://admin.njshengsong.cn/pages/users/user_about/index?from=sys_userr_privacy\">《隐私政策》</a>,否则将退出应用。",
"buttonAccept" : "同意并继续",
"buttonRefuse" : "退出应用"
},
"styles" : {
"backgroundColor" : "#fff",
"borderRadius" : "5px",
"title" : {
"color" : "#000"
},
"buttonAccept" : {
"color" : "#fff"
},
"buttonRefuse" : {
"color" : "#ccc"
}
}
}

@ -0,0 +1,45 @@
import { request } from './request'
const api = {
//发送验证码
sendMsm(data) {
return request({
url: 'api/sendSmsCode',
method: 'post',
data
})
},
//登录
toLogin(data) {
return request({
url: 'api/loginByCode',
method: 'post',
data
})
},
//授权登录
mnpLogin(data) {
return request({
url: 'api/Login/mnpLogin',
method: 'post',
data
})
},
//修改用户信息
editMember(data) {
return request({
url: 'api/user/profile',
method: 'post',
data
})
},
//用户信息
getMemberInfo(data) {
return request({
url: 'api/user/getinfo',
method: 'post',
data
})
}
}
export default api

@ -0,0 +1,52 @@
import Vue from 'vue'
let baseUrl = 'https://zhengxin.njrenzhou.cn';
Vue.prototype.$baseUrl = baseUrl;
export function request(prams) {
return new Promise((resolve, reject) => {
let url;
url = baseUrl+"/"+prams.url;
console.log(url)
uni.request({
url: url,
data: prams.data,
method: prams.method,
header: {
"token": uni.getStorageSync('token'),
"Content-type": "application/x-www-form-urlencoded"
},
success: (res) => {
if (res.data.code == 1 ){
resolve(res.data);
}else if(res.data.code == 401){
uni.showModal({
title: "温馨提示",
content: "当前账号已过期,是否重新登录",
confirmColor: "#05754D",
success(res) {
uni.removeStorageSync("userInfo")
uni.removeStorageSync("token")
uni.navigateTo({
url: "/pages/login/login"
})
}
})
} else {
reject(res.data);
uni.showToast({
icon: "none",
title: res.data.msg,
duration: 3000
});
}
},
fail: (err) => {
reject(err);
},
complete: () => {
//console.log('请求完成')
}
});
})
}

@ -17,7 +17,10 @@
"delay" : 0
},
/* */
"modules" : {},
"modules" : {
"Geolocation" : {},
"OAuth" : {}
},
/* */
"distribute" : {
/* android */
@ -43,7 +46,20 @@
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
"sdkConfigs" : {
"geolocation" : {
"amap" : {
"name" : "amap_17321661234Ay6qpQnkC",
"__platform__" : [ "ios", "android" ],
"appkey_ios" : "49e860f8b39479b15db1110fb3e62286",
"appkey_android" : "d2e40f882c2fde0f3724791cb82cbd9c"
}
},
"oauth" : {}
},
"splashscreen" : {
"useOriginalMsgbox" : true
}
}
},
/* */

@ -3,16 +3,16 @@
<view class="login-hd">注册账号</view>
<view class="login-bd">
<view class="item">
<input placeholder="请输入手机号" type="number" />
<input v-model="phone" placeholder="请输入手机号" type="number" />
</view>
<view class="item" v-if="isShow">
<input placeholder="请输入短信验证码" type="number" />
<view class="code">获取验证码</view>
<input v-model="code" placeholder="请输入短信验证码" type="number" />
<view class="code" @click="sendCode()">{{count == 60?'获取验证码': count+'s'}}</view>
</view>
<view class="item" v-else>
<input placeholder="请输入密码" type="password" />
<input v-model="password" placeholder="请输入密码" type="password" />
</view>
<view class="btn">登录</view>
<view class="btn" @click="toLogin()">登录</view>
<view class="info">
<view class="a">新用户注册</view>
<view class="b" @click="onToggle()">{{isShow?'密码登录':'验证码登录'}}</view>
@ -31,11 +31,17 @@
</template>
<script>
let timer = null;
export default {
data() {
return {
isClick: true,
isCheck: true,
isShow: true
isShow: true,
phone: "",
code: "",
password: "",
count: 60
};
},
methods: {
@ -45,11 +51,105 @@
clickCheck() {
this.isCheck = !this.isCheck
},
//
async sendCode() {
const that = this;
if(!that.phone){
uni.showToast({
icon: "none",
title: "手机号不能为空!",
})
return
}
if(!/^1[3456789]\d{9}$/.test(that.phone)){
uni.showToast({
title: '手机号格式不能为空!',
icon: "none",
})
return ;
}
if(that.isClick == false){
return ;
}
const { code, data, msg } = await that.$api.sendCode({
phone: that.phone
});
if(code == 1){
that.isClick = false;
timer = setInterval(()=>{
if(that.count == 0){
clearInterval(timer);
that.count = 60;
that.isClick = true;
}else{
that.count --
}
},1000)
uni.showToast({
icon: "none",
title: "发送成功"
})
}else{
that.isClick = true;
}
},
//
async toLogin() {
const that = this;
if(!that.phone){
uni.showToast({
icon: "none",
title: "手机号不能为空!",
})
return
}
if(!/^1[3456789]\d{9}$/.test(that.phone)){
uni.showToast({
title: '手机号格式不能为空!',
icon: "none",
})
return ;
}
if(that.isShow == true){
if(!that.code){
uni.showToast({
icon: "none",
title: "验证码不能为空!",
})
return
}
}else{
if(!that.password){
uni.showToast({
icon: "none",
title: "密码不能为空!",
})
return
}
}
const {code, data, msg} = await this.$api.toLogin({
phone: this.phone,
code: this.code
})
if(code == 1){
uni.showToast({
title: "登录成功"
})
}else{
uni.showToast({
icon: "none",
title: msg
})
}
},
}
}
</script>
<style scoped lang="scss">
page{
background-color: #FFFFFF;
}
.login{
padding: 0 50rpx;
overflow: hidden;

@ -0,0 +1 @@
https://console-docs.apipost.cn/preview/fcdafa982d33921a/a79bbc0bf3e503dc
Loading…
Cancel
Save