提交 7f64283f 作者: wk

微信手机号快捷登录

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