parent
b2fe3b2fa7
commit
9e623e65ab
@ -1262,12 +1262,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// ISBN-10 转 ISBN-13(自动转换)
|
// ISBN-10 转 ISBN-13(自动转换)
|
||||||
convertIsbn10To13(isbn) {
|
convertIsbn10To13(isbn) {
|
||||||
if (!isbn) return ''
|
if (!isbn) return isbn
|
||||||
// 去掉连字符和空格
|
// 去掉连字符和空格
|
||||||
var clean = isbn.replace(/[-\s]/g, '')
|
var clean = isbn.replace(/[-\s]/g, '')
|
||||||
// 只处理10位纯数字(可能有X结尾)
|
// 只处理10位纯数字(可能有X结尾)
|
||||||
var match = clean.match(/^(\d{9})([\dXx])$/)
|
var match = clean.match(/^(\d{9})([\dXx])$/)
|
||||||
if (!match) return ''
|
if (!match) return isbn
|
||||||
// 前9位 + 前缀978
|
// 前9位 + 前缀978
|
||||||
var digits = '978' + match[1]
|
var digits = '978' + match[1]
|
||||||
// 计算ISBN-13校验码
|
// 计算ISBN-13校验码
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user