修复绑定input值

This commit is contained in:
itgaojian 2023-07-15 14:44:36 +08:00
parent 609f748248
commit 7fe51944d0
3 changed files with 406 additions and 396 deletions

View File

@ -42,7 +42,7 @@
"pages/mine/myCardDetail/myCardDetail",
"pages/mine/otherCard/othercarddetail",
"pages/columnlist/columnlist",
"pages/serve/serviceDetail"
"pages/serve/serviceDetail"
],
"window": {
"backgroundTextStyle": "light",
@ -96,7 +96,7 @@
"sharePage/cardcode",
"common/corpperimg/cropperimg"
]
}]
}],
"requiredPrivateInfos": ["chooseLocation","getLocation"]
}

View File

@ -1,396 +1,406 @@
var a = getApp(), r = require("../../utils/md5.js");
Page({
data: {
token: a.globalData.token,
sourceUrl: a.baseUrls.sourceUrl,
userIcon: "",
userName: "",
curCommunityName: "",
gridList: [],
serviceUrl: a.baseUrls.serviceUrl,
baseImgUrl: a.baseUrls.baseImgUrl,
userNameText: "",
userPassword: "",
showAuthentication: !1,
isLoading: !1,
menuList: [],
imgUrl: a.baseUrls.baseCardUrl,
isShow: !0,
isOpen: !0,
Height: 0,
isBindPhone: !0,
isShowCardBag: !1,
userGridList: [],
userOrgList: [],
isCreate: !1
},
callPhone: function (t) {
var e = t.currentTarget.dataset.item;
console.log(e), wx.makePhoneCall({
phoneNumber: e + ""
});
},
checkPermission: function () {
var t = this;
try {
var e = wx.getStorageSync("name"), a = wx.getStorageSync("userIcon");
e ? this.setData({
name: e,
userIcon: a
}) : wx.showModal({
title: "提示",
content: "小程序需要您微信头像以及昵称用于展示,请授权.",
showCancel: !1,
success: function (e) {
e.confirm && t.getUserProfile(3);
}
});
} catch (t) {
t = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(t);
wx.showToast({
title: "获取信息失败",
icon: "error"
});
}
},
getUserProfile: function (t) {
var e = this;
wx.getUserProfile({
desc: "获取微信头像以及昵称用于展示",
success: function (t) {
wx.setStorage({
data: t.userInfo.nickName,
key: "name"
}), wx.setStorage({
data: t.userInfo.avatarUrl,
key: "userIcon"
}), e.setData({
name: t.userInfo.nickName,
userIcon: t.userInfo.avatarUrl
}), a.globalData.userIcon = t.userInfo.avatarUrl, a.globalData.userInfo = t.userInfo;
},
fail: function (t) {
wx.showToast({
title: "获取个人信息失败",
icon: "error"
});
}
});
},
getHelpCount: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getHelpCount, [a.baseUrls.requestUrl]), {
problemTypeId: "b99f796f-b3a0-4d52-b10e-6e387ebbcc1b",
areaCode: wx.getStorageSync("areaCode")
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
helpCount: a.data
});
}, function (t, e) {
console.log(e);
});
},
getFriendCount: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getHelpCount, [a.baseUrls.requestUrl]), {
problemTypeId: "99cf4a4e-22a2-49b2-9274-4519cd47cefd"
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
friendCount: a.data
});
}, function (t, e) {
console.log(e);
});
},
getOtherCount: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getHelpCount, [a.baseUrls.requestUrl]), {
problemTypeId: "02a11dc0-9656-4504-8c11-030a28914ff3"
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
otherCount: a.data
});
}, function (t, e) {
console.log(e);
});
},
checkGrid: function () {
this.setData({
showAuthentication: !0
}), wx.hideTabBar({
animation: !1
});
},
getGridList: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getGridListPage, [a.baseUrls.requestUrl]), {
page: 1,
rows: 3,
areaCode: wx.getStorageSync("areaCode")
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
"200" == e && t.setData({
gridList: a.rows
});
}, function (t, e) {
console.log(e);
});
},
doAuthentication: function () {
var t = this;
if (!t.data.isLoading) {
var e = {
userName: t.data.userNameText,
passWord: r.hexMD5(r.hexMD5(r.hexMD5(t.data.userPassword)))
};
t.setData({
isLoading: !0
}), a.restAjax.get(a.restAjax.path(a.apis.checkGrid, [a.baseUrls.requestUrl]), e, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
wx.hideLoading(), a.data ? (wx.showToast({
title: "认证成功!",
icon: "success"
}), t.setData({
showAuthentication: !1,
userNameText: "",
userPassword: "",
isLoading: !1
}), wx.showTabBar({
animation: !1
}), t.getGridList(), wx.navigateTo({
url: "/packagecard/cardList/cardList?type=grid&id=" + a.data
})) : (wx.showToast({
title: "认证失败!",
icon: "error"
}), t.setData({
isLoading: !1
}));
}, function (e, a) {
console.log(a), wx.showToast({
title: a.msg,
icon: "error"
}), t.setData({
isLoading: !1
});
});
}
},
closeAuthentication: function () {
this.setData({
showAuthentication: !1,
userNameText: "",
userPassword: ""
}), wx.showTabBar({
animation: !1
});
},
checkGridMore: function () {
wx.navigateTo({
url: "./contact"
});
},
checkMoreCase: function () {
wx.navigateTo({
url: "./case/caseList"
});
},
checkCaseStatus: function (t) {
var e = t.currentTarget.dataset.status, a = "";
a = "2" == e ? "?handleStatus=2" : "?isAccept=" + e, wx.navigateTo({
url: "./case/caseList" + a
});
},
contactGrid: function (t) {
var e = t.currentTarget.dataset.item;
console.log(e), wx.navigateTo({
url: "./contact/contactDetail?gridMiniId=" + e.cardSysId + "&title=" + e.userUserName
});
},
onload(options) {
this.getHelpCount();
this.getFriendCount();
this.getOtherCount();
if (!wx.getStorageSync("userIcon")) {
this.checkPermission();
}
data: {
token: a.globalData.token,
sourceUrl: a.baseUrls.sourceUrl,
userIcon: "",
userName: "",
curCommunityName: "",
gridList: [],
serviceUrl: a.baseUrls.serviceUrl,
baseImgUrl: a.baseUrls.baseImgUrl,
userNameText: "",
userPassword: "",
showAuthentication: !1,
isLoading: !1,
menuList: [],
imgUrl: a.baseUrls.baseCardUrl,
isShow: !0,
isOpen: !0,
Height: 0,
isBindPhone: !0,
isShowCardBag: !1,
userGridList: [],
userOrgList: [],
isCreate: !1
},
callPhone: function (t) {
var e = t.currentTarget.dataset.item;
console.log(e), wx.makePhoneCall({
phoneNumber: e + ""
});
},
checkPermission: function () {
var t = this;
try {
var e = wx.getStorageSync("name"), a = wx.getStorageSync("userIcon");
e ? this.setData({
name: e,
userIcon: a
}) : wx.showModal({
title: "提示",
content: "小程序需要您微信头像以及昵称用于展示,请授权.",
showCancel: !1,
success: function (e) {
e.confirm && t.getUserProfile(3);
}
});
} catch (t) {
t = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(t);
wx.showToast({
title: "获取信息失败",
icon: "error"
});
}
},
getUserProfile: function (t) {
var e = this;
wx.getUserProfile({
desc: "获取微信头像以及昵称用于展示",
success: function (t) {
wx.setStorage({
data: t.userInfo.nickName,
key: "name"
}), wx.setStorage({
data: t.userInfo.avatarUrl,
key: "userIcon"
}), e.setData({
name: t.userInfo.nickName,
userIcon: t.userInfo.avatarUrl
}), a.globalData.userIcon = t.userInfo.avatarUrl, a.globalData.userInfo = t.userInfo;
},
fail: function (t) {
wx.showToast({
title: "获取个人信息失败",
icon: "error"
});
}
});
},
getHelpCount: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getHelpCount, [a.baseUrls.requestUrl]), {
problemTypeId: "b99f796f-b3a0-4d52-b10e-6e387ebbcc1b",
areaCode: wx.getStorageSync("areaCode")
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
helpCount: a.data
});
}, function (t, e) {
console.log(e);
});
},
authPhone(e) {
this.setData({
userNameText: e.detail.value
})
},
authPwd(e) {
this.setData({
userPassword: e.detail.value
})
},
getFriendCount: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getHelpCount, [a.baseUrls.requestUrl]), {
problemTypeId: "99cf4a4e-22a2-49b2-9274-4519cd47cefd"
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
friendCount: a.data
});
}, function (t, e) {
console.log(e);
});
},
getOtherCount: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getHelpCount, [a.baseUrls.requestUrl]), {
problemTypeId: "02a11dc0-9656-4504-8c11-030a28914ff3"
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
otherCount: a.data
});
}, function (t, e) {
console.log(e);
});
},
checkGrid: function () {
this.setData({
showAuthentication: !0
}), wx.hideTabBar({
animation: !1
});
},
getGridList: function () {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getGridListPage, [a.baseUrls.requestUrl]), {
page: 1,
rows: 3,
areaCode: wx.getStorageSync("areaCode")
}, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
"200" == e && t.setData({
gridList: a.rows
});
}, function (t, e) {
console.log(e);
});
},
doAuthentication: function () {
var t = this;
if (!t.data.isLoading) {
var e = {
userName: t.data.userNameText,
passWord: r.hexMD5(r.hexMD5(r.hexMD5(t.data.userPassword)))
};
t.setData({
isLoading: !0
}), a.restAjax.get(a.restAjax.path(a.apis.checkGrid, [a.baseUrls.requestUrl]), e, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
wx.hideLoading(), a.data ? (wx.showToast({
title: "认证成功!",
icon: "success"
}), t.setData({
showAuthentication: !1,
userNameText: "",
userPassword: "",
isLoading: !1
}), wx.showTabBar({
animation: !1
}), t.getGridList(), wx.navigateTo({
url: "/packagecard/cardList/cardList?type=grid&id=" + a.data
})) : (wx.showToast({
title: "认证失败!",
icon: "error"
}), t.setData({
isLoading: !1
}));
}, function (e, a) {
console.log(a), wx.showToast({
title: a.msg,
icon: "error"
}), t.setData({
isLoading: !1
});
});
}
},
closeAuthentication: function () {
this.setData({
showAuthentication: !1,
userNameText: "",
userPassword: ""
}), wx.showTabBar({
animation: !1
});
},
checkGridMore: function () {
wx.navigateTo({
url: "./contact"
});
},
checkMoreCase: function () {
wx.navigateTo({
url: "./case/caseList"
});
},
checkCaseStatus: function (t) {
var e = t.currentTarget.dataset.status, a = "";
a = "2" == e ? "?handleStatus=2" : "?isAccept=" + e, wx.navigateTo({
url: "./case/caseList" + a
});
},
contactGrid: function (t) {
var e = t.currentTarget.dataset.item;
console.log(e), wx.navigateTo({
url: "./contact/contactDetail?gridMiniId=" + e.cardSysId + "&title=" + e.userUserName
});
},
onload(options) {
this.getHelpCount();
this.getFriendCount();
this.getOtherCount();
if (!wx.getStorageSync("userIcon")) {
this.checkPermission();
}
},
checkPermission() {
var t = this;
try {
var e = wx.getStorageSync("name"), a = wx.getStorageSync("userIcon");
e ? this.setData({
name: e,
userIcon: a
}) : wx.showModal({
title: "提示",
content: "小程序需要您微信头像以及昵称用于展示,请授权.",
showCancel: !1,
success: function (e) {
e.confirm && t.getUserProfile(3);
}
});
} catch (t) {
wx.showToast({
title: "获取信息失败",
icon: "error"
});
}
},
getUserProfile(t) {
var e = this;
wx.getUserProfile({
desc: "获取微信头像以及昵称用于展示",
success: function (t) {
wx.setStorage({
data: t.userInfo.nickName,
key: "name"
}), wx.setStorage({
data: t.userInfo.avatarUrl,
key: "userIcon"
}), e.setData({
userName: t.userInfo.nickName,
userIcon: t.userInfo.avatarUrl
}), a.globalData.userIcon = t.userInfo.avatarUrl, a.globalData.userInfo = t.userInfo;
},
fail: function (t) {
wx.showToast({
title: "获取个人信息失败",
icon: "error"
});
}
});
},
goColumnList(t) {
var e = t.currentTarget.dataset.item;
if ("1" == e.configColumnGroupTargetMode) {
var a = e.configColumnGroupTargetUrl;
console.log(a), -1 != a.indexOf("/mine/myCard/myCard") || -1 != a.indexOf("/packagecard/cardList/cardList") ? (this.setData({
isShowCardBag: !0
}), -1 != a.indexOf("/mine/myCard/myCard") && this.setData({
isCreate: !1
}), -1 != a.indexOf("/packagecard/cardList/cardList") && this.setData({
isCreate: !0
})) : wx.navigateTo({
url: a
});
} else "2" == e.configColumnGroupTargetMode || "3" == e.configColumnGroupTargetMode || wx.navigateTo({
url: "../columnlist/columnlist?id=" + e.configColumnGroupId + "&title=" + e.configColumnGroupName
});
},
onShow() {
this.getGridList(), this.setData({
userIcon: wx.getStorageSync("userIcon"),
userName: wx.getStorageSync("name"),
curCommunityName: wx.getStorageSync("curCommunityName")
}), this.getMineIsGrid();
},
getMineIsGrid() {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getMineIsGrid, [a.baseUrls.requestUrl]), null, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
userGridList: a
}), t.getMineOrgList();
}, function (e, a) {
console.log(a), t.getMineOrgList();
});
},
getMineOrgList() {
var _self = this;
a.restAjax.get(a.restAjax.path(a.apis.getMineOrg, [a.baseUrls.requestUrl]), null, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
_self.setData({
userOrgList: a
});
var r = null != _self.data.userGridList && null != _self.data.userGridLis && _self.data.userGridList.length > 0, o = null != _self.data.userOrgList && null != _self.data.userOrgList && _self.data.userOrgList.length > 0;
(r || o) && _self.getItemList();
}, function (t, e) {
console.log(e);
});
},
getItemList() {
wx.showLoading({
title: "加载中..."
});
var t = this;
console.log(a.urls.getMenuList)
a.http.get(a.urls.getMenuList, {
header: {
token: a.globalData.token
}
}).then(function (e) {
var a = e.data;
wx.stopPullDownRefresh({}), wx.hideLoading({});
var r = !0;
a.forEach(function (t) {
t.configColumnList.sort(function (t, e) {
return t.configColumnGroupOrder - e.configColumnGroupOrder;
}), "创建名片" == t.configColumnGroupName && (r = !1);
}), t.setData({
menuList: a,
isShow: r
});
}).catch(function (t) {
console.log(t), wx.stopPullDownRefresh({}), wx.hideLoading({});
});
},
imgHeight(t) {
var e = wx.getSystemInfoSync().windowWidth * t.detail.height / t.detail.width * .88 + "px";
this.setData({
Height: e
});
},
toFunction(t) {
console.log(t);
var e = "";
this.data.menuList.forEach(function (t) {
"3" == t.configColumnGroupDirection && (e = t.configColumnGroupTargetUrl);
}), -1 != e.indexOf("/packagecard/cardList/cardList") ? this.setData({
isShowCardBag: !0,
isCreate: !0
}) : wx.navigateTo({
url: e
});
},
onHide(t) {
this.setData({
isShowCardBag: !1
});
},
changeCard(t) {
console.log(t.currentTarget.dataset.type), console.log(t.currentTarget.dataset.item);
var e = t.currentTarget.dataset.item, a = "";
a = 1 == t.currentTarget.dataset.type ? this.data.isCreate ? "/packagecard/cardList/cardList?type=grid&id=" + e.gridMiniId : "/pages/mine/myCard/myCard?type=grid&id=" + e.gridMiniId : this.data.isCreate ? "/packagecard/cardList/cardList?type=org&id=" + e.organizationId : "/pages/mine/myCard/myCard?type=org&id=" + e.organizationId,
wx.navigateTo({
url: a
}), this.setData({
isShowCardBag: !1
});
}
},
checkPermission() {
var t = this;
try {
var e = wx.getStorageSync("name"), a = wx.getStorageSync("userIcon");
e ? this.setData({
name: e,
userIcon: a
}) : wx.showModal({
title: "提示",
content: "小程序需要您微信头像以及昵称用于展示,请授权.",
showCancel: !1,
success: function (e) {
e.confirm && t.getUserProfile(3);
}
});
} catch (t) {
wx.showToast({
title: "获取信息失败",
icon: "error"
});
}
},
getUserProfile(t) {
var e = this;
wx.getUserProfile({
desc: "获取微信头像以及昵称用于展示",
success: function (t) {
wx.setStorage({
data: t.userInfo.nickName,
key: "name"
}), wx.setStorage({
data: t.userInfo.avatarUrl,
key: "userIcon"
}), e.setData({
userName: t.userInfo.nickName,
userIcon: t.userInfo.avatarUrl
}), a.globalData.userIcon = t.userInfo.avatarUrl, a.globalData.userInfo = t.userInfo;
},
fail: function (t) {
wx.showToast({
title: "获取个人信息失败",
icon: "error"
});
}
});
},
goColumnList(t) {
var e = t.currentTarget.dataset.item;
if ("1" == e.configColumnGroupTargetMode) {
var a = e.configColumnGroupTargetUrl;
console.log(a), -1 != a.indexOf("/mine/myCard/myCard") || -1 != a.indexOf("/packagecard/cardList/cardList") ? (this.setData({
isShowCardBag: !0
}), -1 != a.indexOf("/mine/myCard/myCard") && this.setData({
isCreate: !1
}), -1 != a.indexOf("/packagecard/cardList/cardList") && this.setData({
isCreate: !0
})) : wx.navigateTo({
url: a
});
} else "2" == e.configColumnGroupTargetMode || "3" == e.configColumnGroupTargetMode || wx.navigateTo({
url: "../columnlist/columnlist?id=" + e.configColumnGroupId + "&title=" + e.configColumnGroupName
});
},
onShow() {
this.getGridList(), this.setData({
userIcon: wx.getStorageSync("userIcon"),
userName: wx.getStorageSync("name"),
curCommunityName: wx.getStorageSync("curCommunityName")
}), this.getMineIsGrid();
},
getMineIsGrid() {
var t = this;
a.restAjax.get(a.restAjax.path(a.apis.getMineIsGrid, [a.baseUrls.requestUrl]), null, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
t.setData({
userGridList: a
}), t.getMineOrgList();
}, function (e, a) {
console.log(a), t.getMineOrgList();
});
},
getMineOrgList() {
var _self = this;
a.restAjax.get(a.restAjax.path(a.apis.getMineOrg, [a.baseUrls.requestUrl]), null, {
headers: {
token: a.globalData.token
}
}, function (e, a) {
_self.setData({
userOrgList: a
});
var r = null != _self.data.userGridList && null != _self.data.userGridLis && _self.data.userGridList.length > 0, o = null != _self.data.userOrgList && null != _self.data.userOrgList && _self.data.userOrgList.length > 0;
(r || o) && _self.getItemList();
}, function (t, e) {
console.log(e);
});
},
getItemList() {
wx.showLoading({
title: "加载中..."
});
var t = this;
console.log(a.urls.getMenuList)
a.http.get(a.urls.getMenuList, {
header: {
token: a.globalData.token
}
}).then(function (e) {
var a = e.data;
wx.stopPullDownRefresh({}), wx.hideLoading({});
var r = !0;
a.forEach(function (t) {
t.configColumnList.sort(function (t, e) {
return t.configColumnGroupOrder - e.configColumnGroupOrder;
}), "创建名片" == t.configColumnGroupName && (r = !1);
}), t.setData({
menuList: a,
isShow: r
});
}).catch(function (t) {
console.log(t), wx.stopPullDownRefresh({}), wx.hideLoading({});
});
},
imgHeight(t) {
var e = wx.getSystemInfoSync().windowWidth * t.detail.height / t.detail.width * .88 + "px";
this.setData({
Height: e
});
},
toFunction(t) {
console.log(t);
var e = "";
this.data.menuList.forEach(function (t) {
"3" == t.configColumnGroupDirection && (e = t.configColumnGroupTargetUrl);
}), -1 != e.indexOf("/packagecard/cardList/cardList") ? this.setData({
isShowCardBag: !0,
isCreate: !0
}) : wx.navigateTo({
url: e
});
},
onHide(t) {
this.setData({
isShowCardBag: !1
});
},
changeCard(t) {
console.log(t.currentTarget.dataset.type), console.log(t.currentTarget.dataset.item);
var e = t.currentTarget.dataset.item, a = "";
a = 1 == t.currentTarget.dataset.type ? this.data.isCreate ? "/packagecard/cardList/cardList?type=grid&id=" + e.gridMiniId : "/pages/mine/myCard/myCard?type=grid&id=" + e.gridMiniId : this.data.isCreate ? "/packagecard/cardList/cardList?type=org&id=" + e.organizationId : "/pages/mine/myCard/myCard?type=org&id=" + e.organizationId,
wx.navigateTo({
url: a
}), this.setData({
isShowCardBag: !1
});
}
})

View File

@ -96,8 +96,8 @@
<image bindtap="closeAuthentication" class="close" src="{{sourceUrl}}close-rz.png"></image>
</view>
<view class="authentication-box">
<input value="{{userNameText}}" placeholder="请输入用户名" type="text"></input>
<input value="{{userPassword}}" placeholder="请输入密码" type="password"></input>
<input value="{{userNameText}}" placeholder="请输入用户名" type="text" bindinput="authPhone"></input>
<input value="{{userPassword}}" placeholder="请输入密码" type="password" bindinput="authPwd"></input>
<view bindtap="doAuthentication" class="authentication-btn">立即认证</view>
</view>
</view>