nieyuge преди 2 години
родител
ревизия
130c1036f4
променени са 4 файла, в които са добавени 55 реда и са изтрити 56 реда
  1. 5 14
      src/pages/index.vue
  2. 7 4
      src/pages/nft/add.vue
  3. 0 13
      src/pages/nft/index.vue
  4. 43 25
      src/pages/nft/list.vue

+ 5 - 14
src/pages/index.vue

@@ -112,20 +112,11 @@ onMounted(() => {
         });
     }
 
-    // jump login
-    let str = route.query && route.query.params || ''
-    if (str) {
-        // @ts-ignore
-        let params = JSON.parse(atob(str));
-        setStorage(storageKey.userInfo, params)
-        location.href = `/nft/list`;
-    } else {
-        // plugin login
-        let userInfo = getCookie(storageKey.userInfo);
-        if (userInfo) {
-            setStorage(storageKey.userInfo, JSON.parse(userInfo));
-            removeCookie(storageKey.userInfo)
-        }
+    // plugin login
+    let userInfo = getCookie(storageKey.userInfo);
+    if (userInfo) {
+        setStorage(storageKey.userInfo, JSON.parse(userInfo));
+        removeCookie(storageKey.userInfo)
     }
 
     // Report

+ 7 - 4
src/pages/nft/add.vue

@@ -103,7 +103,7 @@
     <div class="succ" v-if="showSuccess">
         <img class="icon" src="../../static/img/icon-notice-succ.svg" alt="" />
         <div class="notic">Your NFTs are Created</div>
-        <button class="btn"  @click="hideSuccess">Done</button>
+        <button class="btn"  @click="jumpList">Done</button>
     </div>
     <div class="succ-bg" v-if="showSuccess" @click="hideSuccess"></div>
 
@@ -174,7 +174,6 @@ const next = () => {
     }).then(res => {
         if (res.code === 0) {
             showSuccess.value = true;
-            location.href = `/nft/list`
         }
     }).finally(() => {
         showLoading.value = false;
@@ -253,6 +252,10 @@ const hideSuccess = () => {
     showSuccess.value = false;
 }
 
+const jumpList = () => {
+    location.href = `/nft/list`
+}
+
 const changePrice = (e: any) => {
     projectPrice.value = String(Math.abs(e.target.value))
 }
@@ -297,9 +300,9 @@ watchEffect(() => {
     let ifUpload = uploadItem.value && uploadItem.value.objectKey || false;
     let ifName = projectName.value !== '';
     let ifDesc = projectDesc.value !== '';
-    let ifSize = projectSize.value !== '';
+    let ifSize = projectSize.value !== '' && Number(projectSize.value) > 0;
     let ifCurrency = currencyItem.value && currencyItem.value.currencyCode;
-    let ifPrice = projectPrice.value && projectPrice.value !== ''
+    let ifPrice = projectPrice.value && projectPrice.value !== '' && Number(projectPrice.value) > 0;
 
     isNext.value = ifUpload && ifName && ifDesc && ifSize && ifCurrency && ifPrice;
 })

+ 0 - 13
src/pages/nft/index.vue

@@ -2,19 +2,6 @@
     <router-view></router-view>
 </template>
 
-<script lang="ts" setup>
-import { onMounted } from 'vue'
-import { getStorage, storageKey } from '../../static/utils/storage'
-
-onMounted(() => {
-    let userInfo = getStorage(storageKey.userInfo);
-    if (!userInfo) {
-        location.href = '/'
-    }
-})
-</script>
-
-
 <style lang="less">
 body {
     overflow: hidden;

+ 43 - 25
src/pages/nft/list.vue

@@ -78,16 +78,17 @@
 </template>
 
 <script lang="ts" setup>
-import { onMounted, ref } from 'vue'
+import { onMounted, ref, nextTick } from 'vue'
+import { useRoute } from 'vue-router'
 import { ElMessage } from 'element-plus'
 import Api from '../../static/http/api';
 import { postRequest } from '../../static/http'
-import { getStorage, storageKey, removeStorage } from '../../static/utils/storage'
+import { getStorage, setStorage, storageKey, removeStorage } from '../../static/utils/storage'
 import { Report } from '../../static/report'
 import { businessType, pageSource, objectType } from '../../static/report/enum'
 
 const userInfo: any = ref({})
-
+const route = useRoute()
 const publishType = ref(0)
 const publishItem = ref(null)
 const publishDialog = ref(false)
@@ -211,6 +212,7 @@ const getList = () => {
             pageSize: pageSize
         }
     }).then(res => {
+        console.log(333, res)
         let { code, data } = res;
         if (code === 0) {
             pageList.value = data;
@@ -290,12 +292,9 @@ const confirmPublishLayer = () => {
     }).then(res => {
         let { code, msg } = res;
         if ( code === 0 ) {
-            pageList.value.some((row) => {
-                if (row.nftProjectId === item.nftProjectId) {
-                    row.publishStatus = status;
-                    return true;
-                }
-            })
+            // list
+            getList()
+
             ElMessage({
                 type: 'success',
                 message: publishType.value === 1 ? 'Published Successfully!' : 'We have listed your NFT collection!',
@@ -318,10 +317,17 @@ const confirmPublishLayer = () => {
                 })
             }
         } else {
-            ElMessage({
-                type: 'error',
-                message: msg
-            })
+            if (code === 5004) {
+                ElMessage({
+                    type: 'error',
+                    message: `You can list at most one NFT collection, unlist one collection to list another.`
+                })
+            } else {
+                ElMessage({
+                    type: 'error',
+                    message: msg
+                })
+            }
             if (publishType.value === 1) {
                 // Report
                 Report({
@@ -345,19 +351,31 @@ const confirmPublishLayer = () => {
 }
 
 onMounted(() => {
-    userInfo.value = getStorage(storageKey.userInfo);
-    // 获取列表
-    getList()
-    // Report
-    Report({
-        baseInfo: {
-            pageSource: pageSource.managerPage,
-        },
-        params: {
-            eventData: {
-                businessType: businessType.pageView,
+    // jump login
+    let str = route.query && route.query.params || ''
+    if (str) {
+        // @ts-ignore
+        let params = JSON.parse(atob(str));
+        setStorage(storageKey.userInfo, params)
+        userInfo.value = params;
+    } else {
+        userInfo.value = getStorage(storageKey.userInfo);
+    }
+
+    nextTick(() => {
+        // 获取列表
+        getList()
+        // Report
+        Report({
+            baseInfo: {
+                pageSource: pageSource.managerPage,
+            },
+            params: {
+                eventData: {
+                    businessType: businessType.pageView,
+                }
             }
-        }
+        })
     })
 })
 </script>