修复绑定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/myCardDetail/myCardDetail",
"pages/mine/otherCard/othercarddetail", "pages/mine/otherCard/othercarddetail",
"pages/columnlist/columnlist", "pages/columnlist/columnlist",
"pages/serve/serviceDetail" "pages/serve/serviceDetail"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@ -96,7 +96,7 @@
"sharePage/cardcode", "sharePage/cardcode",
"common/corpperimg/cropperimg" "common/corpperimg/cropperimg"
] ]
}] }],
"requiredPrivateInfos": ["chooseLocation","getLocation"]
} }

View File

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

View File

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