diff --git a/components/layouts/pc/header.vue b/components/layouts/pc/header.vue index bc3bec2..bffb026 100644 --- a/components/layouts/pc/header.vue +++ b/components/layouts/pc/header.vue @@ -155,7 +155,7 @@ }) break; case 'github': - window.open("https://github.com/Hugh-rymcu"); + window.open("https://github.com/rymcu"); return false; break; default: @@ -180,10 +180,7 @@ break; case 'user-info': _ts.$router.push({ - name: 'account', - params: { - id: _ts.user.idUser - } + path: '/user/settings/account' }) break; case 'logout': @@ -210,7 +207,7 @@ } }, mounted() { - this.restaurants = this.loadAll(); + // this.restaurants = this.loadAll(); let user = this.user; if (user) { this.getUnreadNotifications(); diff --git a/nuxt.config.js b/nuxt.config.js index d4af280..9401318 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -51,6 +51,7 @@ export default { ** https://nuxtjs.org/guide/plugins */ plugins: [ + {src: '~/plugins/avataaars/generator/generateAvatar'}, {src: '~/plugins/extend'}, {src: '~/plugins/axios'}, {src: '~/plugins/element-ui'}, diff --git a/package-lock.json b/package-lock.json index 88cd8d5..17e2309 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9495,6 +9495,11 @@ } } }, + "save-svg-as-png": { + "version": "1.4.17", + "resolved": "https://registry.npm.taobao.org/save-svg-as-png/download/save-svg-as-png-1.4.17.tgz", + "integrity": "sha1-KURCACdyok8dsb+KKq999KsM3FU=" + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz", @@ -11049,6 +11054,11 @@ "resolved": "https://registry.npm.taobao.org/vue-template-es2015-compiler/download/vue-template-es2015-compiler-1.9.1.tgz", "integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=" }, + "vuejs-avataaars": { + "version": "4.0.1", + "resolved": "https://registry.npm.taobao.org/vuejs-avataaars/download/vuejs-avataaars-4.0.1.tgz", + "integrity": "sha1-Ak1rLcTu/pf/pKBeLiiNS5UDTSw=" + }, "vuex": { "version": "3.5.1", "resolved": "https://registry.npm.taobao.org/vuex/download/vuex-3.5.1.tgz", diff --git a/package.json b/package.json index 61552d7..5ad2243 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,9 @@ "express": "^4.17.1", "js-cookie": "^2.2.1", "nuxt": "^2.14.0", - "vditor": "^3.4.1" + "save-svg-as-png": "^1.4.17", + "vditor": "^3.4.1", + "vuejs-avataaars": "^4.0.1" }, "devDependencies": { "@nuxtjs/proxy": "^2.0.1", diff --git a/pages/user/settings.vue b/pages/user/settings.vue new file mode 100644 index 0000000..bf6c189 --- /dev/null +++ b/pages/user/settings.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/pages/user/settings/account.vue b/pages/user/settings/account.vue new file mode 100644 index 0000000..ca5868c --- /dev/null +++ b/pages/user/settings/account.vue @@ -0,0 +1,253 @@ + + + + + diff --git a/plugins/avataaars/data/accessories.js b/plugins/avataaars/data/accessories.js new file mode 100644 index 0000000..5390dc0 --- /dev/null +++ b/plugins/avataaars/data/accessories.js @@ -0,0 +1,9 @@ +module.exports = [ + 'Blank', + 'Kurt', + 'Prescription01', + 'Prescription02', + 'Round', + 'Sunglasses', + 'Wayfarers' +] diff --git a/plugins/avataaars/data/clothes.js b/plugins/avataaars/data/clothes.js new file mode 100644 index 0000000..767ec9d --- /dev/null +++ b/plugins/avataaars/data/clothes.js @@ -0,0 +1,12 @@ +module.exports = [ + 'BlazerShirt', + 'BlazerSweater', + 'CollarSweater', + 'GraphicShirt', + 'Graphics', + 'Hoodie', + 'Overall', + 'ShirtCrewNeck', + 'ShirtScoopNeck', + 'ShirtVNeck' +] diff --git a/plugins/avataaars/data/clothesColor.js b/plugins/avataaars/data/clothesColor.js new file mode 100644 index 0000000..6df4c3b --- /dev/null +++ b/plugins/avataaars/data/clothesColor.js @@ -0,0 +1,17 @@ +module.exports = [ + 'Black', + 'Blue01', + 'Blue02', + 'Blue03', + 'Gray01', + 'Gray02', + 'Heather', + 'PastelBlue', + 'PastelGreen', + 'PastelOrange', + 'PastelRed', + 'PastelYellow', + 'Pink', + 'Red', + 'White' +] diff --git a/plugins/avataaars/data/clothesGraphic.js b/plugins/avataaars/data/clothesGraphic.js new file mode 100644 index 0000000..ca3283a --- /dev/null +++ b/plugins/avataaars/data/clothesGraphic.js @@ -0,0 +1,13 @@ +module.exports = [ + 'Skull', + 'SkullOutline', + 'Bat', + 'Cumbia', + 'Deer', + 'Diamond', + 'Hola', + 'Selena', + 'Pizza', + 'Resist', + 'Bear' +] diff --git a/plugins/avataaars/data/eyebrow.js b/plugins/avataaars/data/eyebrow.js new file mode 100644 index 0000000..2ae9d03 --- /dev/null +++ b/plugins/avataaars/data/eyebrow.js @@ -0,0 +1,15 @@ +module.exports = [ + 'Angry', + 'AngryNatural', + 'Default', + 'DefaultNatural', + 'FlatNatural', + 'FrownNatural', + 'RaisedExcited', + 'RaisedExcitedNatural', + 'SadConcerned', + 'SadConcernedNatural', + 'UnibrowNatural', + 'UpDown', + 'UpDownNatural' +] diff --git a/plugins/avataaars/data/eyes.js b/plugins/avataaars/data/eyes.js new file mode 100644 index 0000000..7299f69 --- /dev/null +++ b/plugins/avataaars/data/eyes.js @@ -0,0 +1,14 @@ +module.exports = [ + 'Close', + 'Cry', + 'Default', + 'Dizzy', + 'EyeRoll', + 'Happy', + 'Hearts', + 'Side', + 'Squint', + 'Surprised', + 'Wink', + 'WinkWacky' +] diff --git a/plugins/avataaars/data/facialHair.js b/plugins/avataaars/data/facialHair.js new file mode 100644 index 0000000..94cc5ac --- /dev/null +++ b/plugins/avataaars/data/facialHair.js @@ -0,0 +1,8 @@ +module.exports = [ + 'BeardLight', + 'BeardMagestic', + 'BeardMedium', + 'Blank', + 'MoustacheFancy', + 'MoustacheMagnum' +] diff --git a/plugins/avataaars/data/facialHairColor.js b/plugins/avataaars/data/facialHairColor.js new file mode 100644 index 0000000..d21fd08 --- /dev/null +++ b/plugins/avataaars/data/facialHairColor.js @@ -0,0 +1,10 @@ +module.exports = [ + 'Auburn', + 'Black', + 'Blonde', + 'BlondeGolden', + 'Brown', + 'BrownDark', + 'Platinum', + 'Red' +] diff --git a/plugins/avataaars/data/hairColor.js b/plugins/avataaars/data/hairColor.js new file mode 100644 index 0000000..3f8a112 --- /dev/null +++ b/plugins/avataaars/data/hairColor.js @@ -0,0 +1,12 @@ +module.exports = [ + 'Auburn', + 'Black', + 'Blonde', + 'BlondeGolden', + 'Brown', + 'BrownDark', + 'PastelPink', + 'Platinum', + 'Red', + 'SilverGray' +] diff --git a/plugins/avataaars/data/hatColor.js b/plugins/avataaars/data/hatColor.js new file mode 100644 index 0000000..6df4c3b --- /dev/null +++ b/plugins/avataaars/data/hatColor.js @@ -0,0 +1,17 @@ +module.exports = [ + 'Black', + 'Blue01', + 'Blue02', + 'Blue03', + 'Gray01', + 'Gray02', + 'Heather', + 'PastelBlue', + 'PastelGreen', + 'PastelOrange', + 'PastelRed', + 'PastelYellow', + 'Pink', + 'Red', + 'White' +] diff --git a/plugins/avataaars/data/mouth.js b/plugins/avataaars/data/mouth.js new file mode 100644 index 0000000..92eefcf --- /dev/null +++ b/plugins/avataaars/data/mouth.js @@ -0,0 +1,14 @@ +module.exports = [ + 'Concerned', + 'Default', + 'Disbelief', + 'Eating', + 'Grimace', + 'Sad', + 'ScreamOpen', + 'Serious', + 'Smile', + 'Tongue', + 'Twinkle', + 'Vomit' +] diff --git a/plugins/avataaars/data/skin.js b/plugins/avataaars/data/skin.js new file mode 100644 index 0000000..26048bc --- /dev/null +++ b/plugins/avataaars/data/skin.js @@ -0,0 +1,9 @@ +module.exports = [ + 'Tanned', + 'Yellow', + 'Pale', + 'Light', + 'Brown', + 'DarkBrown', + 'Black' +] diff --git a/plugins/avataaars/data/top.js b/plugins/avataaars/data/top.js new file mode 100644 index 0000000..3085c10 --- /dev/null +++ b/plugins/avataaars/data/top.js @@ -0,0 +1,38 @@ +module.exports = [ + 'Eyepatch', + 'Hat', + 'Hijab', + 'LongHairBigHair', + 'LongHairBob', + 'LongHairBun', + 'LongHairCurly', + 'LongHairCurvy', + 'LongHairDreads', + 'LongHairFrida', + 'LongHairFro', + 'LongHairFroBand', + 'LongHairMiaWallace', + 'LongHairNotTooLong', + 'LongHairShavedSides', + 'LongHairStraight', + 'LongHairStraight2', + 'LongHairStraightStrand', + 'NoHair', + 'ShortHairDreads01', + 'ShortHairDreads02', + 'ShortHairFrizzle', + 'ShortHairShaggy', + 'ShortHairShaggyMullet', + 'ShortHairShortCurly', + 'ShortHairShortFlat', + 'ShortHairShortRound', + 'ShortHairShortWaved', + 'ShortHairSides', + 'ShortHairTheCaesar', + 'ShortHairTheCaesarSidePart', + 'Turban', + 'WinterHat1', + 'WinterHat2', + 'WinterHat3', + 'WinterHat4' +] diff --git a/plugins/avataaars/generator/generateAvatar.js b/plugins/avataaars/generator/generateAvatar.js new file mode 100644 index 0000000..b87ed0d --- /dev/null +++ b/plugins/avataaars/generator/generateAvatar.js @@ -0,0 +1,59 @@ +const accessories = require('./../data/accessories'); +const clothes = require('./../data/clothes'); +const clothesColor = require('./../data/clothesColor'); +const clothesGraphic = require('./../data/clothesGraphic'); +const eyebrows = require('./../data/eyebrow'); +const eyes = require('./../data/eyes'); +const facialHair = require('./../data/facialHair'); +const facialHairColors = require('./../data/facialHairColor'); +const hairColors = require('./../data/hairColor'); +const hatColors = require('./../data/hatColor'); +const mouth = require('./../data/mouth'); +const skin = require('./../data/skin'); +const top = require('./../data/top'); + +const getRandom = (length) => { + return Math.floor(Math.random() * length) +}; + +const generateRandomAvatar = (avatarType) => { + const accessory = accessories[getRandom(accessories.length)]; + const facialHairStyle = facialHair[getRandom(facialHair.length)]; + const facialHairColor = facialHairColors[getRandom(facialHairColors.length)]; + const hatColor = hatColors[getRandom(hatColors.length)]; + const hairColor = hairColors[getRandom(hairColors.length)]; + const clothingColor = clothesColor[getRandom(clothesColor.length)]; + const clothingGraphic = clothesGraphic[getRandom(clothesGraphic.length)]; + const clothing = clothes[getRandom(clothes.length)]; + const eyebrow = eyebrows[getRandom(eyebrows.length)]; + const eyesStyle = eyes[getRandom(eyes.length)]; + const mouthStyle = mouth[getRandom(mouth.length)]; + const skinStyle = skin[getRandom(skin.length)]; + const topStyle = top[getRandom(top.length)]; + + let avatarStyle = 'Transparent'; + if (Math.floor(Math.random() * 2) === 1) { + avatarStyle = 'Circle' + } + let avatarOption = { + avatarStyle: avatarType || avatarStyle, + topType: topStyle, + accessoriesType: accessory, + hairColor: hairColor, + hatColor: hatColor, + facialHairType: facialHairStyle, + facialHairColor: facialHairColor, + clotheType: clothing, + clotheColor: clothingColor, + graphicType: clothingGraphic, + eyeType: eyesStyle, + eyebrowType: eyebrow, + mouthType: mouthStyle, + skinColor: skinStyle + }; + + return avatarOption; + // return `https://avataaars.io/?avatarStyle=${avatarType || avatarStyle}&topType=${topStyle}&accessoriesType=${accessory}&hairColor=${hairColor}&hatColor=${hatColor}&facialHairType=${facialHairStyle}&facialHairColor=${facialHairColor}&clotheType=${clothing}&clotheColor=${clothingColor}&graphicType=${clothingGraphic}&eyeType=${eyesStyle}&eyebrowType=${eyebrow}&mouthType=${mouthStyle}&skinColor=${skinStyle}` +}; + +module.exports = { generateRandomAvatar } diff --git a/store/index.js b/store/index.js index 625f5a8..bb1dc4a 100644 --- a/store/index.js +++ b/store/index.js @@ -4,7 +4,8 @@ export const state = () => { return { activeMenu: 'index', oauth: null, - locale: 'zh_CN' + locale: 'zh_CN', + uploadHeaders: '' } } @@ -14,6 +15,9 @@ export const mutations = { }, setActiveMenu (state, activeMenu) { state.activeMenu = activeMenu + }, + setUploadHeaders(state, data){ + state.uploadHeaders = data } }