zlisen 4 years ago
parent
commit
bf937b4b2b
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      src/pages/imglist/index.jsx

+ 7
- 7
src/pages/imglist/index.jsx View File

19
   const [labelState, setLabelState] = useState(false);
19
   const [labelState, setLabelState] = useState(false);
20
   const [list, setList] = useState({});
20
   const [list, setList] = useState({});
21
   const [labelList, setLabelList] = useState([]);
21
   const [labelList, setLabelList] = useState([]);
22
-  const [data, setData] = useState({});
22
+  const [data, setData] = useState([]);
23
   const [tagList, setTagList] = useState([]);
23
   const [tagList, setTagList] = useState([]);
24
 
24
 
25
   let [arrList, setArrList] = useState({});
25
   let [arrList, setArrList] = useState({});
58
             newImage: res[0].imageId,
58
             newImage: res[0].imageId,
59
             newTags: data.map(x => x.tagId)
59
             newTags: data.map(x => x.tagId)
60
           };
60
           };
61
-          updatainfo(newInfo);
61
+          updatainfo(newInfo,'image');
62
         });
62
         });
63
       }
63
       }
64
     });
64
     });
71
       newImage: data[0].imageId,
71
       newImage: data[0].imageId,
72
       newTags: labelList.map(x => x.tagId)
72
       newTags: labelList.map(x => x.tagId)
73
     };
73
     };
74
-    updatainfo(newInfo);
74
+    updatainfo(newInfo,'tag');
75
   };
75
   };
76
 
76
 
77
-  const updatainfo = newInfo => {
77
+  const updatainfo = (newInfo,type) => {
78
     const oldinfo = {
78
     const oldinfo = {
79
       originImage: data[0].imageId,
79
       originImage: data[0].imageId,
80
       originTags: data.map(x => x.tagId)
80
       originTags: data.map(x => x.tagId)
86
     }).then(() => {
86
     }).then(() => {
87
       Taro.showModal({
87
       Taro.showModal({
88
         title: "修改成功",
88
         title: "修改成功",
89
-        content: "如果修改标签请重新查询",
89
+        content:type==='tag'? "修改标签请重新查询":'',
90
         showCancel: false,
90
         showCancel: false,
91
         success: function(res) {
91
         success: function(res) {
92
           if (res.confirm) {
92
           if (res.confirm) {
243
           style={{ zIndex: "1000" }}
243
           style={{ zIndex: "1000" }}
244
         >
244
         >
245
           <View className="floatmodel">
245
           <View className="floatmodel">
246
-            <View onClick={() => updateLabel()}>更改标签</View>
247
-            <View onClick={() => updateImage()}>更换图片</View>
246
+            <View onClick={() => updateLabel('tag')}>更改标签</View>
247
+            <View onClick={() => updateImage('image')}>更换图片</View>
248
             <View onClick={() => deleteImage()}>删除</View>
248
             <View onClick={() => deleteImage()}>删除</View>
249
             <View
249
             <View
250
               style={{ color: "#d2d2d2" }}
250
               style={{ color: "#d2d2d2" }}