index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  6. <title>{$Think.config.app.app_name}简易安装向导</title>
  7. <link rel="stylesheet" href="__STATIC__/elementui/element-ui.css">
  8. <script src="__STATIC__/js/vue.js"></script>
  9. <script src="__STATIC__/js/jquery-2.0.3.min.js"></script>
  10. <script src="__STATIC__/elementui/element-ui.js"></script>
  11. </head>
  12. <body>
  13. <div id="el-app">
  14. <el-card class="box-card header-card" style="margin-bottom: 20px;">
  15. <header class="header" align="center">
  16. <div class="header-content">
  17. <div class="header-logo">
  18. <el-avatar src="{$Think.config.app.app_logo}" :size="50">
  19. </el-avatar>
  20. </div>
  21. <div class="contact-us" align="left">
  22. <div><a class="main-color" href="http://img.raingad.com/index.html"> {$Think.config.app.app_name} </a>for {$Think.config.app.app_verison} 安装向导</div>
  23. <div>QQ交流群: <a href="https://jq.qq.com/?_wv=1027&k=jMQAt9lh" target="_blank">336921267</a></div>
  24. </div>
  25. </div>
  26. </header>
  27. </el-card>
  28. <el-card class="container box-card" style="padding:0">
  29. <el-steps :active="action" simple finish-status="success">
  30. <el-step title="IM介绍"> </el-step>
  31. <el-step title="环境检测"> </el-step>
  32. <el-step title="连接数据库"> </el-step>
  33. <el-step title="安装完成"> </el-step>
  34. </el-steps>
  35. <div class="step-item" v-if="action==0">
  36. <div class="setting-version">
  37. <b> 免责申明:</b>
  38. <p><span class="main-color"> {$Think.config.app.app_name} </span>是由个人开发者《<a href="https://gitee.com/lvzhe-lcoce" target="_blank">raingad@foxmail.com</a>》开发,以下简称“本软件”,用户出于自愿而使用本软件,必须了解使用本软件的风险,本软件只用作学习交流使用,我们不承诺对免费用户提供任何形式的技术支持, 并且不能作为商业用途使用,若因为使用本软件产生的侵权行为一律与作者无关。如果本软件有侵权行为,请联系作者删除!
  39. </p>
  40. <b> 软件地址:</b>
  41. <p>前端地址:<a href="https://gitee.com/raingad/im-chat-front" target="_blank">https://gitee.com/raingad/im-chat-front</a></p>
  42. <p>后端地址:<a href="https://gitee.com/raingad/im-instant-chat" target="_blank">https://gitee.com/raingad/im-instant-chat</a></p>
  43. <b> 支持功能:</b>
  44. <ul>
  45. <li v-for="item in funcList">${item.text}</li>
  46. </ul>
  47. </div>
  48. <div class="setting-version" style="color: #a6a6a6">
  49. <p>后端技术栈:thinkphp6+workerman+redis</p>
  50. <p>前端技术栈:vue+Lemon-IMUI+element-UI</p>
  51. </div>
  52. </div>
  53. <div class="step-item" v-if="action==1">
  54. <h4>环境状态</h4>
  55. <el-table :data="env" border style="width: 100%" size="mini">
  56. <el-table-column prop="name" label="检查项" align="center">
  57. </el-table-column>
  58. <el-table-column prop="description" label="建议要求" width="300px" align="center">
  59. </el-table-column>
  60. <el-table-column prop="value" label="当前环境" align="center">
  61. </el-table-column>
  62. <el-table-column prop="status" label="是否通过" align="center">
  63. <template slot-scope="scope">
  64. <span :class="scope.row.status === 'ok' ? 'fc-success' : 'fc-danger'">${scope.row.status}</span>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <h4>文件夹权限</h4>
  69. <el-table :data="dir" border style="width: 100%" size="mini">
  70. <el-table-column prop="dir" label="目录检查项" width="300px" align="center">
  71. </el-table-column>
  72. <el-table-column prop="value" label="当前环境" align="center">
  73. </el-table-column>
  74. <el-table-column prop="status" label="是否通过" align="center">
  75. <template slot-scope="scope">
  76. <span :class="scope.row.status === 'ok' ? 'fc-success' : 'fc-danger'">${scope.row.status}</span>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <div align="center" style="margin-top:15px;">
  81. <el-button round @click="reCheckEnv" :loading="loading">重新检测</el-button>
  82. </div>
  83. </div>
  84. <div class="step-item" v-if="action==2" align="center">
  85. <div class="step-form">
  86. <el-alert
  87. title="如果未设置成功,请将根目录下[example.env]更名为为[.env],并填写好相关参数"
  88. type="warning">
  89. </el-alert>
  90. <h4>请填写数据库信息</h4>
  91. <el-form ref="form" :model="form" label-width="120px">
  92. <el-form-item label="服务器地址">
  93. <el-input v-model="form.hostname">
  94. <template slot="append">数据库地址一般为:127.0.0.1</template>
  95. </el-input>
  96. </el-form-item>
  97. <el-form-item label="数据库">
  98. <el-input v-model="form.database"></el-input>
  99. </el-form-item>
  100. <el-form-item label="表前缀">
  101. <el-input v-model="form.prefix">
  102. <template slot="append">默认为yu_</template>
  103. </el-input>
  104. </el-form-item>
  105. <el-form-item label="数据库用户名">
  106. <el-input v-model="form.username">
  107. <template slot="append">生产环境建议创建独立账户</template>
  108. </el-input>
  109. </el-form-item>
  110. <el-form-item label="数据库密码">
  111. <el-input v-model="form.password"></el-input>
  112. </el-form-item>
  113. <el-form-item label="端口">
  114. <el-input v-model="form.hostport">
  115. <template slot="append">数据库端口一般为:3306</template>
  116. </el-input>
  117. </el-form-item>
  118. <h4>redis配置</h4>
  119. <el-form-item label="服务器地址">
  120. <el-input v-model="form.redishost">
  121. <template slot="append">默认为127.0.0.1</template>
  122. </el-input>
  123. </el-form-item>
  124. <el-form-item label="端口">
  125. <el-input v-model="form.redisport">
  126. <template slot="append">默认为6379</template>
  127. </el-input>
  128. </el-form-item>
  129. <el-form-item label="密码">
  130. <el-input v-model="form.redispass">
  131. <template slot="append">可以为空</template>
  132. </el-input>
  133. </el-form-item>
  134. </el-form>
  135. </div>
  136. </div>
  137. <div class="step-item" v-if="action==3">
  138. <p>开始安装...</p>
  139. <div id='install-process'>
  140. </div>
  141. </div>
  142. <div class="step-item" v-if="action==4">
  143. <div class="setting-version">
  144. <p>您已成功安装本程序,现在您还需最后一步即可使用聊天程序!</p>
  145. <p>管理员账号:<b style="font-size:18px">administrator</b>;密码:<b style="font-size:18px">123456</b>;进入后再聊天界面的左下角可以进入后台。</p>
  146. <h4>启动消息推送</h4>
  147. <p>第一种方式:进入终端,输入[ <code>php think worker:gateway start -d</code> ] 或者 [ <code>php start.php start -d</code> ] 即可启动服务</p>
  148. <p>第二种方式:linux上可以直接在后台启动服务,首次启动必须要先进行第一种方式调试没问题后才能用这种方式</p>
  149. <p>windows启动直接运行根目录的start_for_win.bat,推送服务不建议在windows上运行,不稳定,生产环境请使用linux。</p>
  150. <p>PS:消息推送的服务器必须开启8282端口,并在nginx配置文件中配置反向代理。如需更改,请修改[ <b>app\worker\start_gateway.php</b> ]中的8282端口</p>
  151. <h4>前台地址:</h4>
  152. <p>浏览器访问:<a href="{:request()->domain()}/index.html">{:request()->domain()}/index.html</a></p>
  153. <div>QQ交流群: <a href="https://jq.qq.com/?_wv=1027&k=jMQAt9lh" target="_blank">336921267</a></div>
  154. </div>
  155. </div>
  156. <hr style="border: 1px solid #f5f5f5;">
  157. <div class="next-button" align="center" v-if="!isDone">
  158. <el-button @click="pre" :disabled="preDisabled" v-text="preText"></el-button>
  159. <el-button type="primary" @click="next" :disabled="nextDisabled" v-text="nextText"></el-button>
  160. </div>
  161. <div class="next-button" align="center" v-if="isDone">
  162. <el-button type="success" @click="openSys" v-text="doneText"> </el-button>
  163. </div>
  164. </el-card>
  165. <div class="footer-wrapper" align="center">
  166. <footer class="footer">
  167. ©{:date("Y")} {$Think.config.app.app_name} for {$Think.config.app.app_version}
  168. </footer>
  169. </div>
  170. </div>
  171. </body>
  172. <script>
  173. var app = new Vue({
  174. delimiters: ['${', '}'],
  175. el: '#el-app',
  176. data() {
  177. return {
  178. action: 0,
  179. preDisabled: true,
  180. nextDisabled: false,
  181. preText: "上一步",
  182. nextText: "下一步",
  183. isDone: false,
  184. doneText: '进入系统',
  185. env: [],
  186. dir: [],
  187. database: [],
  188. status: 1,
  189. loading: false,
  190. form: {
  191. hostname: '127.0.0.1',
  192. database: 'im',
  193. username: 'root',
  194. password: '',
  195. hostport: 3306,
  196. prefix: 'yu_',
  197. redishost: '127.0.0.1',
  198. redisport: '6379',
  199. redispass: '',
  200. },
  201. funcList:[
  202. {
  203. icon:'el-icon-chat-line-round',
  204. text:'支持单聊和群聊,支持发送表情、图片、语音、视频和文件消息',
  205. },
  206. {
  207. icon:'el-icon-potato-strips',
  208. text:'单聊支持消息已读未读的状态显示,在线状态显示',
  209. },
  210. {
  211. icon:'el-icon-user',
  212. text:'群聊创建、删除和群成员管理、群公告、群禁言、@群成员等',
  213. },
  214. {
  215. icon:'el-icon-ice-cream-round',
  216. text:'支持置顶联系人,消息免打扰;支持设置新消息声音提醒,浏览器通知',
  217. },
  218. {
  219. icon:'el-icon-video-camera',
  220. text:'支持一对一音视频通话(和移动端不互通)',
  221. },
  222. {
  223. icon:'el-icon-milk-tea',
  224. text:'支持文件、图片和绝大部分媒体文件在线预览',
  225. },
  226. {
  227. icon:'el-icon-mobile-phone',
  228. text:'支持移动端(H5和APP),支持简易后台管理',
  229. }
  230. ]
  231. }
  232. },
  233. watch: {
  234. action(val) {
  235. this.status = 1;
  236. if (val == 0) {
  237. this.preDisabled = true;
  238. } else {
  239. this.preDisabled = false;
  240. }
  241. if (val == 1) {
  242. this.getEnv();
  243. }
  244. if (val == 3) {
  245. this.process('正在写入数据库...');
  246. var _this = this;
  247. setTimeout(function() {
  248. _this.install()
  249. }, 1000);
  250. } else {
  251. $('#install-process').html('');
  252. }
  253. if (val == 4) {
  254. this.isDone = true;
  255. }
  256. },
  257. status(val) {
  258. if (val == 0) {
  259. this.nextDisabled = true;
  260. } else {
  261. this.nextDisabled = false;
  262. }
  263. }
  264. },
  265. methods: {
  266. next() {
  267. if (this.action == 2) {
  268. this.checkDatabase();
  269. } else if (this.action < 4) {
  270. this.action++;
  271. }
  272. },
  273. pre() {
  274. if (this.action > 0) {
  275. this.action--;
  276. }
  277. },
  278. openSys() {
  279. window.location.href = "{:request()->domain()}/index.html";
  280. },
  281. getEnv() {
  282. var _this = this;
  283. $.post("{:url('install/getEnv')}", {}, function(res) {
  284. if (res.code == 0) {
  285. _this.env = res.data.env;
  286. _this.dir = res.data.dir;
  287. _this.status = res.data.status;
  288. }
  289. _this.loading = false;
  290. })
  291. },
  292. checkDatabase() {
  293. var _this = this;
  294. $.post("{:url('install/checkDatabase')}", {
  295. form: this.form
  296. }, function(res) {
  297. if (res.code == 0) {
  298. _this.status = res.data.status;
  299. _this.action++;
  300. } else {
  301. _this.$message.error(res.msg);
  302. }
  303. _this.loading = false;
  304. })
  305. },
  306. install() {
  307. this.status = 0;
  308. var _this = this;
  309. $.post("{:url('install/install')}", {}, function(res) {
  310. if (res.code == 0) {
  311. setTimeout(function() {
  312. _this.process('数据库写入成功,执行sql语句 ' + 1 + ' 条!');
  313. setTimeout(function() {
  314. _this.process('正在跳转...');
  315. setTimeout(function() {
  316. _this.action++;
  317. }, 1000);
  318. }, 1000);
  319. }, 1000);
  320. _this.status = res.data.status;
  321. } else {
  322. setTimeout(_this.process("<span class='fc-danger'>" + res.msg + "</span>"), 1000);
  323. _this.isDone = true;
  324. }
  325. _this.loading = false;
  326. })
  327. },
  328. reCheckEnv() {
  329. this.loading = true;
  330. this.getEnv();
  331. },
  332. process(text) {
  333. var html = "<p>" + text + "</p>";
  334. this.$nextTick(() => {
  335. $('#install-process').append(html);
  336. });
  337. }
  338. }
  339. })
  340. </script>
  341. <style>
  342. body {
  343. background-color: #f5f5f5;
  344. margin: 0;
  345. padding: 0
  346. }
  347. .header-card {
  348. margin-bottom: 15px;
  349. }
  350. .header-card .el-card__body {
  351. padding: 10px;
  352. }
  353. .header-content {
  354. display: flex;
  355. flex-direction: row;
  356. align-items: center;
  357. flex-wrap: nowrap;
  358. justify-content: flex-start;
  359. width: 320px;
  360. }
  361. .header-logo {
  362. margin-right: 20px;
  363. }
  364. .contact-us {
  365. margin: 10px 0;
  366. }
  367. .main-color {
  368. color: #409eff;
  369. }
  370. .step-item {
  371. height: 550px;
  372. overflow: auto;
  373. padding: 20px;
  374. }
  375. .container {
  376. width: 800px;
  377. margin: 0 auto;
  378. }
  379. .container .el-card__body {
  380. padding: 0
  381. }
  382. .next-button {
  383. margin: 12px 0;
  384. }
  385. .setting-version,
  386. .install-process {
  387. line-height: 1.3;
  388. }
  389. .step-form {
  390. width: 600px
  391. }
  392. .el-input-group__append {
  393. width: 190px;
  394. }
  395. .footer-wrapper {
  396. margin: 15px auto;
  397. color: #888888
  398. }
  399. .fc-danger {
  400. color: #f56c6c;
  401. }
  402. .fc-warning {
  403. color: #e6a23c;
  404. }
  405. .fc-success {
  406. color: #67c23a;
  407. }
  408. .fc-info {
  409. color: #909399;
  410. }
  411. .fc-primary {
  412. color: #409eff;
  413. }
  414. </style>
  415. </html>