|
@@ -7,6 +7,7 @@ var AParse = require('../../../Component/aParse/aParse.js');
|
|
|
import 'dingtalk-jsapi/entry/union';
|
|
|
import { setCache, getCache } from '../../../utils/util'
|
|
|
import { contactAdminToUseApp } from 'dingtalk-design-libs';
|
|
|
+import { openSubscribeMiniApp, disposeSubscribeData} from 'dingtalk-service-window-libs/lib/openSubscribeMiniApp';
|
|
|
import moment from 'moment' // 时间库
|
|
|
Page({
|
|
|
data: {
|
|
@@ -46,38 +47,46 @@ Page({
|
|
|
isGz:false,
|
|
|
islog:true,
|
|
|
announcementList:[],
|
|
|
- isShowYy:false,
|
|
|
+ isSuperAdministrator:app.globalData.isSuperAdministrator, //是否是超级管理员
|
|
|
isShowAn:true,
|
|
|
|
|
|
selectPlItem:{},
|
|
|
+ isShowDate:false,
|
|
|
+ dateArr:[
|
|
|
+ {dateIndex:1,max:60,min:31,},
|
|
|
+ {dateIndex:2,max:30,min:8},
|
|
|
+ {dateIndex:3,max:7,min:4},
|
|
|
+ {dateIndex:4,max:3,min:0},
|
|
|
+ ],
|
|
|
+ day:0,
|
|
|
+ dateIndex:0,
|
|
|
+ isShowVlink:false,//是否显示关注
|
|
|
},
|
|
|
onLoad() {
|
|
|
that = this;
|
|
|
chart1, chart2, chart3 = '';
|
|
|
},
|
|
|
onShow() {
|
|
|
+ disposeSubscribeData((options)=>{
|
|
|
+ if(options.subscribe=='cancel'){
|
|
|
+ this.vlinkConfig()
|
|
|
+ }else{
|
|
|
+ // app.globalData.showToast("已关注");
|
|
|
+ this.vlinkConfig()
|
|
|
+ }
|
|
|
+ // dd.alert({
|
|
|
+ // title:'disposeSubscribeData',
|
|
|
+ // content:JSON.stringify(options)
|
|
|
+ // })
|
|
|
+ })
|
|
|
if (app.globalData.userData) {
|
|
|
dd.setNavigationBar({ title: app.globalData.userData.name });
|
|
|
that.getUserData();
|
|
|
that.getGg();
|
|
|
that.getNotice();
|
|
|
that.opneWebSocket();
|
|
|
- let isShowYy=false;
|
|
|
- app.globalData.userData.employee_detail.role_list.forEach(item=>{
|
|
|
- if(item.name=='admin'||item.name=='creator'|| item.name == 'point_manager'){
|
|
|
- isShowYy=true;
|
|
|
- }
|
|
|
- })
|
|
|
- that.setData({
|
|
|
- isAdministrator: app.globalData.isAdministrator,
|
|
|
- getRole_four: app.globalData.isCreator,
|
|
|
- isSubject: app.globalData.userData.is_personal == 1 ? true : false,
|
|
|
- mainCorpId: app.globalData.userData.main_corp_id,
|
|
|
- isShowYy:isShowYy,
|
|
|
- isShowAn:getCache('isShowAn')? false:true,
|
|
|
- })
|
|
|
- if(that.data.isShowYy&&that.data.isShowAn){
|
|
|
- that.getAnnouncement();
|
|
|
+ if(app.globalData.isSuperAdministrator){ //套餐
|
|
|
+ that.getCorp();
|
|
|
}
|
|
|
if(!getCache('init_rule_check')){
|
|
|
app.globalData.userData.init_rule_check? '':that.setData({ isGz: true})
|
|
@@ -89,39 +98,50 @@ Page({
|
|
|
} else if (!app.globalData.isCreator && !app.globalData.isAdministrator) {
|
|
|
that.setMenuList("employee");
|
|
|
}
|
|
|
+ that.setData({
|
|
|
+ isAdministrator: app.globalData.isAdministrator,
|
|
|
+ getRole_four: app.globalData.isCreator,
|
|
|
+ isSubject: app.globalData.userData.is_personal == 1 ? true : false,
|
|
|
+ mainCorpId: app.globalData.userData.main_corp_id,
|
|
|
+ isShowAn:getCache('isShowAn')? false:true,
|
|
|
+ })
|
|
|
+ if(app.globalData.isSuperAdministrator&&that.data.isShowAn){ //指南
|
|
|
+ that.getAnnouncement();
|
|
|
+ }
|
|
|
+ if(app.globalData.isSuperAdministrator&&app.globalData.userData.vlink.status=='UNFOLLOW'&&!getCache('vlink')){ //关注
|
|
|
+ this.setData({
|
|
|
+ isShowVlink:true
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
app.login(app.globalData.corpId,function (is) {
|
|
|
if (is) {
|
|
|
dd.setNavigationBar({ title: app.globalData.userData.name });
|
|
|
- if (app.globalData.isCreator) {
|
|
|
- that.setMenuList("creator");
|
|
|
- } else if (app.globalData.isAdministrator) {
|
|
|
- that.setMenuList("admin");
|
|
|
- } else if (!app.globalData.isCreator && !app.globalData.isAdministrator) {
|
|
|
- that.setMenuList("employee");
|
|
|
- }
|
|
|
that.getUserData();
|
|
|
that.getGg();
|
|
|
that.getNotice();
|
|
|
that.opneWebSocket();
|
|
|
+ if(app.globalData.isSuperAdministrator){
|
|
|
+ that.getCorp();
|
|
|
+ }
|
|
|
if(!getCache('init_rule_check')){
|
|
|
app.globalData.userData.init_rule_check? '':that.setData({ isGz: true})
|
|
|
}
|
|
|
- let isShowYy=false;
|
|
|
- app.globalData.userData.employee_detail.role_list.forEach(item=>{
|
|
|
- if(item.name=='admin'||item.name=='creator'|| item.name == 'point_manager'){
|
|
|
- isShowYy=true;
|
|
|
- }
|
|
|
- })
|
|
|
+ if (app.globalData.isCreator) {
|
|
|
+ that.setMenuList("creator");
|
|
|
+ } else if (app.globalData.isAdministrator) {
|
|
|
+ that.setMenuList("admin");
|
|
|
+ } else if (!app.globalData.isCreator && !app.globalData.isAdministrator) {
|
|
|
+ that.setMenuList("employee");
|
|
|
+ }
|
|
|
that.setData({
|
|
|
isAdministrator: app.globalData.isAdministrator,
|
|
|
getRole_four: app.globalData.isCreator,
|
|
|
isSubject: app.globalData.userData.is_personal == 1 ? true : false,
|
|
|
mainCorpId: app.globalData.userData.main_corp_id,
|
|
|
- isShowYy:isShowYy,
|
|
|
isShowAn:getCache('isShowAn')? false:true,
|
|
|
})
|
|
|
- if(that.data.isShowYy&&that.data.isShowAn){
|
|
|
+ if(app.globalData.isSuperAdministrator&&that.data.isShowAn){
|
|
|
that.getAnnouncement();
|
|
|
}
|
|
|
} else {
|
|
@@ -132,10 +152,74 @@ Page({
|
|
|
},function(){},true)
|
|
|
}
|
|
|
},
|
|
|
+ onTap() {
|
|
|
+ return openSubscribeMiniApp({
|
|
|
+ panelHeight: 'percent40',
|
|
|
+ path: 'pages/index/index',
|
|
|
+ float: true,
|
|
|
+ extraData: {
|
|
|
+ clientId: '55493',
|
|
|
+ authToken: 'v00dfd6ff9ca66a4ae187dab8a5b6004495',
|
|
|
+ },
|
|
|
+ options:{
|
|
|
+ // snsMessageSendAuthEnable参数仅对个人小程序有效,非个人小程序请勿设置此参数。
|
|
|
+ // 在使用 snsMessageSendAuthEnable 参数时
|
|
|
+ // 需要为应用申请OfficialAccount.SnsMessage.Send权限后方可使用。
|
|
|
+ // snsMessageSendAuthEnable:true
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ vlinkConfig(){
|
|
|
+ setCache('vlink',true);
|
|
|
+ this.setData({
|
|
|
+ isShowVlink:false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ dayConfig(e){
|
|
|
+ var index = e.target.dataset.index;
|
|
|
+ if(index==1){
|
|
|
+ dd.navigateTo({
|
|
|
+ url: '../../deploy/addMoney/addMoney'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ setCache('dateIndex',that.data.dateIndex);
|
|
|
+ that.setData({
|
|
|
+ isShowDate:false,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取套餐信息
|
|
|
+ getCorp() {
|
|
|
+ app.$get2('api/order/corp', {corp_id:app.globalData.corpId}).then(res => {
|
|
|
+ let corpMessage = res.data.data;
|
|
|
+ const startDate = moment(corpMessage.expire_time).format('YYYY-MM-DD');
|
|
|
+ const endDate = moment().format('YYYY-MM-DD');
|
|
|
+ let day=moment(startDate).diff(endDate, 'day');
|
|
|
+ // let day=4
|
|
|
+ this.data.dateArr.forEach(item=>{
|
|
|
+ if(item.max>=day&&item.min<=day){
|
|
|
+ let dateIndex=getCache('dateIndex')
|
|
|
+ if(!dateIndex){
|
|
|
+ that.setData({
|
|
|
+ dateIndex:item.dateIndex,
|
|
|
+ isShowDate:true,
|
|
|
+ day:day
|
|
|
+ })
|
|
|
+ }else if(dateIndex!=item.dateIndex){
|
|
|
+ that.setData({
|
|
|
+ dateIndex:item.dateIndex,
|
|
|
+ isShowDate:true,
|
|
|
+ day:day
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
closeAn(){
|
|
|
setCache('isShowAn',true);
|
|
|
this.setData({
|
|
|
- isShowYy:false,
|
|
|
+ isSuperAdministrator:false,
|
|
|
})
|
|
|
},
|
|
|
openaN(e){
|
|
@@ -147,7 +231,6 @@ Page({
|
|
|
getAnnouncement(){
|
|
|
app.$get2("api/announcement/list",{type:3}).then((res) => {
|
|
|
let list=res.data.data.list;
|
|
|
-
|
|
|
that.setData({ announcementList:list})
|
|
|
})
|
|
|
},
|