factory_mp_old/App.vue

276 lines
6.3 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script>
export default {
// 此处globalData为了演示其作用不是uView框架的一部分
globalData: {
appid: 'wxf7d6140f507466be'
},
// getUserRange() {
// let that = this;
// that.$u.api.deptList({
// page: 0,
// type__in: 'rparty,dept',
// query: '{id, name, parent, type}'
// }).then(res => {
// let list1 = res;
// let list2 = [];
// let reqList = [];
// list1.forEach(function(item) {
// reqList.push(that.$u.api.userList({
// page: 0,
// belong_dept: item.id,
// is_active: true,
// query: '{id, name, belong_dept}'
// }))
// })
// Promise.all(reqList).then(res => {
// for (let i = 0; i < res.length; i++) {
// list1[i].children = res[i]
// }
// list1.forEach(item=>{
// if(item.type == 'dept'){
// list2.push({ ...item })
// }
// })
// that.$u.vuex('vuex_userRange', that.parseData(list1))
// that.$u.vuex('vuex_userRange2', that.parseData(list2))
// })
// })
// },
// parseData(data) {
// // * 先生成parent建立父子关系
// const obj = {};
// data.forEach((item) => {
// obj[item.id] = item;
// });
// const parentList = [];
// data.forEach((item) => {
// const parent = obj[item.parent];
// if (parent) {
// // * 当前项有父节点
// parent.children = parent.children || [];
// parent.children.unshift(item);
// } else {
// parentList.push(item);
// }
// });
// return parentList;
// },
onLaunch() {
// #ifdef APP-PLUS
let client = plus.push.getClientInfo();
let qyjyClientId = client.clientid;
uni.setStorageSync('qyjyClientId', qyjyClientId)
console.log("设备唯一标识:",qyjyClientId)
// #endif
var that = this
// 1.1.0版本之前关于http拦截器代码已平滑移动到/common/http.interceptor.js中
// 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明)
// import httpInterceptor from '@/common/http.interceptor.js'
// Vue.use(httpInterceptor, app)
// process.env.VUE_APP_PLATFORM 为通过js判断平台名称的方法结果分别如下
/**
* h5app-plus(nvue下也为app-plus)mp-weixinmp-alipay......
*/
//var that=this
// 小程序自动登录
// #ifdef MP-WEIXIN
uni.showLoading({
title: '微信自动登录中...',
mask: true
})
uni.login({
provider: 'weixin',
success: (loginRes) => {
that.$u.api.wxmplogin({
code: loginRes.code
}).then(res => {
that.$u.vuex('vuex_token', res.access)
that.$u.api.getUserInfo().then(res => {
if(res.avatar){
res.avatar = that.vuex_host + res.avatar
}
uni.hideLoading()
uni.showToast({
title: "登录成功",
icon: "none"
})
uni.reLaunch({
url: "/pages/home/home"
})
that.$u.vuex('vuex_user', res)
// 修改资源请求地址
// this.$u.vuex('vuex_user.avatar', this.vuex_user.avatar +
// '?token=' + this.vuex_token)
})
}).catch(e => {
console.log(e)
uni.setStorageSync('wxmp_openid', e.data.wxmp_openid)
uni.hideLoading()
// uni.showToast({
// title: "暂未绑定微信!",
// icon: "none"
// })
uni.reLaunch({
url: '/pages/login/login'
})
})
}
});
// #endif
// uni.getSystemInfo({
// success(res) {
// console.log(res)
// that.$u.vuex('vuex_version', res.appVersion)
// // #ifdef APP-PLUS
// if (res.platform == 'android') {
// that.$u.api.apkCheck().then(res1 => {
// if (res.appVersion < res1.version) {
// uni.showModal({
// title: "版本更新",
// content: '有新的版本发布, 请下载新版本',
// confirmText: '立即更新',
// showCancel: false,
// success: function(res2) {
// if (res2.confirm) {
// if(res1.file.indexOf("http") == 0){
// plus.runtime.openURL(res1.file)
// }else{
// plus.runtime.openURL(that.vuex_host + res1.file)
// }
// }
// }
// });
// }
// })
// }
// // #endif
// }
// })
},
}
</script>
<style lang="scss">
@import "uview-ui/index.scss";
@import "common/demo.scss";
.star {
color: red;
}
uni-page-body{
min-height: 100%;
}
.my-top-search-nav {
position: fixed;
left: 0;
right: 0;
z-index: 999;
background-color: #f3fbff;
border-bottom: 1upx solid #eeeeee;
}
.search-wrap {
background-blend-mode: normal, normal;
padding-bottom: 20rpx;
padding-top: 20rpx;
display: flex;
justify-content: space-around;
}
.tabbar-title{
background-color: #FFFFFF;
height: 55px;
display: flex;
padding: 0 17px;
box-sizing: border-box;
font-size: 17px;
line-height: 55px;
color: #505050;
}
.tabbar-title {
background-color: #FFFFFF;
height: 100upx;
display: flex;
/* justify-content: space-between; */
padding: 0 32upx;
box-sizing: border-box;
font-size: 32rpx;
line-height: 100rpx;
color: #505050;
}
.text-title {
position: relative;
margin-right: 40upx;
}
.active.text-title::after {
content: "";
width: 46rpx;
height: 4rpx;
background-image: linear-gradient(90deg,
#164cc3 0%,
#2c6fd9 100%),
linear-gradient(#085f56,
#085f56);
background-blend-mode: normal,
normal;
border-radius: 2rpx;
position: absolute;
bottom: 20rpx;
left: 50%;
transform: translateX(-50%);
}
.search-body {
width: 600upx;
height: 78upx;
background-color: #ffffff;
border-radius: 39upx;
padding: 13upx;
padding-left: 25upx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.search-body .search-input {
height: 100%;
flex: 1;
padding-left: 12rpx;
box-sizing: border-box;
}
.left-img {
width: 26rpx;
height: 26rpx;
}
.right-img {
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
}
.right-btn {
width: 110rpx;
height: 58rpx;
line-height: 58rpx;
background-image: linear-gradient(0deg,
#2da0f3 0%,
#54bcff 100%);
border-radius: 29rpx;
font-size: 28rpx;
color: #ffffff;
text-align: center;
}
.right-btn.allBtn {
margin: 13rpx 0;
}
</style>