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

合并代码

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