chache/pages/home/jubao/jubao.js
2024-01-23 19:04:21 +08:00

136 lines
3.8 KiB
JavaScript

var t;
(t = getApp()),
Page({
data: {
car_uid: 0,
value: "",
feedback_type: 1,
isShow: !1,
more_status: !0,
items: [
{ name: "虚假信息", checked: "true" },
{ name: "广告" },
{ name: "其他" },
],
leftid: 1,
content: [],
},
onLoad: function (t) {
console.log(t),
t.form_type &&
"undefined" != t.form_type &&
this.setData({
feedback_type: t.form_type,
car_id: t.car_id,
car_uid: t.car_uid,
}),
wx.getUserInfo({
success: function (t) {
console.log(t);
},
fail: function (t) {
console.log(t);
},
}),
wx.setNavigationBarTitle({
title: 1 == this.data.feedback_type ? "留言商家" : "举报商家",
}),
this._stay();
},
_stay: function () {
var a = this;
t.util.request({
url: "entry/wxapp/Api",
data: {
r: "home.index.stay",
car_id: this.data.car_id,
leftid: this.data.leftid++,
},
cachetime: "0",
success: function (t) {
var e;
console.log(t),
t.data.data.length > 0
? (console.log(t),
(e = a.data.content).push.apply(
e,
(function (t) {
if (Array.isArray(t)) {
for (var a = 0, e = Array(t.length); a < t.length; a++)
e[a] = t[a];
return e;
}
return Array.from(t);
})(t.data.data)
),
a.setData({ content: a.data.content }))
: a.setData({ more_status: !1 });
},
});
},
more: function () {
this._stay();
},
formSubmit: function (a) {
console.log(wx.getStorageSync("uid"));
var e = a.detail.value,
i = "";
1 != this.data.feedback_type && (i = "[车辆信息]:" + this.data.value),
e.content
? t.util.request({
url: "entry/wxapp/Api",
data: {
r: "home.index.word",
content: e.content,
car_uid: this.data.car_uid,
car_info: i,
feedback_type: this.data.feedback_type,
uid: wx.getStorageSync("uid"),
car_id: this.data.car_id,
},
cachetime: "0",
success: function (t) {
console.log(t),
wx.showModal({
title: "提示",
content: "提交信息成功",
showCancel: !1,
success: function (t) {
wx.navigateBack({});
},
});
},
})
: wx.showModal({
title: "提示",
content: "内容不能为空!",
showCancel: !1,
success: function (t) {},
});
},
radioChange: function (t) {
0 == t.detail.value
? (this.data.value = "虚假信息")
: 1 == t.detail.value
? (this.data.value = "广告")
: 2 == t.detail.value && (this.data.value = "其他");
},
hideDialog: function () {
this.setData({ isShow: !this.data.isShow });
},
onShow: function () {
var a = this;
t.util.getUserInfo(function (t) {
(wx.getStorageSync("uid") && t.memberInfo) || a.setData({ isShow: !0 });
});
},
updateUserInfo: function (a) {
var e = this;
t.util.getUserInfo(function (t) {
wx.setStorageSync("uid", t.memberInfo.uid), e.hideDialog();
}, a.detail);
},
});