123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- // pages/my/work/work.js
- const App = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- appAssetsUrl2: App.appAssetsUrl2,
- id: null,
- detail: {},
- topicList: [],
- meetList: [],
- meetQuery: {
- page: 1,
- limit: 10,
- },
- meetPage: {
- totalCount: null,
- currPage: null,
- totalPage: null,
- },
- serveObj: {},
- items: [
- {
- week: "周一",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- {
- week: "周二",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- {
- week: "周三",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- {
- week: "周四",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- {
- week: "周五",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- {
- week: "周六",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- {
- week: "周日",
- startTime: "09:00",
- endTime: "18:00",
- checked: true,
- },
- ],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.setData({
- id: options.id,
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- this.popup2 = this.selectComponent("#popup2");
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.getDetail();
- },
- getDetail() {
- wx.showLoading({
- title: "努力加载中...",
- });
- App._get(
- "expert/infoMember/" + this.data.id,
- {},
- (res) => {
- if (res.code === 0) {
- this.setData({
- detail: res.expert,
- items: res.expert.periodBOList || this.data.items,
- });
- wx.hideLoading();
- if (res.expert.id) {
- this.getTopic(res.expert.id);
- this.getExperience(res.expert.id);
- this.getServe(res.expert.id);
- }
- }
- },
- (err) => {
- wx.showToast({
- icon: "error",
- title: "服务端异常",
- });
- },
- (complete) => {}
- );
- },
- // 获取话题
- getTopic(expertId) {
- App._get(
- "experttopic/list",
- {
- expertId: expertId,
- },
- (res) => {
- if (res.code === 0) {
- this.setData({
- topicList: res.list,
- });
- }
- }
- );
- },
- // 获取心得分享
- getExperience(expertId) {
- if (this.data.meetPage.totalCount > 0) {
- if (this.data.meetPage.currPage == this.data.meetPage.totalPage) {
- wx.showToast({
- title: "没有更多哦~",
- icon: "none",
- });
- return false;
- }
- }
- wx.showLoading({
- title: "努力加载中...",
- });
- App._get(
- "meetevaluation/evaluatePage",
- {
- ...this.data.meetQuery,
- expertId: expertId,
- },
- (res) => {
- if (res.code === 0) {
- this.setData({
- meetList: res.page.list,
- meetPage: {
- totalCount: res.page.totalCount,
- currPage: res.page.currPage,
- totalPage: res.page.totalPage,
- },
- });
- wx.hideLoading();
- }
- },
- (err) => {
- wx.showToast({
- icon: "error",
- title: "服务端异常",
- });
- },
- (complete) => {}
- );
- },
- // 获取服务统计
- getServe(expertId) {
- App._get(
- "expert_workbench/myServiceStatistics",
- {
- expertId: expertId,
- },
- (res) => {
- if (res.code === 0) {
- this.setData({
- serveObj: res.data,
- });
- }
- }
- );
- },
- toDetail(e) {
- wx.navigateTo({
- url: `/workbench/work/topic?id=${e.currentTarget.dataset.id}`
- })
- },
- checkboxChange(e) {
- console.log(e);
- let list = this.data.items;
- for (let i = 0, lenI = list.length; i < lenI; ++i) {
- list[i].checked = false;
- for (let j = 0, lenJ = e.detail.value.length; j < lenJ; ++j) {
- if (i == e.detail.value[j]) {
- list[i].checked = true;
- break;
- }
- }
- }
- this.setData({
- items: list,
- });
- },
- bindStartTimeChange(e) {
- console.log(e);
- let list = this.data.items;
- for (let i in list) {
- if (i == e.currentTarget.dataset.index) {
- list[i].startTime = e.detail.value;
- break;
- }
- }
- this.setData({
- items: list,
- });
- },
- bindEndTimeChange(e) {
- console.log(e);
- let list = this.data.items;
- for (let i in list) {
- if (i == e.currentTarget.dataset.index) {
- list[i].endTime = e.detail.value;
- break;
- }
- }
- this.setData({
- items: list,
- });
- },
- toGambit(e) {
- wx.navigateTo({
- url: "/workbench/gambit/gambit?id=" + e.currentTarget.dataset.id,
- });
- },
- timeHandle() {
- this.popup2.showPopup();
- },
- _error() {
- console.log("返回");
- let list = this.data.items;
- // for (let value of list) {
- // value.startTime = "09:00";
- // value.endTime = "18:00";
- // value.checked = true;
- // }
- this.setData({
- items: list,
- });
- this.popup2.hidePopup();
- },
- _success() {
- console.log("查看");
- App._put_form(
- "expert/updatePeriod",
- "",
- {
- id: this.data.detail.id,
- memberId: this.data.id,
- periodBOList: this.data.items,
- },
- (res) => {
- if (res.code === 0) {
- wx.showToast({
- title: "保存成功",
- icon: "success",
- });
- }
- }
- );
- this.popup2.hidePopup();
- },
- lookMore() {
- wx.navigateTo({
- url: "/workbench/myService/myService",
- });
- },
- toServerList(e) {
- console.log(e, 111);
- wx.navigateTo({
- url:
- "/workbench/myService/myService?status=" +
- e.currentTarget.dataset.status,
- });
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- this.getExperience(this.data.detail.id);
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {},
- });
|