|
|
@@ -8,7 +8,7 @@
|
|
|
<view class="itemOption"
|
|
|
><view class="imgItem" @click="deleteGroup(item)"
|
|
|
><image src="../../static/delete.png"></image></view
|
|
|
- ><view class="imgItem"
|
|
|
+ ><view class="imgItem" @click="editGroup(item)"
|
|
|
><image src="../../static/edit.png"></image></view
|
|
|
><view class="imgItem"
|
|
|
><image src="../../static/shareTwo.png"></image></view
|
|
|
@@ -58,7 +58,14 @@
|
|
|
style="width: 100%"
|
|
|
@click="$event.stopPropagation()"
|
|
|
/>
|
|
|
- <button class="btn link-btn" @click="sureAddGroup()">
|
|
|
+ <button
|
|
|
+ class="btn link-btn"
|
|
|
+ @click="sureAddGroup()"
|
|
|
+ v-if="!editFlag"
|
|
|
+ >
|
|
|
+ <text>确定</text>
|
|
|
+ </button>
|
|
|
+ <button class="btn link-btn" @click="sureEditGroup()">
|
|
|
<text>确定</text>
|
|
|
</button>
|
|
|
</view>
|
|
|
@@ -75,6 +82,7 @@ export default {
|
|
|
groupName: "",
|
|
|
userId: uni.getStorageSync("userId"),
|
|
|
groupList: [],
|
|
|
+ editFlag: false,
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -82,6 +90,14 @@ export default {
|
|
|
this.addGroupModle = true;
|
|
|
},
|
|
|
sureAddGroup() {
|
|
|
+ if (this.groupName.trim() == "") {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入家庭名称",
|
|
|
+ icon: "none",
|
|
|
+ duration: 1500,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
let groupAddParams = {
|
|
|
userId: this.userId,
|
|
|
groupName: this.groupName,
|
|
|
@@ -156,6 +172,52 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ editGroup(item) {
|
|
|
+ this.addGroupModle = true;
|
|
|
+ this.editFlag = true;
|
|
|
+ this.groupName = item.groupName;
|
|
|
+ },
|
|
|
+ sureEditGroup() {
|
|
|
+ if (this.groupName.trim() == "") {
|
|
|
+ uni.showToast({
|
|
|
+ title: "请输入家庭名称",
|
|
|
+ icon: "none",
|
|
|
+ duration: 1500,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let groupEditParams = {
|
|
|
+ groupUuid: this.groupList.find(
|
|
|
+ (g) => g.groupName === this.groupName
|
|
|
+ ).groupUuid,
|
|
|
+ groupName: this.groupName,
|
|
|
+ };
|
|
|
+ this.$http
|
|
|
+ .post("wap/group/updateGroup", groupEditParams, {
|
|
|
+ header: {
|
|
|
+ "Content-Type": "application/json;charset=UTF-8",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "编辑家庭成功",
|
|
|
+ icon: "success",
|
|
|
+ duration: 1500,
|
|
|
+ });
|
|
|
+ this.addGroupModle = false;
|
|
|
+ this.groupName = "";
|
|
|
+ this.editFlag = false;
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.data.message,
|
|
|
+ icon: "none",
|
|
|
+ duration: 1500,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.getdevList();
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
onShow() {
|
|
|
this.getdevList();
|