提交 7f64283f 作者: wk

微信手机号快捷登录

父级 c5427b2d
......@@ -257,6 +257,18 @@ const params = {
getCompany: {
url: "/api/v1/org/o_comp_user/user_comp_list",
method: "get"
},
getWxPhone: {
url: "/ydt/api/v1/access/user_third/phone",
method: "post"
},
wxPhoneLogin: {
url: "/ydt/api/v1/access/user_third/temp_login",
method: "post"
},
getMostUsed: {
url: "/ydt/api/v1/navigation/list/at_most_used",
method: "get"
}
}
......
......@@ -9,7 +9,8 @@ const http = (params) => {
data: params.data,
header: {
'access_token': uni.getStorageSync('token') || '',
// "token": uni.getStorageSync('token') || ''
"token": uni.getStorageSync('token') || '',
"key": uni.getStorageSync("key") || ''
},
success(res) {
uni.hideLoading()
......
......@@ -780,7 +780,7 @@
url: "/api/v1/project/project_list",
data: {
is_all: 1,
org_no: uni.getStorageInfoSync("org_no")
org_no: uni.getStorageSync("org_no")
},
header: {
"access_token": this.getToken()
......
......@@ -63,7 +63,7 @@
Api.getProjectList({
data: {
is_all: 1,
org_no: uni.getStorageInfoSync("org_no")
org_no: uni.getStorageSync("org_no")
}
}).then((result) => {
console.log("项目列表:", result);
......
......@@ -29,7 +29,7 @@
<image src="../../static/ic-sjzg.png" class="image" @click="linkToData"></image>
<text class="text" @click="linkToData">数据智管</text>
<image src="../../static/ic-rqyy.png" class="rq-image"></image>
<text class="text">本周人气最佳:物料收发存(地磅)</text>
<text class="text">本周人气最佳:{{mostUsed.app_name}}</text>
</view>
<view class="app-content">
<v-tabs :tabs="tabs" :scroll="true" :value="current" @change="tabChange"></v-tabs>
......@@ -87,13 +87,15 @@
is_publish: 1,
app_sort: 1
},
orgName: ""
orgName: "",
mostUsed: {}
}
},
onLoad() {
const info = uni.getSystemInfoSync()
this.statusBarHeight = info.statusBarHeight
this.getAppGroup()
this.getMostUsed()
},
onShow() {
this.getMessages()
......@@ -104,6 +106,15 @@
this.getOrgTree()
},
methods: {
getMostUsed() {
Api.getMostUsed().then((result) => {
if (result.code == 0) {
this.mostUsed = result.data.list[0]
} else {
this.$toast.showToast(result.msg)
}
})
},
getOrgTree() {
Api.getOrgTree({
data: {
......@@ -112,6 +123,7 @@
}
}).then((result) => {
console.log("组织树", result);
console.log("------", uni.getStorageSync("org_name"));
if (result.code == 0) {
this.trees = result.data.list[0].children_list
this.orgName = uni.getStorageSync("org_name") || result.data.list[0].name
......@@ -202,7 +214,7 @@
}).then((result) => {
console.log("消息列表", result);
if (result.code == 0) {
this.messageCount = result.data.total_count
this.messageCount = result.data.warnNumber + result.data.msgNumber
} else {
this.$toast.showToast(result.msg)
}
......
......@@ -2,7 +2,7 @@
<view class="content">
<titleBar title="消息中心"></titleBar>
<v-tabs :tabs="tabs" :scroll="true" :value="current" @change="tabChange"></v-tabs>
<view class="list-content">
<view class="list-content" v-if="list.length>0">
<view v-for="(item,index) in list" :key="index" class="list-item" @click="itemClick(index,item)">
<view class="red-dot" v-if="!item.readStatus"></view>
<view class="item-content ">
......@@ -78,11 +78,11 @@
console.log("消息列表", result);
uni.stopPullDownRefresh()
if (result.code == 0) {
this.totalPage = result.data.total_page
this.totalPage = result.data.warnRecords.total_page
if (this.page == 1) {
this.list = []
}
this.list = this.list.concat(result.data.list)
this.list = this.list.concat(result.data.warnRecords.list)
} else {
this.$toast.showToast(result.msg)
}
......
......@@ -9,10 +9,11 @@
<view v-for="(item,index) in list" :key="index" class="list-item" @click="itemClick(item)">
<image class="image" src="../../../static/ic-jrdb.png"></image>
<view class="item-content">
<view class="title">张三发起了隐患整改,请于2022/12/13 15:37:56前完成隐患整改。</view>
<view class="title">{{item.created_by_name}}发起了{{item.app_name}},请于{{item.expect_end_date}}前完成。
</view>
<view class="time-content">
<view class="create-time">2022/12/13 15:39:56</view>
<view class="leave-time">处理倒计时:0天20小时23分</view>
<view class="create-time">{{item.end_opt_time}}</view>
<view class="leave-time">处理倒计时:{{timeSpace(item.end_opt_time)}}</view>
</view>
<view class="line" style="margin: 30rpx 0;"></view>
</view>
......@@ -22,10 +23,11 @@
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
list: [{}, {}, {}],
list: [],
page: 1,
pageSize: 20,
totalCount: 0
......@@ -45,6 +47,23 @@
}
},
methods: {
timeSpace(endTime) {
var dateTime = new Date();
var end = new Date(endTime);
var dateDiff = end.getTime() - dateTime.getTime(); //时间差的毫秒数
if (dateDiff > 0) {
return this.formatDuring(dateDiff)
} else {
return "0秒"
}
},
formatDuring(mss) {
let days = Math.floor(mss / (1000 * 60 * 60 * 24));
let hours = Math.floor((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
let minutes = Math.floor((mss % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.round((mss % (1000 * 60)) / 1000);
return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
},
getTodayNeedDo() {
Api.getNeedDo({
data: {
......
......@@ -14,7 +14,7 @@
<view class="menu-item" v-for="(item,index) in selList" :key="index">
<view class="logo-content">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+item.logo+'.png'"
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+item.ydt_logo+'.png'"
class="logo"></image>
<image src="../../../static/delete-ic.png" class="del" @click="toDel(index)"></image>
</view>
......@@ -31,7 +31,7 @@
<view class="menu-item" v-for="(app,appIndex) in item.data" :key="appIndex">
<view class="logo-content">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+app.logo+'.png'"
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+app.ydt_logo+'.png'"
class="logo"></image>
<image src="../../../static/add-ic.png" class="del" @click="toAdd(app,index,appIndex)">
</image>
......
......@@ -53,7 +53,8 @@
<view :class="isLineVisil(index)?'app-name-left':'app-name-right'">
{{nameLengthDeal(app.app_name)}}
</view>
<image class="app-logo" src="../../static/ic-score-logo.png">
<image class="app-logo"
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+app.ydt_logo+'.png'">
</image>
<view class="line" v-if="isLineVisil(index)"></view>
</view>
......@@ -72,7 +73,7 @@
</view>
</view>
<!-- 积分兑换 -->
<view class="score-content" v-if="isCompShow('OnePointScore')">
<view class="score-content" v-if="isCompShow('OnePointScore')&&role=='WORKER'">
<view class="title-content">
<view class="title">积分兑换</view>
<view class="more" @click="toLinkScore">更多</view>
......@@ -180,10 +181,8 @@
that.getUserInfo()
that.getNews()
that.getSetting()
that.getMyScore()
that.getHomeComp()
that.getWeather()
that.loadProject()
if (that.isCommonSel) {
that.getCommonApp()
} else {
......@@ -192,7 +191,7 @@
},
fail() {
uni.redirectTo({
url: "/pages/login/authLogin/authLogin"
url: "/pages/login/login/login"
})
}
})
......@@ -203,7 +202,7 @@
url: "/api/v1/project/project_list",
data: {
is_all: 1,
org_no: uni.getStorageSync("org_no")
// org_no: uni.getStorageSync("org_no")
},
header: {
"access_token": this.getToken()
......@@ -212,9 +211,20 @@
let result = res.data
console.log("项目列表:", result);
if (result.code === 0) {
this.project = result.data.list[0]
if (result.data.list.length > 0) {
this.project = result.data.list[0]
if (!uni.getStorageSync("project_id")) {
uni.setStorageSync("org_no", this.project.org_no)
uni.setStorageSync("org_name", this.project.project_name)
uni.setStorageSync("org_id", this.project.id)
uni.setStorageSync("project_id", this.project.project_id)
}
}
}
if (this.role == 'WORKER') {
this.getGoodsList()
this.getMyScore()
}
this.getGoodsList()
})
},
getGoodsList() {
......@@ -280,7 +290,7 @@
ScoreApi.exchangeGood({
data: {
goods_id: item.goods_id,
worker_id: this.userInfo.worker_id,
worker_id: this.userInfo.worker.worker_id,
project_id: this.project.project_id,
order_num: 1
}
......@@ -354,7 +364,10 @@
},
getMyScore() {
Api.getUserScore({
data: this.requestParam
data: {
project_id: this.project.project_id,
worker_id: this.userInfo.worker.workerId
}
}).then(res => {
console.log("用户积分", res);
if (res.code === 0) {
......@@ -407,6 +420,7 @@
this.userInfo = result.data
// this.title = "欢迎" + this.userInfo.user.user_name + "访问一点通"
this.role = this.userInfo.identity.code
this.loadProject()
} else {
this.$toast.showToast(result.msg)
}
......@@ -454,7 +468,7 @@
// 获取用户的地理位置,
getLocation() {
const that = this
uni.getLocation({
uni.getFuzzyLocation({
type: 'gcj02',
altitude: true,
success(res) {
......
......@@ -255,7 +255,8 @@
}).then((result) => {
console.log(result);
if (result.code === 0) {
that.toLogin(result.data.key)
uni.setStorageSync("key", result.data.key)
that.toLogin()
} else {
uni.showToast({
title: result.msg,
......@@ -327,7 +328,7 @@
}
})
},
toLogin(key) {
toLogin() {
uni.showLoading({
title: "登录中..."
})
......@@ -340,10 +341,6 @@
"login_type": 2,
"system_no": this.$config.systemCode
},
header: {
"key": key,
"Content-Type": "application/json"
}
}).then((result) => {
console.log("登录用户信息:", result);
if (result.code === 0) {
......@@ -380,10 +377,6 @@
"login_type": 1,
"system_no": this.$config.systemCode
},
header: {
"key": key,
"Content-Type": "application/json"
}
}).then((result) => {
console.log("登录用户信息:", result);
if (result.code === 0) {
......
<template>
<view>
<titleBar title="授权登录"></titleBar>
<titleBar title="微信授权登录"></titleBar>
<view v-if="isCanUse">
<view>
<view class='header'>
<image src='../../../static/icon_wechat.jpg'></image>
<image src="../../../static/wx-ic.png"></image>
</view>
<view class='content'>
<view>申请获取微信授权登录</view>
<text>获得你的手机号信息</text>
</view>
<button class="bottom" open-type="getPhoneNumber" type="primary"
@getphonenumber="getPhoneNumber">获取手机号码授权登录</button>
<button class="bottom" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">手机号码授权登录</button>
</view>
</view>
</view>
......@@ -32,6 +31,45 @@
methods: {
getPhoneNumber(e) {
console.log(e)
Api.getWxPhone({
data: {
code: e.detail.code
}
}).then((result) => {
console.log("获取手机号", result);
if (result.code == 0) {
this.wxPhoneLogin(result.data.phoneNumber)
} else {
this.$toast.showToast(result.msg)
}
})
},
wxPhoneLogin(phone) {
Api.wxPhoneLogin({
data: {
"phone": phone,
"unique_token": this.unique_token
}
}).then((result) => {
console.log("微信手机号登录", result);
if (result.code == 0) {
uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id)
uni.setStorageSync("org_no", result.data.org_no)
uni.setStorageSync("refresh_token", result.data.refresh_token)
uni.showToast({
title: "登录成功",
icon: 'none'
})
uni.switchTab({
url: "/pages/index/index"
})
} else {
this.$toast.showToast(result.msg)
}
})
},
authLogin() {
if (this.unique_token !== '') {
......@@ -246,8 +284,9 @@
.bottom {
border-radius: 80rpx;
background-color: 3B73FE;
background: linear-gradient(138.42deg, #59a3fe 0%, #1757ff 100%);
margin: 70rpx 50rpx;
color: #FFFFFF;
font-size: 35rpx;
}
</style>
......@@ -92,7 +92,7 @@
Api.getUserScore({
data: {
project_id: this.project.project_id,
worker_id: getApp().globalData.userInfo.user.user_id
worker_id: getApp().globalData.userInfo.worker.workerId
}
}).then(res => {
if (res.code === 0) {
......
......@@ -64,7 +64,7 @@
getProjectInfo() {
Api.getProjectInfo({
data: {
project_id: 358
project_id: uni.getStorageSync("project_id")
}
}).then((result) => {
console.log("项目信息", result);
......
<template>
<view class="content">
<web-view src="https://www.baidu.com/"></web-view>
<drag-ball x="300" y="450" v-if="false" image="../../static/ic-more-kb.png"></drag-ball>
<titleBar title="欢迎您访问工地一点通"></titleBar>
<view class="default-content">
<image src="../../static/ic-gth.png" class="image"></image>
<view class="default-text">当前无监控台权限</view>
</view>
<view>
</view>
<uni-tabbar currentPage="2"></uni-tabbar>
</view>
</template>
......@@ -38,5 +44,24 @@
left: 0;
}
}
.default-content {
display: flex;
flex-direction: column;
align-items: center;
width: 750rpx;
image {
margin-top: 200px;
width: 64rpx;
height: 64rpx;
}
.default-text {
margin-top: 30rpx;
font-size: 28rpx;
color: #333;
}
}
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment