|
|
@@ -2,7 +2,7 @@
|
|
|
<view class="content">
|
|
|
<view class="self-inf">
|
|
|
<view class="antu-box">
|
|
|
- <view class="img-name-box" style="margin-bottom: 5%">
|
|
|
+ <view class="img-name-box" style="margin-bottom: 5%" :style="{ 'z-index': isFirstPage ? '0' : '101' }">
|
|
|
<image :src="userHeadImg" class="heade-img" mode="aspectFill"></image>
|
|
|
<p class="nickname">{{userNickName}}</p>
|
|
|
<p class="nickname">{{userPhone}}</p>
|
|
|
@@ -43,10 +43,10 @@
|
|
|
<view style="width: 55%;">{{item.type}}</view>
|
|
|
</view>
|
|
|
<view class="active-content-box">
|
|
|
- <view class="active-content">
|
|
|
+ <view class="active-content" style="margin-bottom: 3%;">
|
|
|
<view class="active-name">{{item.name}}</view>
|
|
|
</view>
|
|
|
- <view class="active-content" >
|
|
|
+ <view class="active-content" style="margin-bottom: 2%;color: #ccc;">
|
|
|
<view style="margin-right:10rpx;">{{item.branch}}</view>
|
|
|
<view class="author-box">{{item.author}}</view>
|
|
|
<view style="margin-left:10rpx;">记录数:({{item.process_count}}/
|
|
|
@@ -66,16 +66,31 @@
|
|
|
</view> -->
|
|
|
</view>
|
|
|
</mescroll-body>
|
|
|
-
|
|
|
</view>
|
|
|
+ <uni-popup ref="popup" type="center" :is-mask-click="false">
|
|
|
+ <view class="auth-pop">
|
|
|
+ <image src="/static/logo.png" mode="aspectFill"></image>
|
|
|
+ <text class="margin-top-3 auth-title">欢迎使用农工笔记小程序</text>
|
|
|
+ <text class="margin-top-3 auth-content">此页面是微信授权页面,授权之后你可以获取更优质的服务,您的隐私将会受到保护</text>
|
|
|
+ <view class="margin-top-3">
|
|
|
+ <!-- <button type='default' class="refuse" @click="goAuthPage">去授权</button>-->
|
|
|
+ <button type='primary' class="allow" @click="getUserInfo()" v-if="!isAuth">登录授权</button>
|
|
|
+ <button type="primary" class="allow" open-type="getPhoneNumber" style="font-size: 12px;"
|
|
|
+ @getphonenumber="getPhoneNumber" v-if="isAuth && !isNeedPhone">手机号码授权</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
+ <share-modal @closeShare="closeShare" :isShowShare="isShowShareModal" :isFirstPage="isFirstPage" :class="{ shareParent: isShowShareModal}"></share-modal>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import md5 from "@/common/md5.js";
|
|
|
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
|
|
+import shareModal from '@/components/share-modal/share-modal.vue'
|
|
|
export default {
|
|
|
components: {
|
|
|
+ "share-modal": shareModal,
|
|
|
},
|
|
|
mixins: [MescrollMixin], // 使用mixin
|
|
|
data() {
|
|
|
@@ -84,27 +99,216 @@ export default {
|
|
|
arrayYear:[],
|
|
|
dateMonth:'全部',
|
|
|
arrayMonth:['全部',"1","2","3","4","5","6","7","8","9","10","11","12"],
|
|
|
- userHeadImg: getApp().globalData.user_headUrl,
|
|
|
- userNickName:getApp().globalData.user_name,
|
|
|
- userPhone:getApp().globalData.user_phone.substr(0, 3) + '****' + getApp().globalData.user_phone.substr(7),
|
|
|
+ isAuth: true,
|
|
|
+ userHeadImg:'',
|
|
|
+ userNickName:'',
|
|
|
+ userPhone:'',
|
|
|
userPosList:[],
|
|
|
+ isNeedPhone:getApp().globalData.user_phone,
|
|
|
branchArray: [],
|
|
|
branchValue:'全部',
|
|
|
branchId:'0',
|
|
|
page:1,
|
|
|
pageSize:10,
|
|
|
- activiList:[]
|
|
|
+ activiList:[],
|
|
|
+ isShowShareModal:false,
|
|
|
+ isFirstPage:false
|
|
|
};
|
|
|
},
|
|
|
onShow() {
|
|
|
// this.getActiveList(this.branchId)
|
|
|
},
|
|
|
- onLoad(option) {
|
|
|
- this.getUserInfoBranch()
|
|
|
- this.getActiveInfoBranch()
|
|
|
+ onShareAppMessage() {
|
|
|
+ return {
|
|
|
+ title: '农工笔记',
|
|
|
+ path:'/pages/index/activity/activity'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async onLoad(option) {
|
|
|
+ await this.$getOpenId
|
|
|
+ this.getUserInfoData()
|
|
|
this.makeYearArr()
|
|
|
},
|
|
|
methods: {
|
|
|
+ open(){
|
|
|
+ // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
|
|
|
+ uni.hideTabBar();
|
|
|
+ this.$refs.popup.open('center')
|
|
|
+ },
|
|
|
+ pageShowShare(obj){
|
|
|
+ this.isShowShareModal = true;
|
|
|
+ this.isFirstPage = true;
|
|
|
+ },
|
|
|
+ closeShare(e){
|
|
|
+ this.isShowShareModal = false;
|
|
|
+ },
|
|
|
+ getUserInfo() {
|
|
|
+ uni.getUserProfile({
|
|
|
+ desc:'登录',
|
|
|
+ success:(res)=> {
|
|
|
+ getApp().globalData.user_headUrl = res.userInfo.avatarUrl;
|
|
|
+ getApp().globalData.user_name = res.userInfo.nickName;
|
|
|
+ this.userHeadImg = res.userInfo.avatarUrl;
|
|
|
+ this.userNickName = res.userInfo.nickName;
|
|
|
+ this.iv = res.iv;
|
|
|
+ this.encryptedData = res.encryptedData;
|
|
|
+ this.isAuth = true;
|
|
|
+ getApp().globalData.isAuth = true;
|
|
|
+ getApp().globalData.globalAuth = true;
|
|
|
+ this.loginUserInfo()
|
|
|
+ },
|
|
|
+ fail:(err)=> {
|
|
|
+ getApp().globalData.isAuth = false;
|
|
|
+ getApp().globalData.globalAuth = false;
|
|
|
+ this.isAuth = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getPhoneNumber(e){
|
|
|
+ let that = this;
|
|
|
+ if (e.detail.errMsg == 'getPhoneNumber:ok') { //允许授权执行跳转
|
|
|
+ that.phoneRequest(e.detail.iv, e.detail.encryptedData, getApp().globalData.session_key)
|
|
|
+ } else { //
|
|
|
+ that.isNeedPhone = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ phoneRequest(myIv,myEncryptedData,sKey){
|
|
|
+ let that = this;
|
|
|
+ let md5Sign = md5("method="+'user'+"×tamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
|
|
|
+ let url = getApp().globalData.shareUrl+'api/api.php'+'?method=user&source=user&action=phone×tamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
|
|
|
+ uni.request({
|
|
|
+ url:url,
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/x-www-form-urlencoded'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ iv:myIv,
|
|
|
+ sessionKey:sKey,
|
|
|
+ encryptedData:myEncryptedData,
|
|
|
+ openid:getApp().globalData.open_id
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.code === 200){
|
|
|
+ getApp().globalData.user_phone = res.data.data;
|
|
|
+ this.userPhone = res.data.data.substr(0, 3) + '****' + res.data.data.substr(7) ;
|
|
|
+ this.$refs.popup.close()
|
|
|
+ uni.showTabBar({})
|
|
|
+ this.getUserInfoBranch();
|
|
|
+ this.getActiveList(this.branchId)
|
|
|
+ this.getActiveInfoBranch()
|
|
|
+ }else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.data.msg,
|
|
|
+ duration: 2500,
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ loginUserInfo(){
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "user" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=user&action=update×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ nickname:getApp().globalData.user_name,
|
|
|
+ headimg:getApp().globalData.user_headUrl,
|
|
|
+ openid:getApp().globalData.open_id
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getUserInfoData() {
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "user" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=user&action=info_by_openid×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&sign=" +
|
|
|
+ md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ openid:getApp().globalData.open_id,
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ if (res.data.data.nickname) {
|
|
|
+ this.isAuth = true;
|
|
|
+ this.userHeadImg = res.data.data.headimg;
|
|
|
+ this.userNickName = res.data.data.nickname;
|
|
|
+ if(res.data.data.phone){
|
|
|
+ this.userPhone = res.data.data.phone.substr(0, 3) + '****' + res.data.data.phone.substr(7)
|
|
|
+ this.getUserInfoBranch();
|
|
|
+ this.getActiveList(this.branchId);
|
|
|
+ }else {
|
|
|
+ this.open()
|
|
|
+ }
|
|
|
+ getApp().globalData.globalAuth = true;
|
|
|
+ getApp().globalData.user_name = res.data.data.nickname;
|
|
|
+ getApp().globalData.user_headUrl = res.data.data.headimg;
|
|
|
+ getApp().globalData.user_department = res.data.data.department;
|
|
|
+ getApp().globalData.user_real_name = res.data.data.real_name;
|
|
|
+ getApp().globalData.user_phone = res.data.data.phone;
|
|
|
+ getApp().globalData.isAuth = true;
|
|
|
+ this.isAuth = true;
|
|
|
+ this.isNeedPhone = false;
|
|
|
+ }else {
|
|
|
+ this.open();
|
|
|
+ this.isAuth = false;
|
|
|
+ getApp().globalData.globalAuth = false;
|
|
|
+ getApp().globalData.user_name = '';
|
|
|
+ getApp().globalData.isAuth = false;
|
|
|
+ this.isAuth = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
makeYearArr(){
|
|
|
let nowYear = new Date().getFullYear(),yearList = ['全部'];
|
|
|
for(let i = 0; i < 10 ; i ++){
|
|
|
@@ -174,10 +378,8 @@ export default {
|
|
|
title: "删除成功",
|
|
|
icon: "none",
|
|
|
duration: 2500,
|
|
|
- success:()=>{
|
|
|
- this.getActiveList(this.branchId)
|
|
|
- }
|
|
|
});
|
|
|
+ this.getActiveList(this.branchId)
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
@@ -268,7 +470,19 @@ export default {
|
|
|
},
|
|
|
success: (res) => {
|
|
|
if (res.data.code === 200) {
|
|
|
- this.activiList=res.data.data.list;
|
|
|
+ // 接口返回的当前页数据列表 (数组)
|
|
|
+ let curPageData = res.data.data.list;
|
|
|
+ // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
|
|
|
+ let curPageLen = curPageData.length;
|
|
|
+ // 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
|
|
|
+ let totalPage = res.data.data.page_count;
|
|
|
+ // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
|
|
|
+ let totalSize = res.data.data.count;
|
|
|
+ // // 接口返回的是否有下一页 (true/false)
|
|
|
+ // let hasNext = data.xxx;
|
|
|
+ this.activiList = res.data.data.list;
|
|
|
+ this.mescroll.endByPage(curPageLen || 0, totalPage);
|
|
|
+ // this.activiList=res.data.data.list;
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
@@ -277,7 +491,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
upCallback(page) {
|
|
|
- console.log(666)
|
|
|
let pageNum = page.num; // 页码, 默认从1开始
|
|
|
let pageSize = page.size; // 页长, 默认每页10条
|
|
|
let md5Sign = md5(
|
|
|
@@ -418,6 +631,59 @@ export default {
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
+ .auth-pop{
|
|
|
+ background-color: #fff;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 75%;
|
|
|
+ margin: 0 auto;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ padding: 20rpx;
|
|
|
+ }
|
|
|
+ .auth-pop image{
|
|
|
+ width: 200upx;
|
|
|
+ height: 200upx;
|
|
|
+ margin-top: 10%;
|
|
|
+ }
|
|
|
+ .auth-pop view {
|
|
|
+ // display: flex;
|
|
|
+ // width: 490upx;
|
|
|
+ // justify-content: space-between;
|
|
|
+ }
|
|
|
+ .auth-title {
|
|
|
+ font-size: 32upx;
|
|
|
+ }
|
|
|
+ .auth-content {
|
|
|
+ font-size: 26upx;
|
|
|
+ color: #a7aaa9;
|
|
|
+ }
|
|
|
+ .allow {
|
|
|
+ background-color: #27BCEF;
|
|
|
+ margin: 20rpx 0 75rpx;
|
|
|
+ text-align: center;
|
|
|
+ vertical-align: middle;
|
|
|
+ touch-action: manipulation;
|
|
|
+ cursor: pointer;
|
|
|
+ background-image: none;
|
|
|
+ white-space: nowrap;
|
|
|
+ user-select: none;
|
|
|
+ font-size: 14px;
|
|
|
+ border: 0 !important;
|
|
|
+ position: relative;
|
|
|
+ text-decoration: none;
|
|
|
+ height: 44px;
|
|
|
+ width: 250rpx;
|
|
|
+ line-height: 44px;
|
|
|
+ box-shadow: inset 0 0 0 1px #27BCEF;
|
|
|
+ background: #fff !important;
|
|
|
+ color: #27BCEF !important;
|
|
|
+ display: inline-block;
|
|
|
+ border-radius: 10rpx;
|
|
|
+
|
|
|
+ }
|
|
|
.self-inf {
|
|
|
position: relative;
|
|
|
height: 440rpx;
|
|
|
@@ -430,7 +696,7 @@ export default {
|
|
|
margin-top:80rpx;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- z-index: 99999;
|
|
|
+ z-index: 101;
|
|
|
.auth-btn {
|
|
|
margin-left: 30rpx;
|
|
|
margin-top: 20rpx;
|
|
|
@@ -604,7 +870,7 @@ export default {
|
|
|
background-color: #81d3f8;
|
|
|
}
|
|
|
.fontRed {
|
|
|
- color: red;
|
|
|
+ color: coral;
|
|
|
}
|
|
|
}
|
|
|
</style>
|