You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
1.9 KiB
111 lines
1.9 KiB
import { wxRequestPost } from "@utils/promise-wx-api";
|
|
import animeBehavior from "@mixins/anime";
|
|
|
|
let tempReslove = () => {};
|
|
const app = getApp();
|
|
|
|
Component({
|
|
behaviors: [animeBehavior],
|
|
|
|
properties: {
|
|
npcList: {
|
|
type: Array,
|
|
value: [],
|
|
},
|
|
selectIndex: {
|
|
type: Number,
|
|
value: 0,
|
|
},
|
|
},
|
|
|
|
data: {
|
|
hidden: true,
|
|
|
|
initLoading: false,
|
|
|
|
selectNpcIndex:-1,
|
|
selectNpc: {
|
|
userId:"",
|
|
displayName:"",
|
|
headImgUrl:"",
|
|
gridId:"",
|
|
agencyId:"",
|
|
pids:""
|
|
},
|
|
|
|
},
|
|
|
|
lifetimes: {
|
|
async attached() {
|
|
|
|
},
|
|
detached() {},
|
|
},
|
|
|
|
methods: {
|
|
async show() {
|
|
|
|
// await this.getNpcList();
|
|
this.setData({
|
|
selectNpcIndex:this.data.selectIndex,
|
|
hidden: false,
|
|
});
|
|
return new Promise((reslove) => {
|
|
tempReslove = reslove;
|
|
});
|
|
},
|
|
|
|
|
|
selectNpc(e) {
|
|
|
|
const {
|
|
currentTarget: {
|
|
dataset: { index },
|
|
},
|
|
} = e;
|
|
|
|
let {selectNpcIndex } = this.data;
|
|
|
|
selectNpcIndex = index
|
|
|
|
this.setData({
|
|
selectNpcIndex
|
|
});
|
|
},
|
|
|
|
confirm() {
|
|
let ret = {};
|
|
let {
|
|
selectNpcIndex
|
|
} = this.data;
|
|
|
|
// selectNpcList=npcList.filter((item)=>{
|
|
// return item.selected
|
|
// })
|
|
|
|
// if (selectNpcList.length===0) {
|
|
// return wx.showToast({
|
|
// title: "请先选择至少一名人大代表",
|
|
// icon: "none",
|
|
// duration: 2000,
|
|
// });
|
|
// }
|
|
|
|
|
|
this.hide();
|
|
return tempReslove(selectNpcIndex);
|
|
},
|
|
|
|
cancel() {
|
|
this.hide();
|
|
return tempReslove('cancal');
|
|
},
|
|
async hide() {
|
|
this.animeFadeOut("#root");
|
|
await this.animeFadeOutDown("#wrap");
|
|
this.setData({ hidden: true });
|
|
},
|
|
|
|
|
|
},
|
|
});
|
|
|