Commit e11175e2 authored by 李俊赕's avatar 李俊赕

合并代码

parent 251c3de0
......@@ -6,9 +6,9 @@
import {
AnalysysAgent
} from '@/utils/analysys_paas.js'
} from '@/utils/analysys_paas.js'
import util from '@/utils/util.js'
export default {
globalData: {
......@@ -97,20 +97,30 @@
protocolContent:'',
signUrl:'',
jumpLoginStatus:true,
settleRecommend:'',
navHeight:0, //导航栏高度
rpxScreenHeight:0,// 照相视框高度
// 用户信息
tempUserInfo: '', // 临时用户选项
userInfo: '', // 用户信息
authLoading: false,
jumpLoginStatus:true,
settleRecommend:'',
navHeight:0, //导航栏高度
rpxScreenHeight:0,// 照相视框高度
//拍照相关数据
photo:{
product:{
brandId:'', // 品牌id
brandName:'', // 品牌名称
classifyId:'', // 分类id
systemId:'', // 系统id
},
productList:[],
currentItem:null, // 选择的某一项
},
// 用户信息
tempUserInfo: '', // 临时用户选项
userInfo: '', // 用户信息
authLoading: false,
},
onLaunch: function() {
this.getSystemInfo()
this.checkUpdate()
this.checkUpdate()
var that=this
uni.getStorage({
......@@ -122,32 +132,32 @@
}
})
this.getProtocolContent()
this.getProtocolContent()
AnalysysAgent.registerSuperProperty("platform","take-order");
},
onShow: function() {
if (this.globalData.token) {
this.globalData.authLoading = false
} else {
this.autoLogin()
}
onShow: function() {
if (this.globalData.token) {
this.globalData.authLoading = false
} else {
this.autoLogin()
}
},
methods: {
getSystemInfo(){
try {
let a = wx.getSystemInfoSync();
// this.globalData.platform = systemInfo.platform, this.globalData.pixelRatio = a.pixelRatio,
// this.globalData.statusBarHeight = a.statusBarHeight, this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90,
// this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750, this.globalData.screenWidth = a.screenWidth,
// this.globalData.screenHeight = a.screenHeight;
this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90
this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750
this.globalData.screenHeight = a.screenHeight
} catch (a) {}
getSystemInfo(){
try {
let a = wx.getSystemInfoSync();
// this.globalData.platform = systemInfo.platform, this.globalData.pixelRatio = a.pixelRatio,
// this.globalData.statusBarHeight = a.statusBarHeight, this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90,
// this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750, this.globalData.screenWidth = a.screenWidth,
// this.globalData.screenHeight = a.screenHeight;
this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90
this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750
this.globalData.screenHeight = a.screenHeight
} catch (a) {}
},
//检查更新
checkUpdate: function () {
......@@ -176,28 +186,28 @@
})
},
async getBaseInfo(vm,callBack){
uni.showLoading({
title:'加载中……'
})
const res = await vm.$u.api.getSettleBaseInfo()
if (!res || !res.status) {
if(res && res.message){
uni.showToast({
title: res && res.message || '获取基本信息错误',
icon: 'none'
});
}
return false;
}
this.globalData.settledInfo = res.data
if(!res.data){
return
}
callBack(vm,res.data)
uni.hideLoading()
return res.data
async getBaseInfo(vm,callBack){
uni.showLoading({
title:'加载中……'
})
const res = await vm.$u.api.getSettleBaseInfo()
if (!res || !res.status) {
if(res && res.message){
uni.showToast({
title: res && res.message || '获取基本信息错误',
icon: 'none'
});
}
return false;
}
this.globalData.settledInfo = res.data
if(!res.data){
return
}
callBack(vm,res.data)
uni.hideLoading()
return res.data
},
initAPIneedToken: function() {
//RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502
......@@ -242,7 +252,7 @@
}
//*/
},
getProtocolContent: function() {
......@@ -318,78 +328,78 @@
}
},
/* ------------------------- 数据埋点end ------------------------------ */
/**
* 用户自动登录
*/
autoLogin() {
let that = this;
that.globalData.authLoading = true
uni.login({
success(res) {
if (res.code) {
let params = {code: res.code};
that.authorization(params)
} else {
uni.showModal({
title: '登录失败',
content: '未获取到code',
});
}
},
fail() {
wx.showModal({
title: '登录失败',
content: '接口调用失败',
});
}
});
},
async authorization(params) {
let that = this
const res = await that.$u.api.loginWechatAuth(params)
if(!res || !res.code || !res.data){
uni.hideLoading()
return
} else if (res.code == 200) {
that.setUserData(res.data)
if (typeof callback == "function") {
callback();
}
} else {
wx.showModal({
title: '请求失败',
showCancel: false
});
}
that.globalData.authLoading = false
uni.hideLoading()
},
setUserData(userInfo) {
if(userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息
util.setOpenid(userInfo.wxopenid)
util.setToken(userInfo.token)
this.globalData.userInfo = userInfo;
uni.setStorageSync('user-info', userInfo);
uni.setStorageSync('isNewUser', false);
} else {
uni.setStorageSync('isNewUser', true);
}
/**
* 用户自动登录
*/
autoLogin() {
let that = this;
that.globalData.authLoading = true
uni.login({
success(res) {
if (res.code) {
let params = {code: res.code};
that.authorization(params)
} else {
uni.showModal({
title: '登录失败',
content: '未获取到code',
});
}
},
fail() {
wx.showModal({
title: '登录失败',
content: '接口调用失败',
});
}
});
},
async authorization(params) {
let that = this
const res = await that.$u.api.loginWechatAuth(params)
if(!res || !res.code || !res.data){
uni.hideLoading()
return
} else if (res.code == 200) {
that.setUserData(res.data)
if (typeof callback == "function") {
callback();
}
} else {
wx.showModal({
title: '请求失败',
showCancel: false
});
}
that.globalData.authLoading = false
uni.hideLoading()
},
setUserData(userInfo) {
if(userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息
util.setOpenid(userInfo.wxopenid)
util.setToken(userInfo.token)
this.globalData.userInfo = userInfo;
uni.setStorageSync('user-info', userInfo);
uni.setStorageSync('isNewUser', false);
} else {
uni.setStorageSync('isNewUser', true);
}
},
},
onHide: function() {
console.log('App Hide')
onHide: function() {
console.log('App Hide')
},
}
</script>
<style>
/*每个页面公共css */
}
</script>
<style>
/*每个页面公共css */
</style>
......@@ -124,7 +124,16 @@
"navigationBarTitleText": "工单详情"
}
},
{
"path": "pages/photo/setting",
"style": {
"navigationStyle":"custom",
"navigationBarTitleText": "水印设置",
"navigationBarBackgroundColor": "#333333",
"navigationBarTextStyle": "#FFFFFF",
"disableScroll": true
}
},
{
"path": "pages/photo/take",
"style": {
......
......@@ -5,7 +5,7 @@
<cover-view class="inner">
<cover-image @click="setCameraInfo('devicePosition')" class="icon" mode="aspectFit" src="/static/photo/icon-switch.png"></cover-image>
<cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit" src="/static/photo/icon-light.png"></cover-image>
<cover-image @click="goPage('/pages/photo/markSetting')" class="icon" mode="aspectFit" src="/static/photo/icon-setting.png"></cover-image>
<cover-image @click="goPage('/pages/photo/setting')" class="icon" mode="aspectFit" src="/static/photo/icon-setting.png"></cover-image>
</cover-view>
</cover-view>
<camera class="camera-box" v-if="cameraChange&&!standardShow" :device-position="cameraInfo.devicePosition" :flash="cameraInfo.flash" :style="{'height':cameraHeight + 'rpx'}"
......@@ -112,7 +112,7 @@
methods: {
goBack(){
uni.redirectTo({
url:'/pages/photo/brand'
url:'/pages/photo/list'
})
},
goPage(url){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment