@ -0,0 +1,510 @@ |
|||||
|
"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 promise_wx_api_1 = require("./utils/promise-wx-api"); |
||||
|
var tools_1 = require("./utils/tools"); |
||||
|
var config_1 = require("./config/config"); |
||||
|
App({ |
||||
|
globalData: { |
||||
|
appLaunchTime: "", |
||||
|
previewImage: false, |
||||
|
landing: false, |
||||
|
extAppid: "", |
||||
|
token: "", |
||||
|
isNoviceEnv: false, |
||||
|
isPhoneAccount: false, |
||||
|
isLogined: false, |
||||
|
customerId: "", |
||||
|
gridId: "", |
||||
|
agencyId: "", |
||||
|
orgInfo: { |
||||
|
orgId: "", |
||||
|
orgName: "", |
||||
|
orgType: "", |
||||
|
}, |
||||
|
latitude: 0, |
||||
|
longitude: 0, |
||||
|
userRoleList: [], |
||||
|
currentGridName: "", |
||||
|
userInfo: { |
||||
|
userStreetTrueName: "", |
||||
|
userStreetName: "", |
||||
|
realName: "", |
||||
|
nickname: "", |
||||
|
userHeadPhoto: "", |
||||
|
}, |
||||
|
userPhone: "", |
||||
|
pageCustomerData: {}, |
||||
|
customOptions: {}, |
||||
|
tempData: { |
||||
|
subjectTitle: "", |
||||
|
subjectSuggest: "", |
||||
|
invitationId: "", |
||||
|
}, |
||||
|
isHintedFillIdNum: false, |
||||
|
}, |
||||
|
onLaunch: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var menuButtonObject, extConfig; |
||||
|
var _this = this; |
||||
|
return __generator(this, function (_a) { |
||||
|
setTimeout(function () { |
||||
|
}, 100); |
||||
|
this.globalData.appLaunchTime = new Date().getTime(); |
||||
|
menuButtonObject = wx.getMenuButtonBoundingClientRect(); |
||||
|
wx.getSystemInfo({ |
||||
|
success: function (res) { |
||||
|
var statusBarHeight = res.statusBarHeight, navTop = menuButtonObject.top, navHeight = statusBarHeight + |
||||
|
menuButtonObject.height + |
||||
|
(menuButtonObject.top - statusBarHeight) * 2; |
||||
|
_this.globalData.navHeight = navHeight; |
||||
|
_this.globalData.statusHeight = statusBarHeight; |
||||
|
_this.globalData.navTop = navTop; |
||||
|
_this.globalData.windowHeight = res.windowHeight; |
||||
|
}, |
||||
|
fail: function (err) { |
||||
|
console.log(err); |
||||
|
}, |
||||
|
}); |
||||
|
extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; |
||||
|
console.log("extConfig", extConfig); |
||||
|
this.globalData.extAppid = extConfig.extAppid; |
||||
|
wx.setStorageSync("extAppid", extConfig.extAppid); |
||||
|
this.syncLocalAccountInfo(); |
||||
|
return [2]; |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
loadFontFace: function () { |
||||
|
wx.loadFontFace({ |
||||
|
global: true, |
||||
|
family: "Source Han Serif SC", |
||||
|
scopes: ["webview", "native"], |
||||
|
source: 'url("' + |
||||
|
config_1.apiUrl.slice(0, -4) + |
||||
|
'fonts/syst/SourceHanSerifSC-Regular.otf")', |
||||
|
success: function (res) { |
||||
|
console.log(" 字体加载------------------------------------------res ", res); |
||||
|
}, |
||||
|
fail: function (err) { |
||||
|
console.log(" 字体加载------------------------------------------err ", err); |
||||
|
}, |
||||
|
}); |
||||
|
wx.loadFontFace({ |
||||
|
global: true, |
||||
|
family: "Source Han Serif SC", |
||||
|
scopes: ["webview", "native"], |
||||
|
desc: { |
||||
|
weight: "bold", |
||||
|
}, |
||||
|
source: 'url("' + |
||||
|
config_1.apiUrl.slice(0, -4) + |
||||
|
'/fonts/syst/SourceHanSerifCN-Bold.otf")', |
||||
|
success: function (res) { |
||||
|
console.log(" 重体---------------------res ", res); |
||||
|
}, |
||||
|
fail: function (err) { |
||||
|
console.log(" 重体---------------------err ", err); |
||||
|
}, |
||||
|
}); |
||||
|
}, |
||||
|
doAfterLogin: tools_1.doAfterLogin, |
||||
|
syncLocalAccountInfo: function () { |
||||
|
this.globalData.isLogined = |
||||
|
wx.getStorageSync("isLogined") === false ? false : true; |
||||
|
if (this.globalData.isLogined) { |
||||
|
this.globalData.isNoviceEnv = wx.getStorageSync("isNoviceEnv") || false; |
||||
|
this.globalData.isPhoneAccount = |
||||
|
wx.getStorageSync("isPhoneAccount") || false; |
||||
|
if (this.globalData.isPhoneAccount) { |
||||
|
this.globalData.token = wx.getStorageSync("token") || ""; |
||||
|
} |
||||
|
} |
||||
|
return this.globalData.isLogined; |
||||
|
}, |
||||
|
setAccountInfo: function (obj) { |
||||
|
var _this = this; |
||||
|
if (obj === void 0) { obj = {}; } |
||||
|
Object.keys(obj).forEach(function (k) { |
||||
|
_this.globalData[k] = obj[k]; |
||||
|
wx.setStorageSync(k, obj[k]); |
||||
|
}); |
||||
|
}, |
||||
|
logoutRecord: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var _a, msg, data; |
||||
|
return __generator(this, function (_b) { |
||||
|
switch (_b.label) { |
||||
|
case 0: return [4, promise_wx_api_1.wxRequestPost("auth/thirdlogin/delresitoken", {}, { |
||||
|
isQuiet: true, |
||||
|
})]; |
||||
|
case 1: |
||||
|
_a = _b.sent(), msg = _a.msg, data = _a.data.data; |
||||
|
if (msg != "success" || data.code !== 0) { |
||||
|
console.log("退出失败"); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
else { |
||||
|
console.log("退出成功"); |
||||
|
return [2, true]; |
||||
|
} |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
logout: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
return __generator(this, function (_a) { |
||||
|
switch (_a.label) { |
||||
|
case 0: |
||||
|
this.setAccountInfo({ |
||||
|
token: "", |
||||
|
isNoviceEnv: false, |
||||
|
isPhoneAccount: false, |
||||
|
isLogined: false, |
||||
|
}); |
||||
|
this.logoutRecord(); |
||||
|
wx.showToast({ |
||||
|
title: "退出成功", |
||||
|
icon: "none", |
||||
|
duration: 2000, |
||||
|
}); |
||||
|
return [4, tools_1.nextTick(1500)]; |
||||
|
case 1: |
||||
|
_a.sent(); |
||||
|
this.toGuidePage(); |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
toGuidePage: function () { |
||||
|
wx.reLaunch({ |
||||
|
url: "/pages/guide/guide", |
||||
|
}); |
||||
|
}, |
||||
|
toGuidePageAfterHint: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
return __generator(this, function (_a) { |
||||
|
switch (_a.label) { |
||||
|
case 0: |
||||
|
wx.showToast({ |
||||
|
title: "登录已失效", |
||||
|
icon: "none", |
||||
|
duration: 2000, |
||||
|
}); |
||||
|
return [4, tools_1.nextTick(1500)]; |
||||
|
case 1: |
||||
|
_a.sent(); |
||||
|
this.toGuidePage(); |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
loginbytoken: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var _a, msg, data; |
||||
|
return __generator(this, function (_b) { |
||||
|
switch (_b.label) { |
||||
|
case 0: return [4, promise_wx_api_1.wxRequestPost("auth/thirdlogin/tonewtoken", {}, { |
||||
|
isQuiet: false, |
||||
|
})]; |
||||
|
case 1: |
||||
|
_a = _b.sent(), msg = _a.msg, data = _a.data.data; |
||||
|
if (msg != "success" || data.code !== 0 || !data.data || !data.data.token) { |
||||
|
console.log("换取token失败", msg); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
else { |
||||
|
console.log("换取token成功", data.data.token); |
||||
|
this.setAccountInfo({ token: data.data.token }); |
||||
|
return [2, true]; |
||||
|
} |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
loginbywxcode: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var retWxLogin, extAppid, url, _a, msg, data; |
||||
|
return __generator(this, function (_b) { |
||||
|
switch (_b.label) { |
||||
|
case 0: return [4, promise_wx_api_1.wxLogin({})]; |
||||
|
case 1: |
||||
|
retWxLogin = _b.sent(); |
||||
|
console.log(retWxLogin); |
||||
|
if (retWxLogin.msg != "success") { |
||||
|
console.log("获取微信code失败:", retWxLogin); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
extAppid = wx.getStorageSync("extAppid"); |
||||
|
url = extAppid |
||||
|
? "auth/thirdlogin/resilogin" |
||||
|
: "auth/login/resiwxmp/loginbywxcode"; |
||||
|
return [4, promise_wx_api_1.wxRequestPost(url, { |
||||
|
wxCode: retWxLogin.data.code, |
||||
|
app: "resi", |
||||
|
client: "wxmp", |
||||
|
encryptedData: "", |
||||
|
iv: "", |
||||
|
appId: extAppid, |
||||
|
}, { |
||||
|
hasToken: false, |
||||
|
isQuiet: false, |
||||
|
})]; |
||||
|
case 2: |
||||
|
_a = _b.sent(), msg = _a.msg, data = _a.data.data; |
||||
|
if (msg != "success" || data.code !== 0) { |
||||
|
console.log("登录失败", msg); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
else { |
||||
|
console.log("登录成功", data.data.token); |
||||
|
this.setAccountInfo({ token: data.data.token }); |
||||
|
return [2, true]; |
||||
|
} |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
loginGetToken: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var isPhoneAccount; |
||||
|
return __generator(this, function (_a) { |
||||
|
switch (_a.label) { |
||||
|
case 0: |
||||
|
isPhoneAccount = this.globalData.isPhoneAccount; |
||||
|
if (!isPhoneAccount) return [3, 2]; |
||||
|
return [4, this.loginbytoken()]; |
||||
|
case 1: |
||||
|
if (!(_a.sent())) { |
||||
|
this.toGuidePageAfterHint(); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
else { |
||||
|
return [2, true]; |
||||
|
} |
||||
|
return [3, 4]; |
||||
|
case 2: return [4, this.loginbywxcode()]; |
||||
|
case 3: return [2, _a.sent()]; |
||||
|
case 4: return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
getLatestGridData: function (noSkip) { |
||||
|
if (noSkip === void 0) { noSkip = false; } |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var extAppid, url, _a, msg, data; |
||||
|
return __generator(this, function (_b) { |
||||
|
|
||||
|
switch (_b.label) { |
||||
|
case 0: |
||||
|
extAppid = wx.getStorageSync("extAppid"); |
||||
|
url = extAppid |
||||
|
? "resi/mine/mygrid/latestgridinfo" |
||||
|
: "resi/mine/mygrid/getlatestgridinfo"; |
||||
|
return [4, promise_wx_api_1.wxRequestGet(url, { appId: extAppid }, { |
||||
|
isQuiet: false, |
||||
|
})]; |
||||
|
case 1: |
||||
|
_a = _b.sent(), msg = _a.msg, data = _a.data.data; |
||||
|
if (msg != "success") { |
||||
|
console.log(msg); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
else { |
||||
|
if (data.code === 0) { |
||||
|
|
||||
|
if (data.data && data.data.gridId) { |
||||
|
this.globalData.gridId = data.data.gridId; |
||||
|
this.globalData.customerId = data.data.customerId; |
||||
|
return [2, true]; |
||||
|
} |
||||
|
else { |
||||
|
if (!noSkip) { |
||||
|
console.log("找不到最近访问网格"); |
||||
|
this.toGuidePage(); |
||||
|
} |
||||
|
return [2, false]; |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
return [2, false]; |
||||
|
} |
||||
|
} |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
enterGridData: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var _a, customerId, gridId, _b, msg, data; |
||||
|
return __generator(this, function (_c) { |
||||
|
switch (_c.label) { |
||||
|
case 0: |
||||
|
_a = this.globalData, customerId = _a.customerId, gridId = _a.gridId; |
||||
|
return [4, promise_wx_api_1.wxRequestPost("resi/guide/user/entergrid", { |
||||
|
customerId: customerId, |
||||
|
gridId: gridId, |
||||
|
}, { |
||||
|
isQuiet: false, |
||||
|
})]; |
||||
|
case 1: |
||||
|
_b = _c.sent(), msg = _b.msg, data = _b.data.data; |
||||
|
if (msg != "success") { |
||||
|
console.log(msg); |
||||
|
return [2, false]; |
||||
|
} |
||||
|
else { |
||||
|
if (data.code === 0) { |
||||
|
wx.setStorageSync("userRoleList", data.data.userRoleList); |
||||
|
wx.setStorageSync("gridName", data.data.currentGridName); |
||||
|
this.globalData.agencyId = data.data.agencyId; |
||||
|
this.globalData.userRoleList = data.data.userRoleList; |
||||
|
this.globalData.currentGridName = data.data.currentGridName; |
||||
|
this.globalData.orgInfo.orgId = data.data.orgId; |
||||
|
this.globalData.orgInfo.orgName = data.data.orgName; |
||||
|
this.globalData.orgInfo.orgType = data.data.orgType; |
||||
|
this.globalData.userInfo.realName = data.data.realName; |
||||
|
this.globalData.userInfo.nickname = data.data.nickname; |
||||
|
this.globalData.userInfo.userStreetName = |
||||
|
data.data.userStreetName || ""; |
||||
|
this.globalData.userInfo.userStreetTrueName = |
||||
|
data.data.userStreetTrueName || ""; |
||||
|
this.globalData.userInfo.userHeadPhoto = data.data.userHeadPhoto; |
||||
|
this.globalData.latitude = parseFloat(data.data.latitude); |
||||
|
this.globalData.longitude = parseFloat(data.data.longitude); |
||||
|
console.log("加入网格成功。", data.data); |
||||
|
return [2, true]; |
||||
|
} |
||||
|
else { |
||||
|
return [2, false]; |
||||
|
} |
||||
|
} |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
switchGrid: function (customerId, gridId) { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
return __generator(this, function (_a) { |
||||
|
switch (_a.label) { |
||||
|
case 0: |
||||
|
this.globalData.customerId = customerId; |
||||
|
this.globalData.gridId = gridId; |
||||
|
return [4, this.enterGridData()]; |
||||
|
case 1: |
||||
|
_a.sent(); |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
login: function () { |
||||
|
return __awaiter(this, void 0, void 0, function () { |
||||
|
var pages, route, _a, _b; |
||||
|
return __generator(this, function (_c) { |
||||
|
switch (_c.label) { |
||||
|
case 0: |
||||
|
if (this.globalData.landing) |
||||
|
return [2, 0]; |
||||
|
pages = getCurrentPages(); |
||||
|
console.log("当前页面", pages); |
||||
|
if (pages.length > 0) { |
||||
|
route = pages[pages.length - 1].route; |
||||
|
if (route == "pages/guide/guide" || |
||||
|
route == "pages/guide/novice/index" || |
||||
|
route == "pages/guide/chooseGrid/chooseGrid") |
||||
|
return [2, 0]; |
||||
|
} |
||||
|
this.globalData.landing = true; |
||||
|
if (!this.globalData.isLogined) { |
||||
|
this.toGuidePage(); |
||||
|
return [2, 0]; |
||||
|
} |
||||
|
return [4, this.loginGetToken()]; |
||||
|
case 1: |
||||
|
_b = (_c.sent()); |
||||
|
if (!_b) return [3, 3]; |
||||
|
return [4, this.getLatestGridData()]; |
||||
|
case 2: |
||||
|
_b = (_c.sent()); |
||||
|
_c.label = 3; |
||||
|
case 3: |
||||
|
_a = _b; |
||||
|
if (!_a) return [3, 5]; |
||||
|
return [4, this.enterGridData()]; |
||||
|
case 4: |
||||
|
_a = (_c.sent()); |
||||
|
_c.label = 5; |
||||
|
case 5: |
||||
|
if (_a) { |
||||
|
this.globalData.landing = false; |
||||
|
return [2, 1]; |
||||
|
} |
||||
|
else { |
||||
|
this.globalData.landing = false; |
||||
|
return [2, 0]; |
||||
|
} |
||||
|
return [2]; |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
switchTab: function (tab) { |
||||
|
var pages = getCurrentPages(); |
||||
|
var mainPageIndex = pages.findIndex(function (item) { return item.route == "pages/main/index"; }); |
||||
|
if (mainPageIndex !== -1) { |
||||
|
var mainPageItem = pages.find(function (item) { return item.route == "pages/main/index"; }); |
||||
|
mainPageItem.switchTab(tab); |
||||
|
wx.navigateBack({ |
||||
|
delta: pages.length - mainPageIndex - 1, |
||||
|
}); |
||||
|
} |
||||
|
else { |
||||
|
wx.reLaunch({ url: "/pages/main/index?tab=" + tab }); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
@ -0,0 +1,237 @@ |
|||||
|
{ |
||||
|
"pages": [ |
||||
|
"pages/main/index", |
||||
|
"pages/mine/index", |
||||
|
"pages/guide/guide", |
||||
|
"pages/guide/novice/index", |
||||
|
"pages/discussion/discussion", |
||||
|
"pages/discussion/detail/index", |
||||
|
"pages/discussion/detail/tag/index", |
||||
|
"pages/guide/chooseGrid/chooseGrid", |
||||
|
"pages/guide/changeGrid/changeGrid", |
||||
|
"pages/group/group/newGroup/newGroup", |
||||
|
"pages/group/group/newGroup/edit-avatar/index", |
||||
|
"pages/group/group/invitation/invitation", |
||||
|
"pages/group/topic/newTopic/newTopic", |
||||
|
"pages/group/topic/topicDetail/topicDetail", |
||||
|
"pages/group/group/invitation/expired/expired", |
||||
|
"pages/heartNew/heartNew", |
||||
|
"pages/common/qrcode/index", |
||||
|
"pages/common/in-dev/index", |
||||
|
"pages/index/webview", |
||||
|
"pages/index/subscribe" |
||||
|
], |
||||
|
"subpackages": [ |
||||
|
{ |
||||
|
"root": "subpages/index", |
||||
|
"name": "index", |
||||
|
"pages": [ |
||||
|
"pages/questionnaire/index", |
||||
|
"pages/party-center/index", |
||||
|
"pages/party-center/info/index", |
||||
|
"pages/party-center/order/index", |
||||
|
"pages/questionnaire/detail/index", |
||||
|
"pages/voice/index", |
||||
|
"pages/voice/special/index", |
||||
|
"pages/voice/detail", |
||||
|
"pages/report/create", |
||||
|
"pages/report/detail/index", |
||||
|
"pages/report/myReport/index", |
||||
|
"pages/report/npcReport/index", |
||||
|
"pages/workguide/index", |
||||
|
"pages/workguide/detail", |
||||
|
"pages/workguide/collect", |
||||
|
"pages/workguide/link", |
||||
|
"pages/suishoupai/create", |
||||
|
"pages/suishijiang/create" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/discussion", |
||||
|
"name": "discussion", |
||||
|
"pages": [ |
||||
|
"pages/rate/index", |
||||
|
"pages/idea/create/index" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/group", |
||||
|
"name": "group", |
||||
|
"pages": [ |
||||
|
"pages/group/myGroup/myGroup", |
||||
|
"pages/group/myGroup/branch/index", |
||||
|
"pages/group/groupInfos/groupInfos", |
||||
|
"pages/group/groupManage/groupManage", |
||||
|
"pages/group/groupMembers/groupMembers", |
||||
|
"pages/group/editGroup/editGroup", |
||||
|
"pages/group/checkMembers/checkMembers", |
||||
|
"pages/topic/topicHistory/topicHistory", |
||||
|
"pages/topic/history/index", |
||||
|
"pages/topic/unreadList/index", |
||||
|
"pages/topic/topicIndex/topicIndex", |
||||
|
"pages/topic/topicManage/topicManage", |
||||
|
"pages/topic/topicToDiscussion/index", |
||||
|
"pages/issue/index", |
||||
|
"pages/issue/auditting/index", |
||||
|
"pages/issue/auditting/info/index", |
||||
|
"pages/topic/subjectPreview/index", |
||||
|
"pages/topic/auditting/index", |
||||
|
"pages/topic/auditting/topicDetail", |
||||
|
"pages/poster/index", |
||||
|
"pages/management/index", |
||||
|
"pages/management/transferGroup", |
||||
|
"pages/group/notice/create", |
||||
|
"pages/group/notice/detail", |
||||
|
"pages/group/activity/map/index", |
||||
|
"pages/group/activity/create", |
||||
|
"pages/group/activity/detail", |
||||
|
"pages/group/activity/summary", |
||||
|
"pages/group/activity/signinRecord", |
||||
|
"pages/group/activity/qrcode", |
||||
|
"pages/group/integral/integral", |
||||
|
"pages/topic/topicMap/topicMap" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/heart", |
||||
|
"pages": [ |
||||
|
"pages/heartDetail/heartDetail", |
||||
|
"pages/leaderboard/leaderboard", |
||||
|
"pages/leaderboardNew/leaderboardNew", |
||||
|
"pages/myNews/myNews", |
||||
|
"pages/clockIn/clockIn", |
||||
|
"pages/volunteer/volunteer", |
||||
|
"pages/signed/signed", |
||||
|
"pages/refusedOrEndedDetail/refusedOrEndedDetail" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/points", |
||||
|
"name": "points", |
||||
|
"pages": [ |
||||
|
"pages/top/party/index", |
||||
|
"pages/fangyi/index", |
||||
|
"pages/fangyi/xingcheng/create/index", |
||||
|
"pages/fangyi/xingcheng/record/index", |
||||
|
"pages/fangyi/xingchengPanshi/create/index", |
||||
|
"pages/fangyi/xingchengPanshi/record/index", |
||||
|
"pages/fangyi/hesuan/create/index", |
||||
|
"pages/fangyi/hesuan/record/index", |
||||
|
"pages/fangyi/xinxi/create/index", |
||||
|
"pages/fangyi/xinxi/create/list", |
||||
|
"pages/fangyi/xinxi/create/visitor", |
||||
|
"pages/fangyi/xinxi/create/detail", |
||||
|
"pages/fangyi/xinxi/create/visitorDetail", |
||||
|
"pages/points/index", |
||||
|
"pages/points/qrcode", |
||||
|
"pages/points/success", |
||||
|
"pages/demand/index", |
||||
|
"pages/demand/detail", |
||||
|
"pages/demand/list", |
||||
|
"pages/demand/crate", |
||||
|
"pages/demand/finish", |
||||
|
"pages/moral/index", |
||||
|
"pages/moral/apply" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/mine", |
||||
|
"name": "mine", |
||||
|
"pages": [ |
||||
|
"pages/register/resident/index", |
||||
|
"pages/register/communist/index", |
||||
|
"pages/register/activist/index", |
||||
|
"pages/register/edit-base/index", |
||||
|
"pages/register/cover/index", |
||||
|
"pages/message/index/index", |
||||
|
"pages/message/info/index", |
||||
|
"pages/message/fangyi-info/index", |
||||
|
"pages/mine/index", |
||||
|
"pages/safe/index", |
||||
|
"pages/safe/phone/index", |
||||
|
"pages/badge/index", |
||||
|
"pages/badge/apply/index", |
||||
|
"pages/suggest/index", |
||||
|
"pages/suggest/record/index", |
||||
|
"pages/works/project-part/index", |
||||
|
"pages/works/topic-part/start-topic/index", |
||||
|
"pages/works/topic-part/part-topic/index", |
||||
|
"pages/works/issue-part/start-issue/index", |
||||
|
"pages/works/issue-part/part-issue/index", |
||||
|
"pages/message/skip", |
||||
|
"pages/agency/index", |
||||
|
"pages/task/task", |
||||
|
"pages/myReportEvent/index", |
||||
|
"pages/myReportEvent/detail/index", |
||||
|
"pages/family/index", |
||||
|
"pages/family/register", |
||||
|
"pages/family/familyInfo/index", |
||||
|
"pages/family/emigration", |
||||
|
"pages/family/accept" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/event", |
||||
|
"name": "event", |
||||
|
"pages": [ |
||||
|
"pages/gridmember/gridmember", |
||||
|
"pages/shzz/index", |
||||
|
"pages/shzz/info/index" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/epidemicmap", |
||||
|
"name": "epidemicmap", |
||||
|
"pages": [ |
||||
|
"pages/index/index" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/xiaoqumap", |
||||
|
"name": "xiaoqumap", |
||||
|
"pages": [ |
||||
|
"pages/index/index" |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
"root": "subpages/partyHelper", |
||||
|
"name": "partyHelper", |
||||
|
"pages": [ |
||||
|
"pages/index/index", |
||||
|
"pages/elegant/index", |
||||
|
"pages/elegant/detail", |
||||
|
"pages/partyAct/index", |
||||
|
"pages/partyAct/detail", |
||||
|
"pages/score/index" |
||||
|
] |
||||
|
} |
||||
|
], |
||||
|
"window": { |
||||
|
"backgroundColor": "#f7f7f7", |
||||
|
"backgroundTextStyle": "light", |
||||
|
"navigationBarBackgroundColor": "#fff", |
||||
|
"navigationBarTitleText": "", |
||||
|
"navigationBarTextStyle": "black" |
||||
|
}, |
||||
|
"usingComponents": { |
||||
|
"request-msg": "./components/requestMsg/index" |
||||
|
}, |
||||
|
"style": "v2", |
||||
|
"networkTimeout": { |
||||
|
"request": 60000 |
||||
|
}, |
||||
|
"permission": { |
||||
|
"scope.userLocation": { |
||||
|
"desc": "将获取您的位置信息" |
||||
|
} |
||||
|
}, |
||||
|
"requiredBackgroundModes": [ |
||||
|
"location" |
||||
|
], |
||||
|
"requiredPrivateInfos": [ |
||||
|
"getLocation", |
||||
|
"onLocationChange", |
||||
|
"chooseLocation" |
||||
|
], |
||||
|
"sitemapLocation": "sitemap.json" |
||||
|
} |
||||
@ -0,0 +1,487 @@ |
|||||
|
import { wxLogin, wxRequestGet, wxRequestPost } from "./utils/promise-wx-api"; |
||||
|
import { doAfterLogin, nextTick } from "./utils/tools"; |
||||
|
import { apiUrl } from "@config/config"; |
||||
|
|
||||
|
App<IAppOption>({ |
||||
|
globalData: { |
||||
|
// 小程序初始化启动时间
|
||||
|
appLaunchTime: "", |
||||
|
|
||||
|
previewImage: false, |
||||
|
|
||||
|
landing: false, // 是否微信登陆中
|
||||
|
|
||||
|
extAppid: "", // 第三方APPID
|
||||
|
|
||||
|
token: "", |
||||
|
// 是否新手体验区环境
|
||||
|
isNoviceEnv: false, |
||||
|
// 是否手机号登录
|
||||
|
isPhoneAccount: false, |
||||
|
// 是否已经登录并选择网格啦
|
||||
|
isLogined: false, |
||||
|
|
||||
|
customerId: "", |
||||
|
gridId: "", |
||||
|
agencyId: "", |
||||
|
|
||||
|
// 调查问卷详情传参用
|
||||
|
orgInfo: { |
||||
|
orgId: "", |
||||
|
orgName: "", |
||||
|
orgType: "", |
||||
|
}, |
||||
|
|
||||
|
// 组织或网格的经纬度
|
||||
|
latitude: 0, |
||||
|
longitude: 0, |
||||
|
|
||||
|
userRoleList: [], |
||||
|
currentGridName: "", |
||||
|
userInfo: { |
||||
|
userStreetTrueName: "", |
||||
|
userStreetName: "", |
||||
|
realName: "", |
||||
|
nickname: "", |
||||
|
userHeadPhoto: "", |
||||
|
}, |
||||
|
userPhone: "", |
||||
|
pageCustomerData: {}, |
||||
|
customOptions: {}, |
||||
|
tempData: { |
||||
|
subjectTitle: "", |
||||
|
subjectSuggest: "", |
||||
|
invitationId: "", |
||||
|
}, |
||||
|
|
||||
|
isHintedFillIdNum: false, |
||||
|
}, |
||||
|
|
||||
|
async onLaunch() { |
||||
|
setTimeout(() => { |
||||
|
// this.loadFontFace();
|
||||
|
}, 100); |
||||
|
this.globalData.appLaunchTime = new Date().getTime(); |
||||
|
|
||||
|
let menuButtonObject = wx.getMenuButtonBoundingClientRect(); |
||||
|
wx.getSystemInfo({ |
||||
|
success: (res) => { |
||||
|
//导航高度
|
||||
|
let statusBarHeight = res.statusBarHeight, |
||||
|
navTop = menuButtonObject.top, |
||||
|
navHeight = |
||||
|
statusBarHeight + |
||||
|
menuButtonObject.height + |
||||
|
(menuButtonObject.top - statusBarHeight) * 2; |
||||
|
this.globalData.navHeight = navHeight; |
||||
|
this.globalData.statusHeight = statusBarHeight; |
||||
|
this.globalData.navTop = navTop; |
||||
|
this.globalData.windowHeight = res.windowHeight; |
||||
|
}, |
||||
|
fail(err) { |
||||
|
console.log(err); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; |
||||
|
console.log("extConfig", extConfig); |
||||
|
this.globalData.extAppid = extConfig.extAppid; |
||||
|
wx.setStorageSync("extAppid", extConfig.extAppid); |
||||
|
|
||||
|
this.syncLocalAccountInfo(); |
||||
|
}, |
||||
|
|
||||
|
loadFontFace() { |
||||
|
wx.loadFontFace({ |
||||
|
global: true, |
||||
|
family: "Source Han Serif SC", |
||||
|
scopes: ["webview", "native"], |
||||
|
source: |
||||
|
'url("' + |
||||
|
apiUrl.slice(0, -4) + |
||||
|
'fonts/syst/SourceHanSerifSC-Regular.otf")', |
||||
|
success(res) { |
||||
|
console.log( |
||||
|
" 字体加载------------------------------------------res ", |
||||
|
res |
||||
|
); |
||||
|
}, |
||||
|
fail(err) { |
||||
|
console.log( |
||||
|
" 字体加载------------------------------------------err ", |
||||
|
err |
||||
|
); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
wx.loadFontFace({ |
||||
|
global: true, |
||||
|
family: "Source Han Serif SC", |
||||
|
scopes: ["webview", "native"], |
||||
|
desc: { |
||||
|
weight: "bold", |
||||
|
}, |
||||
|
source: |
||||
|
'url("' + |
||||
|
apiUrl.slice(0, -4) + |
||||
|
'/fonts/syst/SourceHanSerifCN-Bold.otf")', |
||||
|
success(res) { |
||||
|
console.log(" 重体---------------------res ", res); |
||||
|
}, |
||||
|
fail(err) { |
||||
|
console.log(" 重体---------------------err ", err); |
||||
|
}, |
||||
|
}); |
||||
|
// wx.loadFontFace({
|
||||
|
// global: true,
|
||||
|
// family: "Source Han Serif SC",
|
||||
|
// desc: {
|
||||
|
// weight: "800",
|
||||
|
// },
|
||||
|
// source:
|
||||
|
// 'url("' +
|
||||
|
// apiUrl.slice(0, -4) +
|
||||
|
// '/fonts/syst/SourceHanSerifCN-Bold.otf")',
|
||||
|
// success(res) {
|
||||
|
// console.log(" 重体---------------------res ", res);
|
||||
|
// },
|
||||
|
// fail(err) {
|
||||
|
// console.log(" 重体---------------------err ", err);
|
||||
|
// },
|
||||
|
// });
|
||||
|
// wx.loadFontFace({
|
||||
|
// global: true,
|
||||
|
// family: "Source Han Serif SC",
|
||||
|
// desc: {
|
||||
|
// weight: "900",
|
||||
|
// },
|
||||
|
// source:
|
||||
|
// 'url("' +
|
||||
|
// apiUrl.slice(0, -4) +
|
||||
|
// '/fonts/syst/SourceHanSerifCN-Bold.otf")',
|
||||
|
// success(res) {
|
||||
|
// console.log(" 重体---------------------res ", res);
|
||||
|
// },
|
||||
|
// fail(err) {
|
||||
|
// console.log(" 重体---------------------err ", err);
|
||||
|
// },
|
||||
|
// });
|
||||
|
}, |
||||
|
|
||||
|
// 异步函数:登陆后再操作
|
||||
|
doAfterLogin, |
||||
|
|
||||
|
// 从本地数据库同步账户信息
|
||||
|
syncLocalAccountInfo() { |
||||
|
this.globalData.isLogined = |
||||
|
wx.getStorageSync("isLogined") === false ? false : true; |
||||
|
if (this.globalData.isLogined) { |
||||
|
this.globalData.isNoviceEnv = wx.getStorageSync("isNoviceEnv") || false; |
||||
|
this.globalData.isPhoneAccount = |
||||
|
wx.getStorageSync("isPhoneAccount") || false; |
||||
|
if (this.globalData.isPhoneAccount) { |
||||
|
this.globalData.token = wx.getStorageSync("token") || ""; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return this.globalData.isLogined; |
||||
|
}, |
||||
|
// 设置账户信息 并保存本地
|
||||
|
setAccountInfo(obj = {}) { |
||||
|
Object.keys(obj).forEach((k) => { |
||||
|
this.globalData[k] = obj[k]; |
||||
|
wx.setStorageSync(k, obj[k]); |
||||
|
}); |
||||
|
}, |
||||
|
// 后端记录退出操作
|
||||
|
async logoutRecord() { |
||||
|
const { |
||||
|
msg, |
||||
|
data: { data }, |
||||
|
} = await wxRequestPost( |
||||
|
"auth/thirdlogin/delresitoken", |
||||
|
{}, |
||||
|
{ |
||||
|
isQuiet: true, |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
if (msg != "success" || data.code !== 0) { |
||||
|
console.log("退出失败"); |
||||
|
return false; |
||||
|
} else { |
||||
|
console.log("退出成功"); |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
// 退出登录
|
||||
|
async logout() { |
||||
|
this.setAccountInfo({ |
||||
|
token: "", |
||||
|
isNoviceEnv: false, |
||||
|
isPhoneAccount: false, |
||||
|
isLogined: false, |
||||
|
}); |
||||
|
|
||||
|
this.logoutRecord(); |
||||
|
|
||||
|
wx.showToast({ |
||||
|
title: "退出成功", |
||||
|
icon: "none", |
||||
|
duration: 2000, |
||||
|
}); |
||||
|
await nextTick(1500); |
||||
|
|
||||
|
this.toGuidePage(); |
||||
|
}, |
||||
|
|
||||
|
toGuidePage() { |
||||
|
wx.reLaunch({ |
||||
|
url: "/pages/guide/guide", |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async toGuidePageAfterHint() { |
||||
|
wx.showToast({ |
||||
|
title: "登录已失效", |
||||
|
icon: "none", |
||||
|
duration: 2000, |
||||
|
}); |
||||
|
await nextTick(1500); |
||||
|
|
||||
|
this.toGuidePage(); |
||||
|
}, |
||||
|
|
||||
|
// 手机账户下 token换取token
|
||||
|
async loginbytoken() { |
||||
|
const { |
||||
|
msg, |
||||
|
data: { data }, |
||||
|
} = await wxRequestPost( |
||||
|
"auth/thirdlogin/tonewtoken", |
||||
|
{}, |
||||
|
{ |
||||
|
isQuiet: false, |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
if (msg != "success" || data.code !== 0 || !data.data || !data.data.token) { |
||||
|
console.log("换取token失败", msg); |
||||
|
return false; |
||||
|
} else { |
||||
|
console.log("换取token成功", data.data.token); |
||||
|
this.setAccountInfo({ token: data.data.token }); |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 微信code获取token
|
||||
|
async loginbywxcode() { |
||||
|
const retWxLogin = await wxLogin({}); |
||||
|
console.log(retWxLogin); |
||||
|
if (retWxLogin.msg != "success") { |
||||
|
console.log("获取微信code失败:", retWxLogin); |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
const extAppid = wx.getStorageSync("extAppid"); |
||||
|
const url = extAppid |
||||
|
? "auth/thirdlogin/resilogin" |
||||
|
: "auth/login/resiwxmp/loginbywxcode"; |
||||
|
const { |
||||
|
msg, |
||||
|
data: { data }, |
||||
|
} = await wxRequestPost( |
||||
|
url, |
||||
|
{ |
||||
|
wxCode: retWxLogin.data.code, |
||||
|
app: "resi", |
||||
|
client: "wxmp", |
||||
|
encryptedData: "", |
||||
|
iv: "", |
||||
|
appId: extAppid, |
||||
|
}, |
||||
|
{ |
||||
|
hasToken: false, |
||||
|
isQuiet: false, |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
if (msg != "success" || data.code !== 0) { |
||||
|
console.log("登录失败", msg); |
||||
|
return false; |
||||
|
} else { |
||||
|
console.log("登录成功", data.data.token); |
||||
|
this.setAccountInfo({ token: data.data.token }); |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 获取token
|
||||
|
async loginGetToken() { |
||||
|
// 手机账户要做单独处理
|
||||
|
const { isPhoneAccount } = this.globalData; |
||||
|
|
||||
|
if (isPhoneAccount) { |
||||
|
if (!(await this.loginbytoken())) { |
||||
|
this.toGuidePageAfterHint(); |
||||
|
return false; |
||||
|
} else { |
||||
|
return true; |
||||
|
} |
||||
|
} else { |
||||
|
return await this.loginbywxcode(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 获取最近的网格
|
||||
|
async getLatestGridData(noSkip = false) { |
||||
|
const extAppid = wx.getStorageSync("extAppid"); |
||||
|
const url = extAppid |
||||
|
? "resi/mine/mygrid/latestgridinfo" |
||||
|
: "resi/mine/mygrid/getlatestgridinfo"; |
||||
|
const { |
||||
|
msg, |
||||
|
data: { data }, |
||||
|
} = await wxRequestGet( |
||||
|
url, |
||||
|
{ appId: extAppid }, |
||||
|
{ |
||||
|
isQuiet: false, |
||||
|
} |
||||
|
); |
||||
|
|
||||
|
if (msg != "success") { |
||||
|
console.log(msg); |
||||
|
return false; |
||||
|
} else { |
||||
|
if (data.code === 0) { |
||||
|
if (data.data && data.data.gridId) { |
||||
|
this.globalData.gridId = data.data.gridId; |
||||
|
this.globalData.customerId = data.data.customerId; |
||||
|
return true; |
||||
|
} else { |
||||
|
if (!noSkip) { |
||||
|
console.log("找不到最近访问网格"); |
||||
|
this.toGuidePage(); |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
} else { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 加入网格初始化
|
||||
|
async enterGridData() { |
||||
|
const { customerId, gridId } = this.globalData; |
||||
|
const { |
||||
|
msg, |
||||
|
data: { data }, |
||||
|
} = await wxRequestPost( |
||||
|
"resi/guide/user/entergrid", |
||||
|
{ |
||||
|
customerId, |
||||
|
gridId, |
||||
|
}, |
||||
|
{ |
||||
|
isQuiet: false, |
||||
|
} |
||||
|
); |
||||
|
if (msg != "success") { |
||||
|
console.log(msg); |
||||
|
return false; |
||||
|
} else { |
||||
|
if (data.code === 0) { |
||||
|
wx.setStorageSync("userRoleList", data.data.userRoleList); |
||||
|
wx.setStorageSync("gridName", data.data.currentGridName); |
||||
|
|
||||
|
this.globalData.agencyId = data.data.agencyId; |
||||
|
|
||||
|
this.globalData.userRoleList = data.data.userRoleList; |
||||
|
this.globalData.currentGridName = data.data.currentGridName; |
||||
|
this.globalData.orgInfo.orgId = data.data.orgId; |
||||
|
this.globalData.orgInfo.orgName = data.data.orgName; |
||||
|
this.globalData.orgInfo.orgType = data.data.orgType; |
||||
|
this.globalData.userInfo.realName = data.data.realName; |
||||
|
this.globalData.userInfo.nickname = data.data.nickname; |
||||
|
this.globalData.userInfo.userStreetName = |
||||
|
data.data.userStreetName || ""; |
||||
|
this.globalData.userInfo.userStreetTrueName = |
||||
|
data.data.userStreetTrueName || ""; |
||||
|
this.globalData.userInfo.userHeadPhoto = data.data.userHeadPhoto; |
||||
|
this.globalData.latitude = parseFloat(data.data.latitude); |
||||
|
this.globalData.longitude = parseFloat(data.data.longitude); |
||||
|
|
||||
|
console.log("加入网格成功。", data.data); |
||||
|
return true; |
||||
|
} else { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 切换所在网格
|
||||
|
async switchGrid(customerId, gridId) { |
||||
|
this.globalData.customerId = customerId; |
||||
|
this.globalData.gridId = gridId; |
||||
|
await this.enterGridData(); |
||||
|
}, |
||||
|
|
||||
|
// 登陆
|
||||
|
async login() { |
||||
|
if (this.globalData.landing) return 0; |
||||
|
|
||||
|
const pages = getCurrentPages(); |
||||
|
console.log("当前页面", pages); |
||||
|
if (pages.length > 0) { |
||||
|
const { route } = pages[pages.length - 1]; |
||||
|
if ( |
||||
|
route == "pages/guide/guide" || |
||||
|
route == "pages/guide/novice/index" || |
||||
|
route == "pages/guide/chooseGrid/chooseGrid" |
||||
|
) |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
this.globalData.landing = true; |
||||
|
|
||||
|
// 是否第一次打开小程序或退出过
|
||||
|
if (!this.globalData.isLogined) { |
||||
|
this.toGuidePage(); |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
// 获取网格、个人信息
|
||||
|
if ( |
||||
|
(await this.loginGetToken()) && |
||||
|
(await this.getLatestGridData()) && |
||||
|
(await this.enterGridData()) |
||||
|
) { |
||||
|
this.globalData.landing = false; |
||||
|
return 1; |
||||
|
} else { |
||||
|
this.globalData.landing = false; |
||||
|
return 0; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 前往切换标签页面
|
||||
|
switchTab(tab) { |
||||
|
const pages = getCurrentPages(); |
||||
|
|
||||
|
const mainPageIndex = pages.findIndex( |
||||
|
(item) => item.route == "pages/main/index" |
||||
|
); |
||||
|
if (mainPageIndex !== -1) { |
||||
|
let mainPageItem = pages.find((item) => item.route == "pages/main/index"); |
||||
|
mainPageItem.switchTab(tab); |
||||
|
wx.navigateBack({ |
||||
|
delta: pages.length - mainPageIndex - 1, |
||||
|
}); |
||||
|
} else { |
||||
|
wx.reLaunch({ url: `/pages/main/index?tab=${tab}` }); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
@ -0,0 +1,44 @@ |
|||||
|
@import '/assets/wxss/global.wxss'; |
||||
|
|
||||
|
|
||||
|
.container { |
||||
|
height: 100%; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
padding: 0; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
page { |
||||
|
box-sizing: border-box; |
||||
|
color: #333; |
||||
|
-webkit-font-smoothing: antialiased; |
||||
|
} |
||||
|
.wux-tabs { |
||||
|
width: 500rpx !important; |
||||
|
color: #999 !important; |
||||
|
font-size: 28rpx !important; |
||||
|
} |
||||
|
.wux-tabs__tab--current .wux-tabs__tab-title { |
||||
|
color: #e60000 !important; |
||||
|
font-size: 32rpx !important; |
||||
|
} |
||||
|
.wux-tabs__tab--current .wux-tabs__tab-bar { |
||||
|
height: 8rpx !important; |
||||
|
background: #e60000 !important; |
||||
|
} |
||||
|
|
||||
|
radio .wx-radio-input { |
||||
|
height: 20rpx; |
||||
|
width: 20rpx; |
||||
|
} |
||||
|
|
||||
|
radio .wx-radio-input.wx-radio-input-checked::before { |
||||
|
background: #e60000; |
||||
|
border-radius: 50%; |
||||
|
-webkit-border-radius: 50%; |
||||
|
-moz-border-radius: 50%; |
||||
|
-ms-border-radius: 50%; |
||||
|
-o-border-radius: 50%; |
||||
|
} |
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 952 B |
|
After Width: | Height: | Size: 405 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 469 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 395 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 476 B |
|
After Width: | Height: | Size: 515 B |
|
After Width: | Height: | Size: 425 B |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 716 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 499 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 800 B |
|
After Width: | Height: | Size: 587 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 506 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 440 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 983 B |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 971 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 190 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 481 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 398 B |
|
After Width: | Height: | Size: 857 B |
|
After Width: | Height: | Size: 758 B |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 592 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 1006 B |
|
After Width: | Height: | Size: 430 B |
|
After Width: | Height: | Size: 992 B |
|
After Width: | Height: | Size: 671 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 643 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 527 B |
|
After Width: | Height: | Size: 374 B |
|
After Width: | Height: | Size: 552 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 649 B |
|
After Width: | Height: | Size: 621 B |
|
After Width: | Height: | Size: 664 B |