| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- import common from '../../utils/util';
- import server from '../../utils/main';
- const app = getApp();
- var productList=[];
- Page({
- data: {
- },
- onLoad: function (options) {
- this.setData({
- Containnerheight: common.getSystemHeight(),
- ProgramList: server.getProgramList(),
- });
- this.init();
- },
- init: function (e, isRemind) {
- var that = this;
- wx.showLoading({
- title: '装载中',
- });
- server.getData('GetUserActivateListByUserID500?UserID=' + app.globalData.userInfo.UserID + "&ProductID=" + app.globalData.ProgramID, function (data) {
- if (data && data.length > 0) {
- var programList = server.getProgramList();
- for (var i = 0; i < programList.length; i++) {
- for (var j = 0; j < data.length; j++) {
- if (programList[i].ID == data[j].ProductID) {
- data[j].Name = programList[i].Name;
- data[j].ImageUrl = programList[i].ImageUrl;
- data[j].appId = programList[i].appId;
- data[j].path = programList[i].path;
- }
- }
- }
- if (productList.length>0){
- for(var i=0;i<productList.length;i++){
- var b=false;
- for(var j=0;j<data.length;j++){
- if (productList[i].ProductID == data[j].ProductID){
- b=true;
- break;
- }
- }
- if (!b){
- productList[i].IsActivate=1;
- data.push(productList[i]);
- }
- }
- }
- that.setData({
- List: data,
- });
- productList=data;
- wx.hideLoading();
- if (isRemind) {
- wx.showModal({
- title: '产品未激活',
- content: '您有产品未激活,请立即点击红色“去激活”按钮。',
- showCancel: false,
- confirmText: "知道了",
- });
- }
- wx.setStorageSync("HasActivate", 1);
- }
- else {
- wx.redirectTo({
- url: "./activateFinish",
- });
- wx.removeStorageSync("HasActivate");
- }
- });
- },
- gotoFeedback: function () {
- server.gotoFeedback();
- },
- gotoActive: function (e) {
- var that = this;
- var productid = e.currentTarget.dataset.id;
- if (productid == app.globalData.ProgramID) {
- server.getData('UpdateWXUsersAll500?ProductID=' + productid
- + "&ProductUserID=" + app.globalData.userInfo.UserID
- + "&CurrentProductID=" + productid
- + "&CurrentUserID=" + app.globalData.userInfo.UserID, function (data) {
- if (data) {
- }
- });
- }
- else {
- var appId = e.currentTarget.dataset.appid;
- var path = e.currentTarget.dataset.path;
- path += "&ProductID=" + app.globalData.ProgramID;
- path += "&ProductUserID=" + app.globalData.userInfo.UserID;
- wx.navigateToMiniProgram({
- appId: appId,
- path: path,
- success(res) {
- }
- });
- }
- var data = this.data.List;
- for (var i = 0; i < data.length; i++) {
- if (data[i].ProductID == productid) {
- data[i].IsActivate = 0;
- }
- }
- that.setData({
- List: data,
- });
- },
- gotoFinish: function () {
- this.init(null, true);
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.ShareImage,
- }
- },
- })
|