优化微信授权登录
parent
25cbc307b6
commit
6ceeddde35
2
App.vue
2
App.vue
|
@ -15,7 +15,7 @@
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// uni.setStorageSync('hostapi','http://maintain.7and5.cn');
|
// uni.setStorageSync('hostapi','http://maintain.7and5.cn');
|
||||||
getApp().globalData.hostapi = 'http://maintain.7and5.cn';
|
this.globalData.hostapi = 'http://maintain.7and5.cn';
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// uni.setStorageSync('hostapi','/web');
|
// uni.setStorageSync('hostapi','/web');
|
||||||
|
|
|
@ -214,6 +214,8 @@ button:after{content: none!important;}
|
||||||
.radius35{border-radius: 35rpx;}
|
.radius35{border-radius: 35rpx;}
|
||||||
.radius40{border-radius: 40rpx;}
|
.radius40{border-radius: 40rpx;}
|
||||||
.radius45{border-radius: 45rpx;}
|
.radius45{border-radius: 45rpx;}
|
||||||
|
.radius_50{border-radius: 50%;}
|
||||||
|
.radius_100{border-radius: 100%;}
|
||||||
|
|
||||||
/* 上下左右---外边距 */
|
/* 上下左右---外边距 */
|
||||||
.mar10{margin: 10rpx;}
|
.mar10{margin: 10rpx;}
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
if(index==0){
|
if(index==0){
|
||||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||||
} else {
|
} else {
|
||||||
// if(!this.$toolAll.tools.judgeAuth()) {
|
if(this.$toolAll.tools.judgeAuth()) {
|
||||||
// 已授权
|
// 已授权
|
||||||
switch (index){
|
switch (index){
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -144,12 +144,7 @@
|
||||||
uni.reLaunch({url:'/pages/tabbar/my/my'})
|
uni.reLaunch({url:'/pages/tabbar/my/my'})
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// } else {
|
}
|
||||||
// // 未授权
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url:'/pages/login/login'
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scanCode() {
|
scanCode() {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
const app = getApp();
|
||||||
const tools = {
|
const tools = {
|
||||||
timer:'',
|
timer:'',
|
||||||
timerNot:'',
|
timerNot:'',
|
||||||
|
@ -498,7 +499,7 @@ const tools = {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
var params = {code:res.code}
|
var params = {code:res.code}
|
||||||
uni.request({
|
uni.request({
|
||||||
url: `${getApp().globalData.hostapi}/api/user/login`,
|
url: `${app.globalData.hostapi}/api/user/login`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params,
|
data: params,
|
||||||
header: {
|
header: {
|
||||||
|
@ -523,16 +524,17 @@ const tools = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 判断是否授权,没授权,前往登录页面授权
|
// 判断是否授权,没授权,前往登录页面授权
|
||||||
|
authTimer:null,
|
||||||
judgeAuth(){
|
judgeAuth(){
|
||||||
let auth = true;
|
let auth = false;
|
||||||
switch (uni.getStorageSync('phone_active')*1){
|
clearTimeout(this.authTimer);
|
||||||
case 0: // 未注册
|
if(!uni.getStorageSync('token')) {
|
||||||
uni.navigateTo({url:'/pages/login/login'});
|
this.showToast('请登录');
|
||||||
auth = false
|
this.authTimer = setTimeout(()=>{
|
||||||
break;
|
uni.navigateTo({url:'/pages/login/login'});
|
||||||
case 1: // 已注册
|
},2000)
|
||||||
auth = true
|
} else {
|
||||||
break;
|
auth = true;
|
||||||
}
|
}
|
||||||
return auth;
|
return auth;
|
||||||
},
|
},
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"appid" : "wx705dfb975654e53a",
|
"appid" : "wx372ffc194d87c693",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : true,
|
"urlCheck" : true,
|
||||||
"es6" : true
|
"es6" : true
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
import statusNav from '../../components/status-nav.vue';
|
import statusNav from '../../components/status-nav.vue';
|
||||||
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
|
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
|
||||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||||
|
const app = getApp();
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
footTabOne,
|
footTabOne,
|
||||||
|
@ -141,7 +142,7 @@
|
||||||
const tempFilePaths = chooseImageRes.tempFilePaths;
|
const tempFilePaths = chooseImageRes.tempFilePaths;
|
||||||
this.imgSrc = chooseImageRes.tempFilePaths[0]
|
this.imgSrc = chooseImageRes.tempFilePaths[0]
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: getApp().globalData.hostapi+'/universal/api.upload/upload', //仅为示例,非真实的接口地址
|
url: app.globalData.hostapi+'/universal/api.upload/upload', //仅为示例,非真实的接口地址
|
||||||
filePath: tempFilePaths[0],
|
filePath: tempFilePaths[0],
|
||||||
name: 'image',
|
name: 'image',
|
||||||
header:{
|
header:{
|
||||||
|
|
|
@ -27,17 +27,16 @@
|
||||||
style="background: url(../../../static/public/icon-my-head.png) no-repeat;height: 400rpx;background-size: 100% 100%;">
|
style="background: url(../../../static/public/icon-my-head.png) no-repeat;height: 400rpx;background-size: 100% 100%;">
|
||||||
<view class="disjbac" style="padding: 60rpx 80rpx 60rpx 60rpx;">
|
<view class="disjbac" style="padding: 60rpx 80rpx 60rpx 60rpx;">
|
||||||
<view class="disac">
|
<view class="disac">
|
||||||
<image class="flexs mar-y10" v-if="!userInfo.avatar"
|
<!-- 用户头像 -->
|
||||||
src="/static/public/icon-my-headimg.png" mode="aspectFill"
|
<image class="flexs mar-y10 radius_100" @tap="replaceImg" :src="userInfo.avatar || '/static/public/icon-my-headimg.png'" mode="aspectFill" style="width: 91rpx;height: 91rpx;" lazy-load></image>
|
||||||
style="width: 91rpx;height: 91rpx;" lazy-load></image>
|
|
||||||
<image class="flexs mar-y10" v-else src="/static/public/icon-my-headimg.png"
|
|
||||||
mode="aspectFill" style="width: 91rpx;height: 91rpx;" lazy-load></image>
|
|
||||||
|
|
||||||
<view class="disjb fc" style="height: 91rpx;">
|
<view class="disjb fc" style="height: 91rpx;">
|
||||||
|
<!-- 用户手机号 -->
|
||||||
<view class="fon34 bold">{{tel(userInfo.username)}}</view>
|
<view class="fon34 bold">{{tel(userInfo.username)}}</view>
|
||||||
|
<!-- 是否实名认证 -->
|
||||||
<view class="fon22" style="color: #717171;">未实名认证</view>
|
<view class="fon22" style="color: #717171;">未实名认证</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 等级图标 -->
|
||||||
<image src="/static/public/icon-my-level.png" mode="aspectFill"
|
<image src="/static/public/icon-my-level.png" mode="aspectFill"
|
||||||
style="width: 49rpx;height: 76rpx;" lazy-load></image>
|
style="width: 49rpx;height: 76rpx;" lazy-load></image>
|
||||||
</view>
|
</view>
|
||||||
|
@ -181,6 +180,16 @@
|
||||||
this.$toolAll.tools.disableShareEv();
|
this.$toolAll.tools.disableShareEv();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 更换头像
|
||||||
|
replaceImg(){
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sourceType:['album','camera'],
|
||||||
|
success: (res) => {
|
||||||
|
this.userInfo.avatar = res.tempFilePaths[0];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 退出登录
|
// 退出登录
|
||||||
logOutEv() {
|
logOutEv() {
|
||||||
this.$requst.post('/universal/api.login/signout').then(res => {
|
this.$requst.post('/universal/api.login/signout').then(res => {
|
||||||
|
|
|
@ -231,6 +231,7 @@
|
||||||
import lwNotice from '@/components/lw-notice/lw-notice.vue';
|
import lwNotice from '@/components/lw-notice/lw-notice.vue';
|
||||||
import footTabOne from '@/components/foot-tabs/foot-tab-one.vue';
|
import footTabOne from '@/components/foot-tabs/foot-tab-one.vue';
|
||||||
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
|
||||||
|
const app = getApp();
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
pitera,
|
pitera,
|
||||||
|
@ -368,7 +369,7 @@
|
||||||
let obj = {
|
let obj = {
|
||||||
id:item.id,
|
id:item.id,
|
||||||
title:item.name,
|
title:item.name,
|
||||||
imgsrc: getApp().globalData.hostapi + '/' + item.cover_img,
|
imgsrc: app.globalData.hostapi + '/' + item.cover_img,
|
||||||
}
|
}
|
||||||
this.solutionList.push(obj);
|
this.solutionList.push(obj);
|
||||||
})
|
})
|
||||||
|
@ -398,7 +399,7 @@
|
||||||
let obj = {
|
let obj = {
|
||||||
id:item.id,
|
id:item.id,
|
||||||
title:item.title,
|
title:item.title,
|
||||||
imgsrc: getApp().globalData.hostapi + '/' + item.cover_img,
|
imgsrc: app.globalData.hostapi + '/' + item.cover_img,
|
||||||
content:item.summary,
|
content:item.summary,
|
||||||
views:item.reading
|
views:item.reading
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,9 +218,9 @@
|
||||||
},
|
},
|
||||||
goWorkorderTwo(){
|
goWorkorderTwo(){
|
||||||
console.log(this.targetObj);
|
console.log(this.targetObj);
|
||||||
// uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: "/pages/workOrder/workOrderThree"
|
url: "/pages/workOrder/workOrderThree"
|
||||||
// })
|
})
|
||||||
},
|
},
|
||||||
addMountingsList() {
|
addMountingsList() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const app = getApp();
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
// 日期转换
|
// 日期转换
|
||||||
this.dataObj.create_time = this.$toolAll.tools.timestampToTime(this.dataObj.create_time);
|
this.dataObj.create_time = this.$toolAll.tools.timestampToTime(this.dataObj.create_time);
|
||||||
// 封面图
|
// 封面图
|
||||||
this.dataObj.cover_img = getApp().globalData.hostapi + '/' + this.dataObj.cover_img,
|
this.dataObj.cover_img = app.globalData.hostapi + '/' + this.dataObj.cover_img,
|
||||||
this.rich_text = this.$toolAll.tools.escape2Html(this.dataObj.content);
|
this.rich_text = this.$toolAll.tools.escape2Html(this.dataObj.content);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import rate from '@/components/rate.vue';
|
import rate from '@/components/rate.vue';
|
||||||
|
const app = getApp();
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
rate
|
rate
|
||||||
|
@ -80,7 +81,7 @@
|
||||||
res.data.data.forEach(item=>{
|
res.data.data.forEach(item=>{
|
||||||
let obj = {
|
let obj = {
|
||||||
id:item.id,
|
id:item.id,
|
||||||
cover_img: getApp().globalData.hostapi + '/' + item.cover_img,
|
cover_img: app.globalData.hostapi + '/' + item.cover_img,
|
||||||
title:item.title,//标题
|
title:item.title,//标题
|
||||||
summary:item.summary,//描述
|
summary:item.summary,//描述
|
||||||
hot:item.hot,//热度
|
hot:item.hot,//热度
|
||||||
|
|
Loading…
Reference in New Issue