添加测评登录

This commit is contained in:
贺平 2024-09-29 17:49:07 +08:00
parent d3d59409e0
commit 6126ea916b
8 changed files with 915 additions and 52 deletions

View File

@ -6,6 +6,8 @@ export default {
baseUrl: 'https://syjk.yhy.ren/xcx-api/', // 生产
// baseUrl:'http://192.171.1.17:8082/',
// baseUrl1:'http://syjk.yhy.ren/prod-api',//大屏
//baseUrl:'http://192.171.1.17:9206/',
post(url, param) {
return this.ajax('post', url, param)

View File

@ -120,7 +120,14 @@ export default { // 所有接口
//http://192.171.1.22:9206/ytj-report/testReportDetails?userId=15&familyId=1
testReportDetails: (param) => ajax.get(`ytj-report/testReportDetails`, param),
//登录
sendTheVerificationCodeXcx: (param) => ajax.get('sysUser/sendTheVerificationCodeXcx', param), // 发送手机号验证码
xcxLogin: (param) => ajax.get('userLogin/login/xcxLogin', param), // 小程序登录
wechatScanCodeLogin: (param) => ajax.get('userLogin/login/wechatScanCodeLogin', param), // 微信扫码登录
perfectTheInformationXcx: (param) => ajax.post('sysUser/perfectTheInformationXcx', param), // 个人用户登录注册or web未使用手机号注册企业用户登录绑定小程序专用
completeInformation: (param) => ajax.get('/sysUser/completeInformation', param), //查询用户基本信息
customerDropDownBox: (param) => ajax.get('sysUser/customerDropDownBox', param), // 客户列表
perfectTheInformation: (param) => ajax.post('sysUser/perfectTheInformationXcx?application=true', param), // 注册或者保存信息
queryLargeScreenData: (param) => ajax1.get(`dataDetection/facilityChart/queryLargeScreenData`, param), //数据大屏

54
package-lock.json generated
View File

@ -4224,6 +4224,27 @@
"whatwg-fetch": "^3.6.2"
},
"dependencies": {
"@vue/vue-loader-v15": {
"version": "npm:vue-loader@15.11.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.11.1.tgz",
"integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
"dev": true,
"requires": {
"@vue/component-compiler-utils": "^3.1.0",
"hash-sum": "^1.0.2",
"loader-utils": "^1.1.0",
"vue-hot-reload-api": "^2.3.0",
"vue-style-loader": "^4.1.0"
},
"dependencies": {
"hash-sum": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz",
"integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
"dev": true
}
}
},
"acorn": {
"version": "8.10.0",
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.10.0.tgz",
@ -4479,19 +4500,6 @@
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.4.tgz",
"integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ=="
},
"@vue/vue-loader-v15": {
"version": "npm:vue-loader@15.11.1",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.11.1.tgz",
"integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
"dev": true,
"requires": {
"@vue/component-compiler-utils": "^3.1.0",
"hash-sum": "^1.0.2",
"loader-utils": "^1.1.0",
"vue-hot-reload-api": "^2.3.0",
"vue-style-loader": "^4.1.0"
}
},
"@vue/web-component-wrapper": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz",
@ -5564,15 +5572,6 @@
"resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bl": {
"version": "4.1.0",
"resolved": "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz",
@ -8746,12 +8745,6 @@
"escape-string-regexp": "^1.0.5"
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"optional": true
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz",
@ -9038,7 +9031,7 @@
},
"fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"optional": true
},
@ -18518,11 +18511,10 @@
},
"fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-1.2.13.tgz",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},

View File

@ -16,6 +16,8 @@ Vue.prototype.$preventClick = function(times = 2000) { // 防抖
this._CLICK = true
setTimeout(() => this._CLICK = false, times)
}
const app = new Vue({
...App
})

View File

@ -143,6 +143,13 @@
"backgroundColor":"#3AAFB8"
}
},
{
"path" : "pages/login/ImproveInformation/ImproveInformation",
"style" :
{
"navigationBarTitleText" : ""
}
}
],

View File

@ -53,10 +53,12 @@
<view class="flex align-center" style="margin-top: 36px;">
<image :src="item.imgAddress" class="imgAddress"></image>
<view>
<view class="titleInter">{{item.dishName}}</view>
<view v-if="item.tags" class="flex flex-wrap">
<view v-for="(item2,index2) in item.tags.split('、')" class="tag">{{item2}}</view>
</view>
</view>
</view>
</block>

View File

@ -0,0 +1,549 @@
<template>
<view class="pageBox">
<view class="contioner">
<view class="flex-contion">
<view class="themColor text-df text-bold marginRight-xs" @click="perfectIndex=0" v-if="perfectIndex==1">
上一步</view>
<progress :percent="percent" activeColor="#3AAFB8" border-radius="50" class="flex-sub" />
</view>
<block v-if="perfectIndex==0">
<view class="text-four marginTop text-center">生理性别和激素会影响我的身体代谢食物的方式</view>
<view class="text-bold marginTop-xl"># 你的姓名</view>
<view class="marginTop flex-align">
<input v-model="realName" maxlength="10" style="border: 1rpx solid #eee;padding: 5rpx; width: 100%;" />
</view>
<view class="text-bold marginTop-xl"># 选择你的性别</view>
<view class="marginTop flex-align">
<view class="flex-conter flex-direction text-sm" @click="tabClick(0)">
<image src="https://shayu5qny.yhy.ren/login-boy.png" class="img"></image>
<view :class="genIndex==0?'tagShaw':''">男性</view>
</view>
<view class="flex-conter flex-direction text-sm" @click="tabClick(1)">
<image src="https://shayu5qny.yhy.ren/login-gilr.png" class="img"></image>
<view :class="genIndex==1?'tagShaw':''">女性</view>
</view>
</view>
<view class="text-bold marginTop-xl"># 选择你的出生年月</view>
<!-- 时间选择器 -->
<picker-view class="picker-view" indicator-class="city-picker" mask-style="background:#E6EFF1;opacity:0"
:value="value" :indicator-style="indicatorStyle" @change="bindChange($event)">
<picker-view-column>
<view class="item" v-for="(item2,index2) in years" :key="index2"
:class="value[0]==index2?'pickerSelected':''">
{{item2}}
</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item3,index3) in months" :key="index3"
:class="value[1]==index3?'pickerSelected':''">
{{item3}}
</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item4,index4) in days" :key="index4"
:class="value[2]==index4?'pickerSelected':''">
{{item4}}
</view>
</picker-view-column>
</picker-view>
</block>
<block v-else>
<view class="text-center">
<image
:src="genIndex==0?'https://shayu5qny.yhy.ren/login-boy.png':'https://shayu5qny.yhy.ren/login-gilr.png'"
class="boyGirl"></image>
</view>
<view class="text-four">身高体重信息对发现或筛查某些疾病有重要的参考价值</view>
<view class="text-bold marginTop-xl"># 选择你的身高</view>
<view class="text-center text-bold margin-bottom-xs marginTop-sm">{{height}}CM</view>
<scale :min="0" :max="300" :int="true" :single="10" :h="40" :active="height" :styles="styles"
@value="heightSelect" ref="height" />
<view class="text-bold marginTop-xl"># 选择你的体重</view>
<view class="text-center text-bold margin-bottom-xs marginTop-sm">{{weight}}KG</view>
<scale :min="0" :max="300" :int="true" :single="10" :h="40" :active="weight" :styles="styles"
@value="weightSelect" ref="weight" />
</block>
<view class="flex-conter" @click="next">
<view class="btn">{{perfectIndex==0?'下一步':'完成'}}</view>
</view>
</view>
<!-- 检测企业 未注册企业弹框 -->
<uni-popup type="center" ref="detection" :is-mask-click="false">
<view class="detectionCard">
<uni-icons type="closeempty" size="28" class="closeempty" @click="closeDetection"></uni-icons>
<view class="text-center">
<image src="https://shayu5qny.yhy.ren/corporateConnections.png" class="corporateConnections">
</image>
</view>
<!-- 检测企业内容 -->
<block v-if="type==1">
<view class="fourSix text-bold text-center">检测到您是非企业用户</view>
<view class="fourSix text-bold text-center marginBottom-xl">是否立即加入企业</view>
<view class="btnTk" @click="changeType">立即加入</view>
<view class="btnTk whiteShaw" @click="personalLogin">个人用户登录</view>
</block>
<!-- 未注册企业内容 -->
<block v-else>
<view class="fourSix text-bold text-center">未查询到您的数据</view>
<view class="fourSix text-bold text-center marginBottom-xl">请联系企业注册</view>
<view class="btnTk">去联系</view>
<view class="btnTk tranform">取消</view>
</block>
</view>
</uni-popup>
<!-- 加入企业弹框 -->
<uni-popup type="center" ref="join" :is-mask-click="false">
<view class="detectionCard">
<uni-icons type="closeempty" size="28" class="closeempty" @click="closeJoin"></uni-icons>
<view class="fourSix text-bold text-center marginBottom-xl">加入企业</view>
<input v-model="key" placeholder="请输入激活码" class="inputClass marginBottom-xl marginTop-xl" />
<view class="btnTk" @click="joinNow">立即加入</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
toast,
showLoading,
hideLoading,
debounce,
formatTime
// preventClick,
} from "/tool/index.js"
import config from '/api/config.js'
export default {
data() {
const date = new Date()
const years = []
const months = []
const days = []
var yearIndex = 0
for (let i = 1900; i <= date.getFullYear(); i++) {
if (i <= 2000) {
yearIndex++;
}
years.push(i)
}
for (let i = 1; i <= 12; i++) {
months.push(i)
}
for (let i = 1; i <= 31; i++) {
days.push(i)
}
return {
realName:"",
percent: 50, //
perfectIndex: 0, //
genIndex: 0, //0 1
years, //
months, //
days, //
yearIndex,
monthIndex: 0,
datIndex: 0,
value: [], //
height: 170, //
weight: 50, //
type: 1, // 2
enterprise: 0, //
phone: '', //
code: '', //
//
range: [],
indicatorStyle: `height: 50px;`,
styles: {
line: '#96d0d6',
bginner: '#fff',
bgoutside: '#d4e7ea',
font: '#3AAFB8',
fontColor: '#3AAFB8',
fontSize: 12,
paddingLeft: '345rpx'
},
year: '',
month: '',
day: '',
dateIndex: '2000-01-01',
userId: null,
yesNoEnterpriseUser: null,
keyName: '',
key: '',
currDate: formatTime(new Date()).split(" ")[0],
}
},
onLoad(opt) {
// 0 1
this.yesNoEnterpriseUser = opt.flag
this.userId = opt.userId
this.phone = opt.phone
if ("null" != opt.userId) {
this.$API.completeInformation({
data: {
userId: this.userId
}
}).then((res) => {
var user = res.data
if (null != user && null != user.sex) {
this.genIndex = user.sex
}
if (null != user && null != user.birtyday) {
var useryear = user.birtyday.split("-")[0];
var usermonth = user.birtyday.split("-")[1];
var userday = user.birtyday.split("-")[2];
this.dateIndex = useryear + '-' + usermonth + '-' + userday
var yearUserIndex = 0;
var monthUserIndex = 0;
var dayUserIndex = 0;
const date = new Date()
for (let i = 1900; i <= date.getFullYear(); i++) {
if (i <= useryear) {
yearUserIndex++;
}
}
this.yearIndex = yearUserIndex;
for (let i = 1; i <= 12; i++) {
if (i < parseInt(usermonth)) {
monthUserIndex++;
}
}
for (let i = 1; i <= 31; i++) {
if (i < parseInt(userday)) {
dayUserIndex++;
}
}
//
this.value = [yearUserIndex - 1, monthUserIndex, dayUserIndex]
}
//
if (null != user && null != user.height) {
this.height = parseInt(user.height)
}
if (null != user && null != user.weight) {
this.weight = parseInt(user.weight)
}
})
} else {
this.value = [this.yearIndex - 1, 0, 0]
}
},
methods: {
//
personalLogin() {
if (this.$preventClick()) return
var rsq = {
sex: this.genIndex,
birthday: this.dateIndex,
height: this.height,
weight: this.weight,
phone: this.phone,
type: 0
}
this.saveInfoAndLogin(rsq)
},
changeType() {
var that = this
//
this.$API.customerDropDownBox({
data: {}
}).then((res) => {
if (null != res.data) {
res.data.forEach(function(item, index, array) {
that.range.push({
value: item.userId,
text: item.nickName
})
})
}
this.$refs.join.open()
})
},
//
tabClick(index) {
this.genIndex = index
},
//
bindChange: function(e) {
this.value = e.detail.value
this.year = this.years[this.value[0]]
this.month = this.months[this.value[1]]
this.day = this.days[this.value[2]]
if (this.month < 10) {
this.month = 0 + "" + this.month
}
if (this.day < 10) {
this.day = 0 + "" + this.day
}
this.dateIndex = this.year + '-' + this.month + '-' + this.day
},
//
async next() {
// console.log(this.dateIndex);
// return
if (this.$preventClick()) return
var that = this
if (this.perfectIndex == 0) {
if (this.dateIndex > this.currDate) return toast('出生日期不能大于当前日期')
this.perfectIndex = 1
this.percent = 100
} else {
//
var rsq = {
userId: that.userId,
sex: that.genIndex,
birthday: that.dateIndex,
height: that.height,
weight: that.weight,
phone: that.phone
}
// 0 1
if (this.yesNoEnterpriseUser == 1) {
this.$refs.detection.open()
} else {
//
this.saveInfoAndLogin(rsq)
}
}
},
//sysUser/perfectTheInformation userId
//sysUser/perfectTheInformation userId
//sysUser/perfectTheInformation userId
async saveInfoAndLogin(data) {
showLoading('请稍等...')
var that = this
//let openId = await this.$store.dispatch(types.GET_OPEN_ID)
//data.openId = openId
data.realName = that.realName
let ret1 = this.$API.perfectTheInformation({
data: data,
}).then((res) => {
if (res.code != 200) {
return toast(res.msg)
}else{
hideLoading()
let userInfo = res.data
let token = openId
let data = res.data
uni.setStorageSync('userInfo',res.data);
//
}
})
},
//
heightSelect(msg) {
setTimeout(() => {
this.height = msg;
}, 0)
},
//
weightSelect(msg) {
setTimeout(() => {
this.weight = msg;
}, 0)
},
//
closeDetection() {
this.$refs.detection.close()
},
//
closeJoin() {
this.$refs.join.close()
this.clearJoin()
},
//
clearJoin() {
this.enterprise = 0
this.keyName = ''
this.key = ''
},
//
changeEnterprise(e) {
console.log("e:", e);
},
//
joinNow() {
if (this.$preventClick()) return
if ('' == this.key) {
return toast('请填写激活码')
}
var rsq = {
sex: this.genIndex,
birthday: this.dateIndex,
height: this.height,
weight: this.weight,
phone: this.phone,
key: this.key,
type: 1
}
this.saveInfoAndLogin(rsq)
},
//
goHome() {
uni.reLaunch({
url: "/pages/tabBar/home/home"
})
},
},
}
</script>
<style lang="scss" scoped>
.themColor {
color: $uni-color;
}
.fourSix {
font-size: 46rpx;
}
.contioner {
padding: 26rpx 80rpx;
color: #3F4040;
.img {
$wh: 160rpx;
width: $wh;
height: $wh;
margin-bottom: 24rpx;
}
.tagShaw {
width: 140rpx;
line-height: 40rpx;
text-align: center;
color: #FFFFFF;
background: $uni-color;
border-radius: 30rpx;
}
.picker-view {
text-align: center;
width: 100%;
margin: 0 auto;
height: 450upx;
overflow: hidden;
font-size: 40rpx;
color: #909292;
margin-top: 20rpx;
.pickerSelected {
color: $uni-color;
}
.item {
//line-height: 100rpx;
text-align: center;
}
}
.city-picker {
border-top: 2rpx solid $uni-color;
border-bottom: 2rpx solid $uni-color;
}
.btn {
position: fixed;
bottom: 48rpx;
width: 622rpx;
line-height: 84rpx;
text-align: center;
background: $uni-color;
border-radius: 50rpx;
color: #FFFFFF;
font-size: 28rpx;
margin-top: 80rpx;
}
.boyGirl {
$wh: 80rpx;
width: $wh;
height: $wh;
margin-top: 42rpx;
margin-bottom: 20rpx;
}
}
.detectionCard {
width: 600rpx;
background: #FFFFFF;
border-radius: 21rpx;
padding: 62rpx 30rpx;
position: relative;
.corporateConnections {
width: 310rpx;
height: 186rpx;
padding-bottom: 50rpx;
}
.btnTk {
margin: 0 auto;
width: 500rpx;
line-height: 103rpx;
text-align: center;
background: $uni-color;
border-radius: 10rpx;
color: #FFFFFF;
font-size: 41rpx;
margin-top: 20rpx;
}
.whiteShaw {
background: #FFFFFF;
color: $uni-color;
border: 3rpx solid #3AAFB8;
}
.closeempty {
position: absolute;
top: 41rpx;
right: 41rpx;
}
.tranform {
background: #FFFFFF;
color: #999999;
}
::v-deep .uni-select__input-placeholder {
font-size: 36rpx;
}
::v-deep .uni-select {
border-radius: 22rpx;
background: #F7F7F7;
height: 103rpx;
font-size: 36rpx;
color: #17191A;
font-weight: bold;
border: none;
padding-left: 40rpx;
}
.inputClass {
border-radius: 22rpx;
background: #F7F7F7;
height: 103rpx;
font-size: 36rpx;
color: #17191A;
font-weight: bold;
padding-left: 40rpx;
}
.rightTitle {
position: absolute;
right: 40rpx;
z-index: 10;
}
}
</style>

View File

@ -1,5 +1,4 @@
<template>
<view class="pageBox">
<image src="https://sharkbaby.yhy.ren/login/loginScrew.png" class="backImg"></image>
<image class="iconClass" src="https://sharkbaby.yhy.ren/login/loginIcon.png"></image>
@ -11,21 +10,38 @@
<view class="titleOne2" @click="click(0)">健康风险评估</view>
</view>
<image class="backImg" src="https://sharkbaby.yhy.ren/login/loginSubtract.png"></image>
<view class="qrImg" id="codeBox" @click="updateWx()"></view>
</view>
<view class="phoneBox" v-show="statusIndex == 0 ? false : true">
<view class="title">完善信息</view>
<view class="title" v-show="statusIndex == 1 ? true : false">完善信息</view>
<image class="phomeIcon" src="https://sharkbaby.yhy.ren/login/loginShark.png" v-show="statusIndex == 1 ? false : true"></image>
<view class="titleOne" v-show="statusIndex == 1 ? false : true">
<view class="titleOne1">登陆你的账号邀您参与</view>
<view class="titleOne2" @click="click(0)">健康风险评估</view>
</view>
<view class="titleOneOther" v-show="statusIndex == 1 ? true : false">为保证您的账号安全请补全您的手机号码</view>
<input class="phoneClass" type="number" placeholder="输入手机号码" @input="clearInput"/>
<view class="phoneClass">
<input class="phoneInput" type="number" maxlength="11" placeholder="输入手机号码" v-model="phone" />
<image class="phoneImg" @click="clearClick()" src="https://sharkbaby.yhy.ren/login/loginClear.png" v-show="phone == ''?false:true"></image>
</view>
<view class="codeClass">
<!-- 验证码输入框 -->
<input type="text" class="codeInput" maxlength="6" v-model="code" placeholder="输入验证码" />
<!-- 获取验证码 -->
<view class="codeGet" @click="isResend ? '' : getCode()">{{isResend?''+(time)+'s':'获取验证码'}}</view>
</view>
<view :class="['loginClass',phone == ''||code==''?'loginClass1':'loginClass2']" @click="phone == ''||code=='' ? '' : click(1)">立即登录</view>
</view>
<view class="login" @click="click(4)">{{(statusIndex == 0 || statusIndex == 1) ? '手机号登录' : '扫码登录'}}</view>
<view class="login" @click="click(2)">{{(statusIndex == 0 || statusIndex == 1) ? '手机号登录' : '扫码登录'}}</view>
</view>
@ -33,42 +49,254 @@
</template>
<script>
import {
toast,
showLoading,
hideLoading,
debounce,
formatTime
// preventClick,
} from "/tool/index.js"
export default {
data() {
return {
//012
statusIndex:1,
statusIndex:0,
phone: '', //
informationPhone: '', //
code: '', //
correctCode: '', //
time: 60, //
timer: null, //
isResend: false, //
unionid: '',//unionId
yesNoEnterpriseUser:'',
userId:'',
};
},
onLoad() {
onLoad(options) {
console.log('login + options');
console.log(options);
var that = this;
setTimeout(() => {
that.updateWx();
}, 1500);
//that.wechatLogin();
},
mounted(){
const s = document.createElement('script');
s.scr = "https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"
document.body.appendChild(s);
const script = document.createElement('script');
script.src = 'https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js';
document.body.appendChild(script);
console.log('mounted');
const wxCode = this.getQueryVariable('code');
console.log('wxCode');
console.log(wxCode);
if(wxCode){
this.wechatLogin(wxCode);
}
},
methods:{
//
goInfo() {
clearInterval(this.timer)
this.isResend = false
uni.navigateTo({
url: '/pages/login/ImproveInformation/ImproveInformation?flag=' + this.yesNoEnterpriseUser + "&userId=" +
this.userId + "&phone=" + this.informationPhone
});
},
wechatLogin(code){
var that = this;
this.$API.wechatScanCodeLogin({
data: {
code: code,
//code:'051fPQ000GexVS1W3s200X5SEb3fPQ0J'
}
}).then(res => {
console.log('wechatScanCodeLogin + res');
console.log(res);
if (res.code != 200) return uni.showToast({
title: res.msg || '登录失败,请联系管理员',
icon: 'none',
duration: 2000,
success: () => {}
})
let data = res.data
let userInfo = data.sysUser
var userId = null
if (null != userInfo) {
userId = userInfo.userId
}
// 0 1 2
let needToPerfect = data.needToPerfect
// 0 1
that.yesNoEnterpriseUser = data.yesNoEnterpriseUser ? data.yesNoEnterpriseUser : '';
that.userId = userId;
if (needToPerfect == 0) {
uni.setStorageSync('userInfo',res.data);
} else {
console.log(userId,"到完善资料")
//
//
if(res.data.sysUser.phonenumber){
that.unionid = res.data.sysUser.unionid ? res.data.sysUser.unionid : '';
that.statusIndex = 1;
}else{
that.informationPhone = res.data.sysUser.phonenumber;
that.goInfo();
}
}
})
},
getQueryVariable(variable) {
var query = window.location.href.substring(1)
var vars = query.split('&')
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=')
if (pair[0] === variable) { return pair[1] }
}
return false
},
clearClick(){
this.phone = '';
},
//
getCode() {
console.log('获取验证码');
if (this.$preventClick()) return
if (!this.phone){
return uni.showToast({
title: String('请输入手机号'),
icon: 'none',
duration: 2000
})
}
const reg = (
/^(13[0-9]|14[1579]|15[0-3,5-9]|16[6]|17[0123456789]|18[0-9]|19[0-9])\d{8}$/
);
if (!reg.test(this.phone)) return toast('手机号码格式不正确,请重新填写')
this.isResend = true
this.$API.sendTheVerificationCodeXcx({
data: {
phone: this.phone,
exist: 1,
}
}).then(res => {
console.log('res');
console.log(res);
if (res.code != 200) return toast(res.msg)
this.timeFunction()
this.correctCode = res.data
})
},
//
timeFunction() {
this.timer = setInterval(() => {
this.time--
if (this.time == 0) {
clearInterval(this.timer)
this.isResend = false
this.time = 60
}
}, 1000)
},
updateWx(){
console.log(333);
new WxLogin({
self_redirect: true,
id: "codeBox",
appid: "wx8a169dc73b528250",
scope: "snsapi_login",
//stylelite:1,
//redirect_uri: "http://www.yhy.ren/register", // 线 /register
redirect_uri:encodeURIComponent("https://syjk.yhy.ren/risk-assessment/#/pages/login/login/login"),
state: "",
style: "black",
href: "https://sharkbaby.yhy.ren/login/wechat3.css",
});
},
//
async signIn() {
if (this.$preventClick()) return
var that = this
const reg = (
/^(13[0-9]|14[1579]|15[0-3,5-9]|16[6]|17[0123456789]|18[0-9]|19[0-9])\d{8}$/
);
if (!reg.test(this.phone)) return toast('手机号码格式不正确,请重新填写')
uni.showLoading({
title: String('登录中...'),
mask: true,
})
let ret1 = that.$API.xcxLogin({
data: {
phone: that.phone,
code: that.code,
unionid: that.statusIndex == 2 ? '':that.unionid,
openId:'',
},
}).then(async (res) => {
console.log('小程序登录');
console.log(res);
uni.hideLoading()
if (res.code != 200) return uni.showToast({
title: res.msg || '登录失败,请联系管理员',
icon: 'none',
duration: 2000,
success: () => {}
})
let data = res.data;
let userInfo = data.sysUser
var userId = null
if (null != userInfo) {
userId = userInfo.userId
}
// 0 1 2
let needToPerfect = data.needToPerfect
// 0 1
that.yesNoEnterpriseUser = data.yesNoEnterpriseUser ? data.yesNoEnterpriseUser : '';
that.userId = userId;
if (needToPerfect == 0) {
uni.setStorageSync('userInfo',res.data);
} else {
console.log(userId,"到完善资料")
//
that.informationPhone = that.phone;
that.goInfo();
}
})
},
click(index){
//
if(index == 0){
console.log('健康风险评估');
}
//
if(index == 1){
console.log('健康风险评估');
}
//
if(index == 2){
console.log('获取验证码');
}
//
if(index == 3){
if(index == 1){
console.log('立即登录');
this.signIn();
}
//
if(index == 4){
if(index == 2){
console.log('手机或扫码登录');
//012
let index = this.statusIndex;
if((index == 0 || index == 1)){
this.statusIndex = 2;
}
if(index == 2){
this.statusIndex = 0;
}
console.log(this.statusIndex);
}
},
},
@ -128,6 +356,7 @@
.titleOne2{
color: #3AAFB8;
font-size: 34px;
}
}
.backImg{
@ -136,6 +365,13 @@
height: 496px;
}
.qrImg{
margin-top: -470px;
width: 520px;
height: 520px;
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
}
}
@ -156,6 +392,11 @@
line-height: 100px;
font-family: PingFang SC-Semibold;
}
.phomeIcon{
margin-top: 204px;
width: 312px;
height: 73px;
}
.titleOne{
display: flex;
flex-direction: row;
@ -185,9 +426,70 @@
height: 140px;
border-radius: 70px 70px 70px 70px;
background-color: #F5F5F5;
display: flex;
flex-direction: row;
.phoneInput{
margin-left: 0;
margin-top: 0;
height: 140px;
line-height: 140px;
font-size: 36px;
}
.phoneImg{
margin-right: 60px;
margin-top: 40px;
margin-left: auto;
height: 60px;
width: 60px;
}
}
.codeClass{
margin-top: 60px;
width: 800px;
height: 140px;
border-radius: 70px 70px 70px 70px;
background-color: #F5F5F5;
display: flex;
flex-direction: row;
.codeInput{
margin-left: 60px;
margin-top: 0;
height: 140px;
line-height: 140px;
font-size: 36px;
}
.codeGet{
margin-right: 60px;
margin-top: 0;
margin-left: auto;
height: 140px;
line-height: 140px;
color: #3AAFB8;
font-size: 36px;
}
}
.loginClass{
margin-top: 60px;
width: 800px;
height: 140px;
border-radius: 70px 70px 70px 70px;
background-color: #3AAFB8;
line-height: 140px;
color: #FFFFFF;
font-size: 46px;
text-align: center;
}
.loginClass1{
opacity: 0.5;
}
.loginClass2{
opacity: 1;
}
}
.login{
margin-top: 65px;