nieyuge 2 年之前
父節點
當前提交
2f8d82aeb7
共有 2 個文件被更改,包括 23 次插入7 次删除
  1. 21 5
      src/pages/nft/add.vue
  2. 2 2
      src/pages/nft/list.vue

+ 21 - 5
src/pages/nft/add.vue

@@ -13,7 +13,7 @@
                             <div class="member">{{ projectName === '' ? 'xxxx' : projectName }}</div>
                             <div class="number">{{ projectNo === '' ? '0000' : projectNo }}</div>
                         </div>
-                        <img class="bg" :src="selectItem.mainImagePath" />
+                        <img class="bg" :src="selectItem.previewImagePath" />
                     </div>
                     <div class="list">
                         <div
@@ -66,7 +66,7 @@
                     </div>
                     <div class="input">
                         <div class="tips" v-if="showMinPrice">the price of each NFT must be above $0.1 USD</div>
-                        <input type="number" v-model="projectPrice" @input="changePrice" placeholder="0" />
+                        <input type="text" v-model="projectPrice" @input="changePrice" placeholder="0" />
                     </div>
                     <!-- 货币列表 -->
                     <div class="currency-pop" v-if="currencyDialog">
@@ -278,8 +278,24 @@ const jumpList = () => {
 }
 
 const changePrice = debounce((e: any) => {
-    if (e.target.value !== '') {
-        projectPrice.value = String(Math.abs(e.target.value))
+    let val = projectPrice.value;
+
+    val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
+
+    if (val == '00') {
+        val = '0'
+    }
+
+    if (val.indexOf('.') > -1){
+        let arr = val.split('.');
+        if(arr[0].startsWith('0')) {
+            let num = +arr[0];
+            val = num + '.' + arr[1];
+        }
+    }
+
+    if (val !== '') {
+        projectPrice.value = val
     } else {
         projectPrice.value = ''
     }
@@ -323,7 +339,7 @@ watchEffect(() => {
     } else {
         projectNo.value = ''
     }
-    showNoStr.value = projectNo.value != '';
+    showNoStr.value = projectNo.value != '' && Number(projectNo.value) > 0;
 
     // 是否可以创建
     let ifUpload = tempUrl.value != '' || false;

+ 2 - 2
src/pages/nft/list.vue

@@ -21,12 +21,12 @@
                         </div>
                         <div class="opt">
                             <template v-if="item.publishStatus === 1">
-                                <el-button link type="danger" @click="unpublish(item)">Unpublish</el-button>
+                                <el-button link type="danger" @click="unpublish(item)">Unlist</el-button>
                                 <el-button link type="primary" @click="view">View</el-button>
                             </template>
                             <template v-else>
                                 <el-button link type="danger" @click="remove(item)">Delete</el-button>
-                                <el-button link type="primary" @click="publish(item)">Publish</el-button>
+                                <el-button link type="primary" @click="publish(item)">Sell</el-button>
                             </template>
                         </div>
                     </div>