You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
312 lines
13 KiB
312 lines
13 KiB
"use strict";
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
function step(op) {
|
|
if (f) throw new TypeError("Generator is already executing.");
|
|
while (_) try {
|
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
switch (op[0]) {
|
|
case 0: case 1: t = op; break;
|
|
case 4: _.label++; return { value: op[1], done: false };
|
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
default:
|
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
if (t[2]) _.ops.pop();
|
|
_.trys.pop(); continue;
|
|
}
|
|
op = body.call(thisArg, _);
|
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
}
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var rerquest_1 = require("../../../../config/rerquest");
|
|
var promise_wx_api_1 = require("../../../../utils/promise-wx-api");
|
|
var app = getApp();
|
|
Component({
|
|
data: {
|
|
userState: "",
|
|
showTips: false,
|
|
showModel: false,
|
|
visible: false,
|
|
joinMessage: "",
|
|
currentGid: "",
|
|
completeInfoDialogVisible: false,
|
|
},
|
|
properties: {
|
|
recommandGroupList: {
|
|
type: Array,
|
|
value: [],
|
|
},
|
|
noDataVisible: {
|
|
type: Boolean,
|
|
value: true,
|
|
},
|
|
},
|
|
lifetimes: {
|
|
attached: function () {
|
|
},
|
|
},
|
|
ready: function () {
|
|
this.requestMsg = this.selectComponent("#requestMsg");
|
|
},
|
|
methods: {
|
|
cancelModel: function () {
|
|
this.setData({
|
|
joinMessage: "",
|
|
showModel: false,
|
|
});
|
|
},
|
|
closeDialog: function () {
|
|
this.setData({
|
|
visible: false,
|
|
});
|
|
},
|
|
gotomanage: function (e) {
|
|
var gid = e.currentTarget.dataset.gid;
|
|
wx.navigateTo({
|
|
url: "/subpages/group/pages/group/groupManage/groupManage?gid=" + gid,
|
|
});
|
|
},
|
|
confirmModel: function () {
|
|
var _this = this;
|
|
var that = this;
|
|
var params = {
|
|
groupId: this.data.currentGid,
|
|
operateDes: this.data.joinMessage,
|
|
};
|
|
if (this.data.joinMessage == "") {
|
|
wx.showToast({
|
|
title: "入组理由不能为空",
|
|
icon: "none",
|
|
duration: 3000,
|
|
});
|
|
return false;
|
|
}
|
|
this.applyJoinGroupData(params).then(function (res) { return __awaiter(_this, void 0, void 0, function () {
|
|
var msg;
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0:
|
|
console.log(res);
|
|
msg = res.msg;
|
|
if (!(msg === "success")) return [3, 2];
|
|
console.log("success");
|
|
that.setData({
|
|
joinMessage: "",
|
|
showModel: false,
|
|
showTips: true,
|
|
});
|
|
setTimeout(function () {
|
|
that.setData({
|
|
showTips: false,
|
|
});
|
|
}, 3000);
|
|
return [4, that.requestMsg.handleMsg()];
|
|
case 1:
|
|
_a.sent();
|
|
that.triggerEvent("callSomeFun");
|
|
_a.label = 2;
|
|
case 2: return [2];
|
|
}
|
|
});
|
|
}); });
|
|
},
|
|
bindTextAreaBlur: function (e) {
|
|
this.setData({
|
|
joinMessage: e.detail.value,
|
|
});
|
|
console.log(this.data.joinMessage);
|
|
},
|
|
pureJoinGroup: function (groupId) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var $ele, addReturn;
|
|
return __generator(this, function (_a) {
|
|
switch (_a.label) {
|
|
case 0:
|
|
$ele = this.selectComponent("#joinGroup");
|
|
return [4, $ele.show({ groupId: groupId })];
|
|
case 1:
|
|
addReturn = _a.sent();
|
|
if (!addReturn)
|
|
return [2];
|
|
return [4, this.requestMsg.handleMsg()];
|
|
case 2:
|
|
_a.sent();
|
|
this.triggerEvent("callSomeFun");
|
|
return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
toCreateGroup: function () {
|
|
this.triggerEvent("callCreatGroup");
|
|
},
|
|
updateWxuserInfoData: function (params) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
return __generator(this, function (_a) {
|
|
return [2, rerquest_1.default({
|
|
method: "POST",
|
|
url: "epmetuser/user/updatewxuserinfo",
|
|
options: params,
|
|
ifToken: true,
|
|
})];
|
|
});
|
|
});
|
|
},
|
|
confirm: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var _a, msg, data, params;
|
|
return __generator(this, function (_b) {
|
|
switch (_b.label) {
|
|
case 0: return [4, promise_wx_api_1.wxGetUserProfile({
|
|
desc: "用于完善居民信息",
|
|
})];
|
|
case 1:
|
|
_a = _b.sent(), msg = _a.msg, data = _a.data;
|
|
if (!(msg == "success")) return [3, 3];
|
|
console.log(data.avatarUrl);
|
|
params = {
|
|
nickName: data.userInfo.nickName,
|
|
gender: data.userInfo.gender,
|
|
avatarUrl: data.userInfo.avatarUrl,
|
|
province: data.userInfo.province,
|
|
country: data.userInfo.country,
|
|
city: data.userInfo.city,
|
|
};
|
|
return [4, this.updateWxuserInfoData(params).then(function (res) { })];
|
|
case 2:
|
|
_b.sent();
|
|
wx.navigateTo({
|
|
url: "/subpages/mine/pages/register/communist/index?from=group_joinGroup",
|
|
});
|
|
this.setData({
|
|
visible: false,
|
|
});
|
|
_b.label = 3;
|
|
case 3: return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
confirm2: function () {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var _a, msg, data, params;
|
|
return __generator(this, function (_b) {
|
|
switch (_b.label) {
|
|
case 0: return [4, promise_wx_api_1.wxGetUserProfile({
|
|
desc: "用于完善居民信息",
|
|
})];
|
|
case 1:
|
|
_a = _b.sent(), msg = _a.msg, data = _a.data;
|
|
if (!(msg == "success")) return [3, 3];
|
|
console.log(data);
|
|
params = {
|
|
nickName: data.userInfo.nickName,
|
|
gender: data.userInfo.gender,
|
|
avatarUrl: data.userInfo.avatarUrl,
|
|
province: data.userInfo.province,
|
|
country: data.userInfo.country,
|
|
city: data.userInfo.city,
|
|
};
|
|
return [4, this.updateWxuserInfoData(params).then(function (res) { })];
|
|
case 2:
|
|
_b.sent();
|
|
wx.navigateTo({
|
|
url: "/subpages/mine/pages/register/resident/index?from=group_joinGroup",
|
|
});
|
|
this.setData({
|
|
visible: false,
|
|
});
|
|
_b.label = 3;
|
|
case 3: return [2];
|
|
}
|
|
});
|
|
});
|
|
},
|
|
gotoGroup: function (e) {
|
|
var gid = e.currentTarget.dataset.gid;
|
|
var status = e.currentTarget.dataset.status;
|
|
if (status == "under_auditting") {
|
|
wx.navigateTo({
|
|
url: "/subpages/group/pages/group/groupManage/groupManage?gid=" + gid,
|
|
});
|
|
}
|
|
else {
|
|
wx.navigateTo({
|
|
url: "/subpages/group/pages/topic/topicIndex/topicIndex?gid=" + gid,
|
|
});
|
|
}
|
|
},
|
|
applyJoinGroupData: function (params) {
|
|
return rerquest_1.default({
|
|
method: "POST",
|
|
url: "resi/group/member/applyjoingroup",
|
|
options: params,
|
|
ifToken: true,
|
|
});
|
|
},
|
|
joinAssocition: function (e) {
|
|
console.log(app.globalData.userRoleList);
|
|
var type = e.currentTarget.dataset.type;
|
|
var gid = e.currentTarget.dataset.gid;
|
|
var userRoleList = app.globalData.userRoleList;
|
|
if (type === "branch") {
|
|
if (userRoleList.indexOf("partymember") >= 0) {
|
|
this.pureJoinGroup(gid);
|
|
}
|
|
else {
|
|
wx.showModal({
|
|
content: "该小组需党员才能加入,是否注册党员",
|
|
confirmText: "是",
|
|
cancelText: "否",
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
console.log("用户点击确定");
|
|
wx.navigateTo({
|
|
url: "/subpages/mine/pages/register/communist/index",
|
|
});
|
|
}
|
|
else if (res.cancel) {
|
|
console.log("用户点击取消");
|
|
}
|
|
},
|
|
});
|
|
}
|
|
}
|
|
else {
|
|
if (userRoleList.indexOf("registered_resi") >= 0) {
|
|
console.log("gid=" + gid);
|
|
this.pureJoinGroup(gid);
|
|
}
|
|
else {
|
|
this.setData({
|
|
visible: true,
|
|
});
|
|
}
|
|
}
|
|
},
|
|
previewImage: function (e) {
|
|
app.globalData.previewImage = true;
|
|
wx.previewImage({
|
|
urls: [e.currentTarget.dataset.src],
|
|
});
|
|
},
|
|
},
|
|
});
|
|
|