diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..324f59130fc533386d064b55554e9c5853ec26d3 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1720695168640 + + + + + + \ No newline at end of file diff --git a/__pycache__/cos.cpython-312.pyc b/__pycache__/cos.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c2fb376d80edc0ced9f7fdaef0454b6bde27c157 Binary files /dev/null and b/__pycache__/cos.cpython-312.pyc differ diff --git a/__pycache__/datas.cpython-312.pyc b/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5eea94753a4291f82caf874b80ddeb65da3aae46 Binary files /dev/null and b/__pycache__/datas.cpython-312.pyc differ diff --git a/cos.py b/cos.py new file mode 100644 index 0000000000000000000000000000000000000000..e733d980c2452a0b5794c6b432df9dd838f6e21d --- /dev/null +++ b/cos.py @@ -0,0 +1,31 @@ +import math +def dot(A,B): + result=zip(A,B) + sum=0 + for item in result: + sum+=item[0]*item[1] + + return sum; + + +def mo(A): + sum=0 + for i in A: + sum+=i*i + + result=sum**0.5 + + return result + +def angel(A,B): + ji=dot(A,B) + mo1=mo(A); + mo2=mo(B); + cos=ji/(mo1*mo2) + if cos>1 or cos<-1: + cos=int(cos) + a=math.acos(cos)*180/math.pi + + return a + +# print(angel([1,0],[0,1]))#测试一下 \ No newline at end of file diff --git a/datas.py b/datas.py new file mode 100644 index 0000000000000000000000000000000000000000..8de083e483d8a17c552176c1c23cee139619a58c --- /dev/null +++ b/datas.py @@ -0,0 +1,102 @@ +#1.类型 1戒指 2手表 3手镯 4项链 +#2.价格 1.1000元以下 2.1000-2500元 3.2500-4000元 4.4000-5000元 5.5000元 以上 +#3.销量 1.200人以下 2.200-500人 3.500-800人 4.800人以上 +#4.发货地 1.广东 2.浙江 3.福建 4.上海 5.江苏 6.香港 +datas=[ + { + "name":"CRD钻戒", + "img":"1.jpg", + "info":"心动怦然 爱意恒久,从传承百年的经典爪镶中汲取灵感,融汇浪漫心形元素,光耀岁月里的隽永爱语。", + "feature":[1,3,4,4], + }, +{ + "name": "DR钻戒", + "img": "2.jpg", + "info": "以新娘手中的捧花为灵感,手捧花承载着新人对美满爱情的向往,设计师将美好的祝愿倾注于永恒钻石,愿每位新人都能幸福隽永", + "feature":[1,3,4,3], + }, +{ + "name": "周大福钻戒", + "img": "3.jpg", + "info": "采用多颗钻石围镶一颗主钻为设计,寓意“一生只宠爱你一人”,关于美好,是遇见你,宠爱你,是余生浪漫的开始", + "feature": [1,3,4,3], + }, +{ + "name": "周大生钻戒", + "img": "4.jpg", + "info": "以新型CNC技术进行切割,呈现出480+不同角度车花切面折射面扩大30%+,显钻放大3倍以上使火彩愈加璀璨,如同绚丽极光", + "feature": [1,3,4,5], + }, +{ + "name": "浪琴手表", + "img": "5.jpg", + "info": "Longines浪琴官方正品名匠系列女士机械表瑞士手表女官方旗舰", + "feature": [2,1,4,4], + }, +{ + "name": "阿玛尼手表", + "img": "6.jpg", + "info": "Armani阿玛尼手表女白月光系列优雅石英表正品AR1763", + "feature": [2,1,4,5], + }, +{ + "name": "DW手表", + "img": "7.jpg", + "info": "DW女士手表PETITE系列优雅流金表气质石英腕表28MM丹尼尔惠灵顿", + "feature": [2,1,4,2], + }, +{ + "name": "瑞士手表", + "img": "8.jpg", + "info": "jowissa瑞士手表女女款轻奢小众小表盘小金表品牌表气质女士手表", + "feature": [2,1,4,3], + }, +{ + "name": "流星手镯", + "img": "9.jpg", + "info": "幸运星绕星轨飞行,流星划过,为你许下心愿,期待着幸运降临,快乐无边,甜美星轨手镯,柔美弧线,灵动精巧,时尚百搭", + "feature": [3,5,1,2], + }, +{ + "name": "碎碎冰手镯", + "img": "10.jpg", + "info": "摆脱乏味横平竖直打破风格定义,枷锁以光芒跃动的线条之美,展现时尚优雅气质玩转出个性的态度人生。", + "feature": [3,5,2,2], + }, +{ + "name": "繁花似锦手镯", + "img": "11.jpg", + "info": "繁花枝叶元素点缀,将甜蜜温情与精致时尚感,平𧗾地恰到好处,轻松戴出属于你的美好气质,绝美金彩,心动难挡", + "feature": [3,5,3,2], + }, +{ + "name": "满天星手镯", + "img": "12.jpg", + "info": "大气中有精细,端正又不束缚,宽松休闲的版型显瘦不挑身材,搭配不费心,狠狠拿捏住少年感穿搭。", + "feature": [3,5,4,2], + }, +{ + "name": "梵克雅项链", + "img": "13.jpg", + "info": "梵克雅宝官方旗舰店Frivole系列18K 玫瑰金红宝石迷你款项链。", + "feature": [4,2,1,1], + }, +{ + "name": "YIN项链", + "img": "14.jpg", + "info": "从2014年起原创设计的经典系列莫比乌斯环“∞”一枚代表无限时空的符号赋予佩戴者勇气与信念打开每一个当下的[无限可能]", + "feature": [4,2,1,4], + }, +{ + "name": "Graff项链", + "img": "15.jpg", + "info": "Wild Flower钻石吊坠揉合,珠宝工艺与迷人的现代设计。轻盈的花瓣优雅地展开,散发欢欣活泼的气息。", + "feature": [4,2,1,3], + }, +{ + "name": "TSL项链", + "img": "16.jpg", + "info": "小巧爱心细腻点缀,吊坠背面爱心设计温柔细腻巧妙潜藏干练是你,温柔也是你", + "feature": [4,2,1,2], + }, +] \ No newline at end of file diff --git a/server.py b/server.py new file mode 100644 index 0000000000000000000000000000000000000000..9c083a01f1567d1316d99ee58adbf12a6ec95680 --- /dev/null +++ b/server.py @@ -0,0 +1,26 @@ +from flask import Flask,render_template +from datas import datas +from cos import angel +app = Flask(__name__) +@app.route("/") +def index(): + return render_template("index1.html",datas=datas) +@app.route("/info/") +def info(id): + current = datas[id]["feature"] + result=[] + for i in range(len(datas)): + obj={} + if id==i: + continue + obj["id"]=i; + obj["angle"]=angel(current,datas[i]["feature"]) + result.append(obj) + + def fn(k): + return k["angle"] + result.sort(key=fn) + + return render_template("info.html",datas=datas,result=result[0:5],id=id) +# return render_template("info.html",datas=datas,result=result[0:5],id=id) +app.run() \ No newline at end of file diff --git a/static/imgs/1.jpg b/static/imgs/1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8b6571865d449ac65bdd33e72b1c75c27e58e46e Binary files /dev/null and b/static/imgs/1.jpg differ diff --git a/static/imgs/10.jpg b/static/imgs/10.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d8ca7870216945aab7805619f94b1410021ed25d Binary files /dev/null and b/static/imgs/10.jpg differ diff --git a/static/imgs/11.jpg b/static/imgs/11.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bc57aeebe6915b7c8a16bf275898dca8c4d11008 Binary files /dev/null and b/static/imgs/11.jpg differ diff --git a/static/imgs/12.jpg b/static/imgs/12.jpg new file mode 100644 index 0000000000000000000000000000000000000000..19d1bcbbd27fae914227f95c8d2751b050ffae93 Binary files /dev/null and b/static/imgs/12.jpg differ diff --git a/static/imgs/13.jpg b/static/imgs/13.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0c4510d98e039519f14b250b0f4d6d25eaddda2a Binary files /dev/null and b/static/imgs/13.jpg differ diff --git a/static/imgs/14.jpg b/static/imgs/14.jpg new file mode 100644 index 0000000000000000000000000000000000000000..88c981d55d75e89bb10682e4b161cdb8b13e6619 Binary files /dev/null and b/static/imgs/14.jpg differ diff --git a/static/imgs/15.jpg b/static/imgs/15.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5cc8b6a411df2531e02230bfba368d78321c3d11 Binary files /dev/null and b/static/imgs/15.jpg differ diff --git a/static/imgs/16.jpg b/static/imgs/16.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b8125fef68e63541f4a813c3fc310923166b8cb3 Binary files /dev/null and b/static/imgs/16.jpg differ diff --git a/static/imgs/2.jpg b/static/imgs/2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a330848b20c10a958a190dd7799db40b02fcd702 Binary files /dev/null and b/static/imgs/2.jpg differ diff --git a/static/imgs/3.jpg b/static/imgs/3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..66e2dcbe23bc887ccd439057921241806719939c Binary files /dev/null and b/static/imgs/3.jpg differ diff --git a/static/imgs/4.jpg b/static/imgs/4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..913573813b48c275b815f4846b1016f9d6349427 Binary files /dev/null and b/static/imgs/4.jpg differ diff --git a/static/imgs/5.jpg b/static/imgs/5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8bf616cc6e5c68cabe7901b08fc40c4969125ac5 Binary files /dev/null and b/static/imgs/5.jpg differ diff --git a/static/imgs/6.jpg b/static/imgs/6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..51076af41d9385152bd2661a5a1200756c479589 Binary files /dev/null and b/static/imgs/6.jpg differ diff --git a/static/imgs/7.jpg b/static/imgs/7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7178ff00012c6405ba9918373e4a459bd3e2c7e2 Binary files /dev/null and b/static/imgs/7.jpg differ diff --git a/static/imgs/8.jpg b/static/imgs/8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c3a7be68d3c1dd53c605c4c951c509c4a8fc9fac Binary files /dev/null and b/static/imgs/8.jpg differ diff --git a/static/imgs/9.jpg b/static/imgs/9.jpg new file mode 100644 index 0000000000000000000000000000000000000000..edbba5c8407a87470094b15df845ef2407b8bd5b Binary files /dev/null and b/static/imgs/9.jpg differ diff --git a/templates/index1.html b/templates/index1.html new file mode 100644 index 0000000000000000000000000000000000000000..e1465bbcddb5bb619764555a56a2ca196764f62e --- /dev/null +++ b/templates/index1.html @@ -0,0 +1,84 @@ + + + + + + + 618·疯狂购物节 + + + +
+ +
+
+ {%for i in range(datas|length)%} +
+ +
+ {{datas[i].name}} +
+ + +
+ {%endfor%} +
+ + + + \ No newline at end of file diff --git a/templates/info.html b/templates/info.html new file mode 100644 index 0000000000000000000000000000000000000000..e612a259e027d11c4289056c66ceb4c504a594f3 --- /dev/null +++ b/templates/info.html @@ -0,0 +1,91 @@ + + + + + + + Document + + + + + + +
+
+
+ +
+ {{datas[id].name}} +
+
+
+ {{datas[id].info}} +
+
+
+ 更多喜欢 +
+
+ + {%for item in result%} +
+ +
+ {{datas[item.id].name}} + + {{item.angle}} +
+
+ {%endfor%} +
+
+ + + + \ No newline at end of file diff --git "a/\351\241\271\347\233\256\350\257\264\346\230\216\344\271\246/\351\245\260\345\223\201\345\257\274\350\210\252\347\263\273\347\273\237.docx" "b/\351\241\271\347\233\256\350\257\264\346\230\216\344\271\246/\351\245\260\345\223\201\345\257\274\350\210\252\347\263\273\347\273\237.docx" new file mode 100644 index 0000000000000000000000000000000000000000..817787f70f0bd2febf27c7c812f3d2af5455255c Binary files /dev/null and "b/\351\241\271\347\233\256\350\257\264\346\230\216\344\271\246/\351\245\260\345\223\201\345\257\274\350\210\252\347\263\273\347\273\237.docx" differ